expo-iap 2.7.5-rc.1 → 2.7.6
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/.copilot-instructions.md +26 -8
- package/CHANGELOG.md +33 -2
- package/CONTRIBUTING.md +26 -3
- package/build/ExpoIap.types.d.ts.map +1 -1
- package/build/ExpoIap.types.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -4
- package/build/index.js.map +1 -1
- package/build/modules/android.d.ts.map +1 -1
- package/build/modules/android.js.map +1 -1
- package/build/modules/ios.d.ts.map +1 -1
- package/build/modules/ios.js.map +1 -1
- package/build/useIap.d.ts +6 -2
- package/build/useIap.d.ts.map +1 -1
- package/build/useIap.js +13 -8
- package/build/useIap.js.map +1 -1
- package/package.json +1 -1
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/ExpoIap.types.ts +17 -8
- package/src/index.ts +34 -36
- package/src/modules/android.ts +2 -4
- package/src/modules/ios.ts +87 -47
- package/src/useIap.ts +21 -15
package/src/ExpoIap.types.ts
CHANGED
|
@@ -365,7 +365,8 @@ export interface AndroidRequestPurchaseProps {
|
|
|
365
365
|
/**
|
|
366
366
|
* Android-specific subscription request parameters
|
|
367
367
|
*/
|
|
368
|
-
export interface AndroidRequestSubscriptionProps
|
|
368
|
+
export interface AndroidRequestSubscriptionProps
|
|
369
|
+
extends AndroidRequestPurchaseProps {
|
|
369
370
|
readonly purchaseTokenAndroid?: string;
|
|
370
371
|
readonly replacementModeAndroid?: number;
|
|
371
372
|
readonly subscriptionOffers: {
|
|
@@ -408,28 +409,36 @@ export type RequestSubscriptionProps = PlatformRequestSubscriptionProps;
|
|
|
408
409
|
* Includes both unified and old platform-specific formats
|
|
409
410
|
* @deprecated Use RequestPurchaseProps with platform-specific structure instead
|
|
410
411
|
*/
|
|
411
|
-
export type LegacyRequestPurchasePropsAll =
|
|
412
|
+
export type LegacyRequestPurchasePropsAll =
|
|
413
|
+
| UnifiedRequestPurchaseProps
|
|
414
|
+
| LegacyRequestPurchaseProps;
|
|
412
415
|
|
|
413
416
|
/**
|
|
414
417
|
* Legacy request subscription parameters (deprecated)
|
|
415
418
|
* Includes both unified and old platform-specific formats
|
|
416
419
|
* @deprecated Use RequestSubscriptionProps with platform-specific structure instead
|
|
417
420
|
*/
|
|
418
|
-
export type LegacyRequestSubscriptionPropsAll =
|
|
421
|
+
export type LegacyRequestSubscriptionPropsAll =
|
|
422
|
+
| UnifiedRequestSubscriptionProps
|
|
423
|
+
| LegacyRequestSubscriptionProps;
|
|
419
424
|
|
|
420
425
|
/**
|
|
421
426
|
* All supported request purchase parameters
|
|
422
427
|
* Used internally for backward compatibility
|
|
423
428
|
* @internal
|
|
424
429
|
*/
|
|
425
|
-
export type RequestPurchasePropsWithLegacy =
|
|
430
|
+
export type RequestPurchasePropsWithLegacy =
|
|
431
|
+
| RequestPurchaseProps
|
|
432
|
+
| LegacyRequestPurchasePropsAll;
|
|
426
433
|
|
|
427
434
|
/**
|
|
428
435
|
* All supported request subscription parameters
|
|
429
436
|
* Used internally for backward compatibility
|
|
430
437
|
* @internal
|
|
431
438
|
*/
|
|
432
|
-
export type RequestSubscriptionPropsWithLegacy =
|
|
439
|
+
export type RequestSubscriptionPropsWithLegacy =
|
|
440
|
+
| RequestSubscriptionProps
|
|
441
|
+
| LegacyRequestSubscriptionPropsAll;
|
|
433
442
|
|
|
434
443
|
// ============================================================================
|
|
435
444
|
// Type Guards and Utility Functions
|
|
@@ -437,19 +446,19 @@ export type RequestSubscriptionPropsWithLegacy = RequestSubscriptionProps | Lega
|
|
|
437
446
|
|
|
438
447
|
// Type guards to check which API style is being used
|
|
439
448
|
export function isPlatformRequestProps(
|
|
440
|
-
props: RequestPurchasePropsWithLegacy | RequestSubscriptionPropsWithLegacy
|
|
449
|
+
props: RequestPurchasePropsWithLegacy | RequestSubscriptionPropsWithLegacy,
|
|
441
450
|
): props is PlatformRequestPurchaseProps | PlatformRequestSubscriptionProps {
|
|
442
451
|
return 'ios' in props || 'android' in props;
|
|
443
452
|
}
|
|
444
453
|
|
|
445
454
|
export function isUnifiedRequestProps(
|
|
446
|
-
props: RequestPurchasePropsWithLegacy | RequestSubscriptionPropsWithLegacy
|
|
455
|
+
props: RequestPurchasePropsWithLegacy | RequestSubscriptionPropsWithLegacy,
|
|
447
456
|
): props is UnifiedRequestPurchaseProps | UnifiedRequestSubscriptionProps {
|
|
448
457
|
return 'sku' in props || 'skus' in props;
|
|
449
458
|
}
|
|
450
459
|
|
|
451
460
|
export function isLegacyRequestProps(
|
|
452
|
-
props: RequestPurchasePropsWithLegacy | RequestSubscriptionPropsWithLegacy
|
|
461
|
+
props: RequestPurchasePropsWithLegacy | RequestSubscriptionPropsWithLegacy,
|
|
453
462
|
): props is LegacyRequestPurchaseProps | LegacyRequestSubscriptionProps {
|
|
454
463
|
return 'productId' in props || 'productIds' in props;
|
|
455
464
|
}
|
package/src/index.ts
CHANGED
|
@@ -21,12 +21,8 @@ import {
|
|
|
21
21
|
isPlatformRequestProps,
|
|
22
22
|
isUnifiedRequestProps,
|
|
23
23
|
} from './ExpoIap.types';
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
} from './types/ExpoIapAndroid.types';
|
|
27
|
-
import {
|
|
28
|
-
PaymentDiscount,
|
|
29
|
-
} from './types/ExpoIapIos.types';
|
|
24
|
+
import {ProductPurchaseAndroid} from './types/ExpoIapAndroid.types';
|
|
25
|
+
import {PaymentDiscount} from './types/ExpoIapIos.types';
|
|
30
26
|
|
|
31
27
|
// Export all types
|
|
32
28
|
export * from './ExpoIap.types';
|
|
@@ -80,40 +76,43 @@ export const purchaseErrorListener = (
|
|
|
80
76
|
/**
|
|
81
77
|
* iOS-only listener for App Store promoted product events.
|
|
82
78
|
* This fires when a user taps on a promoted product in the App Store.
|
|
83
|
-
*
|
|
79
|
+
*
|
|
84
80
|
* @param listener - Callback function that receives the promoted product details
|
|
85
81
|
* @returns EventSubscription that can be used to unsubscribe
|
|
86
|
-
*
|
|
82
|
+
*
|
|
87
83
|
* @example
|
|
88
84
|
* ```typescript
|
|
89
85
|
* const subscription = promotedProductListenerIOS((product) => {
|
|
90
86
|
* console.log('Promoted product:', product);
|
|
91
87
|
* // Handle the promoted product
|
|
92
88
|
* });
|
|
93
|
-
*
|
|
89
|
+
*
|
|
94
90
|
* // Later, clean up
|
|
95
91
|
* subscription.remove();
|
|
96
92
|
* ```
|
|
97
|
-
*
|
|
93
|
+
*
|
|
98
94
|
* @platform iOS
|
|
99
95
|
*/
|
|
100
96
|
export const promotedProductListenerIOS = (
|
|
101
97
|
listener: (product: Product) => void,
|
|
102
98
|
) => {
|
|
103
99
|
if (Platform.OS !== 'ios') {
|
|
104
|
-
console.warn(
|
|
105
|
-
|
|
100
|
+
console.warn(
|
|
101
|
+
'promotedProductListenerIOS: This listener is only available on iOS',
|
|
102
|
+
);
|
|
103
|
+
return {remove: () => {}};
|
|
106
104
|
}
|
|
107
105
|
return emitter.addListener(IapEvent.PromotedProductIOS, listener);
|
|
108
106
|
};
|
|
109
107
|
|
|
110
|
-
export function initConnection() {
|
|
111
|
-
|
|
108
|
+
export function initConnection(): Promise<boolean> {
|
|
109
|
+
const result = ExpoIapModule.initConnection();
|
|
110
|
+
return Promise.resolve(result);
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
export const getProducts = async (skus: string[]): Promise<Product[]> => {
|
|
115
114
|
console.warn(
|
|
116
|
-
|
|
115
|
+
"`getProducts` is deprecated. Use `requestProducts({ skus, type: 'inapp' })` instead. This function will be removed in version 3.0.0.",
|
|
117
116
|
);
|
|
118
117
|
if (!skus?.length) {
|
|
119
118
|
return Promise.reject(new Error('"skus" is required'));
|
|
@@ -147,7 +146,7 @@ export const getSubscriptions = async (
|
|
|
147
146
|
skus: string[],
|
|
148
147
|
): Promise<SubscriptionProduct[]> => {
|
|
149
148
|
console.warn(
|
|
150
|
-
|
|
149
|
+
"`getSubscriptions` is deprecated. Use `requestProducts({ skus, type: 'subs' })` instead. This function will be removed in version 3.0.0.",
|
|
151
150
|
);
|
|
152
151
|
if (!skus?.length) {
|
|
153
152
|
return Promise.reject(new Error('"skus" is required'));
|
|
@@ -271,7 +270,7 @@ export const getPurchaseHistory = ({
|
|
|
271
270
|
onlyIncludeActiveItems?: boolean;
|
|
272
271
|
} = {}): Promise<ProductPurchase[]> => {
|
|
273
272
|
console.warn(
|
|
274
|
-
|
|
273
|
+
'`getPurchaseHistory` is deprecated. Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.',
|
|
275
274
|
);
|
|
276
275
|
return getPurchaseHistories({
|
|
277
276
|
alsoPublishToEventListener,
|
|
@@ -321,9 +320,8 @@ export const getAvailablePurchases = ({
|
|
|
321
320
|
),
|
|
322
321
|
android: async () => {
|
|
323
322
|
const products = await ExpoIapModule.getAvailableItemsByType('inapp');
|
|
324
|
-
const subscriptions =
|
|
325
|
-
'subs'
|
|
326
|
-
);
|
|
323
|
+
const subscriptions =
|
|
324
|
+
await ExpoIapModule.getAvailableItemsByType('subs');
|
|
327
325
|
return products.concat(subscriptions);
|
|
328
326
|
},
|
|
329
327
|
}) || (() => Promise.resolve([]))
|
|
@@ -342,7 +340,6 @@ const offerToRecordIos = (
|
|
|
342
340
|
};
|
|
343
341
|
};
|
|
344
342
|
|
|
345
|
-
|
|
346
343
|
// Define discriminated union with explicit type parameter
|
|
347
344
|
// Using legacy types internally for backward compatibility
|
|
348
345
|
type PurchaseRequest =
|
|
@@ -372,7 +369,8 @@ const normalizeRequestProps = (
|
|
|
372
369
|
if (platform === 'ios') {
|
|
373
370
|
return {
|
|
374
371
|
sku: request.sku || (request.skus?.[0] ?? ''),
|
|
375
|
-
andDangerouslyFinishTransactionAutomaticallyIOS:
|
|
372
|
+
andDangerouslyFinishTransactionAutomaticallyIOS:
|
|
373
|
+
request.andDangerouslyFinishTransactionAutomaticallyIOS,
|
|
376
374
|
appAccountToken: request.appAccountToken,
|
|
377
375
|
quantity: request.quantity,
|
|
378
376
|
withOffer: request.withOffer,
|
|
@@ -384,7 +382,7 @@ const normalizeRequestProps = (
|
|
|
384
382
|
obfuscatedProfileIdAndroid: request.obfuscatedProfileIdAndroid,
|
|
385
383
|
isOfferPersonalized: request.isOfferPersonalized,
|
|
386
384
|
};
|
|
387
|
-
|
|
385
|
+
|
|
388
386
|
// Add subscription-specific fields if present
|
|
389
387
|
if ('subscriptionOffers' in request && request.subscriptionOffers) {
|
|
390
388
|
androidRequest.subscriptionOffers = request.subscriptionOffers;
|
|
@@ -395,7 +393,7 @@ const normalizeRequestProps = (
|
|
|
395
393
|
if ('replacementModeAndroid' in request) {
|
|
396
394
|
androidRequest.replacementModeAndroid = request.replacementModeAndroid;
|
|
397
395
|
}
|
|
398
|
-
|
|
396
|
+
|
|
399
397
|
return androidRequest;
|
|
400
398
|
}
|
|
401
399
|
}
|
|
@@ -406,11 +404,11 @@ const normalizeRequestProps = (
|
|
|
406
404
|
|
|
407
405
|
/**
|
|
408
406
|
* Request a purchase for products or subscriptions.
|
|
409
|
-
*
|
|
407
|
+
*
|
|
410
408
|
* @param requestObj - Purchase request configuration
|
|
411
409
|
* @param requestObj.request - Platform-specific purchase parameters
|
|
412
410
|
* @param requestObj.type - Type of purchase: 'inapp' for products (default) or 'subs' for subscriptions
|
|
413
|
-
*
|
|
411
|
+
*
|
|
414
412
|
* @example
|
|
415
413
|
* ```typescript
|
|
416
414
|
* // Product purchase
|
|
@@ -421,12 +419,12 @@ const normalizeRequestProps = (
|
|
|
421
419
|
* },
|
|
422
420
|
* type: 'inapp'
|
|
423
421
|
* });
|
|
424
|
-
*
|
|
422
|
+
*
|
|
425
423
|
* // Subscription purchase
|
|
426
424
|
* await requestPurchase({
|
|
427
425
|
* request: {
|
|
428
426
|
* ios: { sku: subscriptionId },
|
|
429
|
-
* android: {
|
|
427
|
+
* android: {
|
|
430
428
|
* skus: [subscriptionId],
|
|
431
429
|
* subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]
|
|
432
430
|
* }
|
|
@@ -448,7 +446,7 @@ export const requestPurchase = (
|
|
|
448
446
|
|
|
449
447
|
if (Platform.OS === 'ios') {
|
|
450
448
|
const normalizedRequest = normalizeRequestProps(request, 'ios');
|
|
451
|
-
|
|
449
|
+
|
|
452
450
|
if (!normalizedRequest?.sku) {
|
|
453
451
|
throw new Error(
|
|
454
452
|
'Invalid request for iOS. The `sku` property is required and must be a string.',
|
|
@@ -481,7 +479,7 @@ export const requestPurchase = (
|
|
|
481
479
|
|
|
482
480
|
if (Platform.OS === 'android') {
|
|
483
481
|
const normalizedRequest = normalizeRequestProps(request, 'android');
|
|
484
|
-
|
|
482
|
+
|
|
485
483
|
if (!normalizedRequest?.skus?.length) {
|
|
486
484
|
throw new Error(
|
|
487
485
|
'Invalid request for Android. The `skus` property is required and must be a non-empty array.',
|
|
@@ -545,7 +543,7 @@ export const requestPurchase = (
|
|
|
545
543
|
|
|
546
544
|
/**
|
|
547
545
|
* @deprecated Use `requestPurchase({ request, type: 'subs' })` instead. This method will be removed in version 3.0.0.
|
|
548
|
-
*
|
|
546
|
+
*
|
|
549
547
|
* @example
|
|
550
548
|
* ```typescript
|
|
551
549
|
* // Old way (deprecated)
|
|
@@ -554,12 +552,12 @@ export const requestPurchase = (
|
|
|
554
552
|
* // or for Android
|
|
555
553
|
* skus: [subscriptionId],
|
|
556
554
|
* });
|
|
557
|
-
*
|
|
555
|
+
*
|
|
558
556
|
* // New way (recommended)
|
|
559
557
|
* await requestPurchase({
|
|
560
558
|
* request: {
|
|
561
559
|
* ios: { sku: subscriptionId },
|
|
562
|
-
* android: {
|
|
560
|
+
* android: {
|
|
563
561
|
* skus: [subscriptionId],
|
|
564
562
|
* subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]
|
|
565
563
|
* }
|
|
@@ -624,16 +622,16 @@ export const finishTransaction = ({
|
|
|
624
622
|
|
|
625
623
|
/**
|
|
626
624
|
* Retrieves the current storefront information from iOS App Store
|
|
627
|
-
*
|
|
625
|
+
*
|
|
628
626
|
* @returns Promise resolving to the storefront country code
|
|
629
627
|
* @throws Error if called on non-iOS platform
|
|
630
|
-
*
|
|
628
|
+
*
|
|
631
629
|
* @example
|
|
632
630
|
* ```typescript
|
|
633
631
|
* const storefront = await getStorefrontIOS();
|
|
634
632
|
* console.log(storefront); // 'US'
|
|
635
633
|
* ```
|
|
636
|
-
*
|
|
634
|
+
*
|
|
637
635
|
* @platform iOS
|
|
638
636
|
*/
|
|
639
637
|
export const getStorefrontIOS = (): Promise<string> => {
|
package/src/modules/android.ts
CHANGED
|
@@ -102,11 +102,9 @@ export const acknowledgePurchaseAndroid = ({
|
|
|
102
102
|
* Open the Google Play Store to redeem offer codes (Android only).
|
|
103
103
|
* Note: Google Play does not provide a direct API to redeem codes within the app.
|
|
104
104
|
* This function opens the Play Store where users can manually enter their codes.
|
|
105
|
-
*
|
|
105
|
+
*
|
|
106
106
|
* @returns {Promise<void>}
|
|
107
107
|
*/
|
|
108
108
|
export const openRedeemOfferCodeAndroid = async (): Promise<void> => {
|
|
109
|
-
return Linking.openURL(
|
|
110
|
-
`https://play.google.com/redeem?code=`
|
|
111
|
-
);
|
|
109
|
+
return Linking.openURL(`https://play.google.com/redeem?code=`);
|
|
112
110
|
};
|
package/src/modules/ios.ts
CHANGED
|
@@ -11,7 +11,10 @@ import {
|
|
|
11
11
|
Purchase,
|
|
12
12
|
SubscriptionPurchase,
|
|
13
13
|
} from '../ExpoIap.types';
|
|
14
|
-
import type {
|
|
14
|
+
import type {
|
|
15
|
+
ProductStatusIos,
|
|
16
|
+
AppTransactionIOS,
|
|
17
|
+
} from '../types/ExpoIapIos.types';
|
|
15
18
|
|
|
16
19
|
export type TransactionEvent = {
|
|
17
20
|
transaction?: ProductPurchase;
|
|
@@ -35,7 +38,6 @@ export type TransactionEvent = {
|
|
|
35
38
|
export const transactionUpdatedIos = (
|
|
36
39
|
listener: (event: TransactionEvent) => void,
|
|
37
40
|
) => {
|
|
38
|
-
|
|
39
41
|
const isProductPurchase = (item: unknown): item is ProductPurchase => {
|
|
40
42
|
return (
|
|
41
43
|
item != null &&
|
|
@@ -86,10 +88,10 @@ export function isProductIos<T extends {platform?: string}>(
|
|
|
86
88
|
/**
|
|
87
89
|
* Sync state with Appstore (iOS only)
|
|
88
90
|
* https://developer.apple.com/documentation/storekit/appstore/3791906-sync
|
|
89
|
-
*
|
|
91
|
+
*
|
|
90
92
|
* @returns Promise resolving to null on success
|
|
91
93
|
* @throws Error if called on non-iOS platform
|
|
92
|
-
*
|
|
94
|
+
*
|
|
93
95
|
* @platform iOS
|
|
94
96
|
*/
|
|
95
97
|
export const syncIOS = (): Promise<null> => {
|
|
@@ -98,50 +100,56 @@ export const syncIOS = (): Promise<null> => {
|
|
|
98
100
|
|
|
99
101
|
/**
|
|
100
102
|
* Check if user is eligible for introductory offer
|
|
101
|
-
*
|
|
103
|
+
*
|
|
102
104
|
* @param groupID The subscription group ID
|
|
103
105
|
* @returns Promise resolving to true if eligible
|
|
104
106
|
* @throws Error if called on non-iOS platform
|
|
105
|
-
*
|
|
107
|
+
*
|
|
106
108
|
* @platform iOS
|
|
107
109
|
*/
|
|
108
|
-
export const isEligibleForIntroOfferIOS = (
|
|
110
|
+
export const isEligibleForIntroOfferIOS = (
|
|
111
|
+
groupID: string,
|
|
112
|
+
): Promise<boolean> => {
|
|
109
113
|
return ExpoIapModule.isEligibleForIntroOffer(groupID);
|
|
110
114
|
};
|
|
111
115
|
|
|
112
116
|
/**
|
|
113
117
|
* Get subscription status for a specific SKU
|
|
114
|
-
*
|
|
118
|
+
*
|
|
115
119
|
* @param sku The product SKU
|
|
116
120
|
* @returns Promise resolving to array of subscription status
|
|
117
121
|
* @throws Error if called on non-iOS platform
|
|
118
|
-
*
|
|
122
|
+
*
|
|
119
123
|
* @platform iOS
|
|
120
124
|
*/
|
|
121
|
-
export const subscriptionStatusIOS = (
|
|
125
|
+
export const subscriptionStatusIOS = (
|
|
126
|
+
sku: string,
|
|
127
|
+
): Promise<ProductStatusIos[]> => {
|
|
122
128
|
return ExpoIapModule.subscriptionStatus(sku);
|
|
123
129
|
};
|
|
124
130
|
|
|
125
131
|
/**
|
|
126
132
|
* Get current entitlement for a specific SKU
|
|
127
|
-
*
|
|
133
|
+
*
|
|
128
134
|
* @param sku The product SKU
|
|
129
135
|
* @returns Promise resolving to current entitlement
|
|
130
136
|
* @throws Error if called on non-iOS platform
|
|
131
|
-
*
|
|
137
|
+
*
|
|
132
138
|
* @platform iOS
|
|
133
139
|
*/
|
|
134
|
-
export const currentEntitlementIOS = (
|
|
140
|
+
export const currentEntitlementIOS = (
|
|
141
|
+
sku: string,
|
|
142
|
+
): Promise<ProductPurchase> => {
|
|
135
143
|
return ExpoIapModule.currentEntitlement(sku);
|
|
136
144
|
};
|
|
137
145
|
|
|
138
146
|
/**
|
|
139
147
|
* Get latest transaction for a specific SKU
|
|
140
|
-
*
|
|
148
|
+
*
|
|
141
149
|
* @param sku The product SKU
|
|
142
150
|
* @returns Promise resolving to latest transaction
|
|
143
151
|
* @throws Error if called on non-iOS platform
|
|
144
|
-
*
|
|
152
|
+
*
|
|
145
153
|
* @platform iOS
|
|
146
154
|
*/
|
|
147
155
|
export const latestTransactionIOS = (sku: string): Promise<ProductPurchase> => {
|
|
@@ -150,15 +158,17 @@ export const latestTransactionIOS = (sku: string): Promise<ProductPurchase> => {
|
|
|
150
158
|
|
|
151
159
|
/**
|
|
152
160
|
* Begin refund request for a specific SKU
|
|
153
|
-
*
|
|
161
|
+
*
|
|
154
162
|
* @param sku The product SKU
|
|
155
163
|
* @returns Promise resolving to refund request status
|
|
156
164
|
* @throws Error if called on non-iOS platform
|
|
157
|
-
*
|
|
165
|
+
*
|
|
158
166
|
* @platform iOS
|
|
159
167
|
*/
|
|
160
168
|
type RefundRequestStatus = 'success' | 'userCancelled';
|
|
161
|
-
export const beginRefundRequestIOS = (
|
|
169
|
+
export const beginRefundRequestIOS = (
|
|
170
|
+
sku: string,
|
|
171
|
+
): Promise<RefundRequestStatus> => {
|
|
162
172
|
return ExpoIapModule.beginRefundRequest(sku);
|
|
163
173
|
};
|
|
164
174
|
|
|
@@ -166,10 +176,10 @@ export const beginRefundRequestIOS = (sku: string): Promise<RefundRequestStatus>
|
|
|
166
176
|
* Shows the system UI for managing subscriptions.
|
|
167
177
|
* When the user changes subscription renewal status, the system will emit events to
|
|
168
178
|
* purchaseUpdatedListener and transactionUpdatedIos listeners.
|
|
169
|
-
*
|
|
179
|
+
*
|
|
170
180
|
* @returns Promise resolving to null on success
|
|
171
181
|
* @throws Error if called on non-iOS platform
|
|
172
|
-
*
|
|
182
|
+
*
|
|
173
183
|
* @platform iOS
|
|
174
184
|
*/
|
|
175
185
|
export const showManageSubscriptionsIOS = (): Promise<null> => {
|
|
@@ -197,7 +207,7 @@ export const getReceiptIOS = (): Promise<string> => {
|
|
|
197
207
|
* @param sku The product's SKU (on iOS)
|
|
198
208
|
* @returns Promise resolving to true if the transaction is verified
|
|
199
209
|
* @throws Error if called on non-iOS platform
|
|
200
|
-
*
|
|
210
|
+
*
|
|
201
211
|
* @platform iOS
|
|
202
212
|
*/
|
|
203
213
|
export const isTransactionVerifiedIOS = (sku: string): Promise<boolean> => {
|
|
@@ -211,7 +221,7 @@ export const isTransactionVerifiedIOS = (sku: string): Promise<boolean> => {
|
|
|
211
221
|
* @param sku The product's SKU (on iOS)
|
|
212
222
|
* @returns Promise resolving to JWS representation of the transaction
|
|
213
223
|
* @throws Error if called on non-iOS platform
|
|
214
|
-
*
|
|
224
|
+
*
|
|
215
225
|
* @platform iOS
|
|
216
226
|
*/
|
|
217
227
|
export const getTransactionJwsIOS = (sku: string): Promise<string> => {
|
|
@@ -248,12 +258,12 @@ export const validateReceiptIOS = async (
|
|
|
248
258
|
/**
|
|
249
259
|
* Present the code redemption sheet for offer codes (iOS only).
|
|
250
260
|
* This allows users to redeem promotional codes for in-app purchases and subscriptions.
|
|
251
|
-
*
|
|
261
|
+
*
|
|
252
262
|
* Note: This only works on real devices, not simulators.
|
|
253
|
-
*
|
|
263
|
+
*
|
|
254
264
|
* @returns Promise resolving to true if the sheet was presented successfully
|
|
255
265
|
* @throws Error if called on non-iOS platform or tvOS
|
|
256
|
-
*
|
|
266
|
+
*
|
|
257
267
|
* @platform iOS
|
|
258
268
|
*/
|
|
259
269
|
export const presentCodeRedemptionSheetIOS = (): Promise<boolean> => {
|
|
@@ -263,14 +273,14 @@ export const presentCodeRedemptionSheetIOS = (): Promise<boolean> => {
|
|
|
263
273
|
/**
|
|
264
274
|
* Get app transaction information (iOS 16.0+).
|
|
265
275
|
* AppTransaction represents the initial purchase that unlocked the app.
|
|
266
|
-
*
|
|
276
|
+
*
|
|
267
277
|
* NOTE: This function requires:
|
|
268
278
|
* - iOS 16.0 or later at runtime
|
|
269
279
|
* - Xcode 15.0+ with iOS 16.0 SDK for compilation
|
|
270
|
-
*
|
|
280
|
+
*
|
|
271
281
|
* @returns Promise resolving to the app transaction information or null if not available
|
|
272
282
|
* @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK
|
|
273
|
-
*
|
|
283
|
+
*
|
|
274
284
|
* @platform iOS
|
|
275
285
|
* @since iOS 16.0
|
|
276
286
|
*/
|
|
@@ -281,10 +291,10 @@ export const getAppTransactionIOS = (): Promise<AppTransactionIOS | null> => {
|
|
|
281
291
|
/**
|
|
282
292
|
* Get the promoted product details (iOS only).
|
|
283
293
|
* This is called after a promoted product event is received from the App Store.
|
|
284
|
-
*
|
|
294
|
+
*
|
|
285
295
|
* @returns Promise resolving to the promoted product details or null if none available
|
|
286
296
|
* @throws Error if called on non-iOS platform
|
|
287
|
-
*
|
|
297
|
+
*
|
|
288
298
|
* @platform iOS
|
|
289
299
|
*/
|
|
290
300
|
export const getPromotedProductIOS = (): Promise<any | null> => {
|
|
@@ -294,10 +304,10 @@ export const getPromotedProductIOS = (): Promise<any | null> => {
|
|
|
294
304
|
/**
|
|
295
305
|
* Complete the purchase of a promoted product (iOS only).
|
|
296
306
|
* This should be called after showing your purchase UI for a promoted product.
|
|
297
|
-
*
|
|
307
|
+
*
|
|
298
308
|
* @returns Promise resolving when the purchase is initiated
|
|
299
309
|
* @throws Error if called on non-iOS platform or no promoted product is available
|
|
300
|
-
*
|
|
310
|
+
*
|
|
301
311
|
* @platform iOS
|
|
302
312
|
*/
|
|
303
313
|
export const buyPromotedProductIOS = (): Promise<void> => {
|
|
@@ -311,7 +321,9 @@ export const buyPromotedProductIOS = (): Promise<void> => {
|
|
|
311
321
|
* @deprecated Use `syncIOS` instead. This function will be removed in version 3.0.0.
|
|
312
322
|
*/
|
|
313
323
|
export const sync = (): Promise<null> => {
|
|
314
|
-
console.warn(
|
|
324
|
+
console.warn(
|
|
325
|
+
'`sync` is deprecated. Use `syncIOS` instead. This function will be removed in version 3.0.0.',
|
|
326
|
+
);
|
|
315
327
|
return syncIOS();
|
|
316
328
|
};
|
|
317
329
|
|
|
@@ -319,15 +331,21 @@ export const sync = (): Promise<null> => {
|
|
|
319
331
|
* @deprecated Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.
|
|
320
332
|
*/
|
|
321
333
|
export const isEligibleForIntroOffer = (groupID: string): Promise<boolean> => {
|
|
322
|
-
console.warn(
|
|
334
|
+
console.warn(
|
|
335
|
+
'`isEligibleForIntroOffer` is deprecated. Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.',
|
|
336
|
+
);
|
|
323
337
|
return isEligibleForIntroOfferIOS(groupID);
|
|
324
338
|
};
|
|
325
339
|
|
|
326
340
|
/**
|
|
327
341
|
* @deprecated Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.
|
|
328
342
|
*/
|
|
329
|
-
export const subscriptionStatus = (
|
|
330
|
-
|
|
343
|
+
export const subscriptionStatus = (
|
|
344
|
+
sku: string,
|
|
345
|
+
): Promise<ProductStatusIos[]> => {
|
|
346
|
+
console.warn(
|
|
347
|
+
'`subscriptionStatus` is deprecated. Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.',
|
|
348
|
+
);
|
|
331
349
|
return subscriptionStatusIOS(sku);
|
|
332
350
|
};
|
|
333
351
|
|
|
@@ -335,7 +353,9 @@ export const subscriptionStatus = (sku: string): Promise<ProductStatusIos[]> =>
|
|
|
335
353
|
* @deprecated Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.
|
|
336
354
|
*/
|
|
337
355
|
export const currentEntitlement = (sku: string): Promise<ProductPurchase> => {
|
|
338
|
-
console.warn(
|
|
356
|
+
console.warn(
|
|
357
|
+
'`currentEntitlement` is deprecated. Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.',
|
|
358
|
+
);
|
|
339
359
|
return currentEntitlementIOS(sku);
|
|
340
360
|
};
|
|
341
361
|
|
|
@@ -343,15 +363,21 @@ export const currentEntitlement = (sku: string): Promise<ProductPurchase> => {
|
|
|
343
363
|
* @deprecated Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.
|
|
344
364
|
*/
|
|
345
365
|
export const latestTransaction = (sku: string): Promise<ProductPurchase> => {
|
|
346
|
-
console.warn(
|
|
366
|
+
console.warn(
|
|
367
|
+
'`latestTransaction` is deprecated. Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.',
|
|
368
|
+
);
|
|
347
369
|
return latestTransactionIOS(sku);
|
|
348
370
|
};
|
|
349
371
|
|
|
350
372
|
/**
|
|
351
373
|
* @deprecated Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.
|
|
352
374
|
*/
|
|
353
|
-
export const beginRefundRequest = (
|
|
354
|
-
|
|
375
|
+
export const beginRefundRequest = (
|
|
376
|
+
sku: string,
|
|
377
|
+
): Promise<RefundRequestStatus> => {
|
|
378
|
+
console.warn(
|
|
379
|
+
'`beginRefundRequest` is deprecated. Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.',
|
|
380
|
+
);
|
|
355
381
|
return beginRefundRequestIOS(sku);
|
|
356
382
|
};
|
|
357
383
|
|
|
@@ -359,7 +385,9 @@ export const beginRefundRequest = (sku: string): Promise<RefundRequestStatus> =>
|
|
|
359
385
|
* @deprecated Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.
|
|
360
386
|
*/
|
|
361
387
|
export const showManageSubscriptions = (): Promise<null> => {
|
|
362
|
-
console.warn(
|
|
388
|
+
console.warn(
|
|
389
|
+
'`showManageSubscriptions` is deprecated. Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.',
|
|
390
|
+
);
|
|
363
391
|
return showManageSubscriptionsIOS();
|
|
364
392
|
};
|
|
365
393
|
|
|
@@ -367,7 +395,9 @@ export const showManageSubscriptions = (): Promise<null> => {
|
|
|
367
395
|
* @deprecated Use `getReceiptIOS` instead. This function will be removed in version 3.0.0.
|
|
368
396
|
*/
|
|
369
397
|
export const getReceiptIos = (): Promise<string> => {
|
|
370
|
-
console.warn(
|
|
398
|
+
console.warn(
|
|
399
|
+
'`getReceiptIos` is deprecated. Use `getReceiptIOS` instead. This function will be removed in version 3.0.0.',
|
|
400
|
+
);
|
|
371
401
|
return getReceiptIOS();
|
|
372
402
|
};
|
|
373
403
|
|
|
@@ -375,7 +405,9 @@ export const getReceiptIos = (): Promise<string> => {
|
|
|
375
405
|
* @deprecated Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.
|
|
376
406
|
*/
|
|
377
407
|
export const isTransactionVerified = (sku: string): Promise<boolean> => {
|
|
378
|
-
console.warn(
|
|
408
|
+
console.warn(
|
|
409
|
+
'`isTransactionVerified` is deprecated. Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.',
|
|
410
|
+
);
|
|
379
411
|
return isTransactionVerifiedIOS(sku);
|
|
380
412
|
};
|
|
381
413
|
|
|
@@ -383,7 +415,9 @@ export const isTransactionVerified = (sku: string): Promise<boolean> => {
|
|
|
383
415
|
* @deprecated Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.
|
|
384
416
|
*/
|
|
385
417
|
export const getTransactionJws = (sku: string): Promise<string> => {
|
|
386
|
-
console.warn(
|
|
418
|
+
console.warn(
|
|
419
|
+
'`getTransactionJws` is deprecated. Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.',
|
|
420
|
+
);
|
|
387
421
|
return getTransactionJwsIOS(sku);
|
|
388
422
|
};
|
|
389
423
|
|
|
@@ -398,7 +432,9 @@ export const validateReceiptIos = async (
|
|
|
398
432
|
jwsRepresentation: string;
|
|
399
433
|
latestTransaction?: ProductPurchase;
|
|
400
434
|
}> => {
|
|
401
|
-
console.warn(
|
|
435
|
+
console.warn(
|
|
436
|
+
'`validateReceiptIos` is deprecated. Use `validateReceiptIOS` instead. This function will be removed in version 3.0.0.',
|
|
437
|
+
);
|
|
402
438
|
return validateReceiptIOS(sku);
|
|
403
439
|
};
|
|
404
440
|
|
|
@@ -406,7 +442,9 @@ export const validateReceiptIos = async (
|
|
|
406
442
|
* @deprecated Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.
|
|
407
443
|
*/
|
|
408
444
|
export const presentCodeRedemptionSheet = (): Promise<boolean> => {
|
|
409
|
-
console.warn(
|
|
445
|
+
console.warn(
|
|
446
|
+
'`presentCodeRedemptionSheet` is deprecated. Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.',
|
|
447
|
+
);
|
|
410
448
|
return presentCodeRedemptionSheetIOS();
|
|
411
449
|
};
|
|
412
450
|
|
|
@@ -414,6 +452,8 @@ export const presentCodeRedemptionSheet = (): Promise<boolean> => {
|
|
|
414
452
|
* @deprecated Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.
|
|
415
453
|
*/
|
|
416
454
|
export const getAppTransaction = (): Promise<AppTransactionIOS | null> => {
|
|
417
|
-
console.warn(
|
|
455
|
+
console.warn(
|
|
456
|
+
'`getAppTransaction` is deprecated. Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.',
|
|
457
|
+
);
|
|
418
458
|
return getAppTransactionIOS();
|
|
419
459
|
};
|