expo-iap 2.7.9 → 2.7.10

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/build/index.d.ts CHANGED
@@ -194,6 +194,28 @@ export declare const validateReceipt: (sku: string, androidOptions?: {
194
194
  accessToken: string;
195
195
  isSub?: boolean;
196
196
  }) => Promise<any>;
197
+ /**
198
+ * Deeplinks to native interface that allows users to manage their subscriptions
199
+ * @param options.skuAndroid - Required for Android to locate specific subscription (ignored on iOS)
200
+ * @param options.packageNameAndroid - Required for Android to identify your app (ignored on iOS)
201
+ *
202
+ * @returns Promise that resolves when the deep link is successfully opened
203
+ *
204
+ * @throws {Error} When called on unsupported platform or when required Android parameters are missing
205
+ *
206
+ * @example
207
+ * import { deepLinkToSubscriptions } from 'expo-iap';
208
+ *
209
+ * // Works on both iOS and Android
210
+ * await deepLinkToSubscriptions({
211
+ * skuAndroid: 'your_subscription_sku',
212
+ * packageNameAndroid: 'com.example.app'
213
+ * });
214
+ */
215
+ export declare const deepLinkToSubscriptions: (options: {
216
+ skuAndroid?: string;
217
+ packageNameAndroid?: string;
218
+ }) => Promise<void>;
197
219
  export * from './useIap';
198
220
  export * from './utils/errorMapping';
199
221
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,OAAO,EACP,eAAe,EACf,QAAQ,EACR,aAAa,EACb,cAAc,EACd,kCAAkC,EAClC,8BAA8B,EAC9B,mBAAmB,EACnB,oBAAoB,EAGrB,MAAM,iBAAiB,CAAC;AAKzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAGhE,eAAO,MAAM,EAAE,KAAmB,CAAC;AAEnC,oBAAY,QAAQ;IAClB,eAAe,qBAAqB;I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,eAAO,MAAM,aAAa,QAAO,OAAO,CAAC,MAAM,CAK9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,KAAK,MAAM,EACX,iBAAiB;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,KACA,OAAO,CAAC,GAAG,CAwBb,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,KAAG,OAAO,CAAC,IAAI,CA2Bf,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC"}
package/build/index.js CHANGED
@@ -3,8 +3,8 @@ import { NativeModulesProxy } from 'expo-modules-core';
3
3
  import { Platform } from 'react-native';
4
4
  // Internal modules
5
5
  import ExpoIapModule from './ExpoIapModule';
6
- import { isProductIos, validateReceiptIOS } from './modules/ios';
7
- import { isProductAndroid, validateReceiptAndroid } from './modules/android';
6
+ import { isProductIos, validateReceiptIOS, deepLinkToSubscriptionsIos, } from './modules/ios';
7
+ import { isProductAndroid, validateReceiptAndroid, deepLinkToSubscriptionsAndroid, } from './modules/android';
8
8
  // Types
9
9
  import { isPlatformRequestProps, isUnifiedRequestProps, } from './ExpoIap.types';
10
10
  // Export all types
@@ -463,6 +463,42 @@ export const validateReceipt = async (sku, androidOptions) => {
463
463
  throw new Error('Platform not supported');
464
464
  }
465
465
  };
466
+ /**
467
+ * Deeplinks to native interface that allows users to manage their subscriptions
468
+ * @param options.skuAndroid - Required for Android to locate specific subscription (ignored on iOS)
469
+ * @param options.packageNameAndroid - Required for Android to identify your app (ignored on iOS)
470
+ *
471
+ * @returns Promise that resolves when the deep link is successfully opened
472
+ *
473
+ * @throws {Error} When called on unsupported platform or when required Android parameters are missing
474
+ *
475
+ * @example
476
+ * import { deepLinkToSubscriptions } from 'expo-iap';
477
+ *
478
+ * // Works on both iOS and Android
479
+ * await deepLinkToSubscriptions({
480
+ * skuAndroid: 'your_subscription_sku',
481
+ * packageNameAndroid: 'com.example.app'
482
+ * });
483
+ */
484
+ export const deepLinkToSubscriptions = (options) => {
485
+ if (Platform.OS === 'ios') {
486
+ return deepLinkToSubscriptionsIos();
487
+ }
488
+ if (Platform.OS === 'android') {
489
+ if (!options.skuAndroid) {
490
+ return Promise.reject(new Error('skuAndroid is required to locate subscription in Android Store'));
491
+ }
492
+ if (!options.packageNameAndroid) {
493
+ return Promise.reject(new Error('packageNameAndroid is required to identify your app in Android Store'));
494
+ }
495
+ return deepLinkToSubscriptionsAndroid({
496
+ sku: options.skuAndroid,
497
+ packageName: options.packageNameAndroid,
498
+ });
499
+ }
500
+ return Promise.reject(new Error(`Unsupported platform: ${Platform.OS}`));
501
+ };
466
502
  export * from './useIap';
467
503
  export * from './utils/errorMapping';
