@entitlehub/react-native 0.1.3 → 0.1.4
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/dist/index.cjs +2 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -73,6 +73,7 @@ async function getProducts(productIds, type = "all") {
|
|
|
73
73
|
async function purchaseProduct(productId, opts = {}) {
|
|
74
74
|
const I = iap();
|
|
75
75
|
const isSub = Boolean(opts.isSubscription);
|
|
76
|
+
const isConsumable = Boolean(opts.isConsumable) && !isSub;
|
|
76
77
|
const request = { apple: { sku: productId }, google: { skus: [productId] } };
|
|
77
78
|
if (isSub) {
|
|
78
79
|
try {
|
|
@@ -104,7 +105,7 @@ async function purchaseProduct(productId, opts = {}) {
|
|
|
104
105
|
try {
|
|
105
106
|
const info = await reportToEntitleHub(purchase, productId, isSub);
|
|
106
107
|
try {
|
|
107
|
-
await I.finishTransaction({ purchase, isConsumable
|
|
108
|
+
await I.finishTransaction({ purchase, isConsumable });
|
|
108
109
|
} catch {
|
|
109
110
|
}
|
|
110
111
|
resolve(info);
|
package/dist/index.d.cts
CHANGED
|
@@ -41,6 +41,7 @@ declare function getProducts(productIds: string[], type?: "in-app" | "subs" | "a
|
|
|
41
41
|
*/
|
|
42
42
|
declare function purchaseProduct(productId: string, opts?: {
|
|
43
43
|
isSubscription?: boolean;
|
|
44
|
+
isConsumable?: boolean;
|
|
44
45
|
}): Promise<CustomerInfo>;
|
|
45
46
|
/** Restore the user's purchases: re-validate each with EntitleHub, then return entitlements. */
|
|
46
47
|
declare function restorePurchases(): Promise<CustomerInfo>;
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ declare function getProducts(productIds: string[], type?: "in-app" | "subs" | "a
|
|
|
41
41
|
*/
|
|
42
42
|
declare function purchaseProduct(productId: string, opts?: {
|
|
43
43
|
isSubscription?: boolean;
|
|
44
|
+
isConsumable?: boolean;
|
|
44
45
|
}): Promise<CustomerInfo>;
|
|
45
46
|
/** Restore the user's purchases: re-validate each with EntitleHub, then return entitlements. */
|
|
46
47
|
declare function restorePurchases(): Promise<CustomerInfo>;
|
package/dist/index.js
CHANGED
|
@@ -48,6 +48,7 @@ async function getProducts(productIds, type = "all") {
|
|
|
48
48
|
async function purchaseProduct(productId, opts = {}) {
|
|
49
49
|
const I = iap();
|
|
50
50
|
const isSub = Boolean(opts.isSubscription);
|
|
51
|
+
const isConsumable = Boolean(opts.isConsumable) && !isSub;
|
|
51
52
|
const request = { apple: { sku: productId }, google: { skus: [productId] } };
|
|
52
53
|
if (isSub) {
|
|
53
54
|
try {
|
|
@@ -79,7 +80,7 @@ async function purchaseProduct(productId, opts = {}) {
|
|
|
79
80
|
try {
|
|
80
81
|
const info = await reportToEntitleHub(purchase, productId, isSub);
|
|
81
82
|
try {
|
|
82
|
-
await I.finishTransaction({ purchase, isConsumable
|
|
83
|
+
await I.finishTransaction({ purchase, isConsumable });
|
|
83
84
|
} catch {
|
|
84
85
|
}
|
|
85
86
|
resolve(info);
|
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.4",
|
|
4
|
+
"description": "EntitleHub for React Native & Expo — 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",
|
|
@@ -62,4 +62,4 @@
|
|
|
62
62
|
"tsup": "^8.0.0",
|
|
63
63
|
"typescript": "^5.9.3"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|