@entitlehub/react-native 0.1.1 → 0.1.3
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 +12 -0
- package/README.md +22 -0
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +2 -1
- package/package.json +23 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.2 — 2026-07-18
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `configureEntitleHub({ iap })` — inject the OpenIAP-compatible store module (pinned expo-iap
|
|
7
|
+
version, or react-native-iap) instead of the hard-coded `expo-iap`. Decouples this SDK from a
|
|
8
|
+
single store-library version so you can work around a native issue without changing the SDK.
|
|
9
|
+
|
|
10
|
+
### Docs
|
|
11
|
+
- Note that native store-library crashes (e.g. `EXC_BAD_ACCESS` in expo-iap/OpenIAP off the JS
|
|
12
|
+
thread) are a store-library-version concern; how to pin a version, inject a module, or fall back
|
|
13
|
+
to the fully-decoupled `@entitlehub/sdk` + your own billing library.
|
|
14
|
+
|
|
3
15
|
## 0.1.1 — 2026-07-18
|
|
4
16
|
|
|
5
17
|
### Fixed
|
package/README.md
CHANGED
|
@@ -57,6 +57,28 @@ customer info. Renewals/refunds stay current via
|
|
|
57
57
|
|
|
58
58
|
Full guide: **[entitlehub.com/docs/purchases](https://entitlehub.com/docs/purchases)**.
|
|
59
59
|
|
|
60
|
+
## Choosing / pinning the store library
|
|
61
|
+
|
|
62
|
+
The on-device purchase runs through **expo-iap** (OpenIAP). That native layer is the store
|
|
63
|
+
library's responsibility, not EntitleHub's — and a given version can have platform-specific native
|
|
64
|
+
bugs. If you hit a **native IAP crash** (e.g. an `EXC_BAD_ACCESS` in the store module), it's the
|
|
65
|
+
store library, not this SDK or your app code, and no JS change can catch a native exception thrown
|
|
66
|
+
off the JS thread.
|
|
67
|
+
|
|
68
|
+
Two levers, both without changing this SDK:
|
|
69
|
+
|
|
70
|
+
- **Pin a working version:** `npm install expo-iap@<version>` — this package uses whatever `expo-iap`
|
|
71
|
+
is installed (peer dependency).
|
|
72
|
+
- **Supply your own module:** pass any OpenIAP-compatible library to `configureEntitleHub`:
|
|
73
|
+
```ts
|
|
74
|
+
await configureEntitleHub({ apiKey, appUserId, iap: require("expo-iap") }); // or react-native-iap
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Fully decoupled fallback: skip this package and use **[`@entitlehub/sdk`](https://www.npmjs.com/package/@entitlehub/sdk)**
|
|
78
|
+
directly — open the purchase with *any* billing library you've verified on your target OS, then call
|
|
79
|
+
`eh.reportPurchase({ signedTransaction | purchaseToken })`. See
|
|
80
|
+
[Purchases → manual](https://entitlehub.com/docs/purchases).
|
|
81
|
+
|
|
60
82
|
> Requires a development build (Expo Go has no in-app-purchase native module). The entitlement layer
|
|
61
83
|
> is [`@entitlehub/sdk`](https://www.npmjs.com/package/@entitlehub/sdk); this package adds the
|
|
62
84
|
> purchase flow on top.
|
package/dist/index.cjs
CHANGED
|
@@ -48,6 +48,7 @@ function eh() {
|
|
|
48
48
|
return client;
|
|
49
49
|
}
|
|
50
50
|
async function configureEntitleHub(opts) {
|
|
51
|
+
if (opts.iap) _iap = opts.iap;
|
|
51
52
|
client = new import_sdk.EntitleHub({ apiKey: opts.apiKey, appUserId: opts.appUserId, baseUrl: opts.baseUrl });
|
|
52
53
|
try {
|
|
53
54
|
await iap().initConnection();
|
|
@@ -142,7 +143,7 @@ function addCustomerInfoUpdateListener(fn) {
|
|
|
142
143
|
return eh().addCustomerInfoUpdateListener(fn);
|
|
143
144
|
}
|
|
144
145
|
async function reportToEntitleHub(purchase, productId, isSubscription) {
|
|
145
|
-
const jws = purchase?.jwsRepresentation ?? purchase?.jwsRepresentationIos;
|
|
146
|
+
const jws = purchase?.jwsRepresentation ?? purchase?.jwsRepresentationIos ?? (String(purchase?.platform).toLowerCase() === "ios" ? purchase?.purchaseToken : void 0);
|
|
146
147
|
if (jws) return eh().reportPurchase({ signedTransaction: jws });
|
|
147
148
|
const token = purchase?.purchaseTokenAndroid ?? purchase?.purchaseToken;
|
|
148
149
|
if (token) {
|
package/dist/index.d.cts
CHANGED
|
@@ -8,6 +8,16 @@ interface ConfigureOptions {
|
|
|
8
8
|
appUserId: string;
|
|
9
9
|
/** Override the API base (self-host). */
|
|
10
10
|
baseUrl?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The in-app-purchase module to use. Must implement the OpenIAP API (`initConnection`,
|
|
13
|
+
* `fetchProducts`, `requestPurchase`, `purchaseUpdatedListener`, `purchaseErrorListener`,
|
|
14
|
+
* `finishTransaction`, `getAvailablePurchases`). Defaults to `expo-iap`.
|
|
15
|
+
*
|
|
16
|
+
* Pass your own if you need a specific version or a different OpenIAP-compatible library, e.g.
|
|
17
|
+
* `iap: require("expo-iap")` with a pinned version, or `react-native-iap`. Useful to work around
|
|
18
|
+
* a native issue in a particular store-library version without changing this SDK.
|
|
19
|
+
*/
|
|
20
|
+
iap?: unknown;
|
|
11
21
|
}
|
|
12
22
|
/** Configure EntitleHub and open the store connection. Call once at startup (after your own login). */
|
|
13
23
|
declare function configureEntitleHub(opts: ConfigureOptions): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,16 @@ interface ConfigureOptions {
|
|
|
8
8
|
appUserId: string;
|
|
9
9
|
/** Override the API base (self-host). */
|
|
10
10
|
baseUrl?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The in-app-purchase module to use. Must implement the OpenIAP API (`initConnection`,
|
|
13
|
+
* `fetchProducts`, `requestPurchase`, `purchaseUpdatedListener`, `purchaseErrorListener`,
|
|
14
|
+
* `finishTransaction`, `getAvailablePurchases`). Defaults to `expo-iap`.
|
|
15
|
+
*
|
|
16
|
+
* Pass your own if you need a specific version or a different OpenIAP-compatible library, e.g.
|
|
17
|
+
* `iap: require("expo-iap")` with a pinned version, or `react-native-iap`. Useful to work around
|
|
18
|
+
* a native issue in a particular store-library version without changing this SDK.
|
|
19
|
+
*/
|
|
20
|
+
iap?: unknown;
|
|
11
21
|
}
|
|
12
22
|
/** Configure EntitleHub and open the store connection. Call once at startup (after your own login). */
|
|
13
23
|
declare function configureEntitleHub(opts: ConfigureOptions): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ function eh() {
|
|
|
23
23
|
return client;
|
|
24
24
|
}
|
|
25
25
|
async function configureEntitleHub(opts) {
|
|
26
|
+
if (opts.iap) _iap = opts.iap;
|
|
26
27
|
client = new EntitleHub({ apiKey: opts.apiKey, appUserId: opts.appUserId, baseUrl: opts.baseUrl });
|
|
27
28
|
try {
|
|
28
29
|
await iap().initConnection();
|
|
@@ -117,7 +118,7 @@ function addCustomerInfoUpdateListener(fn) {
|
|
|
117
118
|
return eh().addCustomerInfoUpdateListener(fn);
|
|
118
119
|
}
|
|
119
120
|
async function reportToEntitleHub(purchase, productId, isSubscription) {
|
|
120
|
-
const jws = purchase?.jwsRepresentation ?? purchase?.jwsRepresentationIos;
|
|
121
|
+
const jws = purchase?.jwsRepresentation ?? purchase?.jwsRepresentationIos ?? (String(purchase?.platform).toLowerCase() === "ios" ? purchase?.purchaseToken : void 0);
|
|
121
122
|
if (jws) return eh().reportPurchase({ signedTransaction: jws });
|
|
122
123
|
const token = purchase?.purchaseTokenAndroid ?? purchase?.purchaseToken;
|
|
123
124
|
if (token) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entitlehub/react-native",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "EntitleHub for React Native & Expo
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "EntitleHub for React Native & Expo \u2014 one call to purchase and unlock entitlements. Wraps expo-iap for the native store sheet and validates receipts via EntitleHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"entitlehub",
|
|
7
7
|
"react-native",
|
|
@@ -14,10 +14,18 @@
|
|
|
14
14
|
"entitlements"
|
|
15
15
|
],
|
|
16
16
|
"homepage": "https://entitlehub.com/docs/purchases",
|
|
17
|
-
"repository": {
|
|
18
|
-
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/DanCue44/entitlehub-sdk.git",
|
|
20
|
+
"directory": "react-native"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/DanCue44/entitlehub-sdk/issues"
|
|
24
|
+
},
|
|
19
25
|
"license": "MIT",
|
|
20
|
-
"publishConfig": {
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
21
29
|
"type": "module",
|
|
22
30
|
"main": "./dist/index.cjs",
|
|
23
31
|
"module": "./dist/index.js",
|
|
@@ -29,14 +37,21 @@
|
|
|
29
37
|
"require": "./dist/index.cjs"
|
|
30
38
|
}
|
|
31
39
|
},
|
|
32
|
-
"files": [
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md",
|
|
43
|
+
"CHANGELOG.md",
|
|
44
|
+
"LICENSE"
|
|
45
|
+
],
|
|
33
46
|
"sideEffects": false,
|
|
34
47
|
"scripts": {
|
|
35
48
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
36
49
|
"typecheck": "tsc --noEmit",
|
|
37
50
|
"prepublishOnly": "npm run build"
|
|
38
51
|
},
|
|
39
|
-
"engines": {
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18"
|
|
54
|
+
},
|
|
40
55
|
"peerDependencies": {
|
|
41
56
|
"@entitlehub/sdk": ">=0.2.0",
|
|
42
57
|
"expo-iap": "*",
|
|
@@ -47,4 +62,4 @@
|
|
|
47
62
|
"tsup": "^8.0.0",
|
|
48
63
|
"typescript": "^5.9.3"
|
|
49
64
|
}
|
|
50
|
-
}
|
|
65
|
+
}
|