468
504
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAC,gBAAgB,EAAE,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;AAE3E,QAAQ;AACR,OAAO,EAUL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAIzB,mBAAmB;AACnB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAG9B,gCAA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CAAC;YAClC,WAAW,EAAE,cAAc,CAAC,WAAW;YACvC,SAAS,EAAE,GAAG;YACd,YAAY,EAAE,cAAc,CAAC,YAAY;YACzC,WAAW,EAAE,cAAc,CAAC,WAAW;YACvC,KAAK,EAAE,cAAc,CAAC,KAAK;SAC5B,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC","sourcesContent":["// External dependencies\nimport {NativeModulesProxy} from 'expo-modules-core';\nimport {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from './ExpoIapModule';\nimport {isProductIos, validateReceiptIOS} from './modules/ios';\nimport {isProductAndroid, validateReceiptAndroid} from './modules/android';\n\n// Types\nimport {\n Product,\n ProductPurchase,\n Purchase,\n PurchaseError,\n PurchaseResult,\n RequestSubscriptionPropsWithLegacy,\n RequestPurchasePropsWithLegacy,\n SubscriptionProduct,\n SubscriptionPurchase,\n isPlatformRequestProps,\n isUnifiedRequestProps,\n} from './ExpoIap.types';\nimport {ProductPurchaseAndroid} from './types/ExpoIapAndroid.types';\nimport {PaymentDiscount} from './types/ExpoIapIos.types';\n\n// Export all types\nexport * from './ExpoIap.types';\nexport * from './modules/android';\nexport * from './modules/ios';\nexport type {AppTransactionIOS} from './types/ExpoIapIos.types';\n\n// Get the native constant value\nexport const PI = ExpoIapModule.PI;\n\nexport enum IapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n /** @deprecated Use PurchaseUpdated instead. This will be removed in a future version. */\n TransactionIapUpdated = 'iap-transaction-updated',\n PromotedProductIOS = 'promoted-product-ios',\n}\n\nexport function setValueAsync(value: string) {\n return ExpoIapModule.setValueAsync(value);\n}\n\n// Ensure the emitter has proper EventEmitter interface\nexport const emitter = (ExpoIapModule || NativeModulesProxy.ExpoIap) as {\n addListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => {remove: () => void};\n removeListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => void;\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const emitterSubscription = emitter.addListener(\n IapEvent.PurchaseUpdated,\n listener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n return emitter.addListener(IapEvent.PurchaseError, listener);\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 console.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(IapEvent.PromotedProductIOS, listener);\n};\n\nexport function initConnection(): Promise<boolean> {\n const result = ExpoIapModule.initConnection();\n return Promise.resolve(result);\n}\n\nexport const getProducts = async (skus: string[]): Promise<Product[]> => {\n console.warn(\n \"`getProducts` is deprecated. Use `requestProducts({ skus, type: 'inapp' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as Product[];\n },\n android: async () => {\n const products = await ExpoIapModule.getItemsByType('inapp', skus);\n return products.filter((product: unknown) =>\n isProductAndroid<Product>(product),\n );\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport const getSubscriptions = async (\n skus: string[],\n): Promise<SubscriptionProduct[]> => {\n console.warn(\n \"`getSubscriptions` is deprecated. Use `requestProducts({ skus, type: 'subs' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n android: async () => {\n const rawItems = await ExpoIapModule.getItemsByType('subs', skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\n/**\n * Request products with unified API (v2.7.0+)\n *\n * @param params - Product request configuration\n * @param params.skus - Array of product SKUs to fetch\n * @param params.type - Type of products: 'inapp' for regular products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Regular products\n * const products = await requestProducts({\n * skus: ['product1', 'product2'],\n * type: 'inapp'\n * });\n *\n * // Subscriptions\n * const subscriptions = await requestProducts({\n * skus: ['sub1', 'sub2'],\n * type: 'subs'\n * });\n * ```\n */\nexport const requestProducts = async ({\n skus,\n type = 'inapp',\n}: {\n skus: string[];\n type?: 'inapp' | 'subs';\n}): Promise<Product[] | SubscriptionProduct[]> => {\n if (!skus?.length) {\n throw new Error('No SKUs provided');\n }\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.getItems(skus);\n const filteredItems = rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n if (Platform.OS === 'android') {\n const items = await ExpoIapModule.getItemsByType(type, skus);\n const filteredItems = items.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n throw new Error('Unsupported platform');\n};\n\n/**\n * @deprecated Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.\n */\nexport const getPurchaseHistory = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> => {\n console.warn(\n '`getPurchaseHistory` is deprecated. Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.',\n );\n return getPurchaseHistories({\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n });\n};\n\nexport const getPurchaseHistories = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> =>\n (\n Platform.select({\n ios: async () => {\n return ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n );\n },\n android: async () => {\n // getPurchaseHistoryByType was removed in Google Play Billing Library v8\n // Android doesn't provide purchase history anymore, only active purchases\n console.warn(\n 'getPurchaseHistories is not supported on Android with Google Play Billing Library v8. Use getAvailablePurchases instead to get active purchases.',\n );\n return [];\n },\n }) || (() => Promise.resolve([]))\n )();\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = true,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> =>\n (\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n ),\n android: async () => {\n const products = await ExpoIapModule.getAvailableItemsByType('inapp');\n const subscriptions =\n await ExpoIapModule.getAvailableItemsByType('subs');\n return products.concat(subscriptions);\n },\n }) || (() => Promise.resolve([]))\n )();\n\nconst offerToRecordIos = (\n offer: PaymentDiscount | undefined,\n): Record<keyof PaymentDiscount, string> | undefined => {\n if (!offer) return undefined;\n return {\n identifier: offer.identifier,\n keyIdentifier: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n\n// Define discriminated union with explicit type parameter\n// Using legacy types internally for backward compatibility\ntype PurchaseRequest =\n | {\n request: RequestPurchasePropsWithLegacy;\n type?: 'inapp';\n }\n | {\n request: RequestSubscriptionPropsWithLegacy;\n type: 'subs';\n };\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nconst normalizeRequestProps = (\n request: RequestPurchasePropsWithLegacy | RequestSubscriptionPropsWithLegacy,\n platform: 'ios' | 'android',\n): any => {\n // If it's already platform-specific format\n if (isPlatformRequestProps(request)) {\n return platform === 'ios' ? request.ios : request.android;\n }\n\n // If it's unified format, convert to platform-specific\n if (isUnifiedRequestProps(request)) {\n if (platform === 'ios') {\n return {\n sku: request.sku || (request.skus?.[0] ?? ''),\n andDangerouslyFinishTransactionAutomaticallyIOS:\n request.andDangerouslyFinishTransactionAutomaticallyIOS,\n appAccountToken: request.appAccountToken,\n quantity: request.quantity,\n withOffer: request.withOffer,\n };\n } else {\n const androidRequest: any = {\n skus: request.skus || (request.sku ? [request.sku] : []),\n obfuscatedAccountIdAndroid: request.obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid: request.obfuscatedProfileIdAndroid,\n isOfferPersonalized: request.isOfferPersonalized,\n };\n\n // Add subscription-specific fields if present\n if ('subscriptionOffers' in request && request.subscriptionOffers) {\n androidRequest.subscriptionOffers = request.subscriptionOffers;\n }\n if ('purchaseTokenAndroid' in request) {\n androidRequest.purchaseTokenAndroid = request.purchaseTokenAndroid;\n }\n if ('replacementModeAndroid' in request) {\n androidRequest.replacementModeAndroid = request.replacementModeAndroid;\n }\n\n return androidRequest;\n }\n }\n\n // Legacy format handling\n return request;\n};\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Platform-specific purchase parameters\n * @param requestObj.type - Type of purchase: 'inapp' for products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Product purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'inapp'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestPurchase = (\n requestObj: PurchaseRequest,\n): Promise<\n | ProductPurchase\n | SubscriptionPurchase\n | ProductPurchase[]\n | SubscriptionPurchase[]\n | void\n> => {\n const {request, type = 'inapp'} = requestObj;\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 iOS. The `sku` property is required and must be a string.',\n );\n }\n\n const {\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS = false,\n appAccountToken,\n quantity,\n withOffer,\n } = normalizedRequest;\n\n return (async () => {\n const offer = offerToRecordIos(withOffer);\n const purchase = await ExpoIapModule.buyProduct(\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS,\n appAccountToken,\n quantity ?? -1,\n offer,\n );\n\n return type === 'inapp'\n ? (purchase as ProductPurchase)\n : (purchase as SubscriptionPurchase);\n })();\n }\n\n if (Platform.OS === 'android') {\n const normalizedRequest = normalizeRequestProps(request, 'android');\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Android. The `skus` property is required and must be a non-empty array.',\n );\n }\n\n if (type === 'inapp') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'inapp',\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<ProductPurchase[]>;\n })();\n }\n\n if (type === 'subs') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers = [],\n replacementModeAndroid = -1,\n purchaseTokenAndroid,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'subs',\n skuArr: skus,\n purchaseToken: purchaseTokenAndroid,\n replacementMode: replacementModeAndroid,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: subscriptionOffers.map((so: any) => so.offerToken),\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<SubscriptionPurchase[]>;\n })();\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n return Promise.resolve(); // Fallback for unsupported platforms\n};\n\n/**\n * @deprecated Use `requestPurchase({ request, type: 'subs' })` instead. This method will be removed in version 3.0.0.\n *\n * @example\n * ```typescript\n * // Old way (deprecated)\n * await requestSubscription({\n * sku: subscriptionId,\n * // or for Android\n * skus: [subscriptionId],\n * });\n *\n * // New way (recommended)\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestSubscription = async (\n request: RequestSubscriptionPropsWithLegacy,\n): Promise<SubscriptionPurchase | SubscriptionPurchase[] | null | void> => {\n console.warn(\n \"`requestSubscription` is deprecated and will be removed in version 3.0.0. Use `requestPurchase({ request, type: 'subs' })` instead.\",\n );\n return (await requestPurchase({request, type: 'subs'})) as\n | SubscriptionPurchase\n | SubscriptionPurchase[]\n | null\n | void;\n};\n\nexport const finishTransaction = ({\n purchase,\n isConsumable = false,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n}): Promise<PurchaseResult | boolean> => {\n return (\n Platform.select({\n ios: async () => {\n const transactionId = purchase.transactionId;\n if (!transactionId) {\n return Promise.reject(\n new Error('transactionId required to finish iOS transaction'),\n );\n }\n await ExpoIapModule.finishTransaction(transactionId);\n return Promise.resolve(true);\n },\n android: async () => {\n const androidPurchase = purchase as ProductPurchaseAndroid;\n\n if (!('purchaseTokenAndroid' in androidPurchase)) {\n return Promise.reject(\n new Error('purchaseToken is required to finish transaction'),\n );\n }\n if (isConsumable) {\n return ExpoIapModule.consumeProduct(\n androidPurchase.purchaseTokenAndroid,\n );\n } else {\n return ExpoIapModule.acknowledgePurchase(\n androidPurchase.purchaseTokenAndroid,\n );\n }\n },\n }) || (() => Promise.reject(new Error('Unsupported Platform')))\n )();\n};\n\n/**\n * Retrieves the current storefront information from iOS App Store\n *\n * @returns Promise resolving to the storefront country code\n * @throws Error if called on non-iOS platform\n *\n * @example\n * ```typescript\n * const storefront = await getStorefrontIOS();\n * console.log(storefront); // 'US'\n * ```\n *\n * @platform iOS\n */\nexport const getStorefrontIOS = (): Promise<string> => {\n if (Platform.OS !== 'ios') {\n console.warn('getStorefrontIOS: This method is only available on iOS');\n return Promise.resolve('');\n }\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * @deprecated Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getStorefront = (): Promise<string> => {\n console.warn(\n '`getStorefront` is deprecated. Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getStorefrontIOS();\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 */\nexport const validateReceipt = async (\n sku: string,\n androidOptions?: {\n packageName: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n },\n): Promise<any> => {\n if (Platform.OS === 'ios') {\n return await validateReceiptIOS(sku);\n } else 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 await validateReceiptAndroid({\n packageName: androidOptions.packageName,\n productId: sku,\n productToken: androidOptions.productToken,\n accessToken: androidOptions.accessToken,\n isSub: androidOptions.isSub,\n });\n } else {\n throw new Error('Platform not supported');\n }\n};\n\nexport * from './useIap';\nexport * from './utils/errorMapping';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAE3B,QAAQ;AACR,OAAO,EAUL,sBAAsB,EACtB,qBAAqB,GACtB,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,cAAc,sBAAsB,CAAC","sourcesContent":["// External dependencies\nimport {NativeModulesProxy} 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} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\n\n// Types\nimport {\n Product,\n ProductPurchase,\n Purchase,\n PurchaseError,\n PurchaseResult,\n RequestSubscriptionPropsWithLegacy,\n RequestPurchasePropsWithLegacy,\n SubscriptionProduct,\n SubscriptionPurchase,\n isPlatformRequestProps,\n isUnifiedRequestProps,\n} from './ExpoIap.types';\nimport {ProductPurchaseAndroid} from './types/ExpoIapAndroid.types';\nimport {PaymentDiscount} from './types/ExpoIapIos.types';\n\n// Export all types\nexport * from './ExpoIap.types';\nexport * from './modules/android';\nexport * from './modules/ios';\nexport type {AppTransactionIOS} from './types/ExpoIapIos.types';\n\n// Get the native constant value\nexport const PI = ExpoIapModule.PI;\n\nexport enum IapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n /** @deprecated Use PurchaseUpdated instead. This will be removed in a future version. */\n TransactionIapUpdated = 'iap-transaction-updated',\n PromotedProductIOS = 'promoted-product-ios',\n}\n\nexport function setValueAsync(value: string) {\n return ExpoIapModule.setValueAsync(value);\n}\n\n// Ensure the emitter has proper EventEmitter interface\nexport const emitter = (ExpoIapModule || NativeModulesProxy.ExpoIap) as {\n addListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => {remove: () => void};\n removeListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => void;\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const emitterSubscription = emitter.addListener(\n IapEvent.PurchaseUpdated,\n listener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n return emitter.addListener(IapEvent.PurchaseError, listener);\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 console.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(IapEvent.PromotedProductIOS, listener);\n};\n\nexport function initConnection(): Promise<boolean> {\n const result = ExpoIapModule.initConnection();\n return Promise.resolve(result);\n}\n\nexport const getProducts = async (skus: string[]): Promise<Product[]> => {\n console.warn(\n \"`getProducts` is deprecated. Use `requestProducts({ skus, type: 'inapp' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as Product[];\n },\n android: async () => {\n const products = await ExpoIapModule.getItemsByType('inapp', skus);\n return products.filter((product: unknown) =>\n isProductAndroid<Product>(product),\n );\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport const getSubscriptions = async (\n skus: string[],\n): Promise<SubscriptionProduct[]> => {\n console.warn(\n \"`getSubscriptions` is deprecated. Use `requestProducts({ skus, type: 'subs' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n android: async () => {\n const rawItems = await ExpoIapModule.getItemsByType('subs', skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\n/**\n * Request products with unified API (v2.7.0+)\n *\n * @param params - Product request configuration\n * @param params.skus - Array of product SKUs to fetch\n * @param params.type - Type of products: 'inapp' for regular products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Regular products\n * const products = await requestProducts({\n * skus: ['product1', 'product2'],\n * type: 'inapp'\n * });\n *\n * // Subscriptions\n * const subscriptions = await requestProducts({\n * skus: ['sub1', 'sub2'],\n * type: 'subs'\n * });\n * ```\n */\nexport const requestProducts = async ({\n skus,\n type = 'inapp',\n}: {\n skus: string[];\n type?: 'inapp' | 'subs';\n}): Promise<Product[] | SubscriptionProduct[]> => {\n if (!skus?.length) {\n throw new Error('No SKUs provided');\n }\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.getItems(skus);\n const filteredItems = rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n if (Platform.OS === 'android') {\n const items = await ExpoIapModule.getItemsByType(type, skus);\n const filteredItems = items.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n throw new Error('Unsupported platform');\n};\n\n/**\n * @deprecated Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.\n */\nexport const getPurchaseHistory = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> => {\n console.warn(\n '`getPurchaseHistory` is deprecated. Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.',\n );\n return getPurchaseHistories({\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n });\n};\n\nexport const getPurchaseHistories = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> =>\n (\n Platform.select({\n ios: async () => {\n return ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n );\n },\n android: async () => {\n // getPurchaseHistoryByType was removed in Google Play Billing Library v8\n // Android doesn't provide purchase history anymore, only active purchases\n console.warn(\n 'getPurchaseHistories is not supported on Android with Google Play Billing Library v8. Use getAvailablePurchases instead to get active purchases.',\n );\n return [];\n },\n }) || (() => Promise.resolve([]))\n )();\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = true,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> =>\n (\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n ),\n android: async () => {\n const products = await ExpoIapModule.getAvailableItemsByType('inapp');\n const subscriptions =\n await ExpoIapModule.getAvailableItemsByType('subs');\n return products.concat(subscriptions);\n },\n }) || (() => Promise.resolve([]))\n )();\n\nconst offerToRecordIos = (\n offer: PaymentDiscount | undefined,\n): Record<keyof PaymentDiscount, string> | undefined => {\n if (!offer) return undefined;\n return {\n identifier: offer.identifier,\n keyIdentifier: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n\n// Define discriminated union with explicit type parameter\n// Using legacy types internally for backward compatibility\ntype PurchaseRequest =\n | {\n request: RequestPurchasePropsWithLegacy;\n type?: 'inapp';\n }\n | {\n request: RequestSubscriptionPropsWithLegacy;\n type: 'subs';\n };\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nconst normalizeRequestProps = (\n request: RequestPurchasePropsWithLegacy | RequestSubscriptionPropsWithLegacy,\n platform: 'ios' | 'android',\n): any => {\n // If it's already platform-specific format\n if (isPlatformRequestProps(request)) {\n return platform === 'ios' ? request.ios : request.android;\n }\n\n // If it's unified format, convert to platform-specific\n if (isUnifiedRequestProps(request)) {\n if (platform === 'ios') {\n return {\n sku: request.sku || (request.skus?.[0] ?? ''),\n andDangerouslyFinishTransactionAutomaticallyIOS:\n request.andDangerouslyFinishTransactionAutomaticallyIOS,\n appAccountToken: request.appAccountToken,\n quantity: request.quantity,\n withOffer: request.withOffer,\n };\n } else {\n const androidRequest: any = {\n skus: request.skus || (request.sku ? [request.sku] : []),\n obfuscatedAccountIdAndroid: request.obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid: request.obfuscatedProfileIdAndroid,\n isOfferPersonalized: request.isOfferPersonalized,\n };\n\n // Add subscription-specific fields if present\n if ('subscriptionOffers' in request && request.subscriptionOffers) {\n androidRequest.subscriptionOffers = request.subscriptionOffers;\n }\n if ('purchaseTokenAndroid' in request) {\n androidRequest.purchaseTokenAndroid = request.purchaseTokenAndroid;\n }\n if ('replacementModeAndroid' in request) {\n androidRequest.replacementModeAndroid = request.replacementModeAndroid;\n }\n\n return androidRequest;\n }\n }\n\n // Legacy format handling\n return request;\n};\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Platform-specific purchase parameters\n * @param requestObj.type - Type of purchase: 'inapp' for products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Product purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'inapp'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestPurchase = (\n requestObj: PurchaseRequest,\n): Promise<\n | ProductPurchase\n | SubscriptionPurchase\n | ProductPurchase[]\n | SubscriptionPurchase[]\n | void\n> => {\n const {request, type = 'inapp'} = requestObj;\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 iOS. The `sku` property is required and must be a string.',\n );\n }\n\n const {\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS = false,\n appAccountToken,\n quantity,\n withOffer,\n } = normalizedRequest;\n\n return (async () => {\n const offer = offerToRecordIos(withOffer);\n const purchase = await ExpoIapModule.buyProduct(\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS,\n appAccountToken,\n quantity ?? -1,\n offer,\n );\n\n return type === 'inapp'\n ? (purchase as ProductPurchase)\n : (purchase as SubscriptionPurchase);\n })();\n }\n\n if (Platform.OS === 'android') {\n const normalizedRequest = normalizeRequestProps(request, 'android');\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Android. The `skus` property is required and must be a non-empty array.',\n );\n }\n\n if (type === 'inapp') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'inapp',\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<ProductPurchase[]>;\n })();\n }\n\n if (type === 'subs') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers = [],\n replacementModeAndroid = -1,\n purchaseTokenAndroid,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'subs',\n skuArr: skus,\n purchaseToken: purchaseTokenAndroid,\n replacementMode: replacementModeAndroid,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: subscriptionOffers.map((so: any) => so.offerToken),\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<SubscriptionPurchase[]>;\n })();\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n return Promise.resolve(); // Fallback for unsupported platforms\n};\n\n/**\n * @deprecated Use `requestPurchase({ request, type: 'subs' })` instead. This method will be removed in version 3.0.0.\n *\n * @example\n * ```typescript\n * // Old way (deprecated)\n * await requestSubscription({\n * sku: subscriptionId,\n * // or for Android\n * skus: [subscriptionId],\n * });\n *\n * // New way (recommended)\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestSubscription = async (\n request: RequestSubscriptionPropsWithLegacy,\n): Promise<SubscriptionPurchase | SubscriptionPurchase[] | null | void> => {\n console.warn(\n \"`requestSubscription` is deprecated and will be removed in version 3.0.0. Use `requestPurchase({ request, type: 'subs' })` instead.\",\n );\n return (await requestPurchase({request, type: 'subs'})) as\n | SubscriptionPurchase\n | SubscriptionPurchase[]\n | null\n | void;\n};\n\nexport const finishTransaction = ({\n purchase,\n isConsumable = false,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n}): Promise<PurchaseResult | boolean> => {\n return (\n Platform.select({\n ios: async () => {\n const transactionId = purchase.transactionId;\n if (!transactionId) {\n return Promise.reject(\n new Error('transactionId required to finish iOS transaction'),\n );\n }\n await ExpoIapModule.finishTransaction(transactionId);\n return Promise.resolve(true);\n },\n android: async () => {\n const androidPurchase = purchase as ProductPurchaseAndroid;\n\n if (!('purchaseTokenAndroid' in androidPurchase)) {\n return Promise.reject(\n new Error('purchaseToken is required to finish transaction'),\n );\n }\n if (isConsumable) {\n return ExpoIapModule.consumeProduct(\n androidPurchase.purchaseTokenAndroid,\n );\n } else {\n return ExpoIapModule.acknowledgePurchase(\n androidPurchase.purchaseTokenAndroid,\n );\n }\n },\n }) || (() => Promise.reject(new Error('Unsupported Platform')))\n )();\n};\n\n/**\n * Retrieves the current storefront information from iOS App Store\n *\n * @returns Promise resolving to the storefront country code\n * @throws Error if called on non-iOS platform\n *\n * @example\n * ```typescript\n * const storefront = await getStorefrontIOS();\n * console.log(storefront); // 'US'\n * ```\n *\n * @platform iOS\n */\nexport const getStorefrontIOS = (): Promise<string> => {\n if (Platform.OS !== 'ios') {\n console.warn('getStorefrontIOS: This method is only available on iOS');\n return Promise.resolve('');\n }\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * @deprecated Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getStorefront = (): Promise<string> => {\n console.warn(\n '`getStorefront` is deprecated. Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getStorefrontIOS();\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 */\nexport const validateReceipt = async (\n sku: string,\n androidOptions?: {\n packageName: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n },\n): Promise<any> => {\n if (Platform.OS === 'ios') {\n return await validateReceiptIOS(sku);\n } else 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 await validateReceiptAndroid({\n packageName: androidOptions.packageName,\n productId: sku,\n productToken: androidOptions.productToken,\n accessToken: androidOptions.accessToken,\n isSub: androidOptions.isSub,\n });\n } else {\n throw new Error('Platform not supported');\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 = (options: {\n skuAndroid?: string;\n packageNameAndroid?: string;\n}): Promise<void> => {\n if (Platform.OS === 'ios') {\n return deepLinkToSubscriptionsIos();\n }\n\n if (Platform.OS === 'android') {\n if (!options.skuAndroid) {\n return Promise.reject(\n new Error(\n 'skuAndroid is required to locate subscription in Android Store',\n ),\n );\n }\n if (!options.packageNameAndroid) {\n return Promise.reject(\n new Error(\n 'packageNameAndroid is required to identify your app in Android Store',\n ),\n );\n }\n return deepLinkToSubscriptionsAndroid({\n sku: options.skuAndroid,\n packageName: options.packageNameAndroid,\n });\n }\n\n return Promise.reject(new Error(`Unsupported platform: ${Platform.OS}`));\n};\n\nexport * from './useIap';\nexport * from './utils/errorMapping';\n"]}
@@ -7,21 +7,33 @@ export declare function isProductAndroid<T extends {
7
7
  };
