expo-iap 2.7.7-rc.1 → 2.7.8

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/src/useIap.ts CHANGED
@@ -15,9 +15,13 @@ import {
15
15
  finishTransaction as finishTransactionInternal,
16
16
  requestPurchase as requestPurchaseInternal,
17
17
  requestProducts,
18
+ validateReceipt as validateReceiptInternal,
18
19
  } from './';
19
- import {syncIOS, validateReceiptIOS, getPromotedProductIOS, buyPromotedProductIOS} from './modules/ios';
20
- import {validateReceiptAndroid} from './modules/android';
20
+ import {
21
+ syncIOS,
22
+ getPromotedProductIOS,
23
+ buyPromotedProductIOS,
24
+ } from './modules/ios';
21
25
 
22
26
  // Types
23
27
  import {
@@ -58,9 +62,15 @@ type UseIap = {
58
62
  skus: string[];
59
63
  type?: 'inapp' | 'subs';
60
64
  }) => Promise<void>;
61
- /** @deprecated Use requestProducts({ skus, type: 'inapp' }) instead. This method will be removed in version 3.0.0. */
65
+ /**
66
+ * @deprecated Use requestProducts({ skus, type: 'inapp' }) instead. This method will be removed in version 3.0.0.
67
+ * Note: This method internally uses requestProducts, so no deprecation warning is shown.
68
+ */
62
69
  getProducts: (skus: string[]) => Promise<void>;
63
- /** @deprecated Use requestProducts({ skus, type: 'subs' }) instead. This method will be removed in version 3.0.0. */
70
+ /**
71
+ * @deprecated Use requestProducts({ skus, type: 'subs' }) instead. This method will be removed in version 3.0.0.
72
+ * Note: This method internally uses requestProducts, so no deprecation warning is shown.
73
+ */
64
74
  getSubscriptions: (skus: string[]) => Promise<void>;
65
75
  requestPurchase: (params: {
66
76
  request: RequestPurchaseProps | RequestSubscriptionProps;
@@ -93,9 +103,7 @@ export interface UseIAPOptions {
93
103
  export function useIAP(options?: UseIAPOptions): UseIap {
94
104
  const [connected, setConnected] = useState<boolean>(false);
95
105
  const [products, setProducts] = useState<Product[]>([]);
96
- const [promotedProductsIOS] = useState<
97
- ProductPurchase[]
98
- >([]);
106
+ const [promotedProductsIOS] = useState<ProductPurchase[]>([]);
99
107
  const [subscriptions, setSubscriptions] = useState<SubscriptionProduct[]>([]);
100
108
  const [purchaseHistories, setPurchaseHistories] = useState<ProductPurchase[]>(
101
109
  [],
@@ -324,29 +332,7 @@ export function useIAP(options?: UseIAPOptions): UseIap {
324
332
  isSub?: boolean;
325
333
  },
326
334
  ) => {
327
- if (Platform.OS === 'ios') {
328
- return await validateReceiptIOS(sku);
329
- } else if (Platform.OS === 'android') {
330
- if (
331
- !androidOptions ||
332
- !androidOptions.packageName ||
333
- !androidOptions.productToken ||
334
- !androidOptions.accessToken
335
- ) {
336
- throw new Error(
337
- 'Android validation requires packageName, productToken, and accessToken',
338
- );
339
- }
340
- return await validateReceiptAndroid({
341
- packageName: androidOptions.packageName,
342
- productId: sku,
343
- productToken: androidOptions.productToken,
344
- accessToken: androidOptions.accessToken,
345
- isSub: androidOptions.isSub,
346
- });
347
- } else {
348
- throw new Error('Platform not supported');
349
- }
335
+ return validateReceiptInternal(sku, androidOptions);
350
336
  },
351
337
  [],
352
338
  );
@@ -387,14 +373,14 @@ export function useIAP(options?: UseIAPOptions): UseIap {
387
373
  subscriptionsRef.current.promotedProductsIos =
388
374
  promotedProductListenerIOS((product: Product) => {
389
375
  setPromotedProductIOS(product);
390
-
376
+
391
377
  if (optionsRef.current?.onPromotedProductIOS) {
392
378
  optionsRef.current.onPromotedProductIOS(product);
393
379
  }
394
380
  });
395
381
  }
396
382
  }
397
- }, [refreshSubscriptionStatus, mergeWithDuplicateCheck]);
383
+ }, [refreshSubscriptionStatus]);
398
384
 
399
385
  useEffect(() => {
400
386
  initIapWithSubscriptions();
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "self:">
6
- </FileRef>
7
- </Workspace>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>