expo-iap 3.0.4 → 3.0.5
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/.eslintignore +1 -1
- package/.eslintrc.js +1 -0
- package/.prettierignore +1 -0
- package/CHANGELOG.md +6 -0
- package/CLAUDE.md +1 -1
- package/CONTRIBUTING.md +10 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +12 -12
- package/android/src/main/java/expo/modules/iap/PromiseUtils.kt +2 -2
- package/build/index.d.ts +28 -14
- package/build/index.d.ts.map +1 -1
- package/build/index.js +36 -15
- package/build/index.js.map +1 -1
- package/build/modules/android.d.ts +3 -4
- package/build/modules/android.d.ts.map +1 -1
- package/build/modules/android.js +2 -4
- package/build/modules/android.js.map +1 -1
- package/build/modules/ios.d.ts +2 -3
- package/build/modules/ios.d.ts.map +1 -1
- package/build/modules/ios.js +1 -3
- package/build/modules/ios.js.map +1 -1
- package/build/purchase-error.d.ts +8 -10
- package/build/purchase-error.d.ts.map +1 -1
- package/build/purchase-error.js +4 -2
- package/build/purchase-error.js.map +1 -1
- package/build/types.d.ts +159 -204
- package/build/types.d.ts.map +1 -1
- package/build/types.js +1 -59
- package/build/types.js.map +1 -1
- package/build/useIAP.d.ts +5 -8
- package/build/useIAP.d.ts.map +1 -1
- package/build/useIAP.js.map +1 -1
- package/ios/ExpoIap.podspec +1 -1
- package/ios/ExpoIapModule.swift +103 -89
- package/package.json +2 -1
- package/plugin/build/withIAP.js +4 -5
- package/plugin/src/withIAP.ts +4 -5
- package/scripts/update-types.mjs +61 -0
- package/src/index.ts +77 -29
- package/src/modules/android.ts +5 -7
- package/src/modules/ios.ts +3 -5
- package/src/purchase-error.ts +13 -16
- package/src/types.ts +183 -216
- package/src/useIAP.ts +10 -10
package/src/useIAP.ts
CHANGED
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
getActiveSubscriptions,
|
|
19
19
|
hasActiveSubscriptions,
|
|
20
20
|
type ActiveSubscription,
|
|
21
|
+
type ProductTypeInput,
|
|
22
|
+
type PurchaseRequestInput,
|
|
21
23
|
restorePurchases,
|
|
22
24
|
} from './index';
|
|
23
25
|
import {
|
|
@@ -30,10 +32,9 @@ import {
|
|
|
30
32
|
Product,
|
|
31
33
|
Purchase,
|
|
32
34
|
ProductSubscription,
|
|
33
|
-
RequestPurchaseProps,
|
|
34
|
-
RequestSubscriptionPropsByPlatforms,
|
|
35
35
|
ErrorCode,
|
|
36
36
|
VoidResult,
|
|
37
|
+
ReceiptValidationResult,
|
|
37
38
|
} from './types';
|
|
38
39
|
import {PurchaseError} from './purchase-error';
|
|
39
40
|
import {
|
|
@@ -69,13 +70,12 @@ type UseIap = {
|
|
|
69
70
|
getAvailablePurchases: () => Promise<void>;
|
|
70
71
|
fetchProducts: (params: {
|
|
71
72
|
skus: string[];
|
|
72
|
-
type?:
|
|
73
|
+
type?: ProductTypeInput;
|
|
73
74
|
}) => Promise<void>;
|
|
74
75
|
|
|
75
|
-
requestPurchase: (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}) => Promise<any>;
|
|
76
|
+
requestPurchase: (
|
|
77
|
+
params: PurchaseRequestInput,
|
|
78
|
+
) => ReturnType<typeof requestPurchaseInternal>;
|
|
79
79
|
validateReceipt: (
|
|
80
80
|
sku: string,
|
|
81
81
|
androidOptions?: {
|
|
@@ -84,7 +84,7 @@ type UseIap = {
|
|
|
84
84
|
accessToken: string;
|
|
85
85
|
isSub?: boolean;
|
|
86
86
|
},
|
|
87
|
-
) => Promise<
|
|
87
|
+
) => Promise<ReceiptValidationResult>;
|
|
88
88
|
restorePurchases: () => Promise<void>;
|
|
89
89
|
getPromotedProductIOS: () => Promise<Product | null>;
|
|
90
90
|
requestPurchaseOnPromotedProductIOS: () => Promise<void>;
|
|
@@ -194,7 +194,7 @@ export function useIAP(options?: UseIAPOptions): UseIap {
|
|
|
194
194
|
const fetchProductsInternal = useCallback(
|
|
195
195
|
async (params: {
|
|
196
196
|
skus: string[];
|
|
197
|
-
type?:
|
|
197
|
+
type?: ProductTypeInput;
|
|
198
198
|
}): Promise<void> => {
|
|
199
199
|
try {
|
|
200
200
|
const result = await fetchProducts(params);
|
|
@@ -293,7 +293,7 @@ export function useIAP(options?: UseIAPOptions): UseIap {
|
|
|
293
293
|
);
|
|
294
294
|
|
|
295
295
|
const requestPurchaseWithReset = useCallback(
|
|
296
|
-
async (requestObj:
|
|
296
|
+
async (requestObj: PurchaseRequestInput) => {
|
|
297
297
|
clearCurrentPurchase();
|
|
298
298
|
clearCurrentPurchaseError();
|
|
299
299
|
|