@chipmobilesdk/rn-ads 0.6.0 → 0.7.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 CHANGED
@@ -1,5 +1,56 @@
1
1
  # @chipmobilesdk/rn-ads
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - The ads instance is split by responsibility, and the banner host's wiring is off the
8
+ public type. ([#19](https://github.com/operationd8979/chip-mobile-sdk/pull/19))
9
+
10
+ - `AdsInstance` no longer has an `internals` field. It was undocumented, but any
11
+ consumer could use it to emit `impression` or `reward_earned` into the event stream
12
+ used for revenue reconciliation. `AdsBanner` now reaches an instance's wiring through
13
+ a private registry, so a banner given an instance the app wrote by hand renders
14
+ nothing instead of throwing.
15
+ - Banner events carry the instance's clock (`createAds({ now })`), like full-screen
16
+ events, and resolving a banner during render no longer mints a correlation id.
17
+ - `allTestAdUnits()` moved from the engine module to `@chipmobilesdk/rn-ads/testing`.
18
+ - Rewards from AdMob go through the one `normalizeReward`; an unused consent port guard
19
+ and the throttle's unused `reset`/`lastRequestAt` are gone.
20
+ - Internally, `createAds` is now a 142-line composition root over `core/instance/`
21
+ (gate, init, load, show, consent, internals), down from one 1,899-line closure. Every
22
+ path that closes the request gate goes through one teardown.
23
+
24
+ - Four fixes to how ads behave around throttling, retries and show timeouts. ([#19](https://github.com/operationd8979/chip-mobile-sdk/pull/19))
25
+
26
+ - A banner refused by the request throttle now tries again by itself once the window
27
+ passes. Before, it stayed empty until it was remounted, so a banner on a screen the
28
+ user returned to within a minute never filled.
29
+ - A load retry waits at least as long as the placement's `minRequestIntervalMs`
30
+ requires, so a retry policy cannot request faster than the floor allows. The
31
+ `retry_scheduled` event reports the wait actually used.
32
+ - A request AdMob refuses outright (an invalid request or ad unit, a missing app id)
33
+ is the new non-retryable `provider_rejected` code instead of a retryable
34
+ `provider_error`, so a retry policy no longer spends billable requests on it. Engines
35
+ may classify a failure with the new optional `kind` on the `failed` event.
36
+ - A show that times out and then opens anyway is reported once, not twice. The late
37
+ ad holds the full-screen lock until it is dismissed, and its reward and dismissal
38
+ still reach the app.
39
+
40
+ - The banner renders through the engine port. `AdsEngine` has an optional `banner`
41
+ capability (`isAvailable()` and a `Component` with neutral props: `adUnitId`,
42
+ `personalizedAds`, `onLoaded`, `onFailed`, `onImpression`, `onClicked`), and the AdMob
43
+ adapter supplies the adaptive `BannerAd` there. `AdsBanner` no longer loads the AdMob
44
+ bridge itself, so a custom or future iOS engine provides its own banner, and the fake
45
+ engine from `./testing` renders one in tests without a mocked native module. An engine
46
+ without `banner` keeps working; its banners report `unavailable`. ([#19](https://github.com/operationd8979/chip-mobile-sdk/pull/19))
47
+
48
+ ### Patch Changes
49
+
50
+ - Internal: no module in these packages is over 500 lines any more. The camera controller's session I/O moved to `sessionRuntime` and its contract to `contract.ts`; the Play adapter's shape translation to `iapShapes`; the purchase flow's failure mapping and its receipt-validation hook to modules of their own; the AI client's quota request to `quotaRequest`; the in-memory adapter's attachments and the fake ads engine's clock likewise. Behaviour is unchanged — the splits are by responsibility, and every package's suite passes as it stood. ([#19](https://github.com/operationd8979/chip-mobile-sdk/pull/19))
51
+
52
+ The repository also measures what it promised: `npm run perf` prints the median of nine runs of the deterministic hot paths against written budgets (recurrence expansion, theme construction, translation lookup, chart geometry, filter compilation), the demo app has a Performance screen reporting startup phases, time to interactive and the same benchmarks on Hermes, and `npm run check:file-size` keeps the limit from drifting. The budgets and the measured figures are recorded in `docs/standards.md` §VI.
53
+
3
54
  ## 0.6.0
4
55
 
5
56
  ### Minor Changes
package/README.md CHANGED
@@ -273,7 +273,9 @@ ads.subscribeEvents(event => {
273
273
  A config value outside its band names its own field and code: a timeout or validity window is `timeout_out_of_bounds`, a retry policy `retry_out_of_bounds`, a placement's `minRequestIntervalMs` `invalid_config`.
274
274
 
275
275
  Retryable: `no_fill` `network_error` `load_timeout` `show_timeout` `ad_expired` `not_ready` `busy` `consumed` `app_inactive` `provider_error`
276
- Not retryable: `invalid_config` `duplicate_placement_key` `missing_ad_unit_id` `format_mismatch` `placement_not_found` `production_in_dev_build` `timeout_out_of_bounds` `retry_out_of_bounds` `unsupported_platform` `provider_missing` `disabled` `consent_required` `consent_undetermined` `requires_reinitialization` `internal_error`
276
+ Not retryable: `invalid_config` `duplicate_placement_key` `missing_ad_unit_id` `format_mismatch` `placement_not_found` `production_in_dev_build` `timeout_out_of_bounds` `retry_out_of_bounds` `unsupported_platform` `provider_missing` `disabled` `consent_required` `consent_undetermined` `requires_reinitialization` `provider_rejected` `internal_error`
277
+
278
+ `provider_rejected` (0.7.0) means AdMob refused the request itself — an invalid request or ad unit, a missing app id — so a retry policy does not spend more requests on it. Before, those were `provider_error` and were retried.
277
279
 
278
280
  Attach any logger or analytics you already use. The package depends on none:
279
281
 
@@ -804,7 +806,7 @@ On device, verify with Google's official test ads only. `npm run android`, then
804
806
  Adding iOS contributes exactly three things and changes **nothing** you have already written:
805
807
 
806
808
  1. **`PlacementDefinition.iosAdUnitId`** — the optional field already exists in v1's type, so existing Android-only catalogs stay valid.
807
- 2. **A second engine adapter** behind the existing `AdsEngine` port. The port names no platform and no provider; that is what makes this additive.
809
+ 2. **A second engine adapter** behind the existing `AdsEngine` port. The port names no platform and no provider; that is what makes this additive. The banner is part of the port too (`AdsEngine.banner`, since 0.7.0): an adapter supplies its own banner component, which receives neutral props (`adUnitId`, `personalizedAds`, `onLoaded`, `onFailed`, `onImpression`, `onClicked`), and `AdsBanner` renders whatever the engine offers.
808
810
  3. **iOS entries in the private test-ad-unit table.**
809
811
 
810
812
  Your `createAds`, `initialize`, `load`, `show`, `AdsBanner`, and every subscription keep their current signatures. The exported state, event, and error models do not change.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipmobilesdk/rn-ads",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "main": "src/index.ts",
@@ -174,7 +174,8 @@ policy; everything else returns a typed result rather than throwing) · `AdsProv
174
174
  `UNDECIDED_WARNING_BOUNDS`, `DEFAULT_BANNER_MIN_REQUEST_INTERVAL_MS`,
175
175
  `DEFAULT_FULL_SCREEN_MIN_REQUEST_INTERVAL_MS`, `MIN_REQUEST_INTERVAL_BOUNDS`,
176
176
  `defaultMinRequestIntervalMs` · `createFakeAdsEngine`, `createTestClock`,
177
- `runAdsEngineConformance` from `@chipmobilesdk/rn-ads/testing` (test doubles only).
177
+ `runAdsEngineConformance`, `allTestAdUnits` from `@chipmobilesdk/rn-ads/testing` (test
178
+ doubles only).
178
179
 
179
180
  Instance: `initialize`, `updatePrivacy`, `setEnabled`, `setEnablement`, `setAppActive`,
180
181
  `consent`, `getStatus`, `subscribeStatus`, `load`, `show`, `getPlacementState`,