@chipmobilesdk/rn-ads 0.6.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 +139 -0
- package/README.md +4 -2
- 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/skills/sdk-rn-ads/SKILL.md +2 -1
- package/src/core/adsInstance.ts +72 -1829
- package/src/core/consentFlow.ts +1 -20
- package/src/core/instance/consent.ts +162 -0
- package/src/core/instance/context.ts +328 -0
- package/src/core/instance/gate.ts +147 -0
- package/src/core/instance/init.ts +262 -0
- package/src/core/instance/internals.ts +138 -0
- package/src/core/instance/load.ts +426 -0
- package/src/core/instance/show.ts +202 -0
- package/src/core/instance/types.ts +198 -0
- package/src/core/requestThrottle.ts +11 -17
- package/src/diagnostics/errors.ts +24 -5
- package/src/engine/admobBanner.tsx +55 -0
- package/src/engine/admobEngine.ts +21 -12
- package/src/engine/admobErrors.ts +44 -0
- package/src/engine/port.ts +46 -1
- package/src/engine/testAdUnits.ts +0 -5
- package/src/react/AdsBanner.tsx +81 -80
- package/src/testing/clock.ts +75 -0
- package/src/testing/index.ts +43 -68
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type { AdsError } from '../diagnostics/errors';
|
|
2
|
+
/**
|
|
3
|
+
* Public configuration and state types (FR-001, FR-003, FR-004).
|
|
4
|
+
*
|
|
5
|
+
* Nothing here names a platform or an ad provider. That is the whole point:
|
|
6
|
+
* adding an iOS adapter later contributes an optional `iosAdUnitId` and a second
|
|
7
|
+
* engine implementation, and changes nothing a consumer already wrote (FR-006).
|
|
8
|
+
*
|
|
9
|
+
* The package persists none of this. Every value below lives for the lifetime of
|
|
10
|
+
* one instance and is released by `dispose()`.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Supported formats. Native and rewarded-interstitial remain deferred.
|
|
14
|
+
*
|
|
15
|
+
* `app_open` joined in 0.2.0. It is a member of this union rather than a
|
|
16
|
+
* separate concept because FR-132 forbids a parallel vocabulary: app-open uses
|
|
17
|
+
* the same placement states, events, and error codes as everything else. The
|
|
18
|
+
* cost is that a consumer's exhaustive `switch` over this union stops compiling
|
|
19
|
+
* — the one required migration step, documented in the 0.2.0 release notes.
|
|
20
|
+
*/
|
|
21
|
+
export type AdFormat = 'banner' | 'interstitial' | 'rewarded' | 'app_open';
|
|
22
|
+
/**
|
|
23
|
+
* Formats that take over the screen, and so contend for the single-show lock.
|
|
24
|
+
* App-open is included deliberately: two full-screen ads at once is a broken
|
|
25
|
+
* app regardless of which formats produced them (FR-129).
|
|
26
|
+
*/
|
|
27
|
+
export type FullScreenFormat = Extract<AdFormat, 'interstitial' | 'rewarded' | 'app_open'>;
|
|
28
|
+
export declare function isFullScreenFormat(format: AdFormat): format is FullScreenFormat;
|
|
29
|
+
/**
|
|
30
|
+
* Declared by the app, because the package cannot depend on any particular
|
|
31
|
+
* configuration mechanism (FR-015). Cross-checked against the runtime dev flag
|
|
32
|
+
* so a debug build claiming `production` is caught rather than trusted (FR-012).
|
|
33
|
+
*/
|
|
34
|
+
export type Environment = 'development' | 'test' | 'production';
|
|
35
|
+
/**
|
|
36
|
+
* One logical ad slot. `key` is the app's own stable name — `home_footer`, not
|
|
37
|
+
* an AdMob unit. Provider identifiers appear here in configuration and nowhere
|
|
38
|
+
* else in consumer code (FR-003, FR-007).
|
|
39
|
+
*/
|
|
40
|
+
export interface PlacementDefinition {
|
|
41
|
+
readonly key: string;
|
|
42
|
+
readonly format: AdFormat;
|
|
43
|
+
readonly androidAdUnitId: string;
|
|
44
|
+
/**
|
|
45
|
+
* Additive placeholder for FR-006. Unused in v1 and never read by the Android
|
|
46
|
+
* adapter — present so that adding iOS is a configuration change rather than a
|
|
47
|
+
* type change for every existing consumer.
|
|
48
|
+
*/
|
|
49
|
+
readonly iosAdUnitId?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Per-placement retry, overriding `AdsConfig.retry` for this placement only.
|
|
52
|
+
* Absent inherits; `false` turns retry off here while leaving it on elsewhere.
|
|
53
|
+
*
|
|
54
|
+
* An override *replaces* the instance-wide policy rather than merging into
|
|
55
|
+
* it, so the effective policy for a placement is readable from configuration
|
|
56
|
+
* without simulating a merge. Both are held to the same bounds, so an
|
|
57
|
+
* override can narrow behavior but never exceed a ceiling (FR-136a).
|
|
58
|
+
*/
|
|
59
|
+
readonly retry?: RetryPolicy | false;
|
|
60
|
+
/**
|
|
61
|
+
* Minimum milliseconds between two provider requests for this placement
|
|
62
|
+
* (FR-140), added in 0.3.0.
|
|
63
|
+
*
|
|
64
|
+
* Absent takes the format-aware default: 60s for a banner, off for full-screen
|
|
65
|
+
* formats. `0` turns it off here while leaving it on elsewhere.
|
|
66
|
+
*
|
|
67
|
+
* This is an **account-safety** floor, not a frequency cap: it limits how often
|
|
68
|
+
* a placement may *ask* for an ad, never how often the app may *show* one. If
|
|
69
|
+
* you are reaching for this to pace interstitials, that belongs in the app.
|
|
70
|
+
*/
|
|
71
|
+
readonly minRequestIntervalMs?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Bounded retry for failed loads. Off unless `AdsConfig.retry` is supplied —
|
|
75
|
+
* upgrading from 0.1.0 without configuring this issues not one extra request
|
|
76
|
+
* (FR-134).
|
|
77
|
+
*
|
|
78
|
+
* Only errors already flagged `retryable` are retried. Configuration errors,
|
|
79
|
+
* consent errors, an unsupported platform, and a disabled or undecided instance
|
|
80
|
+
* never are (FR-135).
|
|
81
|
+
*
|
|
82
|
+
* Backoff is exponential with a fixed x2 multiplier and no jitter. Jitter exists
|
|
83
|
+
* to desynchronize a fleet hitting one server; a single device retrying its own
|
|
84
|
+
* load has no herd to avoid, and omitting it keeps the attempt count an exact
|
|
85
|
+
* assertion rather than a statistical one.
|
|
86
|
+
*/
|
|
87
|
+
export interface RetryPolicy {
|
|
88
|
+
/** Attempts *after* the first. Default 2, bounds 1-5. */
|
|
89
|
+
readonly maxRetries?: number;
|
|
90
|
+
/** Delay before the first retry. Default 2000ms, bounds 500-30000. */
|
|
91
|
+
readonly initialDelayMs?: number;
|
|
92
|
+
/** Ceiling the doubling cannot pass. Default 30000ms, bounds 1000-60000. */
|
|
93
|
+
readonly maxDelayMs?: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Whether the app wants ads, including the case where it does not know yet.
|
|
97
|
+
*
|
|
98
|
+
* The package never resolves `undecided` on the app's behalf and never learns
|
|
99
|
+
* why the app chose what it chose — no entitlement, no receipt, no reason
|
|
100
|
+
* (FR-119, FR-120).
|
|
101
|
+
*/
|
|
102
|
+
export type Enablement = 'enabled' | 'disabled' | 'undecided';
|
|
103
|
+
/**
|
|
104
|
+
* Tools for exercising the consent flow from a device outside a
|
|
105
|
+
* consent-required region.
|
|
106
|
+
*
|
|
107
|
+
* **Stripped entirely when `environment` is `production`.** That is enforced at
|
|
108
|
+
* configuration validation rather than at each call site, so no path through the
|
|
109
|
+
* consent module can forget it, and the fact that they were ignored is
|
|
110
|
+
* observable through a `config_warning` event and `getIgnoredConsentTools()` —
|
|
111
|
+
* not merely documented (FR-113).
|
|
112
|
+
*/
|
|
113
|
+
export interface ConsentTestingOptions {
|
|
114
|
+
/** Makes the flow behave as though the device were in this region. */
|
|
115
|
+
readonly debugGeography?: 'disabled' | 'eea' | 'not_eea' | 'regulated_us_state' | 'other';
|
|
116
|
+
/** Clears any stored decision so the flow runs from the beginning. */
|
|
117
|
+
readonly resetOnStart?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Consent status, normalized. Carries no provider type and no payload (FR-104).
|
|
121
|
+
*
|
|
122
|
+
* Shaped so an iOS adapter can later express both a consent flow and the
|
|
123
|
+
* platform's tracking-permission mechanism, plus the ordering between them,
|
|
124
|
+
* without changing shape.
|
|
125
|
+
*/
|
|
126
|
+
export type ConsentState =
|
|
127
|
+
/** Not yet asked. The initial value, and the value after a reset. */
|
|
128
|
+
'undetermined'
|
|
129
|
+
/** The provider reports this region does not require consent. */
|
|
130
|
+
| 'not_required'
|
|
131
|
+
/** Required and not yet obtained. */
|
|
132
|
+
| 'required'
|
|
133
|
+
/** Obtained. */
|
|
134
|
+
| 'obtained'
|
|
135
|
+
/**
|
|
136
|
+
* The flow failed — a provider error, a network failure, a cancellation, or
|
|
137
|
+
* a form dismissed without an answer. Never, under any circumstance, read as
|
|
138
|
+
* consent granted (FR-106).
|
|
139
|
+
*/
|
|
140
|
+
| 'error';
|
|
141
|
+
/**
|
|
142
|
+
* Whether the user must be offered a way to change their consent choice
|
|
143
|
+
* (FR-150), added in 0.4.0.
|
|
144
|
+
*
|
|
145
|
+
* The provider's verdict, forwarded — never the package's judgement about a
|
|
146
|
+
* region, exactly as `not_required` in `ConsentState` is not. `required` is the
|
|
147
|
+
* app's cue to show its own "Privacy options" entry; where that entry lives and
|
|
148
|
+
* what it says stay the app's.
|
|
149
|
+
*
|
|
150
|
+
* `unknown` before the first successful `requestInfoUpdate()`, after `reset()`,
|
|
151
|
+
* after a failed update, and on a platform with no adapter. It is not `not_required`:
|
|
152
|
+
* an app that hides the entry on `unknown` is right to, but it must not conclude
|
|
153
|
+
* the user has no right to one.
|
|
154
|
+
*/
|
|
155
|
+
export type PrivacyOptionsRequirement = 'required' | 'not_required' | 'unknown';
|
|
156
|
+
export interface ConsentSnapshot {
|
|
157
|
+
readonly state: ConsentState;
|
|
158
|
+
/** Always false when `state` is `error`. */
|
|
159
|
+
readonly canRequestAds: boolean;
|
|
160
|
+
readonly isFormAvailable: boolean;
|
|
161
|
+
/** Whether to offer a "change my choice" entry (FR-150). Added in 0.4.0. */
|
|
162
|
+
readonly privacyOptionsRequirement: PrivacyOptionsRequirement;
|
|
163
|
+
readonly error: AdsError | null;
|
|
164
|
+
}
|
|
165
|
+
/** Bounds exist because an unbounded timeout is the same defect as no timeout. */
|
|
166
|
+
export interface TimeoutConfig {
|
|
167
|
+
readonly load?: number;
|
|
168
|
+
readonly show?: number;
|
|
169
|
+
}
|
|
170
|
+
export interface AdsConfig {
|
|
171
|
+
/**
|
|
172
|
+
* FR-009. When `false`, every operation is a safe no-op reporting `disabled`.
|
|
173
|
+
*
|
|
174
|
+
* `'undecided'` was added in 0.2.0 for an app that cannot answer this at
|
|
175
|
+
* construction time — one selling an ad-removal tier has to ask a store
|
|
176
|
+
* first. Both boolean spellings keep their exact 0.1.0 meaning; widening an
|
|
177
|
+
* *input* union cannot break a consumer, because consumers write this value
|
|
178
|
+
* rather than switching on it (FR-114, BC-003).
|
|
179
|
+
*/
|
|
180
|
+
readonly enabled: boolean | 'undecided';
|
|
181
|
+
readonly environment: Environment;
|
|
182
|
+
readonly placements: readonly PlacementDefinition[];
|
|
183
|
+
readonly timeouts?: TimeoutConfig;
|
|
184
|
+
/** How long a loaded full-screen ad stays presentable (FR-034). */
|
|
185
|
+
readonly adValidityMs?: number;
|
|
186
|
+
/** Ignored entirely in `production` (FR-014). */
|
|
187
|
+
readonly testDeviceIds?: readonly string[];
|
|
188
|
+
/**
|
|
189
|
+
* How long a loaded app-open ad stays presentable. Separate from
|
|
190
|
+
* `adValidityMs`, which continues to govern interstitial and rewarded.
|
|
191
|
+
*
|
|
192
|
+
* Default 30 minutes, half the other formats' window. Note this is *our*
|
|
193
|
+
* constraint, not the provider's — Google expires app-open ads after four
|
|
194
|
+
* hours, which is longer than this package's general full-screen window. The
|
|
195
|
+
* shorter window trades some fill for a fresher creative at the most
|
|
196
|
+
* prominent moment in the app (FR-130).
|
|
197
|
+
*/
|
|
198
|
+
readonly appOpenValidityMs?: number;
|
|
199
|
+
/**
|
|
200
|
+
* How long `enabled: 'undecided'` may go unresolved before the package emits
|
|
201
|
+
* one diagnostic warning. Default 10 seconds.
|
|
202
|
+
*
|
|
203
|
+
* It warns and does nothing else. Resolving on the app's behalf would mean
|
|
204
|
+
* guessing at exactly the business decision FR-120 forbids the package from
|
|
205
|
+
* knowing.
|
|
206
|
+
*/
|
|
207
|
+
readonly undecidedWarningMs?: number;
|
|
208
|
+
/** Instance-wide retry. Absent means retry is entirely off (FR-134). */
|
|
209
|
+
readonly retry?: RetryPolicy;
|
|
210
|
+
/** Consent testing tools. Stripped in `production` (FR-113). */
|
|
211
|
+
readonly consentTesting?: ConsentTestingOptions;
|
|
212
|
+
}
|
|
213
|
+
/** Content ratings, normalized. Maps onto the provider's own rating scale. */
|
|
214
|
+
export type AdContentRating = 'G' | 'PG' | 'T' | 'MA';
|
|
215
|
+
/**
|
|
216
|
+
* Supplied before initialization (FR-016). Never logged, never persisted
|
|
217
|
+
* (FR-021). Everything except `canRequestAds` must reach the provider before it
|
|
218
|
+
* initializes, which is why changing one afterwards reports
|
|
219
|
+
* `requires_reinitialization` rather than pretending it applied (FR-020).
|
|
220
|
+
*/
|
|
221
|
+
export interface PrivacyOptions {
|
|
222
|
+
/** The gate itself. False means no request may be made, for any reason. */
|
|
223
|
+
readonly canRequestAds: boolean;
|
|
224
|
+
/** Distinguishes "the user said no" from "we have not asked yet" (FR-018). */
|
|
225
|
+
readonly consentUndetermined?: boolean;
|
|
226
|
+
readonly childDirected?: boolean;
|
|
227
|
+
readonly underAgeOfConsent?: boolean;
|
|
228
|
+
readonly maxAdContentRating?: AdContentRating;
|
|
229
|
+
/** When false, the package requests non-personalized ads. */
|
|
230
|
+
readonly personalizedAds?: boolean;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Why the consent gate is closed.
|
|
234
|
+
*
|
|
235
|
+
* The two original members keep their exact v1 meaning — the app's own gate —
|
|
236
|
+
* so no existing consumer's interpretation changes. The two added in 0.2.0 name
|
|
237
|
+
* the package's consent flow instead. The split exists because the gate has two
|
|
238
|
+
* independent inputs that combine as most-restrictive-wins, and a refusal has to
|
|
239
|
+
* say *which* of them is blocking or the app cannot act on it (FR-105a).
|
|
240
|
+
*/
|
|
241
|
+
export type PrivacyBlockReason = 'consent_required' | 'consent_undetermined' | 'consent_flow_required' | 'consent_flow_error';
|
|
242
|
+
export type UnavailableReason = 'unsupported_platform' | 'provider_missing';
|
|
243
|
+
/** FR-023. One per instance, observable without holding a provider object. */
|
|
244
|
+
export type InitStatus = 'not_started' | 'blocked' | 'initializing' | 'ready' | 'disabled'
|
|
245
|
+
/**
|
|
246
|
+
* The app has not decided whether ads are on yet — it is still waiting on
|
|
247
|
+
* whatever answers that question, typically a store entitlement sync.
|
|
248
|
+
*
|
|
249
|
+
* Behaves exactly like `disabled` for requests (zero reach the provider) but
|
|
250
|
+
* is deliberately a separate value. That distinction is the entire point:
|
|
251
|
+
* `disabled` means a settled no, and a banner host can reclaim its space;
|
|
252
|
+
* `undecided` means not yet, and the app may want to hold the space so a
|
|
253
|
+
* paying user never sees an ad flash in and out (FR-116).
|
|
254
|
+
*/
|
|
255
|
+
| 'undecided' | 'unavailable' | 'failed';
|
|
256
|
+
/**
|
|
257
|
+
* FR-026. One per placement. Banners never reach `consumed` — they are
|
|
258
|
+
* continuous, not single-use.
|
|
259
|
+
*/
|
|
260
|
+
export type PlacementState = 'idle' | 'loading' | 'ready' | 'showing' | 'consumed' | 'failed'
|
|
261
|
+
/** Mirrors `InitStatus.undecided` so the banner host can report it directly. */
|
|
262
|
+
| 'undecided'
|
|
263
|
+
/**
|
|
264
|
+
* Refused by the per-placement request throttle (FR-140), added in 0.3.0.
|
|
265
|
+
*
|
|
266
|
+
* Deliberately distinct from `failed` and from a no-fill: nothing is wrong,
|
|
267
|
+
* nothing was requested, and the same placement will work again shortly. An
|
|
268
|
+
* app that collapses its ad slot on `failed` will usually want to collapse on
|
|
269
|
+
* this too, but it must be able to tell the two apart when diagnosing why a
|
|
270
|
+
* banner is absent.
|
|
271
|
+
*/
|
|
272
|
+
| 'throttled' | 'unavailable';
|
|
273
|
+
/** FR-047. The provider's reward descriptor, normalized. */
|
|
274
|
+
export interface Reward {
|
|
275
|
+
readonly type: string;
|
|
276
|
+
readonly amount: number;
|
|
277
|
+
}
|
|
278
|
+
/** FR-005. Returned by every subscription; safe to call more than once. */
|
|
279
|
+
export type Unsubscribe = () => void;
|
|
280
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/config/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalog and configuration validation (FR-008), plus the fail-closed check
|
|
3
|
+
* that substitution cannot cover (FR-012).
|
|
4
|
+
*
|
|
5
|
+
* Configuration faults throw rather than returning a result. They mean the app
|
|
6
|
+
* is wired wrong, and no runtime status could describe a usable outcome — every
|
|
7
|
+
* other failure in this package is a typed result instead.
|
|
8
|
+
*
|
|
9
|
+
* Every message names the offending placement key. An error that says only
|
|
10
|
+
* "invalid configuration" makes the integrator hunt through a catalog by hand.
|
|
11
|
+
*/
|
|
12
|
+
import { type ResolvedCatalog } from './resolveAdUnit';
|
|
13
|
+
import { type ResolvedTimeouts } from '../core/timers';
|
|
14
|
+
import { type ResolvedRetryPolicy } from '../core/retryPolicy';
|
|
15
|
+
import type { AdsConfig, ConsentTestingOptions, Enablement, Environment, PlacementDefinition } from './types';
|
|
16
|
+
export interface ValidateOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Whether this is a debug build. Injected rather than read from `__DEV__`
|
|
19
|
+
* directly so the fail-closed rule is testable without manipulating a global
|
|
20
|
+
* the test runner also depends on.
|
|
21
|
+
*/
|
|
22
|
+
readonly isDevBuild: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ResolvedConfig {
|
|
25
|
+
readonly enablement: Enablement;
|
|
26
|
+
readonly environment: Environment;
|
|
27
|
+
readonly placements: ReadonlyMap<string, PlacementDefinition>;
|
|
28
|
+
readonly catalog: ResolvedCatalog;
|
|
29
|
+
readonly timeouts: ResolvedTimeouts;
|
|
30
|
+
/** Empty in production regardless of what was configured (FR-014). */
|
|
31
|
+
readonly testDeviceIds: readonly string[];
|
|
32
|
+
/** Effective retry per placement. `null` means retry is off there (FR-134). */
|
|
33
|
+
readonly retryByKey: ReadonlyMap<string, ResolvedRetryPolicy | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Effective minimum interval between provider requests, per placement
|
|
36
|
+
* (FR-140). Zero means the throttle is off for that placement.
|
|
37
|
+
*/
|
|
38
|
+
readonly minRequestIntervalByKey: ReadonlyMap<string, number>;
|
|
39
|
+
/** Stripped entirely in production (FR-113). */
|
|
40
|
+
readonly consentTesting: ConsentTestingOptions | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Which consent tools were dropped because the environment is production.
|
|
43
|
+
* Surfaced so the inertness is observable rather than merely documented —
|
|
44
|
+
* the same treatment FR-011a gives substituted ad units.
|
|
45
|
+
*/
|
|
46
|
+
readonly ignoredConsentTools: readonly string[];
|
|
47
|
+
}
|
|
48
|
+
export declare function validateConfig(config: AdsConfig, options: ValidateOptions): ResolvedConfig;
|
|
49
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/config/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGnF,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,KAAK,EAEX,SAAS,EACT,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,MAAM,SAAS,CAAC;AASjB,MAAM,WAAW,eAAe;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC9D,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,sEAAsE;IACtE,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACrE;;;OAGG;IACH,QAAQ,CAAC,uBAAuB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9D,gDAAgD;IAChD,QAAQ,CAAC,cAAc,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAC3D;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CAChD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,GAAG,cAAc,CA+G1F"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ad-originated return detection (FR-128).
|
|
3
|
+
*
|
|
4
|
+
* This is the reason app-open belongs in the package rather than in the app.
|
|
5
|
+
* Every other app-open rule — when to show one, how often, on which screens — is
|
|
6
|
+
* policy the app owns. This one is not policy; it is a fact only the package
|
|
7
|
+
* holds. When a user dismisses a full-screen ad, or comes back from a browser an
|
|
8
|
+
* ad opened, the app sees an ordinary return to the foreground and has no way to
|
|
9
|
+
* tell it apart from any other. Showing an app-open ad on that return means
|
|
10
|
+
* showing an ad immediately after an ad, which is both a poor experience and the
|
|
11
|
+
* kind of thing store review notices.
|
|
12
|
+
*
|
|
13
|
+
* The package knows, because it holds the full-screen lock and it sees the click
|
|
14
|
+
* events. So it refuses, with a reason distinct from `busy` and `not_ready` so
|
|
15
|
+
* the app can tell what happened.
|
|
16
|
+
*
|
|
17
|
+
* **Bounded on both sides, deliberately.** Arming has to be tied to something
|
|
18
|
+
* that actually happened, and it has to expire:
|
|
19
|
+
*
|
|
20
|
+
* - Armed when the provider reports a full-screen ad opened, or on a click —
|
|
21
|
+
* that second case is a browser the ad opened, which is the only signal the
|
|
22
|
+
* provider gives for it. Arming is deliberately not tied to the app
|
|
23
|
+
* reporting that it went to the background; see `noteFullScreenShown`.
|
|
24
|
+
* - Disarmed without firing if the app was away longer than
|
|
25
|
+
* `AD_RETURN_MAX_AWAY_MS`. Someone who left, did something else, and came
|
|
26
|
+
* back an hour later is not returning from an ad, and treating them as if
|
|
27
|
+
* they were would refuse a legitimate show.
|
|
28
|
+
* - Refusals last `AD_RETURN_GRACE_MS` after the return, then stop. The window
|
|
29
|
+
* only needs to cover the moment right after the return, where an app-open
|
|
30
|
+
* show would otherwise fire. A window that outlived that moment would start
|
|
31
|
+
* refusing shows that have nothing to do with the ad.
|
|
32
|
+
*
|
|
33
|
+
* Three limits are worth stating plainly, because they are limits rather than
|
|
34
|
+
* defects and the documentation must not imply otherwise:
|
|
35
|
+
*
|
|
36
|
+
* 1. It cannot survive process death. If the OS kills the app while an ad is
|
|
37
|
+
* on screen, the return is a cold start and nothing links it to the ad.
|
|
38
|
+
* 2. It depends on the app reporting `setAppActive` faithfully — an obligation
|
|
39
|
+
* 0.1.0 already imposes for staleness re-evaluation, not a new one.
|
|
40
|
+
* 3. A browser opened by an ad without a preceding click event is undetectable.
|
|
41
|
+
*
|
|
42
|
+
* Pure state. No listener, no timer — it is driven entirely by transitions the
|
|
43
|
+
* package already observes, which is why `dispose()` has nothing extra to
|
|
44
|
+
* release for it.
|
|
45
|
+
*/
|
|
46
|
+
export interface AdOriginatedTracker {
|
|
47
|
+
/** A full-screen ad is on screen, per the provider's own `opened` callback. */
|
|
48
|
+
noteFullScreenShown(nowMs: number): void;
|
|
49
|
+
/** Record an ad click — the only signal that an ad opened a browser. */
|
|
50
|
+
noteClick(nowMs: number): void;
|
|
51
|
+
/** The app went to the background. Kept for the click case's timing. */
|
|
52
|
+
noteBackground(nowMs: number): void;
|
|
53
|
+
/** The app came back. Decides whether this return was ad-originated. */
|
|
54
|
+
noteForeground(nowMs: number): void;
|
|
55
|
+
/** Whether an app-open show should be refused right now. */
|
|
56
|
+
isRefusing(nowMs: number): boolean;
|
|
57
|
+
/** Drops all state. For dispose, and for tests asserting a clean slate. */
|
|
58
|
+
reset(): void;
|
|
59
|
+
}
|
|
60
|
+
export declare function createAdOriginatedTracker(): AdOriginatedTracker;
|
|
61
|
+
//# sourceMappingURL=adOriginatedReturn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adOriginatedReturn.d.ts","sourceRoot":"","sources":["../../../../src/core/adOriginatedReturn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAIH,MAAM,WAAW,mBAAmB;IACnC,+EAA+E;IAC/E,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,wEAAwE;IACxE,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,wEAAwE;IACxE,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,wEAAwE;IACxE,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,4DAA4D;IAC5D,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,2EAA2E;IAC3E,KAAK,IAAI,IAAI,CAAC;CACd;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CAsE/D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ads instance — the public contract's implementation.
|
|
3
|
+
*
|
|
4
|
+
* Every guarantee the specification treats as a rule rather than a convention
|
|
5
|
+
* converges here, and none of it needs a device to prove:
|
|
6
|
+
*
|
|
7
|
+
* FR-022 one native initialization, however many callers race
|
|
8
|
+
* FR-017 no request before the privacy gate permits one
|
|
9
|
+
* FR-011 no production ad unit outside production
|
|
10
|
+
* FR-029 one in-flight provider request per placement
|
|
11
|
+
* FR-030 exactly one full-screen ad, never a queue
|
|
12
|
+
* FR-031 a consumed ad is never reused
|
|
13
|
+
* FR-035 after dispose, a late callback updates nothing and emits nothing
|
|
14
|
+
*
|
|
15
|
+
* This file only composes. Each responsibility lives in `core/instance/` and
|
|
16
|
+
* takes the shared context (ADS-10): the gate, initialization and enablement,
|
|
17
|
+
* full-screen load, show, consent, and the banner host's internals.
|
|
18
|
+
*
|
|
19
|
+
* Nothing here imports the provider. It talks to the engine port, which the
|
|
20
|
+
* caller injects — the AdMob adapter in production, the fake in tests.
|
|
21
|
+
*/
|
|
22
|
+
import type { AdsConfig } from '../config/types';
|
|
23
|
+
import type { AdsEngine } from '../engine/port';
|
|
24
|
+
import type { AdsInstance, CreateAdsOptions } from './instance/types';
|
|
25
|
+
export type { AdsInstance, ConsentApi, CreateAdsOptions, InitResult, LoadRefusal, LoadResult, PrivacyOptionsFormResult, PrivacyUpdateResult, ShowResult, ThrottledResult, } from './instance/types';
|
|
26
|
+
export { getInternals, type InstanceInternals } from './instance/internals';
|
|
27
|
+
/**
|
|
28
|
+
* The instance itself. The public `createAds` (src/index.ts) passes the AdMob
|
|
29
|
+
* adapter as `defaultEngine`: core/ never loads an adapter, so it stays testable
|
|
30
|
+
* in Node and the provider stays replaceable (ADS-14).
|
|
31
|
+
*/
|
|
32
|
+
export declare function createAds(config: AdsConfig, options?: CreateAdsOptions, defaultEngine?: () => AdsEngine): AdsInstance;
|
|
33
|
+
//# sourceMappingURL=adsInstance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adsInstance.d.ts","sourceRoot":"","sources":["../../../../src/core/adsInstance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQhD,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,YAAY,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,UAAU,EACV,wBAAwB,EACxB,mBAAmB,EACnB,UAAU,EACV,eAAe,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,SAAS,CACxB,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,gBAAqB,EAC9B,aAAa,GAAE,MAAM,SAA2B,GAC9C,WAAW,CAgFb"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent orchestration and normalization (FR-101 – FR-110).
|
|
3
|
+
*
|
|
4
|
+
* This closes the most serious gap in 0.1.0. The package *consumed* a consent
|
|
5
|
+
* decision but nothing *produced* one, and the flow that produces it lives
|
|
6
|
+
* inside the very provider library the package promised an app would never have
|
|
7
|
+
* to import. So any app shipping to a consent-required region had to import the
|
|
8
|
+
* provider directly — breaking the package's central promise at exactly the
|
|
9
|
+
* point where it mattered most — and hand-write the same order-sensitive
|
|
10
|
+
* orchestration every other such app was also writing.
|
|
11
|
+
*
|
|
12
|
+
* What this module does **not** do is as load-bearing as what it does:
|
|
13
|
+
*
|
|
14
|
+
* - It renders no consent UI. The form is the provider's (FR-103).
|
|
15
|
+
* - It decides nothing about jurisdictions. Which regions require consent is
|
|
16
|
+
* the provider's answer and the publisher's console configuration; the
|
|
17
|
+
* package forwards it (FR-107).
|
|
18
|
+
* - It never infers consent. An error, a cancellation, a dismissed form, a
|
|
19
|
+
* network failure — all of them land on `error`, and `error` never carries
|
|
20
|
+
* permission (FR-106). This is the invariant the whole module exists to
|
|
21
|
+
* protect, because the failure it prevents is invisible: a request that
|
|
22
|
+
* should not have happened looks exactly like one that should.
|
|
23
|
+
*
|
|
24
|
+
* Pure apart from the port calls it awaits. No React, no provider type crossing
|
|
25
|
+
* outward.
|
|
26
|
+
*/
|
|
27
|
+
import type { ConsentSnapshot, ConsentTestingOptions } from '../config/types';
|
|
28
|
+
import { AdsError } from '../diagnostics/errors';
|
|
29
|
+
import type { EngineConsentInfo, EngineConsentOptions } from '../engine/port';
|
|
30
|
+
import type { ConsentGateInput } from './gates';
|
|
31
|
+
export declare const INITIAL_CONSENT: ConsentSnapshot;
|
|
32
|
+
/**
|
|
33
|
+
* Maps the engine's status onto the published one.
|
|
34
|
+
*
|
|
35
|
+
* `canRequestAds` is taken from the provider rather than derived from the
|
|
36
|
+
* status. The two are not the same question — a region can be `not_required`
|
|
37
|
+
* while the provider still withholds permission — and inventing the second
|
|
38
|
+
* answer from the first is how a package ends up requesting ads it should not.
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizeConsent(info: EngineConsentInfo): ConsentSnapshot;
|
|
41
|
+
/**
|
|
42
|
+
* The snapshot for a failed flow.
|
|
43
|
+
*
|
|
44
|
+
* `canRequestAds` is hard-coded false rather than carried through from anywhere.
|
|
45
|
+
* There is no failure mode in which "the flow broke" should mean "go ahead", and
|
|
46
|
+
* making that structural rather than conditional means no future edit can
|
|
47
|
+
* accidentally reintroduce the inference.
|
|
48
|
+
*
|
|
49
|
+
* The privacy-options requirement is `unknown` for the same reason: a broken
|
|
50
|
+
* flow has no provider verdict to forward, and reporting `not_required` would be
|
|
51
|
+
* the package deciding the user has no right to change their mind (FR-150).
|
|
52
|
+
*/
|
|
53
|
+
export declare function consentFailure(error: AdsError): ConsentSnapshot;
|
|
54
|
+
export declare function toConsentError(cause: unknown, message: string): AdsError;
|
|
55
|
+
/**
|
|
56
|
+
* Projects a snapshot onto the consent gate's second input.
|
|
57
|
+
*
|
|
58
|
+
* Only `obtained` and `not_required` open it. `undetermined` and `required` are
|
|
59
|
+
* both "we do not have permission yet" and are reported as
|
|
60
|
+
* `consent_flow_required`; `error` gets its own reason so an app can tell a
|
|
61
|
+
* user who has not answered from a flow that broke.
|
|
62
|
+
*/
|
|
63
|
+
export declare function toGateInput(snapshot: ConsentSnapshot): ConsentGateInput;
|
|
64
|
+
/**
|
|
65
|
+
* Builds the options for a consent information update.
|
|
66
|
+
*
|
|
67
|
+
* `testing` has already been stripped by config validation when the environment
|
|
68
|
+
* is production, so this function does not re-check. That is deliberate: the
|
|
69
|
+
* guarantee lives at one point rather than being re-asserted at each call site,
|
|
70
|
+
* which is the same reason the ad-unit substitution guarantee is provable
|
|
71
|
+
* (FR-113).
|
|
72
|
+
*/
|
|
73
|
+
export declare function buildConsentOptions(testing: ConsentTestingOptions | undefined, underAgeOfConsent: boolean | undefined, testDeviceIds: readonly string[]): EngineConsentOptions;
|
|
74
|
+
/**
|
|
75
|
+
* One consent operation, with the never-infer rule applied to every exit.
|
|
76
|
+
*
|
|
77
|
+
* Every path out of here is either a normalized snapshot or a normalized error
|
|
78
|
+
* snapshot. Nothing throws, because a consent failure must not be able to block
|
|
79
|
+
* app startup or crash the host (FR-108).
|
|
80
|
+
*/
|
|
81
|
+
export declare function runConsentStep(step: () => Promise<EngineConsentInfo>, failureMessage: string): Promise<ConsentSnapshot>;
|
|
82
|
+
/** Whether a form should be presented, per the provider's own report. */
|
|
83
|
+
export declare function needsForm(snapshot: ConsentSnapshot): boolean;
|
|
84
|
+
//# sourceMappingURL=consentFlow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consentFlow.d.ts","sourceRoot":"","sources":["../../../../src/core/consentFlow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAgB,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,eAAe,EAAE,eAM7B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,eAAe,CAiBzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,eAAe,CAQ/D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,CAMxE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,gBAAgB,CAWvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,qBAAqB,GAAG,SAAS,EAC1C,iBAAiB,EAAE,OAAO,GAAG,SAAS,EACtC,aAAa,EAAE,SAAS,MAAM,EAAE,GAC9B,oBAAoB,CAMtB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,EACtC,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC,eAAe,CAAC,CAM1B;AAED,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAI5D"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Three-state enablement and the typed result of changing it (FR-114 – FR-125).
|
|
3
|
+
*
|
|
4
|
+
* 0.1.0 had a boolean, which forced an app selling an ad-removal tier to lie at
|
|
5
|
+
* startup. It does not yet know whether this user has paid — that answer arrives
|
|
6
|
+
* after a store sync — and both available answers are wrong: `true` flashes ads
|
|
7
|
+
* at someone who paid to never see them, `false` delays ads for everyone else
|
|
8
|
+
* and then runs into the silent re-enable trap below. The missing third state
|
|
9
|
+
* was a hole in the contract, not an omission in the app.
|
|
10
|
+
*
|
|
11
|
+
* The package still knows nothing about payments, entitlements, or why the app
|
|
12
|
+
* decided anything (FR-120). It only stops insisting the decision already exists
|
|
13
|
+
* at construction time.
|
|
14
|
+
*
|
|
15
|
+
* Pure — no provider, no React, no I/O.
|
|
16
|
+
*/
|
|
17
|
+
import type { Enablement, InitStatus, UnavailableReason } from '../config/types';
|
|
18
|
+
/**
|
|
19
|
+
* Normalizes the configured value. `true`/`false` keep their exact 0.1.0
|
|
20
|
+
* meaning, which is what makes the widened config type additive (BC-003).
|
|
21
|
+
*/
|
|
22
|
+
export declare function toEnablement(value: boolean | 'undecided'): Enablement;
|
|
23
|
+
/** Neither `disabled` nor `undecided` may reach the provider (FR-115). */
|
|
24
|
+
export declare function permitsRequests(enablement: Enablement): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The outcome of an enablement change.
|
|
27
|
+
*
|
|
28
|
+
* 0.1.0 returned `void`, which is the defect FR-122 supersedes. Re-enabling
|
|
29
|
+
* after a disable sent the init status back to `not_started`, so the app *had*
|
|
30
|
+
* to call `initialize()` again or every later load and show was refused — and
|
|
31
|
+
* nothing said so. Not the result, not the status, not the documentation. An app
|
|
32
|
+
* whose user's subscription lapsed would turn ads back on and silently show
|
|
33
|
+
* none.
|
|
34
|
+
*/
|
|
35
|
+
export type EnablementResult =
|
|
36
|
+
/**
|
|
37
|
+
* Returned to the status held before disabling, with zero provider calls.
|
|
38
|
+
* The common case: disabling never un-initializes the provider, so there is
|
|
39
|
+
* genuinely nothing to redo.
|
|
40
|
+
*/
|
|
41
|
+
{
|
|
42
|
+
readonly status: 'resumed';
|
|
43
|
+
readonly initStatus: InitStatus;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The instance never reached `ready`, privacy options changed, or the
|
|
47
|
+
* platform became unavailable. The caller must initialize; the package will
|
|
48
|
+
* not do it implicitly, because that would hide an asynchronous, billable
|
|
49
|
+
* operation behind a setter the caller may not be awaiting (FR-121).
|
|
50
|
+
*/
|
|
51
|
+
| {
|
|
52
|
+
readonly status: 'requires_initialization';
|
|
53
|
+
} | {
|
|
54
|
+
readonly status: 'disabled';
|
|
55
|
+
} | {
|
|
56
|
+
readonly status: 'undecided';
|
|
57
|
+
}
|
|
58
|
+
/** The requested state was already the current one. No work, no event. */
|
|
59
|
+
| {
|
|
60
|
+
readonly status: 'unchanged';
|
|
61
|
+
} | {
|
|
62
|
+
readonly status: 'unavailable';
|
|
63
|
+
readonly reason: UnavailableReason;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Whether re-enabling can resume, given what the instance was doing when it was
|
|
67
|
+
* turned off.
|
|
68
|
+
*
|
|
69
|
+
* Only `ready` resumes. Everything else — never started, still initializing,
|
|
70
|
+
* blocked, failed — has no completed initialization to return to, so claiming a
|
|
71
|
+
* resume would put the instance in a state it never actually reached.
|
|
72
|
+
*/
|
|
73
|
+
export declare function canResume(resumeTo: InitStatus | null): resumeTo is 'ready';
|
|
74
|
+
//# sourceMappingURL=enablement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enablement.d.ts","sourceRoot":"","sources":["../../../../src/core/enablement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEjF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,UAAU,CAKrE;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAE/D;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB;AAC3B;;;;GAIG;AACD;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAA;CAAE;AACjE;;;;;GAKG;GACD;IAAE,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAA;CAAE,GAC9C;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAAE;AAClC,0EAA0E;GACxE;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAE1E;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI,GAAG,QAAQ,IAAI,OAAO,CAE1E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single full-screen lock (FR-030).
|
|
3
|
+
*
|
|
4
|
+
* One token per instance, not per placement, because the constraint is about the
|
|
5
|
+
* screen rather than about any particular ad: two full-screen ads stacked on top
|
|
6
|
+
* of each other is a broken app regardless of which placements produced them.
|
|
7
|
+
*
|
|
8
|
+
* **There is no queue.** A refused show is refused, and the caller is told so
|
|
9
|
+
* immediately. Queueing would mean an ad opening at a moment the app never
|
|
10
|
+
* chose — seconds later, on a different screen, after the user moved on — which
|
|
11
|
+
* is exactly the behavior FR-045 forbids the package from deciding on its own.
|
|
12
|
+
*/
|
|
13
|
+
export interface FullScreenLock {
|
|
14
|
+
/** Takes the lock, or returns false if another full-screen ad holds it. */
|
|
15
|
+
acquire(placementKey: string): boolean;
|
|
16
|
+
/** Releases only if this placement holds it; a stale release is a no-op. */
|
|
17
|
+
release(placementKey: string): void;
|
|
18
|
+
/** Whichever placement currently holds it, if any. */
|
|
19
|
+
holder(): string | null;
|
|
20
|
+
isHeld(): boolean;
|
|
21
|
+
/** Drops the lock unconditionally. For dispose only. */
|
|
22
|
+
reset(): void;
|
|
23
|
+
}
|
|
24
|
+
export declare function createFullScreenLock(): FullScreenLock;
|
|
25
|
+
//# sourceMappingURL=fullScreenLock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fullScreenLock.d.ts","sourceRoot":"","sources":["../../../../src/core/fullScreenLock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,cAAc;IAC9B,2EAA2E;IAC3E,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;IACvC,4EAA4E;IAC5E,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,sDAAsD;IACtD,MAAM,IAAI,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,IAAI,OAAO,CAAC;IAClB,wDAAwD;IACxD,KAAK,IAAI,IAAI,CAAC;CACd;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CA4BrD"}
|