react-native-google-mobile-ads 8.1.0 → 8.1.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.
Files changed (238) hide show
  1. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsAdHelper.kt +17 -42
  2. package/ios_config.sh +3 -3
  3. package/lib/commonjs/AdEventType.js +1 -4
  4. package/lib/commonjs/AdEventType.js.map +1 -1
  5. package/lib/commonjs/AdsConsent.js +2 -25
  6. package/lib/commonjs/AdsConsent.js.map +1 -1
  7. package/lib/commonjs/AdsConsentDebugGeography.js +0 -3
  8. package/lib/commonjs/AdsConsentDebugGeography.js.map +1 -1
  9. package/lib/commonjs/AdsConsentPurposes.js +1 -4
  10. package/lib/commonjs/AdsConsentPurposes.js.map +1 -1
  11. package/lib/commonjs/AdsConsentSpecialFeatures.js +1 -4
  12. package/lib/commonjs/AdsConsentSpecialFeatures.js.map +1 -1
  13. package/lib/commonjs/AdsConsentStatus.js +0 -3
  14. package/lib/commonjs/AdsConsentStatus.js.map +1 -1
  15. package/lib/commonjs/BannerAdSize.js +1 -4
  16. package/lib/commonjs/BannerAdSize.js.map +1 -1
  17. package/lib/commonjs/GAMAdEventType.js +1 -4
  18. package/lib/commonjs/GAMAdEventType.js.map +1 -1
  19. package/lib/commonjs/MaxAdContentRating.js +1 -4
  20. package/lib/commonjs/MaxAdContentRating.js.map +1 -1
  21. package/lib/commonjs/MobileAds.js +0 -14
  22. package/lib/commonjs/MobileAds.js.map +1 -1
  23. package/lib/commonjs/RewardedAdEventType.js +1 -4
  24. package/lib/commonjs/RewardedAdEventType.js.map +1 -1
  25. package/lib/commonjs/TestIds.js +1 -2
  26. package/lib/commonjs/TestIds.js.map +1 -1
  27. package/lib/commonjs/ads/AppOpenAd.js +0 -14
  28. package/lib/commonjs/ads/AppOpenAd.js.map +1 -1
  29. package/lib/commonjs/ads/BannerAd.js +1 -6
  30. package/lib/commonjs/ads/BannerAd.js.map +1 -1
  31. package/lib/commonjs/ads/BaseAd.js +1 -20
  32. package/lib/commonjs/ads/BaseAd.js.map +1 -1
  33. package/lib/commonjs/ads/GAMBannerAd.js +1 -14
  34. package/lib/commonjs/ads/GAMBannerAd.js.map +1 -1
  35. package/lib/commonjs/ads/GAMInterstitialAd.js +0 -6
  36. package/lib/commonjs/ads/GAMInterstitialAd.js.map +1 -1
  37. package/lib/commonjs/ads/InterstitialAd.js +0 -14
  38. package/lib/commonjs/ads/InterstitialAd.js.map +1 -1
  39. package/lib/commonjs/ads/MobileAd.js +2 -55
  40. package/lib/commonjs/ads/MobileAd.js.map +1 -1
  41. package/lib/commonjs/ads/RewardedAd.js +0 -16
  42. package/lib/commonjs/ads/RewardedAd.js.map +1 -1
  43. package/lib/commonjs/ads/RewardedInterstitialAd.js +0 -16
  44. package/lib/commonjs/ads/RewardedInterstitialAd.js.map +1 -1
  45. package/lib/commonjs/common/Base64.js +4 -23
  46. package/lib/commonjs/common/Base64.js.map +1 -1
  47. package/lib/commonjs/common/MutatableParams.js +2 -12
  48. package/lib/commonjs/common/MutatableParams.js.map +1 -1
  49. package/lib/commonjs/common/ReferenceBase.js +2 -10
  50. package/lib/commonjs/common/ReferenceBase.js.map +1 -1
  51. package/lib/commonjs/common/deeps.js +1 -17
  52. package/lib/commonjs/common/deeps.js.map +1 -1
  53. package/lib/commonjs/common/id.js +7 -17
  54. package/lib/commonjs/common/id.js.map +1 -1
  55. package/lib/commonjs/common/index.js +2 -34
  56. package/lib/commonjs/common/index.js.map +1 -1
  57. package/lib/commonjs/common/path.js +9 -28
  58. package/lib/commonjs/common/path.js.map +1 -1
  59. package/lib/commonjs/common/promise.js +1 -7
  60. package/lib/commonjs/common/promise.js.map +1 -1
  61. package/lib/commonjs/common/serialize.js +4 -8
  62. package/lib/commonjs/common/serialize.js.map +1 -1
  63. package/lib/commonjs/common/validate.js +17 -44
  64. package/lib/commonjs/common/validate.js.map +1 -1
  65. package/lib/commonjs/declarations.d.js.map +1 -1
  66. package/lib/commonjs/hooks/useAppOpenAd.js +0 -6
  67. package/lib/commonjs/hooks/useAppOpenAd.js.map +1 -1
  68. package/lib/commonjs/hooks/useFullScreenAd.js +5 -16
  69. package/lib/commonjs/hooks/useFullScreenAd.js.map +1 -1
  70. package/lib/commonjs/hooks/useInterstitialAd.js +0 -6
  71. package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -1
  72. package/lib/commonjs/hooks/useRewardedAd.js +0 -6
  73. package/lib/commonjs/hooks/useRewardedAd.js.map +1 -1
  74. package/lib/commonjs/hooks/useRewardedInterstitialAd.js +0 -6
  75. package/lib/commonjs/hooks/useRewardedInterstitialAd.js.map +1 -1
  76. package/lib/commonjs/index.js +1 -29
  77. package/lib/commonjs/index.js.map +1 -1
  78. package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js +8 -20
  79. package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -1
  80. package/lib/commonjs/internal/Module.js +2 -18
  81. package/lib/commonjs/internal/Module.js.map +1 -1
  82. package/lib/commonjs/internal/NativeError.js +2 -13
  83. package/lib/commonjs/internal/NativeError.js.map +1 -1
  84. package/lib/commonjs/internal/SharedEventEmitter.js +2 -3
  85. package/lib/commonjs/internal/SharedEventEmitter.js.map +1 -1
  86. package/lib/commonjs/internal/constants.js +1 -1
  87. package/lib/commonjs/internal/constants.js.map +1 -1
  88. package/lib/commonjs/internal/index.js +0 -5
  89. package/lib/commonjs/internal/index.js.map +1 -1
  90. package/lib/commonjs/internal/registry/nativeModule.js +13 -44
  91. package/lib/commonjs/internal/registry/nativeModule.js.map +1 -1
  92. package/lib/commonjs/types/AdEventListener.js.map +1 -1
  93. package/lib/commonjs/types/AdEventsListener.js.map +1 -1
  94. package/lib/commonjs/types/AdShowOptions.js.map +1 -1
  95. package/lib/commonjs/types/AdStates.js.map +1 -1
  96. package/lib/commonjs/types/AdapterStatus.js +3 -6
  97. package/lib/commonjs/types/AdapterStatus.js.map +1 -1
  98. package/lib/commonjs/types/AdsConsent.interface.js.map +1 -1
  99. package/lib/commonjs/types/AppEvent.js.map +1 -1
  100. package/lib/commonjs/types/BannerAdProps.js.map +1 -1
  101. package/lib/commonjs/types/GoogleMobileAdsNativeModule.js.map +1 -1
  102. package/lib/commonjs/types/MobileAd.interface.js.map +1 -1
  103. package/lib/commonjs/types/MobileAdsModule.interface.js.map +1 -1
  104. package/lib/commonjs/types/Module.interface.js.map +1 -1
  105. package/lib/commonjs/types/RequestConfiguration.js.map +1 -1
  106. package/lib/commonjs/types/RequestOptions.js.map +1 -1
  107. package/lib/commonjs/types/RewardedAdReward.js.map +1 -1
  108. package/lib/commonjs/types/index.js +0 -22
  109. package/lib/commonjs/types/index.js.map +1 -1
  110. package/lib/commonjs/validateAdRequestConfiguration.js +1 -13
  111. package/lib/commonjs/validateAdRequestConfiguration.js.map +1 -1
  112. package/lib/commonjs/validateAdRequestOptions.js +1 -29
  113. package/lib/commonjs/validateAdRequestOptions.js.map +1 -1
  114. package/lib/commonjs/validateAdShowOptions.js +1 -7
  115. package/lib/commonjs/validateAdShowOptions.js.map +1 -1
  116. package/lib/commonjs/version.js +1 -1
  117. package/lib/commonjs/version.js.map +1 -1
  118. package/lib/module/AdEventType.js +1 -1
  119. package/lib/module/AdEventType.js.map +1 -1
  120. package/lib/module/AdsConsent.js +2 -18
  121. package/lib/module/AdsConsent.js.map +1 -1
  122. package/lib/module/AdsConsentDebugGeography.js +0 -1
  123. package/lib/module/AdsConsentDebugGeography.js.map +1 -1
  124. package/lib/module/AdsConsentPurposes.js +1 -1
  125. package/lib/module/AdsConsentPurposes.js.map +1 -1
  126. package/lib/module/AdsConsentSpecialFeatures.js +1 -1
  127. package/lib/module/AdsConsentSpecialFeatures.js.map +1 -1
  128. package/lib/module/AdsConsentStatus.js +0 -1
  129. package/lib/module/AdsConsentStatus.js.map +1 -1
  130. package/lib/module/BannerAdSize.js +1 -1
  131. package/lib/module/BannerAdSize.js.map +1 -1
  132. package/lib/module/GAMAdEventType.js +1 -1
  133. package/lib/module/GAMAdEventType.js.map +1 -1
  134. package/lib/module/MaxAdContentRating.js +1 -1
  135. package/lib/module/MaxAdContentRating.js.map +1 -1
  136. package/lib/module/MobileAds.js +0 -8
  137. package/lib/module/MobileAds.js.map +1 -1
  138. package/lib/module/RewardedAdEventType.js +1 -1
  139. package/lib/module/RewardedAdEventType.js.map +1 -1
  140. package/lib/module/TestIds.js +1 -0
  141. package/lib/module/TestIds.js.map +1 -1
  142. package/lib/module/ads/AppOpenAd.js +1 -8
  143. package/lib/module/ads/AppOpenAd.js.map +1 -1
  144. package/lib/module/ads/BannerAd.js +2 -2
  145. package/lib/module/ads/BannerAd.js.map +1 -1
  146. package/lib/module/ads/BaseAd.js +1 -9
  147. package/lib/module/ads/BaseAd.js.map +1 -1
  148. package/lib/module/ads/GAMBannerAd.js +2 -7
  149. package/lib/module/ads/GAMBannerAd.js.map +1 -1
  150. package/lib/module/ads/GAMInterstitialAd.js +0 -3
  151. package/lib/module/ads/GAMInterstitialAd.js.map +1 -1
  152. package/lib/module/ads/InterstitialAd.js +1 -9
  153. package/lib/module/ads/InterstitialAd.js.map +1 -1
  154. package/lib/module/ads/MobileAd.js +3 -47
  155. package/lib/module/ads/MobileAd.js.map +1 -1
  156. package/lib/module/ads/RewardedAd.js +1 -10
  157. package/lib/module/ads/RewardedAd.js.map +1 -1
  158. package/lib/module/ads/RewardedInterstitialAd.js +1 -10
  159. package/lib/module/ads/RewardedInterstitialAd.js.map +1 -1
  160. package/lib/module/common/Base64.js +4 -17
  161. package/lib/module/common/Base64.js.map +1 -1
  162. package/lib/module/common/MutatableParams.js +3 -9
  163. package/lib/module/common/MutatableParams.js.map +1 -1
  164. package/lib/module/common/ReferenceBase.js +2 -8
  165. package/lib/module/common/ReferenceBase.js.map +1 -1
  166. package/lib/module/common/deeps.js +3 -15
  167. package/lib/module/common/deeps.js.map +1 -1
  168. package/lib/module/common/id.js +7 -16
  169. package/lib/module/common/id.js.map +1 -1
  170. package/lib/module/common/index.js +2 -11
  171. package/lib/module/common/index.js.map +1 -1
  172. package/lib/module/common/path.js +9 -19
  173. package/lib/module/common/path.js.map +1 -1
  174. package/lib/module/common/promise.js +3 -5
  175. package/lib/module/common/promise.js.map +1 -1
  176. package/lib/module/common/serialize.js +4 -4
  177. package/lib/module/common/serialize.js.map +1 -1
  178. package/lib/module/common/validate.js +17 -24
  179. package/lib/module/common/validate.js.map +1 -1
  180. package/lib/module/declarations.d.js.map +1 -1
  181. package/lib/module/hooks/useAppOpenAd.js +2 -1
  182. package/lib/module/hooks/useAppOpenAd.js.map +1 -1
  183. package/lib/module/hooks/useFullScreenAd.js +5 -11
  184. package/lib/module/hooks/useFullScreenAd.js.map +1 -1
  185. package/lib/module/hooks/useInterstitialAd.js +2 -1
  186. package/lib/module/hooks/useInterstitialAd.js.map +1 -1
  187. package/lib/module/hooks/useRewardedAd.js +2 -1
  188. package/lib/module/hooks/useRewardedAd.js.map +1 -1
  189. package/lib/module/hooks/useRewardedInterstitialAd.js +2 -1
  190. package/lib/module/hooks/useRewardedInterstitialAd.js.map +1 -1
  191. package/lib/module/index.js +3 -1
  192. package/lib/module/index.js.map +1 -1
  193. package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js +9 -18
  194. package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -1
  195. package/lib/module/internal/Module.js +3 -13
  196. package/lib/module/internal/Module.js.map +1 -1
  197. package/lib/module/internal/NativeError.js +2 -11
  198. package/lib/module/internal/NativeError.js.map +1 -1
  199. package/lib/module/internal/SharedEventEmitter.js +1 -0
  200. package/lib/module/internal/SharedEventEmitter.js.map +1 -1
  201. package/lib/module/internal/constants.js +1 -0
  202. package/lib/module/internal/constants.js.map +1 -1
  203. package/lib/module/internal/index.js +1 -0
  204. package/lib/module/internal/index.js.map +1 -1
  205. package/lib/module/internal/registry/nativeModule.js +13 -35
  206. package/lib/module/internal/registry/nativeModule.js.map +1 -1
  207. package/lib/module/types/AdEventListener.js.map +1 -1
  208. package/lib/module/types/AdEventsListener.js.map +1 -1
  209. package/lib/module/types/AdShowOptions.js.map +1 -1
  210. package/lib/module/types/AdStates.js.map +1 -1
  211. package/lib/module/types/AdapterStatus.js +1 -1
  212. package/lib/module/types/AdapterStatus.js.map +1 -1
  213. package/lib/module/types/AdsConsent.interface.js.map +1 -1
  214. package/lib/module/types/AppEvent.js.map +1 -1
  215. package/lib/module/types/BannerAdProps.js.map +1 -1
  216. package/lib/module/types/GoogleMobileAdsNativeModule.js.map +1 -1
  217. package/lib/module/types/MobileAd.interface.js.map +1 -1
  218. package/lib/module/types/MobileAdsModule.interface.js.map +1 -1
  219. package/lib/module/types/Module.interface.js.map +1 -1
  220. package/lib/module/types/RequestConfiguration.js.map +1 -1
  221. package/lib/module/types/RequestOptions.js.map +1 -1
  222. package/lib/module/types/RewardedAdReward.js.map +1 -1
  223. package/lib/module/types/index.js +1 -0
  224. package/lib/module/types/index.js.map +1 -1
  225. package/lib/module/validateAdRequestConfiguration.js +1 -10
  226. package/lib/module/validateAdRequestConfiguration.js.map +1 -1
  227. package/lib/module/validateAdRequestOptions.js +1 -27
  228. package/lib/module/validateAdRequestOptions.js.map +1 -1
  229. package/lib/module/validateAdShowOptions.js +1 -5
  230. package/lib/module/validateAdShowOptions.js.map +1 -1
  231. package/lib/module/version.js +1 -1
  232. package/lib/module/version.js.map +1 -1
  233. package/lib/typescript/common/Base64.d.ts +0 -1
  234. package/lib/typescript/index.d.ts +1 -1
  235. package/lib/typescript/version.d.ts +1 -1
  236. package/package.json +35 -29
  237. package/src/internal/registry/nativeModule.ts +2 -0
  238. package/src/version.ts +1 -1
