expo-iap 3.3.0-rc.1 → 3.3.0-rc.2
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 +1 -22
- package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +17 -13
- package/build/index.d.ts.map +1 -1
- package/build/index.js +16 -12
- package/build/index.js.map +1 -1
- package/build/modules/ios.d.ts.map +1 -1
- package/build/modules/ios.js +4 -2
- package/build/modules/ios.js.map +1 -1
- package/build/types.d.ts +94 -9
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/coverage/clover.xml +57 -55
- package/coverage/coverage-final.json +2 -2
- package/coverage/lcov-report/index.html +14 -14
- package/coverage/lcov-report/src/index.html +14 -14
- package/coverage/lcov-report/src/index.ts.html +34 -22
- package/coverage/lcov-report/src/modules/android.ts.html +1 -1
- package/coverage/lcov-report/src/modules/index.html +1 -1
- package/coverage/lcov-report/src/modules/ios.ts.html +13 -7
- package/coverage/lcov-report/src/utils/debug.ts.html +1 -1
- package/coverage/lcov-report/src/utils/errorMapping.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +100 -96
- package/ios/ExpoIapModule.swift +1 -1
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/index.ts +16 -12
- package/src/modules/ios.ts +4 -2
- package/src/types.ts +97 -9
package/README.md
CHANGED
|
@@ -50,28 +50,7 @@ Both libraries will continue to be maintained in parallel going forward.
|
|
|
50
50
|
npx expo install expo-iap
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
**Important:** For Android, `expo-iap` uses Google Play Billing Library v8.0.0 which requires Kotlin 2.0+. Since `expo-modules-core` doesn't support Kotlin v2 yet, you need to configure your project with `expo-build-properties`:
|
|
56
|
-
|
|
57
|
-
```json
|
|
58
|
-
{
|
|
59
|
-
"expo": {
|
|
60
|
-
"plugins": [
|
|
61
|
-
[
|
|
62
|
-
"expo-build-properties",
|
|
63
|
-
{
|
|
64
|
-
"android": {
|
|
65
|
-
"kotlinVersion": "2.1.20"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
If you're targeting Expo SDK 54 or newer, please confirm whether this manual override is still required and share findings with the community at [github.com/hyochan/expo-iap/discussions](https://github.com/hyochan/expo-iap/discussions).
|
|
53
|
+
For platform-specific configuration (Android Kotlin version, iOS deployment target, etc.), see the [Installation Guide](https://hyochan.github.io/expo-iap/getting-started/installation#important-for-expo-managed-workflow).
|
|
75
54
|
|
|
76
55
|
## Contributing
|
|
77
56
|
|
|
@@ -19,7 +19,7 @@ import dev.hyo.openiap.RequestPurchaseResultPurchase
|
|
|
19
19
|
import dev.hyo.openiap.RequestPurchaseResultPurchases
|
|
20
20
|
import dev.hyo.openiap.RequestSubscriptionAndroidProps
|
|
21
21
|
import dev.hyo.openiap.RequestSubscriptionPropsByPlatforms
|
|
22
|
-
import dev.hyo.openiap.
|
|
22
|
+
import dev.hyo.openiap.VerifyPurchaseGoogleOptions
|
|
23
23
|
import dev.hyo.openiap.VerifyPurchaseProps
|
|
24
24
|
import dev.hyo.openiap.VerifyPurchaseWithProviderProps
|
|
25
25
|
import dev.hyo.openiap.store.OpenIapStore
|
|
@@ -443,24 +443,28 @@ class ExpoIapModule : Module() {
|
|
|
443
443
|
ExpoIapLog.payload("verifyPurchase", params)
|
|
444
444
|
scope.launch {
|
|
445
445
|
try {
|
|
446
|
-
val
|
|
447
|
-
params["
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
446
|
+
val googleOptions =
|
|
447
|
+
(params["google"] as? Map<String, Any?>)?.let { opts ->
|
|
448
|
+
VerifyPurchaseGoogleOptions(
|
|
449
|
+
sku =
|
|
450
|
+
(opts["sku"] as? String)?.takeIf { it.isNotEmpty() }
|
|
451
|
+
?: throw IllegalArgumentException("Missing or empty required parameter: google.sku"),
|
|
452
|
+
accessToken =
|
|
453
|
+
(opts["accessToken"] as? String)?.takeIf { it.isNotEmpty() }
|
|
454
|
+
?: throw IllegalArgumentException("Missing or empty required parameter: google.accessToken"),
|
|
455
|
+
packageName =
|
|
456
|
+
(opts["packageName"] as? String)?.takeIf { it.isNotEmpty() }
|
|
457
|
+
?: throw IllegalArgumentException("Missing or empty required parameter: google.packageName"),
|
|
458
|
+
purchaseToken =
|
|
459
|
+
(opts["purchaseToken"] as? String)?.takeIf { it.isNotEmpty() }
|
|
460
|
+
?: throw IllegalArgumentException("Missing or empty required parameter: google.purchaseToken"),
|
|
456
461
|
isSub = opts["isSub"] as? Boolean,
|
|
457
462
|
)
|
|
458
463
|
}
|
|
459
464
|
|
|
460
465
|
val props =
|
|
461
466
|
VerifyPurchaseProps(
|
|
462
|
-
|
|
463
|
-
androidOptions = androidOptions,
|
|
467
|
+
google = googleOptions,
|
|
464
468
|
)
|
|
465
469
|
|
|
466
470
|
val result = openIap.verifyPurchase(props)
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAIV,aAAa,EAGb,OAAO,EACP,gBAAgB,EAEhB,QAAQ,EAER,UAAU,EAOV,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAsB,KAAK,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAG7E,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAG9B,oBAAY,YAAY;IACtB,eAAe,qBAAqB;IACpC,aAAa,mBAAmB;IAChC,kBAAkB,yBAAyB;IAC3C,wBAAwB,gCAAgC;CACzD;AAED,KAAK,oBAAoB,GAAG;IAC1B,C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,EAAE,aAAa,CACjD,yBAAyB,CAa1B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,iBAAiB,CAkC5D,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,gBAAgB,CAQ1D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,0BAA0B,EAAE,aAAa,CACpD,4BAA4B,CAO7B,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,aAAa,IAAI,iBAAiB,EAClC,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -485,23 +485,27 @@ export const deepLinkToSubscriptions = async (options) => {
|
|
|
485
485
|
* @deprecated Use verifyPurchase instead
|
|
486
486
|
*/
|
|
487
487
|
export const validateReceipt = async (options) => {
|
|
488
|
-
const {
|
|
488
|
+
const { apple, google } = options;
|
|
489
489
|
if (Platform.OS === 'ios') {
|
|
490
|
-
|
|
490
|
+
if (!apple?.sku) {
|
|
491
|
+
throw new Error('iOS validation requires apple.sku');
|
|
492
|
+
}
|
|
493
|
+
return validateReceiptIOS({ apple: { sku: apple.sku } });
|
|
491
494
|
}
|
|
492
495
|
if (Platform.OS === 'android') {
|
|
493
|
-
if (!
|
|
494
|
-
!
|
|
495
|
-
!
|
|
496
|
-
!
|
|
497
|
-
|
|
496
|
+
if (!google ||
|
|
497
|
+
!google.sku ||
|
|
498
|
+
!google.packageName ||
|
|
499
|
+
!google.purchaseToken ||
|
|
500
|
+
!google.accessToken) {
|
|
501
|
+
throw new Error('Android validation requires google.sku, google.packageName, google.purchaseToken, and google.accessToken');
|
|
498
502
|
}
|
|
499
503
|
return validateReceiptAndroid({
|
|
500
|
-
packageName:
|
|
501
|
-
productId: sku,
|
|
502
|
-
productToken:
|
|
503
|
-
accessToken:
|
|
504
|
-
isSub:
|
|
504
|
+
packageName: google.packageName,
|
|
505
|
+
productId: google.sku,
|
|
506
|
+
productToken: google.purchaseToken,
|
|
507
|
+
accessToken: google.accessToken,
|
|
508
|
+
isSub: google.isSub ?? undefined,
|
|
505
509
|
});
|
|
506
510
|
}
|
|
507
511
|
throw new Error('Platform not supported');
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,EAC1B,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAwB7C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,mBAAmB,EAAqB,MAAM,sBAAsB,CAAC;AAE7E,mBAAmB;AACnB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAE9B,gCAAgC;AAChC,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,oDAAoC,CAAA;IACpC,gDAAgC,CAAA;IAChC,2DAA2C,CAAA;IAC3C,wEAAwD,CAAA;AAC1D,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAwBD,uDAAuD;AACvD,MAAM,CAAC,MA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AAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC","sourcesContent":["// External dependencies\nimport {requireNativeModule} from 'expo-modules-core';\nimport {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from './ExpoIapModule';\nimport {\n isProductIOS,\n validateReceiptIOS,\n deepLinkToSubscriptionsIOS,\n syncIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\nimport {ExpoIapConsole} from './utils/debug';\n\n// Types\nimport type {\n ActiveSubscription,\n AndroidSubscriptionOfferInput,\n DeepLinkOptions,\n MutationField,\n MutationRequestPurchaseArgs,\n MutationValidateReceiptArgs,\n Product,\n ProductQueryType,\n ProductSubscription,\n Purchase,\n PurchaseOptions,\n QueryField,\n RequestPurchasePropsByPlatforms,\n RequestPurchaseAndroidProps,\n RequestPurchaseIosProps,\n RequestSubscriptionPropsByPlatforms,\n RequestSubscriptionAndroidProps,\n RequestSubscriptionIosProps,\n UserChoiceBillingDetails,\n} from './types';\nimport {ErrorCode} from './types';\nimport {createPurchaseError, type PurchaseError} from './utils/errorMapping';\n\n// Export all types\nexport * from './types';\nexport * from './modules/android';\nexport * from './modules/ios';\n\n// Get the native constant value\nexport enum OpenIapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n PromotedProductIOS = 'promoted-product-ios',\n UserChoiceBillingAndroid = 'user-choice-billing-android',\n}\n\ntype ExpoIapEventPayloads = {\n [OpenIapEvent.PurchaseUpdated]: Purchase;\n [OpenIapEvent.PurchaseError]: PurchaseError;\n [OpenIapEvent.PromotedProductIOS]: Product;\n [OpenIapEvent.UserChoiceBillingAndroid]: UserChoiceBillingDetails;\n};\n\ntype ExpoIapEventListener<E extends OpenIapEvent> = (\n payload: ExpoIapEventPayloads[E],\n) => void;\n\ntype ExpoIapEmitter = {\n addListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): {remove: () => void};\n removeListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): void;\n};\n\n// Ensure the emitter has proper EventEmitter interface\nexport const emitter = (ExpoIapModule ||\n requireNativeModule('ExpoIap')) as ExpoIapEmitter;\n\n/**\n * TODO(v3.1.0): Remove legacy 'inapp' alias once downstream apps migrate to 'in-app'.\n */\nexport type ProductTypeInput = ProductQueryType | 'inapp';\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (type === 'inapp') {\n ExpoIapConsole.warn(\n \"'inapp' product type is deprecated and will be removed in v3.1.0. Use 'in-app' instead.\",\n );\n }\n\n if (!type || type === 'inapp' || type === 'in-app') {\n return {\n canonical: 'in-app' as ProductQueryType,\n native: 'in-app' as const,\n };\n }\n if (type === 'subs') {\n return {\n canonical: 'subs' as ProductQueryType,\n native: 'subs' as const,\n };\n }\n if (type === 'all') {\n return {\n canonical: 'all' as ProductQueryType,\n native: 'all' as const,\n };\n }\n throw new Error(`Unsupported product type: ${type}`);\n};\n\nconst normalizePurchasePlatform = (purchase: Purchase): Purchase => {\n const platform = purchase.platform;\n if (typeof platform !== 'string') {\n return purchase;\n }\n\n const lowered = platform.toLowerCase();\n if (lowered === platform || (lowered !== 'ios' && lowered !== 'android')) {\n return purchase;\n }\n\n return {...purchase, platform: lowered};\n};\n\nconst normalizePurchaseArray = (purchases: Purchase[]): Purchase[] =>\n purchases.map((purchase) => normalizePurchasePlatform(purchase));\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const wrappedListener = (event: Purchase) => {\n const normalized = normalizePurchasePlatform(event);\n listener(normalized);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n const wrappedListener = (error: PurchaseError) => {\n listener(error);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseError,\n wrappedListener,\n );\n return emitterSubscription;\n};\n\n/**\n * iOS-only listener for App Store promoted product events.\n * This fires when a user taps on a promoted product in the App Store.\n *\n * @param listener - Callback function that receives the promoted product details\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = promotedProductListenerIOS((product) => {\n * console.log('Promoted product:', product);\n * // Handle the promoted product\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform iOS\n */\nexport const promotedProductListenerIOS = (\n listener: (product: Product) => void,\n) => {\n if (Platform.OS !== 'ios') {\n ExpoIapConsole.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.PromotedProductIOS, listener);\n};\n\n/**\n * Android-only listener for User Choice Billing events.\n * This fires when a user selects alternative billing instead of Google Play billing\n * in the User Choice Billing dialog (only in 'user-choice' mode).\n *\n * @param listener - Callback function that receives the external transaction token and product IDs\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = userChoiceBillingListenerAndroid((details) => {\n * console.log('User selected alternative billing');\n * console.log('Token:', details.externalTransactionToken);\n * console.log('Products:', details.products);\n *\n * // Process payment in your system, then report token to Google\n * await processPaymentAndReportToken(details);\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform Android\n */\nexport const userChoiceBillingListenerAndroid = (\n listener: (details: UserChoiceBillingDetails) => void,\n) => {\n if (Platform.OS !== 'android') {\n ExpoIapConsole.warn(\n 'userChoiceBillingListenerAndroid: This listener is only available on Android',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.UserChoiceBillingAndroid, listener);\n};\n\nexport const initConnection: MutationField<'initConnection'> = async (config) =>\n ExpoIapModule.initConnection(config ?? null);\n\nexport const endConnection: MutationField<'endConnection'> = async () =>\n ExpoIapModule.endConnection();\n\n/**\n * Fetch products with unified API (v2.7.0+)\n *\n * @param request - Product fetch configuration\n * @param request.skus - Array of product SKUs to fetch\n * @param request.type - Product query type: 'in-app', 'subs', or 'all'\n */\nexport const fetchProducts: QueryField<'fetchProducts'> = async (request) => {\n ExpoIapConsole.debug('fetchProducts called with:', request);\n const {skus, type} = request ?? {};\n\n if (!Array.isArray(skus) || skus.length === 0) {\n throw createPurchaseError({\n message: 'No SKUs provided',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {canonical, native} = normalizeProductType(\n type as ProductTypeInput | undefined,\n );\n const skuSet = new Set(skus);\n\n const filterIosItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductIOS(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const filterAndroidItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductAndroid(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const castResult = (\n items: (Product | ProductSubscription)[],\n ):\n | (Product | ProductSubscription)[]\n | Product[]\n | ProductSubscription[]\n | null => {\n if (canonical === 'in-app') {\n return items as Product[];\n }\n if (canonical === 'subs') {\n return items as ProductSubscription[];\n }\n // For 'all' type, items contain both Product and ProductSubscription\n // Return as ProductOrSubscription[] to preserve discriminated union\n return items;\n };\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.fetchProducts({skus, type: native});\n return castResult(filterIosItems(rawItems));\n }\n\n if (Platform.OS === 'android') {\n const rawItems = await ExpoIapModule.fetchProducts(native, skus);\n return castResult(filterAndroidItems(rawItems));\n }\n\n throw new Error('Unsupported platform');\n};\n\nexport const getAvailablePurchases: QueryField<\n 'getAvailablePurchases'\n> = async (options) => {\n const normalizedOptions: PurchaseOptions = {\n alsoPublishToEventListenerIOS:\n options?.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options?.onlyIncludeActiveItemsIOS ?? true,\n };\n\n const resolvePurchases: () => Promise<Purchase[]> =\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n normalizedOptions.alsoPublishToEventListenerIOS,\n normalizedOptions.onlyIncludeActiveItemsIOS,\n ) as Promise<Purchase[]>,\n android: () => ExpoIapModule.getAvailableItems() as Promise<Purchase[]>,\n }) ?? (() => Promise.resolve([] as Purchase[]));\n\n const purchases = await resolvePurchases();\n return normalizePurchaseArray(purchases as Purchase[]);\n};\n\n/**\n * Get all active subscriptions with detailed information.\n * Uses native OpenIAP module for accurate subscription status and renewal info.\n *\n * On iOS: Returns subscriptions with renewalInfoIOS containing pendingUpgradeProductId,\n * willAutoRenew, autoRenewPreference, and other renewal details.\n *\n * On Android: Filters available purchases to find active subscriptions (fallback implementation).\n *\n * @param subscriptionIds - Optional array of subscription product IDs to filter. If not provided, returns all active subscriptions.\n * @returns Promise resolving to array of active subscriptions with details\n *\n * @example\n * ```typescript\n * // Get all active subscriptions\n * const subs = await getActiveSubscriptions();\n *\n * // Get specific subscriptions\n * const premiumSubs = await getActiveSubscriptions(['premium', 'premium_year']);\n *\n * // Check for pending upgrades (iOS)\n * subs.forEach(sub => {\n * if (sub.renewalInfoIOS?.pendingUpgradeProductId) {\n * console.log(`Upgrade pending to: ${sub.renewalInfoIOS.pendingUpgradeProductId}`);\n * }\n * });\n * ```\n */\nexport const getActiveSubscriptions: QueryField<\n 'getActiveSubscriptions'\n> = async (subscriptionIds) => {\n const result = await ExpoIapModule.getActiveSubscriptions(\n subscriptionIds ?? null,\n );\n return (result ?? []) as ActiveSubscription[];\n};\n\n/**\n * Check if user has any active subscriptions.\n *\n * @param subscriptionIds - Optional array of subscription product IDs to check. If not provided, checks all subscriptions.\n * @returns Promise resolving to true if user has at least one active subscription\n *\n * @example\n * ```typescript\n * // Check any active subscription\n * const hasAny = await hasActiveSubscriptions();\n *\n * // Check specific subscriptions\n * const hasPremium = await hasActiveSubscriptions(['premium', 'premium_year']);\n * ```\n */\nexport const hasActiveSubscriptions: QueryField<\n 'hasActiveSubscriptions'\n> = async (subscriptionIds) => {\n return !!(await ExpoIapModule.hasActiveSubscriptions(\n subscriptionIds ?? null,\n ));\n};\n\nexport const getStorefront: QueryField<'getStorefront'> = async () => {\n if (Platform.OS !== 'ios' && Platform.OS !== 'android') {\n return '';\n }\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'ios',\n): RequestPurchaseIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'android',\n): RequestPurchaseAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'ios',\n): RequestSubscriptionIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'android',\n): RequestSubscriptionAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request:\n | RequestPurchasePropsByPlatforms\n | RequestSubscriptionPropsByPlatforms,\n platform: 'ios' | 'android',\n) {\n // Support both new (apple/google) and legacy (ios/android) field names\n // New fields take precedence over deprecated ones\n if (platform === 'ios') {\n return request.apple ?? request.ios;\n }\n return request.google ?? request.android;\n}\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Store-specific purchase parameters\n * @param requestObj.type - Type of purchase: 'in-app' for products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Product purchase (recommended: use apple/google)\n * await requestPurchase({\n * request: {\n * apple: { sku: productId },\n * google: { skus: [productId] }\n * },\n * type: 'in-app'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * apple: { sku: subscriptionId },\n * google: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n *\n * // Legacy format (deprecated, but still supported)\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'in-app'\n * });\n * ```\n */\nexport const requestPurchase: MutationField<'requestPurchase'> = async (\n args,\n) => {\n const {request, type} = args;\n const {canonical, native} = normalizeProductType(type as ProductTypeInput);\n const isInAppPurchase = canonical === 'in-app';\n\n if (Platform.OS === 'ios') {\n const normalizedRequest = normalizeRequestProps(request, 'ios');\n\n if (!normalizedRequest?.sku) {\n throw new Error(\n 'Invalid request for Apple. The `sku` property is required and must be a string.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n if (canonical !== 'in-app' && canonical !== 'subs') {\n throw new Error(`Unsupported product type: ${canonical}`);\n }\n\n const payload: MutationRequestPurchaseArgs = {\n type: canonical === 'in-app' ? 'in-app' : 'subs',\n request: {ios: normalizedRequest},\n useAlternativeBilling: args.useAlternativeBilling,\n };\n\n const purchase = (await ExpoIapModule.requestPurchase(payload)) as\n | Purchase\n | Purchase[]\n | null;\n\n if (Array.isArray(purchase)) {\n return normalizePurchaseArray(purchase);\n }\n\n if (purchase) {\n return normalizePurchasePlatform(purchase);\n }\n\n return canonical === 'subs' ? [] : null;\n }\n\n if (Platform.OS === 'android') {\n if (isInAppPurchase) {\n const normalizedRequest = normalizeRequestProps(\n request as RequestPurchasePropsByPlatforms,\n 'android',\n ) as RequestPurchaseAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n const result = (await ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n })) as Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n if (canonical === 'subs') {\n const normalizedRequest = normalizeRequestProps(\n request as RequestSubscriptionPropsByPlatforms,\n 'android',\n ) as RequestSubscriptionAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"subscription_id\" },\\n' +\n ' google: { skus: [\"subscription_id\"] }\\n' +\n ' },\\n' +\n ' type: \"subs\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers,\n replacementModeAndroid,\n purchaseTokenAndroid,\n } = normalizedRequest;\n\n const normalizedOffers = subscriptionOffers ?? [];\n const replacementMode = replacementModeAndroid ?? -1;\n const purchaseToken = purchaseTokenAndroid ?? undefined;\n\n const result = (await ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken,\n replacementMode,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: normalizedOffers.map(\n (offer: AndroidSubscriptionOfferInput) => offer.offerToken,\n ),\n subscriptionOffers: normalizedOffers,\n isOfferPersonalized: isOfferPersonalized ?? false,\n })) as Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n throw new Error('Platform not supported');\n};\n\nexport const finishTransaction: MutationField<'finishTransaction'> = async ({\n purchase,\n isConsumable = false,\n}) => {\n if (Platform.OS === 'ios') {\n await ExpoIapModule.finishTransaction(purchase, isConsumable);\n return;\n }\n\n if (Platform.OS === 'android') {\n const token = purchase.purchaseToken ?? undefined;\n\n if (!token) {\n throw createPurchaseError({\n message: 'Purchase token is required to finish transaction',\n code: ErrorCode.DeveloperError,\n productId: purchase.productId,\n platform: 'android',\n });\n }\n\n if (isConsumable) {\n await ExpoIapModule.consumePurchaseAndroid(token);\n return;\n }\n\n await ExpoIapModule.acknowledgePurchaseAndroid(token);\n return;\n }\n\n throw new Error('Unsupported Platform');\n};\n\n/**\n * Restore completed transactions (cross-platform behavior)\n *\n * - iOS: perform a lightweight sync to refresh transactions and ignore sync errors,\n * then fetch available purchases to surface restored items to the app.\n * - Android: simply fetch available purchases (restoration happens via query).\n *\n * This helper triggers the refresh flows but does not return the purchases; consumers should\n * call `getAvailablePurchases` or rely on hook state to inspect the latest items.\n */\nexport const restorePurchases: MutationField<'restorePurchases'> = async () => {\n if (Platform.OS === 'ios') {\n await syncIOS().catch(() => undefined);\n }\n\n await getAvailablePurchases({\n alsoPublishToEventListenerIOS: false,\n onlyIncludeActiveItemsIOS: true,\n });\n};\n\n/**\n * Deeplinks to native interface that allows users to manage their subscriptions\n * @param options.skuAndroid - Required for Android to locate specific subscription (ignored on iOS)\n * @param options.packageNameAndroid - Required for Android to identify your app (ignored on iOS)\n *\n * @returns Promise that resolves when the deep link is successfully opened\n *\n * @throws {Error} When called on unsupported platform or when required Android parameters are missing\n *\n * @example\n * import { deepLinkToSubscriptions } from 'expo-iap';\n *\n * // Works on both iOS and Android\n * await deepLinkToSubscriptions({\n * skuAndroid: 'your_subscription_sku',\n * packageNameAndroid: 'com.example.app'\n * });\n */\nexport const deepLinkToSubscriptions: MutationField<\n 'deepLinkToSubscriptions'\n> = async (options) => {\n if (Platform.OS === 'ios') {\n await deepLinkToSubscriptionsIOS();\n return;\n }\n\n if (Platform.OS === 'android') {\n await deepLinkToSubscriptionsAndroid((options as DeepLinkOptions) ?? null);\n return;\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\n/**\n * Internal receipt validation function (NOT RECOMMENDED for production use)\n *\n * WARNING: This function performs client-side validation which is NOT secure.\n * For production apps, always validate receipts on your secure server:\n * - iOS: Send receipt data to Apple's verification endpoint from your server\n * - Android: Use Google Play Developer API with service account credentials\n *\n * @deprecated Use verifyPurchase instead\n */\nexport const validateReceipt: MutationField<'validateReceipt'> = async (\n options,\n) => {\n const {sku, androidOptions} = options as MutationValidateReceiptArgs;\n\n if (Platform.OS === 'ios') {\n return validateReceiptIOS({sku});\n }\n\n if (Platform.OS === 'android') {\n if (\n !androidOptions ||\n !androidOptions.packageName ||\n !androidOptions.productToken ||\n !androidOptions.accessToken\n ) {\n throw new Error(\n 'Android validation requires packageName, productToken, and accessToken',\n );\n }\n return validateReceiptAndroid({\n packageName: androidOptions.packageName,\n productId: sku,\n productToken: androidOptions.productToken,\n accessToken: androidOptions.accessToken,\n isSub: androidOptions.isSub ?? undefined,\n });\n }\n\n throw new Error('Platform not supported');\n};\n\n/**\n * Verify purchase with the configured providers\n *\n * This function uses the native OpenIAP verifyPurchase implementation\n * which validates purchases using platform-specific methods.\n *\n * @param options - Receipt validation options containing the SKU\n * @returns Promise resolving to receipt validation result\n */\nexport const verifyPurchase: MutationField<'verifyPurchase'> = async (\n options,\n) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n return ExpoIapModule.verifyPurchase(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\n/**\n * Verify purchase with a specific provider (e.g., IAPKit)\n *\n * This function allows you to verify purchases using external verification\n * services like IAPKit, which provide additional validation and security.\n *\n * @param options - Verification options including provider and credentials\n * @returns Promise resolving to provider-specific verification result\n *\n * @example\n * ```typescript\n * const result = await verifyPurchaseWithProvider({\n * provider: 'iapkit',\n * iapkit: {\n * apiKey: 'your-api-key',\n * apple: {\n * jws: purchase.purchaseToken // JWS from purchase\n * },\n * google: {\n * purchaseToken: purchase.purchaseToken\n * }\n * }\n * });\n * ```\n */\nexport const verifyPurchaseWithProvider: MutationField<\n 'verifyPurchaseWithProvider'\n> = async (options) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n return ExpoIapModule.verifyPurchaseWithProvider(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\nexport * from './useIAP';\nexport {\n ErrorCodeUtils,\n ErrorCodeMapping,\n createPurchaseError,\n createPurchaseErrorFromPlatform,\n} from './utils/errorMapping';\nexport type {\n PurchaseError as ExpoPurchaseError,\n PurchaseErrorProps,\n} from './utils/errorMapping';\nexport {ExpoIapConsole} from './utils/debug';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,EAC1B,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,GAC/B,MAA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;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAoC,KAAK,EAClE,OAAO,EACP,EAAE;IACF,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QACvD,OAAO,aAAa,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAEnC,KAAK,EAAE,OAAO,EAAE,EAAE;IACpB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QACvD,OAAO,aAAa,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC","sourcesContent":["// External dependencies\nimport {requireNativeModule} from 'expo-modules-core';\nimport {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from './ExpoIapModule';\nimport {\n isProductIOS,\n validateReceiptIOS,\n deepLinkToSubscriptionsIOS,\n syncIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\nimport {ExpoIapConsole} from './utils/debug';\n\n// Types\nimport type {\n ActiveSubscription,\n AndroidSubscriptionOfferInput,\n DeepLinkOptions,\n MutationField,\n MutationRequestPurchaseArgs,\n MutationValidateReceiptArgs,\n Product,\n ProductQueryType,\n ProductSubscription,\n Purchase,\n PurchaseOptions,\n QueryField,\n RequestPurchasePropsByPlatforms,\n RequestPurchaseAndroidProps,\n RequestPurchaseIosProps,\n RequestSubscriptionPropsByPlatforms,\n RequestSubscriptionAndroidProps,\n RequestSubscriptionIosProps,\n UserChoiceBillingDetails,\n} from './types';\nimport {ErrorCode} from './types';\nimport {createPurchaseError, type PurchaseError} from './utils/errorMapping';\n\n// Export all types\nexport * from './types';\nexport * from './modules/android';\nexport * from './modules/ios';\n\n// Get the native constant value\nexport enum OpenIapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n PromotedProductIOS = 'promoted-product-ios',\n UserChoiceBillingAndroid = 'user-choice-billing-android',\n}\n\ntype ExpoIapEventPayloads = {\n [OpenIapEvent.PurchaseUpdated]: Purchase;\n [OpenIapEvent.PurchaseError]: PurchaseError;\n [OpenIapEvent.PromotedProductIOS]: Product;\n [OpenIapEvent.UserChoiceBillingAndroid]: UserChoiceBillingDetails;\n};\n\ntype ExpoIapEventListener<E extends OpenIapEvent> = (\n payload: ExpoIapEventPayloads[E],\n) => void;\n\ntype ExpoIapEmitter = {\n addListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): {remove: () => void};\n removeListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): void;\n};\n\n// Ensure the emitter has proper EventEmitter interface\nexport const emitter = (ExpoIapModule ||\n requireNativeModule('ExpoIap')) as ExpoIapEmitter;\n\n/**\n * TODO(v3.1.0): Remove legacy 'inapp' alias once downstream apps migrate to 'in-app'.\n */\nexport type ProductTypeInput = ProductQueryType | 'inapp';\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (type === 'inapp') {\n ExpoIapConsole.warn(\n \"'inapp' product type is deprecated and will be removed in v3.1.0. Use 'in-app' instead.\",\n );\n }\n\n if (!type || type === 'inapp' || type === 'in-app') {\n return {\n canonical: 'in-app' as ProductQueryType,\n native: 'in-app' as const,\n };\n }\n if (type === 'subs') {\n return {\n canonical: 'subs' as ProductQueryType,\n native: 'subs' as const,\n };\n }\n if (type === 'all') {\n return {\n canonical: 'all' as ProductQueryType,\n native: 'all' as const,\n };\n }\n throw new Error(`Unsupported product type: ${type}`);\n};\n\nconst normalizePurchasePlatform = (purchase: Purchase): Purchase => {\n const platform = purchase.platform;\n if (typeof platform !== 'string') {\n return purchase;\n }\n\n const lowered = platform.toLowerCase();\n if (lowered === platform || (lowered !== 'ios' && lowered !== 'android')) {\n return purchase;\n }\n\n return {...purchase, platform: lowered};\n};\n\nconst normalizePurchaseArray = (purchases: Purchase[]): Purchase[] =>\n purchases.map((purchase) => normalizePurchasePlatform(purchase));\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const wrappedListener = (event: Purchase) => {\n const normalized = normalizePurchasePlatform(event);\n listener(normalized);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n const wrappedListener = (error: PurchaseError) => {\n listener(error);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseError,\n wrappedListener,\n );\n return emitterSubscription;\n};\n\n/**\n * iOS-only listener for App Store promoted product events.\n * This fires when a user taps on a promoted product in the App Store.\n *\n * @param listener - Callback function that receives the promoted product details\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = promotedProductListenerIOS((product) => {\n * console.log('Promoted product:', product);\n * // Handle the promoted product\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform iOS\n */\nexport const promotedProductListenerIOS = (\n listener: (product: Product) => void,\n) => {\n if (Platform.OS !== 'ios') {\n ExpoIapConsole.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.PromotedProductIOS, listener);\n};\n\n/**\n * Android-only listener for User Choice Billing events.\n * This fires when a user selects alternative billing instead of Google Play billing\n * in the User Choice Billing dialog (only in 'user-choice' mode).\n *\n * @param listener - Callback function that receives the external transaction token and product IDs\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = userChoiceBillingListenerAndroid((details) => {\n * console.log('User selected alternative billing');\n * console.log('Token:', details.externalTransactionToken);\n * console.log('Products:', details.products);\n *\n * // Process payment in your system, then report token to Google\n * await processPaymentAndReportToken(details);\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform Android\n */\nexport const userChoiceBillingListenerAndroid = (\n listener: (details: UserChoiceBillingDetails) => void,\n) => {\n if (Platform.OS !== 'android') {\n ExpoIapConsole.warn(\n 'userChoiceBillingListenerAndroid: This listener is only available on Android',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.UserChoiceBillingAndroid, listener);\n};\n\nexport const initConnection: MutationField<'initConnection'> = async (config) =>\n ExpoIapModule.initConnection(config ?? null);\n\nexport const endConnection: MutationField<'endConnection'> = async () =>\n ExpoIapModule.endConnection();\n\n/**\n * Fetch products with unified API (v2.7.0+)\n *\n * @param request - Product fetch configuration\n * @param request.skus - Array of product SKUs to fetch\n * @param request.type - Product query type: 'in-app', 'subs', or 'all'\n */\nexport const fetchProducts: QueryField<'fetchProducts'> = async (request) => {\n ExpoIapConsole.debug('fetchProducts called with:', request);\n const {skus, type} = request ?? {};\n\n if (!Array.isArray(skus) || skus.length === 0) {\n throw createPurchaseError({\n message: 'No SKUs provided',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {canonical, native} = normalizeProductType(\n type as ProductTypeInput | undefined,\n );\n const skuSet = new Set(skus);\n\n const filterIosItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductIOS(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const filterAndroidItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductAndroid(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const castResult = (\n items: (Product | ProductSubscription)[],\n ):\n | (Product | ProductSubscription)[]\n | Product[]\n | ProductSubscription[]\n | null => {\n if (canonical === 'in-app') {\n return items as Product[];\n }\n if (canonical === 'subs') {\n return items as ProductSubscription[];\n }\n // For 'all' type, items contain both Product and ProductSubscription\n // Return as ProductOrSubscription[] to preserve discriminated union\n return items;\n };\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.fetchProducts({skus, type: native});\n return castResult(filterIosItems(rawItems));\n }\n\n if (Platform.OS === 'android') {\n const rawItems = await ExpoIapModule.fetchProducts(native, skus);\n return castResult(filterAndroidItems(rawItems));\n }\n\n throw new Error('Unsupported platform');\n};\n\nexport const getAvailablePurchases: QueryField<\n 'getAvailablePurchases'\n> = async (options) => {\n const normalizedOptions: PurchaseOptions = {\n alsoPublishToEventListenerIOS:\n options?.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options?.onlyIncludeActiveItemsIOS ?? true,\n };\n\n const resolvePurchases: () => Promise<Purchase[]> =\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n normalizedOptions.alsoPublishToEventListenerIOS,\n normalizedOptions.onlyIncludeActiveItemsIOS,\n ) as Promise<Purchase[]>,\n android: () => ExpoIapModule.getAvailableItems() as Promise<Purchase[]>,\n }) ?? (() => Promise.resolve([] as Purchase[]));\n\n const purchases = await resolvePurchases();\n return normalizePurchaseArray(purchases as Purchase[]);\n};\n\n/**\n * Get all active subscriptions with detailed information.\n * Uses native OpenIAP module for accurate subscription status and renewal info.\n *\n * On iOS: Returns subscriptions with renewalInfoIOS containing pendingUpgradeProductId,\n * willAutoRenew, autoRenewPreference, and other renewal details.\n *\n * On Android: Filters available purchases to find active subscriptions (fallback implementation).\n *\n * @param subscriptionIds - Optional array of subscription product IDs to filter. If not provided, returns all active subscriptions.\n * @returns Promise resolving to array of active subscriptions with details\n *\n * @example\n * ```typescript\n * // Get all active subscriptions\n * const subs = await getActiveSubscriptions();\n *\n * // Get specific subscriptions\n * const premiumSubs = await getActiveSubscriptions(['premium', 'premium_year']);\n *\n * // Check for pending upgrades (iOS)\n * subs.forEach(sub => {\n * if (sub.renewalInfoIOS?.pendingUpgradeProductId) {\n * console.log(`Upgrade pending to: ${sub.renewalInfoIOS.pendingUpgradeProductId}`);\n * }\n * });\n * ```\n */\nexport const getActiveSubscriptions: QueryField<\n 'getActiveSubscriptions'\n> = async (subscriptionIds) => {\n const result = await ExpoIapModule.getActiveSubscriptions(\n subscriptionIds ?? null,\n );\n return (result ?? []) as ActiveSubscription[];\n};\n\n/**\n * Check if user has any active subscriptions.\n *\n * @param subscriptionIds - Optional array of subscription product IDs to check. If not provided, checks all subscriptions.\n * @returns Promise resolving to true if user has at least one active subscription\n *\n * @example\n * ```typescript\n * // Check any active subscription\n * const hasAny = await hasActiveSubscriptions();\n *\n * // Check specific subscriptions\n * const hasPremium = await hasActiveSubscriptions(['premium', 'premium_year']);\n * ```\n */\nexport const hasActiveSubscriptions: QueryField<\n 'hasActiveSubscriptions'\n> = async (subscriptionIds) => {\n return !!(await ExpoIapModule.hasActiveSubscriptions(\n subscriptionIds ?? null,\n ));\n};\n\nexport const getStorefront: QueryField<'getStorefront'> = async () => {\n if (Platform.OS !== 'ios' && Platform.OS !== 'android') {\n return '';\n }\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'ios',\n): RequestPurchaseIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'android',\n): RequestPurchaseAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'ios',\n): RequestSubscriptionIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'android',\n): RequestSubscriptionAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request:\n | RequestPurchasePropsByPlatforms\n | RequestSubscriptionPropsByPlatforms,\n platform: 'ios' | 'android',\n) {\n // Support both new (apple/google) and legacy (ios/android) field names\n // New fields take precedence over deprecated ones\n if (platform === 'ios') {\n return request.apple ?? request.ios;\n }\n return request.google ?? request.android;\n}\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Store-specific purchase parameters\n * @param requestObj.type - Type of purchase: 'in-app' for products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Product purchase (recommended: use apple/google)\n * await requestPurchase({\n * request: {\n * apple: { sku: productId },\n * google: { skus: [productId] }\n * },\n * type: 'in-app'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * apple: { sku: subscriptionId },\n * google: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n *\n * // Legacy format (deprecated, but still supported)\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'in-app'\n * });\n * ```\n */\nexport const requestPurchase: MutationField<'requestPurchase'> = async (\n args,\n) => {\n const {request, type} = args;\n const {canonical, native} = normalizeProductType(type as ProductTypeInput);\n const isInAppPurchase = canonical === 'in-app';\n\n if (Platform.OS === 'ios') {\n const normalizedRequest = normalizeRequestProps(request, 'ios');\n\n if (!normalizedRequest?.sku) {\n throw new Error(\n 'Invalid request for Apple. The `sku` property is required and must be a string.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n if (canonical !== 'in-app' && canonical !== 'subs') {\n throw new Error(`Unsupported product type: ${canonical}`);\n }\n\n const payload: MutationRequestPurchaseArgs = {\n type: canonical === 'in-app' ? 'in-app' : 'subs',\n request: {ios: normalizedRequest},\n useAlternativeBilling: args.useAlternativeBilling,\n };\n\n const purchase = (await ExpoIapModule.requestPurchase(payload)) as\n | Purchase\n | Purchase[]\n | null;\n\n if (Array.isArray(purchase)) {\n return normalizePurchaseArray(purchase);\n }\n\n if (purchase) {\n return normalizePurchasePlatform(purchase);\n }\n\n return canonical === 'subs' ? [] : null;\n }\n\n if (Platform.OS === 'android') {\n if (isInAppPurchase) {\n const normalizedRequest = normalizeRequestProps(\n request as RequestPurchasePropsByPlatforms,\n 'android',\n ) as RequestPurchaseAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n const result = (await ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n })) as Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n if (canonical === 'subs') {\n const normalizedRequest = normalizeRequestProps(\n request as RequestSubscriptionPropsByPlatforms,\n 'android',\n ) as RequestSubscriptionAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"subscription_id\" },\\n' +\n ' google: { skus: [\"subscription_id\"] }\\n' +\n ' },\\n' +\n ' type: \"subs\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers,\n replacementModeAndroid,\n purchaseTokenAndroid,\n } = normalizedRequest;\n\n const normalizedOffers = subscriptionOffers ?? [];\n const replacementMode = replacementModeAndroid ?? -1;\n const purchaseToken = purchaseTokenAndroid ?? undefined;\n\n const result = (await ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken,\n replacementMode,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: normalizedOffers.map(\n (offer: AndroidSubscriptionOfferInput) => offer.offerToken,\n ),\n subscriptionOffers: normalizedOffers,\n isOfferPersonalized: isOfferPersonalized ?? false,\n })) as Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n throw new Error('Platform not supported');\n};\n\nexport const finishTransaction: MutationField<'finishTransaction'> = async ({\n purchase,\n isConsumable = false,\n}) => {\n if (Platform.OS === 'ios') {\n await ExpoIapModule.finishTransaction(purchase, isConsumable);\n return;\n }\n\n if (Platform.OS === 'android') {\n const token = purchase.purchaseToken ?? undefined;\n\n if (!token) {\n throw createPurchaseError({\n message: 'Purchase token is required to finish transaction',\n code: ErrorCode.DeveloperError,\n productId: purchase.productId,\n platform: 'android',\n });\n }\n\n if (isConsumable) {\n await ExpoIapModule.consumePurchaseAndroid(token);\n return;\n }\n\n await ExpoIapModule.acknowledgePurchaseAndroid(token);\n return;\n }\n\n throw new Error('Unsupported Platform');\n};\n\n/**\n * Restore completed transactions (cross-platform behavior)\n *\n * - iOS: perform a lightweight sync to refresh transactions and ignore sync errors,\n * then fetch available purchases to surface restored items to the app.\n * - Android: simply fetch available purchases (restoration happens via query).\n *\n * This helper triggers the refresh flows but does not return the purchases; consumers should\n * call `getAvailablePurchases` or rely on hook state to inspect the latest items.\n */\nexport const restorePurchases: MutationField<'restorePurchases'> = async () => {\n if (Platform.OS === 'ios') {\n await syncIOS().catch(() => undefined);\n }\n\n await getAvailablePurchases({\n alsoPublishToEventListenerIOS: false,\n onlyIncludeActiveItemsIOS: true,\n });\n};\n\n/**\n * Deeplinks to native interface that allows users to manage their subscriptions\n * @param options.skuAndroid - Required for Android to locate specific subscription (ignored on iOS)\n * @param options.packageNameAndroid - Required for Android to identify your app (ignored on iOS)\n *\n * @returns Promise that resolves when the deep link is successfully opened\n *\n * @throws {Error} When called on unsupported platform or when required Android parameters are missing\n *\n * @example\n * import { deepLinkToSubscriptions } from 'expo-iap';\n *\n * // Works on both iOS and Android\n * await deepLinkToSubscriptions({\n * skuAndroid: 'your_subscription_sku',\n * packageNameAndroid: 'com.example.app'\n * });\n */\nexport const deepLinkToSubscriptions: MutationField<\n 'deepLinkToSubscriptions'\n> = async (options) => {\n if (Platform.OS === 'ios') {\n await deepLinkToSubscriptionsIOS();\n return;\n }\n\n if (Platform.OS === 'android') {\n await deepLinkToSubscriptionsAndroid((options as DeepLinkOptions) ?? null);\n return;\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\n/**\n * Internal receipt validation function (NOT RECOMMENDED for production use)\n *\n * WARNING: This function performs client-side validation which is NOT secure.\n * For production apps, always validate receipts on your secure server:\n * - iOS: Send receipt data to Apple's verification endpoint from your server\n * - Android: Use Google Play Developer API with service account credentials\n *\n * @deprecated Use verifyPurchase instead\n */\nexport const validateReceipt: MutationField<'validateReceipt'> = async (\n options,\n) => {\n const {apple, google} = options as MutationValidateReceiptArgs;\n\n if (Platform.OS === 'ios') {\n if (!apple?.sku) {\n throw new Error('iOS validation requires apple.sku');\n }\n return validateReceiptIOS({apple: {sku: apple.sku}});\n }\n\n if (Platform.OS === 'android') {\n if (\n !google ||\n !google.sku ||\n !google.packageName ||\n !google.purchaseToken ||\n !google.accessToken\n ) {\n throw new Error(\n 'Android validation requires google.sku, google.packageName, google.purchaseToken, and google.accessToken',\n );\n }\n return validateReceiptAndroid({\n packageName: google.packageName,\n productId: google.sku,\n productToken: google.purchaseToken,\n accessToken: google.accessToken,\n isSub: google.isSub ?? undefined,\n });\n }\n\n throw new Error('Platform not supported');\n};\n\n/**\n * Verify purchase with the configured providers\n *\n * This function uses the native OpenIAP verifyPurchase implementation\n * which validates purchases using platform-specific methods.\n *\n * @param options - Receipt validation options containing the SKU\n * @returns Promise resolving to receipt validation result\n */\nexport const verifyPurchase: MutationField<'verifyPurchase'> = async (\n options,\n) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n return ExpoIapModule.verifyPurchase(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\n/**\n * Verify purchase with a specific provider (e.g., IAPKit)\n *\n * This function allows you to verify purchases using external verification\n * services like IAPKit, which provide additional validation and security.\n *\n * @param options - Verification options including provider and credentials\n * @returns Promise resolving to provider-specific verification result\n *\n * @example\n * ```typescript\n * const result = await verifyPurchaseWithProvider({\n * provider: 'iapkit',\n * iapkit: {\n * apiKey: 'your-api-key',\n * apple: {\n * jws: purchase.purchaseToken // JWS from purchase\n * },\n * google: {\n * purchaseToken: purchase.purchaseToken\n * }\n * }\n * });\n * ```\n */\nexport const verifyPurchaseWithProvider: MutationField<\n 'verifyPurchaseWithProvider'\n> = async (options) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n return ExpoIapModule.verifyPurchaseWithProvider(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\nexport * from './useIAP';\nexport {\n ErrorCodeUtils,\n ErrorCodeMapping,\n createPurchaseError,\n createPurchaseErrorFromPlatform,\n} from './utils/errorMapping';\nexport type {\n PurchaseError as ExpoPurchaseError,\n PurchaseErrorProps,\n} from './utils/errorMapping';\nexport {ExpoIapConsole} from './utils/debug';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGV,aAAa,EAEb,QAAQ,EAER,UAAU,EAIX,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAGzD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAKF,wBAAgB,YAAY,CAAC,CAAC,SAAS;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,EACxD,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,CAAC,GAAG;IAAC,QAAQ,EAAE,KAAK,CAAA;CAAC,CAQ/B;AAGD;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,SAAS,CAE5C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,UAAU,CACjD,4BAA4B,CAM7B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,EAAE,UAAU,CAC5C,uBAAuB,CAOxB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,EAAE,UAAU,CAC5C,uBAAuB,CAOxB,CAAC;AAEF;;;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;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAC7C,qBAAqB,CAGtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,QAAO,OAAO,CAAC,IAAI,CACO,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,EAAE,UAAU,CAC1D,qCAAqC,CAGtC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,EAAE,aAAa,CAC/D,uCAAuC,CAIxC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,EAAE,aAAa,CACxD,gCAAgC,CAIjC,CAAC"}
|
package/build/modules/ios.js
CHANGED
|
@@ -181,9 +181,11 @@ export const getTransactionJwsIOS = async (sku) => {
|
|
|
181
181
|
* }>}
|
|
182
182
|
*/
|
|
183
183
|
const validateReceiptIOSImpl = async (props) => {
|
|
184
|
-
const sku = typeof props === 'string'
|
|
184
|
+
const sku = typeof props === 'string'
|
|
185
|
+
? props
|
|
186
|
+
: props?.apple?.sku;
|
|
185
187
|
if (!sku) {
|
|
186
|
-
throw new Error('validateReceiptIOS requires a SKU');
|
|
188
|
+
throw new Error('validateReceiptIOS requires a SKU (via apple.sku)');
|
|
187
189
|
}
|
|
188
190
|
return (await ExpoIapModule.validateReceiptIOS(sku));
|
|
189
191
|
};
|
package/build/modules/ios.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,mBAAmB;AACnB,mEAAmE;AACnE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAgB7C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAOrC,YAAY;AAEZ,cAAc;AACd,MAAM,UAAU,YAAY,CAC1B,IAAa;IAEb,OAAO,CACL,IAAI,IAAI,IAAI;QACZ,OAAO,IAAI,KAAK,QAAQ;QACxB,UAAU,IA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AE,EAAE;IACxB,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,8BAA8B,CAAC,GAAG,CAAC,CAAC;IACvE,OAAO,MAAuC,CAAC;AACjD,CAAC,CAAC;AAEF,uEAAuE","sourcesContent":["// External dependencies\n\n// Internal modules\n// import removed: use purchaseUpdatedListener directly in app code\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport type {\n ExternalPurchaseLinkResultIOS,\n ExternalPurchaseNoticeResultIOS,\n MutationField,\n ProductIOS,\n Purchase,\n PurchaseIOS,\n QueryField,\n VerifyPurchaseProps,\n VerifyPurchaseResultIOS,\n SubscriptionStatusIOS,\n} from '../types';\nimport type {PurchaseError} from '../utils/errorMapping';\nimport {Linking} from 'react-native';\n\nexport type TransactionEvent = {\n transaction?: Purchase;\n error?: PurchaseError;\n};\n\n// Listeners\n\n// Type guards\nexport function isProductIOS<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'ios'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n typeof (item as any).platform === 'string' &&\n (item as any).platform.toLowerCase() === 'ios'\n );\n}\n\n// Functions\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const syncIOS: MutationField<'syncIOS'> = async () => {\n return !!(await ExpoIapModule.syncIOS());\n};\n\n/**\n * Check if user is eligible for introductory offer\n *\n * @param groupId The subscription group ID\n * @returns Promise resolving to true if eligible\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const isEligibleForIntroOfferIOS: QueryField<\n 'isEligibleForIntroOfferIOS'\n> = async (groupID) => {\n if (!groupID) {\n throw new Error('isEligibleForIntroOfferIOS requires a groupID');\n }\n return ExpoIapModule.isEligibleForIntroOfferIOS(groupID);\n};\n\n/**\n * Get subscription status for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to array of subscription status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const subscriptionStatusIOS: QueryField<\n 'subscriptionStatusIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('subscriptionStatusIOS requires a SKU');\n }\n const status = await ExpoIapModule.subscriptionStatusIOS(sku);\n return (status ?? []) as SubscriptionStatusIOS[];\n};\n\n/**\n * Get current entitlement for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to current entitlement\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const currentEntitlementIOS: QueryField<\n 'currentEntitlementIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('currentEntitlementIOS requires a SKU');\n }\n const purchase = await ExpoIapModule.currentEntitlementIOS(sku);\n return (purchase ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Get latest transaction for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to latest transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (\n sku,\n) => {\n if (!sku) {\n throw new Error('latestTransactionIOS requires a SKU');\n }\n const transaction = await ExpoIapModule.latestTransactionIOS(sku);\n return (transaction ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Begin refund request for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to refund request status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const beginRefundRequestIOS: MutationField<\n 'beginRefundRequestIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('beginRefundRequestIOS requires a SKU');\n }\n const status = await ExpoIapModule.beginRefundRequestIOS(sku);\n return status ?? null;\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * Returns an array of subscriptions that had status changes after the UI is closed.\n *\n * @returns Promise<Purchase[]> - Array of subscriptions with status changes (e.g., auto-renewal toggled)\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const showManageSubscriptionsIOS: MutationField<\n 'showManageSubscriptionsIOS'\n> = async () => {\n const purchases = await ExpoIapModule.showManageSubscriptionsIOS();\n return (purchases ?? []) as PurchaseIOS[];\n};\n\n/**\n * Get the receipt data from the iOS device.\n * This returns the base64 encoded receipt data which can be sent to your server\n * for verification with Apple's server.\n *\n * NOTE: For proper security, always verify receipts on your server using\n * Apple's verifyReceipt endpoint, not directly from the app.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n */\nexport const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {\n return ExpoIapModule.getReceiptDataIOS();\n};\n\nexport const getReceiptIOS = getReceiptDataIOS;\n\n/**\n * Check if a transaction is verified through StoreKit 2.\n * StoreKit 2 performs local verification of transaction JWS signatures.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to true if the transaction is verified\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const isTransactionVerifiedIOS: QueryField<\n 'isTransactionVerifiedIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('isTransactionVerifiedIOS requires a SKU');\n }\n return ExpoIapModule.isTransactionVerifiedIOS(sku);\n};\n\n/**\n * Get the JWS representation of a purchase for server-side verification.\n * The JWS (JSON Web Signature) can be verified on your server using Apple's public keys.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to JWS representation of the transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (\n sku,\n) => {\n if (!sku) {\n throw new Error('getTransactionJwsIOS requires a SKU');\n }\n const jws = await ExpoIapModule.getTransactionJwsIOS(sku);\n return jws ?? '';\n};\n\n/**\n * Validate receipt for iOS using StoreKit 2's built-in verification.\n * Returns receipt data and verification information to help with server-side validation.\n *\n * NOTE: For proper security, Apple recommends verifying receipts on your server using\n * the verifyReceipt endpoint rather than relying solely on client-side verification.\n *\n * @deprecated Use verifyPurchase instead\n * @param props The product's SKU or verification props\n * @returns {Promise<{\n * isValid: boolean;\n * receiptData: string;\n * jwsRepresentation: string;\n * latestTransaction?: Purchase;\n * }>}\n */\nconst validateReceiptIOSImpl = async (props: VerifyPurchaseProps | string) => {\n const sku =\n typeof props === 'string' ? props : (props as VerifyPurchaseProps)?.sku;\n\n if (!sku) {\n throw new Error('validateReceiptIOS requires a SKU');\n }\n\n return (await ExpoIapModule.validateReceiptIOS(\n sku,\n )) as VerifyPurchaseResultIOS;\n};\n\nexport const validateReceiptIOS =\n validateReceiptIOSImpl as QueryField<'validateReceiptIOS'>;\n\n/**\n * Present the code redemption sheet for offer codes (iOS only).\n * This allows users to redeem promotional codes for in-app purchases and subscriptions.\n *\n * Note: This only works on real devices, not simulators.\n *\n * @returns Promise resolving to true if the sheet was presented successfully\n * @throws Error if called on non-iOS platform or tvOS\n *\n * @platform iOS\n */\nexport const presentCodeRedemptionSheetIOS: MutationField<\n 'presentCodeRedemptionSheetIOS'\n> = async () => {\n return !!(await ExpoIapModule.presentCodeRedemptionSheetIOS());\n};\n\n/**\n * Get app transaction information (iOS 16.0+).\n * AppTransaction represents the initial purchase that unlocked the app.\n *\n * NOTE: This function requires:\n * - iOS 16.0 or later at runtime\n * - Xcode 15.0+ with iOS 16.0 SDK for compilation\n *\n * @returns Promise resolving to the app transaction information or null if not available\n * @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK\n *\n * @platform iOS\n * @since iOS 16.0\n */\nexport const getAppTransactionIOS: QueryField<\n 'getAppTransactionIOS'\n> = async () => {\n return (await ExpoIapModule.getAppTransactionIOS()) ?? null;\n};\n\n/**\n * Get information about a promoted product if one is available (iOS only).\n * Promoted products are products that the App Store promotes on your behalf.\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product information or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getPromotedProductIOS: QueryField<\n 'getPromotedProductIOS'\n> = async () => {\n const product = await ExpoIapModule.getPromotedProductIOS();\n return (product ?? null) as ProductIOS | null;\n};\n\n/**\n * Complete the purchase of a promoted product (iOS only).\n * This should be called after showing your purchase UI for a promoted product.\n *\n * @returns Promise resolving when the purchase is initiated\n * @throws Error if called on non-iOS platform or no promoted product is available\n *\n * @platform iOS\n */\nexport const requestPurchaseOnPromotedProductIOS: MutationField<\n 'requestPurchaseOnPromotedProductIOS'\n> = async () => {\n await ExpoIapModule.requestPurchaseOnPromotedProductIOS();\n return true;\n};\n\n/**\n * Get pending transactions that haven't been finished yet (iOS only).\n *\n * @returns Promise resolving to array of pending transactions\n * @platform iOS\n */\nexport const getPendingTransactionsIOS: QueryField<\n 'getPendingTransactionsIOS'\n> = async () => {\n const transactions = await ExpoIapModule.getPendingTransactionsIOS();\n return (transactions ?? []) as PurchaseIOS[];\n};\n\n/**\n * Clear a specific transaction (iOS only).\n *\n * @returns Promise resolving when transaction is cleared\n * @platform iOS\n */\nexport const clearTransactionIOS: MutationField<\n 'clearTransactionIOS'\n> = async () => {\n return !!(await ExpoIapModule.clearTransactionIOS());\n};\n\n/**\n * Deep link to subscriptions screen on iOS.\n * @returns {Promise<void>}\n *\n * @platform iOS\n */\nexport const deepLinkToSubscriptionsIOS = (): Promise<void> =>\n Linking.openURL('https://apps.apple.com/account/subscriptions');\n\n/**\n * Check if the device can present an external purchase notice sheet (iOS 18.2+).\n *\n * @returns Promise resolving to true if the notice sheet can be presented\n * @platform iOS\n */\nexport const canPresentExternalPurchaseNoticeIOS: QueryField<\n 'canPresentExternalPurchaseNoticeIOS'\n> = async () => {\n return !!(await ExpoIapModule.canPresentExternalPurchaseNoticeIOS());\n};\n\n/**\n * Present an external purchase notice sheet to inform users about external purchases (iOS 18.2+).\n * This must be called before opening an external purchase link.\n *\n * @returns Promise resolving to the result with action and error if any\n * @platform iOS\n */\nexport const presentExternalPurchaseNoticeSheetIOS: MutationField<\n 'presentExternalPurchaseNoticeSheetIOS'\n> = async () => {\n const result = await ExpoIapModule.presentExternalPurchaseNoticeSheetIOS();\n return result as ExternalPurchaseNoticeResultIOS;\n};\n\n/**\n * Present an external purchase link to redirect users to your website (iOS 16.0+).\n *\n * @param url - The external purchase URL to open\n * @returns Promise resolving to the result with success status and error if any\n * @platform iOS\n */\nexport const presentExternalPurchaseLinkIOS: MutationField<\n 'presentExternalPurchaseLinkIOS'\n> = async (url: string) => {\n const result = await ExpoIapModule.presentExternalPurchaseLinkIOS(url);\n return result as ExternalPurchaseLinkResultIOS;\n};\n\n// iOS-specific APIs only; cross-platform wrappers live in src/index.ts\n"]}
|
|
1
|
+
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,mBAAmB;AACnB,mEAAmE;AACnE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAgB7C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAOrC,YAAY;AAEZ,cAAc;AACd,MAAM,UAAU,YAAY,CAC1B,IAAa;IAEb,OAAO,CACL,IAAI,IAAI,IAAI;QACZ,OAAO,IAAI,KAAK,QAAQ;QACxB,UAAU,IAAI,IAAI;QAClB,OAAQ,IAAY,CAAC,QAAQ,KAAK,QAAQ;QACzC,IAAY,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,KAAK,CAC/C,CAAC;AACJ,CAAC;AAED,YAAY;AACZ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAA6B,KAAK,IAAI,EAAE;IAC1D,OAAO,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAEnC,KAAK,EAAE,OAAO,EAAE,EAAE;IACpB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,aAAa,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH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AAI,EAAE;IACb,OAAO,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,mBAAmB,EAAE,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAkB,EAAE,CAC5D,OAAO,CAAC,OAAO,CAAC,8CAA8C,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAE5C,KAAK,IAAI,EAAE;IACb,OAAO,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,mCAAmC,EAAE,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAE9C,KAAK,IAAI,EAAE;IACb,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,qCAAqC,EAAE,CAAC;IAC3E,OAAO,MAAyC,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAEvC,KAAK,EAAE,GAAW,EAAE,EAAE;IACxB,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,8BAA8B,CAAC,GAAG,CAAC,CAAC;IACvE,OAAO,MAAuC,CAAC;AACjD,CAAC,CAAC;AAEF,uEAAuE","sourcesContent":["// External dependencies\n\n// Internal modules\n// import removed: use purchaseUpdatedListener directly in app code\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport type {\n ExternalPurchaseLinkResultIOS,\n ExternalPurchaseNoticeResultIOS,\n MutationField,\n ProductIOS,\n Purchase,\n PurchaseIOS,\n QueryField,\n VerifyPurchaseProps,\n VerifyPurchaseResultIOS,\n SubscriptionStatusIOS,\n} from '../types';\nimport type {PurchaseError} from '../utils/errorMapping';\nimport {Linking} from 'react-native';\n\nexport type TransactionEvent = {\n transaction?: Purchase;\n error?: PurchaseError;\n};\n\n// Listeners\n\n// Type guards\nexport function isProductIOS<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'ios'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n typeof (item as any).platform === 'string' &&\n (item as any).platform.toLowerCase() === 'ios'\n );\n}\n\n// Functions\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const syncIOS: MutationField<'syncIOS'> = async () => {\n return !!(await ExpoIapModule.syncIOS());\n};\n\n/**\n * Check if user is eligible for introductory offer\n *\n * @param groupId The subscription group ID\n * @returns Promise resolving to true if eligible\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const isEligibleForIntroOfferIOS: QueryField<\n 'isEligibleForIntroOfferIOS'\n> = async (groupID) => {\n if (!groupID) {\n throw new Error('isEligibleForIntroOfferIOS requires a groupID');\n }\n return ExpoIapModule.isEligibleForIntroOfferIOS(groupID);\n};\n\n/**\n * Get subscription status for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to array of subscription status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const subscriptionStatusIOS: QueryField<\n 'subscriptionStatusIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('subscriptionStatusIOS requires a SKU');\n }\n const status = await ExpoIapModule.subscriptionStatusIOS(sku);\n return (status ?? []) as SubscriptionStatusIOS[];\n};\n\n/**\n * Get current entitlement for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to current entitlement\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const currentEntitlementIOS: QueryField<\n 'currentEntitlementIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('currentEntitlementIOS requires a SKU');\n }\n const purchase = await ExpoIapModule.currentEntitlementIOS(sku);\n return (purchase ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Get latest transaction for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to latest transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (\n sku,\n) => {\n if (!sku) {\n throw new Error('latestTransactionIOS requires a SKU');\n }\n const transaction = await ExpoIapModule.latestTransactionIOS(sku);\n return (transaction ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Begin refund request for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to refund request status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const beginRefundRequestIOS: MutationField<\n 'beginRefundRequestIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('beginRefundRequestIOS requires a SKU');\n }\n const status = await ExpoIapModule.beginRefundRequestIOS(sku);\n return status ?? null;\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * Returns an array of subscriptions that had status changes after the UI is closed.\n *\n * @returns Promise<Purchase[]> - Array of subscriptions with status changes (e.g., auto-renewal toggled)\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const showManageSubscriptionsIOS: MutationField<\n 'showManageSubscriptionsIOS'\n> = async () => {\n const purchases = await ExpoIapModule.showManageSubscriptionsIOS();\n return (purchases ?? []) as PurchaseIOS[];\n};\n\n/**\n * Get the receipt data from the iOS device.\n * This returns the base64 encoded receipt data which can be sent to your server\n * for verification with Apple's server.\n *\n * NOTE: For proper security, always verify receipts on your server using\n * Apple's verifyReceipt endpoint, not directly from the app.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n */\nexport const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {\n return ExpoIapModule.getReceiptDataIOS();\n};\n\nexport const getReceiptIOS = getReceiptDataIOS;\n\n/**\n * Check if a transaction is verified through StoreKit 2.\n * StoreKit 2 performs local verification of transaction JWS signatures.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to true if the transaction is verified\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const isTransactionVerifiedIOS: QueryField<\n 'isTransactionVerifiedIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('isTransactionVerifiedIOS requires a SKU');\n }\n return ExpoIapModule.isTransactionVerifiedIOS(sku);\n};\n\n/**\n * Get the JWS representation of a purchase for server-side verification.\n * The JWS (JSON Web Signature) can be verified on your server using Apple's public keys.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to JWS representation of the transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (\n sku,\n) => {\n if (!sku) {\n throw new Error('getTransactionJwsIOS requires a SKU');\n }\n const jws = await ExpoIapModule.getTransactionJwsIOS(sku);\n return jws ?? '';\n};\n\n/**\n * Validate receipt for iOS using StoreKit 2's built-in verification.\n * Returns receipt data and verification information to help with server-side validation.\n *\n * NOTE: For proper security, Apple recommends verifying receipts on your server using\n * the verifyReceipt endpoint rather than relying solely on client-side verification.\n *\n * @deprecated Use verifyPurchase instead\n * @param props The product's SKU or verification props\n * @returns {Promise<{\n * isValid: boolean;\n * receiptData: string;\n * jwsRepresentation: string;\n * latestTransaction?: Purchase;\n * }>}\n */\nconst validateReceiptIOSImpl = async (props: VerifyPurchaseProps | string) => {\n const sku =\n typeof props === 'string'\n ? props\n : (props as VerifyPurchaseProps)?.apple?.sku;\n\n if (!sku) {\n throw new Error('validateReceiptIOS requires a SKU (via apple.sku)');\n }\n\n return (await ExpoIapModule.validateReceiptIOS(\n sku,\n )) as VerifyPurchaseResultIOS;\n};\n\nexport const validateReceiptIOS =\n validateReceiptIOSImpl as QueryField<'validateReceiptIOS'>;\n\n/**\n * Present the code redemption sheet for offer codes (iOS only).\n * This allows users to redeem promotional codes for in-app purchases and subscriptions.\n *\n * Note: This only works on real devices, not simulators.\n *\n * @returns Promise resolving to true if the sheet was presented successfully\n * @throws Error if called on non-iOS platform or tvOS\n *\n * @platform iOS\n */\nexport const presentCodeRedemptionSheetIOS: MutationField<\n 'presentCodeRedemptionSheetIOS'\n> = async () => {\n return !!(await ExpoIapModule.presentCodeRedemptionSheetIOS());\n};\n\n/**\n * Get app transaction information (iOS 16.0+).\n * AppTransaction represents the initial purchase that unlocked the app.\n *\n * NOTE: This function requires:\n * - iOS 16.0 or later at runtime\n * - Xcode 15.0+ with iOS 16.0 SDK for compilation\n *\n * @returns Promise resolving to the app transaction information or null if not available\n * @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK\n *\n * @platform iOS\n * @since iOS 16.0\n */\nexport const getAppTransactionIOS: QueryField<\n 'getAppTransactionIOS'\n> = async () => {\n return (await ExpoIapModule.getAppTransactionIOS()) ?? null;\n};\n\n/**\n * Get information about a promoted product if one is available (iOS only).\n * Promoted products are products that the App Store promotes on your behalf.\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product information or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getPromotedProductIOS: QueryField<\n 'getPromotedProductIOS'\n> = async () => {\n const product = await ExpoIapModule.getPromotedProductIOS();\n return (product ?? null) as ProductIOS | null;\n};\n\n/**\n * Complete the purchase of a promoted product (iOS only).\n * This should be called after showing your purchase UI for a promoted product.\n *\n * @returns Promise resolving when the purchase is initiated\n * @throws Error if called on non-iOS platform or no promoted product is available\n *\n * @platform iOS\n */\nexport const requestPurchaseOnPromotedProductIOS: MutationField<\n 'requestPurchaseOnPromotedProductIOS'\n> = async () => {\n await ExpoIapModule.requestPurchaseOnPromotedProductIOS();\n return true;\n};\n\n/**\n * Get pending transactions that haven't been finished yet (iOS only).\n *\n * @returns Promise resolving to array of pending transactions\n * @platform iOS\n */\nexport const getPendingTransactionsIOS: QueryField<\n 'getPendingTransactionsIOS'\n> = async () => {\n const transactions = await ExpoIapModule.getPendingTransactionsIOS();\n return (transactions ?? []) as PurchaseIOS[];\n};\n\n/**\n * Clear a specific transaction (iOS only).\n *\n * @returns Promise resolving when transaction is cleared\n * @platform iOS\n */\nexport const clearTransactionIOS: MutationField<\n 'clearTransactionIOS'\n> = async () => {\n return !!(await ExpoIapModule.clearTransactionIOS());\n};\n\n/**\n * Deep link to subscriptions screen on iOS.\n * @returns {Promise<void>}\n *\n * @platform iOS\n */\nexport const deepLinkToSubscriptionsIOS = (): Promise<void> =>\n Linking.openURL('https://apps.apple.com/account/subscriptions');\n\n/**\n * Check if the device can present an external purchase notice sheet (iOS 18.2+).\n *\n * @returns Promise resolving to true if the notice sheet can be presented\n * @platform iOS\n */\nexport const canPresentExternalPurchaseNoticeIOS: QueryField<\n 'canPresentExternalPurchaseNoticeIOS'\n> = async () => {\n return !!(await ExpoIapModule.canPresentExternalPurchaseNoticeIOS());\n};\n\n/**\n * Present an external purchase notice sheet to inform users about external purchases (iOS 18.2+).\n * This must be called before opening an external purchase link.\n *\n * @returns Promise resolving to the result with action and error if any\n * @platform iOS\n */\nexport const presentExternalPurchaseNoticeSheetIOS: MutationField<\n 'presentExternalPurchaseNoticeSheetIOS'\n> = async () => {\n const result = await ExpoIapModule.presentExternalPurchaseNoticeSheetIOS();\n return result as ExternalPurchaseNoticeResultIOS;\n};\n\n/**\n * Present an external purchase link to redirect users to your website (iOS 16.0+).\n *\n * @param url - The external purchase URL to open\n * @returns Promise resolving to the result with success status and error if any\n * @platform iOS\n */\nexport const presentExternalPurchaseLinkIOS: MutationField<\n 'presentExternalPurchaseLinkIOS'\n> = async (url: string) => {\n const result = await ExpoIapModule.presentExternalPurchaseLinkIOS(url);\n return result as ExternalPurchaseLinkResultIOS;\n};\n\n// iOS-specific APIs only; cross-platform wrappers live in src/index.ts\n"]}
|
package/build/types.d.ts
CHANGED
|
@@ -814,6 +814,14 @@ export type RequestPurchaseProps = {
|
|
|
814
814
|
/** Use alternative billing (Google Play alternative billing, Apple external purchase link) */
|
|
815
815
|
useAlternativeBilling?: boolean | null;
|
|
816
816
|
};
|
|
817
|
+
/**
|
|
818
|
+
* Platform-specific purchase request parameters.
|
|
819
|
+
*
|
|
820
|
+
* Note: "Platforms" refers to the SDK/OS level (apple, google), not the store.
|
|
821
|
+
* - apple: Always targets App Store
|
|
822
|
+
* - google: Targets Play Store by default, or Horizon when built with horizon flavor
|
|
823
|
+
* (determined at build time, not runtime)
|
|
824
|
+
*/
|
|
817
825
|
export interface RequestPurchasePropsByPlatforms {
|
|
818
826
|
/** @deprecated Use google instead */
|
|
819
827
|
android?: (RequestPurchaseAndroidProps | null);
|
|
@@ -856,6 +864,14 @@ export interface RequestSubscriptionIosProps {
|
|
|
856
864
|
sku: string;
|
|
857
865
|
withOffer?: (DiscountOfferInputIOS | null);
|
|
858
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* Platform-specific subscription request parameters.
|
|
869
|
+
*
|
|
870
|
+
* Note: "Platforms" refers to the SDK/OS level (apple, google), not the store.
|
|
871
|
+
* - apple: Always targets App Store
|
|
872
|
+
* - google: Targets Play Store by default, or Horizon when built with horizon flavor
|
|
873
|
+
* (determined at build time, not runtime)
|
|
874
|
+
*/
|
|
859
875
|
export interface RequestSubscriptionPropsByPlatforms {
|
|
860
876
|
/** @deprecated Use google instead */
|
|
861
877
|
android?: (RequestSubscriptionAndroidProps | null);
|
|
@@ -874,12 +890,18 @@ export interface RequestVerifyPurchaseWithIapkitGoogleProps {
|
|
|
874
890
|
/** The token provided to the user's device when the product or subscription was purchased. */
|
|
875
891
|
purchaseToken: string;
|
|
876
892
|
}
|
|
893
|
+
/**
|
|
894
|
+
* Platform-specific verification parameters for IAPKit.
|
|
895
|
+
*
|
|
896
|
+
* - apple: Verifies via App Store (JWS token)
|
|
897
|
+
* - google: Verifies via Play Store (purchase token)
|
|
898
|
+
*/
|
|
877
899
|
export interface RequestVerifyPurchaseWithIapkitProps {
|
|
878
900
|
/** API key used for the Authorization header (Bearer {apiKey}). */
|
|
879
901
|
apiKey?: (string | null);
|
|
880
|
-
/** Apple verification parameters. */
|
|
902
|
+
/** Apple App Store verification parameters. */
|
|
881
903
|
apple?: (RequestVerifyPurchaseWithIapkitAppleProps | null);
|
|
882
|
-
/** Google verification parameters. */
|
|
904
|
+
/** Google Play Store verification parameters. */
|
|
883
905
|
google?: (RequestVerifyPurchaseWithIapkitGoogleProps | null);
|
|
884
906
|
}
|
|
885
907
|
export interface RequestVerifyPurchaseWithIapkitResult {
|
|
@@ -964,19 +986,72 @@ export interface ValidTimeWindowAndroid {
|
|
|
964
986
|
/** Start time in milliseconds since epoch */
|
|
965
987
|
startTimeMillis: string;
|
|
966
988
|
}
|
|
967
|
-
|
|
989
|
+
/**
|
|
990
|
+
* Apple App Store verification parameters.
|
|
991
|
+
* Used for server-side receipt validation via App Store Server API.
|
|
992
|
+
*/
|
|
993
|
+
export interface VerifyPurchaseAppleOptions {
|
|
994
|
+
/** Product SKU to validate */
|
|
995
|
+
sku: string;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Google Play Store verification parameters.
|
|
999
|
+
* Used for server-side receipt validation via Google Play Developer API.
|
|
1000
|
+
*
|
|
1001
|
+
* ⚠️ SECURITY: Contains sensitive tokens (accessToken, purchaseToken). Do not log or persist this data.
|
|
1002
|
+
*/
|
|
1003
|
+
export interface VerifyPurchaseGoogleOptions {
|
|
1004
|
+
/**
|
|
1005
|
+
* Google OAuth2 access token for API authentication.
|
|
1006
|
+
* ⚠️ Sensitive: Do not log this value.
|
|
1007
|
+
*/
|
|
968
1008
|
accessToken: string;
|
|
1009
|
+
/** Whether this is a subscription purchase (affects API endpoint used) */
|
|
969
1010
|
isSub?: (boolean | null);
|
|
1011
|
+
/** Android package name (e.g., com.example.app) */
|
|
970
1012
|
packageName: string;
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1013
|
+
/**
|
|
1014
|
+
* Purchase token from the purchase response.
|
|
1015
|
+
* ⚠️ Sensitive: Do not log this value.
|
|
1016
|
+
*/
|
|
1017
|
+
purchaseToken: string;
|
|
976
1018
|
/** Product SKU to validate */
|
|
977
1019
|
sku: string;
|
|
978
1020
|
}
|
|
979
|
-
|
|
1021
|
+
/**
|
|
1022
|
+
* Meta Horizon (Quest) verification parameters.
|
|
1023
|
+
* Used for server-side entitlement verification via Meta's S2S API.
|
|
1024
|
+
* POST https://graph.oculus.com/$APP_ID/verify_entitlement
|
|
1025
|
+
*
|
|
1026
|
+
* ⚠️ SECURITY: Contains sensitive token (accessToken). Do not log or persist this data.
|
|
1027
|
+
*/
|
|
1028
|
+
export interface VerifyPurchaseHorizonOptions {
|
|
1029
|
+
/**
|
|
1030
|
+
* Access token for Meta API authentication (OC|$APP_ID|$APP_SECRET or User Access Token).
|
|
1031
|
+
* ⚠️ Sensitive: Do not log this value.
|
|
1032
|
+
*/
|
|
1033
|
+
accessToken: string;
|
|
1034
|
+
/** The SKU for the add-on item, defined in Meta Developer Dashboard */
|
|
1035
|
+
sku: string;
|
|
1036
|
+
/** The user ID of the user whose purchase you want to verify */
|
|
1037
|
+
userId: string;
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Platform-specific purchase verification parameters.
|
|
1041
|
+
*
|
|
1042
|
+
* - apple: Verifies via App Store Server API
|
|
1043
|
+
* - google: Verifies via Google Play Developer API
|
|
1044
|
+
* - horizon: Verifies via Meta's S2S API (verify_entitlement endpoint)
|
|
1045
|
+
*/
|
|
1046
|
+
export interface VerifyPurchaseProps {
|
|
1047
|
+
/** Apple App Store verification parameters. */
|
|
1048
|
+
apple?: (VerifyPurchaseAppleOptions | null);
|
|
1049
|
+
/** Google Play Store verification parameters. */
|
|
1050
|
+
google?: (VerifyPurchaseGoogleOptions | null);
|
|
1051
|
+
/** Meta Horizon (Quest) verification parameters. */
|
|
1052
|
+
horizon?: (VerifyPurchaseHorizonOptions | null);
|
|
1053
|
+
}
|
|
1054
|
+
export type VerifyPurchaseResult = VerifyPurchaseResultAndroid | VerifyPurchaseResultHorizon | VerifyPurchaseResultIOS;
|
|
980
1055
|
export interface VerifyPurchaseResultAndroid {
|
|
981
1056
|
autoRenewing: boolean;
|
|
982
1057
|
betaProduct: boolean;
|
|
@@ -997,6 +1072,16 @@ export interface VerifyPurchaseResultAndroid {
|
|
|
997
1072
|
termSku: string;
|
|
998
1073
|
testTransaction: boolean;
|
|
999
1074
|
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Result from Meta Horizon verify_entitlement API.
|
|
1077
|
+
* Returns verification status and grant time for the entitlement.
|
|
1078
|
+
*/
|
|
1079
|
+
export interface VerifyPurchaseResultHorizon {
|
|
1080
|
+
/** Unix timestamp (seconds) when the entitlement was granted. */
|
|
1081
|
+
grantTime?: (number | null);
|
|
1082
|
+
/** Whether the entitlement verification succeeded. */
|
|
1083
|
+
success: boolean;
|
|
1084
|
+
}
|
|
1000
1085
|
export interface VerifyPurchaseResultIOS {
|
|
1001
1086
|
/** Whether the receipt is valid */
|
|
1002
1087
|
isValid: boolean;
|