expo-iap 2.7.6 → 2.7.7-rc.1
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 +8 -26
- package/.markdownlint.json +11 -0
- package/CHANGELOG.md +56 -34
- package/CONTRIBUTING.md +2 -25
- package/build/ExpoIap.types.d.ts.map +1 -1
- package/build/ExpoIap.types.js.map +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -3
- 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.map +1 -1
- package/build/useIap.js +1 -1
- package/build/useIap.js.map +1 -1
- package/ios/ExpoIapModule.swift +92 -52
- package/ios/expoiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/expoiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/package.json +1 -1
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/ExpoIap.types.ts +8 -17
- package/src/index.ts +34 -31
- package/src/modules/android.ts +4 -2
- package/src/modules/ios.ts +47 -87
- package/src/useIap.ts +5 -8
package/src/modules/ios.ts
CHANGED
|
@@ -11,10 +11,7 @@ import {
|
|
|
11
11
|
Purchase,
|
|
12
12
|
SubscriptionPurchase,
|
|
13
13
|
} from '../ExpoIap.types';
|
|
14
|
-
import type {
|
|
15
|
-
ProductStatusIos,
|
|
16
|
-
AppTransactionIOS,
|
|
17
|
-
} from '../types/ExpoIapIos.types';
|
|
14
|
+
import type {ProductStatusIos, AppTransactionIOS} from '../types/ExpoIapIos.types';
|
|
18
15
|
|
|
19
16
|
export type TransactionEvent = {
|
|
20
17
|
transaction?: ProductPurchase;
|
|
@@ -38,6 +35,7 @@ export type TransactionEvent = {
|
|
|
38
35
|
export const transactionUpdatedIos = (
|
|
39
36
|
listener: (event: TransactionEvent) => void,
|
|
40
37
|
) => {
|
|
38
|
+
|
|
41
39
|
const isProductPurchase = (item: unknown): item is ProductPurchase => {
|
|
42
40
|
return (
|
|
43
41
|
item != null &&
|
|
@@ -88,10 +86,10 @@ export function isProductIos<T extends {platform?: string}>(
|
|
|
88
86
|
/**
|
|
89
87
|
* Sync state with Appstore (iOS only)
|
|
90
88
|
* https://developer.apple.com/documentation/storekit/appstore/3791906-sync
|
|
91
|
-
*
|
|
89
|
+
*
|
|
92
90
|
* @returns Promise resolving to null on success
|
|
93
91
|
* @throws Error if called on non-iOS platform
|
|
94
|
-
*
|
|
92
|
+
*
|
|
95
93
|
* @platform iOS
|
|
96
94
|
*/
|
|
97
95
|
export const syncIOS = (): Promise<null> => {
|
|
@@ -100,56 +98,50 @@ export const syncIOS = (): Promise<null> => {
|
|
|
100
98
|
|
|
101
99
|
/**
|
|
102
100
|
* Check if user is eligible for introductory offer
|
|
103
|
-
*
|
|
101
|
+
*
|
|
104
102
|
* @param groupID The subscription group ID
|
|
105
103
|
* @returns Promise resolving to true if eligible
|
|
106
104
|
* @throws Error if called on non-iOS platform
|
|
107
|
-
*
|
|
105
|
+
*
|
|
108
106
|
* @platform iOS
|
|
109
107
|
*/
|
|
110
|
-
export const isEligibleForIntroOfferIOS = (
|
|
111
|
-
groupID: string,
|
|
112
|
-
): Promise<boolean> => {
|
|
108
|
+
export const isEligibleForIntroOfferIOS = (groupID: string): Promise<boolean> => {
|
|
113
109
|
return ExpoIapModule.isEligibleForIntroOffer(groupID);
|
|
114
110
|
};
|
|
115
111
|
|
|
116
112
|
/**
|
|
117
113
|
* Get subscription status for a specific SKU
|
|
118
|
-
*
|
|
114
|
+
*
|
|
119
115
|
* @param sku The product SKU
|
|
120
116
|
* @returns Promise resolving to array of subscription status
|
|
121
117
|
* @throws Error if called on non-iOS platform
|
|
122
|
-
*
|
|
118
|
+
*
|
|
123
119
|
* @platform iOS
|
|
124
120
|
*/
|
|
125
|
-
export const subscriptionStatusIOS = (
|
|
126
|
-
sku: string,
|
|
127
|
-
): Promise<ProductStatusIos[]> => {
|
|
121
|
+
export const subscriptionStatusIOS = (sku: string): Promise<ProductStatusIos[]> => {
|
|
128
122
|
return ExpoIapModule.subscriptionStatus(sku);
|
|
129
123
|
};
|
|
130
124
|
|
|
131
125
|
/**
|
|
132
126
|
* Get current entitlement for a specific SKU
|
|
133
|
-
*
|
|
127
|
+
*
|
|
134
128
|
* @param sku The product SKU
|
|
135
129
|
* @returns Promise resolving to current entitlement
|
|
136
130
|
* @throws Error if called on non-iOS platform
|
|
137
|
-
*
|
|
131
|
+
*
|
|
138
132
|
* @platform iOS
|
|
139
133
|
*/
|
|
140
|
-
export const currentEntitlementIOS = (
|
|
141
|
-
sku: string,
|
|
142
|
-
): Promise<ProductPurchase> => {
|
|
134
|
+
export const currentEntitlementIOS = (sku: string): Promise<ProductPurchase> => {
|
|
143
135
|
return ExpoIapModule.currentEntitlement(sku);
|
|
144
136
|
};
|
|
145
137
|
|
|
146
138
|
/**
|
|
147
139
|
* Get latest transaction for a specific SKU
|
|
148
|
-
*
|
|
140
|
+
*
|
|
149
141
|
* @param sku The product SKU
|
|
150
142
|
* @returns Promise resolving to latest transaction
|
|
151
143
|
* @throws Error if called on non-iOS platform
|
|
152
|
-
*
|
|
144
|
+
*
|
|
153
145
|
* @platform iOS
|
|
154
146
|
*/
|
|
155
147
|
export const latestTransactionIOS = (sku: string): Promise<ProductPurchase> => {
|
|
@@ -158,17 +150,15 @@ export const latestTransactionIOS = (sku: string): Promise<ProductPurchase> => {
|
|
|
158
150
|
|
|
159
151
|
/**
|
|
160
152
|
* Begin refund request for a specific SKU
|
|
161
|
-
*
|
|
153
|
+
*
|
|
162
154
|
* @param sku The product SKU
|
|
163
155
|
* @returns Promise resolving to refund request status
|
|
164
156
|
* @throws Error if called on non-iOS platform
|
|
165
|
-
*
|
|
157
|
+
*
|
|
166
158
|
* @platform iOS
|
|
167
159
|
*/
|
|
168
160
|
type RefundRequestStatus = 'success' | 'userCancelled';
|
|
169
|
-
export const beginRefundRequestIOS = (
|
|
170
|
-
sku: string,
|
|
171
|
-
): Promise<RefundRequestStatus> => {
|
|
161
|
+
export const beginRefundRequestIOS = (sku: string): Promise<RefundRequestStatus> => {
|
|
172
162
|
return ExpoIapModule.beginRefundRequest(sku);
|
|
173
163
|
};
|
|
174
164
|
|
|
@@ -176,10 +166,10 @@ export const beginRefundRequestIOS = (
|
|
|
176
166
|
* Shows the system UI for managing subscriptions.
|
|
177
167
|
* When the user changes subscription renewal status, the system will emit events to
|
|
178
168
|
* purchaseUpdatedListener and transactionUpdatedIos listeners.
|
|
179
|
-
*
|
|
169
|
+
*
|
|
180
170
|
* @returns Promise resolving to null on success
|
|
181
171
|
* @throws Error if called on non-iOS platform
|
|
182
|
-
*
|
|
172
|
+
*
|
|
183
173
|
* @platform iOS
|
|
184
174
|
*/
|
|
185
175
|
export const showManageSubscriptionsIOS = (): Promise<null> => {
|
|
@@ -207,7 +197,7 @@ export const getReceiptIOS = (): Promise<string> => {
|
|
|
207
197
|
* @param sku The product's SKU (on iOS)
|
|
208
198
|
* @returns Promise resolving to true if the transaction is verified
|
|
209
199
|
* @throws Error if called on non-iOS platform
|
|
210
|
-
*
|
|
200
|
+
*
|
|
211
201
|
* @platform iOS
|
|
212
202
|
*/
|
|
213
203
|
export const isTransactionVerifiedIOS = (sku: string): Promise<boolean> => {
|
|
@@ -221,7 +211,7 @@ export const isTransactionVerifiedIOS = (sku: string): Promise<boolean> => {
|
|
|
221
211
|
* @param sku The product's SKU (on iOS)
|
|
222
212
|
* @returns Promise resolving to JWS representation of the transaction
|
|
223
213
|
* @throws Error if called on non-iOS platform
|
|
224
|
-
*
|
|
214
|
+
*
|
|
225
215
|
* @platform iOS
|
|
226
216
|
*/
|
|
227
217
|
export const getTransactionJwsIOS = (sku: string): Promise<string> => {
|
|
@@ -258,12 +248,12 @@ export const validateReceiptIOS = async (
|
|
|
258
248
|
/**
|
|
259
249
|
* Present the code redemption sheet for offer codes (iOS only).
|
|
260
250
|
* This allows users to redeem promotional codes for in-app purchases and subscriptions.
|
|
261
|
-
*
|
|
251
|
+
*
|
|
262
252
|
* Note: This only works on real devices, not simulators.
|
|
263
|
-
*
|
|
253
|
+
*
|
|
264
254
|
* @returns Promise resolving to true if the sheet was presented successfully
|
|
265
255
|
* @throws Error if called on non-iOS platform or tvOS
|
|
266
|
-
*
|
|
256
|
+
*
|
|
267
257
|
* @platform iOS
|
|
268
258
|
*/
|
|
269
259
|
export const presentCodeRedemptionSheetIOS = (): Promise<boolean> => {
|
|
@@ -273,14 +263,14 @@ export const presentCodeRedemptionSheetIOS = (): Promise<boolean> => {
|
|
|
273
263
|
/**
|
|
274
264
|
* Get app transaction information (iOS 16.0+).
|
|
275
265
|
* AppTransaction represents the initial purchase that unlocked the app.
|
|
276
|
-
*
|
|
266
|
+
*
|
|
277
267
|
* NOTE: This function requires:
|
|
278
268
|
* - iOS 16.0 or later at runtime
|
|
279
269
|
* - Xcode 15.0+ with iOS 16.0 SDK for compilation
|
|
280
|
-
*
|
|
270
|
+
*
|
|
281
271
|
* @returns Promise resolving to the app transaction information or null if not available
|
|
282
272
|
* @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK
|
|
283
|
-
*
|
|
273
|
+
*
|
|
284
274
|
* @platform iOS
|
|
285
275
|
* @since iOS 16.0
|
|
286
276
|
*/
|
|
@@ -291,10 +281,10 @@ export const getAppTransactionIOS = (): Promise<AppTransactionIOS | null> => {
|
|
|
291
281
|
/**
|
|
292
282
|
* Get the promoted product details (iOS only).
|
|
293
283
|
* This is called after a promoted product event is received from the App Store.
|
|
294
|
-
*
|
|
284
|
+
*
|
|
295
285
|
* @returns Promise resolving to the promoted product details or null if none available
|
|
296
286
|
* @throws Error if called on non-iOS platform
|
|
297
|
-
*
|
|
287
|
+
*
|
|
298
288
|
* @platform iOS
|
|
299
289
|
*/
|
|
300
290
|
export const getPromotedProductIOS = (): Promise<any | null> => {
|
|
@@ -304,10 +294,10 @@ export const getPromotedProductIOS = (): Promise<any | null> => {
|
|
|
304
294
|
/**
|
|
305
295
|
* Complete the purchase of a promoted product (iOS only).
|
|
306
296
|
* This should be called after showing your purchase UI for a promoted product.
|
|
307
|
-
*
|
|
297
|
+
*
|
|
308
298
|
* @returns Promise resolving when the purchase is initiated
|
|
309
299
|
* @throws Error if called on non-iOS platform or no promoted product is available
|
|
310
|
-
*
|
|
300
|
+
*
|
|
311
301
|
* @platform iOS
|
|
312
302
|
*/
|
|
313
303
|
export const buyPromotedProductIOS = (): Promise<void> => {
|
|
@@ -321,9 +311,7 @@ export const buyPromotedProductIOS = (): Promise<void> => {
|
|
|
321
311
|
* @deprecated Use `syncIOS` instead. This function will be removed in version 3.0.0.
|
|
322
312
|
*/
|
|
323
313
|
export const sync = (): Promise<null> => {
|
|
324
|
-
console.warn(
|
|
325
|
-
'`sync` is deprecated. Use `syncIOS` instead. This function will be removed in version 3.0.0.',
|
|
326
|
-
);
|
|
314
|
+
console.warn('`sync` is deprecated. Use `syncIOS` instead. This function will be removed in version 3.0.0.');
|
|
327
315
|
return syncIOS();
|
|
328
316
|
};
|
|
329
317
|
|
|
@@ -331,21 +319,15 @@ export const sync = (): Promise<null> => {
|
|
|
331
319
|
* @deprecated Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.
|
|
332
320
|
*/
|
|
333
321
|
export const isEligibleForIntroOffer = (groupID: string): Promise<boolean> => {
|
|
334
|
-
console.warn(
|
|
335
|
-
'`isEligibleForIntroOffer` is deprecated. Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.',
|
|
336
|
-
);
|
|
322
|
+
console.warn('`isEligibleForIntroOffer` is deprecated. Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.');
|
|
337
323
|
return isEligibleForIntroOfferIOS(groupID);
|
|
338
324
|
};
|
|
339
325
|
|
|
340
326
|
/**
|
|
341
327
|
* @deprecated Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.
|
|
342
328
|
*/
|
|
343
|
-
export const subscriptionStatus = (
|
|
344
|
-
|
|
345
|
-
): Promise<ProductStatusIos[]> => {
|
|
346
|
-
console.warn(
|
|
347
|
-
'`subscriptionStatus` is deprecated. Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.',
|
|
348
|
-
);
|
|
329
|
+
export const subscriptionStatus = (sku: string): Promise<ProductStatusIos[]> => {
|
|
330
|
+
console.warn('`subscriptionStatus` is deprecated. Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.');
|
|
349
331
|
return subscriptionStatusIOS(sku);
|
|
350
332
|
};
|
|
351
333
|
|
|
@@ -353,9 +335,7 @@ export const subscriptionStatus = (
|
|
|
353
335
|
* @deprecated Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.
|
|
354
336
|
*/
|
|
355
337
|
export const currentEntitlement = (sku: string): Promise<ProductPurchase> => {
|
|
356
|
-
console.warn(
|
|
357
|
-
'`currentEntitlement` is deprecated. Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.',
|
|
358
|
-
);
|
|
338
|
+
console.warn('`currentEntitlement` is deprecated. Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.');
|
|
359
339
|
return currentEntitlementIOS(sku);
|
|
360
340
|
};
|
|
361
341
|
|
|
@@ -363,21 +343,15 @@ export const currentEntitlement = (sku: string): Promise<ProductPurchase> => {
|
|
|
363
343
|
* @deprecated Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.
|
|
364
344
|
*/
|
|
365
345
|
export const latestTransaction = (sku: string): Promise<ProductPurchase> => {
|
|
366
|
-
console.warn(
|
|
367
|
-
'`latestTransaction` is deprecated. Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.',
|
|
368
|
-
);
|
|
346
|
+
console.warn('`latestTransaction` is deprecated. Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.');
|
|
369
347
|
return latestTransactionIOS(sku);
|
|
370
348
|
};
|
|
371
349
|
|
|
372
350
|
/**
|
|
373
351
|
* @deprecated Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.
|
|
374
352
|
*/
|
|
375
|
-
export const beginRefundRequest = (
|
|
376
|
-
|
|
377
|
-
): Promise<RefundRequestStatus> => {
|
|
378
|
-
console.warn(
|
|
379
|
-
'`beginRefundRequest` is deprecated. Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.',
|
|
380
|
-
);
|
|
353
|
+
export const beginRefundRequest = (sku: string): Promise<RefundRequestStatus> => {
|
|
354
|
+
console.warn('`beginRefundRequest` is deprecated. Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.');
|
|
381
355
|
return beginRefundRequestIOS(sku);
|
|
382
356
|
};
|
|
383
357
|
|
|
@@ -385,9 +359,7 @@ export const beginRefundRequest = (
|
|
|
385
359
|
* @deprecated Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.
|
|
386
360
|
*/
|
|
387
361
|
export const showManageSubscriptions = (): Promise<null> => {
|
|
388
|
-
console.warn(
|
|
389
|
-
'`showManageSubscriptions` is deprecated. Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.',
|
|
390
|
-
);
|
|
362
|
+
console.warn('`showManageSubscriptions` is deprecated. Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.');
|
|
391
363
|
return showManageSubscriptionsIOS();
|
|
392
364
|
};
|
|
393
365
|
|
|
@@ -395,9 +367,7 @@ export const showManageSubscriptions = (): Promise<null> => {
|
|
|
395
367
|
* @deprecated Use `getReceiptIOS` instead. This function will be removed in version 3.0.0.
|
|
396
368
|
*/
|
|
397
369
|
export const getReceiptIos = (): Promise<string> => {
|
|
398
|
-
console.warn(
|
|
399
|
-
'`getReceiptIos` is deprecated. Use `getReceiptIOS` instead. This function will be removed in version 3.0.0.',
|
|
400
|
-
);
|
|
370
|
+
console.warn('`getReceiptIos` is deprecated. Use `getReceiptIOS` instead. This function will be removed in version 3.0.0.');
|
|
401
371
|
return getReceiptIOS();
|
|
402
372
|
};
|
|
403
373
|
|
|
@@ -405,9 +375,7 @@ export const getReceiptIos = (): Promise<string> => {
|
|
|
405
375
|
* @deprecated Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.
|
|
406
376
|
*/
|
|
407
377
|
export const isTransactionVerified = (sku: string): Promise<boolean> => {
|
|
408
|
-
console.warn(
|
|
409
|
-
'`isTransactionVerified` is deprecated. Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.',
|
|
410
|
-
);
|
|
378
|
+
console.warn('`isTransactionVerified` is deprecated. Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.');
|
|
411
379
|
return isTransactionVerifiedIOS(sku);
|
|
412
380
|
};
|
|
413
381
|
|
|
@@ -415,9 +383,7 @@ export const isTransactionVerified = (sku: string): Promise<boolean> => {
|
|
|
415
383
|
* @deprecated Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.
|
|
416
384
|
*/
|
|
417
385
|
export const getTransactionJws = (sku: string): Promise<string> => {
|
|
418
|
-
console.warn(
|
|
419
|
-
'`getTransactionJws` is deprecated. Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.',
|
|
420
|
-
);
|
|
386
|
+
console.warn('`getTransactionJws` is deprecated. Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.');
|
|
421
387
|
return getTransactionJwsIOS(sku);
|
|
422
388
|
};
|
|
423
389
|
|
|
@@ -432,9 +398,7 @@ export const validateReceiptIos = async (
|
|
|
432
398
|
jwsRepresentation: string;
|
|
433
399
|
latestTransaction?: ProductPurchase;
|
|
434
400
|
}> => {
|
|
435
|
-
console.warn(
|
|
436
|
-
'`validateReceiptIos` is deprecated. Use `validateReceiptIOS` instead. This function will be removed in version 3.0.0.',
|
|
437
|
-
);
|
|
401
|
+
console.warn('`validateReceiptIos` is deprecated. Use `validateReceiptIOS` instead. This function will be removed in version 3.0.0.');
|
|
438
402
|
return validateReceiptIOS(sku);
|
|
439
403
|
};
|
|
440
404
|
|
|
@@ -442,9 +406,7 @@ export const validateReceiptIos = async (
|
|
|
442
406
|
* @deprecated Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.
|
|
443
407
|
*/
|
|
444
408
|
export const presentCodeRedemptionSheet = (): Promise<boolean> => {
|
|
445
|
-
console.warn(
|
|
446
|
-
'`presentCodeRedemptionSheet` is deprecated. Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.',
|
|
447
|
-
);
|
|
409
|
+
console.warn('`presentCodeRedemptionSheet` is deprecated. Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.');
|
|
448
410
|
return presentCodeRedemptionSheetIOS();
|
|
449
411
|
};
|
|
450
412
|
|
|
@@ -452,8 +414,6 @@ export const presentCodeRedemptionSheet = (): Promise<boolean> => {
|
|
|
452
414
|
* @deprecated Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.
|
|
453
415
|
*/
|
|
454
416
|
export const getAppTransaction = (): Promise<AppTransactionIOS | null> => {
|
|
455
|
-
console.warn(
|
|
456
|
-
'`getAppTransaction` is deprecated. Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.',
|
|
457
|
-
);
|
|
417
|
+
console.warn('`getAppTransaction` is deprecated. Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.');
|
|
458
418
|
return getAppTransactionIOS();
|
|
459
419
|
};
|
package/src/useIap.ts
CHANGED
|
@@ -16,12 +16,7 @@ import {
|
|
|
16
16
|
requestPurchase as requestPurchaseInternal,
|
|
17
17
|
requestProducts,
|
|
18
18
|
} from './';
|
|
19
|
-
import {
|
|
20
|
-
syncIOS,
|
|
21
|
-
validateReceiptIOS,
|
|
22
|
-
getPromotedProductIOS,
|
|
23
|
-
buyPromotedProductIOS,
|
|
24
|
-
} from './modules/ios';
|
|
19
|
+
import {syncIOS, validateReceiptIOS, getPromotedProductIOS, buyPromotedProductIOS} from './modules/ios';
|
|
25
20
|
import {validateReceiptAndroid} from './modules/android';
|
|
26
21
|
|
|
27
22
|
// Types
|
|
@@ -98,7 +93,9 @@ export interface UseIAPOptions {
|
|
|
98
93
|
export function useIAP(options?: UseIAPOptions): UseIap {
|
|
99
94
|
const [connected, setConnected] = useState<boolean>(false);
|
|
100
95
|
const [products, setProducts] = useState<Product[]>([]);
|
|
101
|
-
const [promotedProductsIOS] = useState<
|
|
96
|
+
const [promotedProductsIOS] = useState<
|
|
97
|
+
ProductPurchase[]
|
|
98
|
+
>([]);
|
|
102
99
|
const [subscriptions, setSubscriptions] = useState<SubscriptionProduct[]>([]);
|
|
103
100
|
const [purchaseHistories, setPurchaseHistories] = useState<ProductPurchase[]>(
|
|
104
101
|
[],
|
|
@@ -390,7 +387,7 @@ export function useIAP(options?: UseIAPOptions): UseIap {
|
|
|
390
387
|
subscriptionsRef.current.promotedProductsIos =
|
|
391
388
|
promotedProductListenerIOS((product: Product) => {
|
|
392
389
|
setPromotedProductIOS(product);
|
|
393
|
-
|
|
390
|
+
|
|
394
391
|
if (optionsRef.current?.onPromotedProductIOS) {
|
|
395
392
|
optionsRef.current.onPromotedProductIOS(product);
|
|
396
393
|
}
|