expo-iap 2.3.2 → 2.3.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/build/useIap.d.ts +8 -2
- package/build/useIap.d.ts.map +1 -1
- package/build/useIap.js +38 -5
- package/build/useIap.js.map +1 -1
- package/package.json +1 -1
- package/src/useIap.ts +57 -5
package/build/useIap.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { requestPurchase as requestPurchaseInternal } from './';
|
|
2
|
-
import { Product, ProductPurchase, Purchase, PurchaseError, PurchaseResult, SubscriptionProduct } from './ExpoIap.types';
|
|
2
|
+
import { Product, ProductPurchase, Purchase, PurchaseError, PurchaseResult, SubscriptionProduct, SubscriptionPurchase } from './ExpoIap.types';
|
|
3
3
|
type UseIap = {
|
|
4
4
|
connected: boolean;
|
|
5
5
|
products: Product[];
|
|
@@ -9,6 +9,8 @@ type UseIap = {
|
|
|
9
9
|
availablePurchases: ProductPurchase[];
|
|
10
10
|
currentPurchase?: ProductPurchase;
|
|
11
11
|
currentPurchaseError?: PurchaseError;
|
|
12
|
+
clearCurrentPurchase: () => void;
|
|
13
|
+
clearCurrentPurchaseError: () => void;
|
|
12
14
|
finishTransaction: ({ purchase, isConsumable, }: {
|
|
13
15
|
purchase: Purchase;
|
|
14
16
|
isConsumable?: boolean;
|
|
@@ -19,6 +21,10 @@ type UseIap = {
|
|
|
19
21
|
getSubscriptions: (skus: string[]) => Promise<void>;
|
|
20
22
|
requestPurchase: typeof requestPurchaseInternal;
|
|
21
23
|
};
|
|
22
|
-
export
|
|
24
|
+
export interface UseIAPOptions {
|
|
25
|
+
onPurchaseSuccess?: (purchase: ProductPurchase | SubscriptionPurchase) => void;
|
|
26
|
+
onPurchaseError?: (error: PurchaseError) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function useIAP(options?: UseIAPOptions): UseIap;
|
|
23
29
|
export {};
|
|
24
30
|
//# sourceMappingURL=useIap.d.ts.map
|
package/build/useIap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIap.d.ts","sourceRoot":"","sources":["../src/useIap.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,eAAe,IAAI,uBAAuB,EAC3C,MAAM,IAAI,CAAC;AAEZ,OAAO,EACL,OAAO,EACP,eAAe,EACf,QAAQ,EACR,aAAa,EACb,cAAc,EACd,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useIap.d.ts","sourceRoot":"","sources":["../src/useIap.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,eAAe,IAAI,uBAAuB,EAC3C,MAAM,IAAI,CAAC;AAEZ,OAAO,EACL,OAAO,EACP,eAAe,EACf,QAAQ,EACR,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAKzB,KAAK,MAAM,GAAG;IACZ,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,mBAAmB,EAAE,eAAe,EAAE,CAAC;IACvC,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,iBAAiB,EAAE,eAAe,EAAE,CAAC;IACrC,kBAAkB,EAAE,eAAe,EAAE,CAAC;IACtC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oBAAoB,CAAC,EAAE,aAAa,CAAC;IACrC,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,yBAAyB,EAAE,MAAM,IAAI,CAAC;IACtC,iBAAiB,EAAE,CAAC,EAClB,QAAQ,EACR,YAAY,GACb,EAAE;QACD,QAAQ,EAAE,QAAQ,CAAC;QACnB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,KAAK,OAAO,CAAC,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,IAAI,CAAC,CAAC;IACxD,qBAAqB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,eAAe,EAAE,OAAO,uBAAuB,CAAC;CACjD,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,iBAAiB,CAAC,EAAE,CAClB,QAAQ,EAAE,eAAe,GAAG,oBAAoB,KAC7C,IAAI,CAAC;IACV,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CAClD;AAED,wBAAgB,MAAM,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAiLtD"}
|
package/build/useIap.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { endConnection, initConnection, purchaseErrorListener, purchaseUpdatedListener, transactionUpdatedIos, getProducts, getAvailablePurchases, getPurchaseHistory, finishTransaction as finishTransactionInternal, getSubscriptions, requestPurchase as requestPurchaseInternal, } from './';
|
|
2
2
|
import { useCallback, useEffect, useState, useRef } from 'react';
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
|
-
export function useIAP() {
|
|
4
|
+
export function useIAP(options) {
|
|
5
5
|
const [connected, setConnected] = useState(false);
|
|
6
6
|
const [products, setProducts] = useState([]);
|
|
7
7
|
const [promotedProductsIOS, setPromotedProductsIOS] = useState([]);
|
|
@@ -10,7 +10,17 @@ export function useIAP() {
|
|
|
10
10
|
const [availablePurchases, setAvailablePurchases] = useState([]);
|
|
11
11
|
const [currentPurchase, setCurrentPurchase] = useState();
|
|
12
12
|
const [currentPurchaseError, setCurrentPurchaseError] = useState();
|
|
13
|
+
const optionsRef = useRef(options);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
optionsRef.current = options;
|
|
16
|
+
}, [options]);
|
|
13
17
|
const subscriptionsRef = useRef({});
|
|
18
|
+
const clearCurrentPurchase = useCallback(() => {
|
|
19
|
+
setCurrentPurchase(undefined);
|
|
20
|
+
}, []);
|
|
21
|
+
const clearCurrentPurchaseError = useCallback(() => {
|
|
22
|
+
setCurrentPurchaseError(undefined);
|
|
23
|
+
}, []);
|
|
14
24
|
const getProductsInternal = useCallback(async (skus) => {
|
|
15
25
|
setProducts(await getProducts(skus));
|
|
16
26
|
}, []);
|
|
@@ -35,13 +45,28 @@ export function useIAP() {
|
|
|
35
45
|
}
|
|
36
46
|
finally {
|
|
37
47
|
if (purchase.id === currentPurchase?.id) {
|
|
38
|
-
|
|
48
|
+
clearCurrentPurchase();
|
|
39
49
|
}
|
|
40
50
|
if (purchase.id === currentPurchaseError?.productId) {
|
|
41
|
-
|
|
51
|
+
clearCurrentPurchaseError();
|
|
42
52
|
}
|
|
43
53
|
}
|
|
44
|
-
}, [
|
|
54
|
+
}, [
|
|
55
|
+
currentPurchase?.id,
|
|
56
|
+
currentPurchaseError?.productId,
|
|
57
|
+
clearCurrentPurchase,
|
|
58
|
+
clearCurrentPurchaseError,
|
|
59
|
+
]);
|
|
60
|
+
const requestPurchaseWithReset = useCallback(async (requestObj) => {
|
|
61
|
+
clearCurrentPurchase();
|
|
62
|
+
clearCurrentPurchaseError();
|
|
63
|
+
try {
|
|
64
|
+
return await requestPurchaseInternal(requestObj);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}, [clearCurrentPurchase, clearCurrentPurchaseError]);
|
|
45
70
|
const initIapWithSubscriptions = useCallback(async () => {
|
|
46
71
|
const result = await initConnection();
|
|
47
72
|
setConnected(result);
|
|
@@ -49,10 +74,16 @@ export function useIAP() {
|
|
|
49
74
|
subscriptionsRef.current.purchaseUpdate = purchaseUpdatedListener(async (purchase) => {
|
|
50
75
|
setCurrentPurchaseError(undefined);
|
|
51
76
|
setCurrentPurchase(purchase);
|
|
77
|
+
if (optionsRef.current?.onPurchaseSuccess) {
|
|
78
|
+
optionsRef.current.onPurchaseSuccess(purchase);
|
|
79
|
+
}
|
|
52
80
|
});
|
|
53
81
|
subscriptionsRef.current.purchaseError = purchaseErrorListener((error) => {
|
|
54
82
|
setCurrentPurchase(undefined);
|
|
55
83
|
setCurrentPurchaseError(error);
|
|
84
|
+
if (optionsRef.current?.onPurchaseError) {
|
|
85
|
+
optionsRef.current.onPurchaseError(error);
|
|
86
|
+
}
|
|
56
87
|
});
|
|
57
88
|
if (Platform.OS === 'ios') {
|
|
58
89
|
subscriptionsRef.current.promotedProductsIos = transactionUpdatedIos((event) => {
|
|
@@ -84,11 +115,13 @@ export function useIAP() {
|
|
|
84
115
|
availablePurchases,
|
|
85
116
|
currentPurchase,
|
|
86
117
|
currentPurchaseError,
|
|
118
|
+
clearCurrentPurchase,
|
|
119
|
+
clearCurrentPurchaseError,
|
|
87
120
|
getAvailablePurchases: getAvailablePurchasesInternal,
|
|
88
121
|
getPurchaseHistories: getPurchaseHistoriesInternal,
|
|
89
122
|
getProducts: getProductsInternal,
|
|
90
123
|
getSubscriptions: getSubscriptionsInternal,
|
|
91
|
-
requestPurchase:
|
|
124
|
+
requestPurchase: requestPurchaseWithReset,
|
|
92
125
|
};
|
|
93
126
|
}
|
|
94
127
|
//# sourceMappingURL=useIap.js.map
|
package/build/useIap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIap.js","sourceRoot":"","sources":["../src/useIap.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,IAAI,yBAAyB,EAC9C,gBAAgB,EAChB,eAAe,IAAI,uBAAuB,GAC3C,MAAM,IAAI,CAAC;AACZ,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE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AAuB;KACzC,CAAC;AACJ,CAAC","sourcesContent":["import {\n endConnection,\n initConnection,\n purchaseErrorListener,\n purchaseUpdatedListener,\n transactionUpdatedIos,\n getProducts,\n getAvailablePurchases,\n getPurchaseHistory,\n finishTransaction as finishTransactionInternal,\n getSubscriptions,\n requestPurchase as requestPurchaseInternal,\n} from './';\nimport {useCallback, useEffect, useState, useRef} from 'react';\nimport {\n Product,\n ProductPurchase,\n Purchase,\n PurchaseError,\n PurchaseResult,\n SubscriptionProduct,\n SubscriptionPurchase,\n} from './ExpoIap.types';\nimport {TransactionEvent} from './modules/ios';\nimport {Subscription} from 'expo-modules-core';\nimport {Platform} from 'react-native';\n\ntype UseIap = {\n connected: boolean;\n products: Product[];\n promotedProductsIOS: ProductPurchase[];\n subscriptions: SubscriptionProduct[];\n purchaseHistories: ProductPurchase[];\n availablePurchases: ProductPurchase[];\n currentPurchase?: ProductPurchase;\n currentPurchaseError?: PurchaseError;\n finishTransaction: ({\n purchase,\n isConsumable,\n }: {\n purchase: Purchase;\n isConsumable?: boolean;\n }) => Promise<string | boolean | PurchaseResult | void>;\n getAvailablePurchases: (skus: string[]) => Promise<void>;\n getPurchaseHistories: (skus: string[]) => Promise<void>;\n getProducts: (skus: string[]) => Promise<void>;\n getSubscriptions: (skus: string[]) => Promise<void>;\n requestPurchase: typeof requestPurchaseInternal;\n};\n\nexport function useIAP(): UseIap {\n const [connected, setConnected] = useState<boolean>(false);\n const [products, setProducts] = useState<Product[]>([]);\n const [promotedProductsIOS, setPromotedProductsIOS] = useState<\n ProductPurchase[]\n >([]);\n const [subscriptions, setSubscriptions] = useState<SubscriptionProduct[]>([]);\n const [purchaseHistories, setPurchaseHistories] = useState<ProductPurchase[]>(\n [],\n );\n const [availablePurchases, setAvailablePurchases] = useState<\n ProductPurchase[]\n >([]);\n const [currentPurchase, setCurrentPurchase] = useState<ProductPurchase>();\n const [currentPurchaseError, setCurrentPurchaseError] =\n useState<PurchaseError>();\n\n const subscriptionsRef = useRef<{\n purchaseUpdate?: Subscription;\n purchaseError?: Subscription;\n promotedProductsIos?: Subscription;\n }>({});\n\n const getProductsInternal = useCallback(\n async (skus: string[]): Promise<void> => {\n setProducts(await getProducts(skus));\n },\n [],\n );\n\n const getSubscriptionsInternal = useCallback(\n async (skus: string[]): Promise<void> => {\n setSubscriptions(await getSubscriptions(skus));\n },\n [],\n );\n\n const getAvailablePurchasesInternal = useCallback(async (): Promise<void> => {\n setAvailablePurchases(await getAvailablePurchases());\n }, []);\n\n const getPurchaseHistoriesInternal = useCallback(async (): Promise<void> => {\n setPurchaseHistories(await getPurchaseHistory());\n }, []);\n\n const finishTransaction = useCallback(\n async ({\n purchase,\n isConsumable,\n }: {\n purchase: ProductPurchase;\n isConsumable?: boolean;\n }): Promise<string | boolean | PurchaseResult | void> => {\n try {\n return await finishTransactionInternal({\n purchase,\n isConsumable,\n });\n } catch (err) {\n throw err;\n } finally {\n if (purchase.id === currentPurchase?.id) {\n setCurrentPurchase(undefined);\n }\n if (purchase.id === currentPurchaseError?.productId) {\n setCurrentPurchaseError(undefined);\n }\n }\n },\n [currentPurchase?.id, currentPurchaseError?.productId],\n );\n\n const initIapWithSubscriptions = useCallback(async (): Promise<void> => {\n const result = await initConnection();\n setConnected(result);\n\n if (result) {\n subscriptionsRef.current.purchaseUpdate = purchaseUpdatedListener(\n async (purchase: Purchase | SubscriptionPurchase) => {\n setCurrentPurchaseError(undefined);\n setCurrentPurchase(purchase);\n },\n );\n\n subscriptionsRef.current.purchaseError = purchaseErrorListener(\n (error: PurchaseError) => {\n setCurrentPurchase(undefined);\n setCurrentPurchaseError(error);\n },\n );\n\n if (Platform.OS === 'ios') {\n subscriptionsRef.current.promotedProductsIos = transactionUpdatedIos(\n (event: TransactionEvent) => {\n setPromotedProductsIOS((prevProducts) =>\n event.transaction\n ? [...prevProducts, event.transaction]\n : prevProducts,\n );\n },\n );\n }\n }\n }, []);\n\n useEffect(() => {\n initIapWithSubscriptions();\n const currentSubscriptions = subscriptionsRef.current;\n\n return () => {\n currentSubscriptions.purchaseUpdate?.remove();\n currentSubscriptions.purchaseError?.remove();\n currentSubscriptions.promotedProductsIos?.remove();\n endConnection();\n setConnected(false);\n };\n }, [initIapWithSubscriptions]);\n\n return {\n connected,\n products,\n promotedProductsIOS,\n subscriptions,\n purchaseHistories,\n finishTransaction,\n availablePurchases,\n currentPurchase,\n currentPurchaseError,\n getAvailablePurchases: getAvailablePurchasesInternal,\n getPurchaseHistories: getPurchaseHistoriesInternal,\n getProducts: getProductsInternal,\n getSubscriptions: getSubscriptionsInternal,\n requestPurchase: requestPurchaseInternal,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useIap.js","sourceRoot":"","sources":["../src/useIap.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,IAAI,yBAAyB,EAC9C,gBAAgB,EAChB,eAAe,IAAI,uBAAuB,GAC3C,MAAM,IAAI,CAAC;AACZ,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAY/D,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAkCtC,MAAM,UAAU,MAAM,CAAC,OAAuB;IAC5C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAY,EAAE,CAAC,CAAC;IACxD,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,QAAQ,CAE5D,EAAE,CAAC,CAAC;IACN,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAwB,EAAE,CAAC,CAAC;IAC9E,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,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cAAc,EAAE,MAAM,EAAE,CAAC;YAC9C,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;YAC7C,oBAAoB,CAAC,mBAAmB,EAAE,MAAM,EAAE,CAAC;YACnD,aAAa,EAAE,CAAC;YAChB,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAE/B,OAAO;QACL,SAAS;QACT,QAAQ;QACR,mBAAmB;QACnB,aAAa;QACb,iBAAiB;QACjB,iBAAiB;QACjB,kBAAkB;QAClB,eAAe;QACf,oBAAoB;QACpB,oBAAoB;QACpB,yBAAyB;QACzB,qBAAqB,EAAE,6BAA6B;QACpD,oBAAoB,EAAE,4BAA4B;QAClD,WAAW,EAAE,mBAAmB;QAChC,gBAAgB,EAAE,wBAAwB;QAC1C,eAAe,EAAE,wBAAwB;KAC1C,CAAC;AACJ,CAAC","sourcesContent":["import {\n endConnection,\n initConnection,\n purchaseErrorListener,\n purchaseUpdatedListener,\n transactionUpdatedIos,\n getProducts,\n getAvailablePurchases,\n getPurchaseHistory,\n finishTransaction as finishTransactionInternal,\n getSubscriptions,\n requestPurchase as requestPurchaseInternal,\n} from './';\nimport {useCallback, useEffect, useState, useRef} from 'react';\nimport {\n Product,\n ProductPurchase,\n Purchase,\n PurchaseError,\n PurchaseResult,\n SubscriptionProduct,\n SubscriptionPurchase,\n} from './ExpoIap.types';\nimport {TransactionEvent} from './modules/ios';\nimport {Subscription} from 'expo-modules-core';\nimport {Platform} from 'react-native';\n\ntype UseIap = {\n connected: boolean;\n products: Product[];\n promotedProductsIOS: ProductPurchase[];\n subscriptions: SubscriptionProduct[];\n purchaseHistories: ProductPurchase[];\n availablePurchases: ProductPurchase[];\n currentPurchase?: ProductPurchase;\n currentPurchaseError?: PurchaseError;\n clearCurrentPurchase: () => void;\n clearCurrentPurchaseError: () => void;\n finishTransaction: ({\n purchase,\n isConsumable,\n }: {\n purchase: Purchase;\n isConsumable?: boolean;\n }) => Promise<string | boolean | PurchaseResult | void>;\n getAvailablePurchases: (skus: string[]) => Promise<void>;\n getPurchaseHistories: (skus: string[]) => Promise<void>;\n getProducts: (skus: string[]) => Promise<void>;\n getSubscriptions: (skus: string[]) => Promise<void>;\n requestPurchase: typeof requestPurchaseInternal;\n};\n\nexport interface UseIAPOptions {\n onPurchaseSuccess?: (\n purchase: ProductPurchase | SubscriptionPurchase,\n ) => void;\n onPurchaseError?: (error: PurchaseError) => void;\n}\n\nexport function useIAP(options?: UseIAPOptions): UseIap {\n const [connected, setConnected] = useState<boolean>(false);\n const [products, setProducts] = useState<Product[]>([]);\n const [promotedProductsIOS, setPromotedProductsIOS] = useState<\n ProductPurchase[]\n >([]);\n const [subscriptions, setSubscriptions] = useState<SubscriptionProduct[]>([]);\n const [purchaseHistories, setPurchaseHistories] = useState<ProductPurchase[]>(\n [],\n );\n const [availablePurchases, setAvailablePurchases] = useState<\n ProductPurchase[]\n >([]);\n const [currentPurchase, setCurrentPurchase] = useState<ProductPurchase>();\n const [currentPurchaseError, setCurrentPurchaseError] =\n useState<PurchaseError>();\n\n const optionsRef = useRef<UseIAPOptions | undefined>(options);\n\n useEffect(() => {\n optionsRef.current = options;\n }, [options]);\n\n const subscriptionsRef = useRef<{\n purchaseUpdate?: Subscription;\n purchaseError?: Subscription;\n promotedProductsIos?: Subscription;\n }>({});\n\n const clearCurrentPurchase = useCallback(() => {\n setCurrentPurchase(undefined);\n }, []);\n\n const clearCurrentPurchaseError = useCallback(() => {\n setCurrentPurchaseError(undefined);\n }, []);\n\n const getProductsInternal = useCallback(\n async (skus: string[]): Promise<void> => {\n setProducts(await getProducts(skus));\n },\n [],\n );\n\n const getSubscriptionsInternal = useCallback(\n async (skus: string[]): Promise<void> => {\n setSubscriptions(await getSubscriptions(skus));\n },\n [],\n );\n\n const getAvailablePurchasesInternal = useCallback(async (): Promise<void> => {\n setAvailablePurchases(await getAvailablePurchases());\n }, []);\n\n const getPurchaseHistoriesInternal = useCallback(async (): Promise<void> => {\n setPurchaseHistories(await getPurchaseHistory());\n }, []);\n\n const finishTransaction = useCallback(\n async ({\n purchase,\n isConsumable,\n }: {\n purchase: ProductPurchase;\n isConsumable?: boolean;\n }): Promise<string | boolean | PurchaseResult | void> => {\n try {\n return await finishTransactionInternal({\n purchase,\n isConsumable,\n });\n } catch (err) {\n throw err;\n } finally {\n if (purchase.id === currentPurchase?.id) {\n clearCurrentPurchase();\n }\n if (purchase.id === currentPurchaseError?.productId) {\n clearCurrentPurchaseError();\n }\n }\n },\n [\n currentPurchase?.id,\n currentPurchaseError?.productId,\n clearCurrentPurchase,\n clearCurrentPurchaseError,\n ],\n );\n\n const requestPurchaseWithReset = useCallback(\n async (requestObj: Parameters<typeof requestPurchaseInternal>[0]) => {\n clearCurrentPurchase();\n clearCurrentPurchaseError();\n\n try {\n return await requestPurchaseInternal(requestObj);\n } catch (error) {\n throw error;\n }\n },\n [clearCurrentPurchase, clearCurrentPurchaseError],\n );\n\n const initIapWithSubscriptions = useCallback(async (): Promise<void> => {\n const result = await initConnection();\n setConnected(result);\n\n if (result) {\n subscriptionsRef.current.purchaseUpdate = purchaseUpdatedListener(\n async (purchase: Purchase | SubscriptionPurchase) => {\n setCurrentPurchaseError(undefined);\n setCurrentPurchase(purchase);\n\n if (optionsRef.current?.onPurchaseSuccess) {\n optionsRef.current.onPurchaseSuccess(purchase);\n }\n },\n );\n\n subscriptionsRef.current.purchaseError = purchaseErrorListener(\n (error: PurchaseError) => {\n setCurrentPurchase(undefined);\n setCurrentPurchaseError(error);\n\n if (optionsRef.current?.onPurchaseError) {\n optionsRef.current.onPurchaseError(error);\n }\n },\n );\n\n if (Platform.OS === 'ios') {\n subscriptionsRef.current.promotedProductsIos = transactionUpdatedIos(\n (event: TransactionEvent) => {\n setPromotedProductsIOS((prevProducts) =>\n event.transaction\n ? [...prevProducts, event.transaction]\n : prevProducts,\n );\n },\n );\n }\n }\n }, []);\n\n useEffect(() => {\n initIapWithSubscriptions();\n const currentSubscriptions = subscriptionsRef.current;\n\n return () => {\n currentSubscriptions.purchaseUpdate?.remove();\n currentSubscriptions.purchaseError?.remove();\n currentSubscriptions.promotedProductsIos?.remove();\n endConnection();\n setConnected(false);\n };\n }, [initIapWithSubscriptions]);\n\n return {\n connected,\n products,\n promotedProductsIOS,\n subscriptions,\n purchaseHistories,\n finishTransaction,\n availablePurchases,\n currentPurchase,\n currentPurchaseError,\n clearCurrentPurchase,\n clearCurrentPurchaseError,\n getAvailablePurchases: getAvailablePurchasesInternal,\n getPurchaseHistories: getPurchaseHistoriesInternal,\n getProducts: getProductsInternal,\n getSubscriptions: getSubscriptionsInternal,\n requestPurchase: requestPurchaseWithReset,\n };\n}\n"]}
|
package/package.json
CHANGED
package/src/useIap.ts
CHANGED
|
@@ -34,6 +34,8 @@ type UseIap = {
|
|
|
34
34
|
availablePurchases: ProductPurchase[];
|
|
35
35
|
currentPurchase?: ProductPurchase;
|
|
36
36
|
currentPurchaseError?: PurchaseError;
|
|
37
|
+
clearCurrentPurchase: () => void;
|
|
38
|
+
clearCurrentPurchaseError: () => void;
|
|
37
39
|
finishTransaction: ({
|
|
38
40
|
purchase,
|
|
39
41
|
isConsumable,
|
|
@@ -48,7 +50,14 @@ type UseIap = {
|
|
|
48
50
|
requestPurchase: typeof requestPurchaseInternal;
|
|
49
51
|
};
|
|
50
52
|
|
|
51
|
-
export
|
|
53
|
+
export interface UseIAPOptions {
|
|
54
|
+
onPurchaseSuccess?: (
|
|
55
|
+
purchase: ProductPurchase | SubscriptionPurchase,
|
|
56
|
+
) => void;
|
|
57
|
+
onPurchaseError?: (error: PurchaseError) => void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function useIAP(options?: UseIAPOptions): UseIap {
|
|
52
61
|
const [connected, setConnected] = useState<boolean>(false);
|
|
53
62
|
const [products, setProducts] = useState<Product[]>([]);
|
|
54
63
|
const [promotedProductsIOS, setPromotedProductsIOS] = useState<
|
|
@@ -65,12 +74,26 @@ export function useIAP(): UseIap {
|
|
|
65
74
|
const [currentPurchaseError, setCurrentPurchaseError] =
|
|
66
75
|
useState<PurchaseError>();
|
|
67
76
|
|
|
77
|
+
const optionsRef = useRef<UseIAPOptions | undefined>(options);
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
optionsRef.current = options;
|
|
81
|
+
}, [options]);
|
|
82
|
+
|
|
68
83
|
const subscriptionsRef = useRef<{
|
|
69
84
|
purchaseUpdate?: Subscription;
|
|
70
85
|
purchaseError?: Subscription;
|
|
71
86
|
promotedProductsIos?: Subscription;
|
|
72
87
|
}>({});
|
|
73
88
|
|
|
89
|
+
const clearCurrentPurchase = useCallback(() => {
|
|
90
|
+
setCurrentPurchase(undefined);
|
|
91
|
+
}, []);
|
|
92
|
+
|
|
93
|
+
const clearCurrentPurchaseError = useCallback(() => {
|
|
94
|
+
setCurrentPurchaseError(undefined);
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
74
97
|
const getProductsInternal = useCallback(
|
|
75
98
|
async (skus: string[]): Promise<void> => {
|
|
76
99
|
setProducts(await getProducts(skus));
|
|
@@ -110,14 +133,33 @@ export function useIAP(): UseIap {
|
|
|
110
133
|
throw err;
|
|
111
134
|
} finally {
|
|
112
135
|
if (purchase.id === currentPurchase?.id) {
|
|
113
|
-
|
|
136
|
+
clearCurrentPurchase();
|
|
114
137
|
}
|
|
115
138
|
if (purchase.id === currentPurchaseError?.productId) {
|
|
116
|
-
|
|
139
|
+
clearCurrentPurchaseError();
|
|
117
140
|
}
|
|
118
141
|
}
|
|
119
142
|
},
|
|
120
|
-
[
|
|
143
|
+
[
|
|
144
|
+
currentPurchase?.id,
|
|
145
|
+
currentPurchaseError?.productId,
|
|
146
|
+
clearCurrentPurchase,
|
|
147
|
+
clearCurrentPurchaseError,
|
|
148
|
+
],
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
const requestPurchaseWithReset = useCallback(
|
|
152
|
+
async (requestObj: Parameters<typeof requestPurchaseInternal>[0]) => {
|
|
153
|
+
clearCurrentPurchase();
|
|
154
|
+
clearCurrentPurchaseError();
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
return await requestPurchaseInternal(requestObj);
|
|
158
|
+
} catch (error) {
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
[clearCurrentPurchase, clearCurrentPurchaseError],
|
|
121
163
|
);
|
|
122
164
|
|
|
123
165
|
const initIapWithSubscriptions = useCallback(async (): Promise<void> => {
|
|
@@ -129,6 +171,10 @@ export function useIAP(): UseIap {
|
|
|
129
171
|
async (purchase: Purchase | SubscriptionPurchase) => {
|
|
130
172
|
setCurrentPurchaseError(undefined);
|
|
131
173
|
setCurrentPurchase(purchase);
|
|
174
|
+
|
|
175
|
+
if (optionsRef.current?.onPurchaseSuccess) {
|
|
176
|
+
optionsRef.current.onPurchaseSuccess(purchase);
|
|
177
|
+
}
|
|
132
178
|
},
|
|
133
179
|
);
|
|
134
180
|
|
|
@@ -136,6 +182,10 @@ export function useIAP(): UseIap {
|
|
|
136
182
|
(error: PurchaseError) => {
|
|
137
183
|
setCurrentPurchase(undefined);
|
|
138
184
|
setCurrentPurchaseError(error);
|
|
185
|
+
|
|
186
|
+
if (optionsRef.current?.onPurchaseError) {
|
|
187
|
+
optionsRef.current.onPurchaseError(error);
|
|
188
|
+
}
|
|
139
189
|
},
|
|
140
190
|
);
|
|
141
191
|
|
|
@@ -176,10 +226,12 @@ export function useIAP(): UseIap {
|
|
|
176
226
|
availablePurchases,
|
|
177
227
|
currentPurchase,
|
|
178
228
|
currentPurchaseError,
|
|
229
|
+
clearCurrentPurchase,
|
|
230
|
+
clearCurrentPurchaseError,
|
|
179
231
|
getAvailablePurchases: getAvailablePurchasesInternal,
|
|
180
232
|
getPurchaseHistories: getPurchaseHistoriesInternal,
|
|
181
233
|
getProducts: getProductsInternal,
|
|
182
234
|
getSubscriptions: getSubscriptionsInternal,
|
|
183
|
-
requestPurchase:
|
|
235
|
+
requestPurchase: requestPurchaseWithReset,
|
|
184
236
|
};
|
|
185
237
|
}
|