8
8
  /**
9
9
  * Deep link to subscriptions screen on Android.
10
- * @param {string} sku The product's SKU (on Android)
10
+ * @param {Object} params - The parameters object
11
+ * @param {string} params.sku - The product's SKU (on Android)
12
+ * @param {string} params.packageName - The package name of your Android app (e.g., 'com.example.app')
11
13
  * @returns {Promise<void>}
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * await deepLinkToSubscriptionsAndroid({
18
+ * sku: 'subscription_id',
19
+ * packageName: 'com.example.app'
20
+ * });
21
+ * ```
12
22
  */
13
- export declare const deepLinkToSubscriptionsAndroid: ({ sku, }: {
23
+ export declare const deepLinkToSubscriptionsAndroid: ({ sku, packageName, }: {
14
24
  sku: string;
25
+ packageName: string;
15
26
  }) => Promise<void>;
16
27
  /**
17
28
  * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including
18
29
  * your access token in the binary you ship to users is potentially dangerous.
19
30
  * Use server side validation instead for your production builds
20
- * @param {string} packageName package name of your app.
21
- * @param {string} productId product id for your in app product.
22
- * @param {string} productToken token for your purchase (called 'token' in the API documentation).
23
- * @param {string} accessToken OAuth access token with androidpublisher scope. Required for authentication.
24
- * @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.
31
+ * @param {Object} params - The parameters object
32
+ * @param {string} params.packageName - package name of your app.
33
+ * @param {string} params.productId - product id for your in app product.
34
+ * @param {string} params.productToken - token for your purchase (called 'token' in the API documentation).
35
+ * @param {string} params.accessToken - OAuth access token with androidpublisher scope. Required for authentication.
36
+ * @param {boolean} params.isSub - whether this is subscription or inapp. `true` for subscription.
25
37
  * @returns {Promise<ReceiptAndroid>}
26
38
  */
27
39
  export declare const validateReceiptAndroid: ({ packageName, productId, productToken, accessToken, isSub, }: {
@@ -33,7 +45,8 @@ export declare const validateReceiptAndroid: ({ packageName, productId, productT
33
45
  }) => Promise<ReceiptAndroid>;
34
46
  /**
35
47
  * Acknowledge a product (on Android.) No-op on iOS.
36
- * @param {string} token The product's token (on Android)
48
+ * @param {Object} params - The parameters object
49
+ * @param {string} params.token - The product's token (on Android)
37
50
  * @returns {Promise<PurchaseResult | void>}
38
51
  */
39
52
  export declare const acknowledgePurchaseAndroid: ({ token, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAG7D,wBAAgB,gBAAgB,CAAC,CAAC,SAAS;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,EAC5D,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,CAAC,GAAG;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAC,CAOnC;AAED;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,GAAU,UAElD;IACD,GAAG,EAAE,MAAM,CAAC;CACb,KAAG,OAAO,CAAC,IAAI,CAIf,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GAAU,+DAM1C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,KAAG,OAAO,CAAC,cAAc,CAuBzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,YAExC;IACD,KAAK,EAAE,MAAM,CAAC;CACf,KAAG,OAAO,CAAC,cAAc,GAAG,OAAO,GAAG,IAAI,CAE1C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,QAAa,OAAO,CAAC,IAAI,CAE/D,CAAC"}
1
+ {"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAG7D,wBAAgB,gBAAgB,CAAC,CAAC,SAAS;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,EAC5D,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,CAAC,GAAG;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAC,CAOnC;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,GAAU,uBAGlD;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB,KAAG,OAAO,CAAC,IAAI,CAUf,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,GAAU,+DAM1C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,KAAG,OAAO,CAAC,cAAc,CAuBzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAI,YAExC;IACD,KAAK,EAAE,MAAM,CAAC;CACf,KAAG,OAAO,CAAC,cAAc,GAAG,OAAO,GAAG,IAAI,CAE1C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,QAAa,OAAO,CAAC,IAAI,CAE/D,CAAC"}
@@ -11,21 +11,35 @@ export function isProductAndroid(item) {
11
11
  }
12
12
  /**
13
13
  * Deep link to subscriptions screen on Android.
14
- * @param {string} sku The product's SKU (on Android)
14
+ * @param {Object} params - The parameters object
15
+ * @param {string} params.sku - The product's SKU (on Android)
16
+ * @param {string} params.packageName - The package name of your Android app (e.g., 'com.example.app')
15
17
  * @returns {Promise<void>}
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * await deepLinkToSubscriptionsAndroid({
22
+ * sku: 'subscription_id',
23
+ * packageName: 'com.example.app'
24
+ * });
25
+ * ```
16
26
  */
17
- export const deepLinkToSubscriptionsAndroid = async ({ sku, }) => {
18
- return Linking.openURL(`https://play.google.com/store/account/subscriptions?package=${await ExpoIapModule.getPackageName()}&sku=${sku}`);
27
+ export const deepLinkToSubscriptionsAndroid = async ({ sku, packageName, }) => {
28
+ if (!packageName) {
29
+ throw new Error('packageName is required for deepLinkToSubscriptionsAndroid');
30
+ }
31
+ return Linking.openURL(`https://play.google.com/store/account/subscriptions?package=${packageName}&sku=${sku}`);
19
32
  };
20
33
  /**
21
34
  * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including
22
35
  * your access token in the binary you ship to users is potentially dangerous.
23
36
  * Use server side validation instead for your production builds
24
- * @param {string} packageName package name of your app.
25
- * @param {string} productId product id for your in app product.
26
- * @param {string} productToken token for your purchase (called 'token' in the API documentation).
27
- * @param {string} accessToken OAuth access token with androidpublisher scope. Required for authentication.
28
- * @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.
37
+ * @param {Object} params - The parameters object
38
+ * @param {string} params.packageName - package name of your app.
39
+ * @param {string} params.productId - product id for your in app product.
40
+ * @param {string} params.productToken - token for your purchase (called 'token' in the API documentation).
41
+ * @param {string} params.accessToken - OAuth access token with androidpublisher scope. Required for authentication.
42
+ * @param {boolean} params.isSub - whether this is subscription or inapp. `true` for subscription.
29
43
  * @returns {Promise<ReceiptAndroid>}
30
44
  */
31
45
  export const validateReceiptAndroid = async ({ packageName, productId, productToken, accessToken, isSub, }) => {
@@ -49,7 +63,8 @@ export const validateReceiptAndroid = async ({ packageName, productId, productTo
49
63
  };
50
64
  /**
51
65
  * Acknowledge a product (on Android.) No-op on iOS.
52
- * @param {string} token The product's token (on Android)
66
+ * @param {Object} params - The parameters object
67
+ * @param {string} params.token - The product's token (on Android)
53
68
  * @returns {Promise<PurchaseResult | void>}
54
69
  */
55
70
  export const acknowledgePurchaseAnd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C,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YAClD,UAAU,EAAE,QAAQ,CAAC,MAAM;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACzC,KAAK,GAGN,EAA4C,EAAE;IAC7C,OAAO,aAAa,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,IAAmB,EAAE;IAClE,OAAO,OAAO,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// External dependencies\nimport {Linking} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport {PurchaseResult} from '../ExpoIap.types';\nimport {ReceiptAndroid} from '../types/ExpoIapAndroid.types';\n\n// Type guards\nexport function isProductAndroid<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'android'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n item.platform === 'android'\n );\n}\n\n/**\n * Deep link to subscriptions screen on Android.\n * @param {string} sku The product's SKU (on Android)\n * @returns {Promise<void>}\n */\nexport const deepLinkToSubscriptionsAndroid = async ({\n sku,\n}: {\n sku: string;\n}): Promise<void> => {\n return Linking.openURL(\n `https://play.google.com/store/account/subscriptions?package=${await ExpoIapModule.getPackageName()}&sku=${sku}`,\n );\n};\n\n/**\n * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including\n * your access token in the binary you ship to users is potentially dangerous.\n * Use server side validation instead for your production builds\n * @param {string} packageName package name of your app.\n * @param {string} productId product id for your in app product.\n * @param {string} productToken token for your purchase (called 'token' in the API documentation).\n * @param {string} accessToken OAuth access token with androidpublisher scope. Required for authentication.\n * @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.\n * @returns {Promise<ReceiptAndroid>}\n */\nexport const validateReceiptAndroid = async ({\n packageName,\n productId,\n productToken,\n accessToken,\n isSub,\n}: {\n packageName: string;\n productId: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n}): Promise<ReceiptAndroid> => {\n const type = isSub ? 'subscriptions' : 'products';\n\n const url =\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications' +\n `/${packageName}/purchases/${type}/${productId}` +\n `/tokens/${productToken}`;\n\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n });\n\n if (!response.ok) {\n throw Object.assign(new Error(response.statusText), {\n statusCode: response.status,\n });\n }\n\n return response.json();\n};\n\n/**\n * Acknowledge a product (on Android.) No-op on iOS.\n * @param {string} token The product's token (on Android)\n * @returns {Promise<PurchaseResult | void>}\n */\nexport const acknowledgePurchaseAndroid = ({\n token,\n}: {\n token: string;\n}): Promise<PurchaseResult | boolean | void> => {\n return ExpoIapModule.acknowledgePurchase(token);\n};\n\n/**\n * Open the Google Play Store to redeem offer codes (Android only).\n * Note: Google Play does not provide a direct API to redeem codes within the app.\n * This function opens the Play Store where users can manually enter their codes.\n *\n * @returns {Promise<void>}\n */\nexport const openRedeemOfferCodeAndroid = async (): Promise<void> => {\n return Linking.openURL(`https://play.google.com/redeem?code=`);\n};\n"]}
1
+ {"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,mBAAmB;AACnB,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAM7C,cAAc;AACd,MAAM,UAAU,gBAAgB,CAC9B,IAAa;IAEb,OAAO,CACL,IAAI,IAAI,IAAI;QACZ,OAAO,IAAI,KAAK,QAAQ;QACxB,UAAU,IAAI,IAAI;QAClB,I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,GAGN,EAA4C,EAAE;IAC7C,OAAO,aAAa,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,IAAmB,EAAE;IAClE,OAAO,OAAO,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// External dependencies\nimport {Linking} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport {PurchaseResult} from '../ExpoIap.types';\nimport {ReceiptAndroid} from '../types/ExpoIapAndroid.types';\n\n// Type guards\nexport function isProductAndroid<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'android'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n item.platform === 'android'\n );\n}\n\n/**\n * Deep link to subscriptions screen on Android.\n * @param {Object} params - The parameters object\n * @param {string} params.sku - The product's SKU (on Android)\n * @param {string} params.packageName - The package name of your Android app (e.g., 'com.example.app')\n * @returns {Promise<void>}\n *\n * @example\n * ```typescript\n * await deepLinkToSubscriptionsAndroid({\n * sku: 'subscription_id',\n * packageName: 'com.example.app'\n * });\n * ```\n */\nexport const deepLinkToSubscriptionsAndroid = async ({\n sku,\n packageName,\n}: {\n sku: string;\n packageName: string;\n}): Promise<void> => {\n if (!packageName) {\n throw new Error(\n 'packageName is required for deepLinkToSubscriptionsAndroid',\n );\n }\n\n return Linking.openURL(\n `https://play.google.com/store/account/subscriptions?package=${packageName}&sku=${sku}`,\n );\n};\n\n/**\n * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including\n * your access token in the binary you ship to users is potentially dangerous.\n * Use server side validation instead for your production builds\n * @param {Object} params - The parameters object\n * @param {string} params.packageName - package name of your app.\n * @param {string} params.productId - product id for your in app product.\n * @param {string} params.productToken - token for your purchase (called 'token' in the API documentation).\n * @param {string} params.accessToken - OAuth access token with androidpublisher scope. Required for authentication.\n * @param {boolean} params.isSub - whether this is subscription or inapp. `true` for subscription.\n * @returns {Promise<ReceiptAndroid>}\n */\nexport const validateReceiptAndroid = async ({\n packageName,\n productId,\n productToken,\n accessToken,\n isSub,\n}: {\n packageName: string;\n productId: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n}): Promise<ReceiptAndroid> => {\n const type = isSub ? 'subscriptions' : 'products';\n\n const url =\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications' +\n `/${packageName}/purchases/${type}/${productId}` +\n `/tokens/${productToken}`;\n\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n });\n\n if (!response.ok) {\n throw Object.assign(new Error(response.statusText), {\n statusCode: response.status,\n });\n }\n\n return response.json();\n};\n\n/**\n * Acknowledge a product (on Android.) No-op on iOS.\n * @param {Object} params - The parameters object\n * @param {string} params.token - The product's token (on Android)\n * @returns {Promise<PurchaseResult | void>}\n */\nexport const acknowledgePurchaseAndroid = ({\n token,\n}: {\n token: string;\n}): Promise<PurchaseResult | boolean | void> => {\n return ExpoIapModule.acknowledgePurchase(token);\n};\n\n/**\n * Open the Google Play Store to redeem offer codes (Android only).\n * Note: Google Play does not provide a direct API to redeem codes within the app.\n * This function opens the Play Store where users can manually enter their codes.\n *\n * @returns {Promise<void>}\n */\nexport const openRedeemOfferCodeAndroid = async (): Promise<void> => {\n return Linking.openURL(`https://play.google.com/redeem?code=`);\n};\n"]}
@@ -198,6 +198,13 @@ export declare const getPromotedProductIOS: () => Promise<any | null>;
198
198
  * @platform iOS
199
199
  */
200
200
  export declare const buyPromotedProductIOS: () => Promise<void>;
201
+ /**
202
+ * Deep link to subscriptions screen on iOS.
203
+ * @returns {Promise<void>}
204
+ *
205
+ * @platform iOS
206
+ */
207
+ export declare const deepLinkToSubscriptionsIos: () => Promise<void>;
201
208
  /**
202
209
  * @deprecated Use `syncIOS` instead. This function will be removed in version 3.0.0.
203
210
  */
@@ -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MAAM,KAAG,OAAO,CAAC,eAAe,CAKvE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,OAAO,CAAC,eAAe,CAKtE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,KAAK,MAAM,KACV,OAAO,CAAC,mBAAmB,CAK7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,OAAO,CAAC,IAAI,CAKtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,QAAO,OAAO,CAAC,MAAM,CAK9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,KAAG,OAAO,CAAC,OAAO,CAKlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,OAAO,CAAC,MAAM,CAK7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,KAAK,MAAM,KACV,OAAO,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,eAAe,CAAC;CACrC,CAKA,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,QAAO,OAAO,CAAC,OAAO,CAK5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAO,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAKpE,CAAC"}
@@ -2,6 +2,7 @@
2
2
  // Internal modules
3
3
  import { purchaseUpdatedListener } from '..';
4
4
  import ExpoIapModule from '../ExpoIapModule';
5
+ import { Linking } from 'react-native';
5
6
  // Listeners
6
7
  /**
7
8
  * @deprecated Use `purchaseUpdatedListener` instead. This function will be removed in a future version.
@@ -240,6 +241,13 @@ export const getPromotedProductIOS = () => {
240
241
  export const buyPromotedProductIOS = () => {
241
242
  return ExpoIapModule.buyPromotedProduct();
242
243
  };
244
+ /**
245
+ * Deep link to subscriptions screen on iOS.
246
+ * @returns {Promise<void>}
247
+ *
248
+ * @platform iOS
249
+ */
250
+ export const deepLinkToSubscriptionsIos = () => Linking.openURL('https://apps.apple.com/account/subscriptions');
243
251
  // ============= DEPRECATED FUNCTIONS =============
244
252
  // These will be removed in version 3.0.0
245
253
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,mBAAmB;AACnB,OAAO,EAAC,uBAAuB,EAAC,MAAM,IAAI,CAAC;AAC3C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAmB7C,YAAY;AACZ;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,QAA2C,EAC3C,EAAE;IACF,MAAM,iBAAiB,GAAG,CAAC,IAAa,EAA2B,EAAE;QACnE,OAAO,CACL,IAAI,IAAI,IAAI;YACZ,OAAO,IAAI,KAAK,QAAQ;YACxB,IAAI,IAAI,IAAI;YACZ,eAAe,IAAI,IAAI;YACvB,UAAU,IAAI,IAAI,CACnB,CAAC;IACJ,CAAC,CAAC;IAEF,iEAAiE;IACjE,MAAM,6BAA6B,GAAG,CACpC,QAAyC,EACvB,EAAE;QACpB,8CAA8C;QAC9C,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChC,OAAO;gBACL,WAAW,EAAE,QAA2B;aACzC,CAAC;QACJ,CAAC;QAED,sDAAsD;QACtD,OAAO;YACL,WAAW,EAAE,QAA2B;SACzC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,uBAAuB,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC1C,yEAAyE;QACzE,MAAM,KAAK,GAAG,6BAA6B,CAAC,QAAQ,CAAC,CAAC;QACtD,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAA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AC;IACF,OAAO,0BAA0B,EAAE,CAAC;AACtC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAoB,EAAE;IACjD,OAAO,CAAC,IAAI,CACV,6GAA6G,CAC9G,CAAC;IACF,OAAO,aAAa,EAAE,CAAC;AACzB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAW,EAAoB,EAAE;IACrE,OAAO,CAAC,IAAI,CACV,gIAAgI,CACjI,CAAC;IACF,OAAO,wBAAwB,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChE,OAAO,CAAC,IAAI,CACV,wHAAwH,CACzH,CAAC;IACF,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,GAAW,EAMV,EAAE;IACH,OAAO,CAAC,IAAI,CACV,uHAAuH,CACxH,CAAC;IACF,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAqB,EAAE;IAC/D,OAAO,CAAC,IAAI,CACV,0IAA0I,CAC3I,CAAC;IACF,OAAO,6BAA6B,EAAE,CAAC;AACzC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAsC,EAAE;IACvE,OAAO,CAAC,IAAI,CACV,wHAAwH,CACzH,CAAC;IACF,OAAO,oBAAoB,EAAE,CAAC;AAChC,CAAC,CAAC","sourcesContent":["// External dependencies\n\n// Internal modules\nimport {purchaseUpdatedListener} from '..';\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport {\n ProductPurchase,\n PurchaseError,\n Purchase,\n SubscriptionPurchase,\n} from '../ExpoIap.types';\nimport type {\n ProductStatusIos,\n AppTransactionIOS,\n} from '../types/ExpoIapIos.types';\n\nexport type TransactionEvent = {\n transaction?: ProductPurchase;\n error?: PurchaseError;\n};\n\n// Listeners\n/**\n * @deprecated Use `purchaseUpdatedListener` instead. This function will be removed in a future version.\n *\n * The `transactionUpdatedIos` function is redundant as it simply wraps `purchaseUpdatedListener`.\n * You can achieve the same functionality by using `purchaseUpdatedListener` directly.\n *\n * @example\n * // Instead of:\n * // transactionUpdatedIos((event) => { ... });\n *\n * // Use:\n * // purchaseUpdatedListener((purchase) => { ... });\n */\nexport const transactionUpdatedIos = (\n listener: (event: TransactionEvent) => void,\n) => {\n const isProductPurchase = (item: unknown): item is ProductPurchase => {\n return (\n item != null &&\n typeof item === 'object' &&\n 'id' in item &&\n 'transactionId' in item &&\n 'platform' in item\n );\n };\n\n // Helper function to safely convert Purchase to TransactionEvent\n const mapPurchaseToTransactionEvent = (\n purchase: Purchase | SubscriptionPurchase,\n ): TransactionEvent => {\n // Validate the purchase object before casting\n if (isProductPurchase(purchase)) {\n return {\n transaction: purchase as ProductPurchase,\n };\n }\n\n // Fallback: create a basic TransactionEvent structure\n return {\n transaction: purchase as ProductPurchase,\n };\n };\n\n return purchaseUpdatedListener((purchase) => {\n // Convert Purchase to TransactionEvent format for backward compatibility\n const event = mapPurchaseToTransactionEvent(purchase);\n listener(event);\n });\n};\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 item.platform === '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 = (): Promise<null> => {\n return ExpoIapModule.sync();\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 = (\n groupID: string,\n): Promise<boolean> => {\n return ExpoIapModule.isEligibleForIntroOffer(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 = (\n sku: string,\n): Promise<ProductStatusIos[]> => {\n return ExpoIapModule.subscriptionStatus(sku);\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 = (\n sku: string,\n): Promise<ProductPurchase> => {\n return ExpoIapModule.currentEntitlement(sku);\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 = (sku: string): Promise<ProductPurchase> => {\n return ExpoIapModule.latestTransaction(sku);\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 */\ntype RefundRequestStatus = 'success' | 'userCancelled';\nexport const beginRefundRequestIOS = (\n sku: string,\n): Promise<RefundRequestStatus> => {\n return ExpoIapModule.beginRefundRequest(sku);\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * When the user changes subscription renewal status, the system will emit events to\n * purchaseUpdatedListener and transactionUpdatedIos listeners.\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 showManageSubscriptionsIOS = (): Promise<null> => {\n return ExpoIapModule.showManageSubscriptions();\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 getReceiptIOS = (): Promise<string> => {\n return ExpoIapModule.getReceiptData();\n};\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 = (sku: string): Promise<boolean> => {\n return ExpoIapModule.isTransactionVerified(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 = (sku: string): Promise<string> => {\n return ExpoIapModule.getTransactionJws(sku);\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 * @param {string} sku The product's SKU (on iOS)\n * @returns {Promise<{\n * isValid: boolean;\n * receiptData: string;\n * jwsRepresentation: string;\n * latestTransaction?: ProductPurchase;\n * }>}\n */\nexport const validateReceiptIOS = async (\n sku: string,\n): Promise<{\n isValid: boolean;\n receiptData: string;\n jwsRepresentation: string;\n latestTransaction?: ProductPurchase;\n}> => {\n const result = await ExpoIapModule.validateReceiptIOS(sku);\n return result;\n};\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 = (): Promise<boolean> => {\n return ExpoIapModule.presentCodeRedemptionSheet();\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 = (): Promise<AppTransactionIOS | null> => {\n return ExpoIapModule.getAppTransaction();\n};\n\n/**\n * Get the promoted product details (iOS only).\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product details or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getPromotedProductIOS = (): Promise<any | null> => {\n return ExpoIapModule.getPromotedProduct();\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 buyPromotedProductIOS = (): Promise<void> => {\n return ExpoIapModule.buyPromotedProduct();\n};\n\n// ============= DEPRECATED FUNCTIONS =============\n// These will be removed in version 3.0.0\n\n/**\n * @deprecated Use `syncIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const sync = (): Promise<null> => {\n console.warn(\n '`sync` is deprecated. Use `syncIOS` instead. This function will be removed in version 3.0.0.',\n );\n return syncIOS();\n};\n\n/**\n * @deprecated Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const isEligibleForIntroOffer = (groupID: string): Promise<boolean> => {\n console.warn(\n '`isEligibleForIntroOffer` is deprecated. Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.',\n );\n return isEligibleForIntroOfferIOS(groupID);\n};\n\n/**\n * @deprecated Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const subscriptionStatus = (\n sku: string,\n): Promise<ProductStatusIos[]> => {\n console.warn(\n '`subscriptionStatus` is deprecated. Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.',\n );\n return subscriptionStatusIOS(sku);\n};\n\n/**\n * @deprecated Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const currentEntitlement = (sku: string): Promise<ProductPurchase> => {\n console.warn(\n '`currentEntitlement` is deprecated. Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.',\n );\n return currentEntitlementIOS(sku);\n};\n\n/**\n * @deprecated Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const latestTransaction = (sku: string): Promise<ProductPurchase> => {\n console.warn(\n '`latestTransaction` is deprecated. Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.',\n );\n return latestTransactionIOS(sku);\n};\n\n/**\n * @deprecated Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const beginRefundRequest = (\n sku: string,\n): Promise<RefundRequestStatus> => {\n console.warn(\n '`beginRefundRequest` is deprecated. Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.',\n );\n return beginRefundRequestIOS(sku);\n};\n\n/**\n * @deprecated Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const showManageSubscriptions = (): Promise<null> => {\n console.warn(\n '`showManageSubscriptions` is deprecated. Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.',\n );\n return showManageSubscriptionsIOS();\n};\n\n/**\n * @deprecated Use `getReceiptIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getReceiptIos = (): Promise<string> => {\n console.warn(\n '`getReceiptIos` is deprecated. Use `getReceiptIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getReceiptIOS();\n};\n\n/**\n * @deprecated Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const isTransactionVerified = (sku: string): Promise<boolean> => {\n console.warn(\n '`isTransactionVerified` is deprecated. Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.',\n );\n return isTransactionVerifiedIOS(sku);\n};\n\n/**\n * @deprecated Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getTransactionJws = (sku: string): Promise<string> => {\n console.warn(\n '`getTransactionJws` is deprecated. Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getTransactionJwsIOS(sku);\n};\n\n/**\n * @deprecated Use `validateReceiptIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const validateReceiptIos = async (\n sku: string,\n): Promise<{\n isValid: boolean;\n receiptData: string;\n jwsRepresentation: string;\n latestTransaction?: ProductPurchase;\n}> => {\n console.warn(\n '`validateReceiptIos` is deprecated. Use `validateReceiptIOS` instead. This function will be removed in version 3.0.0.',\n );\n return validateReceiptIOS(sku);\n};\n\n/**\n * @deprecated Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const presentCodeRedemptionSheet = (): Promise<boolean> => {\n console.warn(\n '`presentCodeRedemptionSheet` is deprecated. Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.',\n );\n return presentCodeRedemptionSheetIOS();\n};\n\n/**\n * @deprecated Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getAppTransaction = (): Promise<AppTransactionIOS | null> => {\n console.warn(\n '`getAppTransaction` is deprecated. Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getAppTransactionIOS();\n};\n"]}
1
+ {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,mBAAmB;AACnB,OAAO,EAAC,uBAAuB,EAAC,MAAM,IAAI,CAAC;AAC3C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAa7C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;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I,CACjI,CAAC;IACF,OAAO,wBAAwB,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChE,OAAO,CAAC,IAAI,CACV,wHAAwH,CACzH,CAAC;IACF,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,GAAW,EAMV,EAAE;IACH,OAAO,CAAC,IAAI,CACV,uHAAuH,CACxH,CAAC;IACF,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAqB,EAAE;IAC/D,OAAO,CAAC,IAAI,CACV,0IAA0I,CAC3I,CAAC;IACF,OAAO,6BAA6B,EAAE,CAAC;AACzC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAsC,EAAE;IACvE,OAAO,CAAC,IAAI,CACV,wHAAwH,CACzH,CAAC;IACF,OAAO,oBAAoB,EAAE,CAAC;AAChC,CAAC,CAAC","sourcesContent":["// External dependencies\n\n// Internal modules\nimport {purchaseUpdatedListener} from '..';\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport {\n ProductPurchase,\n PurchaseError,\n Purchase,\n SubscriptionPurchase,\n} from '../ExpoIap.types';\nimport type {\n ProductStatusIos,\n AppTransactionIOS,\n} from '../types/ExpoIapIos.types';\nimport {Linking} from 'react-native';\n\nexport type TransactionEvent = {\n transaction?: ProductPurchase;\n error?: PurchaseError;\n};\n\n// Listeners\n/**\n * @deprecated Use `purchaseUpdatedListener` instead. This function will be removed in a future version.\n *\n * The `transactionUpdatedIos` function is redundant as it simply wraps `purchaseUpdatedListener`.\n * You can achieve the same functionality by using `purchaseUpdatedListener` directly.\n *\n * @example\n * // Instead of:\n * // transactionUpdatedIos((event) => { ... });\n *\n * // Use:\n * // purchaseUpdatedListener((purchase) => { ... });\n */\nexport const transactionUpdatedIos = (\n listener: (event: TransactionEvent) => void,\n) => {\n const isProductPurchase = (item: unknown): item is ProductPurchase => {\n return (\n item != null &&\n typeof item === 'object' &&\n 'id' in item &&\n 'transactionId' in item &&\n 'platform' in item\n );\n };\n\n // Helper function to safely convert Purchase to TransactionEvent\n const mapPurchaseToTransactionEvent = (\n purchase: Purchase | SubscriptionPurchase,\n ): TransactionEvent => {\n // Validate the purchase object before casting\n if (isProductPurchase(purchase)) {\n return {\n transaction: purchase as ProductPurchase,\n };\n }\n\n // Fallback: create a basic TransactionEvent structure\n return {\n transaction: purchase as ProductPurchase,\n };\n };\n\n return purchaseUpdatedListener((purchase) => {\n // Convert Purchase to TransactionEvent format for backward compatibility\n const event = mapPurchaseToTransactionEvent(purchase);\n listener(event);\n });\n};\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 item.platform === '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 = (): Promise<null> => {\n return ExpoIapModule.sync();\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 = (\n groupID: string,\n): Promise<boolean> => {\n return ExpoIapModule.isEligibleForIntroOffer(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 = (\n sku: string,\n): Promise<ProductStatusIos[]> => {\n return ExpoIapModule.subscriptionStatus(sku);\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 = (\n sku: string,\n): Promise<ProductPurchase> => {\n return ExpoIapModule.currentEntitlement(sku);\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 = (sku: string): Promise<ProductPurchase> => {\n return ExpoIapModule.latestTransaction(sku);\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 */\ntype RefundRequestStatus = 'success' | 'userCancelled';\nexport const beginRefundRequestIOS = (\n sku: string,\n): Promise<RefundRequestStatus> => {\n return ExpoIapModule.beginRefundRequest(sku);\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * When the user changes subscription renewal status, the system will emit events to\n * purchaseUpdatedListener and transactionUpdatedIos listeners.\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 showManageSubscriptionsIOS = (): Promise<null> => {\n return ExpoIapModule.showManageSubscriptions();\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 getReceiptIOS = (): Promise<string> => {\n return ExpoIapModule.getReceiptData();\n};\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 = (sku: string): Promise<boolean> => {\n return ExpoIapModule.isTransactionVerified(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 = (sku: string): Promise<string> => {\n return ExpoIapModule.getTransactionJws(sku);\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 * @param {string} sku The product's SKU (on iOS)\n * @returns {Promise<{\n * isValid: boolean;\n * receiptData: string;\n * jwsRepresentation: string;\n * latestTransaction?: ProductPurchase;\n * }>}\n */\nexport const validateReceiptIOS = async (\n sku: string,\n): Promise<{\n isValid: boolean;\n receiptData: string;\n jwsRepresentation: string;\n latestTransaction?: ProductPurchase;\n}> => {\n const result = await ExpoIapModule.validateReceiptIOS(sku);\n return result;\n};\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 = (): Promise<boolean> => {\n return ExpoIapModule.presentCodeRedemptionSheet();\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 = (): Promise<AppTransactionIOS | null> => {\n return ExpoIapModule.getAppTransaction();\n};\n\n/**\n * Get the promoted product details (iOS only).\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product details or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getPromotedProductIOS = (): Promise<any | null> => {\n return ExpoIapModule.getPromotedProduct();\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 buyPromotedProductIOS = (): Promise<void> => {\n return ExpoIapModule.buyPromotedProduct();\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// ============= DEPRECATED FUNCTIONS =============\n// These will be removed in version 3.0.0\n\n/**\n * @deprecated Use `syncIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const sync = (): Promise<null> => {\n console.warn(\n '`sync` is deprecated. Use `syncIOS` instead. This function will be removed in version 3.0.0.',\n );\n return syncIOS();\n};\n\n/**\n * @deprecated Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const isEligibleForIntroOffer = (groupID: string): Promise<boolean> => {\n console.warn(\n '`isEligibleForIntroOffer` is deprecated. Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.',\n );\n return isEligibleForIntroOfferIOS(groupID);\n};\n\n/**\n * @deprecated Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const subscriptionStatus = (\n sku: string,\n): Promise<ProductStatusIos[]> => {\n console.warn(\n '`subscriptionStatus` is deprecated. Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.',\n );\n return subscriptionStatusIOS(sku);\n};\n\n/**\n * @deprecated Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const currentEntitlement = (sku: string): Promise<ProductPurchase> => {\n console.warn(\n '`currentEntitlement` is deprecated. Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.',\n );\n return currentEntitlementIOS(sku);\n};\n\n/**\n * @deprecated Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const latestTransaction = (sku: string): Promise<ProductPurchase> => {\n console.warn(\n '`latestTransaction` is deprecated. Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.',\n );\n return latestTransactionIOS(sku);\n};\n\n/**\n * @deprecated Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const beginRefundRequest = (\n sku: string,\n): Promise<RefundRequestStatus> => {\n console.warn(\n '`beginRefundRequest` is deprecated. Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.',\n );\n return beginRefundRequestIOS(sku);\n};\n\n/**\n * @deprecated Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const showManageSubscriptions = (): Promise<null> => {\n console.warn(\n '`showManageSubscriptions` is deprecated. Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.',\n );\n return showManageSubscriptionsIOS();\n};\n\n/**\n * @deprecated Use `getReceiptIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getReceiptIos = (): Promise<string> => {\n console.warn(\n '`getReceiptIos` is deprecated. Use `getReceiptIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getReceiptIOS();\n};\n\n/**\n * @deprecated Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const isTransactionVerified = (sku: string): Promise<boolean> => {\n console.warn(\n '`isTransactionVerified` is deprecated. Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.',\n );\n return isTransactionVerifiedIOS(sku);\n};\n\n/**\n * @deprecated Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getTransactionJws = (sku: string): Promise<string> => {\n console.warn(\n '`getTransactionJws` is deprecated. Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getTransactionJwsIOS(sku);\n};\n\n/**\n * @deprecated Use `validateReceiptIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const validateReceiptIos = async (\n sku: string,\n): Promise<{\n isValid: boolean;\n receiptData: string;\n jwsRepresentation: string;\n latestTransaction?: ProductPurchase;\n}> => {\n console.warn(\n '`validateReceiptIos` is deprecated. Use `validateReceiptIOS` instead. This function will be removed in version 3.0.0.',\n );\n return validateReceiptIOS(sku);\n};\n\n/**\n * @deprecated Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const presentCodeRedemptionSheet = (): Promise<boolean> => {\n console.warn(\n '`presentCodeRedemptionSheet` is deprecated. Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.',\n );\n return presentCodeRedemptionSheetIOS();\n};\n\n/**\n * @deprecated Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getAppTransaction = (): Promise<AppTransactionIOS | null> => {\n console.warn(\n '`getAppTransaction` is deprecated. Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getAppTransactionIOS();\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-iap",
3
- "version": "2.7.9",
3
+ "version": "2.7.10",
4
4
  "description": "In App Purchase module in Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
package/src/index.ts CHANGED
@@ -4,8 +4,16 @@ import {Platform} from 'react-native';
4
4
 
5
5
  // Internal modules
6
6
  import ExpoIapModule from './ExpoIapModule';
7
- import {isProductIos, validateReceiptIOS} from './modules/ios';
8
- import {isProductAndroid, validateReceiptAndroid} from './modules/android';
7
+ import {
8
+ isProductIos,
9
+ validateReceiptIOS,
10
+ deepLinkToSubscriptionsIos,
11
+ } from './modules/ios';
12
+ import {
13
+ isProductAndroid,
14
+ validateReceiptAndroid,
15
+ deepLinkToSubscriptionsAndroid,
16
+ } from './modules/android';
9
17
 
10
18
  // Types
11
19
  import {
@@ -694,5 +702,55 @@ export const validateReceipt = async (
694
702
  }
695
703
  };
696
704
 
705
+ /**
706
+ * Deeplinks to native interface that allows users to manage their subscriptions
707
+ * @param options.skuAndroid - Required for Android to locate specific subscription (ignored on iOS)
708
+ * @param options.packageNameAndroid - Required for Android to identify your app (ignored on iOS)
709
+ *
710
+ * @returns Promise that resolves when the deep link is successfully opened
711
+ *
712
+ * @throws {Error} When called on unsupported platform or when required Android parameters are missing
713
+ *
714
+ * @example
715
+ * import { deepLinkToSubscriptions } from 'expo-iap';
716
+ *
717
+ * // Works on both iOS and Android
718
+ * await deepLinkToSubscriptions({
719
+ * skuAndroid: 'your_subscription_sku',
720
+ * packageNameAndroid: 'com.example.app'
721
+ * });
722
+ */
723
+ export const deepLinkToSubscriptions = (options: {
724
+ skuAndroid?: string;
725
+ packageNameAndroid?: string;
726
+ }): Promise<void> => {
727
+ if (Platform.OS === 'ios') {
728
+ return deepLinkToSubscriptionsIos();
729
+ }
730
+
731
+ if (Platform.OS === 'android') {
732
+ if (!options.skuAndroid) {
733
+ return Promise.reject(
734
+ new Error(
735
+ 'skuAndroid is required to locate subscription in Android Store',
736
+ ),
737
+ );
738
+ }
739
+ if (!options.packageNameAndroid) {
740
+ return Promise.reject(
741
+ new Error(
742
+ 'packageNameAndroid is required to identify your app in Android Store',
743
+ ),
744
+ );
745
+ }
746
+ return deepLinkToSubscriptionsAndroid({
747
+ sku: options.skuAndroid,
748
+ packageName: options.packageNameAndroid,
749
+ });
750
+ }
751
+
752
+ return Promise.reject(new Error(`Unsupported platform: ${Platform.OS}`));
753
+ };
754
+
697
755
  export * from './useIap';
698
756
  export * from './utils/errorMapping';
@@ -22,16 +22,34 @@ export function isProductAndroid<T extends {platform?: string}>(
22
22
 
23
23
  /**
24
24
  * Deep link to subscriptions screen on Android.
25
- * @param {string} sku The product's SKU (on Android)
25
+ * @param {Object} params - The parameters object
26
+ * @param {string} params.sku - The product's SKU (on Android)
27
+ * @param {string} params.packageName - The package name of your Android app (e.g., 'com.example.app')
26
28
  * @returns {Promise<void>}
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * await deepLinkToSubscriptionsAndroid({
33
+ * sku: 'subscription_id',
34
+ * packageName: 'com.example.app'
35
+ * });
36
+ * ```
27
37
  */
28
38
  export const deepLinkToSubscriptionsAndroid = async ({
29
39
  sku,
40
+ packageName,
30
41
  }: {
31
42
  sku: string;
43
+ packageName: string;
32
44
  }): Promise<void> => {
45
+ if (!packageName) {
46
+ throw new Error(
47
+ 'packageName is required for deepLinkToSubscriptionsAndroid',
48
+ );
49
+ }
50
+
33
51
  return Linking.openURL(
34
- `https://play.google.com/store/account/subscriptions?package=${await ExpoIapModule.getPackageName()}&sku=${sku}`,
52
+ `https://play.google.com/store/account/subscriptions?package=${packageName}&sku=${sku}`,
35
53
  );
36
54
  };
37
55
 
@@ -39,11 +57,12 @@ export const deepLinkToSubscriptionsAndroid = async ({
39
57
  * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including
40
58
  * your access token in the binary you ship to users is potentially dangerous.
41
59
  * Use server side validation instead for your production builds
42
- * @param {string} packageName package name of your app.
43
- * @param {string} productId product id for your in app product.
44
- * @param {string} productToken token for your purchase (called 'token' in the API documentation).
45
- * @param {string} accessToken OAuth access token with androidpublisher scope. Required for authentication.
46
- * @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.
60
+ * @param {Object} params - The parameters object
61
+ * @param {string} params.packageName - package name of your app.
62
+ * @param {string} params.productId - product id for your in app product.
63
+ * @param {string} params.productToken - token for your purchase (called 'token' in the API documentation).
64
+ * @param {string} params.accessToken - OAuth access token with androidpublisher scope. Required for authentication.
65
+ * @param {boolean} params.isSub - whether this is subscription or inapp. `true` for subscription.
47
66
  * @returns {Promise<ReceiptAndroid>}
48
67
  */
49
68
  export const validateReceiptAndroid = async ({
@@ -85,7 +104,8 @@ export const validateReceiptAndroid = async ({
85
104
 
86
105
  /**
87
106
  * Acknowledge a product (on Android.) No-op on iOS.
88
- * @param {string} token The product's token (on Android)
107
+ * @param {Object} params - The parameters object
108
+ * @param {string} params.token - The product's token (on Android)
89
109
  * @returns {Promise<PurchaseResult | void>}
90
110
  */
91
111
  export const acknowledgePurchaseAndroid = ({
@@ -15,6 +15,7 @@ import type {
15
15
  ProductStatusIos,
16
16
  AppTransactionIOS,
17
17
  } from '../types/ExpoIapIos.types';
18
+ import {Linking} from 'react-native';
18
19
 
19
20
  export type TransactionEvent = {
20
21
  transaction?: ProductPurchase;
@@ -314,6 +315,15 @@ export const buyPromotedProductIOS = (): Promise<void> => {
314
315
  return ExpoIapModule.buyPromotedProduct();
315
316
  };
316
317
 
318
+ /**
319
+ * Deep link to subscriptions screen on iOS.
320
+ * @returns {Promise<void>}
321
+ *
322
+ * @platform iOS
323
+ */
324
+ export const deepLinkToSubscriptionsIos = (): Promise<void> =>
325
+ Linking.openURL('https://apps.apple.com/account/subscriptions');
326
+
317
327
  // ============= DEPRECATED FUNCTIONS =============
318
328
  // These will be removed in version 3.0.0
319
329