@@ -4,47 +4,27 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.MobileAd = void 0;
7
-
8
7
  var _common = require("../common");
9
-
10
8
  var _NativeError = require("../internal/NativeError");
11
-
12
9
  var _AdEventType = require("../AdEventType");
13
-
14
10
  var _RewardedAdEventType = require("../RewardedAdEventType");
15
-
16
11
  var _GAMAdEventType = require("../GAMAdEventType");
17
-
18
12
  var _validateAdShowOptions = require("../validateAdShowOptions");
19
-
20
13
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
-
22
14
  class MobileAd {
23
15
  constructor(type, googleMobileAds, requestId, adUnitId, requestOptions) {
24
16
  _defineProperty(this, "_type", void 0);
25
-
26
17
  _defineProperty(this, "_googleMobileAds", void 0);
27
-
28
18
  _defineProperty(this, "_requestId", void 0);
29
-
30
19
  _defineProperty(this, "_adUnitId", void 0);
31
-
32
20
  _defineProperty(this, "_requestOptions", void 0);
33
-
34
21
  _defineProperty(this, "_loaded", void 0);
35
-
36
22
  _defineProperty(this, "_isLoadCalled", void 0);
37
-
38
23
  _defineProperty(this, "_adEventsListeners", void 0);
39
-
40
24
  _defineProperty(this, "_adEventListenersMap", void 0);
41
-
42
25
  _defineProperty(this, "_adEventsListenerId", void 0);
43
-
44
26
  _defineProperty(this, "_adEventListenerId", void 0);
45
-
46
27
  _defineProperty(this, "_nativeListener", void 0);
47
-
48
28
  this._type = type;
49
29
  this._googleMobileAds = googleMobileAds;
50
30
  this._requestId = requestId;
@@ -54,11 +34,11 @@ class MobileAd {
54
34
  this._isLoadCalled = false;
55
35
  this._adEventsListeners = new Map();
56
36
  this._adEventListenersMap = new Map();
57
- Object.values({ ..._AdEventType.AdEventType,
37
+ Object.values({
38
+ ..._AdEventType.AdEventType,
58
39
  ..._RewardedAdEventType.RewardedAdEventType,
59
40
  ..._GAMAdEventType.GAMAdEventType,
60
41
  _: _AdEventType.AdEventType.LOADED // since AdEventType.LOADED is overwritten by RewardedAdEventType.LOADED
61
-
62
42
  }).forEach(type => {
63
43
  this._adEventListenersMap.set(type, new Map());
64
44
  });
@@ -66,84 +46,64 @@ class MobileAd {
66
46
  this._adEventsListenerId = 0;
67
47
  this._nativeListener = googleMobileAds.emitter.addListener(`google_mobile_ads_${type}_event:${adUnitId}:${requestId}`, this._handleAdEvent.bind(this));
68
48
  }
69
-
70
49
  _handleAdEvent(event) {
71
50
  const {
72
51
  type,
73
52
  error,
74
53
  data
75
54
  } = event.body;
76
-
77
55
  if (type === _AdEventType.AdEventType.LOADED || type === _RewardedAdEventType.RewardedAdEventType.LOADED) {
78
56
  this._loaded = true;
79
57
  }
80
-
81
58
  if (type === _AdEventType.AdEventType.CLOSED) {
82
59
  this._loaded = false;
83
60
  this._isLoadCalled = false;
84
61
  }
85
-
86
62
  let payload = data;
87
-
88
63
  if (error) {
89
64
  payload = _NativeError.NativeError.fromEvent(error, 'googleMobileAds');
90
65
  }
91
-
92
66
  this._adEventsListeners.forEach(listener => {
93
67
  listener({
94
68
  type,
95
69
  payload
96
70
  });
97
71
  });
98
-
99
72
  this._getAdEventListeners(type).forEach(listener => {
100
73
  listener(payload);
101
74
  });
102
75
  }
103
-
104
76
  _addAdEventsListener(listener) {
105
77
  if (!(0, _common.isFunction)(listener)) {
106
78
  throw new Error(`${this._className}.addAdEventsListener(*) 'listener' expected a function.`);
107
79
  }
108
-
109
80
  const id = this._adEventsListenerId++;
110
-
111
81
  this._adEventsListeners.set(id, listener);
112
-
113
82
  return () => {
114
83
  this._adEventsListeners.delete(id);
115
84
  };
116
85
  }
117
-
118
86
  _addAdEventListener(type, listener) {
119
87
  if (!((0, _common.isOneOf)(type, Object.values(_AdEventType.AdEventType)) || (0, _common.isOneOf)(type, Object.values(_RewardedAdEventType.RewardedAdEventType)) && (this._type === 'rewarded' || this._type === 'rewarded_interstitial'))) {
120
88
  throw new Error(`${this._className}.addAdEventListener(*) 'type' expected a valid event type value.`);
121
89
  }
122
-
123
90
  if (!(0, _common.isFunction)(listener)) {
124
91
  throw new Error(`${this._className}.addAdEventListener(_, *) 'listener' expected a function.`);
125
92
  }
126
-
127
93
  const id = this._adEventListenerId++;
128
-
129
94
  this._getAdEventListeners(type).set(id, listener);
130
-
131
95
  return () => {
132
96
  this._getAdEventListeners(type).delete(id);
133
97
  };
134
98
  }
135
-
136
99
  _getAdEventListeners(type) {
137
100
  return this._adEventListenersMap.get(type);
138
101
  }
139
-
140
102
  get _className() {
141
103
  return this.constructor.name;
142
104
  }
143
-
144
105
  get _camelCaseType() {
145
106
  let type;
146
-
147
107
  if (this._type === 'app_open') {
148
108
  type = 'appOpen';
149
109
  } else if (this._type === 'rewarded_interstitial') {
@@ -151,28 +111,22 @@ class MobileAd {
151
111
  } else {
152
112
  type = this._type;
153
113
  }
154
-
155
114
  return type;
156
115
  }
157
-
158
116
  load() {
159
117
  // Prevent multiple load calls
160
118
  if (this._loaded || this._isLoadCalled) {
161
119
  return;
162
120
  }
163
-
164
121
  this._isLoadCalled = true;
165
122
  const load = this._googleMobileAds.native[`${this._camelCaseType}Load`];
166
123
  load(this._requestId, this._adUnitId, this._requestOptions);
167
124
  }
168
-
169
125
  show(showOptions) {
170
126
  if (!this._loaded) {
171
127
  throw new Error(`${this._className}.show() The requested ${this._className} has not loaded and could not be shown.`);
172
128
  }
173
-
174
129
  let options;
175
-
176
130
  try {
177
131
  options = (0, _validateAdShowOptions.validateAdShowOptions)(showOptions);
178
132
  } catch (e) {
@@ -182,28 +136,21 @@ class MobileAd {
182
136
  throw e;
183
137
  }
184
138
  }
185
-
186
139
  const show = this._googleMobileAds.native[`${this._camelCaseType}Show`];
187
140
  return show(this._requestId, this._adUnitId, options);
188
141
  }
189
-
190
142
  removeAllListeners() {
191
143
  this._adEventsListeners.clear();
192
-
193
144
  this._adEventListenersMap.forEach((_, type, map) => {
194
145
  map.set(type, new Map());
195
146
  });
196
147
  }
197
-
198
148
  get adUnitId() {
199
149
  return this._adUnitId;
200
150
  }
201
-
202
151
  get loaded() {
203
152
  return this._loaded;
204
153
  }
205
-
206
154
  }
207
-
208
155
  exports.MobileAd = MobileAd;
209
156
  //# sourceMappingURL=MobileAd.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["MobileAd.ts"],"names":["MobileAd","constructor","type","googleMobileAds","requestId","adUnitId","requestOptions","_type","_googleMobileAds","_requestId","_adUnitId","_requestOptions","_loaded","_isLoadCalled","_adEventsListeners","Map","_adEventListenersMap","Object","values","AdEventType","RewardedAdEventType","GAMAdEventType","_","LOADED","forEach","set","_adEventListenerId","_adEventsListenerId","_nativeListener","emitter","addListener","_handleAdEvent","bind","event","error","data","body","CLOSED","payload","NativeError","fromEvent","listener","_getAdEventListeners","_addAdEventsListener","Error","_className","id","delete","_addAdEventListener","get","name","_camelCaseType","load","native","show","showOptions","options","e","message","removeAllListeners","clear","map","loaded"],"mappings":";;;;;;;AAkBA;;AACA;;AACA;;AACA;;AAQA;;AAEA;;;;AAIO,MAAeA,QAAf,CAAqD;AAchDC,EAAAA,WAAW,CACnBC,IADmB,EAEnBC,eAFmB,EAGnBC,SAHmB,EAInBC,QAJmB,EAKnBC,cALmB,EAMnB;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACA,SAAKC,KAAL,GAAaL,IAAb;AACA,SAAKM,gBAAL,GAAwBL,eAAxB;AACA,SAAKM,UAAL,GAAkBL,SAAlB;AACA,SAAKM,SAAL,GAAiBL,QAAjB;AACA,SAAKM,eAAL,GAAuBL,cAAvB;AAEA,SAAKM,OAAL,GAAe,KAAf;AACA,SAAKC,aAAL,GAAqB,KAArB;AACA,SAAKC,kBAAL,GAA0B,IAAIC,GAAJ,EAA1B;AACA,SAAKC,oBAAL,GAA4B,IAAID,GAAJ,EAA5B;AACAE,IAAAA,MAAM,CAACC,MAAP,CAAc,EACZ,GAAGC,wBADS;AAEZ,SAAGC,wCAFS;AAGZ,SAAGC,8BAHS;AAIZC,MAAAA,CAAC,EAAEH,yBAAYI,MAJH,CAIW;;AAJX,KAAd,EAKGC,OALH,CAKWtB,IAAI,IAAI;AACjB,WAAKc,oBAAL,CAA0BS,GAA1B,CAA8BvB,IAA9B,EAAiD,IAAIa,GAAJ,EAAjD;AACD,KAPD;AAQ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;;AACA,SAAK5C,oBAAL,CAA0BQ,OAA1B,CAAkC,CAACF,CAAD,EAAIpB,IAAJ,EAAU2D,GAAV,KAAkB;AAClDA,MAAAA,GAAG,CAACpC,GAAJ,CAAQvB,IAAR,EAAc,IAAIa,GAAJ,EAAd;AACD,KAFD;AAGD;;AAEkB,MAARV,QAAQ,GAAG;AACpB,WAAO,KAAKK,SAAZ;AACD;;AAEgB,MAANoD,MAAM,GAAG;AAClB,WAAO,KAAKlD,OAAZ;AACD;;AA5LyD","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 { EmitterSubscription } from 'react-native';\nimport { isFunction, isOneOf } from '../common';\nimport { NativeError } from '../internal/NativeError';\nimport { AdEventType } from '../AdEventType';\nimport { RewardedAdEventType } from '../RewardedAdEventType';\nimport { AdEventListener, AdEventPayload } from '../types/AdEventListener';\nimport { AdEventsListener } from '../types/AdEventsListener';\nimport { AdShowOptions } from '../types/AdShowOptions';\nimport { RequestOptions } from '../types/RequestOptions';\nimport { MobileAdInterface } from '../types/MobileAd.interface';\nimport { MobileAdsModuleInterface } from '../types/MobileAdsModule.interface';\nimport { RewardedAdReward } from '../types/RewardedAdReward';\nimport { GAMAdEventType } from '../GAMAdEventType';\nimport { AppEvent } from '../types/AppEvent';\nimport { validateAdShowOptions } from '../validateAdShowOptions';\n\ntype EventType = AdEventType | RewardedAdEventType | GAMAdEventType;\n\nexport abstract class MobileAd implements MobileAdInterface {\n protected _type: 'app_open' | 'interstitial' | 'rewarded' | 'rewarded_interstitial';\n protected _googleMobileAds: MobileAdsModuleInterface;\n protected _requestId: number;\n protected _adUnitId: string;\n protected _requestOptions: RequestOptions;\n protected _loaded: boolean;\n protected _isLoadCalled: boolean;\n protected _adEventsListeners: Map<number, AdEventsListener<EventType>>;\n protected _adEventListenersMap: Map<EventType, Map<number, AdEventListener<EventType>>>;\n protected _adEventsListenerId: number;\n protected _adEventListenerId: number;\n protected _nativeListener: EmitterSubscription;\n\n protected constructor(\n type: 'app_open' | 'interstitial' | 'rewarded' | 'rewarded_interstitial',\n googleMobileAds: MobileAdsModuleInterface,\n requestId: number,\n adUnitId: string,\n requestOptions: RequestOptions,\n ) {\n this._type = type;\n this._googleMobileAds = googleMobileAds;\n this._requestId = requestId;\n this._adUnitId = adUnitId;\n this._requestOptions = requestOptions;\n\n this._loaded = false;\n this._isLoadCalled = false;\n this._adEventsListeners = new Map();\n this._adEventListenersMap = new Map();\n Object.values({\n ...AdEventType,\n ...RewardedAdEventType,\n ...GAMAdEventType,\n _: AdEventType.LOADED, // since AdEventType.LOADED is overwritten by RewardedAdEventType.LOADED\n }).forEach(type => {\n this._adEventListenersMap.set(type as EventType, new Map());\n });\n this._adEventListenerId = 0;\n this._adEventsListenerId = 0;\n\n this._nativeListener = googleMobileAds.emitter.addListener(\n `google_mobile_ads_${type}_event:${adUnitId}:${requestId}`,\n this._handleAdEvent.bind(this),\n );\n }\n\n protected _handleAdEvent(event: {\n body: {\n type: EventType;\n error?: { code: string; message: string };\n data?: RewardedAdReward | AppEvent;\n };\n }) {\n const { type, error, data } = event.body;\n\n if (type === AdEventType.LOADED || type === RewardedAdEventType.LOADED) {\n this._loaded = true;\n }\n\n if (type === AdEventType.CLOSED) {\n this._loaded = false;\n this._isLoadCalled = false;\n }\n\n let payload: AdEventPayload<EventType> = data;\n if (error) {\n payload = NativeError.fromEvent(error, 'googleMobileAds');\n }\n this._adEventsListeners.forEach(listener => {\n listener({\n type,\n payload,\n });\n });\n this._getAdEventListeners(type).forEach(listener => {\n listener(payload);\n });\n }\n\n protected _addAdEventsListener<T extends EventType>(listener: AdEventsListener<T>) {\n if (!isFunction(listener)) {\n throw new Error(`${this._className}.addAdEventsListener(*) 'listener' expected a function.`);\n }\n\n const id = this._adEventsListenerId++;\n this._adEventsListeners.set(id, listener as AdEventsListener<EventType>);\n return () => {\n this._adEventsListeners.delete(id);\n };\n }\n\n protected _addAdEventListener<T extends EventType>(type: T, listener: AdEventListener<T>) {\n if (\n !(\n isOneOf(type, Object.values(AdEventType)) ||\n (isOneOf(type, Object.values(RewardedAdEventType)) &&\n (this._type === 'rewarded' || this._type === 'rewarded_interstitial'))\n )\n ) {\n throw new Error(\n `${this._className}.addAdEventListener(*) 'type' expected a valid event type value.`,\n );\n }\n if (!isFunction(listener)) {\n throw new Error(\n `${this._className}.addAdEventListener(_, *) 'listener' expected a function.`,\n );\n }\n\n const id = this._adEventListenerId++;\n this._getAdEventListeners(type).set(id, listener);\n return () => {\n this._getAdEventListeners(type).delete(id);\n };\n }\n\n protected _getAdEventListeners<T extends EventType>(type: T) {\n return this._adEventListenersMap.get(type) as Map<number, AdEventListener<T>>;\n }\n\n protected get _className() {\n return this.constructor.name;\n }\n\n protected get _camelCaseType() {\n let type: 'appOpen' | 'interstitial' | 'rewarded' | 'rewardedInterstitial';\n if (this._type === 'app_open') {\n type = 'appOpen';\n } else if (this._type === 'rewarded_interstitial') {\n type = 'rewardedInterstitial';\n } else {\n type = this._type;\n }\n return type;\n }\n\n public load() {\n // Prevent multiple load calls\n if (this._loaded || this._isLoadCalled) {\n return;\n }\n\n this._isLoadCalled = true;\n const load = this._googleMobileAds.native[`${this._camelCaseType}Load`];\n load(this._requestId, this._adUnitId, this._requestOptions);\n }\n\n public show(showOptions?: AdShowOptions) {\n if (!this._loaded) {\n throw new Error(\n `${this._className}.show() The requested ${this._className} has not loaded and could not be shown.`,\n );\n }\n\n let options;\n try {\n options = validateAdShowOptions(showOptions);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`${this._className}.show(*) ${e.message}.`);\n } else {\n throw e;\n }\n }\n\n const show = this._googleMobileAds.native[`${this._camelCaseType}Show`];\n return show(this._requestId, this._adUnitId, options);\n }\n\n public abstract addAdEventsListener<T extends never>(listener: AdEventsListener<T>): () => void;\n\n public abstract addAdEventListener<T extends never>(type: T, listener: AdEventListener<T>): void;\n\n public removeAllListeners() {\n this._adEventsListeners.clear();\n this._adEventListenersMap.forEach((_, type, map) => {\n map.set(type, new Map());\n });\n }\n\n public get adUnitId() {\n return this._adUnitId;\n }\n\n public get loaded() {\n return this._loaded;\n }\n}\n"]}
1
+ {"version":3,"names":["MobileAd","constructor","type","googleMobileAds","requestId","adUnitId","requestOptions","_type","_googleMobileAds","_requestId","_adUnitId","_requestOptions","_loaded","_isLoadCalled","_adEventsListeners","Map","_adEventListenersMap","Object","values","AdEventType","RewardedAdEventType","GAMAdEventType","_","LOADED","forEach","set","_adEventListenerId","_adEventsListenerId","_nativeListener","emitter","addListener","_handleAdEvent","bind","event","error","data","body","CLOSED","payload","NativeError","fromEvent","listener","_getAdEventListeners","_addAdEventsListener","isFunction","Error","_className","id","delete","_addAdEventListener","isOneOf","get","name","_camelCaseType","load","native","show","showOptions","options","validateAdShowOptions","e","message","removeAllListeners","clear","map","loaded"],"sources":["MobileAd.ts"],"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 { EmitterSubscription } from 'react-native';\nimport { isFunction, isOneOf } from '../common';\nimport { NativeError } from '../internal/NativeError';\nimport { AdEventType } from '../AdEventType';\nimport { RewardedAdEventType } from '../RewardedAdEventType';\nimport { AdEventListener, AdEventPayload } from '../types/AdEventListener';\nimport { AdEventsListener } from '../types/AdEventsListener';\nimport { AdShowOptions } from '../types/AdShowOptions';\nimport { RequestOptions } from '../types/RequestOptions';\nimport { MobileAdInterface } from '../types/MobileAd.interface';\nimport { MobileAdsModuleInterface } from '../types/MobileAdsModule.interface';\nimport { RewardedAdReward } from '../types/RewardedAdReward';\nimport { GAMAdEventType } from '../GAMAdEventType';\nimport { AppEvent } from '../types/AppEvent';\nimport { validateAdShowOptions } from '../validateAdShowOptions';\n\ntype EventType = AdEventType | RewardedAdEventType | GAMAdEventType;\n\nexport abstract class MobileAd implements MobileAdInterface {\n protected _type: 'app_open' | 'interstitial' | 'rewarded' | 'rewarded_interstitial';\n protected _googleMobileAds: MobileAdsModuleInterface;\n protected _requestId: number;\n protected _adUnitId: string;\n protected _requestOptions: RequestOptions;\n protected _loaded: boolean;\n protected _isLoadCalled: boolean;\n protected _adEventsListeners: Map<number, AdEventsListener<EventType>>;\n protected _adEventListenersMap: Map<EventType, Map<number, AdEventListener<EventType>>>;\n protected _adEventsListenerId: number;\n protected _adEventListenerId: number;\n protected _nativeListener: EmitterSubscription;\n\n protected constructor(\n type: 'app_open' | 'interstitial' | 'rewarded' | 'rewarded_interstitial',\n googleMobileAds: MobileAdsModuleInterface,\n requestId: number,\n adUnitId: string,\n requestOptions: RequestOptions,\n ) {\n this._type = type;\n this._googleMobileAds = googleMobileAds;\n this._requestId = requestId;\n this._adUnitId = adUnitId;\n this._requestOptions = requestOptions;\n\n this._loaded = false;\n this._isLoadCalled = false;\n this._adEventsListeners = new Map();\n this._adEventListenersMap = new Map();\n Object.values({\n ...AdEventType,\n ...RewardedAdEventType,\n ...GAMAdEventType,\n _: AdEventType.LOADED, // since AdEventType.LOADED is overwritten by RewardedAdEventType.LOADED\n }).forEach(type => {\n this._adEventListenersMap.set(type as EventType, new Map());\n });\n this._adEventListenerId = 0;\n this._adEventsListenerId = 0;\n\n this._nativeListener = googleMobileAds.emitter.addListener(\n `google_mobile_ads_${type}_event:${adUnitId}:${requestId}`,\n this._handleAdEvent.bind(this),\n );\n }\n\n protected _handleAdEvent(event: {\n body: {\n type: EventType;\n error?: { code: string; message: string };\n data?: RewardedAdReward | AppEvent;\n };\n }) {\n const { type, error, data } = event.body;\n\n if (type === AdEventType.LOADED || type === RewardedAdEventType.LOADED) {\n this._loaded = true;\n }\n\n if (type === AdEventType.CLOSED) {\n this._loaded = false;\n this._isLoadCalled = false;\n }\n\n let payload: AdEventPayload<EventType> = data;\n if (error) {\n payload = NativeError.fromEvent(error, 'googleMobileAds');\n }\n this._adEventsListeners.forEach(listener => {\n listener({\n type,\n payload,\n });\n });\n this._getAdEventListeners(type).forEach(listener => {\n listener(payload);\n });\n }\n\n protected _addAdEventsListener<T extends EventType>(listener: AdEventsListener<T>) {\n if (!isFunction(listener)) {\n throw new Error(`${this._className}.addAdEventsListener(*) 'listener' expected a function.`);\n }\n\n const id = this._adEventsListenerId++;\n this._adEventsListeners.set(id, listener as AdEventsListener<EventType>);\n return () => {\n this._adEventsListeners.delete(id);\n };\n }\n\n protected _addAdEventListener<T extends EventType>(type: T, listener: AdEventListener<T>) {\n if (\n !(\n isOneOf(type, Object.values(AdEventType)) ||\n (isOneOf(type, Object.values(RewardedAdEventType)) &&\n (this._type === 'rewarded' || this._type === 'rewarded_interstitial'))\n )\n ) {\n throw new Error(\n `${this._className}.addAdEventListener(*) 'type' expected a valid event type value.`,\n );\n }\n if (!isFunction(listener)) {\n throw new Error(\n `${this._className}.addAdEventListener(_, *) 'listener' expected a function.`,\n );\n }\n\n const id = this._adEventListenerId++;\n this._getAdEventListeners(type).set(id, listener);\n return () => {\n this._getAdEventListeners(type).delete(id);\n };\n }\n\n protected _getAdEventListeners<T extends EventType>(type: T) {\n return this._adEventListenersMap.get(type) as Map<number, AdEventListener<T>>;\n }\n\n protected get _className() {\n return this.constructor.name;\n }\n\n protected get _camelCaseType() {\n let type: 'appOpen' | 'interstitial' | 'rewarded' | 'rewardedInterstitial';\n if (this._type === 'app_open') {\n type = 'appOpen';\n } else if (this._type === 'rewarded_interstitial') {\n type = 'rewardedInterstitial';\n } else {\n type = this._type;\n }\n return type;\n }\n\n public load() {\n // Prevent multiple load calls\n if (this._loaded || this._isLoadCalled) {\n return;\n }\n\n this._isLoadCalled = true;\n const load = this._googleMobileAds.native[`${this._camelCaseType}Load`];\n load(this._requestId, this._adUnitId, this._requestOptions);\n }\n\n public show(showOptions?: AdShowOptions) {\n if (!this._loaded) {\n throw new Error(\n `${this._className}.show() The requested ${this._className} has not loaded and could not be shown.`,\n );\n }\n\n let options;\n try {\n options = validateAdShowOptions(showOptions);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`${this._className}.show(*) ${e.message}.`);\n } else {\n throw e;\n }\n }\n\n const show = this._googleMobileAds.native[`${this._camelCaseType}Show`];\n return show(this._requestId, this._adUnitId, options);\n }\n\n public abstract addAdEventsListener<T extends never>(listener: AdEventsListener<T>): () => void;\n\n public abstract addAdEventListener<T extends never>(type: T, listener: AdEventListener<T>): void;\n\n public removeAllListeners() {\n this._adEventsListeners.clear();\n this._adEventListenersMap.forEach((_, type, map) => {\n map.set(type, new Map());\n });\n }\n\n public get adUnitId() {\n return this._adUnitId;\n }\n\n public get loaded() {\n return this._loaded;\n }\n}\n"],"mappings":";;;;;;AAkBA;AACA;AACA;AACA;AAQA;AAEA;AAAiE;AAI1D,MAAeA,QAAQ,CAA8B;EAchDC,WAAW,CACnBC,IAAwE,EACxEC,eAAyC,EACzCC,SAAiB,EACjBC,QAAgB,EAChBC,cAA8B,EAC9B;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IACA,IAAI,CAACC,KAAK,GAAGL,IAAI;IACjB,IAAI,CAACM,gBAAgB,GAAGL,eAAe;IACvC,IAAI,CAACM,UAAU,GAAGL,SAAS;IAC3B,IAAI,CAACM,SAAS,GAAGL,QAAQ;IACzB,IAAI,CAACM,eAAe,GAAGL,cAAc;I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,UAAW,yCAAwC,CACpG;IACH;IAEA,IAAIY,OAAO;IACX,IAAI;MACFA,OAAO,GAAG,IAAAC,4CAAqB,EAACF,WAAW,CAAC;IAC9C,CAAC,CAAC,OAAOG,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYf,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAE,GAAE,IAAI,CAACC,UAAW,YAAWc,CAAC,CAACC,OAAQ,GAAE,CAAC;MAC7D,CAAC,MAAM;QACL,MAAMD,CAAC;MACT;IACF;IAEA,MAAMJ,IAAI,GAAG,IAAI,CAAChD,gBAAgB,CAAC+C,MAAM,CAAE,GAAE,IAAI,CAACF,cAAe,MAAK,CAAC;IACvE,OAAOG,IAAI,CAAC,IAAI,CAAC/C,UAAU,EAAE,IAAI,CAACC,SAAS,EAAEgD,OAAO,CAAC;EACvD;EAMOI,kBAAkB,GAAG;IAC1B,IAAI,CAAChD,kBAAkB,CAACiD,KAAK,EAAE;IAC/B,IAAI,CAAC/C,oBAAoB,CAACQ,OAAO,CAAC,CAACF,CAAC,EAAEpB,IAAI,EAAE8D,GAAG,KAAK;MAClDA,GAAG,CAACvC,GAAG,CAACvB,IAAI,EAAE,IAAIa,GAAG,EAAE,CAAC;IAC1B,CAAC,CAAC;EACJ;EAEA,IAAWV,QAAQ,GAAG;IACpB,OAAO,IAAI,CAACK,SAAS;EACvB;EAEA,IAAWuD,MAAM,GAAG;IAClB,OAAO,IAAI,CAACrD,OAAO;EACrB;AACF;AAAC"}
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RewardedAd = void 0;
7
-
8
7
  var _common = require("../common");
9
-
10
8
  var _MobileAds = require("../MobileAds");
11
-
12
9
  var _validateAdRequestOptions = require("../validateAdRequestOptions");
13
-
14
10
  var _MobileAd = require("./MobileAd");
15
-
16
11
  var _AdEventType = require("../AdEventType");
17
-
18
12
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
-
20
13
  /**
21
14
  * A class for interacting and showing Rewarded Ads.
22
15
  *
@@ -92,9 +85,7 @@ class RewardedAd extends _MobileAd.MobileAd {
92
85
  if (!(0, _common.isString)(adUnitId)) {
93
86
  throw new Error("RewardedAd.createForAdRequest(*) 'adUnitId' expected an string value.");
94
87
  }
95
-
96
88
  let options = {};
97
-
98
89
  try {
99
90
  options = (0, _validateAdRequestOptions.validateAdRequestOptions)(requestOptions);
100
91
  } catch (e) {
@@ -102,26 +93,19 @@ class RewardedAd extends _MobileAd.MobileAd {
102
93
  throw new Error(`RewardedAd.createForAdRequest(_, *) ${e.message}.`);
103
94
  }
104
95
  }
105
-
106
96
  const requestId = RewardedAd._rewardedRequest++;
107
97
  return new RewardedAd('rewarded', (0, _MobileAds.MobileAds)(), requestId, adUnitId, options);
108
98
  }
109
-
110
99
  addAdEventsListener(listener) {
111
100
  return this._addAdEventsListener(listener);
112
101
  }
113
-
114
102
  addAdEventListener(type, listener) {
115
103
  if (type === _AdEventType.AdEventType.LOADED) {
116
104
  throw new Error('RewardedAd.addAdEventListener(*) use RewardedAdEventType.LOADED instead of AdEventType.LOADED.');
117
105
  }
118
-
119
106
  return this._addAdEventListener(type, listener);
120
107
  }
121
-
122
108
  }
123
-
124
109
  exports.RewardedAd = RewardedAd;
125
-
126
110
  _defineProperty(RewardedAd, "_rewardedRequest", 0);
127
111
  //# sourceMappingURL=RewardedAd.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["RewardedAd.ts"],"names":["RewardedAd","MobileAd","createForAdRequest","adUnitId","requestOptions","Error","options","e","message","requestId","_rewardedRequest","addAdEventsListener","listener","_addAdEventsListener","addAdEventListener","type","AdEventType","LOADED","_addAdEventListener"],"mappings":";;;;;;;AAiBA;;AACA;;AACA;;AACA;;AACA;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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,sBACyB,C","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 { isString } from '../common';\nimport { MobileAds } from '../MobileAds';\nimport { validateAdRequestOptions } from '../validateAdRequestOptions';\nimport { MobileAd } from './MobileAd';\nimport { AdEventType } from '../AdEventType';\nimport { RewardedAdEventType } from '../RewardedAdEventType';\nimport { AdEventListener } from '../types/AdEventListener';\nimport { AdEventsListener } from '../types/AdEventsListener';\nimport { RequestOptions } from '../types/RequestOptions';\n\n/**\n * A class for interacting and showing Rewarded Ads.\n *\n * An Rewarded advert can be pre-loaded and shown at a suitable point in your apps flow, such as at the end of a level\n * in a game. The content of a rewarded advert can be controlled via your Google Mobile Ads dashboard. Typically users are rewarded\n * after completing a specific advert action (e.g. watching a video or submitting an option via an interactive form).\n * Events (such as the user earning a reward or closing a rewarded advert early) are sent back for you to handle accordingly\n * within your application.\n *\n * #### Example\n *\n * First create a new Rewarded instance, passing in your Ad Unit ID from the Google Mobile Ads configuration console, and any additional\n * request options. The example below will present a test advert, and only request a non-personalized ad.\n *\n * ```js\n * import { RewardedAd, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewarded = RewardedAd.createForAdRequest(TestIds.REWARDED, {\n * requestNonPersonalizedAdsOnly: true,\n * });\n * ```\n *\n * Each advert needs to be loaded from Google Mobile Ads before being shown. It is recommended this is performed before the user\n * reaches the checkpoint to show the advert, so it's ready to go. Before loading the advert, we need to setup\n * event listeners to listen for updates from Google Mobile Ads, such as advert loaded or failed to load.\n *\n * Event types match the `AdEventType` or `RewardedAdEventType` interface. The potential user reward for rewarded\n * adverts are passed back to the event handler on advert load and when the user earns the reward.\n *\n * ```js\n * import { RewardedAdEventType } from 'react-native-google-mobile-ads';\n *\n * rewarded.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewarded.show();\n * });\n * rewarded.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewarded.load();\n * ```\n *\n * The rewarded advert will be presented to the user, and several more events can be triggered such as the user clicking the\n * advert, closing it or completing the action.\n */\nexport class RewardedAd extends MobileAd {\n protected static _rewardedRequest = 0;\n /**\n * Creates a new RewardedAd instance.\n *\n * #### Example\n *\n * ```js\n * import { RewardedAd, RewardedAdEventType, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewardedAd = await RewardedAd.createForAdRequest(TestIds.REWARDED, {\n * requestAgent: 'CoolAds',\n * });\n *\n * rewarded.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewarded.show();\n * });\n * rewarded.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewardedAd.load();\n * ```\n *\n * @param adUnitId The Ad Unit ID for the Rewarded Ad. You can find this on your Google Mobile Ads dashboard.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\n static createForAdRequest(adUnitId: string, requestOptions?: RequestOptions) {\n if (!isString(adUnitId)) {\n throw new Error(\"RewardedAd.createForAdRequest(*) 'adUnitId' expected an string value.\");\n }\n\n let options = {};\n try {\n options = validateAdRequestOptions(requestOptions);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`RewardedAd.createForAdRequest(_, *) ${e.message}.`);\n }\n }\n\n const requestId = RewardedAd._rewardedRequest++;\n return new RewardedAd('rewarded', MobileAds(), requestId, adUnitId, options);\n }\n\n addAdEventsListener<T extends AdEventType | RewardedAdEventType>(\n listener: AdEventsListener<T>,\n ): () => void {\n return this._addAdEventsListener(listener);\n }\n\n addAdEventListener<T extends AdEventType | RewardedAdEventType>(\n type: T,\n listener: AdEventListener<T>,\n ) {\n if (type === AdEventType.LOADED) {\n throw new Error(\n 'RewardedAd.addAdEventListener(*) use RewardedAdEventType.LOADED instead of AdEventType.LOADED.',\n );\n }\n return this._addAdEventListener(type, listener);\n }\n}\n"]}
1
+ {"version":3,"names":["RewardedAd","MobileAd","createForAdRequest","adUnitId","requestOptions","isString","Error","options","validateAdRequestOptions","e","message","requestId","_rewardedRequest","MobileAds","addAdEventsListener","listener","_addAdEventsListener","addAdEventListener","type","AdEventType","LOADED","_addAdEventListener"],"sources":["RewardedAd.ts"],"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 { isString } from '../common';\nimport { MobileAds } from '../MobileAds';\nimport { validateAdRequestOptions } from '../validateAdRequestOptions';\nimport { MobileAd } from './MobileAd';\nimport { AdEventType } from '../AdEventType';\nimport { RewardedAdEventType } from '../RewardedAdEventType';\nimport { AdEventListener } from '../types/AdEventListener';\nimport { AdEventsListener } from '../types/AdEventsListener';\nimport { RequestOptions } from '../types/RequestOptions';\n\n/**\n * A class for interacting and showing Rewarded Ads.\n *\n * An Rewarded advert can be pre-loaded and shown at a suitable point in your apps flow, such as at the end of a level\n * in a game. The content of a rewarded advert can be controlled via your Google Mobile Ads dashboard. Typically users are rewarded\n * after completing a specific advert action (e.g. watching a video or submitting an option via an interactive form).\n * Events (such as the user earning a reward or closing a rewarded advert early) are sent back for you to handle accordingly\n * within your application.\n *\n * #### Example\n *\n * First create a new Rewarded instance, passing in your Ad Unit ID from the Google Mobile Ads configuration console, and any additional\n * request options. The example below will present a test advert, and only request a non-personalized ad.\n *\n * ```js\n * import { RewardedAd, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewarded = RewardedAd.createForAdRequest(TestIds.REWARDED, {\n * requestNonPersonalizedAdsOnly: true,\n * });\n * ```\n *\n * Each advert needs to be loaded from Google Mobile Ads before being shown. It is recommended this is performed before the user\n * reaches the checkpoint to show the advert, so it's ready to go. Before loading the advert, we need to setup\n * event listeners to listen for updates from Google Mobile Ads, such as advert loaded or failed to load.\n *\n * Event types match the `AdEventType` or `RewardedAdEventType` interface. The potential user reward for rewarded\n * adverts are passed back to the event handler on advert load and when the user earns the reward.\n *\n * ```js\n * import { RewardedAdEventType } from 'react-native-google-mobile-ads';\n *\n * rewarded.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewarded.show();\n * });\n * rewarded.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewarded.load();\n * ```\n *\n * The rewarded advert will be presented to the user, and several more events can be triggered such as the user clicking the\n * advert, closing it or completing the action.\n */\nexport class RewardedAd extends MobileAd {\n protected static _rewardedRequest = 0;\n /**\n * Creates a new RewardedAd instance.\n *\n * #### Example\n *\n * ```js\n * import { RewardedAd, RewardedAdEventType, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewardedAd = await RewardedAd.createForAdRequest(TestIds.REWARDED, {\n * requestAgent: 'CoolAds',\n * });\n *\n * rewarded.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewarded.show();\n * });\n * rewarded.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewardedAd.load();\n * ```\n *\n * @param adUnitId The Ad Unit ID for the Rewarded Ad. You can find this on your Google Mobile Ads dashboard.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\n static createForAdRequest(adUnitId: string, requestOptions?: RequestOptions) {\n if (!isString(adUnitId)) {\n throw new Error(\"RewardedAd.createForAdRequest(*) 'adUnitId' expected an string value.\");\n }\n\n let options = {};\n try {\n options = validateAdRequestOptions(requestOptions);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`RewardedAd.createForAdRequest(_, *) ${e.message}.`);\n }\n }\n\n const requestId = RewardedAd._rewardedRequest++;\n return new RewardedAd('rewarded', MobileAds(), requestId, adUnitId, options);\n }\n\n addAdEventsListener<T extends AdEventType | RewardedAdEventType>(\n listener: AdEventsListener<T>,\n ): () => void {\n return this._addAdEventsListener(listener);\n }\n\n addAdEventListener<T extends AdEventType | RewardedAdEventType>(\n type: T,\n listener: AdEventListener<T>,\n ) {\n if (type === AdEventType.LOADED) {\n throw new Error(\n 'RewardedAd.addAdEventListener(*) use RewardedAdEventType.LOADED instead of AdEventType.LOADED.',\n );\n }\n return this._addAdEventListener(type, listener);\n }\n}\n"],"mappings":";;;;;;AAiBA;AACA;AACA;AACA;AACA;AAA6C;AAM7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,SAASC,kBAAQ,CAAC;EAEvC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,kBAAkB,CAACC,QAAgB,EAAEC,cAA+B,EAAE;IAC3E,IAAI,CAAC,IAAAC,gBAAQ,EAACF,QAAQ,CAAC,EAAE;MACvB,MAAM,IAAIG,KAAK,CAAC,uEAAuE,CAAC;IAC1F;IAEA,IAAIC,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI;MACFA,OAAO,GAAG,IAAAC,kDAAwB,EAACJ,cAAc,CAAC;IACpD,CAAC,CAAC,OAAOK,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYH,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAE,uCAAsCG,CAAC,CAACC,OAAQ,GAAE,CAAC;MACtE;IACF;IAEA,MAAMC,SAAS,GAAGX,UAAU,CAACY,gBAAgB,EAAE;IAC/C,OAAO,IAAIZ,UAAU,CAAC,UAAU,EAAE,IAAAa,oBAAS,GAAE,EAAEF,SAAS,EAAER,QAAQ,EAAEI,OAAO,CAAC;EAC9E;EAEAO,mBAAmB,CACjBC,QAA6B,EACjB;IACZ,OAAO,IAAI,CAACC,oBAAoB,CAACD,QAAQ,CAAC;EAC5C;EAEAE,kBAAkB,CAChBC,IAAO,EACPH,QAA4B,EAC5B;IACA,IAAIG,IAAI,KAAKC,wBAAW,CAACC,MAAM,EAAE;MAC/B,MAAM,IAAId,KAAK,CACb,gGAAgG,CACjG;IACH;IACA,OAAO,IAAI,CAACe,mBAAmB,CAACH,IAAI,EAAEH,QAAQ,CAAC;EACjD;AACF;AAAC;AAAA,gBA9DYf,UAAU,sBACe,CAAC"}
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RewardedInterstitialAd = void 0;
7
-
8
7
  var _common = require("../common");
9
-
10
8
  var _MobileAds = require("../MobileAds");
11
-
12
9
  var _validateAdRequestOptions = require("../validateAdRequestOptions");
13
-
14
10
  var _MobileAd = require("./MobileAd");
15
-
16
11
  var _AdEventType = require("../AdEventType");
17
-
18
12
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
-
20
13
  /**
21
14
  * A class for interacting and showing Rewarded Interstitial Ads.
22
15
  *
@@ -92,9 +85,7 @@ class RewardedInterstitialAd extends _MobileAd.MobileAd {
92
85
  if (!(0, _common.isString)(adUnitId)) {
93
86
  throw new Error("RewardedInterstitialAd.createForAdRequest(*) 'adUnitId' expected an string value.");
94
87
  }
95
-
96
88
  let options = {};
97
-
98
89
  try {
99
90
  options = (0, _validateAdRequestOptions.validateAdRequestOptions)(requestOptions);
100
91
  } catch (e) {
@@ -102,26 +93,19 @@ class RewardedInterstitialAd extends _MobileAd.MobileAd {
102
93
  throw new Error(`RewardedInterstitialAd.createForAdRequest(_, *) ${e.message}.`);
103
94
  }
104
95
  }
105
-
106
96
  const requestId = RewardedInterstitialAd._rewardedInterstitialRequest++;
107
97
  return new RewardedInterstitialAd('rewarded_interstitial', (0, _MobileAds.MobileAds)(), requestId, adUnitId, options);
108
98
  }
109
-
110
99
  addAdEventsListener(listener) {
111
100
  return this._addAdEventsListener(listener);
112
101
  }
113
-
114
102
  addAdEventListener(type, listener) {
115
103
  if (type === _AdEventType.AdEventType.LOADED) {
116
104
  throw new Error('RewardedInterstitialAd.addAdEventListener(*) use RewardedAdEventType.LOADED instead of AdEventType.LOADED.');
117
105
  }
118
-
119
106
  return this._addAdEventListener(type, listener);
120
107
  }
121
-
122
108
  }
123
-
124
109
  exports.RewardedInterstitialAd = RewardedInterstitialAd;
125
-
126
110
  _defineProperty(RewardedInterstitialAd, "_rewardedInterstitialRequest", 0);
127
111
  //# sourceMappingURL=RewardedInterstitialAd.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["RewardedInterstitialAd.ts"],"names":["RewardedInterstitialAd","MobileAd","createForAdRequest","adUnitId","requestOptions","Error","options","e","message","requestId","_rewardedInterstitialRequest","addAdEventsListener","listener","_addAdEventsListener","addAdEventListener","type","AdEventType","LOADED","_addAdEventListener"],"mappings":";;;;;;;AAiBA;;AACA;;AACA;;AACA;;AACA;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,sBAAN,SAAqCC,kBAArC,CAA8C;AAEnD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC2B,SAAlBC,kBAAkB,CAACC,QAAD,EAAmBC,cAAnB,EAAoD;AAC3E,QAAI,CAAC,sBAASD,QAAT,CAAL,EAAyB;AACvB,YAAM,IAAIE,KAAJ,CACJ,mFADI,CAAN;AAGD;;AAED,QAAIC,OAAO,GAAG,EAAd;;AACA,QAAI;AACFA,MAAAA,OAAO,GAAG,wDAAyBF,cAAzB,CAAV;AACD,KAFD,CAEE,OAAOG,CAAP,EAAU;AACV,UAAIA,CAAC,YAAYF,KAAjB,EAAwB;AACtB,cAAM,IAAIA,KAAJ,CAAW,mDAAkDE,CAAC,CAACC,OAAQ,GAAvE,CAAN;AACD;AACF;;AAED,UAAMC,SAAS,GAAGT,sBAAsB,CAACU,4BAAvB,EAAlB;AACA,WAAO,IAAIV,sBAAJ,CACL,uBADK,EAEL,2BAFK,EAGLS,SAHK,EAILN,QAJK,EAKLG,OALK,CAAP;AAOD;;AAEDK,EAAAA,mBAAmB,CACjBC,QADiB,EAEL;AACZ,WAAO,KAAKC,oBAAL,CAA0BD,QAA1B,CAAP;AACD;;AAEDE,EAAAA,kBAAkB,CAChBC,IADgB,EAEhBH,QAFgB,EAGhB;AACA,QAAIG,IAAI,KAAKC,yBAAYC,MAAzB,EAAiC;AAC/B,YAAM,IAAIZ,KAAJ,CACJ,4GADI,CAAN;AAGD;;AACD,WAAO,KAAKa,mBAAL,CAAyBH,IAAzB,EAA+BH,QAA/B,CAAP;AACD;;AArEkD;;;;gBAAxCZ,sB,kCACqC,C","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 { isString } from '../common';\nimport { MobileAds } from '../MobileAds';\nimport { validateAdRequestOptions } from '../validateAdRequestOptions';\nimport { MobileAd } from './MobileAd';\nimport { AdEventType } from '../AdEventType';\nimport { RewardedAdEventType } from '../RewardedAdEventType';\nimport { AdEventListener } from '../types/AdEventListener';\nimport { AdEventsListener } from '../types/AdEventsListener';\nimport { RequestOptions } from '../types/RequestOptions';\n\n/**\n * A class for interacting and showing Rewarded Interstitial Ads.\n *\n * An Rewarded Interstitial advert can be pre-loaded and shown at a suitable point in your apps flow, such as at the end of a level\n * in a game. The content of a rewarded interstital advert can be controlled via your Google Mobile Ads dashboard. Typically users are rewarded\n * after completing a specific advert action (e.g. watching a video or submitting an option via an interactive form).\n * Events (such as the user earning a reward or closing a rewarded interstital advert early) are sent back for you to handle accordingly\n * within your application.\n *\n * #### Example\n *\n * First create a new Rewarded Interstitial instance, passing in your Ad Unit ID from the Google Mobile Ads configuration console, and any additional\n * request options. The example below will present a test advert, and only request a non-personalized ad.\n *\n * ```js\n * import { RewardedInterstitialAd, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewardedInterstitial = RewardedInterstitialAd.createForAdRequest(TestIds.REWARDED_INTERSTITIAL, {\n * requestNonPersonalizedAdsOnly: true,\n * });\n * ```\n *\n * Each advert needs to be loaded from Google Mobile Ads before being shown. It is recommended this is performed before the user\n * reaches the checkpoint to show the advert, so it's ready to go. Before loading the advert, we need to setup\n * event listeners to listen for updates from Google Mobile Ads, such as advert loaded or failed to load.\n *\n * Event types match the `AdEventType` or `RewardedAdEventType` interface. The potential user reward for rewarded interstitial\n * adverts are passed back to the event handler on advert load and when the user earns the reward.\n *\n * ```js\n * import { RewardedAdEventType } from 'react-native-google-mobile-ads';\n *\n * rewardedInterstitial.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewarded.show();\n * });\n * rewardedInterstitial.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewardedInterstitial.load();\n * ```\n *\n * The rewarded interstitial advert will be presented to the user, and several more events can be triggered such as the user clicking the\n * advert, closing it or completing the action.\n */\nexport class RewardedInterstitialAd extends MobileAd {\n protected static _rewardedInterstitialRequest = 0;\n /**\n * Creates a new RewardedInterstitialAd instance.\n *\n * #### Example\n *\n * ```js\n * import { RewardedInterstitialAd, RewardedAdEventType, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewardedInterstitialAd = await RewardedInterstitialAd.createForAdRequest(TestIds.REWARDED_INTERSTITIAL, {\n * requestAgent: 'CoolAds',\n * });\n *\n * rewardedInterstitialAd.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewardedInterstitialAd.show();\n * });\n * rewardedInterstitialAd.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewardedInterstitialAd.load();\n * ```\n *\n * @param adUnitId The Ad Unit ID for the Rewarded Interstitial Ad. You can find this on your Google Mobile Ads dashboard.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\n static createForAdRequest(adUnitId: string, requestOptions?: RequestOptions) {\n if (!isString(adUnitId)) {\n throw new Error(\n \"RewardedInterstitialAd.createForAdRequest(*) 'adUnitId' expected an string value.\",\n );\n }\n\n let options = {};\n try {\n options = validateAdRequestOptions(requestOptions);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`RewardedInterstitialAd.createForAdRequest(_, *) ${e.message}.`);\n }\n }\n\n const requestId = RewardedInterstitialAd._rewardedInterstitialRequest++;\n return new RewardedInterstitialAd(\n 'rewarded_interstitial',\n MobileAds(),\n requestId,\n adUnitId,\n options,\n );\n }\n\n addAdEventsListener<T extends AdEventType | RewardedAdEventType>(\n listener: AdEventsListener<T>,\n ): () => void {\n return this._addAdEventsListener(listener);\n }\n\n addAdEventListener<T extends AdEventType | RewardedAdEventType>(\n type: T,\n listener: AdEventListener<T>,\n ) {\n if (type === AdEventType.LOADED) {\n throw new Error(\n 'RewardedInterstitialAd.addAdEventListener(*) use RewardedAdEventType.LOADED instead of AdEventType.LOADED.',\n );\n }\n return this._addAdEventListener(type, listener);\n }\n}\n"]}
1
+ {"version":3,"names":["RewardedInterstitialAd","MobileAd","createForAdRequest","adUnitId","requestOptions","isString","Error","options","validateAdRequestOptions","e","message","requestId","_rewardedInterstitialRequest","MobileAds","addAdEventsListener","listener","_addAdEventsListener","addAdEventListener","type","AdEventType","LOADED","_addAdEventListener"],"sources":["RewardedInterstitialAd.ts"],"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 { isString } from '../common';\nimport { MobileAds } from '../MobileAds';\nimport { validateAdRequestOptions } from '../validateAdRequestOptions';\nimport { MobileAd } from './MobileAd';\nimport { AdEventType } from '../AdEventType';\nimport { RewardedAdEventType } from '../RewardedAdEventType';\nimport { AdEventListener } from '../types/AdEventListener';\nimport { AdEventsListener } from '../types/AdEventsListener';\nimport { RequestOptions } from '../types/RequestOptions';\n\n/**\n * A class for interacting and showing Rewarded Interstitial Ads.\n *\n * An Rewarded Interstitial advert can be pre-loaded and shown at a suitable point in your apps flow, such as at the end of a level\n * in a game. The content of a rewarded interstital advert can be controlled via your Google Mobile Ads dashboard. Typically users are rewarded\n * after completing a specific advert action (e.g. watching a video or submitting an option via an interactive form).\n * Events (such as the user earning a reward or closing a rewarded interstital advert early) are sent back for you to handle accordingly\n * within your application.\n *\n * #### Example\n *\n * First create a new Rewarded Interstitial instance, passing in your Ad Unit ID from the Google Mobile Ads configuration console, and any additional\n * request options. The example below will present a test advert, and only request a non-personalized ad.\n *\n * ```js\n * import { RewardedInterstitialAd, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewardedInterstitial = RewardedInterstitialAd.createForAdRequest(TestIds.REWARDED_INTERSTITIAL, {\n * requestNonPersonalizedAdsOnly: true,\n * });\n * ```\n *\n * Each advert needs to be loaded from Google Mobile Ads before being shown. It is recommended this is performed before the user\n * reaches the checkpoint to show the advert, so it's ready to go. Before loading the advert, we need to setup\n * event listeners to listen for updates from Google Mobile Ads, such as advert loaded or failed to load.\n *\n * Event types match the `AdEventType` or `RewardedAdEventType` interface. The potential user reward for rewarded interstitial\n * adverts are passed back to the event handler on advert load and when the user earns the reward.\n *\n * ```js\n * import { RewardedAdEventType } from 'react-native-google-mobile-ads';\n *\n * rewardedInterstitial.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewarded.show();\n * });\n * rewardedInterstitial.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewardedInterstitial.load();\n * ```\n *\n * The rewarded interstitial advert will be presented to the user, and several more events can be triggered such as the user clicking the\n * advert, closing it or completing the action.\n */\nexport class RewardedInterstitialAd extends MobileAd {\n protected static _rewardedInterstitialRequest = 0;\n /**\n * Creates a new RewardedInterstitialAd instance.\n *\n * #### Example\n *\n * ```js\n * import { RewardedInterstitialAd, RewardedAdEventType, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewardedInterstitialAd = await RewardedInterstitialAd.createForAdRequest(TestIds.REWARDED_INTERSTITIAL, {\n * requestAgent: 'CoolAds',\n * });\n *\n * rewardedInterstitialAd.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewardedInterstitialAd.show();\n * });\n * rewardedInterstitialAd.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewardedInterstitialAd.load();\n * ```\n *\n * @param adUnitId The Ad Unit ID for the Rewarded Interstitial Ad. You can find this on your Google Mobile Ads dashboard.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\n static createForAdRequest(adUnitId: string, requestOptions?: RequestOptions) {\n if (!isString(adUnitId)) {\n throw new Error(\n \"RewardedInterstitialAd.createForAdRequest(*) 'adUnitId' expected an string value.\",\n );\n }\n\n let options = {};\n try {\n options = validateAdRequestOptions(requestOptions);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`RewardedInterstitialAd.createForAdRequest(_, *) ${e.message}.`);\n }\n }\n\n const requestId = RewardedInterstitialAd._rewardedInterstitialRequest++;\n return new RewardedInterstitialAd(\n 'rewarded_interstitial',\n MobileAds(),\n requestId,\n adUnitId,\n options,\n );\n }\n\n addAdEventsListener<T extends AdEventType | RewardedAdEventType>(\n listener: AdEventsListener<T>,\n ): () => void {\n return this._addAdEventsListener(listener);\n }\n\n addAdEventListener<T extends AdEventType | RewardedAdEventType>(\n type: T,\n listener: AdEventListener<T>,\n ) {\n if (type === AdEventType.LOADED) {\n throw new Error(\n 'RewardedInterstitialAd.addAdEventListener(*) use RewardedAdEventType.LOADED instead of AdEventType.LOADED.',\n );\n }\n return this._addAdEventListener(type, listener);\n }\n}\n"],"mappings":";;;;;;AAiBA;AACA;AACA;AACA;AACA;AAA6C;AAM7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,sBAAsB,SAASC,kBAAQ,CAAC;EAEnD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,kBAAkB,CAACC,QAAgB,EAAEC,cAA+B,EAAE;IAC3E,IAAI,CAAC,IAAAC,gBAAQ,EAACF,QAAQ,CAAC,EAAE;MACvB,MAAM,IAAIG,KAAK,CACb,mFAAmF,CACpF;IACH;IAEA,IAAIC,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI;MACFA,OAAO,GAAG,IAAAC,kDAAwB,EAACJ,cAAc,CAAC;IACpD,CAAC,CAAC,OAAOK,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYH,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAE,mDAAkDG,CAAC,CAACC,OAAQ,GAAE,CAAC;MAClF;IACF;IAEA,MAAMC,SAAS,GAAGX,sBAAsB,CAACY,4BAA4B,EAAE;IACvE,OAAO,IAAIZ,sBAAsB,CAC/B,uBAAuB,EACvB,IAAAa,oBAAS,GAAE,EACXF,SAAS,EACTR,QAAQ,EACRI,OAAO,CACR;EACH;EAEAO,mBAAmB,CACjBC,QAA6B,EACjB;IACZ,OAAO,IAAI,CAACC,oBAAoB,CAACD,QAAQ,CAAC;EAC5C;EAEAE,kBAAkB,CAChBC,IAAO,EACPH,QAA4B,EAC5B;IACA,IAAIG,IAAI,KAAKC,wBAAW,CAACC,MAAM,EAAE;MAC/B,MAAM,IAAId,KAAK,CACb,4GAA4G,CAC7G;IACH;IACA,OAAO,IAAI,CAACe,mBAAmB,CAACH,IAAI,EAAEH,QAAQ,CAAC;EACjD;AACF;AAAC;AAAA,gBAtEYf,sBAAsB,kCACe,CAAC"}
@@ -6,17 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.atob = atob;
7
7
  exports.btoa = btoa;
8
8
  exports.fromData = fromData;
9
-
10
9
  var _binaryToBase = _interopRequireDefault(require("react-native/Libraries/Utilities/binaryToBase64"));
11
-
12
10
  var _promise = require("./promise");
13
-
14
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
12
  /* eslint-disable no-bitwise */
17
-
18
13
  /* global Blob, FileReader */
19
-
20
14
  /*
21
15
  * Copyright (c) 2016-present Invertase Limited & Contributors
22
16
  *
@@ -33,34 +27,30 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
33
27
  * limitations under the License.
34
28
  *
35
29
  */
30
+
36
31
  const CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
32
+
37
33
  /**
38
34
  * window.btoa
39
35
  */
40
-
41
36
  function btoa(input) {
42
37
  let map;
43
38
  let i = 0;
44
39
  let block = 0;
45
40
  let output = '';
46
-
47
41
  for (block = 0, i = 0, map = CHARS; input.charAt(i | 0) || (map = '=', i % 1); output += map.charAt(63 & block >> 8 - i % 1 * 8)) {
48
42
  const charCode = input.charCodeAt(i += 3 / 4);
49
-
50
43
  if (charCode > 0xff) {
51
44
  throw new Error("'RNFirebase.Base64.btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
52
45
  }
53
-
54
46
  block = block << 8 | charCode;
55
47
  }
56
-
57
48
  return output;
58
49
  }
50
+
59
51
  /**
60
52
  * window.atob
61
53
  */
62
-
63
-
64
54
  function atob(input) {
65
55
  let i = 0;
66
56
  let bc = 0;
@@ -68,22 +58,18 @@ function atob(input) {
68
58
  let buffer;
69
59
  let output = '';
70
60
  const str = input.replace(/[=]+$/, '');
71
-
72
61
  if (str.length % 4 === 1) {
73
62
  throw new Error("'RNFirebase.Base64.atob' failed: The string to be decoded is not correctly encoded.");
74
63
  }
75
-
76
64
  for (bc = 0, bs = 0, i = 0; buffer = str.charAt(i++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
77
65
  buffer = CHARS.indexOf(buffer);
78
66
  }
79
-
80
67
  return output;
81
68
  }
69
+
82
70
  /**
83
71
  * Converts a Blob, ArrayBuffer or Uint8Array to a base64 string.
84
72
  */
85
-
86
-
87
73
  function fromData(data) {
88
74
  if (data instanceof Blob) {
89
75
  const fileReader = new FileReader();
@@ -93,29 +79,24 @@ function fromData(data) {
93
79
  promise
94
80
  } = (0, _promise.promiseDefer)();
95
81
  fileReader.readAsDataURL(data);
96
-
97
82
  fileReader.onloadend = function onloadend() {
98
83
  resolve({
99
84
  string: fileReader.result,
100
85
  format: 'data_url'
101
86
  });
102
87
  };
103
-
104
88
  fileReader.onerror = function onerror(event) {
105
89
  fileReader.abort();
106
90
  reject(event);
107
91
  };
108
-
109
92
  return promise;
110
93
  }
111
-
112
94
  if (data instanceof ArrayBuffer || data instanceof Uint8Array) {
113
95
  return Promise.resolve({
114
96
  string: (0, _binaryToBase.default)(data),
115
97
  format: 'base64'
116
98
  });
117
99
  }
118
-
119
100
  throw new Error("'RNFirebase.Base64.fromData' failed: Unknown data type.");
120
101
  }
121
102
  //# sourceMappingURL=Base64.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Base64.ts"],"names":["CHARS","btoa","input","map","i","block","output","charAt","charCode","charCodeAt","Error","atob","bc","bs","buffer","str","replace","length","String","fromCharCode","indexOf","fromData","data","Blob","fileReader","FileReader","resolve","reject","promise","readAsDataURL","onloadend","string","result","format","onerror","event","abort","ArrayBuffer","Uint8Array","Promise"],"mappings":";;;;;;;;;AAmBA;;AACA;;;;AApBA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA,MAAMA,KAAK,GAAG,mEAAd;AAEA;AACA;AACA;;AACO,SAASC,IAAT,CAAcC,KAAd,EAA6B;AAClC,MAAIC,GAAJ;AACA,MAAIC,CAAC,GAAG,CAAR;AACA,MAAIC,KAAK,GAAG,CAAZ;AACA,MAAIC,MAAM,GAAG,EAAb;;AAEA,OACED,KAAK,GAAG,C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ACKN,MAAM,IAAIY,MAAM,CAACC,YAAP,CAAoB,MAAON,EAAE,KAAM,CAAC,CAAD,GAAKD,EAAN,GAAY,CAAjB,CAA7B,CADf,GAEI,CALN,EAME;AACAE,IAAAA,MAAM,GAAGd,KAAK,CAACoB,OAAN,CAAcN,MAAd,CAAT;AACD;;AAED,SAAOR,MAAP;AACD;AAED;AACA;AACA;;;AACO,SAASe,QAAT,CAAkBC,IAAlB,EAAyD;AAC9D,MAAIA,IAAI,YAAYC,IAApB,EAA0B;AACxB,UAAMC,UAAU,GAAG,IAAIC,UAAJ,EAAnB;AACA,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,MAAX;AAAmBC,MAAAA;AAAnB,QAA+B,4BAArC;AAEAJ,IAAAA,UAAU,CAACK,aAAX,CAAyBP,IAAzB;;AAEAE,IAAAA,UAAU,CAACM,SAAX,GAAuB,SAASA,SAAT,GAAqB;AAC1CJ,MAAAA,OAAO,CAAC;AAAEK,QAAAA,MAAM,EAAEP,UAAU,CAACQ,MAArB;AAA6BC,QAAAA,MAAM,EAAE;AAArC,OAAD,CAAP;AACD,KAFD;;AAIAT,IAAAA,UAAU,CAACU,OAAX,GAAqB,SAASA,OAAT,CAAiBC,KAAjB,EAAwB;AAC3CX,MAAAA,UAAU,CAACY,KAAX;AACAT,MAAAA,MAAM,CAACQ,KAAD,CAAN;AACD,KAHD;;AAKA,WAAOP,OAAP;AACD;;AAED,MAAIN,IAAI,YAAYe,WAAhB,IAA+Bf,IAAI,YAAYgB,UAAnD,EAA+D;AAC7D,WAAOC,OAAO,CAACb,OAAR,CAAgB;AACrBK,MAAAA,MAAM,EAAE,2BAAeT,IAAf,CADa;AAErBW,MAAAA,MAAM,EAAE;AAFa,KAAhB,CAAP;AAID;;AAED,QAAM,IAAIvB,KAAJ,CAAU,yDAAV,CAAN;AACD","sourcesContent":["/* eslint-disable no-bitwise */\n/* global Blob, FileReader */\n/*\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 binaryToBase64 from 'react-native/Libraries/Utilities/binaryToBase64';\nimport { promiseDefer } from './promise';\n\nconst CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * window.btoa\n */\nexport function btoa(input: string) {\n let map;\n let i = 0;\n let block = 0;\n let output = '';\n\n for (\n block = 0, i = 0, map = CHARS;\n input.charAt(i | 0) || ((map = '='), i % 1);\n output += map.charAt(63 & (block >> (8 - (i % 1) * 8)))\n ) {\n const charCode = input.charCodeAt((i += 3 / 4));\n\n if (charCode > 0xff) {\n throw new Error(\n \"'RNFirebase.Base64.btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\",\n );\n }\n\n block = (block << 8) | charCode;\n }\n\n return output;\n}\n\n/**\n * window.atob\n */\nexport function atob(input: string) {\n let i = 0;\n let bc = 0;\n let bs = 0;\n let buffer;\n let output = '';\n\n const str = input.replace(/[=]+$/, '');\n\n if (str.length % 4 === 1) {\n throw new Error(\n \"'RNFirebase.Base64.atob' failed: The string to be decoded is not correctly encoded.\",\n );\n }\n\n for (\n bc = 0, bs = 0, i = 0;\n (buffer = str.charAt(i++));\n ~buffer && ((bs = bc % 4 ? bs * 64 + buffer : buffer), bc++ % 4)\n ? (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6))))\n : 0\n ) {\n buffer = CHARS.indexOf(buffer);\n }\n\n return output;\n}\n\n/**\n * Converts a Blob, ArrayBuffer or Uint8Array to a base64 string.\n */\nexport function fromData(data: Blob | ArrayBuffer | Uint8Array) {\n if (data instanceof Blob) {\n const fileReader = new FileReader();\n const { resolve, reject, promise } = promiseDefer();\n\n fileReader.readAsDataURL(data);\n\n fileReader.onloadend = function onloadend() {\n resolve({ string: fileReader.result, format: 'data_url' });\n };\n\n fileReader.onerror = function onerror(event) {\n fileReader.abort();\n reject(event);\n };\n\n return promise;\n }\n\n if (data instanceof ArrayBuffer || data instanceof Uint8Array) {\n return Promise.resolve({\n string: binaryToBase64(data),\n format: 'base64',\n });\n }\n\n throw new Error(\"'RNFirebase.Base64.fromData' failed: Unknown data type.\");\n}\n"]}
1
+ {"version":3,"names":["CHARS","btoa","input","map","i","block","output","charAt","charCode","charCodeAt","Error","atob","bc","bs","buffer","str","replace","length","String","fromCharCode","indexOf","fromData","data","Blob","fileReader","FileReader","resolve","reject","promise","promiseDefer","readAsDataURL","onloadend","string","result","format","onerror","event","abort","ArrayBuffer","Uint8Array","Promise","binaryToBase64"],"sources":["Base64.ts"],"sourcesContent":["/* eslint-disable no-bitwise */\n/* global Blob, FileReader */\n/*\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 binaryToBase64 from 'react-native/Libraries/Utilities/binaryToBase64';\nimport { promiseDefer } from './promise';\n\nconst CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * window.btoa\n */\nexport function btoa(input: string) {\n let map;\n let i = 0;\n let block = 0;\n let output = '';\n\n for (\n block = 0, i = 0, map = CHARS;\n input.charAt(i | 0) || ((map = '='), i % 1);\n output += map.charAt(63 & (block >> (8 - (i % 1) * 8)))\n ) {\n const charCode = input.charCodeAt((i += 3 / 4));\n\n if (charCode > 0xff) {\n throw new Error(\n \"'RNFirebase.Base64.btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\",\n );\n }\n\n block = (block << 8) | charCode;\n }\n\n return output;\n}\n\n/**\n * window.atob\n */\nexport function atob(input: string) {\n let i = 0;\n let bc = 0;\n let bs = 0;\n let buffer;\n let output = '';\n\n const str = input.replace(/[=]+$/, '');\n\n if (str.length % 4 === 1) {\n throw new Error(\n \"'RNFirebase.Base64.atob' failed: The string to be decoded is not correctly encoded.\",\n );\n }\n\n for (\n bc = 0, bs = 0, i = 0;\n (buffer = str.charAt(i++));\n ~buffer && ((bs = bc % 4 ? bs * 64 + buffer : buffer), bc++ % 4)\n ? (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6))))\n : 0\n ) {\n buffer = CHARS.indexOf(buffer);\n }\n\n return output;\n}\n\n/**\n * Converts a Blob, ArrayBuffer or Uint8Array to a base64 string.\n */\nexport function fromData(data: Blob | ArrayBuffer | Uint8Array) {\n if (data instanceof Blob) {\n const fileReader = new FileReader();\n const { resolve, reject, promise } = promiseDefer();\n\n fileReader.readAsDataURL(data);\n\n fileReader.onloadend = function onloadend() {\n resolve({ string: fileReader.result, format: 'data_url' });\n };\n\n fileReader.onerror = function onerror(event) {\n fileReader.abort();\n reject(event);\n };\n\n return promise;\n }\n\n if (data instanceof ArrayBuffer || data instanceof Uint8Array) {\n return Promise.resolve({\n string: binaryToBase64(data),\n format: 'base64',\n });\n }\n\n throw new Error(\"'RNFirebase.Base64.fromData' failed: Unknown data type.\");\n}\n"],"mappings":";;;;;;;;AAmBA;AACA;AAAyC;AApBzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,MAAMA,KAAK,GAAG,mEAAmE;;AAEjF;AACA;AACA;AACO,SAASC,IAAI,CAACC,KAAa,EAAE;EAClC,IAAIC,GAAG;E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});
6
6
  exports.MutatableParams = void 0;
7
-
8
7
  var _deeps = require("./deeps");
9
-
10
8
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
-
12
9
  class MutatableParams {
13
10
  constructor(parentInstance) {
14
11
  _defineProperty(this, "_mutatableParams", void 0);
15
-
16
12
  _defineProperty(this, "_parentInstance", void 0);
17
-
18
13
  if (parentInstance) {
19
14
  this._mutatableParams = parentInstance._mutatableParams;
20
15
  this._parentInstance = parentInstance;
@@ -23,24 +18,19 @@ class MutatableParams {
23
18
  this._parentInstance = this;
24
19
  }
25
20
  }
26
-
27
21
  set(param, value) {
28
22
  (0, _deeps.deepSet)(this._mutatableParams, param, value);
29
23
  return this._parentInstance;
30
24
  }
31
-
32
25
  get(param) {
33
26
  return (0, _deeps.deepGet)(this._mutatableParams, param, '.');
34
27
  }
35
-
36
28
  toJSON() {
37
29
  return Object.assign({}, this._mutatableParams);
38
30
  }
39
-
40
- validate() {// do nothing
31
+ validate() {
32
+ // do nothing
41
33
  }
42
-
43
34
  }
44
-
45
35
  exports.MutatableParams = MutatableParams;
46
36
  //# sourceMappingURL=MutatableParams.js.map