expo-iap 3.1.24 → 3.1.26
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/README.md +18 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/types.d.ts +11 -10
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/coverage/clover.xml +273 -273
- package/coverage/coverage-final.json +5 -5
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +93 -78
- package/coverage/lcov-report/src/modules/android.ts.html +16 -16
- package/coverage/lcov-report/src/modules/index.html +1 -1
- package/coverage/lcov-report/src/modules/ios.ts.html +43 -43
- package/coverage/lcov-report/src/utils/debug.ts.html +8 -8
- package/coverage/lcov-report/src/utils/errorMapping.ts.html +22 -22
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +426 -426
- package/ios/ExpoIapModule.swift +3 -3
- package/openiap-versions.json +1 -1
- package/package.json +2 -2
- package/src/index.ts +10 -5
- package/src/types.ts +12 -10
- package/bun.lockb +0 -0
package/ios/ExpoIapModule.swift
CHANGED
|
@@ -13,9 +13,9 @@ public final class ExpoIapModule: Module {
|
|
|
13
13
|
nonisolated public func definition() -> ModuleDefinition {
|
|
14
14
|
Name("ExpoIap")
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
OpenIapSerialization.errorCodes()
|
|
18
|
-
|
|
16
|
+
Constants([
|
|
17
|
+
"ERROR_CODES": OpenIapSerialization.errorCodes()
|
|
18
|
+
])
|
|
19
19
|
|
|
20
20
|
Events(
|
|
21
21
|
OpenIapEvent.purchaseUpdated.rawValue,
|
package/openiap-versions.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-iap",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.26",
|
|
4
4
|
"description": "In App Purchase module in Expo",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"homepage": "https://github.com/hyochan/expo-iap#readme",
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"husky": "^9.0.11",
|
|
48
47
|
"@jest/globals": "^30.0.5",
|
|
49
48
|
"@types/jest": "^30.0.0",
|
|
50
49
|
"@types/react": "~19.1.7",
|
|
@@ -54,6 +53,7 @@
|
|
|
54
53
|
"eslint-plugin-prettier": "^5.4.1",
|
|
55
54
|
"expo-module-scripts": "^4.1.7",
|
|
56
55
|
"expo-modules-core": "^2.4.0",
|
|
56
|
+
"husky": "^9.0.11",
|
|
57
57
|
"jest": "^29.7.0",
|
|
58
58
|
"ts-jest": "^29.4.1"
|
|
59
59
|
},
|
package/src/index.ts
CHANGED
|
@@ -22,7 +22,6 @@ import type {
|
|
|
22
22
|
ActiveSubscription,
|
|
23
23
|
AndroidSubscriptionOfferInput,
|
|
24
24
|
DeepLinkOptions,
|
|
25
|
-
FetchProductsResult,
|
|
26
25
|
MutationField,
|
|
27
26
|
MutationRequestPurchaseArgs,
|
|
28
27
|
MutationValidateReceiptArgs,
|
|
@@ -259,7 +258,7 @@ export const fetchProducts: QueryField<'fetchProducts'> = async (request) => {
|
|
|
259
258
|
|
|
260
259
|
const filterIosItems = (
|
|
261
260
|
items: unknown[],
|
|
262
|
-
): Product
|
|
261
|
+
): (Product | ProductSubscription)[] =>
|
|
263
262
|
items.filter((item): item is Product | ProductSubscription => {
|
|
264
263
|
if (!isProductIOS(item)) {
|
|
265
264
|
return false;
|
|
@@ -270,7 +269,7 @@ export const fetchProducts: QueryField<'fetchProducts'> = async (request) => {
|
|
|
270
269
|
|
|
271
270
|
const filterAndroidItems = (
|
|
272
271
|
items: unknown[],
|
|
273
|
-
): Product
|
|
272
|
+
): (Product | ProductSubscription)[] =>
|
|
274
273
|
items.filter((item): item is Product | ProductSubscription => {
|
|
275
274
|
if (!isProductAndroid(item)) {
|
|
276
275
|
return false;
|
|
@@ -280,14 +279,20 @@ export const fetchProducts: QueryField<'fetchProducts'> = async (request) => {
|
|
|
280
279
|
});
|
|
281
280
|
|
|
282
281
|
const castResult = (
|
|
283
|
-
items: Product
|
|
284
|
-
):
|
|
282
|
+
items: (Product | ProductSubscription)[],
|
|
283
|
+
):
|
|
284
|
+
| (Product | ProductSubscription)[]
|
|
285
|
+
| Product[]
|
|
286
|
+
| ProductSubscription[]
|
|
287
|
+
| null => {
|
|
285
288
|
if (canonical === 'in-app') {
|
|
286
289
|
return items as Product[];
|
|
287
290
|
}
|
|
288
291
|
if (canonical === 'subs') {
|
|
289
292
|
return items as ProductSubscription[];
|
|
290
293
|
}
|
|
294
|
+
// For 'all' type, items contain both Product and ProductSubscription
|
|
295
|
+
// Return as ProductOrSubscription[] to preserve discriminated union
|
|
291
296
|
return items;
|
|
292
297
|
};
|
|
293
298
|
|
package/src/types.ts
CHANGED
|
@@ -166,7 +166,7 @@ export interface ExternalPurchaseNoticeResultIOS {
|
|
|
166
166
|
result: ExternalPurchaseNoticeAction;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
export type FetchProductsResult = Product[] | ProductSubscription[] | null;
|
|
169
|
+
export type FetchProductsResult = ProductOrSubscription[] | Product[] | ProductSubscription[] | null;
|
|
170
170
|
|
|
171
171
|
export type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product-ios' | 'user-choice-billing-android';
|
|
172
172
|
|
|
@@ -310,11 +310,11 @@ export interface ProductAndroid extends ProductCommon {
|
|
|
310
310
|
id: string;
|
|
311
311
|
nameAndroid: string;
|
|
312
312
|
oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail | null);
|
|
313
|
-
platform:
|
|
313
|
+
platform: 'android';
|
|
314
314
|
price?: (number | null);
|
|
315
315
|
subscriptionOfferDetailsAndroid?: (ProductSubscriptionAndroidOfferDetails[] | null);
|
|
316
316
|
title: string;
|
|
317
|
-
type:
|
|
317
|
+
type: 'in-app';
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
export interface ProductAndroidOneTimePurchaseOfferDetail {
|
|
@@ -346,14 +346,16 @@ export interface ProductIOS extends ProductCommon {
|
|
|
346
346
|
id: string;
|
|
347
347
|
isFamilyShareableIOS: boolean;
|
|
348
348
|
jsonRepresentationIOS: string;
|
|
349
|
-
platform:
|
|
349
|
+
platform: 'ios';
|
|
350
350
|
price?: (number | null);
|
|
351
351
|
subscriptionInfoIOS?: (SubscriptionInfoIOS | null);
|
|
352
352
|
title: string;
|
|
353
|
-
type:
|
|
353
|
+
type: 'in-app';
|
|
354
354
|
typeIOS: ProductTypeIOS;
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
+
export type ProductOrSubscription = Product | ProductSubscription;
|
|
358
|
+
|
|
357
359
|
export type ProductQueryType = 'in-app' | 'subs' | 'all';
|
|
358
360
|
|
|
359
361
|
export interface ProductRequest {
|
|
@@ -372,11 +374,11 @@ export interface ProductSubscriptionAndroid extends ProductCommon {
|
|
|
372
374
|
id: string;
|
|
373
375
|
nameAndroid: string;
|
|
374
376
|
oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail | null);
|
|
375
|
-
platform:
|
|
377
|
+
platform: 'android';
|
|
376
378
|
price?: (number | null);
|
|
377
379
|
subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];
|
|
378
380
|
title: string;
|
|
379
|
-
type:
|
|
381
|
+
type: 'subs';
|
|
380
382
|
}
|
|
381
383
|
|
|
382
384
|
export interface ProductSubscriptionAndroidOfferDetails {
|
|
@@ -403,13 +405,13 @@ export interface ProductSubscriptionIOS extends ProductCommon {
|
|
|
403
405
|
introductoryPriceSubscriptionPeriodIOS?: (SubscriptionPeriodIOS | null);
|
|
404
406
|
isFamilyShareableIOS: boolean;
|
|
405
407
|
jsonRepresentationIOS: string;
|
|
406
|
-
platform:
|
|
408
|
+
platform: 'ios';
|
|
407
409
|
price?: (number | null);
|
|
408
410
|
subscriptionInfoIOS?: (SubscriptionInfoIOS | null);
|
|
409
411
|
subscriptionPeriodNumberIOS?: (string | null);
|
|
410
412
|
subscriptionPeriodUnitIOS?: (SubscriptionPeriodIOS | null);
|
|
411
413
|
title: string;
|
|
412
|
-
type:
|
|
414
|
+
type: 'subs';
|
|
413
415
|
typeIOS: ProductTypeIOS;
|
|
414
416
|
}
|
|
415
417
|
|
|
@@ -526,7 +528,7 @@ export interface Query {
|
|
|
526
528
|
/** Get current StoreKit 2 entitlements (iOS 15+) */
|
|
527
529
|
currentEntitlementIOS?: Promise<(PurchaseIOS | null)>;
|
|
528
530
|
/** Retrieve products or subscriptions from the store */
|
|
529
|
-
fetchProducts: Promise<(Product[] | ProductSubscription[] | null)>;
|
|
531
|
+
fetchProducts: Promise<(ProductOrSubscription[] | Product[] | ProductSubscription[] | null)>;
|
|
530
532
|
/** Get active subscriptions (filters by subscriptionIds when provided) */
|
|
531
533
|
getActiveSubscriptions: Promise<ActiveSubscription[]>;
|
|
532
534
|
/** Fetch the current app transaction (iOS 16+) */
|
package/bun.lockb
DELETED
|
Binary file
|