react-native-google-mobile-ads 6.2.1 → 6.2.4
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 +24 -4
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.m +14 -5
- package/ios_config.sh +2 -1
- package/lib/commonjs/AdsConsent.js +3 -3
- package/lib/commonjs/AdsConsent.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/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/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 +1 -1
- package/src/AdsConsent.ts +4 -4
- 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
|
@@ -51,6 +51,7 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
51
51
|
private final String EVENT_AD_FAILED_TO_LOAD = "onAdFailedToLoad";
|
|
52
52
|
private final String EVENT_AD_OPENED = "onAdOpened";
|
|
53
53
|
private final String EVENT_AD_CLOSED = "onAdClosed";
|
|
54
|
+
private final String EVENT_SIZE_CHANGE = "onSizeChange";
|
|
54
55
|
private final String EVENT_APP_EVENT = "onAppEvent";
|
|
55
56
|
private final int COMMAND_ID_RECORD_MANUAL_IMPRESSION = 1;
|
|
56
57
|
|
|
@@ -58,6 +59,7 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
58
59
|
private List<AdSize> sizes;
|
|
59
60
|
private String unitId;
|
|
60
61
|
private Boolean manualImpressionsEnabled;
|
|
62
|
+
private boolean propsChanged;
|
|
61
63
|
private boolean isFluid;
|
|
62
64
|
|
|
63
65
|
@Nonnull
|
|
@@ -102,13 +104,13 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
102
104
|
@ReactProp(name = "unitId")
|
|
103
105
|
public void setUnitId(ReactViewGroup reactViewGroup, String value) {
|
|
104
106
|
unitId = value;
|
|
105
|
-
|
|
107
|
+
propsChanged = true;
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
@ReactProp(name = "request")
|
|
109
111
|
public void setRequest(ReactViewGroup reactViewGroup, ReadableMap value) {
|
|
110
112
|
request = ReactNativeGoogleMobileAdsCommon.buildAdRequest(value);
|
|
111
|
-
|
|
113
|
+
propsChanged = true;
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
@ReactProp(name = "sizes")
|
|
@@ -120,14 +122,32 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
120
122
|
sizeList.add(ReactNativeGoogleMobileAdsCommon.getAdSize(sizeString, reactViewGroup));
|
|
121
123
|
}
|
|
122
124
|
}
|
|
125
|
+
|
|
126
|
+
if (sizeList.size() > 0) {
|
|
127
|
+
AdSize adSize = sizeList.get(0);
|
|
128
|
+
WritableMap payload = Arguments.createMap();
|
|
129
|
+
payload.putDouble("width", adSize.getWidth());
|
|
130
|
+
payload.putDouble("height", adSize.getHeight());
|
|
131
|
+
sendEvent(reactViewGroup, EVENT_SIZE_CHANGE, payload);
|
|
132
|
+
}
|
|
133
|
+
|
|
123
134
|
sizes = sizeList;
|
|
124
|
-
|
|
135
|
+
propsChanged = true;
|
|
125
136
|
}
|
|
126
137
|
|
|
127
138
|
@ReactProp(name = "manualImpressionsEnabled")
|
|
128
139
|
public void setManualImpressionsEnabled(ReactViewGroup reactViewGroup, boolean value) {
|
|
129
140
|
this.manualImpressionsEnabled = value;
|
|
130
|
-
|
|
141
|
+
propsChanged = true;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@Override
|
|
145
|
+
public void onAfterUpdateTransaction(@NonNull ReactViewGroup reactViewGroup) {
|
|
146
|
+
super.onAfterUpdateTransaction(reactViewGroup);
|
|
147
|
+
if (propsChanged) {
|
|
148
|
+
requestAd(reactViewGroup);
|
|
149
|
+
}
|
|
150
|
+
propsChanged = false;
|
|
131
151
|
}
|
|
132
152
|
|
|
133
153
|
private BaseAdView initAdView(ReactViewGroup reactViewGroup) {
|
|
@@ -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 {
|
package/ios_config.sh
CHANGED
|
@@ -80,7 +80,8 @@ if [[ ${_SEARCH_RESULT} ]]; then
|
|
|
80
80
|
_RN_ROOT_EXISTS=$(ruby -e "require 'rubygems';require 'json'; output=JSON.parse('$_JSON_OUTPUT_RAW'); puts output[$_JSON_ROOT]" || echo '')
|
|
81
81
|
|
|
82
82
|
if [[ ${_RN_ROOT_EXISTS} ]]; then
|
|
83
|
-
|
|
83
|
+
if ! python3 --version >/dev/null 2>&1; then echo "python3 not found, app.json file processing error." && exit 1; fi
|
|
84
|
+
_JSON_OUTPUT_BASE64=$(python3 -c 'import json,sys,base64;print(base64.b64encode(bytes(json.dumps(json.loads(open('"'${_SEARCH_RESULT}'"', '"'rb'"').read())['${_JSON_ROOT}']), '"'utf-8'"')).decode())' || echo "e30=")
|
|
84
85
|
fi
|
|
85
86
|
|
|
86
87
|
_PLIST_ENTRY_KEYS+=("google_mobile_ads_json_raw")
|
|
@@ -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;A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BK,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"]}
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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,CAAC,uBAAUA,OAAO,CAACG,6BAAlB,CAAL,EAAuD;AACrD,YAAM,IAAID,KAAJ,CAAU,kEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACE,6BAAJ,GAAoCH,OAAO,CAACG,6BAA5C;AACD;;AAED,MAAIH,OAAO,CAACI,aAAZ,EAA2B;AACzB,QAAI,CAAC,sBAASJ,OAAO,CAACI,aAAjB,CAAL,EAAsC;A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AJ,CAAU,yEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACa,UAAJ,GAAiBd,OAAO,CAACc,UAAzB;AACD;;AAED,MAAId,OAAO,CAACe,YAAZ,EAA0B;AACxB,QAAI,CAAC,sBAASf,OAAO,CAACe,YAAjB,CAAL,EAAqC;AACnC,YAAM,IAAIb,KAAJ,CAAU,gDAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACc,YAAJ,GAAmBf,OAAO,CAACe,YAA3B;AACD;;AAED,MAAIf,OAAO,CAACgB,6BAAZ,EAA2C;AACzC,QAAI,CAAC,sBAAShB,OAAO,CAACgB,6BAAjB,CAAL,EAAsD;AACpD,YAAM,IAAId,KAAJ,CACJ,+EADI,CAAN;AAGD;;AAED,UAAMe,UAAU,GAAGjB,OAAO,CAACgB,6BAA3B;;AAEA,QAAIC,UAAU,CAACC,MAAX,IAAqB,CAAC,sBAASD,UAAU,CAACC,MAApB,CAA1B,EAAuD;AACrD,YAAM,IAAIhB,KAAJ,CAAU,wEAAV,CAAN;AACD;;AAED,QAAIe,UAAU,CAACE,UAAX,IAAyB,CAAC,sBAASF,UAAU,CAACE,UAApB,CAA9B,EAA+D;AAC7D,YAAM,IAAIjB,KAAJ,CAAU,4EAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACe,6BAAJ,GAAoChB,OAAO,CAACgB,6BAA5C;AACD;;AAED,MAAIhB,OAAO,CAACoB,eAAZ,EAA6B;AAC3B,QAAI,CAAC,sBAASpB,OAAO,CAACoB,eAAjB,CAAL,EAAwC;AACtC,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.2.
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// Generated by genversion.\nexport const version = '6.2.4';\n"]}
|
package/lib/module/AdsConsent.js
CHANGED
|
@@ -19,7 +19,7 @@ import { NativeModules } from 'react-native';
|
|
|
19
19
|
import { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
|
|
20
20
|
import { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
21
21
|
import { AdsConsentSpecialFeatures } from './AdsConsentSpecialFeatures';
|
|
22
|
-
import {
|
|
22
|
+
import { isPropertySet, isArray, isBoolean, isObject, isString } from './common';
|
|
23
23
|
const native = NativeModules.RNGoogleMobileAdsConsentModule;
|
|
24
24
|
export const AdsConsent = {
|
|
25
25
|
requestInfoUpdate() {
|
|
@@ -29,15 +29,15 @@ export const AdsConsent = {
|
|
|
29
29
|
throw new Error("AdsConsent.requestInfoUpdate(*) 'options' expected an object value.");
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
if (
|
|
32
|
+
if (isPropertySet(options, 'debugGeography') && options.debugGeography !== AdsConsentDebugGeography.DISABLED && options.debugGeography !== AdsConsentDebugGeography.EEA && options.debugGeography !== AdsConsentDebugGeography.NOT_EEA) {
|
|
33
33
|
throw new Error("AdsConsent.requestInfoUpdate(*) 'options.debugGeography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.");
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
if (
|
|
36
|
+
if (isPropertySet(options, 'tagForUnderAgeOfConsent') && !isBoolean(options.tagForUnderAgeOfConsent)) {
|
|
37
37
|
throw new Error("AdsConsent.requestInfoUpdate(*) 'options.tagForUnderAgeOfConsent' expected a boolean value.");
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
if (
|
|
40
|
+
if (isPropertySet(options, 'testDeviceIdentifiers')) {
|
|
41
41
|
if (!isArray(options.testDeviceIdentifiers)) {
|
|
42
42
|
throw new Error("AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.");
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["AdsConsent.ts"],"names":["TCModel","TCString","NativeModules","AdsConsentDebugGeography","AdsConsentPurposes","AdsConsentSpecialFeatures","
|
|
1
|
+
{"version":3,"sources":["AdsConsent.ts"],"names":["TCModel","TCString","NativeModules","AdsConsentDebugGeography","AdsConsentPurposes","AdsConsentSpecialFeatures","isPropertySet","isArray","isBoolean","isObject","isString","native","RNGoogleMobileAdsConsentModule","AdsConsent","requestInfoUpdate","options","Error","debugGeography","DISABLED","EEA","NOT_EEA","tagForUnderAgeOfConsent","testDeviceIdentifiers","deviceId","showForm","reset","getTCString","getTCModel","tcString","decode","getUserChoices","tcModel","e","__DEV__","console","warn","activelyScanDeviceCharacteristicsForIdentification","specialFeatureOptins","has","ACTIVELY_SCAN_DEVICE_CHARACTERISTICS_FOR_IDENTIFICATION","applyMarketResearchToGenerateAudienceInsights","purposeConsents","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":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,OAAT,EAAkBC,QAAlB,QAAkC,cAAlC;AACA,SAASC,aAAT,QAA8B,cAA9B;AACA,SAASC,wBAAT,QAAyC,4BAAzC;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,yBAAT,QAA0C,6BAA1C;AACA,SAASC,aAAT,EAAwBC,OAAxB,EAAiCC,SAAjC,EAA4CC,QAA5C,EAAsDC,QAAtD,QAAsE,UAAtE;AASA,MAAMC,MAAM,GAAGT,aAAa,CAACU,8BAA7B;AAEA,OAAO,MAAMC,UAA+B,GAAG;AAC7CC,EAAAA,iBAAiB,GAA+D;AAAA,QAA9DC,OAA8D,uEAA7B,EAA6B;;AAC9E,QAAI,CAACN,QAAQ,CAACM,OAAD,CAAb,EAAwB;AACtB,YAAM,IAAIC,KAAJ,CAAU,qEAAV,CAAN;AACD;;AAED,QACEV,aAAa,CAACS,OAAD,EAAU,gBAAV,CAAb,IACAA,OAAO,CAACE,cAAR,KAA2Bd,wBAAwB,CAACe,QADpD,IAEAH,OAAO,CAACE,cAAR,KAA2Bd,wBAAwB,CAACgB,GAFpD,IAGAJ,OAAO,CAACE,cAAR,KAA2Bd,wBAAwB,CAACiB,OAJtD,EAKE;AACA,YAAM,IAAIJ,KAAJ,CACJ,+KADI,CAAN;AAGD;;AAED,QACEV,aAAa,CAACS,OAAD,EAAU,yBA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H,GAAxB,CACjClC,kBAAkB,CAACuD,sCADc,CA3B9B;AA8BLC,MAAAA,yBAAyB,EAAE7B,OAAO,CAACM,oBAAR,CAA6BC,GAA7B,CACzBjC,yBAAyB,CAACwD,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"]}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { Platform } from 'react-native';
|
|
18
18
|
import * as Base64 from './Base64';
|
|
19
|
-
import { isString } from './validate';
|
|
19
|
+
import { isString, isUndefined } from './validate';
|
|
20
20
|
export * from './id';
|
|
21
21
|
export * from './path';
|
|
22
22
|
export * from './promise';
|
|
@@ -76,6 +76,9 @@ export function isError(value) {
|
|
|
76
76
|
export function hasOwnProperty(target, property) {
|
|
77
77
|
return Object.hasOwnProperty.call(target, property);
|
|
78
78
|
}
|
|
79
|
+
export function isPropertySet(target, property) {
|
|
80
|
+
return hasOwnProperty(target, property) && !isUndefined(target[property]);
|
|
81
|
+
}
|
|
79
82
|
/**
|
|
80
83
|
* Remove a trailing forward slash from a string if it exists
|
|
81
84
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["Platform","Base64","isString","ReferenceBase","getDataUrlParts","dataUrlString","isBase64","includes","mediaType","base64String","split","undefined","replace","decodeURIComponent","btoa","once","fn","context","onceResult","ranOnce","onceInner","args","apply","isError","value","Object","prototype","toString","call","Error","hasOwnProperty","target","property","stripTrailingSlash","string","endsWith","slice","isIOS","OS","isAndroid","tryJSONParse","JSON","parse","jsonError","tryJSONStringify","data","stringify"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,cAAzB;AACA,OAAO,KAAKC,MAAZ,MAAwB,UAAxB;AACA,SAASC,QAAT,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["Platform","Base64","isString","isUndefined","ReferenceBase","getDataUrlParts","dataUrlString","isBase64","includes","mediaType","base64String","split","undefined","replace","decodeURIComponent","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","OS","isAndroid","tryJSONParse","JSON","parse","jsonError","tryJSONStringify","data","stringify"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,cAAzB;AACA,OAAO,KAAKC,MAAZ,MAAwB,UAAxB;AACA,SAASC,QAAT,EAAmBC,WAAnB,QAAsC,YAAtC;AAEA,cAAc,MAAd;AACA,cAAc,QAAd;AACA,cAAc,WAAd;AACA,cAAc,YAAd;AAEA,SAASF,MAAT;AACA,SAASG,aAAT,QAA8B,iBAA9B;AAEA,OAAO,SAASC,eAAT,CAAyBC,aAAzB,EAAgD;AACrD,QAAMC,QAAQ,GAAGD,aAAa,CAACE,QAAd,CAAuB,SAAvB,CAAjB;AACA,MAAI,CAACC,SAAD,EAAYC,YAA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cAAT,CAAwBC,MAAxB,EAAyCC,QAAzC,EAAgE;AACrE,SAAOP,MAAM,CAACK,cAAP,CAAsBF,IAAtB,CAA2BG,MAA3B,EAAmCC,QAAnC,CAAP;AACD;AAED,OAAO,SAASC,aAAT,CAAuBF,MAAvB,EAAwCC,QAAxC,EAA+D;AACpE,SACEF,cAAc,CAACC,MAAD,EAASC,QAAT,CAAd,IACA,CAAC9B,WAAW,CAAE6B,MAAD,CAAyCC,QAAzC,CAAD,CAFd;AAID;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,kBAAT,CAA4BC,MAA5B,EAA4C;AACjD,MAAI,CAAClC,QAAQ,CAACkC,MAAD,CAAb,EAAuB;AACrB,WAAOA,MAAP;AACD;;AACD,SAAOA,MAAM,CAACC,QAAP,CAAgB,GAAhB,IAAuBD,MAAM,CAACE,KAAP,CAAa,CAAb,EAAgB,CAAC,CAAjB,CAAvB,GAA6CF,MAApD;AACD;AAED,OAAO,MAAMG,KAAK,GAAGvC,QAAQ,CAACwC,EAAT,KAAgB,KAA9B;AAEP,OAAO,MAAMC,SAAS,GAAGzC,QAAQ,CAACwC,EAAT,KAAgB,SAAlC;AAEP,OAAO,SAASE,YAAT,CAAsBN,MAAtB,EAAsC;AAC3C,MAAI;AACF,WAAOA,MAAM,IAAIO,IAAI,CAACC,KAAL,CAAWR,MAAX,CAAjB;AACD,GAFD,CAEE,OAAOS,SAAP,EAAkB;AAClB,WAAOT,MAAP;AACD;AACF;AAED,OAAO,SAASU,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"]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { isPropertySet, isArray, isBoolean, isObject } from './common';
|
|
18
18
|
import { MaxAdContentRating } from './MaxAdContentRating';
|
|
19
19
|
export function validateAdRequestConfiguration(requestConfiguration) {
|
|
20
20
|
const out = {};
|
|
@@ -31,7 +31,7 @@ export function validateAdRequestConfiguration(requestConfiguration) {
|
|
|
31
31
|
out.maxAdContentRating = requestConfiguration.maxAdContentRating;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
if (
|
|
34
|
+
if (isPropertySet(requestConfiguration, 'tagForChildDirectedTreatment')) {
|
|
35
35
|
if (!isBoolean(requestConfiguration.tagForChildDirectedTreatment)) {
|
|
36
36
|
throw new Error("'requestConfiguration.tagForChildDirectedTreatment' expected a boolean value");
|
|
37
37
|
}
|
|
@@ -39,7 +39,7 @@ export function validateAdRequestConfiguration(requestConfiguration) {
|
|
|
39
39
|
out.tagForChildDirectedTreatment = requestConfiguration.tagForChildDirectedTreatment;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
if (
|
|
42
|
+
if (isPropertySet(requestConfiguration, 'tagForUnderAgeOfConsent')) {
|
|
43
43
|
if (!isBoolean(requestConfiguration.tagForUnderAgeOfConsent)) {
|
|
44
44
|
throw new Error("'requestConfiguration.tagForUnderAgeOfConsent' expected a boolean value");
|
|
45
45
|
}
|
|
@@ -47,7 +47,7 @@ export function validateAdRequestConfiguration(requestConfiguration) {
|
|
|
47
47
|
out.tagForUnderAgeOfConsent = requestConfiguration.tagForUnderAgeOfConsent;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
if (
|
|
50
|
+
if (isPropertySet(requestConfiguration, 'testDeviceIdentifiers')) {
|
|
51
51
|
if (!isArray(requestConfiguration.testDeviceIdentifiers)) {
|
|
52
52
|
throw new Error("'requestConfiguration.testDeviceIdentifiers' expected an array value");
|
|
53
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["validateAdRequestConfiguration.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["validateAdRequestConfiguration.ts"],"names":["isPropertySet","isArray","isBoolean","isObject","MaxAdContentRating","validateAdRequestConfiguration","requestConfiguration","out","Error","maxAdContentRating","G","PG","T","MA","tagForChildDirectedTreatment","tagForUnderAgeOfConsent","testDeviceIdentifiers"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,aAAT,EAAwBC,OAAxB,EAAiCC,SAAjC,EAA4CC,QAA5C,QAA4D,UAA5D;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AAGA,OAAO,SAASC,8BAAT,CAAwCC,oBAAxC,EAAoF;AACzF,QAAMC,GAAyB,GAAG,EAAlC;;AAEA,MAAI,CAACJ,QAAQ,CAACG,oBAAD,CAAb,EAAqC;AACnC,UAAM,IAAIE,KAAJ,CAAU,iDAAV,CAAN;AACD;;AAED,MAAIF,oBAAoB,CAACG,kBAAzB,EAA6C;AAC3C,QACEH,oBAAoB,CAACG,kBAArB,KAA4CL,kBAAkB,CAACM,CAA/D,IACAJ,oBAAoB,CAACG,kBAArB,KAA4CL,kBAAkB,CAACO,EAD/D,IAEAL,oBAAoB,CAACG,kBAArB,KAA4CL,kBAAkB,CAACQ,CAF/D,IAGAN,oBAAoB,CAACG,kBAArB,KAA4CL,kBAAkB,CAACS,EAJjE,EAKE;AACA,YAAM,IAAIL,KAAJ,CACJ,qJADI,CAAN;AAGD;;AAEDD,IAAAA,GAAG,CAACE,kBAAJ,GAAyBH,oBAAoB,CAACG,kBAA9C;AACD;;AAED,MAAIT,aAAa,CAACM,oBAAD,EAAuB,8BAAvB,CAAjB,EAAyE;AACvE,QAAI,CAACJ,SAAS,CAACI,oBAAoB,CAACQ,4BAAtB,CAAd,EAAmE;AACjE,YAAM,IAAIN,KAAJ,CACJ,8EADI,CAAN;AAGD;;AAEDD,IAAAA,GAAG,CAACO,4BAAJ,GAAmCR,oBAAoB,CAACQ,4BAAxD;AACD;;AAED,MAAId,aAAa,CAACM,oBAAD,EAAuB,yBAAvB,CAAjB,EAAoE;AAClE,QAAI,CAACJ,SAAS,CAACI,oBAAoB,CAACS,uBAAtB,CAAd,EAA8D;AAC5D,YAAM,IAAIP,KAAJ,CAAU,yEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACQ,uBAAJ,GAA8BT,oBAAoB,CAACS,uBAAnD;AACD;;AAED,MAAIf,aAAa,CAACM,oBAAD,EAAuB,uBAAvB,CAAjB,EAAkE;AAChE,QAAI,CAACL,OAAO,CAACK,oBAAoB,CAACU,qBAAtB,CAAZ,EAA0D;AACxD,YAAM,IAAIR,KAAJ,CAAU,sEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACS,qBAAJ,GAA4BV,oBAAoB,CAACU,qBAAjD;AACD;;AAED,SAAOT,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"]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { isPropertySet, isArray, isBoolean, isObject, isString, isUndefined, isValidUrl } from './common';
|
|
18
18
|
export function validateAdRequestOptions(options) {
|
|
19
19
|
const out = {};
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ export function validateAdRequestOptions(options) {
|
|
|
26
26
|
throw new Error("'options' expected an object value");
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if (
|
|
29
|
+
if (isPropertySet(options, 'requestNonPersonalizedAdsOnly')) {
|
|
30
30
|
if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {
|
|
31
31
|
throw new Error("'options.requestNonPersonalizedAdsOnly' expected a boolean value");
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["validateAdRequestOptions.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["validateAdRequestOptions.ts"],"names":["isPropertySet","isArray","isBoolean","isObject","isString","isUndefined","isValidUrl","validateAdRequestOptions","options","out","Error","requestNonPersonalizedAdsOnly","networkExtras","Object","entries","forEach","key","value","keywords","i","length","keyword","contentUrl","requestAgent","serverSideVerificationOptions","ssvOptions","userId","customData","customTargeting"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SACEA,aADF,EAEEC,OAFF,EAGEC,SAHF,EAIEC,QAJF,EAKEC,QALF,EAMEC,WANF,EAOEC,UAPF,QAQO,UARP;AAWA,OAAO,SAASC,wBAAT,CAAkCC,OAAlC,EAA4D;AACjE,QAAMC,GAAmB,GAAG,EAA5B;;AAEA,MAAIJ,WAAW,CAACG,OAAD,CAAf,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAACN,QAAQ,CAACK,OAAD,CAAb,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAIV,aAAa,CAACQ,OAAD,EAAU,+BAAV,CAAjB,EAA6D;AAC3D,QAAI,CAACN,SAAS,CAACM,OAAO,CAACG,6BAAT,CAAd,EAAuD;AACrD,YAAM,IAAID,KAAJ,CAAU,kEAAV,CAAN;AACD;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EAAV,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"]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { isPropertySet, isBoolean, isObject, isUndefined } from './common';
|
|
18
18
|
export function validateAdShowOptions(options) {
|
|
19
19
|
const out = {};
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ export function validateAdShowOptions(options) {
|
|
|
26
26
|
throw new Error("'options' expected an object value");
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if (
|
|
29
|
+
if (isPropertySet(options, 'immersiveModeEnabled')) {
|
|
30
30
|
if (!isBoolean(options.immersiveModeEnabled)) {
|
|
31
31
|
throw new Error("'options.immersiveModeEnabled' expected a boolean value");
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["validateAdShowOptions.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["validateAdShowOptions.ts"],"names":["isPropertySet","isBoolean","isObject","isUndefined","validateAdShowOptions","options","out","Error","immersiveModeEnabled"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,aAAT,EAAwBC,SAAxB,EAAmCC,QAAnC,EAA6CC,WAA7C,QAAgE,UAAhE;AAGA,OAAO,SAASC,qBAAT,CAA+BC,OAA/B,EAAwD;AAC7D,QAAMC,GAAkB,GAAG,EAA3B;;AAEA,MAAIH,WAAW,CAACE,OAAD,CAAf,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAACJ,QAAQ,CAACG,OAAD,CAAb,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAIP,aAAa,CAACK,OAAD,EAAU,sBAAV,CAAjB,EAAoD;AAClD,QAAI,CAACJ,SAAS,CAACI,OAAO,CAACG,oBAAT,CAAd,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/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// Generated by genversion.\nexport const version = '6.2.
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// Generated by genversion.\nexport const version = '6.2.4';\n"]}
|
|
@@ -15,6 +15,7 @@ export declare function getDataUrlParts(dataUrlString: string): {
|
|
|
15
15
|
export declare function once<T>(fn: () => void, context: unknown): (this: T, ...args: []) => void;
|
|
16
16
|
export declare function isError(value: unknown): boolean;
|
|
17
17
|
export declare function hasOwnProperty(target: unknown, property: PropertyKey): boolean;
|
|
18
|
+
export declare function isPropertySet(target: unknown, property: PropertyKey): boolean;
|
|
18
19
|
/**
|
|
19
20
|
* Remove a trailing forward slash from a string if it exists
|
|
20
21
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "6.2.
|
|
1
|
+
export declare const SDK_VERSION = "6.2.4";
|
|
2
2
|
export { default, MobileAds } from './MobileAds';
|
|
3
3
|
export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
|
|
4
4
|
export { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.2.
|
|
1
|
+
export declare const version = "6.2.4";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-google-mobile-ads",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.4",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Google Mobile Ads is an easy way to monetize mobile apps with targeted, in-app advertising.",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
package/src/AdsConsent.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { NativeModules } from 'react-native';
|
|
|
20
20
|
import { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
|
|
21
21
|
import { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
22
22
|
import { AdsConsentSpecialFeatures } from './AdsConsentSpecialFeatures';
|
|
23
|
-
import {
|
|
23
|
+
import { isPropertySet, isArray, isBoolean, isObject, isString } from './common';
|
|
24
24
|
import {
|
|
25
25
|
AdsConsentFormResult,
|
|
26
26
|
AdsConsentInfo,
|
|
@@ -38,7 +38,7 @@ export const AdsConsent: AdsConsentInterface = {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (
|
|
41
|
-
|
|
41
|
+
isPropertySet(options, 'debugGeography') &&
|
|
42
42
|
options.debugGeography !== AdsConsentDebugGeography.DISABLED &&
|
|
43
43
|
options.debugGeography !== AdsConsentDebugGeography.EEA &&
|
|
44
44
|
options.debugGeography !== AdsConsentDebugGeography.NOT_EEA
|
|
@@ -49,7 +49,7 @@ export const AdsConsent: AdsConsentInterface = {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
if (
|
|
52
|
-
|
|
52
|
+
isPropertySet(options, 'tagForUnderAgeOfConsent') &&
|
|
53
53
|
!isBoolean(options.tagForUnderAgeOfConsent)
|
|
54
54
|
) {
|
|
55
55
|
throw new Error(
|
|
@@ -57,7 +57,7 @@ export const AdsConsent: AdsConsentInterface = {
|
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
if (
|
|
60
|
+
if (isPropertySet(options, 'testDeviceIdentifiers')) {
|
|
61
61
|
if (!isArray(options.testDeviceIdentifiers)) {
|
|
62
62
|
throw new Error(
|
|
63
63
|
"AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.",
|
package/src/common/index.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { Platform } from 'react-native';
|
|
19
19
|
import * as Base64 from './Base64';
|
|
20
|
-
import { isString } from './validate';
|
|
20
|
+
import { isString, isUndefined } from './validate';
|
|
21
21
|
|
|
22
22
|
export * from './id';
|
|
23
23
|
export * from './path';
|
|
@@ -69,6 +69,13 @@ export function hasOwnProperty(target: unknown, property: PropertyKey) {
|
|
|
69
69
|
return Object.hasOwnProperty.call(target, property);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
export function isPropertySet(target: unknown, property: PropertyKey) {
|
|
73
|
+
return (
|
|
74
|
+
hasOwnProperty(target, property) &&
|
|
75
|
+
!isUndefined((target as Record<PropertyKey, unknown>)[property])
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
72
79
|
/**
|
|
73
80
|
* Remove a trailing forward slash from a string if it exists
|
|
74
81
|
*
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { isPropertySet, isArray, isBoolean, isObject } from './common';
|
|
19
19
|
import { MaxAdContentRating } from './MaxAdContentRating';
|
|
20
20
|
import { RequestConfiguration } from './types/RequestConfiguration';
|
|
21
21
|
|
|
@@ -41,7 +41,7 @@ export function validateAdRequestConfiguration(requestConfiguration: RequestConf
|
|
|
41
41
|
out.maxAdContentRating = requestConfiguration.maxAdContentRating;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
if (
|
|
44
|
+
if (isPropertySet(requestConfiguration, 'tagForChildDirectedTreatment')) {
|
|
45
45
|
if (!isBoolean(requestConfiguration.tagForChildDirectedTreatment)) {
|
|
46
46
|
throw new Error(
|
|
47
47
|
"'requestConfiguration.tagForChildDirectedTreatment' expected a boolean value",
|
|
@@ -51,7 +51,7 @@ export function validateAdRequestConfiguration(requestConfiguration: RequestConf
|
|
|
51
51
|
out.tagForChildDirectedTreatment = requestConfiguration.tagForChildDirectedTreatment;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
if (
|
|
54
|
+
if (isPropertySet(requestConfiguration, 'tagForUnderAgeOfConsent')) {
|
|
55
55
|
if (!isBoolean(requestConfiguration.tagForUnderAgeOfConsent)) {
|
|
56
56
|
throw new Error("'requestConfiguration.tagForUnderAgeOfConsent' expected a boolean value");
|
|
57
57
|
}
|
|
@@ -59,7 +59,7 @@ export function validateAdRequestConfiguration(requestConfiguration: RequestConf
|
|
|
59
59
|
out.tagForUnderAgeOfConsent = requestConfiguration.tagForUnderAgeOfConsent;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
if (
|
|
62
|
+
if (isPropertySet(requestConfiguration, 'testDeviceIdentifiers')) {
|
|
63
63
|
if (!isArray(requestConfiguration.testDeviceIdentifiers)) {
|
|
64
64
|
throw new Error("'requestConfiguration.testDeviceIdentifiers' expected an array value");
|
|
65
65
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
|
-
|
|
19
|
+
isPropertySet,
|
|
20
20
|
isArray,
|
|
21
21
|
isBoolean,
|
|
22
22
|
isObject,
|
|
@@ -37,7 +37,7 @@ export function validateAdRequestOptions(options?: RequestOptions) {
|
|
|
37
37
|
throw new Error("'options' expected an object value");
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
if (
|
|
40
|
+
if (isPropertySet(options, 'requestNonPersonalizedAdsOnly')) {
|
|
41
41
|
if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {
|
|
42
42
|
throw new Error("'options.requestNonPersonalizedAdsOnly' expected a boolean value");
|
|
43
43
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { isPropertySet, isBoolean, isObject, isUndefined } from './common';
|
|
19
19
|
import { AdShowOptions } from './types/AdShowOptions';
|
|
20
20
|
|
|
21
21
|
export function validateAdShowOptions(options?: AdShowOptions) {
|
|
@@ -29,7 +29,7 @@ export function validateAdShowOptions(options?: AdShowOptions) {
|
|
|
29
29
|
throw new Error("'options' expected an object value");
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
if (
|
|
32
|
+
if (isPropertySet(options, 'immersiveModeEnabled')) {
|
|
33
33
|
if (!isBoolean(options.immersiveModeEnabled)) {
|
|
34
34
|
throw new Error("'options.immersiveModeEnabled' expected a boolean value");
|
|
35
35
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '6.2.
|
|
2
|
+
export const version = '6.2.4';
|