@chipmobilesdk/rn-ads 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/lib/commonjs/config/resolveAdUnit.js +80 -0
  3. package/lib/commonjs/config/resolveAdUnit.js.map +1 -0
  4. package/lib/commonjs/config/types.js +138 -0
  5. package/lib/commonjs/config/types.js.map +1 -0
  6. package/lib/commonjs/config/validate.js +150 -0
  7. package/lib/commonjs/config/validate.js.map +1 -0
  8. package/lib/commonjs/core/adOriginatedReturn.js +119 -0
  9. package/lib/commonjs/core/adOriginatedReturn.js.map +1 -0
  10. package/lib/commonjs/core/adsInstance.js +129 -0
  11. package/lib/commonjs/core/adsInstance.js.map +1 -0
  12. package/lib/commonjs/core/consentFlow.js +154 -0
  13. package/lib/commonjs/core/consentFlow.js.map +1 -0
  14. package/lib/commonjs/core/enablement.js +64 -0
  15. package/lib/commonjs/core/enablement.js.map +1 -0
  16. package/lib/commonjs/core/fullScreenLock.js +48 -0
  17. package/lib/commonjs/core/fullScreenLock.js.map +1 -0
  18. package/lib/commonjs/core/gates.js +95 -0
  19. package/lib/commonjs/core/gates.js.map +1 -0
  20. package/lib/commonjs/core/initMachine.js +159 -0
  21. package/lib/commonjs/core/initMachine.js.map +1 -0
  22. package/lib/commonjs/core/instance/consent.js +155 -0
  23. package/lib/commonjs/core/instance/consent.js.map +1 -0
  24. package/lib/commonjs/core/instance/context.js +217 -0
  25. package/lib/commonjs/core/instance/context.js.map +1 -0
  26. package/lib/commonjs/core/instance/gate.js +194 -0
  27. package/lib/commonjs/core/instance/gate.js.map +1 -0
  28. package/lib/commonjs/core/instance/init.js +326 -0
  29. package/lib/commonjs/core/instance/init.js.map +1 -0
  30. package/lib/commonjs/core/instance/internals.js +115 -0
  31. package/lib/commonjs/core/instance/internals.js.map +1 -0
  32. package/lib/commonjs/core/instance/load.js +458 -0
  33. package/lib/commonjs/core/instance/load.js.map +1 -0
  34. package/lib/commonjs/core/instance/show.js +243 -0
  35. package/lib/commonjs/core/instance/show.js.map +1 -0
  36. package/lib/commonjs/core/instance/types.js +6 -0
  37. package/lib/commonjs/core/instance/types.js.map +1 -0
  38. package/lib/commonjs/core/placementMachine.js +116 -0
  39. package/lib/commonjs/core/placementMachine.js.map +1 -0
  40. package/lib/commonjs/core/privacyGate.js +93 -0
  41. package/lib/commonjs/core/privacyGate.js.map +1 -0
  42. package/lib/commonjs/core/requestThrottle.js +152 -0
  43. package/lib/commonjs/core/requestThrottle.js.map +1 -0
  44. package/lib/commonjs/core/retryPolicy.js +120 -0
  45. package/lib/commonjs/core/retryPolicy.js.map +1 -0
  46. package/lib/commonjs/core/rewardedSession.js +65 -0
  47. package/lib/commonjs/core/rewardedSession.js.map +1 -0
  48. package/lib/commonjs/core/timers.js +162 -0
  49. package/lib/commonjs/core/timers.js.map +1 -0
  50. package/lib/commonjs/diagnostics/correlation.js +33 -0
  51. package/lib/commonjs/diagnostics/correlation.js.map +1 -0
  52. package/lib/commonjs/diagnostics/errors.js +152 -0
  53. package/lib/commonjs/diagnostics/errors.js.map +1 -0
  54. package/lib/commonjs/diagnostics/events.js +132 -0
  55. package/lib/commonjs/diagnostics/events.js.map +1 -0
  56. package/lib/commonjs/engine/admobBanner.js +58 -0
  57. package/lib/commonjs/engine/admobBanner.js.map +1 -0
  58. package/lib/commonjs/engine/admobEngine.js +343 -0
  59. package/lib/commonjs/engine/admobEngine.js.map +1 -0
  60. package/lib/commonjs/engine/admobErrors.js +45 -0
  61. package/lib/commonjs/engine/admobErrors.js.map +1 -0
  62. package/lib/commonjs/engine/port.js +6 -0
  63. package/lib/commonjs/engine/port.js.map +1 -0
  64. package/lib/commonjs/engine/testAdUnits.js +61 -0
  65. package/lib/commonjs/engine/testAdUnits.js.map +1 -0
  66. package/lib/commonjs/index.js +218 -0
  67. package/lib/commonjs/index.js.map +1 -0
  68. package/lib/commonjs/package.json +1 -0
  69. package/lib/commonjs/react/AdsBanner.js +317 -0
  70. package/lib/commonjs/react/AdsBanner.js.map +1 -0
  71. package/lib/commonjs/react/AdsProvider.js +54 -0
  72. package/lib/commonjs/react/AdsProvider.js.map +1 -0
  73. package/lib/commonjs/react/hooks.js +63 -0
  74. package/lib/commonjs/react/hooks.js.map +1 -0
  75. package/lib/commonjs/testing/clock.js +76 -0
  76. package/lib/commonjs/testing/clock.js.map +1 -0
  77. package/lib/commonjs/testing/conformance.js +99 -0
  78. package/lib/commonjs/testing/conformance.js.map +1 -0
  79. package/lib/commonjs/testing/index.js +389 -0
  80. package/lib/commonjs/testing/index.js.map +1 -0
  81. package/lib/module/config/resolveAdUnit.js +75 -0
  82. package/lib/module/config/resolveAdUnit.js.map +1 -0
  83. package/lib/module/config/types.js +134 -0
  84. package/lib/module/config/types.js.map +1 -0
  85. package/lib/module/config/validate.js +146 -0
  86. package/lib/module/config/validate.js.map +1 -0
  87. package/lib/module/core/adOriginatedReturn.js +115 -0
  88. package/lib/module/core/adOriginatedReturn.js.map +1 -0
  89. package/lib/module/core/adsInstance.js +121 -0
  90. package/lib/module/core/adsInstance.js.map +1 -0
  91. package/lib/module/core/consentFlow.js +143 -0
  92. package/lib/module/core/consentFlow.js.map +1 -0
  93. package/lib/module/core/enablement.js +58 -0
  94. package/lib/module/core/enablement.js.map +1 -0
  95. package/lib/module/core/fullScreenLock.js +44 -0
  96. package/lib/module/core/fullScreenLock.js.map +1 -0
  97. package/lib/module/core/gates.js +91 -0
  98. package/lib/module/core/gates.js.map +1 -0
  99. package/lib/module/core/initMachine.js +152 -0
  100. package/lib/module/core/initMachine.js.map +1 -0
  101. package/lib/module/core/instance/consent.js +151 -0
  102. package/lib/module/core/instance/consent.js.map +1 -0
  103. package/lib/module/core/instance/context.js +212 -0
  104. package/lib/module/core/instance/context.js.map +1 -0
  105. package/lib/module/core/instance/gate.js +183 -0
  106. package/lib/module/core/instance/gate.js.map +1 -0
  107. package/lib/module/core/instance/init.js +321 -0
  108. package/lib/module/core/instance/init.js.map +1 -0
  109. package/lib/module/core/instance/internals.js +109 -0
  110. package/lib/module/core/instance/internals.js.map +1 -0
  111. package/lib/module/core/instance/load.js +452 -0
  112. package/lib/module/core/instance/load.js.map +1 -0
  113. package/lib/module/core/instance/show.js +238 -0
  114. package/lib/module/core/instance/show.js.map +1 -0
  115. package/lib/module/core/instance/types.js +4 -0
  116. package/lib/module/core/instance/types.js.map +1 -0
  117. package/lib/module/core/placementMachine.js +109 -0
  118. package/lib/module/core/placementMachine.js.map +1 -0
  119. package/lib/module/core/privacyGate.js +86 -0
  120. package/lib/module/core/privacyGate.js.map +1 -0
  121. package/lib/module/core/requestThrottle.js +146 -0
  122. package/lib/module/core/requestThrottle.js.map +1 -0
  123. package/lib/module/core/retryPolicy.js +113 -0
  124. package/lib/module/core/retryPolicy.js.map +1 -0
  125. package/lib/module/core/rewardedSession.js +61 -0
  126. package/lib/module/core/rewardedSession.js.map +1 -0
  127. package/lib/module/core/timers.js +150 -0
  128. package/lib/module/core/timers.js.map +1 -0
  129. package/lib/module/diagnostics/correlation.js +29 -0
  130. package/lib/module/diagnostics/correlation.js.map +1 -0
  131. package/lib/module/diagnostics/errors.js +143 -0
  132. package/lib/module/diagnostics/errors.js.map +1 -0
  133. package/lib/module/diagnostics/events.js +128 -0
  134. package/lib/module/diagnostics/events.js.map +1 -0
  135. package/lib/module/engine/admobBanner.js +52 -0
  136. package/lib/module/engine/admobBanner.js.map +1 -0
  137. package/lib/module/engine/admobEngine.js +334 -0
  138. package/lib/module/engine/admobEngine.js.map +1 -0
  139. package/lib/module/engine/admobErrors.js +41 -0
  140. package/lib/module/engine/admobErrors.js.map +1 -0
  141. package/lib/module/engine/port.js +4 -0
  142. package/lib/module/engine/port.js.map +1 -0
  143. package/lib/module/engine/testAdUnits.js +56 -0
  144. package/lib/module/engine/testAdUnits.js.map +1 -0
  145. package/lib/module/index.js +59 -0
  146. package/lib/module/index.js.map +1 -0
  147. package/lib/module/package.json +1 -0
  148. package/lib/module/react/AdsBanner.js +312 -0
  149. package/lib/module/react/AdsBanner.js.map +1 -0
  150. package/lib/module/react/AdsProvider.js +48 -0
  151. package/lib/module/react/AdsProvider.js.map +1 -0
  152. package/lib/module/react/hooks.js +58 -0
  153. package/lib/module/react/hooks.js.map +1 -0
  154. package/lib/module/testing/clock.js +72 -0
  155. package/lib/module/testing/clock.js.map +1 -0
  156. package/lib/module/testing/conformance.js +93 -0
  157. package/lib/module/testing/conformance.js.map +1 -0
  158. package/lib/module/testing/index.js +366 -0
  159. package/lib/module/testing/index.js.map +1 -0
  160. package/lib/typescript/commonjs/config/resolveAdUnit.d.ts +43 -0
  161. package/lib/typescript/commonjs/config/resolveAdUnit.d.ts.map +1 -0
  162. package/lib/typescript/commonjs/config/types.d.ts +280 -0
  163. package/lib/typescript/commonjs/config/types.d.ts.map +1 -0
  164. package/lib/typescript/commonjs/config/validate.d.ts +49 -0
  165. package/lib/typescript/commonjs/config/validate.d.ts.map +1 -0
  166. package/lib/typescript/commonjs/core/adOriginatedReturn.d.ts +61 -0
  167. package/lib/typescript/commonjs/core/adOriginatedReturn.d.ts.map +1 -0
  168. package/lib/typescript/commonjs/core/adsInstance.d.ts +33 -0
  169. package/lib/typescript/commonjs/core/adsInstance.d.ts.map +1 -0
  170. package/lib/typescript/commonjs/core/consentFlow.d.ts +84 -0
  171. package/lib/typescript/commonjs/core/consentFlow.d.ts.map +1 -0
  172. package/lib/typescript/commonjs/core/enablement.d.ts +74 -0
  173. package/lib/typescript/commonjs/core/enablement.d.ts.map +1 -0
  174. package/lib/typescript/commonjs/core/fullScreenLock.d.ts +25 -0
  175. package/lib/typescript/commonjs/core/fullScreenLock.d.ts.map +1 -0
  176. package/lib/typescript/commonjs/core/gates.d.ts +76 -0
  177. package/lib/typescript/commonjs/core/gates.d.ts.map +1 -0
  178. package/lib/typescript/commonjs/core/initMachine.d.ts +66 -0
  179. package/lib/typescript/commonjs/core/initMachine.d.ts.map +1 -0
  180. package/lib/typescript/commonjs/core/instance/consent.d.ts +4 -0
  181. package/lib/typescript/commonjs/core/instance/consent.d.ts.map +1 -0
  182. package/lib/typescript/commonjs/core/instance/context.d.ts +118 -0
  183. package/lib/typescript/commonjs/core/instance/context.d.ts.map +1 -0
  184. package/lib/typescript/commonjs/core/instance/gate.d.ts +38 -0
  185. package/lib/typescript/commonjs/core/instance/gate.d.ts.map +1 -0
  186. package/lib/typescript/commonjs/core/instance/init.d.ts +13 -0
  187. package/lib/typescript/commonjs/core/instance/init.d.ts.map +1 -0
  188. package/lib/typescript/commonjs/core/instance/internals.d.ts +60 -0
  189. package/lib/typescript/commonjs/core/instance/internals.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/core/instance/load.d.ts +9 -0
  191. package/lib/typescript/commonjs/core/instance/load.d.ts.map +1 -0
  192. package/lib/typescript/commonjs/core/instance/show.d.ts +7 -0
  193. package/lib/typescript/commonjs/core/instance/show.d.ts.map +1 -0
  194. package/lib/typescript/commonjs/core/instance/types.d.ts +240 -0
  195. package/lib/typescript/commonjs/core/instance/types.d.ts.map +1 -0
  196. package/lib/typescript/commonjs/core/placementMachine.d.ts +55 -0
  197. package/lib/typescript/commonjs/core/placementMachine.d.ts.map +1 -0
  198. package/lib/typescript/commonjs/core/privacyGate.d.ts +40 -0
  199. package/lib/typescript/commonjs/core/privacyGate.d.ts.map +1 -0
  200. package/lib/typescript/commonjs/core/requestThrottle.d.ts +99 -0
  201. package/lib/typescript/commonjs/core/requestThrottle.d.ts.map +1 -0
  202. package/lib/typescript/commonjs/core/retryPolicy.d.ts +66 -0
  203. package/lib/typescript/commonjs/core/retryPolicy.d.ts.map +1 -0
  204. package/lib/typescript/commonjs/core/rewardedSession.d.ts +37 -0
  205. package/lib/typescript/commonjs/core/rewardedSession.d.ts.map +1 -0
  206. package/lib/typescript/commonjs/core/timers.d.ts +135 -0
  207. package/lib/typescript/commonjs/core/timers.d.ts.map +1 -0
  208. package/lib/typescript/commonjs/diagnostics/correlation.d.ts +18 -0
  209. package/lib/typescript/commonjs/diagnostics/correlation.d.ts.map +1 -0
  210. package/lib/typescript/commonjs/diagnostics/errors.d.ts +59 -0
  211. package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
  212. package/lib/typescript/commonjs/diagnostics/events.d.ts +126 -0
  213. package/lib/typescript/commonjs/diagnostics/events.d.ts.map +1 -0
  214. package/lib/typescript/commonjs/engine/admobBanner.d.ts +10 -0
  215. package/lib/typescript/commonjs/engine/admobBanner.d.ts.map +1 -0
  216. package/lib/typescript/commonjs/engine/admobEngine.d.ts +71 -0
  217. package/lib/typescript/commonjs/engine/admobEngine.d.ts.map +1 -0
  218. package/lib/typescript/commonjs/engine/admobErrors.d.ts +9 -0
  219. package/lib/typescript/commonjs/engine/admobErrors.d.ts.map +1 -0
  220. package/lib/typescript/commonjs/engine/port.d.ts +171 -0
  221. package/lib/typescript/commonjs/engine/port.d.ts.map +1 -0
  222. package/lib/typescript/commonjs/engine/testAdUnits.d.ts +33 -0
  223. package/lib/typescript/commonjs/engine/testAdUnits.d.ts.map +1 -0
  224. package/lib/typescript/commonjs/index.d.ts +42 -0
  225. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  226. package/lib/typescript/commonjs/package.json +1 -0
  227. package/lib/typescript/commonjs/react/AdsBanner.d.ts +29 -0
  228. package/lib/typescript/commonjs/react/AdsBanner.d.ts.map +1 -0
  229. package/lib/typescript/commonjs/react/AdsProvider.d.ts +36 -0
  230. package/lib/typescript/commonjs/react/AdsProvider.d.ts.map +1 -0
  231. package/lib/typescript/commonjs/react/hooks.d.ts +27 -0
  232. package/lib/typescript/commonjs/react/hooks.d.ts.map +1 -0
  233. package/lib/typescript/commonjs/testing/clock.d.ts +29 -0
  234. package/lib/typescript/commonjs/testing/clock.d.ts.map +1 -0
  235. package/lib/typescript/commonjs/testing/conformance.d.ts +26 -0
  236. package/lib/typescript/commonjs/testing/conformance.d.ts.map +1 -0
  237. package/lib/typescript/commonjs/testing/index.d.ts +133 -0
  238. package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
  239. package/lib/typescript/module/config/resolveAdUnit.d.ts +43 -0
  240. package/lib/typescript/module/config/resolveAdUnit.d.ts.map +1 -0
  241. package/lib/typescript/module/config/types.d.ts +280 -0
  242. package/lib/typescript/module/config/types.d.ts.map +1 -0
  243. package/lib/typescript/module/config/validate.d.ts +49 -0
  244. package/lib/typescript/module/config/validate.d.ts.map +1 -0
  245. package/lib/typescript/module/core/adOriginatedReturn.d.ts +61 -0
  246. package/lib/typescript/module/core/adOriginatedReturn.d.ts.map +1 -0
  247. package/lib/typescript/module/core/adsInstance.d.ts +33 -0
  248. package/lib/typescript/module/core/adsInstance.d.ts.map +1 -0
  249. package/lib/typescript/module/core/consentFlow.d.ts +84 -0
  250. package/lib/typescript/module/core/consentFlow.d.ts.map +1 -0
  251. package/lib/typescript/module/core/enablement.d.ts +74 -0
  252. package/lib/typescript/module/core/enablement.d.ts.map +1 -0
  253. package/lib/typescript/module/core/fullScreenLock.d.ts +25 -0
  254. package/lib/typescript/module/core/fullScreenLock.d.ts.map +1 -0
  255. package/lib/typescript/module/core/gates.d.ts +76 -0
  256. package/lib/typescript/module/core/gates.d.ts.map +1 -0
  257. package/lib/typescript/module/core/initMachine.d.ts +66 -0
  258. package/lib/typescript/module/core/initMachine.d.ts.map +1 -0
  259. package/lib/typescript/module/core/instance/consent.d.ts +4 -0
  260. package/lib/typescript/module/core/instance/consent.d.ts.map +1 -0
  261. package/lib/typescript/module/core/instance/context.d.ts +118 -0
  262. package/lib/typescript/module/core/instance/context.d.ts.map +1 -0
  263. package/lib/typescript/module/core/instance/gate.d.ts +38 -0
  264. package/lib/typescript/module/core/instance/gate.d.ts.map +1 -0
  265. package/lib/typescript/module/core/instance/init.d.ts +13 -0
  266. package/lib/typescript/module/core/instance/init.d.ts.map +1 -0
  267. package/lib/typescript/module/core/instance/internals.d.ts +60 -0
  268. package/lib/typescript/module/core/instance/internals.d.ts.map +1 -0
  269. package/lib/typescript/module/core/instance/load.d.ts +9 -0
  270. package/lib/typescript/module/core/instance/load.d.ts.map +1 -0
  271. package/lib/typescript/module/core/instance/show.d.ts +7 -0
  272. package/lib/typescript/module/core/instance/show.d.ts.map +1 -0
  273. package/lib/typescript/module/core/instance/types.d.ts +240 -0
  274. package/lib/typescript/module/core/instance/types.d.ts.map +1 -0
  275. package/lib/typescript/module/core/placementMachine.d.ts +55 -0
  276. package/lib/typescript/module/core/placementMachine.d.ts.map +1 -0
  277. package/lib/typescript/module/core/privacyGate.d.ts +40 -0
  278. package/lib/typescript/module/core/privacyGate.d.ts.map +1 -0
  279. package/lib/typescript/module/core/requestThrottle.d.ts +99 -0
  280. package/lib/typescript/module/core/requestThrottle.d.ts.map +1 -0
  281. package/lib/typescript/module/core/retryPolicy.d.ts +66 -0
  282. package/lib/typescript/module/core/retryPolicy.d.ts.map +1 -0
  283. package/lib/typescript/module/core/rewardedSession.d.ts +37 -0
  284. package/lib/typescript/module/core/rewardedSession.d.ts.map +1 -0
  285. package/lib/typescript/module/core/timers.d.ts +135 -0
  286. package/lib/typescript/module/core/timers.d.ts.map +1 -0
  287. package/lib/typescript/module/diagnostics/correlation.d.ts +18 -0
  288. package/lib/typescript/module/diagnostics/correlation.d.ts.map +1 -0
  289. package/lib/typescript/module/diagnostics/errors.d.ts +59 -0
  290. package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
  291. package/lib/typescript/module/diagnostics/events.d.ts +126 -0
  292. package/lib/typescript/module/diagnostics/events.d.ts.map +1 -0
  293. package/lib/typescript/module/engine/admobBanner.d.ts +10 -0
  294. package/lib/typescript/module/engine/admobBanner.d.ts.map +1 -0
  295. package/lib/typescript/module/engine/admobEngine.d.ts +71 -0
  296. package/lib/typescript/module/engine/admobEngine.d.ts.map +1 -0
  297. package/lib/typescript/module/engine/admobErrors.d.ts +9 -0
  298. package/lib/typescript/module/engine/admobErrors.d.ts.map +1 -0
  299. package/lib/typescript/module/engine/port.d.ts +171 -0
  300. package/lib/typescript/module/engine/port.d.ts.map +1 -0
  301. package/lib/typescript/module/engine/testAdUnits.d.ts +33 -0
  302. package/lib/typescript/module/engine/testAdUnits.d.ts.map +1 -0
  303. package/lib/typescript/module/index.d.ts +42 -0
  304. package/lib/typescript/module/index.d.ts.map +1 -0
  305. package/lib/typescript/module/package.json +1 -0
  306. package/lib/typescript/module/react/AdsBanner.d.ts +29 -0
  307. package/lib/typescript/module/react/AdsBanner.d.ts.map +1 -0
  308. package/lib/typescript/module/react/AdsProvider.d.ts +36 -0
  309. package/lib/typescript/module/react/AdsProvider.d.ts.map +1 -0
  310. package/lib/typescript/module/react/hooks.d.ts +27 -0
  311. package/lib/typescript/module/react/hooks.d.ts.map +1 -0
  312. package/lib/typescript/module/testing/clock.d.ts +29 -0
  313. package/lib/typescript/module/testing/clock.d.ts.map +1 -0
  314. package/lib/typescript/module/testing/conformance.d.ts +26 -0
  315. package/lib/typescript/module/testing/conformance.d.ts.map +1 -0
  316. package/lib/typescript/module/testing/index.d.ts +133 -0
  317. package/lib/typescript/module/testing/index.d.ts.map +1 -0
  318. package/package.json +48 -12
  319. package/src/testing/index.ts +17 -3
