@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.
- package/CHANGELOG.md +88 -0
- package/lib/commonjs/config/resolveAdUnit.js +80 -0
- package/lib/commonjs/config/resolveAdUnit.js.map +1 -0
- package/lib/commonjs/config/types.js +138 -0
- package/lib/commonjs/config/types.js.map +1 -0
- package/lib/commonjs/config/validate.js +150 -0
- package/lib/commonjs/config/validate.js.map +1 -0
- package/lib/commonjs/core/adOriginatedReturn.js +119 -0
- package/lib/commonjs/core/adOriginatedReturn.js.map +1 -0
- package/lib/commonjs/core/adsInstance.js +129 -0
- package/lib/commonjs/core/adsInstance.js.map +1 -0
- package/lib/commonjs/core/consentFlow.js +154 -0
- package/lib/commonjs/core/consentFlow.js.map +1 -0
- package/lib/commonjs/core/enablement.js +64 -0
- package/lib/commonjs/core/enablement.js.map +1 -0
- package/lib/commonjs/core/fullScreenLock.js +48 -0
- package/lib/commonjs/core/fullScreenLock.js.map +1 -0
- package/lib/commonjs/core/gates.js +95 -0
- package/lib/commonjs/core/gates.js.map +1 -0
- package/lib/commonjs/core/initMachine.js +159 -0
- package/lib/commonjs/core/initMachine.js.map +1 -0
- package/lib/commonjs/core/instance/consent.js +155 -0
- package/lib/commonjs/core/instance/consent.js.map +1 -0
- package/lib/commonjs/core/instance/context.js +217 -0
- package/lib/commonjs/core/instance/context.js.map +1 -0
- package/lib/commonjs/core/instance/gate.js +194 -0
- package/lib/commonjs/core/instance/gate.js.map +1 -0
- package/lib/commonjs/core/instance/init.js +326 -0
- package/lib/commonjs/core/instance/init.js.map +1 -0
- package/lib/commonjs/core/instance/internals.js +115 -0
- package/lib/commonjs/core/instance/internals.js.map +1 -0
- package/lib/commonjs/core/instance/load.js +458 -0
- package/lib/commonjs/core/instance/load.js.map +1 -0
- package/lib/commonjs/core/instance/show.js +243 -0
- package/lib/commonjs/core/instance/show.js.map +1 -0
- package/lib/commonjs/core/instance/types.js +6 -0
- package/lib/commonjs/core/instance/types.js.map +1 -0
- package/lib/commonjs/core/placementMachine.js +116 -0
- package/lib/commonjs/core/placementMachine.js.map +1 -0
- package/lib/commonjs/core/privacyGate.js +93 -0
- package/lib/commonjs/core/privacyGate.js.map +1 -0
- package/lib/commonjs/core/requestThrottle.js +152 -0
- package/lib/commonjs/core/requestThrottle.js.map +1 -0
- package/lib/commonjs/core/retryPolicy.js +120 -0
- package/lib/commonjs/core/retryPolicy.js.map +1 -0
- package/lib/commonjs/core/rewardedSession.js +65 -0
- package/lib/commonjs/core/rewardedSession.js.map +1 -0
- package/lib/commonjs/core/timers.js +162 -0
- package/lib/commonjs/core/timers.js.map +1 -0
- package/lib/commonjs/diagnostics/correlation.js +33 -0
- package/lib/commonjs/diagnostics/correlation.js.map +1 -0
- package/lib/commonjs/diagnostics/errors.js +152 -0
- package/lib/commonjs/diagnostics/errors.js.map +1 -0
- package/lib/commonjs/diagnostics/events.js +132 -0
- package/lib/commonjs/diagnostics/events.js.map +1 -0
- package/lib/commonjs/engine/admobBanner.js +58 -0
- package/lib/commonjs/engine/admobBanner.js.map +1 -0
- package/lib/commonjs/engine/admobEngine.js +343 -0
- package/lib/commonjs/engine/admobEngine.js.map +1 -0
- package/lib/commonjs/engine/admobErrors.js +45 -0
- package/lib/commonjs/engine/admobErrors.js.map +1 -0
- package/lib/commonjs/engine/port.js +6 -0
- package/lib/commonjs/engine/port.js.map +1 -0
- package/lib/commonjs/engine/testAdUnits.js +61 -0
- package/lib/commonjs/engine/testAdUnits.js.map +1 -0
- package/lib/commonjs/index.js +218 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/react/AdsBanner.js +317 -0
- package/lib/commonjs/react/AdsBanner.js.map +1 -0
- package/lib/commonjs/react/AdsProvider.js +54 -0
- package/lib/commonjs/react/AdsProvider.js.map +1 -0
- package/lib/commonjs/react/hooks.js +63 -0
- package/lib/commonjs/react/hooks.js.map +1 -0
- package/lib/commonjs/testing/clock.js +76 -0
- package/lib/commonjs/testing/clock.js.map +1 -0
- package/lib/commonjs/testing/conformance.js +99 -0
- package/lib/commonjs/testing/conformance.js.map +1 -0
- package/lib/commonjs/testing/index.js +389 -0
- package/lib/commonjs/testing/index.js.map +1 -0
- package/lib/module/config/resolveAdUnit.js +75 -0
- package/lib/module/config/resolveAdUnit.js.map +1 -0
- package/lib/module/config/types.js +134 -0
- package/lib/module/config/types.js.map +1 -0
- package/lib/module/config/validate.js +146 -0
- package/lib/module/config/validate.js.map +1 -0
- package/lib/module/core/adOriginatedReturn.js +115 -0
- package/lib/module/core/adOriginatedReturn.js.map +1 -0
- package/lib/module/core/adsInstance.js +121 -0
- package/lib/module/core/adsInstance.js.map +1 -0
- package/lib/module/core/consentFlow.js +143 -0
- package/lib/module/core/consentFlow.js.map +1 -0
- package/lib/module/core/enablement.js +58 -0
- package/lib/module/core/enablement.js.map +1 -0
- package/lib/module/core/fullScreenLock.js +44 -0
- package/lib/module/core/fullScreenLock.js.map +1 -0
- package/lib/module/core/gates.js +91 -0
- package/lib/module/core/gates.js.map +1 -0
- package/lib/module/core/initMachine.js +152 -0
- package/lib/module/core/initMachine.js.map +1 -0
- package/lib/module/core/instance/consent.js +151 -0
- package/lib/module/core/instance/consent.js.map +1 -0
- package/lib/module/core/instance/context.js +212 -0
- package/lib/module/core/instance/context.js.map +1 -0
- package/lib/module/core/instance/gate.js +183 -0
- package/lib/module/core/instance/gate.js.map +1 -0
- package/lib/module/core/instance/init.js +321 -0
- package/lib/module/core/instance/init.js.map +1 -0
- package/lib/module/core/instance/internals.js +109 -0
- package/lib/module/core/instance/internals.js.map +1 -0
- package/lib/module/core/instance/load.js +452 -0
- package/lib/module/core/instance/load.js.map +1 -0
- package/lib/module/core/instance/show.js +238 -0
- package/lib/module/core/instance/show.js.map +1 -0
- package/lib/module/core/instance/types.js +4 -0
- package/lib/module/core/instance/types.js.map +1 -0
- package/lib/module/core/placementMachine.js +109 -0
- package/lib/module/core/placementMachine.js.map +1 -0
- package/lib/module/core/privacyGate.js +86 -0
- package/lib/module/core/privacyGate.js.map +1 -0
- package/lib/module/core/requestThrottle.js +146 -0
- package/lib/module/core/requestThrottle.js.map +1 -0
- package/lib/module/core/retryPolicy.js +113 -0
- package/lib/module/core/retryPolicy.js.map +1 -0
- package/lib/module/core/rewardedSession.js +61 -0
- package/lib/module/core/rewardedSession.js.map +1 -0
- package/lib/module/core/timers.js +150 -0
- package/lib/module/core/timers.js.map +1 -0
- package/lib/module/diagnostics/correlation.js +29 -0
- package/lib/module/diagnostics/correlation.js.map +1 -0
- package/lib/module/diagnostics/errors.js +143 -0
- package/lib/module/diagnostics/errors.js.map +1 -0
- package/lib/module/diagnostics/events.js +128 -0
- package/lib/module/diagnostics/events.js.map +1 -0
- package/lib/module/engine/admobBanner.js +52 -0
- package/lib/module/engine/admobBanner.js.map +1 -0
- package/lib/module/engine/admobEngine.js +334 -0
- package/lib/module/engine/admobEngine.js.map +1 -0
- package/lib/module/engine/admobErrors.js +41 -0
- package/lib/module/engine/admobErrors.js.map +1 -0
- package/lib/module/engine/port.js +4 -0
- package/lib/module/engine/port.js.map +1 -0
- package/lib/module/engine/testAdUnits.js +56 -0
- package/lib/module/engine/testAdUnits.js.map +1 -0
- package/lib/module/index.js +59 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/react/AdsBanner.js +312 -0
- package/lib/module/react/AdsBanner.js.map +1 -0
- package/lib/module/react/AdsProvider.js +48 -0
- package/lib/module/react/AdsProvider.js.map +1 -0
- package/lib/module/react/hooks.js +58 -0
- package/lib/module/react/hooks.js.map +1 -0
- package/lib/module/testing/clock.js +72 -0
- package/lib/module/testing/clock.js.map +1 -0
- package/lib/module/testing/conformance.js +93 -0
- package/lib/module/testing/conformance.js.map +1 -0
- package/lib/module/testing/index.js +366 -0
- package/lib/module/testing/index.js.map +1 -0
- package/lib/typescript/commonjs/config/resolveAdUnit.d.ts +43 -0
- package/lib/typescript/commonjs/config/resolveAdUnit.d.ts.map +1 -0
- package/lib/typescript/commonjs/config/types.d.ts +280 -0
- package/lib/typescript/commonjs/config/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/config/validate.d.ts +49 -0
- package/lib/typescript/commonjs/config/validate.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/adOriginatedReturn.d.ts +61 -0
- package/lib/typescript/commonjs/core/adOriginatedReturn.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/adsInstance.d.ts +33 -0
- package/lib/typescript/commonjs/core/adsInstance.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/consentFlow.d.ts +84 -0
- package/lib/typescript/commonjs/core/consentFlow.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/enablement.d.ts +74 -0
- package/lib/typescript/commonjs/core/enablement.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/fullScreenLock.d.ts +25 -0
- package/lib/typescript/commonjs/core/fullScreenLock.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/gates.d.ts +76 -0
- package/lib/typescript/commonjs/core/gates.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/initMachine.d.ts +66 -0
- package/lib/typescript/commonjs/core/initMachine.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/instance/consent.d.ts +4 -0
- package/lib/typescript/commonjs/core/instance/consent.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/instance/context.d.ts +118 -0
- package/lib/typescript/commonjs/core/instance/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/instance/gate.d.ts +38 -0
- package/lib/typescript/commonjs/core/instance/gate.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/instance/init.d.ts +13 -0
- package/lib/typescript/commonjs/core/instance/init.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/instance/internals.d.ts +60 -0
- package/lib/typescript/commonjs/core/instance/internals.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/instance/load.d.ts +9 -0
- package/lib/typescript/commonjs/core/instance/load.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/instance/show.d.ts +7 -0
- package/lib/typescript/commonjs/core/instance/show.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/instance/types.d.ts +240 -0
- package/lib/typescript/commonjs/core/instance/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/placementMachine.d.ts +55 -0
- package/lib/typescript/commonjs/core/placementMachine.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/privacyGate.d.ts +40 -0
- package/lib/typescript/commonjs/core/privacyGate.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/requestThrottle.d.ts +99 -0
- package/lib/typescript/commonjs/core/requestThrottle.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/retryPolicy.d.ts +66 -0
- package/lib/typescript/commonjs/core/retryPolicy.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/rewardedSession.d.ts +37 -0
- package/lib/typescript/commonjs/core/rewardedSession.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/timers.d.ts +135 -0
- package/lib/typescript/commonjs/core/timers.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/correlation.d.ts +18 -0
- package/lib/typescript/commonjs/diagnostics/correlation.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts +59 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts +126 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/admobBanner.d.ts +10 -0
- package/lib/typescript/commonjs/engine/admobBanner.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/admobEngine.d.ts +71 -0
- package/lib/typescript/commonjs/engine/admobEngine.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/admobErrors.d.ts +9 -0
- package/lib/typescript/commonjs/engine/admobErrors.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/port.d.ts +171 -0
- package/lib/typescript/commonjs/engine/port.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/testAdUnits.d.ts +33 -0
- package/lib/typescript/commonjs/engine/testAdUnits.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +42 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/react/AdsBanner.d.ts +29 -0
- package/lib/typescript/commonjs/react/AdsBanner.d.ts.map +1 -0
- package/lib/typescript/commonjs/react/AdsProvider.d.ts +36 -0
- package/lib/typescript/commonjs/react/AdsProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/react/hooks.d.ts +27 -0
- package/lib/typescript/commonjs/react/hooks.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/clock.d.ts +29 -0
- package/lib/typescript/commonjs/testing/clock.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance.d.ts +26 -0
- package/lib/typescript/commonjs/testing/conformance.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/index.d.ts +133 -0
- package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/config/resolveAdUnit.d.ts +43 -0
- package/lib/typescript/module/config/resolveAdUnit.d.ts.map +1 -0
- package/lib/typescript/module/config/types.d.ts +280 -0
- package/lib/typescript/module/config/types.d.ts.map +1 -0
- package/lib/typescript/module/config/validate.d.ts +49 -0
- package/lib/typescript/module/config/validate.d.ts.map +1 -0
- package/lib/typescript/module/core/adOriginatedReturn.d.ts +61 -0
- package/lib/typescript/module/core/adOriginatedReturn.d.ts.map +1 -0
- package/lib/typescript/module/core/adsInstance.d.ts +33 -0
- package/lib/typescript/module/core/adsInstance.d.ts.map +1 -0
- package/lib/typescript/module/core/consentFlow.d.ts +84 -0
- package/lib/typescript/module/core/consentFlow.d.ts.map +1 -0
- package/lib/typescript/module/core/enablement.d.ts +74 -0
- package/lib/typescript/module/core/enablement.d.ts.map +1 -0
- package/lib/typescript/module/core/fullScreenLock.d.ts +25 -0
- package/lib/typescript/module/core/fullScreenLock.d.ts.map +1 -0
- package/lib/typescript/module/core/gates.d.ts +76 -0
- package/lib/typescript/module/core/gates.d.ts.map +1 -0
- package/lib/typescript/module/core/initMachine.d.ts +66 -0
- package/lib/typescript/module/core/initMachine.d.ts.map +1 -0
- package/lib/typescript/module/core/instance/consent.d.ts +4 -0
- package/lib/typescript/module/core/instance/consent.d.ts.map +1 -0
- package/lib/typescript/module/core/instance/context.d.ts +118 -0
- package/lib/typescript/module/core/instance/context.d.ts.map +1 -0
- package/lib/typescript/module/core/instance/gate.d.ts +38 -0
- package/lib/typescript/module/core/instance/gate.d.ts.map +1 -0
- package/lib/typescript/module/core/instance/init.d.ts +13 -0
- package/lib/typescript/module/core/instance/init.d.ts.map +1 -0
- package/lib/typescript/module/core/instance/internals.d.ts +60 -0
- package/lib/typescript/module/core/instance/internals.d.ts.map +1 -0
- package/lib/typescript/module/core/instance/load.d.ts +9 -0
- package/lib/typescript/module/core/instance/load.d.ts.map +1 -0
- package/lib/typescript/module/core/instance/show.d.ts +7 -0
- package/lib/typescript/module/core/instance/show.d.ts.map +1 -0
- package/lib/typescript/module/core/instance/types.d.ts +240 -0
- package/lib/typescript/module/core/instance/types.d.ts.map +1 -0
- package/lib/typescript/module/core/placementMachine.d.ts +55 -0
- package/lib/typescript/module/core/placementMachine.d.ts.map +1 -0
- package/lib/typescript/module/core/privacyGate.d.ts +40 -0
- package/lib/typescript/module/core/privacyGate.d.ts.map +1 -0
- package/lib/typescript/module/core/requestThrottle.d.ts +99 -0
- package/lib/typescript/module/core/requestThrottle.d.ts.map +1 -0
- package/lib/typescript/module/core/retryPolicy.d.ts +66 -0
- package/lib/typescript/module/core/retryPolicy.d.ts.map +1 -0
- package/lib/typescript/module/core/rewardedSession.d.ts +37 -0
- package/lib/typescript/module/core/rewardedSession.d.ts.map +1 -0
- package/lib/typescript/module/core/timers.d.ts +135 -0
- package/lib/typescript/module/core/timers.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/correlation.d.ts +18 -0
- package/lib/typescript/module/diagnostics/correlation.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/errors.d.ts +59 -0
- package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/events.d.ts +126 -0
- package/lib/typescript/module/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/module/engine/admobBanner.d.ts +10 -0
- package/lib/typescript/module/engine/admobBanner.d.ts.map +1 -0
- package/lib/typescript/module/engine/admobEngine.d.ts +71 -0
- package/lib/typescript/module/engine/admobEngine.d.ts.map +1 -0
- package/lib/typescript/module/engine/admobErrors.d.ts +9 -0
- package/lib/typescript/module/engine/admobErrors.d.ts.map +1 -0
- package/lib/typescript/module/engine/port.d.ts +171 -0
- package/lib/typescript/module/engine/port.d.ts.map +1 -0
- package/lib/typescript/module/engine/testAdUnits.d.ts +33 -0
- package/lib/typescript/module/engine/testAdUnits.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +42 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/react/AdsBanner.d.ts +29 -0
- package/lib/typescript/module/react/AdsBanner.d.ts.map +1 -0
- package/lib/typescript/module/react/AdsProvider.d.ts +36 -0
- package/lib/typescript/module/react/AdsProvider.d.ts.map +1 -0
- package/lib/typescript/module/react/hooks.d.ts +27 -0
- package/lib/typescript/module/react/hooks.d.ts.map +1 -0
- package/lib/typescript/module/testing/clock.d.ts +29 -0
- package/lib/typescript/module/testing/clock.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance.d.ts +26 -0
- package/lib/typescript/module/testing/conformance.d.ts.map +1 -0
- package/lib/typescript/module/testing/index.d.ts +133 -0
- package/lib/typescript/module/testing/index.d.ts.map +1 -0
- package/package.json +48 -12
- package/src/testing/index.ts +17 -3
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place that decides why a request was refused (FR-140, FR-141).
|
|
3
|
+
*
|
|
4
|
+
* After 0.2.0 there are three independent ways to be blocked — platform
|
|
5
|
+
* availability, the app's three-state enable flag, and consent — and they can be
|
|
6
|
+
* closed in any combination. A precedence spread across four call sites is not a
|
|
7
|
+
* precedence; it is four coincidences that currently agree. So every refusal
|
|
8
|
+
* path in the package routes through `evaluateGates` and nothing else compares
|
|
9
|
+
* gate state.
|
|
10
|
+
*
|
|
11
|
+
* **The order is availability, then enablement, then consent — most immovable
|
|
12
|
+
* first.** Two reasons, and they agree:
|
|
13
|
+
*
|
|
14
|
+
* 1. It is what 0.1.0 already did. `initMachine`'s BLOCK transition is refused
|
|
15
|
+
* outright when the status is `disabled` or `unavailable`, so consent was
|
|
16
|
+
* already the weakest of the three. Any other order would change observable
|
|
17
|
+
* behavior for a consumer who configured nothing new.
|
|
18
|
+
* 2. It is the most useful order for whoever is debugging. An unsupported
|
|
19
|
+
* platform makes the other two unfixable, so reporting "consent required" on
|
|
20
|
+
* a platform that can never serve an ad sends a developer off to build a flow
|
|
21
|
+
* that will never help. Reporting `unavailable` to an app that has also
|
|
22
|
+
* disabled ads costs nothing — that app was not going to show an ad either
|
|
23
|
+
* way.
|
|
24
|
+
*
|
|
25
|
+
* The accepted cost is that an app which *deliberately* disabled ads on an
|
|
26
|
+
* unsupported platform is told about the platform rather than about its own
|
|
27
|
+
* switch. That is fine: neither answer changes what the app does next.
|
|
28
|
+
*
|
|
29
|
+
* Pure. No provider, no React, no I/O — which is what lets the full combination
|
|
30
|
+
* table be a unit test rather than an integration one.
|
|
31
|
+
*/
|
|
32
|
+
import type { Enablement, PrivacyBlockReason, UnavailableReason } from '../config/types.js';
|
|
33
|
+
/** What the consent flow contributes, or `null` when the app never opted in. */
|
|
34
|
+
export type ConsentGateInput = {
|
|
35
|
+
readonly permitted: true;
|
|
36
|
+
} | {
|
|
37
|
+
readonly permitted: false;
|
|
38
|
+
readonly reason: 'consent_flow_required' | 'consent_flow_error';
|
|
39
|
+
} | null;
|
|
40
|
+
export interface GateInput {
|
|
41
|
+
readonly available: {
|
|
42
|
+
readonly ok: true;
|
|
43
|
+
} | {
|
|
44
|
+
readonly ok: false;
|
|
45
|
+
readonly reason: UnavailableReason;
|
|
46
|
+
};
|
|
47
|
+
readonly enablement: Enablement;
|
|
48
|
+
/** The app's own gate, from `PrivacyOptions.canRequestAds`. */
|
|
49
|
+
readonly appGate: {
|
|
50
|
+
readonly permitted: true;
|
|
51
|
+
} | {
|
|
52
|
+
readonly permitted: false;
|
|
53
|
+
readonly reason: PrivacyBlockReason;
|
|
54
|
+
};
|
|
55
|
+
/** The package's consent flow. `null` when unused — then the app's gate alone decides. */
|
|
56
|
+
readonly consentGate: ConsentGateInput;
|
|
57
|
+
}
|
|
58
|
+
export type GateDecision = {
|
|
59
|
+
readonly allowed: true;
|
|
60
|
+
} | {
|
|
61
|
+
readonly allowed: false;
|
|
62
|
+
readonly kind: 'unavailable';
|
|
63
|
+
readonly reason: UnavailableReason;
|
|
64
|
+
} | {
|
|
65
|
+
readonly allowed: false;
|
|
66
|
+
readonly kind: 'disabled';
|
|
67
|
+
} | {
|
|
68
|
+
readonly allowed: false;
|
|
69
|
+
readonly kind: 'undecided';
|
|
70
|
+
} | {
|
|
71
|
+
readonly allowed: false;
|
|
72
|
+
readonly kind: 'blocked';
|
|
73
|
+
readonly reason: PrivacyBlockReason;
|
|
74
|
+
};
|
|
75
|
+
export declare function evaluateGates(input: GateInput): GateDecision;
|
|
76
|
+
//# sourceMappingURL=gates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../../../../src/core/gates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAiB,CAAC;AAEzF,gFAAgF;AAChF,MAAM,MAAM,gBAAgB,GACzB;IAAE,QAAQ,CAA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,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAE9F,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,CAkC5D"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialization state machine (FR-022 – FR-025).
|
|
3
|
+
*
|
|
4
|
+
* Pure and synchronous: it decides what a transition means; the instance
|
|
5
|
+
* performs the I/O. That split is what makes every rule in data-model.md §3.1
|
|
6
|
+
* testable without a provider.
|
|
7
|
+
*
|
|
8
|
+
* The load-bearing invariant is idempotence. Three consumers calling
|
|
9
|
+
* `initialize()` at once must produce exactly one native initialization and
|
|
10
|
+
* three identical results (SC-005) — the instance holds one in-flight promise,
|
|
11
|
+
* and this machine refuses to leave `initializing` for anything but a terminal
|
|
12
|
+
* outcome.
|
|
13
|
+
*/
|
|
14
|
+
import type { InitStatus, PrivacyBlockReason, UnavailableReason } from '../config/types.js';
|
|
15
|
+
import type { AdsError } from '../diagnostics/errors.js';
|
|
16
|
+
export type InitEvent = {
|
|
17
|
+
readonly type: 'START';
|
|
18
|
+
} | {
|
|
19
|
+
readonly type: 'BLOCK';
|
|
20
|
+
readonly reason: PrivacyBlockReason;
|
|
21
|
+
} | {
|
|
22
|
+
readonly type: 'UNAVAILABLE';
|
|
23
|
+
readonly reason: UnavailableReason;
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: 'DISABLE';
|
|
26
|
+
} | {
|
|
27
|
+
readonly type: 'UNDECIDE';
|
|
28
|
+
} | {
|
|
29
|
+
readonly type: 'ENABLE';
|
|
30
|
+
} | {
|
|
31
|
+
readonly type: 'SUCCEED';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Back to `ready` with no native call, because the provider was initialized
|
|
35
|
+
* earlier and nothing has torn it down since (FR-154). The instance decides
|
|
36
|
+
* whether that holds; this machine only refuses to resume from a state a
|
|
37
|
+
* fresh start could not leave either.
|
|
38
|
+
*/
|
|
39
|
+
| {
|
|
40
|
+
readonly type: 'RESUME';
|
|
41
|
+
} | {
|
|
42
|
+
readonly type: 'FAIL';
|
|
43
|
+
readonly error: AdsError;
|
|
44
|
+
};
|
|
45
|
+
export interface InitSnapshot {
|
|
46
|
+
readonly status: InitStatus;
|
|
47
|
+
readonly blockReason: PrivacyBlockReason | null;
|
|
48
|
+
readonly unavailableReason: UnavailableReason | null;
|
|
49
|
+
readonly error: AdsError | null;
|
|
50
|
+
/**
|
|
51
|
+
* The status held when ads were switched off, so re-enabling can return to
|
|
52
|
+
* it instead of silently dropping to `not_started`.
|
|
53
|
+
*
|
|
54
|
+
* 0.1.0's `ENABLE` sent a disabled instance to `not_started`, which meant the
|
|
55
|
+
* app had to call `initialize()` again or every later load and show was
|
|
56
|
+
* refused — and nothing said so. Remembering one value is the whole fix
|
|
57
|
+
* (FR-121).
|
|
58
|
+
*/
|
|
59
|
+
readonly resumeTo: InitStatus | null;
|
|
60
|
+
}
|
|
61
|
+
export declare const initialInit: InitSnapshot;
|
|
62
|
+
export declare function canStart(status: InitStatus): boolean;
|
|
63
|
+
/** Only `ready` may issue requests. Everything else is a refusal with a reason. */
|
|
64
|
+
export declare function canRequest(status: InitStatus): boolean;
|
|
65
|
+
export declare function initReducer(state: InitSnapshot, event: InitEvent): InitSnapshot;
|
|
66
|
+
//# sourceMappingURL=initMachine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initMachine.d.ts","sourceRoot":"","sources":["../../../../src/core/initMachine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAAuB,CAAC;AAEtD,MAAM,MAAM,SAAS,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CA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oot":"","sources":["../../../../../src/core/instance/consent.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAE1C,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,UAAU,CA0IZ"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What every part of an ads instance shares (ADS-10).
|
|
3
|
+
*
|
|
4
|
+
* 0.5.0 kept all of this as `let` bindings inside one 1,500-line closure, and
|
|
5
|
+
* each path that closed a gate re-implemented its own teardown — which is how
|
|
6
|
+
* ADS-01, ADS-02 and ADS-04 happened. Here the state is one object, the
|
|
7
|
+
* placement runtimes are one map, and the helpers that change them are defined
|
|
8
|
+
* once. The controllers (gate, init, load, show, consent, banner) each take this
|
|
9
|
+
* context and nothing else.
|
|
10
|
+
*/
|
|
11
|
+
import { type ListenerSet } from '@chipmobilesdk/rn-core';
|
|
12
|
+
import { type AdFormat, type AdsConfig, type ConsentSnapshot, type Enablement, type InitStatus, type PlacementDefinition, type PlacementState, type PrivacyOptions, type Unsubscribe } from '../../config/types.js';
|
|
13
|
+
import { type ResolvedConfig } from '../../config/validate.js';
|
|
14
|
+
import { type CorrelationIssuer } from '../../diagnostics/correlation.js';
|
|
15
|
+
import { type AdEventEmitter } from '../../diagnostics/events.js';
|
|
16
|
+
import type { AdsEngine, EngineAdHandle } from '../../engine/port.js';
|
|
17
|
+
import { type AdOriginatedTracker } from '../adOriginatedReturn.js';
|
|
18
|
+
import { type FullScreenLock } from '../fullScreenLock.js';
|
|
19
|
+
import { type InitSnapshot } from '../initMachine.js';
|
|
20
|
+
import { placementReducer, type PlacementSnapshot } from '../placementMachine.js';
|
|
21
|
+
import { type RequestThrottle } from '../requestThrottle.js';
|
|
22
|
+
import type { RewardedSession } from '../rewardedSession.js';
|
|
23
|
+
import { type TimerSet } from '../timers.js';
|
|
24
|
+
import type { CreateAdsOptions, InitResult, LoadRefusal, LoadResult } from './types.js';
|
|
25
|
+
export interface PlacementRuntime {
|
|
26
|
+
snapshot: PlacementSnapshot;
|
|
27
|
+
/**
|
|
28
|
+
* The cycle's correlation id, held here rather than read from the snapshot:
|
|
29
|
+
* the reducer resets the snapshot on dismissal, and events emitted around
|
|
30
|
+
* that transition must still carry the id of the cycle they belong to.
|
|
31
|
+
*/
|
|
32
|
+
correlationId: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Whether this cycle already reported a dismissal. Format-independent — the
|
|
35
|
+
* rewarded session guards its own, but interstitials need the same guard and
|
|
36
|
+
* would otherwise report a repeated provider callback twice.
|
|
37
|
+
*/
|
|
38
|
+
dismissed: boolean;
|
|
39
|
+
handle: EngineAdHandle | null;
|
|
40
|
+
unsubscribeEngine: Unsubscribe | null;
|
|
41
|
+
inFlightLoad: Promise<LoadResult> | null;
|
|
42
|
+
/**
|
|
43
|
+
* Settles the in-flight load with a given result. Only a gate closing uses it
|
|
44
|
+
* (FR-153): the caller awaiting `load()` is told the refusal instead of
|
|
45
|
+
* waiting on a request that has been abandoned.
|
|
46
|
+
*/
|
|
47
|
+
abortLoad: ((result: LoadResult) => void) | null;
|
|
48
|
+
cancelLoadTimer: Unsubscribe | null;
|
|
49
|
+
cancelShowTimer: Unsubscribe | null;
|
|
50
|
+
rewarded: RewardedSession | null;
|
|
51
|
+
listeners: ListenerSet<[PlacementState]>;
|
|
52
|
+
/** Retries already spent in this load cycle. Reset when a new cycle starts. */
|
|
53
|
+
retryAttempts: number;
|
|
54
|
+
/** Cancels a scheduled retry. Called by disable, undecided, and dispose. */
|
|
55
|
+
cancelRetry: Unsubscribe | null;
|
|
56
|
+
}
|
|
57
|
+
/** Everything about the instance that changes after creation. */
|
|
58
|
+
export interface InstanceState {
|
|
59
|
+
init: InitSnapshot;
|
|
60
|
+
enablement: Enablement;
|
|
61
|
+
appActive: boolean;
|
|
62
|
+
consent: ConsentSnapshot;
|
|
63
|
+
/** Whether the app ever used the consent flow; until then the gate ignores it (FR-102). */
|
|
64
|
+
consentStarted: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Consent forms currently on screen. A count rather than a flag because
|
|
67
|
+
* `showFormIfRequired` has never refused a concurrent call; only the privacy
|
|
68
|
+
* options form reads it, to report `busy`.
|
|
69
|
+
*/
|
|
70
|
+
consentFormsOpen: number;
|
|
71
|
+
privacyOptionsFormOpen: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Whether the provider has been natively initialized, ever, by this instance.
|
|
74
|
+
*
|
|
75
|
+
* Tracked apart from the init status because the status can leave `ready` —
|
|
76
|
+
* a withdrawn consent moves it to `blocked` — while the native SDK stays
|
|
77
|
+
* initialized. Re-granting must resume, not initialize again (FR-022, FR-154).
|
|
78
|
+
*/
|
|
79
|
+
providerInitialized: boolean;
|
|
80
|
+
undecidedWarned: boolean;
|
|
81
|
+
cancelUndecidedTimer: Unsubscribe | null;
|
|
82
|
+
appliedPrivacy: PrivacyOptions | null;
|
|
83
|
+
currentPrivacy: PrivacyOptions | null;
|
|
84
|
+
inFlightInit: Promise<InitResult> | null;
|
|
85
|
+
disposed: boolean;
|
|
86
|
+
warnedSubstitution: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface InstanceContext {
|
|
89
|
+
readonly resolved: ResolvedConfig;
|
|
90
|
+
readonly engine: AdsEngine;
|
|
91
|
+
readonly now: () => number;
|
|
92
|
+
readonly events: AdEventEmitter;
|
|
93
|
+
readonly correlation: CorrelationIssuer;
|
|
94
|
+
/** FR-140. Account safety, not product policy — see core/requestThrottle.ts. */
|
|
95
|
+
readonly requestThrottle: RequestThrottle;
|
|
96
|
+
readonly timers: TimerSet;
|
|
97
|
+
readonly lock: FullScreenLock;
|
|
98
|
+
readonly adReturn: AdOriginatedTracker;
|
|
99
|
+
readonly state: InstanceState;
|
|
100
|
+
readonly placements: ReadonlyMap<string, PlacementRuntime>;
|
|
101
|
+
readonly statusListeners: ListenerSet<[InitStatus]>;
|
|
102
|
+
readonly consentListeners: ListenerSet<[ConsentSnapshot]>;
|
|
103
|
+
/** A placement's runtime and definition together, or null for an unknown key (ADS-18). */
|
|
104
|
+
placement(key: string): {
|
|
105
|
+
runtime: PlacementRuntime;
|
|
106
|
+
definition: PlacementDefinition;
|
|
107
|
+
} | null;
|
|
108
|
+
setInit(next: InitSnapshot): void;
|
|
109
|
+
setPlacement(key: string, next: PlacementSnapshot): void;
|
|
110
|
+
dispatchPlacement(key: string, event: Parameters<typeof placementReducer>[1]): void;
|
|
111
|
+
setConsent(next: ConsentSnapshot): void;
|
|
112
|
+
releasePlacementResources(key: string): void;
|
|
113
|
+
emitRefusal(operation: 'initialize' | 'load' | 'show', result: LoadRefusal, placementKey?: string, format?: AdFormat): void;
|
|
114
|
+
}
|
|
115
|
+
export declare function createInstanceContext(config: AdsConfig, options: CreateAdsOptions, defaultEngine: () => AdsEngine): InstanceContext;
|
|
116
|
+
/** App-open expires on its own, shorter window (FR-130). */
|
|
117
|
+
export declare function validityFor(context: InstanceContext, format: AdFormat): number;
|
|
118
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/core/instance/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAGN,KAAK,WAAW,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,MAAM,uBAAoB,CAAC;AAC5B,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,0BAAuB,CAAC;AAC5E,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAA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
2
|
+
import type { InstanceContext } from './context.js';
|
|
3
|
+
import type { LoadRefusal } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Assembles the gate's inputs and defers the precedence entirely to
|
|
6
|
+
* `evaluateGates`: availability, then enablement, then the app's privacy input,
|
|
7
|
+
* then the consent flow. Nothing else compares gate state.
|
|
8
|
+
*
|
|
9
|
+
* The consent flow contributes `null` until the app opts into it, which is what
|
|
10
|
+
* makes FR-102 structural: with no flow started the gate sees only the app's
|
|
11
|
+
* own input and behaves exactly as 0.1.0 did.
|
|
12
|
+
*/
|
|
13
|
+
export declare function currentGate(context: InstanceContext): GateDecision;
|
|
14
|
+
/** Maps a closed gate onto the refusal shape load, show, and the banner share. */
|
|
15
|
+
export declare function refusalFor(decision: Extract<GateDecision, {
|
|
16
|
+
allowed: false;
|
|
17
|
+
}>): LoadRefusal;
|
|
18
|
+
/** The refusal that applies now, or null when a request may go ahead. */
|
|
19
|
+
export declare function gateRefusal(context: InstanceContext): LoadRefusal | null;
|
|
20
|
+
/** Cancels every pending retry, everywhere (FR-137). */
|
|
21
|
+
export declare function cancelAllRetries(context: InstanceContext): void;
|
|
22
|
+
/**
|
|
23
|
+
* The one teardown for a gate that closed to `refusal`: retries cancelled,
|
|
24
|
+
* placements halted, and the init status moved to match.
|
|
25
|
+
*/
|
|
26
|
+
export declare function closeGate(context: InstanceContext, refusal: Exclude<LoadRefusal, {
|
|
27
|
+
status: 'unavailable';
|
|
28
|
+
}>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Warns once if the app leaves `undecided` unresolved (FR-119).
|
|
31
|
+
*
|
|
32
|
+
* Once, not repeatedly: a warning that fires every ten seconds becomes noise.
|
|
33
|
+
* And it only warns — resolving the state would mean guessing the business
|
|
34
|
+
* decision FR-120 forbids the package from knowing.
|
|
35
|
+
*/
|
|
36
|
+
export declare function armUndecidedWarning(context: InstanceContext): void;
|
|
37
|
+
export declare function disarmUndecidedWarning(context: InstanceContext): void;
|
|
38
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../../../../src/core/instance/gate.ts"],"names":[],"mappings":"AAWA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,aAAU,CAAC;AAG5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAW,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAS,CAAC;AAE3C;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,YAAY,CASlE;AAED,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,EAAE;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC,GAAG,WAAW,CAW3F;AAED,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,WAAW,GAAG,IAAI,CAGxE;AAED,wDAAwD;AACxD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAK/D;AA4BD;;;GAGG;AACH,wBAAgB,SAAS,CACxB,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC,GACtD,IAAI,CAcN;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAoBlE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAGrE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type EnablementResult } from '../enablement.js';
|
|
2
|
+
import type { Enablement, PrivacyOptions } from '../../config/types.js';
|
|
3
|
+
import type { InstanceContext } from './context.js';
|
|
4
|
+
import type { InitResult, PrivacyUpdateResult } from './types.js';
|
|
5
|
+
export interface InitController {
|
|
6
|
+
initialize(privacy: PrivacyOptions): Promise<InitResult>;
|
|
7
|
+
updatePrivacy(privacy: PrivacyOptions): Promise<PrivacyUpdateResult>;
|
|
8
|
+
setEnablement(next: Enablement): EnablementResult;
|
|
9
|
+
/** Applies a consent outcome to the gate, initializing at most once (FR-105). */
|
|
10
|
+
reevaluateAfterConsent(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare function createInitController(context: InstanceContext): InitController;
|
|
13
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/core/instance/init.ts"],"names":[],"mappings":"AASA,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,kBAAe,CAAC;AAGjE,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAW,CAAC;AASjD,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAS,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC9B,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACzD,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACrE,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,gBAAgB,CAAC;IAClD,iFAAiF;IACjF,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAqO7E"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `AdsBanner` needs from an instance, held off the public type (ADS-13).
|
|
3
|
+
*
|
|
4
|
+
* 0.5.0 exposed this as `AdsInstance.internals`, so any consumer could emit an
|
|
5
|
+
* `impression` or a `reward_earned` into the stream used for revenue
|
|
6
|
+
* reconciliation, and every change here was a breaking type change. It now
|
|
7
|
+
* lives in a WeakMap keyed by the instance: the banner host looks it up, and an
|
|
8
|
+
* instance an app wrote by hand simply has none.
|
|
9
|
+
*/
|
|
10
|
+
import type { PlacementState } from '../../config/types.js';
|
|
11
|
+
import type { AdEvent } from '../../diagnostics/events.js';
|
|
12
|
+
import type { EngineBanner } from '../../engine/port.js';
|
|
13
|
+
import type { InstanceContext } from './context.js';
|
|
14
|
+
import type { AdsInstance, LoadResult, ThrottledResult } from './types.js';
|
|
15
|
+
export interface InstanceInternals {
|
|
16
|
+
/**
|
|
17
|
+
* Whether a banner for this placement may request now, and with what. Pure:
|
|
18
|
+
* it mints nothing, so the host can call it during render (ADS-20).
|
|
19
|
+
*/
|
|
20
|
+
resolveBanner(placementKey: string): {
|
|
21
|
+
readonly ok: true;
|
|
22
|
+
readonly adUnitId: string;
|
|
23
|
+
/** Current at resolution time, so a banner request honors `updatePrivacy`. */
|
|
24
|
+
readonly personalizedAds: boolean;
|
|
25
|
+
} | {
|
|
26
|
+
readonly ok: false;
|
|
27
|
+
readonly result: LoadResult;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Takes the throttle slot for a banner mount (FR-140).
|
|
31
|
+
*
|
|
32
|
+
* Called during render, immediately before the provider component mounts:
|
|
33
|
+
* that component requests as part of the same render, so an effect would be
|
|
34
|
+
* too late. Idempotent for one `token`, so a render that runs twice charges
|
|
35
|
+
* one slot. Emits nothing and sets no state; the host reports a refusal from
|
|
36
|
+
* its effect.
|
|
37
|
+
*/
|
|
38
|
+
commitBannerRequest(placementKey: string, token: string): ThrottledResult | null;
|
|
39
|
+
/** The configured floor for a placement, so the host can report the cause. */
|
|
40
|
+
throttleFloorFor(placementKey: string): number;
|
|
41
|
+
/** The engine's banner when it can render here, or null (ADS-12). */
|
|
42
|
+
banner(): EngineBanner | null;
|
|
43
|
+
emit(event: AdEvent): void;
|
|
44
|
+
setPlacementState(key: string, state: PlacementState): void;
|
|
45
|
+
isReady(): boolean;
|
|
46
|
+
nextCorrelationId(): string;
|
|
47
|
+
/** The instance's clock, so banner events and full-screen events agree (ADS-20). */
|
|
48
|
+
now(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Runs `task` after `delayMs` on the instance's timers, so a test clock drives
|
|
51
|
+
* it and dispose() cancels it. Returns a cancel.
|
|
52
|
+
*/
|
|
53
|
+
schedule(delayMs: number, task: () => void): () => void;
|
|
54
|
+
timerCount(): number;
|
|
55
|
+
}
|
|
56
|
+
/** The banner host's view of an instance `createAds` made; null for any other. */
|
|
57
|
+
export declare function getInternals(instance: AdsInstance): InstanceInternals | null;
|
|
58
|
+
export declare function attachInternals(instance: AdsInstance, internals: InstanceInternals): void;
|
|
59
|
+
export declare function createInternals(context: InstanceContext): InstanceInternals;
|
|
60
|
+
//# sourceMappingURL=internals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internals.d.ts","sourceRoot":"","sources":["../../../../../src/core/instance/internals.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAmB,CAAC;AAItD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAS,CAAC;AAExE,MAAM,WAAW,iBAAiB;IACjC;;;OAGG;IACH,aAAa,CAAC,YAAY,EAAE,MAAM,GAC/B;QACA,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;QAClB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,8EAA8E;QAC9E,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;KACjC,GACD;QAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;KAAE,CAAC;IACvD;;;;;;;;OAQG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAAC;IACjF,8EAA8E;IAC9E,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/C,qEAAqE;IACrE,MAAM,IAAI,YAAY,GAAG,IAAI,CAAC;IAC9B,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5D,OAAO,IAAI,OAAO,CAAC;IACnB,iBAAiB,IAAI,MAAM,CAAC;IAC5B,oFAAoF;IACpF,GAAG,IAAI,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IACxD,UAAU,IAAI,MAAM,CAAC;CACrB;AAID,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,WAAW,GAAG,iBAAiB,GAAG,IAAI,CAE5E;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAEzF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,iBAAiB,CAiE3E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InstanceContext } from './context.js';
|
|
2
|
+
import type { LoadResult } from './types.js';
|
|
3
|
+
export declare function unknownPlacement(context: InstanceContext, placementKey: string, operation: 'load' | 'show'): LoadResult & {
|
|
4
|
+
status: 'failed';
|
|
5
|
+
};
|
|
6
|
+
export declare function createLoader(context: InstanceContext): {
|
|
7
|
+
load(placementKey: string): Promise<LoadResult>;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../../src/core/instance/load.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAE1C,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAAG,MAAM,GACxB,UAAU,GAAG;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,CASnC;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG;IACvD,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAChD,CAsXA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type InstanceContext } from './context.js';
|
|
2
|
+
import type { ShowResult } from './types.js';
|
|
3
|
+
export declare function createShower(context: InstanceContext): {
|
|
4
|
+
show(placementKey: string): Promise<ShowResult>;
|
|
5
|
+
setAppActive(active: boolean): void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=show.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../../../src/core/instance/show.ts"],"names":[],"mappings":"AASA,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,cAAW,CAAC;AAG9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAE1C,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG;IACvD,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChD,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CACpC,CAwLA"}
|