@chipmobilesdk/rn-payment 0.0.0-stage → 0.1.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 ADDED
@@ -0,0 +1,112 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@chipmobilesdk/rn-payment` are recorded here.
4
+
5
+ This package follows semantic versioning. **Entitlement keys are yours**, but
6
+ product keys, error codes, event names, state values, message keys, and the
7
+ public API shape are this package's contract: renaming any of them is a breaking
8
+ change.
9
+
10
+ ## [0.1.0] — unreleased
11
+
12
+ First version. Android only, via Google Play Billing.
13
+
14
+ ### Added
15
+
16
+ **Entitlements**
17
+
18
+ - `getEntitlement`, `getAllEntitlements`, `subscribeEntitlements` — synchronous,
19
+ in-memory reads safe to call on a render path.
20
+ - Three states: `unknown`, `entitled`, `not_entitled`. `unknown` is both the
21
+ initial state and re-entrant, so a long-offline paying user is never reported
22
+ as unpaid.
23
+ - Many-to-many product↔entitlement mapping. An entitlement stays valid while any
24
+ granting product remains.
25
+ - Source attribution: which of *your* product keys currently grants an
26
+ entitlement.
27
+
28
+ **Selling**
29
+
30
+ - `purchase` with a typed outcome covering success, pending, user cancellation,
31
+ already-owned, ineligible, unknown product, region unavailability, disabled,
32
+ not-ready, unsupported, timeout, network error, store error, environment block,
33
+ and validation rejection.
34
+ - One purchase flow at a time. A second request is refused, never queued.
35
+ - `already_owned` triggers a re-sync, which is how a reinstall repairs itself.
36
+ - Consumables with app-controlled consumption via `consume`.
37
+ - Subscriptions with expiry, auto-renew, and cancelled-but-valid reporting.
38
+ - `changePlan` with four proration modes; `openSubscriptionManagement`;
39
+ `confirmPriceChange`.
40
+
41
+ **Finalization**
42
+
43
+ - A persisted queue drained at startup, on foreground, and after each purchase.
44
+ A purchase survives the app being killed between payment and acknowledgement.
45
+ - Idempotent finalization and consumption.
46
+ - Bounded per-session retry that resumes in the next session rather than
47
+ abandoning a paid transaction.
48
+ - `getUnfinalized()` so "paid but not settled" is observable.
49
+
50
+ **Products and pricing**
51
+
52
+ - `getProducts` / `refreshProducts` returning store-formatted prices, currency
53
+ codes, numeric prices for comparison, billing periods, trials, and
54
+ introductory pricing.
55
+ - Offer eligibility as the store determined it.
56
+ - In-memory cache with a configurable TTL, defaulting to 15 minutes.
57
+
58
+ **Sync, restore, and offline**
59
+
60
+ - Automatic sync at initialization and on foreground, rate-limited.
61
+ - `restore` distinguishing "restored" from "nothing found".
62
+ - Revocation on the next sync when the store stops reporting a transaction.
63
+ - Offline reads from the last successful sync, expiring to `unknown` after a
64
+ configurable ceiling (7 days by default).
65
+ - `clearLocalData` and optional cache-scope partitioning.
66
+
67
+ **Safety**
68
+
69
+ - Fail-closed initialization when a non-production build declares `production`.
70
+ - Runtime block on any chargeable purchase outside production, recorded in
71
+ observable state.
72
+ - No exported way to grant an arbitrary entitlement.
73
+
74
+ **Optional server validation**
75
+
76
+ - A hook that decides entitlement for newly completed purchases.
77
+ - Configurable fallback when the backend is unreachable, defaulting to grant and
78
+ queue for re-validation.
79
+
80
+ **React**
81
+
82
+ - `PaymentProvider`, `useEntitlement`, `useEntitlements`, `usePaymentStatus`,
83
+ `usePurchase`, `useProducts`, `useSync`.
84
+
85
+ **Diagnostics**
86
+
87
+ - 19 typed event types with correlation ids, sufficient to reconstruct a
88
+ transaction's lifecycle from logs alone.
89
+ - 22 stable error codes.
90
+ - A localizable message-key map with English defaults and no i18n dependency.
91
+
92
+ **Testing**
93
+
94
+ - A fake store behind `@chipmobilesdk/rn-payment/testing` driving every outcome,
95
+ both callback orderings, connection loss, refunds, and crash-then-recover
96
+ finalization.
97
+
98
+ ### Known limitations
99
+
100
+ - **Grace period and account hold are not separable on Android.** Play returns a
101
+ grace-period subscription as active and stops returning a held one, so
102
+ `renewalState` reports `indeterminate` rather than inventing a distinction. The
103
+ default policy still behaves correctly with no backend; a non-default policy
104
+ needs server data through the validation hook.
105
+ - **iOS is contract-only.** `createStoreProvider()` returns a stub that reports
106
+ `unavailable` on iOS. The host app still starts and runs.
107
+ - **The Android adapter is unverified against an installed binding.** See the
108
+ README's compatibility section.
109
+
110
+ ### Migration
111
+
112
+ None — this is a new package.