react-native-google-mobile-ads 6.1.0 → 6.2.2
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/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +14 -4
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java +9 -3
- package/docs/european-user-consent.mdx +31 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m +1 -2
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.m +14 -5
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +2 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m +16 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m +1 -2
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.m +1 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m +18 -18
- package/lib/commonjs/AdsConsent.js +3 -3
- package/lib/commonjs/AdsConsent.js.map +1 -1
- package/lib/commonjs/BannerAdSize.js +2 -0
- package/lib/commonjs/BannerAdSize.js.map +1 -1
- package/lib/commonjs/common/index.js +6 -0
- package/lib/commonjs/common/index.js.map +1 -1
- package/lib/commonjs/validateAdRequestConfiguration.js +3 -3
- package/lib/commonjs/validateAdRequestConfiguration.js.map +1 -1
- package/lib/commonjs/validateAdRequestOptions.js +1 -1
- package/lib/commonjs/validateAdRequestOptions.js.map +1 -1
- package/lib/commonjs/validateAdShowOptions.js +1 -1
- package/lib/commonjs/validateAdShowOptions.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/AdsConsent.js +4 -4
- package/lib/module/AdsConsent.js.map +1 -1
- package/lib/module/BannerAdSize.js +2 -0
- package/lib/module/BannerAdSize.js.map +1 -1
- package/lib/module/common/index.js +4 -1
- package/lib/module/common/index.js.map +1 -1
- package/lib/module/validateAdRequestConfiguration.js +4 -4
- package/lib/module/validateAdRequestConfiguration.js.map +1 -1
- package/lib/module/validateAdRequestOptions.js +2 -2
- package/lib/module/validateAdRequestOptions.js.map +1 -1
- package/lib/module/validateAdShowOptions.js +2 -2
- package/lib/module/validateAdShowOptions.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/BannerAdSize.d.ts +10 -1
- package/lib/typescript/common/index.d.ts +1 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +8 -8
- package/src/AdsConsent.ts +4 -4
- package/src/BannerAdSize.ts +12 -1
- package/src/common/index.ts +8 -1
- package/src/validateAdRequestConfiguration.ts +4 -4
- package/src/validateAdRequestOptions.ts +2 -2
- package/src/validateAdShowOptions.ts +2 -2
- package/src/version.ts +1 -1
|
@@ -58,6 +58,7 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
58
58
|
private List<AdSize> sizes;
|
|
59
59
|
private String unitId;
|
|
60
60
|
private Boolean manualImpressionsEnabled;
|
|
61
|
+
private boolean propsChanged;
|
|
61
62
|
private boolean isFluid;
|
|
62
63
|
|
|
63
64
|
@Nonnull
|
|
@@ -102,13 +103,13 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
102
103
|
@ReactProp(name = "unitId")
|
|
103
104
|
public void setUnitId(ReactViewGroup reactViewGroup, String value) {
|
|
104
105
|
unitId = value;
|
|
105
|
-
|
|
106
|
+
propsChanged = true;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
@ReactProp(name = "request")
|
|
109
110
|
public void setRequest(ReactViewGroup reactViewGroup, ReadableMap value) {
|
|
110
111
|
request = ReactNativeGoogleMobileAdsCommon.buildAdRequest(value);
|
|
111
|
-
|
|
112
|
+
propsChanged = true;
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
@ReactProp(name = "sizes")
|
|
@@ -121,13 +122,22 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
sizes = sizeList;
|
|
124
|
-
|
|
125
|
+
propsChanged = true;
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
@ReactProp(name = "manualImpressionsEnabled")
|
|
128
129
|
public void setManualImpressionsEnabled(ReactViewGroup reactViewGroup, boolean value) {
|
|
129
130
|
this.manualImpressionsEnabled = value;
|
|
130
|
-
|
|
131
|
+
propsChanged = true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@Override
|
|
135
|
+
public void onAfterUpdateTransaction(@NonNull ReactViewGroup reactViewGroup) {
|
|
136
|
+
super.onAfterUpdateTransaction(reactViewGroup);
|
|
137
|
+
if (propsChanged) {
|
|
138
|
+
requestAd(reactViewGroup);
|
|
139
|
+
}
|
|
140
|
+
propsChanged = false;
|
|
131
141
|
}
|
|
132
142
|
|
|
133
143
|
private BaseAdView initAdView(ReactViewGroup reactViewGroup) {
|
package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java
CHANGED
|
@@ -40,7 +40,7 @@ import javax.annotation.Nullable;
|
|
|
40
40
|
|
|
41
41
|
public class ReactNativeGoogleMobileAdsCommon {
|
|
42
42
|
|
|
43
|
-
static AdSize getAdSizeForAdaptiveBanner(ReactViewGroup reactViewGroup) {
|
|
43
|
+
static AdSize getAdSizeForAdaptiveBanner(String preDefinedAdSize, ReactViewGroup reactViewGroup) {
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
46
|
Display display =
|
|
@@ -52,6 +52,10 @@ public class ReactNativeGoogleMobileAdsCommon {
|
|
|
52
52
|
display.getMetrics(outMetrics);
|
|
53
53
|
int adWidth = (int) (outMetrics.widthPixels / outMetrics.density);
|
|
54
54
|
|
|
55
|
+
if ("INLINE_ADAPTIVE_BANNER".equals(preDefinedAdSize)) {
|
|
56
|
+
return AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(
|
|
57
|
+
reactViewGroup.getContext(), adWidth);
|
|
58
|
+
}
|
|
55
59
|
return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(
|
|
56
60
|
reactViewGroup.getContext(), adWidth);
|
|
57
61
|
} catch (Exception e) {
|
|
@@ -60,8 +64,10 @@ public class ReactNativeGoogleMobileAdsCommon {
|
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
static AdSize getAdSize(String preDefinedAdSize, ReactViewGroup reactViewGroup) {
|
|
63
|
-
if (
|
|
64
|
-
|
|
67
|
+
if (preDefinedAdSize.matches(
|
|
68
|
+
"ADAPTIVE_BANNER|ANCHORED_ADAPTIVE_BANNER|INLINE_ADAPTIVE_BANNER")) {
|
|
69
|
+
return ReactNativeGoogleMobileAdsCommon.getAdSizeForAdaptiveBanner(
|
|
70
|
+
preDefinedAdSize, reactViewGroup);
|
|
65
71
|
} else {
|
|
66
72
|
return ReactNativeGoogleMobileAdsCommon.stringToAdSize(preDefinedAdSize);
|
|
67
73
|
}
|
|
@@ -18,6 +18,16 @@ ad requests to Google serve personalized ads, with ad selection based on the use
|
|
|
18
18
|
|
|
19
19
|
## Handling consent
|
|
20
20
|
|
|
21
|
+
To setup and configure ads consent collection, first of all:
|
|
22
|
+
|
|
23
|
+
- Enable and configure GDPR and IDFA messaging in the [Privacy & messaging section of AdMob's Web Console](https://apps.admob.com/v2/privacymessaging).
|
|
24
|
+
|
|
25
|
+
- For Android, add the following rule into
|
|
26
|
+
`android/app/proguard-rules.pro`:
|
|
27
|
+
```
|
|
28
|
+
-keep class com.google.android.gms.internal.consent_sdk.** { *; }
|
|
29
|
+
```
|
|
30
|
+
|
|
21
31
|
### Delaying app measurement
|
|
22
32
|
|
|
23
33
|
By default, the Google Mobile Ads SDK initializes app measurement and begins sending user-level event data to Google immediately when the app starts.
|
|
@@ -83,6 +93,13 @@ The method returns an `AdsConsentInfo` interface, which provides information abo
|
|
|
83
93
|
- `OBTAINED`: User consent already obtained.
|
|
84
94
|
- **isConsentFormAvailable**: A boolean value. If `true` a consent form is available.
|
|
85
95
|
|
|
96
|
+
**Note:** The return status of this call is the status of *form presentation and response collection*, **not
|
|
97
|
+
the the actual user consent**. It simply indicates if you now have a consent response to decode.
|
|
98
|
+
(_i.e._ if user consent is **required**, the form has been presented, and user has
|
|
99
|
+
**denied** the consent, the status returned by this method will be `OBTAINED`,
|
|
100
|
+
and not `REQUIRED` as some may expect). To check the actual consent status
|
|
101
|
+
see [Inspecting consent choices] below.
|
|
102
|
+
|
|
86
103
|
### Gathering user consent
|
|
87
104
|
|
|
88
105
|
To request consent, call these methods as early as possible within your app before presenting any ads.
|
|
@@ -132,6 +149,11 @@ if (storeAndAccessInformationOnDevice === false) {
|
|
|
132
149
|
}
|
|
133
150
|
```
|
|
134
151
|
|
|
152
|
+
**Note:** Don't try to use this functionality to enforce user consent on iOS,
|
|
153
|
+
this will likely result in failed app review upon submission to Apple Store, based on [review guideline 3.2.2.vi](https://developer.apple.com/app-store/review/guidelines/#3.2.2):
|
|
154
|
+
|
|
155
|
+
> ...Apps should not require users to rate the app, review the app, watch videos, download other apps, tap on advertisements, enable tracking...
|
|
156
|
+
|
|
135
157
|
### Testing
|
|
136
158
|
|
|
137
159
|
When developing the consent flow, the behavior of the `AdsConsent` responses may not be reliable due to the environment
|
|
@@ -167,3 +189,12 @@ import { AdsConsent } from 'react-native-google-mobile-ads';
|
|
|
167
189
|
|
|
168
190
|
AdsConsent.reset();
|
|
169
191
|
```
|
|
192
|
+
|
|
193
|
+
### Troubleshooting
|
|
194
|
+
|
|
195
|
+
In case of troubles, double-check the original documentation for underlying
|
|
196
|
+
UMP SDK for [Android](https://developers.google.com/admob/ump/android/quick-start) /
|
|
197
|
+
[iOS](https://developers.google.com/admob/ump/ios/quick-start).
|
|
198
|
+
|
|
199
|
+
<!-- links -->
|
|
200
|
+
[Inspecting consent choices]: #inspecting-consent-choices
|
|
@@ -82,8 +82,7 @@ RCT_EXPORT_METHOD(appOpenShow
|
|
|
82
82
|
: (RCTPromiseResolveBlock)resolve
|
|
83
83
|
: (RCTPromiseRejectBlock)reject) {
|
|
84
84
|
if (self.appOpenAd) {
|
|
85
|
-
[self.appOpenAd
|
|
86
|
-
presentFromRootViewController:RCTSharedApplication().delegate.window.rootViewController];
|
|
85
|
+
[self.appOpenAd presentFromRootViewController:RNGoogleMobileAdsCommon.currentViewController];
|
|
87
86
|
resolve([NSNull null]);
|
|
88
87
|
} else {
|
|
89
88
|
[RNSharedUtils
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
#import <GoogleMobileAds/GADBannerView.h>
|
|
22
22
|
#import <GoogleMobileAds/GADBannerViewDelegate.h>
|
|
23
23
|
#import <React/RCTUIManager.h>
|
|
24
|
+
#import <React/RCTView.h>
|
|
24
25
|
#import "RNGoogleMobileAdsCommon.h"
|
|
25
26
|
|
|
26
|
-
@interface BannerComponent :
|
|
27
|
+
@interface BannerComponent : RCTView <GADBannerViewDelegate, GADAppEventDelegate>
|
|
27
28
|
|
|
28
29
|
@property GADBannerView *banner;
|
|
29
30
|
@property(nonatomic, assign) BOOL requested;
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
@property(nonatomic, copy) NSString *unitId;
|
|
33
34
|
@property(nonatomic, copy) NSDictionary *request;
|
|
34
35
|
@property(nonatomic, copy) NSNumber *manualImpressionsEnabled;
|
|
36
|
+
@property(nonatomic, assign) BOOL propsChanged;
|
|
35
37
|
|
|
36
38
|
@property(nonatomic, copy) RCTBubblingEventBlock onNativeEvent;
|
|
37
39
|
|
|
@@ -41,6 +43,13 @@
|
|
|
41
43
|
|
|
42
44
|
@implementation BannerComponent
|
|
43
45
|
|
|
46
|
+
- (void)didSetProps:(NSArray<NSString *> *)changedProps {
|
|
47
|
+
if (_propsChanged) {
|
|
48
|
+
[self requestAd];
|
|
49
|
+
}
|
|
50
|
+
_propsChanged = false;
|
|
51
|
+
}
|
|
52
|
+
|
|
44
53
|
- (void)initBanner:(GADAdSize)adSize {
|
|
45
54
|
if (_requested) {
|
|
46
55
|
[_banner removeFromSuperview];
|
|
@@ -60,7 +69,7 @@
|
|
|
60
69
|
|
|
61
70
|
- (void)setUnitId:(NSString *)unitId {
|
|
62
71
|
_unitId = unitId;
|
|
63
|
-
|
|
72
|
+
_propsChanged = true;
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
- (void)setSizes:(NSArray *)sizes {
|
|
@@ -74,17 +83,17 @@
|
|
|
74
83
|
}
|
|
75
84
|
}];
|
|
76
85
|
_sizes = adSizes;
|
|
77
|
-
|
|
86
|
+
_propsChanged = true;
|
|
78
87
|
}
|
|
79
88
|
|
|
80
89
|
- (void)setRequest:(NSDictionary *)request {
|
|
81
90
|
_request = request;
|
|
82
|
-
|
|
91
|
+
_propsChanged = true;
|
|
83
92
|
}
|
|
84
93
|
|
|
85
94
|
- (void)setManualImpressionsEnabled:(BOOL *)manualImpressionsEnabled {
|
|
86
95
|
_manualImpressionsEnabled = [NSNumber numberWithBool:manualImpressionsEnabled];
|
|
87
|
-
|
|
96
|
+
_propsChanged = true;
|
|
88
97
|
}
|
|
89
98
|
|
|
90
99
|
- (void)requestAd {
|
|
@@ -190,9 +190,13 @@ NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD = @"rewarded_earn
|
|
|
190
190
|
return GADAdSizeFullBanner;
|
|
191
191
|
} else if ([value isEqualToString:@"LEADERBOARD"]) {
|
|
192
192
|
return GADAdSizeLeaderboard;
|
|
193
|
-
} else if ([value isEqualToString:@"ADAPTIVE_BANNER"]
|
|
193
|
+
} else if ([value isEqualToString:@"ADAPTIVE_BANNER"] ||
|
|
194
|
+
[value isEqualToString:@"ANCHORED_ADAPTIVE_BANNER"]) {
|
|
194
195
|
CGFloat viewWidth = [[UIScreen mainScreen] bounds].size.width;
|
|
195
196
|
return GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth);
|
|
197
|
+
} else if ([value isEqualToString:@"INLINE_ADAPTIVE_BANNER"]) {
|
|
198
|
+
CGFloat viewWidth = [[UIScreen mainScreen] bounds].size.width;
|
|
199
|
+
return GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(viewWidth);
|
|
196
200
|
} else {
|
|
197
201
|
return GADAdSizeBanner;
|
|
198
202
|
}
|
|
@@ -205,4 +209,15 @@ NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD = @"rewarded_earn
|
|
|
205
209
|
return [unitId hasPrefix:@"/"];
|
|
206
210
|
}
|
|
207
211
|
|
|
212
|
+
+ (UIViewController *)currentViewController {
|
|
213
|
+
UIViewController *controller = [[[UIApplication sharedApplication] keyWindow] rootViewController];
|
|
214
|
+
UIViewController *presentedController = controller.presentedViewController;
|
|
215
|
+
|
|
216
|
+
while (presentedController && ![presentedController isBeingDismissed]) {
|
|
217
|
+
controller = presentedController;
|
|
218
|
+
presentedController = controller.presentedViewController;
|
|
219
|
+
}
|
|
220
|
+
return controller;
|
|
221
|
+
}
|
|
222
|
+
|
|
208
223
|
@end
|
|
@@ -121,8 +121,7 @@ RCT_EXPORT_METHOD(interstitialShow
|
|
|
121
121
|
: (RCTPromiseRejectBlock)reject) {
|
|
122
122
|
GADInterstitialAd *interstitial = interstitialMap[requestId];
|
|
123
123
|
if (interstitial) {
|
|
124
|
-
[interstitial
|
|
125
|
-
presentFromRootViewController:RCTSharedApplication().delegate.window.rootViewController];
|
|
124
|
+
[interstitial presentFromRootViewController:RNGoogleMobileAdsCommon.currentViewController];
|
|
126
125
|
resolve([NSNull null]);
|
|
127
126
|
} else {
|
|
128
127
|
[RNSharedUtils
|
|
@@ -142,7 +142,7 @@ RCT_EXPORT_METHOD(rewardedInterstitialShow
|
|
|
142
142
|
|
|
143
143
|
if (rewardedInterstitialAd) {
|
|
144
144
|
[rewardedInterstitialAd
|
|
145
|
-
presentFromRootViewController:
|
|
145
|
+
presentFromRootViewController:RNGoogleMobileAdsCommon.currentViewController
|
|
146
146
|
userDidEarnRewardHandler:^{
|
|
147
147
|
GADAdReward *reward = rewardedInterstitialAd.adReward;
|
|
148
148
|
NSMutableDictionary *data = [NSMutableDictionary dictionary];
|
|
@@ -141,24 +141,24 @@ RCT_EXPORT_METHOD(rewardedShow
|
|
|
141
141
|
GADRewardedAd *rewardedAd = rewardedMap[requestId];
|
|
142
142
|
|
|
143
143
|
if (rewardedAd) {
|
|
144
|
-
[rewardedAd
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
144
|
+
[rewardedAd presentFromRootViewController:RNGoogleMobileAdsCommon.currentViewController
|
|
145
|
+
userDidEarnRewardHandler:^{
|
|
146
|
+
GADAdReward *reward = rewardedAd.adReward;
|
|
147
|
+
NSMutableDictionary *data = [NSMutableDictionary dictionary];
|
|
148
|
+
if (reward.type != nil) {
|
|
149
|
+
[data setValue:reward.type forKey:@"type"];
|
|
150
|
+
}
|
|
151
|
+
if (reward.amount != nil) {
|
|
152
|
+
[data setValue:reward.amount forKey:@"amount"];
|
|
153
|
+
}
|
|
154
|
+
[RNGoogleMobileAdsCommon
|
|
155
|
+
sendAdEvent:GOOGLE_MOBILE_ADS_EVENT_REWARDED
|
|
156
|
+
requestId:requestId
|
|
157
|
+
type:GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD
|
|
158
|
+
adUnitId:rewardedAd.adUnitID
|
|
159
|
+
error:nil
|
|
160
|
+
data:data];
|
|
161
|
+
}];
|
|
162
162
|
} else {
|
|
163
163
|
[RNSharedUtils
|
|
164
164
|
rejectPromiseWithUserInfo:reject
|
|
@@ -42,15 +42,15 @@ const AdsConsent = {
|
|
|
42
42
|
throw new Error("AdsConsent.requestInfoUpdate(*) 'options' expected an object value.");
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
if ((0, _common.
|
|
45
|
+
if ((0, _common.isPropertySet)(options, 'debugGeography') && options.debugGeography !== _AdsConsentDebugGeography.AdsConsentDebugGeography.DISABLED && options.debugGeography !== _AdsConsentDebugGeography.AdsConsentDebugGeography.EEA && options.debugGeography !== _AdsConsentDebugGeography.AdsConsentDebugGeography.NOT_EEA) {
|
|
46
46
|
throw new Error("AdsConsent.requestInfoUpdate(*) 'options.debugGeography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.");
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
if ((0, _common.
|
|
49
|
+
if ((0, _common.isPropertySet)(options, 'tagForUnderAgeOfConsent') && !(0, _common.isBoolean)(options.tagForUnderAgeOfConsent)) {
|
|
50
50
|
throw new Error("AdsConsent.requestInfoUpdate(*) 'options.tagForUnderAgeOfConsent' expected a boolean value.");
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
if ((0, _common.
|
|
53
|
+
if ((0, _common.isPropertySet)(options, 'testDeviceIdentifiers')) {
|
|
54
54
|
if (!(0, _common.isArray)(options.testDeviceIdentifiers)) {
|
|
55
55
|
throw new Error("AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.");
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["AdsConsent.ts"],"names":["native","NativeModules","RNGoogleMobileAdsConsentModule","AdsConsent","requestInfoUpdate","options","Error","debugGeography","AdsConsentDebugGeography","DISABLED","EEA","NOT_EEA","tagForUnderAgeOfConsent","testDeviceIdentifiers","deviceId","showForm","reset","getTCString","getTCModel","tcString","TCString","decode","getUserChoices","tcModel","e","TCModel","__DEV__","console","warn","activelyScanDeviceCharacteristicsForIdentification","specialFeatureOptins","has","AdsConsentSpecialFeatures","ACTIVELY_SCAN_DEVICE_CHARACTERISTICS_FOR_IDENTIFICATION","applyMarketResearchToGenerateAudienceInsights","purposeConsents","AdsConsentPurposes","APPLY_MARKET_RESEARCH_TO_GENERATE_AUDIENCE_INSIGHTS","createAPersonalisedAdsProfile","CREATE_A_PERSONALISED_ADS_PROFILE","createAPersonalisedContentProfile","developAndImproveProducts","DEVELOP_AND_IMPROVE_PRODUCTS","measureAdPerformance","MEASURE_AD_PERFORMANCE","measureContentPerformance","MEASURE_CONTENT_PERFORMANCE","selectBasicAds","SELECT_BASIC_ADS","selectPersonalisedAds","SELECT_PERSONALISED_ADS","selectPersonalisedContent","SELECT_PERSONALISED_CONTENT","storeAndAccessInformationOnDevice","STORE_AND_ACCESS_INFORMATION_ON_DEVICE","usePreciseGeolocationData","USE_PRECISE_GEOLOCATION_DATA"],"mappings":";;;;;;;AAiBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBA,MAAMA,MAAM,GAAGC,2BAAcC,8BAA7B;AAEO,MAAMC,UAA+B,GAAG;AAC7CC,EAAAA,iBAAiB,GAA+D;AAAA,QAA9DC,OAA8D,uEAA7B,EAA6B;;AAC9E,QAAI,CAAC,sBAASA,OAAT,CAAL,EAAwB;AACtB,YAAM,IAAIC,KAAJ,CAAU,qEAAV,CAAN;AACD;;AAED,QACE,
|
|
1
|
+
{"version":3,"sources":["AdsConsent.ts"],"names":["native","NativeModules","RNGoogleMobileAdsConsentModule","AdsConsent","requestInfoUpdate","options","Error","debugGeography","AdsConsentDebugGeography","DISABLED","EEA","NOT_EEA","tagForUnderAgeOfConsent","testDeviceIdentifiers","deviceId","showForm","reset","getTCString","getTCModel","tcString","TCString","decode","getUserChoices","tcModel","e","TCModel","__DEV__","console","warn","activelyScanDeviceCharacteristicsForIdentification","specialFeatureOptins","has","AdsConsentSpecialFeatures","ACTIVELY_SCAN_DEVICE_CHARACTERISTICS_FOR_IDENTIFICATION","applyMarketResearchToGenerateAudienceInsights","purposeConsents","AdsConsentPurposes","APPLY_MARKET_RESEARCH_TO_GENERATE_AUDIENCE_INSIGHTS","createAPersonalisedAdsProfile","CREATE_A_PERSONALISED_ADS_PROFILE","createAPersonalisedContentProfile","developAndImproveProducts","DEVELOP_AND_IMPROVE_PRODUCTS","measureAdPerformance","MEASURE_AD_PERFORMANCE","measureContentPerformance","MEASURE_CONTENT_PERFORMANCE","selectBasicAds","SELECT_BASIC_ADS","selectPersonalisedAds","SELECT_PERSONALISED_ADS","selectPersonalisedContent","SELECT_PERSONALISED_CONTENT","storeAndAccessInformationOnDevice","STORE_AND_ACCESS_INFORMATION_ON_DEVICE","usePreciseGeolocationData","USE_PRECISE_GEOLOCATION_DATA"],"mappings":";;;;;;;AAiBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBA,MAAMA,MAAM,GAAGC,2BAAcC,8BAA7B;AAEO,MAAMC,UAA+B,GAAG;AAC7CC,EAAAA,iBAAiB,GAA+D;AAAA,QAA9DC,OAA8D,uEAA7B,EAA6B;;AAC9E,QAAI,CAAC,sBAASA,OAAT,CAAL,EAAwB;AACtB,YAAM,IAAIC,KAAJ,CAAU,qEAAV,CAAN;AACD;;AAED,QACE,2BAAcD,OAAd,EAAuB,gBAAvB,KACAA,OAAO,CAACE,cAAR,KAA2BC,mDAAyBC,QADpD,IAEAJ,OAAO,CAACE,cAAR,KAA2BC,mDAAyBE,GAFpD,IAGAL,OAAO,CAACE,cAAR,KAA2BC,mDAAyBG,OAJtD,EAKE;AACA,YAAM,IAAIL,KAAJ,CACJ,+KADI,CAAN;AAGD;;AAED,QACE,2BAAcD,OAAd,EAAuB,yBAAvB,KACA,CAAC,uBAAUA,OAAO,CAACO,uBAAlB,CAFH,EAGE;AACA,YAAM,IAAIN,KAAJ,CACJ,6FADI,CAAN;AAGD;;AAED,QAAI,2BAAcD,OAAd,EAAuB,uBAA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oBAAR,CAA6BC,GAA7B,CAClDC,qDAA0BC,uDADwB,CAD/C;AAILC,MAAAA,6CAA6C,EAAEX,OAAO,CAACY,eAAR,CAAwBJ,GAAxB,CAC7CK,uCAAmBC,mDAD0B,CAJ1C;AAOLC,MAAAA,6BAA6B,EAAEf,OAAO,CAACY,eAAR,CAAwBJ,GAAxB,CAC7BK,uCAAmBG,iCADU,CAP1B;AAULC,MAAAA,iCAAiC,EAAEjB,OAAO,CAACY,eAAR,CAAwBJ,GAAxB,CACjCK,uCAAmBG,iCADc,CAV9B;AAaLE,MAAAA,yBAAyB,EAAElB,OAAO,CAACY,eAAR,CAAwBJ,GAAxB,CACzBK,uCAAmBM,4BADM,CAbtB;AAgBLC,MAAAA,oBAAoB,EAAEpB,OAAO,CAACY,eAAR,CAAwBJ,GAAxB,CAA4BK,uCAAmBQ,sBAA/C,CAhBjB;AAiBLC,MAAAA,yBAAyB,EAAEtB,OAAO,CAACY,eAAR,CAAwBJ,GAAxB,CACzBK,uCAAmBU,2BADM,CAjBtB;AAoBLC,MAAAA,cAAc,EAAExB,OAAO,CAACY,eAAR,CAAwBJ,GAAxB,CAA4BK,uCAAmBY,gBAA/C,CApBX;AAqBLC,MAAAA,qBAAqB,EAAE1B,OAAO,CAACY,eAAR,CAAwBJ,GAAxB,CACrBK,uCAAmBc,uBADE,CArBlB;AAwBLC,MAAAA,yBAAyB,EAAE5B,OAAO,CAACY,eAAR,CAAwBJ,GAAxB,CACzBK,uCAAmBgB,2BADM,CAxBtB;AA2BLC,MAAAA,iCAAiC,EAAE9B,OAAO,CAACY,eAAR,CAAwBJ,GAAxB,CACjCK,uCAAmBkB,sCADc,CA3B9B;AA8BLC,MAAAA,yBAAyB,EAAEhC,OAAO,CAACO,oBAAR,CAA6BC,GAA7B,CACzBC,qDAA0BwB,4BADD;AA9BtB,KAAP;AAkCD;;AAhH4C,CAAxC","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport { TCModel, TCString } from '@iabtcf/core';\nimport { NativeModules } from 'react-native';\nimport { AdsConsentDebugGeography } from './AdsConsentDebugGeography';\nimport { AdsConsentPurposes } from './AdsConsentPurposes';\nimport { AdsConsentSpecialFeatures } from './AdsConsentSpecialFeatures';\nimport { isPropertySet, isArray, isBoolean, isObject, isString } from './common';\nimport {\n AdsConsentFormResult,\n AdsConsentInfo,\n AdsConsentInfoOptions,\n AdsConsentInterface,\n AdsConsentUserChoices,\n} from './types/AdsConsent.interface';\n\nconst native = NativeModules.RNGoogleMobileAdsConsentModule;\n\nexport const AdsConsent: AdsConsentInterface = {\n requestInfoUpdate(options: AdsConsentInfoOptions = {}): Promise<AdsConsentInfo> {\n if (!isObject(options)) {\n throw new Error(\"AdsConsent.requestInfoUpdate(*) 'options' expected an object value.\");\n }\n\n if (\n isPropertySet(options, 'debugGeography') &&\n options.debugGeography !== AdsConsentDebugGeography.DISABLED &&\n options.debugGeography !== AdsConsentDebugGeography.EEA &&\n options.debugGeography !== AdsConsentDebugGeography.NOT_EEA\n ) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.debugGeography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.\",\n );\n }\n\n if (\n isPropertySet(options, 'tagForUnderAgeOfConsent') &&\n !isBoolean(options.tagForUnderAgeOfConsent)\n ) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.tagForUnderAgeOfConsent' expected a boolean value.\",\n );\n }\n\n if (isPropertySet(options, 'testDeviceIdentifiers')) {\n if (!isArray(options.testDeviceIdentifiers)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.\",\n );\n }\n\n for (const deviceId of options.testDeviceIdentifiers ?? []) {\n if (!isString(deviceId)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.\",\n );\n }\n }\n }\n\n return native.requestInfoUpdate(options);\n },\n\n showForm(): Promise<AdsConsentFormResult> {\n return native.showForm();\n },\n\n reset(): void {\n return native.reset();\n },\n\n getTCString(): Promise<string> {\n return native.getTCString();\n },\n\n async getTCModel(): Promise<TCModel> {\n const tcString = await native.getTCString();\n return TCString.decode(tcString);\n },\n\n async getUserChoices(): Promise<AdsConsentUserChoices> {\n const tcString = await native.getTCString();\n\n let tcModel: TCModel;\n\n try {\n tcModel = TCString.decode(tcString);\n } catch (e) {\n tcModel = new TCModel();\n\n if (__DEV__) {\n // eslint-disable-next-line no-console\n console.warn(`Failed to decode tcString ${tcString}:`, e);\n }\n }\n\n return {\n activelyScanDeviceCharacteristicsForIdentification: tcModel.specialFeatureOptins.has(\n AdsConsentSpecialFeatures.ACTIVELY_SCAN_DEVICE_CHARACTERISTICS_FOR_IDENTIFICATION,\n ),\n applyMarketResearchToGenerateAudienceInsights: tcModel.purposeConsents.has(\n AdsConsentPurposes.APPLY_MARKET_RESEARCH_TO_GENERATE_AUDIENCE_INSIGHTS,\n ),\n createAPersonalisedAdsProfile: tcModel.purposeConsents.has(\n AdsConsentPurposes.CREATE_A_PERSONALISED_ADS_PROFILE,\n ),\n createAPersonalisedContentProfile: tcModel.purposeConsents.has(\n AdsConsentPurposes.CREATE_A_PERSONALISED_ADS_PROFILE,\n ),\n developAndImproveProducts: tcModel.purposeConsents.has(\n AdsConsentPurposes.DEVELOP_AND_IMPROVE_PRODUCTS,\n ),\n measureAdPerformance: tcModel.purposeConsents.has(AdsConsentPurposes.MEASURE_AD_PERFORMANCE),\n measureContentPerformance: tcModel.purposeConsents.has(\n AdsConsentPurposes.MEASURE_CONTENT_PERFORMANCE,\n ),\n selectBasicAds: tcModel.purposeConsents.has(AdsConsentPurposes.SELECT_BASIC_ADS),\n selectPersonalisedAds: tcModel.purposeConsents.has(\n AdsConsentPurposes.SELECT_PERSONALISED_ADS,\n ),\n selectPersonalisedContent: tcModel.purposeConsents.has(\n AdsConsentPurposes.SELECT_PERSONALISED_CONTENT,\n ),\n storeAndAccessInformationOnDevice: tcModel.purposeConsents.has(\n AdsConsentPurposes.STORE_AND_ACCESS_INFORMATION_ON_DEVICE,\n ),\n usePreciseGeolocationData: tcModel.specialFeatureOptins.has(\n AdsConsentSpecialFeatures.USE_PRECISE_GEOLOCATION_DATA,\n ),\n };\n },\n};\n"]}
|
|
@@ -32,6 +32,8 @@ exports.BannerAdSize = BannerAdSize;
|
|
|
32
32
|
BannerAdSize["LEADERBOARD"] = "LEADERBOARD";
|
|
33
33
|
BannerAdSize["MEDIUM_RECTANGLE"] = "MEDIUM_RECTANGLE";
|
|
34
34
|
BannerAdSize["ADAPTIVE_BANNER"] = "ADAPTIVE_BANNER";
|
|
35
|
+
BannerAdSize["ANCHORED_ADAPTIVE_BANNER"] = "ANCHORED_ADAPTIVE_BANNER";
|
|
36
|
+
BannerAdSize["INLINE_ADAPTIVE_BANNER"] = "INLINE_ADAPTIVE_BANNER";
|
|
35
37
|
BannerAdSize["FLUID"] = "FLUID";
|
|
36
38
|
BannerAdSize["WIDE_SKYSCRAPER"] = "WIDE_SKYSCRAPER";
|
|
37
39
|
})(BannerAdSize || (exports.BannerAdSize = BannerAdSize = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["BannerAdSize.ts"],"names":["BannerAdSize"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAEYA,Y;;;WAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;GAAAA,Y,4BAAAA,Y","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n *\n */\n\nexport enum BannerAdSize {\n /**\n * Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).\n */\n BANNER = 'BANNER',\n\n /**\n * Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).\n */\n FULL_BANNER = 'FULL_BANNER',\n\n /**\n * Large banner ad size (320x100 density-independent pixels).\n */\n LARGE_BANNER = 'LARGE_BANNER',\n\n /**\n * Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).\n */\n LEADERBOARD = 'LEADERBOARD',\n\n /**\n * Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).\n */\n MEDIUM_RECTANGLE = 'MEDIUM_RECTANGLE',\n\n /**\n * A (next generation) dynamically sized banner that is full-width and auto-height.\n */\n
|
|
1
|
+
{"version":3,"sources":["BannerAdSize.ts"],"names":["BannerAdSize"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAEYA,Y;;;WAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;GAAAA,Y,4BAAAA,Y","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n *\n */\n\nexport enum BannerAdSize {\n /**\n * Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).\n */\n BANNER = 'BANNER',\n\n /**\n * Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).\n */\n FULL_BANNER = 'FULL_BANNER',\n\n /**\n * Large banner ad size (320x100 density-independent pixels).\n */\n LARGE_BANNER = 'LARGE_BANNER',\n\n /**\n * Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).\n */\n LEADERBOARD = 'LEADERBOARD',\n\n /**\n * Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).\n */\n MEDIUM_RECTANGLE = 'MEDIUM_RECTANGLE',\n\n /**\n * @deprecated Use `ANCHORED_ADAPTIVE_BANNER` instead.\n */\n ADAPTIVE_BANNER = 'ADAPTIVE_BANNER',\n\n /**\n * A (next generation) dynamically sized banner that is full-width and auto-height.\n */\n ANCHORED_ADAPTIVE_BANNER = 'ANCHORED_ADAPTIVE_BANNER',\n\n /**\n * Inline adaptive banners are larger, taller banners compared to anchored adaptive banners. They are of variable height, and can be as tall as the device screen.\n * They are intended to be placed in scrolling content.\n */\n INLINE_ADAPTIVE_BANNER = 'INLINE_ADAPTIVE_BANNER',\n\n /**\n * A dynamically sized banner that matches its parent's width and expands/contracts its height to match the ad's content after loading completes.\n */\n FLUID = 'FLUID',\n\n /**\n * IAB wide skyscraper ad size (160x600 density-independent pixels). This size is currently not supported by the Google Mobile Ads network; this is intended for mediation ad networks only.\n */\n WIDE_SKYSCRAPER = 'WIDE_SKYSCRAPER',\n}\n"]}
|
|
@@ -8,6 +8,7 @@ var _exportNames = {
|
|
|
8
8
|
once: true,
|
|
9
9
|
isError: true,
|
|
10
10
|
hasOwnProperty: true,
|
|
11
|
+
isPropertySet: true,
|
|
11
12
|
stripTrailingSlash: true,
|
|
12
13
|
isIOS: true,
|
|
13
14
|
isAndroid: true,
|
|
@@ -28,6 +29,7 @@ exports.hasOwnProperty = hasOwnProperty;
|
|
|
28
29
|
exports.isAndroid = void 0;
|
|
29
30
|
exports.isError = isError;
|
|
30
31
|
exports.isIOS = void 0;
|
|
32
|
+
exports.isPropertySet = isPropertySet;
|
|
31
33
|
exports.once = once;
|
|
32
34
|
exports.stripTrailingSlash = stripTrailingSlash;
|
|
33
35
|
exports.tryJSONParse = tryJSONParse;
|
|
@@ -173,6 +175,10 @@ function isError(value) {
|
|
|
173
175
|
function hasOwnProperty(target, property) {
|
|
174
176
|
return Object.hasOwnProperty.call(target, property);
|
|
175
177
|
}
|
|
178
|
+
|
|
179
|
+
function isPropertySet(target, property) {
|
|
180
|
+
return hasOwnProperty(target, property) && !(0, _validate.isUndefined)(target[property]);
|
|
181
|
+
}
|
|
176
182
|
/**
|
|
177
183
|
* Remove a trailing forward slash from a string if it exists
|
|
178
184
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["getDataUrlParts","dataUrlString","isBase64","includes","mediaType","base64String","split","undefined","replace","decodeURIComponent","Base64","btoa","once","fn","context","onceResult","ranOnce","onceInner","args","apply","isError","value","Object","prototype","toString","call","Error","hasOwnProperty","target","property","stripTrailingSlash","string","endsWith","slice","isIOS","Platform","OS","isAndroid","tryJSONParse","JSON","parse","jsonError","tryJSONStringify","data","stringify"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["getDataUrlParts","dataUrlString","isBase64","includes","mediaType","base64String","split","undefined","replace","decodeURIComponent","Base64","btoa","once","fn","context","onceResult","ranOnce","onceInner","args","apply","isError","value","Object","prototype","toString","call","Error","hasOwnProperty","target","property","isPropertySet","stripTrailingSlash","string","endsWith","slice","isIOS","Platform","OS","isAndroid","tryJSONParse","JSON","parse","jsonError","tryJSONStringify","data","stringify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA;;AACA;;;;AACA;;AAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAHA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAIA;;;;;;AA3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcO,SAASA,eAAT,CAAyBC,aAAzB,EAAgD;AACrD,QAAMC,QAAQ,GAAGD,aAAa,CAACE,QAAd,CAAuB,SAAvB,CAAjB;AACA,MAAI,CAACC,SAAD,EAAYC,YAAZ,IAA4BJ,aAAa,CAACK,KAAd,CAAoB,GAApB,CAAhC;;AACA,MAAI,CAACF,SAAD,IAAc,CAACC,YAAnB,EAAiC;AAC/B,WAAO;AAAEA,MAAAA,YAAY,EAAEE,SAAhB;AAA2BH,MAAAA,SAAS,EAAEG;AAAtC,KAAP;AACD;;AACDH,EAAAA,SAAS,GAAGA,SAAS,CAACI,OAAV,CAAkB,OAAlB,EAA2B,EAA3B,EAA+BA,OAA/B,CAAuC,SAAvC,EAAkD,EAAlD,CAAZ;;AACA,MAAIH,YAAY,IAAIA,YAAY,CAACF,QAAb,CAAsB,GAAtB,CAApB,EAAgD;AAC9CE,IAAAA,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WAAOA,MAAP;AACD;;AACD,SAAOA,MAAM,CAACC,QAAP,CAAgB,GAAhB,IAAuBD,MAAM,CAACE,KAAP,CAAa,CAAb,EAAgB,CAAC,CAAjB,CAAvB,GAA6CF,MAApD;AACD;;AAEM,MAAMG,KAAK,GAAGC,sBAASC,EAAT,KAAgB,KAA9B;;AAEA,MAAMC,SAAS,GAAGF,sBAASC,EAAT,KAAgB,SAAlC;;;AAEA,SAASE,YAAT,CAAsBP,MAAtB,EAAsC;AAC3C,MAAI;AACF,WAAOA,MAAM,IAAIQ,IAAI,CAACC,KAAL,CAAWT,MAAX,CAAjB;AACD,GAFD,CAEE,OAAOU,SAAP,EAAkB;AAClB,WAAOV,MAAP;AACD;AACF;;AAEM,SAASW,gBAAT,CAA0BC,IAA1B,EAAyC;AAC9C,MAAI;AACF,WAAOJ,IAAI,CAACK,SAAL,CAAeD,IAAf,CAAP;AACD,GAFD,CAEE,OAAOF,SAAP,EAAkB;AAClB,WAAO,IAAP;AACD;AACF","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport { Platform } from 'react-native';\nimport * as Base64 from './Base64';\nimport { isString, isUndefined } from './validate';\n\nexport * from './id';\nexport * from './path';\nexport * from './promise';\nexport * from './validate';\n\nexport { Base64 };\nexport { ReferenceBase } from './ReferenceBase';\n\nexport function getDataUrlParts(dataUrlString: string) {\n const isBase64 = dataUrlString.includes(';base64');\n let [mediaType, base64String] = dataUrlString.split(',');\n if (!mediaType || !base64String) {\n return { base64String: undefined, mediaType: undefined };\n }\n mediaType = mediaType.replace('data:', '').replace(';base64', '');\n if (base64String && base64String.includes('%')) {\n base64String = decodeURIComponent(base64String);\n }\n if (!isBase64) {\n base64String = Base64.btoa(base64String);\n }\n return { base64String, mediaType };\n}\n\nexport function once<T>(fn: () => void, context: unknown): (this: T, ...args: []) => void {\n let onceResult: unknown;\n let ranOnce = false;\n\n return function onceInner(...args: []) {\n if (!ranOnce) {\n ranOnce = true;\n onceResult = fn.apply(context || this, args);\n }\n\n return onceResult;\n };\n}\n\nexport function isError(value: unknown) {\n if (Object.prototype.toString.call(value) === '[object Error]') {\n return true;\n }\n\n return value instanceof Error;\n}\n\nexport function hasOwnProperty(target: unknown, property: PropertyKey) {\n return Object.hasOwnProperty.call(target, property);\n}\n\nexport function isPropertySet(target: unknown, property: PropertyKey) {\n return (\n hasOwnProperty(target, property) &&\n !isUndefined((target as Record<PropertyKey, unknown>)[property])\n );\n}\n\n/**\n * Remove a trailing forward slash from a string if it exists\n *\n * @param string\n * @returns {*}\n */\nexport function stripTrailingSlash(string: string) {\n if (!isString(string)) {\n return string;\n }\n return string.endsWith('/') ? string.slice(0, -1) : string;\n}\n\nexport const isIOS = Platform.OS === 'ios';\n\nexport const isAndroid = Platform.OS === 'android';\n\nexport function tryJSONParse(string: string) {\n try {\n return string && JSON.parse(string);\n } catch (jsonError) {\n return string;\n }\n}\n\nexport function tryJSONStringify(data: unknown) {\n try {\n return JSON.stringify(data);\n } catch (jsonError) {\n return null;\n }\n}\n"]}
|
|
@@ -40,7 +40,7 @@ function validateAdRequestConfiguration(requestConfiguration) {
|
|
|
40
40
|
out.maxAdContentRating = requestConfiguration.maxAdContentRating;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
if ((0, _common.
|
|
43
|
+
if ((0, _common.isPropertySet)(requestConfiguration, 'tagForChildDirectedTreatment')) {
|
|
44
44
|
if (!(0, _common.isBoolean)(requestConfiguration.tagForChildDirectedTreatment)) {
|
|
45
45
|
throw new Error("'requestConfiguration.tagForChildDirectedTreatment' expected a boolean value");
|
|
46
46
|
}
|
|
@@ -48,7 +48,7 @@ function validateAdRequestConfiguration(requestConfiguration) {
|
|
|
48
48
|
out.tagForChildDirectedTreatment = requestConfiguration.tagForChildDirectedTreatment;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
if ((0, _common.
|
|
51
|
+
if ((0, _common.isPropertySet)(requestConfiguration, 'tagForUnderAgeOfConsent')) {
|
|
52
52
|
if (!(0, _common.isBoolean)(requestConfiguration.tagForUnderAgeOfConsent)) {
|
|
53
53
|
throw new Error("'requestConfiguration.tagForUnderAgeOfConsent' expected a boolean value");
|
|
54
54
|
}
|
|
@@ -56,7 +56,7 @@ function validateAdRequestConfiguration(requestConfiguration) {
|
|
|
56
56
|
out.tagForUnderAgeOfConsent = requestConfiguration.tagForUnderAgeOfConsent;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
if ((0, _common.
|
|
59
|
+
if ((0, _common.isPropertySet)(requestConfiguration, 'testDeviceIdentifiers')) {
|
|
60
60
|
if (!(0, _common.isArray)(requestConfiguration.testDeviceIdentifiers)) {
|
|
61
61
|
throw new Error("'requestConfiguration.testDeviceIdentifiers' expected an array value");
|
|
62
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["validateAdRequestConfiguration.ts"],"names":["validateAdRequestConfiguration","requestConfiguration","out","Error","maxAdContentRating","MaxAdContentRating","G","PG","T","MA","tagForChildDirectedTreatment","tagForUnderAgeOfConsent","testDeviceIdentifiers"],"mappings":";;;;;;;AAiBA;;AACA;;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,SAASA,8BAAT,CAAwCC,oBAAxC,EAAoF;AACzF,QAAMC,GAAyB,GAAG,EAAlC;;AAEA,MAAI,CAAC,sBAASD,oBAAT,CAAL,EAAqC;AACnC,UAAM,IAAIE,KAAJ,CAAU,iDAAV,CAAN;AACD;;AAED,MAAIF,oBAAoB,CAACG,kBAAzB,EAA6C;AAC3C,QACEH,oBAAoB,CAACG,kBAArB,KAA4CC,uCAAmBC,CAA/D,IACAL,oBAAoB,CAACG,kBAArB,KAA4CC,uCAAmBE,EAD/D,IAEAN,oBAAoB,CAACG,kBAArB,KAA4CC,uCAAmBG,CAF/D,IAGAP,oBAAoB,CAACG,kBAArB,KAA4CC,uCAAmBI,EAJjE,EAKE;AACA,YAAM,IAAIN,KAAJ,CACJ,qJADI,CAAN;AAGD;;AAEDD,IAAAA,GAAG,CAACE,kBAAJ,GAAyBH,oBAAoB,CAACG,kBAA9C;AACD;;AAED,MAAI,
|
|
1
|
+
{"version":3,"sources":["validateAdRequestConfiguration.ts"],"names":["validateAdRequestConfiguration","requestConfiguration","out","Error","maxAdContentRating","MaxAdContentRating","G","PG","T","MA","tagForChildDirectedTreatment","tagForUnderAgeOfConsent","testDeviceIdentifiers"],"mappings":";;;;;;;AAiBA;;AACA;;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,SAASA,8BAAT,CAAwCC,oBAAxC,EAAoF;AACzF,QAAMC,GAAyB,GAAG,EAAlC;;AAEA,MAAI,CAAC,sBAASD,oBAAT,CAAL,EAAqC;AACnC,UAAM,IAAIE,KAAJ,CAAU,iDAAV,CAAN;AACD;;AAED,MAAIF,oBAAoB,CAACG,kBAAzB,EAA6C;AAC3C,QACEH,oBAAoB,CAACG,kBAArB,KAA4CC,uCAAmBC,CAA/D,IACAL,oBAAoB,CAACG,kBAArB,KAA4CC,uCAAmBE,EAD/D,IAEAN,oBAAoB,CAACG,kBAArB,KAA4CC,uCAAmBG,CAF/D,IAGAP,oBAAoB,CAACG,kBAArB,KAA4CC,uCAAmBI,EAJjE,EAKE;AACA,YAAM,IAAIN,KAAJ,CACJ,qJADI,CAAN;AAGD;;AAEDD,IAAAA,GAAG,CAACE,kBAAJ,GAAyBH,oBAAoB,CAACG,kBAA9C;AACD;;AAED,MAAI,2BAAcH,oBAAd,EAAoC,8BAApC,CAAJ,EAAyE;AACvE,QAAI,CAAC,uBAAUA,oBAAoB,CAACS,4BAA/B,CAAL,EAAmE;AACjE,YAAM,IAAIP,KAAJ,CACJ,8EADI,CAAN;AAGD;;AAEDD,IAAAA,GAAG,CAACQ,4BAAJ,GAAmCT,oBAAoB,CAACS,4BAAxD;AACD;;AAED,MAAI,2BAAcT,oBAAd,EAAoC,yBAApC,CAAJ,EAAoE;AAClE,QAAI,CAAC,uBAAUA,oBAAoB,CAACU,uBAA/B,CAAL,EAA8D;AAC5D,YAAM,IAAIR,KAAJ,CAAU,yEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACS,uBAAJ,GAA8BV,oBAAoB,CAACU,uBAAnD;AACD;;AAED,MAAI,2BAAcV,oBAAd,EAAoC,uBAApC,CAAJ,EAAkE;AAChE,QAAI,CAAC,qBAAQA,oBAAoB,CAACW,qBAA7B,CAAL,EAA0D;AACxD,YAAM,IAAIT,KAAJ,CAAU,sEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACU,qBAAJ,GAA4BX,oBAAoB,CAACW,qBAAjD;AACD;;AAED,SAAOV,GAAP;AACD","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport { isPropertySet, isArray, isBoolean, isObject } from './common';\nimport { MaxAdContentRating } from './MaxAdContentRating';\nimport { RequestConfiguration } from './types/RequestConfiguration';\n\nexport function validateAdRequestConfiguration(requestConfiguration: RequestConfiguration) {\n const out: RequestConfiguration = {};\n\n if (!isObject(requestConfiguration)) {\n throw new Error(\"'requestConfiguration' expected an object value\");\n }\n\n if (requestConfiguration.maxAdContentRating) {\n if (\n requestConfiguration.maxAdContentRating !== MaxAdContentRating.G &&\n requestConfiguration.maxAdContentRating !== MaxAdContentRating.PG &&\n requestConfiguration.maxAdContentRating !== MaxAdContentRating.T &&\n requestConfiguration.maxAdContentRating !== MaxAdContentRating.MA\n ) {\n throw new Error(\n \"'requestConfiguration.maxAdContentRating' expected on of MaxAdContentRating.G, MaxAdContentRating.PG, MaxAdContentRating.T or MaxAdContentRating.MA\",\n );\n }\n\n out.maxAdContentRating = requestConfiguration.maxAdContentRating;\n }\n\n if (isPropertySet(requestConfiguration, 'tagForChildDirectedTreatment')) {\n if (!isBoolean(requestConfiguration.tagForChildDirectedTreatment)) {\n throw new Error(\n \"'requestConfiguration.tagForChildDirectedTreatment' expected a boolean value\",\n );\n }\n\n out.tagForChildDirectedTreatment = requestConfiguration.tagForChildDirectedTreatment;\n }\n\n if (isPropertySet(requestConfiguration, 'tagForUnderAgeOfConsent')) {\n if (!isBoolean(requestConfiguration.tagForUnderAgeOfConsent)) {\n throw new Error(\"'requestConfiguration.tagForUnderAgeOfConsent' expected a boolean value\");\n }\n\n out.tagForUnderAgeOfConsent = requestConfiguration.tagForUnderAgeOfConsent;\n }\n\n if (isPropertySet(requestConfiguration, 'testDeviceIdentifiers')) {\n if (!isArray(requestConfiguration.testDeviceIdentifiers)) {\n throw new Error(\"'requestConfiguration.testDeviceIdentifiers' expected an array value\");\n }\n\n out.testDeviceIdentifiers = requestConfiguration.testDeviceIdentifiers;\n }\n\n return out;\n}\n"]}
|
|
@@ -34,7 +34,7 @@ function validateAdRequestOptions(options) {
|
|
|
34
34
|
throw new Error("'options' expected an object value");
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if ((0, _common.
|
|
37
|
+
if ((0, _common.isPropertySet)(options, 'requestNonPersonalizedAdsOnly')) {
|
|
38
38
|
if (!(0, _common.isBoolean)(options.requestNonPersonalizedAdsOnly)) {
|
|
39
39
|
throw new Error("'options.requestNonPersonalizedAdsOnly' expected a boolean value");
|
|
40
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["validateAdRequestOptions.ts"],"names":["validateAdRequestOptions","options","out","Error","requestNonPersonalizedAdsOnly","networkExtras","Object","entries","forEach","key","value","keywords","i","length","keyword","contentUrl","requestAgent","serverSideVerificationOptions","ssvOptions","userId","customData","customTargeting"],"mappings":";;;;;;;AAiBA;;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaO,SAASA,wBAAT,CAAkCC,OAAlC,EAA4D;AACjE,QAAMC,GAAmB,GAAG,EAA5B;;AAEA,MAAI,yBAAYD,OAAZ,CAAJ,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAAC,sBAASD,OAAT,CAAL,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAI,
|
|
1
|
+
{"version":3,"sources":["validateAdRequestOptions.ts"],"names":["validateAdRequestOptions","options","out","Error","requestNonPersonalizedAdsOnly","networkExtras","Object","entries","forEach","key","value","keywords","i","length","keyword","contentUrl","requestAgent","serverSideVerificationOptions","ssvOptions","userId","customData","customTargeting"],"mappings":";;;;;;;AAiBA;;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaO,SAASA,wBAAT,CAAkCC,OAAlC,EAA4D;AACjE,QAAMC,GAAmB,GAAG,EAA5B;;AAEA,MAAI,yBAAYD,OAAZ,CAAJ,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAAC,sBAASD,OAAT,CAAL,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAI,2BAAcF,OAAd,EAAuB,+BAAvB,CAAJ,EAA6D;AAC3D,QAAI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tC,YAAM,IAAIlB,KAAJ,CAAU,iEAAV,CAAN;AACD;;AACDD,IAAAA,GAAG,CAACmB,eAAJ,GAAsBpB,OAAO,CAACoB,eAA9B;AACD;;AAED,SAAOnB,GAAP;AACD","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n isPropertySet,\n isArray,\n isBoolean,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { RequestOptions } from './types/RequestOptions';\n\nexport function validateAdRequestOptions(options?: RequestOptions) {\n const out: RequestOptions = {};\n\n if (isUndefined(options)) {\n return out;\n }\n\n if (!isObject(options)) {\n throw new Error(\"'options' expected an object value\");\n }\n\n if (isPropertySet(options, 'requestNonPersonalizedAdsOnly')) {\n if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {\n throw new Error(\"'options.requestNonPersonalizedAdsOnly' expected a boolean value\");\n }\n\n out.requestNonPersonalizedAdsOnly = options.requestNonPersonalizedAdsOnly;\n }\n\n if (options.networkExtras) {\n if (!isObject(options.networkExtras)) {\n throw new Error(\"'options.networkExtras' expected an object of key/value pairs\");\n }\n\n Object.entries(options.networkExtras).forEach(([key, value]) => {\n if (!isString(value)) {\n throw new Error(`'options.networkExtras' expected a string value for object key \"${key}\"`);\n }\n });\n\n out.networkExtras = options.networkExtras;\n }\n\n if (options.keywords) {\n if (!isArray(options.keywords)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n\n for (let i = 0; i < options.keywords.length; i++) {\n const keyword = options.keywords[i];\n\n if (!isString(keyword)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n }\n\n out.keywords = options.keywords;\n }\n\n if (options.contentUrl) {\n if (!isString(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a string value\");\n }\n\n if (!isValidUrl(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a valid HTTP or HTTPS url.\");\n }\n\n if (options.contentUrl.length > 512) {\n throw new Error(\"'options.contentUrl' maximum length of a content URL is 512 characters.\");\n }\n\n out.contentUrl = options.contentUrl;\n }\n\n if (options.requestAgent) {\n if (!isString(options.requestAgent)) {\n throw new Error(\"'options.requestAgent' expected a string value\");\n }\n\n out.requestAgent = options.requestAgent;\n }\n\n if (options.serverSideVerificationOptions) {\n if (!isObject(options.serverSideVerificationOptions)) {\n throw new Error(\n \"'options.serverSideVerificationOptions' expected an object of key/value pairs\",\n );\n }\n\n const ssvOptions = options.serverSideVerificationOptions;\n\n if (ssvOptions.userId && !isString(ssvOptions.userId)) {\n throw new Error(\"'options.serverSideVerificationOptions.userId' expected a string value\");\n }\n\n if (ssvOptions.customData && !isString(ssvOptions.customData)) {\n throw new Error(\"'options.serverSideVerificationOptions.customData' expected a string value\");\n }\n\n out.serverSideVerificationOptions = options.serverSideVerificationOptions;\n }\n\n if (options.customTargeting) {\n if (!isObject(options.customTargeting)) {\n throw new Error(\"'options.customTargeting' expected an object of key/value pairs\");\n }\n out.customTargeting = options.customTargeting;\n }\n\n return out;\n}\n"]}
|
|
@@ -34,7 +34,7 @@ function validateAdShowOptions(options) {
|
|
|
34
34
|
throw new Error("'options' expected an object value");
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if ((0, _common.
|
|
37
|
+
if ((0, _common.isPropertySet)(options, 'immersiveModeEnabled')) {
|
|
38
38
|
if (!(0, _common.isBoolean)(options.immersiveModeEnabled)) {
|
|
39
39
|
throw new Error("'options.immersiveModeEnabled' expected a boolean value");
|
|
40
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["validateAdShowOptions.ts"],"names":["validateAdShowOptions","options","out","Error","immersiveModeEnabled"],"mappings":";;;;;;;AAiBA;;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKO,SAASA,qBAAT,CAA+BC,OAA/B,EAAwD;AAC7D,QAAMC,GAAkB,GAAG,EAA3B;;AAEA,MAAI,yBAAYD,OAAZ,CAAJ,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAAC,sBAASD,OAAT,CAAL,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAI,
|
|
1
|
+
{"version":3,"sources":["validateAdShowOptions.ts"],"names":["validateAdShowOptions","options","out","Error","immersiveModeEnabled"],"mappings":";;;;;;;AAiBA;;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKO,SAASA,qBAAT,CAA+BC,OAA/B,EAAwD;AAC7D,QAAMC,GAAkB,GAAG,EAA3B;;AAEA,MAAI,yBAAYD,OAAZ,CAAJ,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAAC,sBAASD,OAAT,CAAL,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAI,2BAAcF,OAAd,EAAuB,sBAAvB,CAAJ,EAAoD;AAClD,QAAI,CAAC,uBAAUA,OAAO,CAACG,oBAAlB,CAAL,EAA8C;AAC5C,YAAM,IAAID,KAAJ,CAAU,yDAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACE,oBAAJ,GAA2BH,OAAO,CAACG,oBAAnC;AACD;;AAED,SAAOF,GAAP;AACD","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport { isPropertySet, isBoolean, isObject, isUndefined } from './common';\nimport { AdShowOptions } from './types/AdShowOptions';\n\nexport function validateAdShowOptions(options?: AdShowOptions) {\n const out: AdShowOptions = {};\n\n if (isUndefined(options)) {\n return out;\n }\n\n if (!isObject(options)) {\n throw new Error(\"'options' expected an object value\");\n }\n\n if (isPropertySet(options, 'immersiveModeEnabled')) {\n if (!isBoolean(options.immersiveModeEnabled)) {\n throw new Error(\"'options.immersiveModeEnabled' expected a boolean value\");\n }\n\n out.immersiveModeEnabled = options.immersiveModeEnabled;\n }\n\n return out;\n}\n"]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// Generated by genversion.\nexport const version = '6.
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// Generated by genversion.\nexport const version = '6.2.2';\n"]}
|