@@ -0,0 +1,389 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FAKE_BANNER_TEST_ID = void 0;
7
+ Object.defineProperty(exports, "adsEngineChecks", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _conformance.adsEngineChecks;
11
+ }
12
+ });
13
+ exports.allTestAdUnits = allTestAdUnits;
14
+ exports.createFakeAdsEngine = createFakeAdsEngine;
15
+ Object.defineProperty(exports, "createTestClock", {
16
+ enumerable: true,
17
+ get: function () {
18
+ return _clock.createTestClock;
19
+ }
20
+ });
21
+ Object.defineProperty(exports, "runAdsEngineConformance", {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _conformance.runAdsEngineConformance;
25
+ }
26
+ });
27
+ var _react = _interopRequireDefault(require("react"));
28
+ var _reactNative = require("react-native");
29
+ var _clock = require("./clock.js");
30
+ var _testAdUnits = require("../engine/testAdUnits.js");
31
+ var _conformance = require("./conformance.js");
32
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
33
+ /**
34
+ * Deterministic in-memory ads engine for tests (SC-012).
35
+ *
36
+ * This is a real implementation of the same `AdsEngine` port the AdMob adapter
37
+ * implements, not a parallel mock — so a contract change breaks it at compile
38
+ * time and it cannot drift. Nothing here touches a native module or a network.
39
+ *
40
+ * It exists to make the package's guarantees provable. The recorded call log is
41
+ * what SC-002 asserts against ("zero production identifiers reached the
42
+ * adapter") and what SC-003 asserts against ("zero calls before consent").
43
+ * Callback emission is fully caller-driven, which is what lets a test run the
44
+ * reward-before-dismiss and dismiss-before-reward orderings and demand the same
45
+ * outcome from both (SC-007).
46
+ *
47
+ * Exported from `@chipmobilesdk/rn-ads/testing`, never from the main entrypoint,
48
+ * so test doubles cannot reach a production bundle.
49
+ */
50
+
51
+ /**
52
+ * A privacy options form the test is holding open (0.4.0).
53
+ *
54
+ * Settle it whenever the test chooses, which is what lets `busy`, a second
55
+ * call, a consent update, and `dispose()` all be exercised *while* the form is
56
+ * on screen — in any order, rather than only the one a resolved promise allows.
57
+ */
58
+
59
+ const DEFAULT_CONSENT = {
60
+ status: 'not_required',
61
+ canRequestAds: true,
62
+ isFormAvailable: false,
63
+ privacyOptions: 'not_required'
64
+ };
65
+ /**
66
+ * Runs `task` on the next microtask, which is when a provider's callbacks would
67
+ * arrive. Written out because React Native's type declarations omit
68
+ * `queueMicrotask`, although Hermes has it.
69
+ */
70
+ function nextMicrotask(task) {
71
+ Promise.resolve().then(task);
72
+ }
73
+
74
+ /** The testID the fake banner renders under, for a test to find it by. */
75
+ const FAKE_BANNER_TEST_ID = exports.FAKE_BANNER_TEST_ID = 'ads-fake-banner';
76
+
77
+ /**
78
+ * The fake engine's banner component.
79
+ *
80
+ * It renders a host view carrying the props the package handed it, so a test
81
+ * can read them and call the callbacks: `getByTestId(FAKE_BANNER_TEST_ID)`.
82
+ * It used to render `null`, which left the props reachable only on the
83
+ * component instance — something `@testing-library/react-native` cannot see,
84
+ * since a host element is all a consumer's own tests can query.
85
+ */
86
+ function FakeBanner(props) {
87
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
88
+ ...props,
89
+ testID: FAKE_BANNER_TEST_ID
90
+ });
91
+ }
92
+ function createFakeAdsEngine(options = {}) {
93
+ const calls = [];
94
+ const consentCalls = [];
95
+ const clock = options.clock ?? (0, _clock.createTestClock)();
96
+ let consentInfo = {
97
+ ...DEFAULT_CONSENT,
98
+ ...options.consentInfo
99
+ };
100
+ let consentRequestFailure;
101
+ let consentFormFailure;
102
+ let privacyFormFailure;
103
+ let privacyFormResult = {};
104
+ let consentReadFailure;
105
+ /** Set by `holdPrivacyOptionsForm`; consumed by the next form. */
106
+ let heldForm = null;
107
+ const consent = {
108
+ async requestInfoUpdate(consentOptions) {
109
+ consentCalls.push({
110
+ kind: 'requestInfoUpdate',
111
+ options: consentOptions
112
+ });
113
+ if (consentRequestFailure !== undefined) {
114
+ throw consentRequestFailure;
115
+ }
116
+ return consentInfo;
117
+ },
118
+ async showFormIfRequired() {
119
+ consentCalls.push({
120
+ kind: 'showFormIfRequired'
121
+ });
122
+ if (consentFormFailure !== undefined) {
123
+ throw consentFormFailure;
124
+ }
125
+ // A presented form that the user completes moves the status on. The
126
+ // fake only does this when a form was actually required, mirroring the
127
+ // provider: showing nothing cannot change an answer.
128
+ // A region that required a form is one that requires a way back into
129
+ // it, which is what the provider reports once consent is obtained.
130
+ if (consentInfo.status === 'required' && consentInfo.isFormAvailable) {
131
+ consentInfo = {
132
+ status: 'obtained',
133
+ canRequestAds: true,
134
+ isFormAvailable: false,
135
+ privacyOptions: 'required'
136
+ };
137
+ }
138
+ return consentInfo;
139
+ },
140
+ async showPrivacyOptionsForm() {
141
+ consentCalls.push({
142
+ kind: 'showPrivacyOptionsForm'
143
+ });
144
+ const held = heldForm;
145
+ heldForm = null;
146
+ if (held) {
147
+ // Rejects if the test calls `fail`, which is exactly the provider's
148
+ // failure path; resolves with what the user left behind otherwise.
149
+ consentInfo = {
150
+ ...consentInfo,
151
+ ...(await held)
152
+ };
153
+ return consentInfo;
154
+ }
155
+ if (privacyFormFailure !== undefined) {
156
+ throw privacyFormFailure;
157
+ }
158
+ consentInfo = {
159
+ ...consentInfo,
160
+ ...privacyFormResult
161
+ };
162
+ return consentInfo;
163
+ },
164
+ async getInfo() {
165
+ consentCalls.push({
166
+ kind: 'getInfo'
167
+ });
168
+ if (consentReadFailure !== undefined) {
169
+ throw consentReadFailure;
170
+ }
171
+ return consentInfo;
172
+ },
173
+ reset() {
174
+ consentCalls.push({
175
+ kind: 'reset'
176
+ });
177
+ consentInfo = {
178
+ status: 'unknown',
179
+ canRequestAds: false,
180
+ isFormAvailable: true,
181
+ privacyOptions: 'unknown'
182
+ };
183
+ }
184
+ };
185
+ const listeners = new Map();
186
+ /** Callbacks queued before anyone subscribed; see `subscribe`. */
187
+ const pending = new Map();
188
+ const live = new Set();
189
+ let counter = 0;
190
+ function record(call) {
191
+ calls.push(call);
192
+ }
193
+ return {
194
+ calls,
195
+ consentCalls,
196
+ consent,
197
+ clock,
198
+ advance(ms) {
199
+ clock.advance(ms);
200
+ },
201
+ setConsentInfo(info) {
202
+ consentInfo = {
203
+ ...consentInfo,
204
+ ...info
205
+ };
206
+ },
207
+ failConsentRequest(cause = new Error('consent request failed')) {
208
+ consentRequestFailure = cause;
209
+ },
210
+ failConsentForm(cause = new Error('consent form failed')) {
211
+ consentFormFailure = cause;
212
+ },
213
+ setPrivacyOptionsFormResult(info) {
214
+ privacyFormResult = info;
215
+ },
216
+ failPrivacyOptionsForm(cause = new Error('privacy options form failed')) {
217
+ privacyFormFailure = cause;
218
+ },
219
+ holdPrivacyOptionsForm() {
220
+ let settle;
221
+ const promise = new Promise((resolve, reject) => {
222
+ settle = {
223
+ resolve,
224
+ reject
225
+ };
226
+ });
227
+ heldForm = promise;
228
+ return {
229
+ close(info = {}) {
230
+ settle.resolve(info);
231
+ },
232
+ fail(cause = new Error('privacy options form failed')) {
233
+ settle.reject(cause);
234
+ }
235
+ };
236
+ },
237
+ failConsentInfoRead(cause = new Error('consent information read failed')) {
238
+ consentReadFailure = cause;
239
+ },
240
+ isAvailable() {
241
+ return options.available !== false;
242
+ },
243
+ // Renders nothing. A test finds it in the tree by its `adUnitId` prop and
244
+ // calls `onLoaded`, `onFailed`, `onImpression` or `onClicked` itself, which
245
+ // is how a banner is driven without mocking a native module (ADS-12).
246
+ banner: {
247
+ isAvailable: () => options.available !== false,
248
+ Component: FakeBanner
249
+ },
250
+ async initialize(privacy) {
251
+ record({
252
+ kind: 'initialize',
253
+ privacy
254
+ });
255
+ if (options.failInitialize !== undefined) {
256
+ throw options.failInitialize;
257
+ }
258
+ },
259
+ async createFullScreen(format, adUnitId, request) {
260
+ counter += 1;
261
+ const id = `fake-${counter}`;
262
+ record({
263
+ kind: 'createFullScreen',
264
+ format,
265
+ adUnitId,
266
+ handleId: id,
267
+ request
268
+ });
269
+ live.add(id);
270
+ // A real provider delivers `loaded` to a listener attached after the
271
+ // ad object exists, so the callback is queued here and flushed when
272
+ // the caller subscribes. Emitting eagerly would race the caller's own
273
+ // subscribe and the event would be dropped — which is a property of
274
+ // this fake, not of the package, and would make the load look hung.
275
+ if (!options.neverCallBack) {
276
+ pending.set(id, {
277
+ type: 'loaded'
278
+ });
279
+ }
280
+ return {
281
+ id
282
+ };
283
+ },
284
+ async show(handle) {
285
+ record({
286
+ kind: 'show',
287
+ handleId: handle.id
288
+ });
289
+ if (options.failShow !== undefined) {
290
+ throw options.failShow;
291
+ }
292
+ if (!options.neverCallBack) {
293
+ // `show` is called with a listener already attached, so this one
294
+ // can go out directly on the next microtask.
295
+ nextMicrotask(() => {
296
+ for (const listener of Array.from(listeners.get(handle.id) ?? [])) {
297
+ listener({
298
+ type: 'opened'
299
+ });
300
+ }
301
+ });
302
+ }
303
+ },
304
+ subscribe(handle, listener) {
305
+ let set = listeners.get(handle.id);
306
+ if (!set) {
307
+ set = new Set();
308
+ listeners.set(handle.id, set);
309
+ }
310
+ set.add(listener);
311
+ // Flush whatever the provider would have delivered between creating
312
+ // the ad and this subscription.
313
+ const queued = pending.get(handle.id);
314
+ if (queued) {
315
+ pending.delete(handle.id);
316
+ nextMicrotask(() => {
317
+ for (const target of Array.from(listeners.get(handle.id) ?? [])) {
318
+ target(queued);
319
+ }
320
+ });
321
+ }
322
+ let active = true;
323
+ return () => {
324
+ if (!active) {
325
+ return;
326
+ }
327
+ active = false;
328
+ set?.delete(listener);
329
+ if (set && set.size === 0) {
330
+ listeners.delete(handle.id);
331
+ }
332
+ };
333
+ },
334
+ dispose(handle) {
335
+ record({
336
+ kind: 'dispose',
337
+ handleId: handle.id
338
+ });
339
+ live.delete(handle.id);
340
+ listeners.delete(handle.id);
341
+ pending.delete(handle.id);
342
+ },
343
+ adUnitIds() {
344
+ return calls.filter(call => call.kind === 'createFullScreen').map(call => call.adUnitId);
345
+ },
346
+ liveHandles() {
347
+ return Array.from(live);
348
+ },
349
+ emit(handleId, event) {
350
+ for (const listener of Array.from(listeners.get(handleId) ?? [])) {
351
+ listener(event);
352
+ }
353
+ },
354
+ completeLoad(handleId) {
355
+ this.emit(handleId, {
356
+ type: 'loaded'
357
+ });
358
+ },
359
+ emitReward(handleId, reward = {
360
+ type: 'coins',
361
+ amount: 10
362
+ }) {
363
+ this.emit(handleId, {
364
+ type: 'rewarded',
365
+ reward
366
+ });
367
+ },
368
+ listenerCount() {
369
+ let total = 0;
370
+ for (const set of listeners.values()) {
371
+ total += set.size;
372
+ }
373
+ return total;
374
+ },
375
+ reset() {
376
+ calls.length = 0;
377
+ }
378
+ };
379
+ }
380
+ /** Google's official test ad unit for each format, as the package substitutes them (FR-011). */
381
+ function allTestAdUnits() {
382
+ return {
383
+ banner: (0, _testAdUnits.testAdUnitFor)('banner'),
384
+ interstitial: (0, _testAdUnits.testAdUnitFor)('interstitial'),
385
+ rewarded: (0, _testAdUnits.testAdUnitFor)('rewarded'),
386
+ app_open: (0, _testAdUnits.testAdUnitFor)('app_open')
387
+ };
388
+ }
389
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_clock","_testAdUnits","_conformance","e","__esModule","default","DEFAULT_CONSENT","status","canRequestAds","isFormAvailable","privacyOptions","nextMicrotask","task","Promise","resolve","then","FAKE_BANNER_TEST_ID","exports","FakeBanner","props","React","createElement","View","testID","createFakeAdsEngine","options","calls","consentCalls","clock","createTestClock","consentInfo","consentRequestFailure","consentFormFailure","privacyFormFailure","privacyFormResult","consentReadFailure","heldForm","consent","requestInfoUpdate","consentOptions","push","kind","undefined","showFormIfRequired","showPrivacyOptionsForm","held","getInfo","reset","listeners","Map","pending","live","Set","counter","record","call","advance","ms","setConsentInfo","info","failConsentRequest","cause","Error","failConsentForm","setPrivacyOptionsFormResult","failPrivacyOptionsForm","holdPrivacyOptionsForm","settle","promise","reject","close","fail","failConsentInfoRead","isAvailable","available","banner","Component","initialize","privacy","failInitialize","createFullScreen","format","adUnitId","request","id","handleId","add","neverCallBack","set","type","show","handle","failShow","listener","Array","from","get","subscribe","queued","delete","target","active","size","dispose","adUnitIds","filter","map","liveHandles","emit","event","completeLoad","emitReward","reward","amount","listenerCount","total","values","length","allTestAdUnits","testAdUnitFor","interstitial","rewarded","app_open"],"sourceRoot":"../../../src","sources":["testing/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAF,OAAA;AAGA,IAAAG,YAAA,GAAAH,OAAA;AA6ZA,IAAAI,YAAA,GAAAJ,OAAA;AAAyE,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAtbzE;AACA;A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";
2
+
3
+ /**
4
+ * The production-traffic guarantee (FR-011, FR-011a).
5
+ *
6
+ * A pure function, deliberately. This is the single point where a production ad
7
+ * unit can be replaced by an official test one, which is what makes SC-002
8
+ * provable rather than merely intended: a guarantee enforced in one place can be
9
+ * asserted; one spread across three call sites is a hope.
10
+ *
11
+ * The rule, from the 2026-09-02 clarification session:
12
+ *
13
+ * production -> use what the app configured, always, no exceptions
14
+ * development / test -> if it is not one of our own official test units,
15
+ * replace it and say so, loudly, naming the key
16
+ *
17
+ * Substitution rather than rejection is a deliberate trade. Rejecting would
18
+ * block a developer whose only mistake was pulling a teammate's environment
19
+ * file, and turn a configuration smell into a broken integration at every
20
+ * startup. Substituting keeps the app working — which is what a non-production
21
+ * build is for — and reports the problem as a first-class signal. The accepted
22
+ * cost is that a warning can be ignored; it is bounded because production never
23
+ * substitutes, so the misconfiguration surfaces there as ordinary behavior
24
+ * rather than as hidden state.
25
+ */
26
+
27
+ import { isOfficialTestAdUnit, testAdUnitFor } from "../engine/testAdUnits.js";
28
+ export function resolveAdUnit(placement, environment) {
29
+ const configured = placement.androidAdUnitId;
30
+
31
+ // Production is the one environment where the package must not second-guess
32
+ // the app. Substituting here would silently rewrite configuration that was
33
+ // asked for on purpose, and would cost the publisher live revenue.
34
+ if (environment === 'production') {
35
+ return {
36
+ effectiveAdUnitId: configured,
37
+ substituted: false
38
+ };
39
+ }
40
+
41
+ // Structural detection: anything that is not a known official test unit is
42
+ // treated as production-owned. Not a parse of AdMob's publisher-id format —
43
+ // see the note in engine/testAdUnits.ts on why that rule would be a liability.
44
+ if (isOfficialTestAdUnit(configured)) {
45
+ return {
46
+ effectiveAdUnitId: configured,
47
+ substituted: false
48
+ };
49
+ }
50
+ return {
51
+ effectiveAdUnitId: testAdUnitFor(placement.format),
52
+ substituted: true
53
+ };
54
+ }
55
+ /**
56
+ * Resolves a whole catalog at once, so the warning can name every affected
57
+ * placement in a single event rather than trickling one out per load — an
58
+ * integrator wants to fix the whole file, not discover it a placement at a time.
59
+ */
60
+ export function resolvePlacementAdUnits(placements, environment) {
61
+ const byKey = new Map();
62
+ const substitutedKeys = [];
63
+ for (const placement of placements) {
64
+ const resolved = resolveAdUnit(placement, environment);
65
+ byKey.set(placement.key, resolved.effectiveAdUnitId);
66
+ if (resolved.substituted) {
67
+ substitutedKeys.push(placement.key);
68
+ }
69
+ }
70
+ return {
71
+ byKey,
72
+ substitutedKeys
73
+ };
74
+ }
75
+ //# sourceMappingURL=resolveAdUnit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isOfficialTestAdUnit","testAdUnitFor","resolveAdUnit","placement","environment","configured","androidAdUnitId","effectiveAdUnitId","substituted","format","resolvePlacementAdUnits","placements","byKey","Map","substitutedKeys","resolved","set","key","push"],"sourceRoot":"../../../src","sources":["config/resolveAdUnit.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,oBAAoB,EAAEC,aAAa,QAAQ,0BAAuB;AAQ3E,OAAO,SAASC,aAAaA,CAC5BC,SAA8B,EAC9BC,WAAwB,EACP;EACjB,MAAMC,UAAU,GAAGF,SAAS,CAACG,eAAe;;EAE5C;EACA;EACA;EACA,IAAIF,WAAW,KAAK,YAAY,EAAE;IACjC,OAAO;MAAEG,iBAAiB,EAAEF,UAAU;MAAEG,WAAW,EAAE;IAAM,CAAC;EAC7D;;EAEA;EACA;EACA;EACA,IAAIR,oBAAoB,CAACK,UAAU,CAAC,EAAE;IACrC,OAAO;MAAEE,iBAAiB,EAAEF,UAAU;MAAEG,WAAW,EAAE;IAAM,CAAC;EAC7D;EAEA,OAAO;IAAED,iBAAiB,EAAEN,aAAa,CAACE,SAAS,CAACM,MAAM,CAAC;IAAED,WAAW,EAAE;EAAK,CAAC;AACjF;AASA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,uBAAuBA,CACtCC,UAA0C,EAC1CP,WAAwB,EACN;EAClB,MAAMQ,KAAK,GAAG,IAAIC,GAAG,CAAiB,CAAC;EACvC,MAAMC,eAAyB,GAAG,EAAE;EAEpC,KAAK,MAAMX,SAAS,IAAIQ,UAAU,EAAE;IACnC,MAAMI,QAAQ,GAAGb,aAAa,CAACC,SAAS,EAAEC,WAAW,CAAC;IACtDQ,KAAK,CAACI,GAAG,CAACb,SAAS,CAACc,GAAG,EAAEF,QAAQ,CAACR,iBAAiB,CAAC;IACpD,IAAIQ,QAAQ,CAACP,WAAW,EAAE;MACzBM,eAAe,CAACI,IAAI,CAACf,SAAS,CAACc,GAAG,CAAC;IACpC;EACD;EAEA,OAAO;IAAEL,KAAK;IAAEE;EAAgB,CAAC;AAClC","ignoreList":[]}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Public configuration and state types (FR-001, FR-003, FR-004).
5
+ *
6
+ * Nothing here names a platform or an ad provider. That is the whole point:
7
+ * adding an iOS adapter later contributes an optional `iosAdUnitId` and a second
8
+ * engine implementation, and changes nothing a consumer already wrote (FR-006).
9
+ *
10
+ * The package persists none of this. Every value below lives for the lifetime of
11
+ * one instance and is released by `dispose()`.
12
+ */
13
+
14
+ /**
15
+ * Supported formats. Native and rewarded-interstitial remain deferred.
16
+ *
17
+ * `app_open` joined in 0.2.0. It is a member of this union rather than a
18
+ * separate concept because FR-132 forbids a parallel vocabulary: app-open uses
19
+ * the same placement states, events, and error codes as everything else. The
20
+ * cost is that a consumer's exhaustive `switch` over this union stops compiling
21
+ * — the one required migration step, documented in the 0.2.0 release notes.
22
+ */
23
+
24
+ /**
25
+ * Formats that take over the screen, and so contend for the single-show lock.
26
+ * App-open is included deliberately: two full-screen ads at once is a broken
27
+ * app regardless of which formats produced them (FR-129).
28
+ */
29
+
30
+ export function isFullScreenFormat(format) {
31
+ return format === 'interstitial' || format === 'rewarded' || format === 'app_open';
32
+ }
33
+
34
+ /**
35
+ * Declared by the app, because the package cannot depend on any particular
36
+ * configuration mechanism (FR-015). Cross-checked against the runtime dev flag
37
+ * so a debug build claiming `production` is caught rather than trusted (FR-012).
38
+ */
39
+
40
+ /**
41
+ * One logical ad slot. `key` is the app's own stable name — `home_footer`, not
42
+ * an AdMob unit. Provider identifiers appear here in configuration and nowhere
43
+ * else in consumer code (FR-003, FR-007).
44
+ */
45
+
46
+ /**
47
+ * Bounded retry for failed loads. Off unless `AdsConfig.retry` is supplied —
48
+ * upgrading from 0.1.0 without configuring this issues not one extra request
49
+ * (FR-134).
50
+ *
51
+ * Only errors already flagged `retryable` are retried. Configuration errors,
52
+ * consent errors, an unsupported platform, and a disabled or undecided instance
53
+ * never are (FR-135).
54
+ *
55
+ * Backoff is exponential with a fixed x2 multiplier and no jitter. Jitter exists
56
+ * to desynchronize a fleet hitting one server; a single device retrying its own
57
+ * load has no herd to avoid, and omitting it keeps the attempt count an exact
58
+ * assertion rather than a statistical one.
59
+ */
60
+
61
+ /**
62
+ * Whether the app wants ads, including the case where it does not know yet.
63
+ *
64
+ * The package never resolves `undecided` on the app's behalf and never learns
65
+ * why the app chose what it chose — no entitlement, no receipt, no reason
66
+ * (FR-119, FR-120).
67
+ */
68
+
69
+ /**
70
+ * Tools for exercising the consent flow from a device outside a
71
+ * consent-required region.
72
+ *
73
+ * **Stripped entirely when `environment` is `production`.** That is enforced at
74
+ * configuration validation rather than at each call site, so no path through the
75
+ * consent module can forget it, and the fact that they were ignored is
76
+ * observable through a `config_warning` event and `getIgnoredConsentTools()` —
77
+ * not merely documented (FR-113).
78
+ */
79
+
80
+ /**
81
+ * Consent status, normalized. Carries no provider type and no payload (FR-104).
82
+ *
83
+ * Shaped so an iOS adapter can later express both a consent flow and the
84
+ * platform's tracking-permission mechanism, plus the ordering between them,
85
+ * without changing shape.
86
+ */
87
+
88
+ /**
89
+ * Whether the user must be offered a way to change their consent choice
90
+ * (FR-150), added in 0.4.0.
91
+ *
92
+ * The provider's verdict, forwarded — never the package's judgement about a
93
+ * region, exactly as `not_required` in `ConsentState` is not. `required` is the
94
+ * app's cue to show its own "Privacy options" entry; where that entry lives and
95
+ * what it says stay the app's.
96
+ *
97
+ * `unknown` before the first successful `requestInfoUpdate()`, after `reset()`,
98
+ * after a failed update, and on a platform with no adapter. It is not `not_required`:
99
+ * an app that hides the entry on `unknown` is right to, but it must not conclude
100
+ * the user has no right to one.
101
+ */
102
+
103
+ /** Bounds exist because an unbounded timeout is the same defect as no timeout. */
104
+
105
+ /** Content ratings, normalized. Maps onto the provider's own rating scale. */
106
+
107
+ /**
108
+ * Supplied before initialization (FR-016). Never logged, never persisted
109
+ * (FR-021). Everything except `canRequestAds` must reach the provider before it
110
+ * initializes, which is why changing one afterwards reports
111
+ * `requires_reinitialization` rather than pretending it applied (FR-020).
112
+ */
113
+
114
+ /**
115
+ * Why the consent gate is closed.
116
+ *
117
+ * The two original members keep their exact v1 meaning — the app's own gate —
118
+ * so no existing consumer's interpretation changes. The two added in 0.2.0 name
119
+ * the package's consent flow instead. The split exists because the gate has two
120
+ * independent inputs that combine as most-restrictive-wins, and a refusal has to
121
+ * say *which* of them is blocking or the app cannot act on it (FR-105a).
122
+ */
123
+
124
+ /** FR-023. One per instance, observable without holding a provider object. */
125
+
126
+ /**
127
+ * FR-026. One per placement. Banners never reach `consumed` — they are
128
+ * continuous, not single-use.
129
+ */
130
+
131
+ /** FR-047. The provider's reward descriptor, normalized. */
132
+
133
+ /** FR-005. Returned by every subscription; safe to call more than once. */
134
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isFullScreenFormat","format"],"sourceRoot":"../../../src","sources":["config/types.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAGA,OAAO,SAASA,kBAAkBA,CAACC,MAAgB,EAA8B;EAChF,OAAOA,MAAM,KAAK,cAAc,IAAIA,MAAM,KAAK,UAAU,IAAIA,MAAM,KAAK,UAAU;AACnF;;AAEA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAmCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;;AAkDA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;;AAqBA;AACA;AACA;AACA;;AAsBA;;AAMA","ignoreList":[]}