expo-iap 3.0.4 → 3.0.5

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.
Files changed (44) hide show
  1. package/.eslintignore +1 -1
  2. package/.eslintrc.js +1 -0
  3. package/.prettierignore +1 -0
  4. package/CHANGELOG.md +6 -0
  5. package/CLAUDE.md +1 -1
  6. package/CONTRIBUTING.md +10 -0
  7. package/android/build.gradle +1 -1
  8. package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +12 -12
  9. package/android/src/main/java/expo/modules/iap/PromiseUtils.kt +2 -2
  10. package/build/index.d.ts +28 -14
  11. package/build/index.d.ts.map +1 -1
  12. package/build/index.js +36 -15
  13. package/build/index.js.map +1 -1
  14. package/build/modules/android.d.ts +3 -4
  15. package/build/modules/android.d.ts.map +1 -1
  16. package/build/modules/android.js +2 -4
  17. package/build/modules/android.js.map +1 -1
  18. package/build/modules/ios.d.ts +2 -3
  19. package/build/modules/ios.d.ts.map +1 -1
  20. package/build/modules/ios.js +1 -3
  21. package/build/modules/ios.js.map +1 -1
  22. package/build/purchase-error.d.ts +8 -10
  23. package/build/purchase-error.d.ts.map +1 -1
  24. package/build/purchase-error.js +4 -2
  25. package/build/purchase-error.js.map +1 -1
  26. package/build/types.d.ts +159 -204
  27. package/build/types.d.ts.map +1 -1
  28. package/build/types.js +1 -59
  29. package/build/types.js.map +1 -1
  30. package/build/useIAP.d.ts +5 -8
  31. package/build/useIAP.d.ts.map +1 -1
  32. package/build/useIAP.js.map +1 -1
  33. package/ios/ExpoIap.podspec +1 -1
  34. package/ios/ExpoIapModule.swift +103 -89
  35. package/package.json +2 -1
  36. package/plugin/build/withIAP.js +4 -5
  37. package/plugin/src/withIAP.ts +4 -5
  38. package/scripts/update-types.mjs +61 -0
  39. package/src/index.ts +77 -29
  40. package/src/modules/android.ts +5 -7
  41. package/src/modules/ios.ts +3 -5
  42. package/src/purchase-error.ts +13 -16
  43. package/src/types.ts +183 -216
  44. package/src/useIAP.ts +10 -10
package/.eslintignore CHANGED
@@ -2,4 +2,4 @@ docs/
2
2
  example/
3
3
  build/
4
4
  node_modules/
5
- *.d.ts
5
+ *.d.ts
package/.eslintrc.js CHANGED
@@ -1,6 +1,7 @@
1
1
  module.exports = {
2
2
  root: true,
3
3
  extends: ['expo', 'prettier'],
4
+ ignorePatterns: ['src/types.ts'],
4
5
  plugins: ['prettier'],
5
6
  rules: {
6
7
  'eslint-comments/no-unlimited-disable': 0,
@@ -0,0 +1 @@
1
+ src/types.ts
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.0.5 - 2025-09-17
4
+
5
+ - Types: Normalize OpenIAP literal unions to `'in-app'`, `'ios'`, and `'android'`, update `useIAP` helpers to the new `PurchaseRequestInput`, and refresh docs/examples/tests to the lowercase schema tokens.
6
+ - Tooling: Regenerate `src/types.ts` with `openiap-gql` 1.0.2, add lint/format ignores for the generated file, and document the type update workflow.
7
+ - Native: Upgrade the Android fallback/config plugin to [openiap-google 1.1.10](https://github.com/hyodotdev/openiap-google/releases/tag/1.1.10), bump the iOS pod to [openiap 1.1.12](https://github.com/hyodotdev/openiap-apple/releases/tag/1.1.12), adopt PascalCase error codes, and wire the new request parameter models through the bridges and config plugin.
8
+
3
9
  ## 3.0.4 - 2025-09-16
4
10
 
5
11
  - Types: Regenerate the OpenIAP schema with the canonical PascalCase names (`ProductIOS`, `PurchaseIOS`, etc.) and align docs/tests/examples with the new exports.
package/CLAUDE.md CHANGED
@@ -62,7 +62,7 @@ For complete type definitions and documentation, see: <https://www.openiap.dev/d
62
62
 
63
63
  The library follows the OpenIAP type specifications with platform-specific extensions using iOS/Android suffixes.
64
64
 
65
- > **Note:** `src/types.ts` is generated from the OpenIAP schema. Do **not** edit this file manually—run `npm run generate` after updating any `*.graphql` schema instead.
65
+ > **Important:** `src/types.ts` is generated from the OpenIAP schema. Never edit this file manually or commit hand-written changes. After updating any `*.graphql` schema, run `bun run generate:types` (or the equivalent script in your package manager) to refresh the file.
66
66
 
67
67
  ### React/JSX Conventions
68
68
 
package/CONTRIBUTING.md CHANGED
@@ -213,6 +213,16 @@ For detailed code conventions, naming standards, and implementation guidelines,
213
213
  - Pre-commit checks
214
214
  - OpenIAP specification compliance
215
215
 
216
+ ### Updating OpenIAP Types
217
+
218
+ The generated TypeScript definitions in `src/types.ts` come from the [`openiap-gql`](https://github.com/hyodotdev/openiap-gql) release artifacts. Never edit this file by hand. When the schema changes or you need to pull newer types:
219
+
220
+ - Run `bun run generate:types` to download the latest pinned release and overwrite `src/types.ts`.
221
+ - To target a specific release, pass the tag: `bun run generate:types --tag <version>`.
222
+ - Commit the updated file alongside any related schema or documentation changes.
223
+
224
+ Always ensure the repository builds and tests succeed after regenerating the types.
225
+
216
226
  ### Development Workflow
217
227
 
218
228
  1. **Before starting work**:
@@ -58,6 +58,6 @@ dependencies {
58
58
  implementation project(":openiap-google")
59
59
  } else {
60
60
  // Fallback to published artifact when local project isn't linked
61
- implementation "io.github.hyochan.openiap:openiap-google:1.1.0"
61
+ implementation "io.github.hyochan.openiap:openiap-google:1.1.10"
62
62
  }
63
63
  }
@@ -6,7 +6,7 @@ import dev.hyo.openiap.OpenIapError
6
6
  import dev.hyo.openiap.OpenIapModule
7
7
  import dev.hyo.openiap.models.DeepLinkOptions
8
8
  import dev.hyo.openiap.models.ProductRequest
9
- import dev.hyo.openiap.models.RequestPurchaseAndroidProps
9
+ import dev.hyo.openiap.models.RequestPurchaseParams
10
10
  import expo.modules.kotlin.Promise
11
11
  import expo.modules.kotlin.exception.Exceptions
12
12
  import expo.modules.kotlin.modules.Module
@@ -103,7 +103,7 @@ class ExpoIapModule : Module() {
103
103
  if (!ok) {
104
104
  // Clear any buffered events from a failed init
105
105
  pendingEvents.clear()
106
- promise.reject(OpenIapError.E_INIT_CONNECTION, "Failed to initialize connection", null)
106
+ promise.reject(OpenIapError.InitConnection.CODE, "Failed to initialize connection", null)
107
107
  return@withLock
108
108
  }
109
109
 
@@ -118,7 +118,7 @@ class ExpoIapModule : Module() {
118
118
 
119
119
  promise.resolve(true)
120
120
  } catch (e: Exception) {
121
- promise.reject(OpenIapError.E_INIT_CONNECTION, e.message, e)
121
+ promise.reject(OpenIapError.InitConnection.CODE, e.message, e)
122
122
  }
123
123
  }
124
124
  }
@@ -143,7 +143,7 @@ class ExpoIapModule : Module() {
143
143
  val products = openIap.fetchProducts(ProductRequest(skuArr.toList(), reqType))
144
144
  promise.resolve(products.map { it.toJSON() })
145
145
  } catch (e: Exception) {
146
- promise.reject(OpenIapError.E_QUERY_PRODUCT, e.message, null)
146
+ promise.reject(OpenIapError.QueryProduct.CODE, e.message, null)
147
147
  }
148
148
  }
149
149
  }
@@ -154,7 +154,7 @@ class ExpoIapModule : Module() {
154
154
  val purchases = openIap.getAvailablePurchases(null)
155
155
  promise.resolve(purchases.map { it.toJSON() })
156
156
  } catch (e: Exception) {
157
- promise.reject(OpenIapError.E_SERVICE_ERROR, e.message, null)
157
+ promise.reject(OpenIapError.ServiceUnavailable.CODE, e.message, null)
158
158
  }
159
159
  }
160
160
  }
@@ -168,7 +168,7 @@ class ExpoIapModule : Module() {
168
168
  openIap.deepLinkToSubscriptions(DeepLinkOptions(sku, packageName))
169
169
  promise.resolve(null)
170
170
  } catch (e: Exception) {
171
- promise.reject(OpenIapError.E_SERVICE_ERROR, e.message, null)
171
+ promise.reject(OpenIapError.ServiceUnavailable.CODE, e.message, null)
172
172
  }
173
173
  }
174
174
  }
@@ -180,7 +180,7 @@ class ExpoIapModule : Module() {
180
180
  val code = openIap.getStorefront()
181
181
  promise.resolve(code)
182
182
  } catch (e: Exception) {
183
- promise.reject(OpenIapError.E_SERVICE_ERROR, e.message, e)
183
+ promise.reject(OpenIapError.ServiceUnavailable.CODE, e.message, e)
184
184
  }
185
185
  }
186
186
  }
@@ -204,7 +204,7 @@ class ExpoIapModule : Module() {
204
204
  val reqType = ProductRequest.ProductRequestType.fromString(type)
205
205
  val result =
206
206
  openIap.requestPurchase(
207
- RequestPurchaseAndroidProps(
207
+ RequestPurchaseParams(
208
208
  skus = skus,
209
209
  obfuscatedAccountIdAndroid = obfuscatedAccountId,
210
210
  obfuscatedProfileIdAndroid = obfuscatedProfileId,
@@ -223,7 +223,7 @@ class ExpoIapModule : Module() {
223
223
  } catch (e: Exception) {
224
224
  val errorMap =
225
225
  mapOf(
226
- "code" to OpenIapError.E_PURCHASE_ERROR,
226
+ "code" to OpenIapError.PurchaseFailed.CODE,
227
227
  "message" to (e.message ?: "Purchase failed"),
228
228
  "platform" to "android",
229
229
  )
@@ -235,7 +235,7 @@ class ExpoIapModule : Module() {
235
235
  // Reject and clear any pending promises for this purchase flow
236
236
  PromiseUtils.rejectPromisesForKey(
237
237
  PromiseUtils.PROMISE_BUY_ITEM,
238
- OpenIapError.E_PURCHASE_ERROR,
238
+ OpenIapError.PurchaseFailed.CODE,
239
239
  e.message,
240
240
  null,
241
241
  )
@@ -249,7 +249,7 @@ class ExpoIapModule : Module() {
249
249
  openIap.acknowledgePurchaseAndroid(token)
250
250
  promise.resolve(mapOf("responseCode" to 0))
251
251
  } catch (e: Exception) {
252
- promise.reject(OpenIapError.E_SERVICE_ERROR, e.message, null)
252
+ promise.reject(OpenIapError.ServiceUnavailable.CODE, e.message, null)
253
253
  }
254
254
  }
255
255
  }
@@ -261,7 +261,7 @@ class ExpoIapModule : Module() {
261
261
  openIap.consumePurchaseAndroid(token)
262
262
  promise.resolve(mapOf("responseCode" to 0, "purchaseToken" to token))
263
263
  } catch (e: Exception) {
264
- promise.reject(OpenIapError.E_SERVICE_ERROR, e.message, null)
264
+ promise.reject(OpenIapError.ServiceUnavailable.CODE, e.message, null)
265
265
  }
266
266
  }
267
267
  }
@@ -32,7 +32,7 @@ object PromiseUtils {
32
32
  fun rejectAllPendingPromises() {
33
33
  // Snapshot to avoid concurrent modification
34
34
  promises.values.flatMap { it.toList() }.forEach { promise ->
35
- promise.safeReject(OpenIapError.E_CONNECTION_CLOSED, "Connection has been closed", null)
35
+ promise.safeReject(OpenIapError.ServiceDisconnected.CODE, "Connection has been closed", null)
36
36
  }
37
37
  promises.clear()
38
38
  }
@@ -60,7 +60,7 @@ fun Promise.safeResolve(value: Any?) {
60
60
  }
61
61
  }
62
62
 
63
- fun Promise.safeReject(message: String) = this.safeReject("E_UNKNOWN", message, null)
63
+ fun Promise.safeReject(message: String) = this.safeReject(OpenIapError.UnknownError.CODE, message, null)
64
64
 
65
65
  fun Promise.safeReject(
66
66
  code: String,
package/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Product, Purchase, RequestPurchaseProps, RequestSubscriptionPropsByPlatforms, ProductSubscription, VoidResult, ReceiptValidationResult } from './types';
1
+ import { Product, Purchase, RequestPurchaseProps, RequestPurchasePropsByPlatforms, RequestSubscriptionPropsByPlatforms, ProductSubscription, VoidResult, ReceiptValidationResult } from './types';
2
2
  import { PurchaseError } from './purchase-error';
3
3
  export * from './types';
4
4
  export { ErrorCodeUtils, ErrorCodeMapping } from './purchase-error';
@@ -18,6 +18,27 @@ export declare const emitter: {
18
18
  };
19
19
  removeListener: (eventName: string, listener: (...args: any[]) => void) => void;
20
20
  };
21
+ /**
22
+ * TODO(v3.1.0): Remove legacy 'inapp' alias once downstream apps migrate to 'in-app'.
23
+ */
24
+ export type ProductTypeInput = 'inapp' | 'in-app' | 'subs';
25
+ export type InAppTypeInput = Exclude<ProductTypeInput, 'subs'>;
26
+ type PurchaseRequestInApp = {
27
+ request: RequestPurchasePropsByPlatforms;
28
+ type?: InAppTypeInput;
29
+ };
30
+ type PurchaseRequestSubscription = {
31
+ request: RequestSubscriptionPropsByPlatforms;
32
+ type: 'subs';
33
+ };
34
+ export type PurchaseRequestInput = PurchaseRequestInApp | PurchaseRequestSubscription;
35
+ export type PurchaseRequest = {
36
+ request: RequestPurchaseProps;
37
+ type?: InAppTypeInput;
38
+ } | {
39
+ request: RequestSubscriptionPropsByPlatforms;
40
+ type: 'subs';
41
+ };
21
42
  export declare const purchaseUpdatedListener: (listener: (event: Purchase) => void) => {
22
43
  remove: () => void;
23
44
  };
@@ -54,14 +75,14 @@ export declare function endConnection(): Promise<boolean>;
54
75
  *
55
76
  * @param params - Product fetch configuration
56
77
  * @param params.skus - Array of product SKUs to fetch
57
- * @param params.type - Type of products: 'inapp' for regular products (default) or 'subs' for subscriptions
78
+ * @param params.type - Type of products: 'in-app' for regular products (default) or 'subs' for subscriptions
58
79
  *
59
80
  * @example
60
81
  * ```typescript
61
82
  * // Regular products
62
83
  * const products = await fetchProducts({
63
84
  * skus: ['product1', 'product2'],
64
- * type: 'inapp'
85
+ * type: 'in-app'
65
86
  * });
66
87
  *
67
88
  * // Subscriptions
@@ -73,7 +94,7 @@ export declare function endConnection(): Promise<boolean>;
73
94
  */
74
95
  export declare const fetchProducts: ({ skus, type, }: {
75
96
  skus: string[];
76
- type?: "inapp" | "subs";
97
+ type?: ProductTypeInput;
77
98
  }) => Promise<Product[] | ProductSubscription[]>;
78
99
  export declare const getAvailablePurchases: ({ alsoPublishToEventListenerIOS, onlyIncludeActiveItemsIOS, }?: {
79
100
  alsoPublishToEventListenerIOS?: boolean;
@@ -96,19 +117,12 @@ export declare const restorePurchases: (options?: {
96
117
  alsoPublishToEventListenerIOS?: boolean;
97
118
  onlyIncludeActiveItemsIOS?: boolean;
98
119
  }) => Promise<Purchase[]>;
99
- type PurchaseRequest = {
100
- request: RequestPurchaseProps;
101
- type?: 'inapp';
102
- } | {
103
- request: RequestSubscriptionPropsByPlatforms;
104
- type: 'subs';
105
- };
106
120
  /**
107
121
  * Request a purchase for products or subscriptions.
108
122
  *
109
123
  * @param requestObj - Purchase request configuration
110
124
  * @param requestObj.request - Platform-specific purchase parameters
111
- * @param requestObj.type - Type of purchase: 'inapp' for products (default) or 'subs' for subscriptions
125
+ * @param requestObj.type - Type of purchase: 'in-app' for products (default) or 'subs' for subscriptions
112
126
  *
113
127
  * @example
114
128
  * ```typescript
@@ -118,7 +132,7 @@ type PurchaseRequest = {
118
132
  * ios: { sku: productId },
119
133
  * android: { skus: [productId] }
120
134
  * },
121
- * type: 'inapp'
135
+ * type: 'in-app'
122
136
  * });
123
137
  *
124
138
  * // Subscription purchase
@@ -134,7 +148,7 @@ type PurchaseRequest = {
134
148
  * });
135
149
  * ```
136
150
  */
137
- export declare const requestPurchase: (requestObj: PurchaseRequest) => Promise<Purchase | Purchase[] | void>;
151
+ export declare const requestPurchase: (requestObj: PurchaseRequestInput) => Promise<Purchase | Purchase[] | void>;
138
152
  export declare const finishTransaction: ({ purchase, isConsumable, }: {
139
153
  purchase: Purchase;
140
154
  isConsumable?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,OAAO,EACP,QAAQ,EAER,oBAAoB,EACpB,mCAAmC,EACnC,mBAAmB,EAGnB,UAAU,EACV,uBAAuB,EACxB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAG/C,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClE,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAG9B,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,EAAE,KAAmB,CAAC;AAEnC,oBAAY,YAAY;IACtB,eAAe,qBAAqB;IACpC,aAAa,mBAAmB;IAChC,kBAAkB,yBAAyB;CAC5C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,OAE1C;AAGD,eAAO,MAAM,OAAO,EAAoD;IACtE,WAAW,EAAE,CACX,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,KAC/B;QAAC,MAAM,EAAE,MAAM,IAAI,CAAA;KAAC,CAAC;IAC1B,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AC,EAAE,OAAO,CAAC;CAChC,KACL,OAAO,CAAC,QAAQ,EAAE,CAcpB,CAAC;AA4BF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,eAAe,GAC1B,YAAY,oBAAoB,KAC/B,OAAO,CAAC,QAAQ,GAAG,QAAQ,EAAE,GAAG,IAAI,CAkGtC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,6BAG/B;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,KAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAsC/B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,QAAO,OAAO,CAAC,MAAM,CAMjD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,QAAO,OAAO,CAAC,MAAM,CAS9C,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,uBAAuB,CAwBjC,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,CAaf,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC"}
package/build/index.js CHANGED
@@ -28,6 +28,24 @@ export function setValueAsync(value) {
28
28
  }
29
29
  // Ensure the emitter has proper EventEmitter interface
30
30
  export const emitter = (ExpoIapModule || NativeModulesProxy.ExpoIap);
31
+ const normalizeProductType = (type) => {
32
+ if (type === 'inapp') {
33
+ console.warn("expo-iap: 'inapp' product type is deprecated and will be removed in v3.1.0. Use 'in-app' instead.");
34
+ }
35
+ if (!type || type === 'inapp' || type === 'in-app') {
36
+ return {
37
+ canonical: 'in-app',
38
+ native: 'inapp',
39
+ };
40
+ }
41
+ if (type === 'subs') {
42
+ return {
43
+ canonical: 'subs',
44
+ native: 'subs',
45
+ };
46
+ }
47
+ throw new Error(`Unsupported product type: ${type}`);
48
+ };
31
49
  export const purchaseUpdatedListener = (listener) => {
32
50
  console.log('[JS] Registering purchaseUpdatedListener');
33
51
  const wrappedListener = (event) => {
@@ -87,14 +105,14 @@ export async function endConnection() {
87
105
  *
88
106
  * @param params - Product fetch configuration
89
107
  * @param params.skus - Array of product SKUs to fetch
90
- * @param params.type - Type of products: 'inapp' for regular products (default) or 'subs' for subscriptions
108
+ * @param params.type - Type of products: 'in-app' for regular products (default) or 'subs' for subscriptions
91
109
  *
92
110
  * @example
93
111
  * ```typescript
94
112
  * // Regular products
95
113
  * const products = await fetchProducts({
96
114
  * skus: ['product1', 'product2'],
97
- * type: 'inapp'
115
+ * type: 'in-app'
98
116
  * });
99
117
  *
100
118
  * // Subscriptions
@@ -104,15 +122,16 @@ export async function endConnection() {
104
122
  * });
105
123
  * ```
106
124
  */
107
- export const fetchProducts = async ({ skus, type = 'inapp', }) => {
125
+ export const fetchProducts = async ({ skus, type, }) => {
108
126
  if (!skus?.length) {
109
127
  throw new PurchaseError({
110
128
  message: 'No SKUs provided',
111
129
  code: ErrorCode.EmptySkuList,
112
130
  });
113
131
  }
132
+ const { canonical, native } = normalizeProductType(type);
114
133
  if (Platform.OS === 'ios') {
115
- const rawItems = await ExpoIapModule.fetchProducts({ skus, type });
134
+ const rawItems = await ExpoIapModule.fetchProducts({ skus, type: native });
116
135
  const filteredItems = rawItems.filter((item) => {
117
136
  if (!isProductIOS(item)) {
118
137
  return false;
@@ -124,12 +143,12 @@ export const fetchProducts = async ({ skus, type = 'inapp', }) => {
124
143
  skus.includes(item.id);
125
144
  return isValid;
126
145
  });
127
- return type === 'inapp'
146
+ return canonical === 'in-app'
128
147
  ? filteredItems
129
148
  : filteredItems;
130
149
  }
131
150
  if (Platform.OS === 'android') {
132
- const items = await ExpoIapModule.fetchProducts(type, skus);
151
+ const items = await ExpoIapModule.fetchProducts(native, skus);
133
152
  const filteredItems = items.filter((item) => {
134
153
  if (!isProductAndroid(item))
135
154
  return false;
@@ -139,7 +158,7 @@ export const fetchProducts = async ({ skus, type = 'inapp', }) => {
139
158
  typeof item.id === 'string' &&
140
159
  skus.includes(item.id));
141
160
  });
142
- return type === 'inapp'
161
+ return canonical === 'in-app'
143
162
  ? filteredItems
144
163
  : filteredItems;
145
164
  }
@@ -197,7 +216,7 @@ const normalizeRequestProps = (request, platform) => {
197
216
  *
198
217
  * @param requestObj - Purchase request configuration
199
218
  * @param requestObj.request - Platform-specific purchase parameters
200
- * @param requestObj.type - Type of purchase: 'inapp' for products (default) or 'subs' for subscriptions
219
+ * @param requestObj.type - Type of purchase: 'in-app' for products (default) or 'subs' for subscriptions
201
220
  *
202
221
  * @example
203
222
  * ```typescript
@@ -207,7 +226,7 @@ const normalizeRequestProps = (request, platform) => {
207
226
  * ios: { sku: productId },
208
227
  * android: { skus: [productId] }
209
228
  * },
210
- * type: 'inapp'
229
+ * type: 'in-app'
211
230
  * });
212
231
  *
213
232
  * // Subscription purchase
@@ -224,7 +243,9 @@ const normalizeRequestProps = (request, platform) => {
224
243
  * ```
225
244
  */
226
245
  export const requestPurchase = (requestObj) => {
227
- const { request, type = 'inapp' } = requestObj;
246
+ const { request, type } = requestObj;
247
+ const { canonical, native } = normalizeProductType(type);
248
+ const isInAppPurchase = canonical === 'in-app';
228
249
  if (Platform.OS === 'ios') {
229
250
  const normalizedRequest = normalizeRequestProps(request, 'ios');
230
251
  if (!normalizedRequest?.sku) {
@@ -240,7 +261,7 @@ export const requestPurchase = (requestObj) => {
240
261
  quantity,
241
262
  withOffer: offer,
242
263
  });
243
- return type === 'inapp' ? purchase : purchase;
264
+ return purchase;
244
265
  })();
245
266
  }
246
267
  if (Platform.OS === 'android') {
@@ -248,11 +269,11 @@ export const requestPurchase = (requestObj) => {
248
269
  if (!normalizedRequest?.skus?.length) {
249
270
  throw new Error('Invalid request for Android. The `skus` property is required and must be a non-empty array.');
250
271
  }
251
- if (type === 'inapp') {
272
+ if (isInAppPurchase) {
252
273
  const { skus, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, isOfferPersonalized, } = normalizedRequest;
253
274
  return (async () => {
254
275
  return ExpoIapModule.requestPurchase({
255
- type: 'inapp',
276
+ type: native,
256
277
  skuArr: skus,
257
278
  purchaseToken: undefined,
258
279
  replacementMode: -1,
@@ -263,11 +284,11 @@ export const requestPurchase = (requestObj) => {
263
284
  });
264
285
  })();
265
286
  }
266
- if (type === 'subs') {
287
+ if (canonical === 'subs') {
267
288
  const { skus, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, isOfferPersonalized, subscriptionOffers = [], replacementModeAndroid = -1, purchaseToken, } = normalizedRequest;
268
289
  return (async () => {
269
290
  return ExpoIapModule.requestPurchase({
270
- type: 'subs',
291
+ type: native,
271
292
  skuArr: skus,
272
293
  purchaseToken,
273
294
  replacementMode: replacementModeAndroid,
@@ -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,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,EAC1B,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAE3B,QAAQ;AACR,OAAO,EAGL,SAAS,GAQV,M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","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 syncIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\n\n// Types\nimport {\n Product,\n Purchase,\n ErrorCode,\n RequestPurchaseProps,\n RequestSubscriptionPropsByPlatforms,\n ProductSubscription,\n PurchaseAndroid,\n DiscountOfferInputIOS,\n VoidResult,\n ReceiptValidationResult,\n} from './types';\nimport {PurchaseError} from './purchase-error';\n\n// Export all types\nexport * from './types';\nexport {ErrorCodeUtils, ErrorCodeMapping} from './purchase-error';\nexport * from './modules/android';\nexport * from './modules/ios';\n\n// Export subscription helpers\nexport {\n getActiveSubscriptions,\n hasActiveSubscriptions,\n} from './helpers/subscription';\n\n// Get the native constant value\nexport const PI = ExpoIapModule.PI;\n\nexport enum OpenIapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\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 console.log('[JS] Registering purchaseUpdatedListener');\n const wrappedListener = (event: Purchase) => {\n console.log('[JS] purchaseUpdatedListener fired:', event);\n listener(event);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n console.log('[JS] purchaseUpdatedListener registered successfully');\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n console.log('[JS] Registering purchaseErrorListener');\n const wrappedListener = (error: PurchaseError) => {\n console.log('[JS] purchaseErrorListener fired:', error);\n listener(error);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseError,\n wrappedListener,\n );\n console.log('[JS] purchaseErrorListener registered successfully');\n return emitterSubscription;\n};\n\n/**\n * iOS-only listener for App Store promoted product events.\n * This fires when a user taps on a promoted product in the App Store.\n *\n * @param listener - Callback function that receives the promoted product details\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = promotedProductListenerIOS((product) => {\n * console.log('Promoted product:', product);\n * // Handle the promoted product\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform iOS\n */\nexport const promotedProductListenerIOS = (\n listener: (product: Product) => void,\n) => {\n if (Platform.OS !== 'ios') {\n console.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.PromotedProductIOS, listener);\n};\n\nexport function initConnection(): Promise<boolean> {\n const result = ExpoIapModule.initConnection();\n return Promise.resolve(result);\n}\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\n/**\n * Fetch products with unified API (v2.7.0+)\n *\n * @param params - Product fetch 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 fetchProducts({\n * skus: ['product1', 'product2'],\n * type: 'inapp'\n * });\n *\n * // Subscriptions\n * const subscriptions = await fetchProducts({\n * skus: ['sub1', 'sub2'],\n * type: 'subs'\n * });\n * ```\n */\nexport const fetchProducts = async ({\n skus,\n type = 'inapp',\n}: {\n skus: string[];\n type?: 'inapp' | 'subs';\n}): Promise<Product[] | ProductSubscription[]> => {\n if (!skus?.length) {\n throw new PurchaseError({\n message: 'No SKUs provided',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.fetchProducts({skus, type});\n\n const filteredItems = rawItems.filter((item: unknown) => {\n if (!isProductIOS(item)) {\n return false;\n }\n const isValid =\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id);\n return isValid;\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as ProductSubscription[]);\n }\n\n if (Platform.OS === 'android') {\n const items = await ExpoIapModule.fetchProducts(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 ProductSubscription[]);\n }\n\n throw new Error('Unsupported platform');\n};\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListenerIOS = false,\n onlyIncludeActiveItemsIOS = true,\n}: {\n alsoPublishToEventListenerIOS?: boolean;\n onlyIncludeActiveItemsIOS?: boolean;\n} = {}): Promise<Purchase[]> =>\n (\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n alsoPublishToEventListenerIOS,\n onlyIncludeActiveItemsIOS,\n ),\n android: () => ExpoIapModule.getAvailableItems(),\n }) || (() => Promise.resolve([]))\n )();\n\n/**\n * Restore completed transactions (cross-platform behavior)\n *\n * - iOS: perform a lightweight sync to refresh transactions and ignore sync errors,\n * then fetch available purchases to surface restored items to the app.\n * - Android: simply fetch available purchases (restoration happens via query).\n *\n * This helper returns the restored/available purchases so callers can update UI/state.\n *\n * @param options.alsoPublishToEventListenerIOS - iOS only: whether to also publish to the event listener\n * @param options.onlyIncludeActiveItemsIOS - iOS only: whether to only include active items\n * @returns Promise resolving to the list of available/restored purchases\n */\nexport const restorePurchases = async (\n options: {\n alsoPublishToEventListenerIOS?: boolean;\n onlyIncludeActiveItemsIOS?: boolean;\n } = {},\n): Promise<Purchase[]> => {\n if (Platform.OS === 'ios') {\n // Perform best-effort sync on iOS and ignore sync errors to avoid blocking restore flow\n await syncIOS().catch(() => undefined);\n }\n\n // Then, fetch available purchases for both platforms\n const purchases = await getAvailablePurchases({\n alsoPublishToEventListenerIOS:\n options.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options.onlyIncludeActiveItemsIOS ?? true,\n });\n\n return purchases;\n};\n\nconst offerToRecordIOS = (\n offer: DiscountOfferInputIOS | undefined,\n): Record<keyof DiscountOfferInputIOS, 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\ntype PurchaseRequest =\n | {\n request: RequestPurchaseProps;\n type?: 'inapp';\n }\n | {\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n };\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nconst normalizeRequestProps = (\n request: RequestPurchaseProps | RequestSubscriptionPropsByPlatforms,\n platform: 'ios' | 'android',\n): any => {\n // Platform-specific format - directly return the appropriate platform data\n return platform === 'ios' ? request.ios : request.android;\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<Purchase | Purchase[] | void> => {\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 andDangerouslyFinishTransactionAutomatically = false,\n appAccountToken,\n quantity,\n withOffer,\n } = normalizedRequest;\n\n return (async () => {\n const offer = offerToRecordIOS(withOffer);\n const purchase = await ExpoIapModule.requestPurchase({\n sku,\n andDangerouslyFinishTransactionAutomatically,\n appAccountToken,\n quantity,\n withOffer: offer,\n });\n\n return type === 'inapp' ? (purchase as Purchase) : (purchase as Purchase);\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.requestPurchase({\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<Purchase[]>;\n })();\n }\n\n if (type === 'subs') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers = [],\n replacementModeAndroid = -1,\n purchaseToken,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.requestPurchase({\n type: 'subs',\n skuArr: skus,\n purchaseToken,\n replacementMode: replacementModeAndroid,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: subscriptionOffers.map((so: any) => so.offerToken),\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<Purchase[]>;\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\nexport const finishTransaction = ({\n purchase,\n isConsumable = false,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n}): Promise<VoidResult | boolean> => {\n return (\n Platform.select({\n ios: async () => {\n const transactionId = purchase.id;\n if (!transactionId) {\n return Promise.reject(\n new Error('purchase.id 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 PurchaseAndroid;\n\n // Use purchaseToken if available, fallback to purchaseTokenAndroid for backward compatibility\n const token = androidPurchase.purchaseToken;\n\n if (!token) {\n return Promise.reject(\n new PurchaseError({\n message: 'Purchase token is required to finish transaction',\n code: ErrorCode.DeveloperError,\n productId: androidPurchase.productId,\n platform: 'android',\n }),\n );\n }\n\n if (isConsumable) {\n return ExpoIapModule.consumePurchaseAndroid(token);\n }\n\n return ExpoIapModule.acknowledgePurchaseAndroid(token);\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.getStorefrontIOS();\n};\n\n/**\n * Gets the storefront country code from the underlying native store.\n * Returns a two-letter country code such as 'US', 'KR', or empty string on failure.\n *\n * @platform ios\n * @platform android\n */\nexport const getStorefront = (): Promise<string> => {\n // Cross-platform storefront\n if (Platform.OS === 'android') {\n if (typeof (ExpoIapModule as any).getStorefrontAndroid === 'function') {\n return (ExpoIapModule as any).getStorefrontAndroid();\n }\n return Promise.resolve('');\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<ReceiptValidationResult> => {\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 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"]}
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,EAC1B,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAE3B,QAAQ;AACR,OAAO,EAGL,SAAS,GASV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/C,mBAAmB;AACnB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClE,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAE9B,8BAA8B;AAC9B,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,gCAAgC;AAChC,MAAM,CAAC,MAAM,EAAE,GAAG,aAAa,CAAC,EAAE,CAAC;AAEnC,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,oDAAoC,CAAA;IACpC,gDAAgC,CAAA;IAChC,2DAA2C,CAAA;AAC7C,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC5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,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 {\n isProductIOS,\n validateReceiptIOS,\n deepLinkToSubscriptionsIOS,\n syncIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\n\n// Types\nimport {\n Product,\n Purchase,\n ErrorCode,\n RequestPurchaseProps,\n RequestPurchasePropsByPlatforms,\n RequestSubscriptionPropsByPlatforms,\n ProductSubscription,\n PurchaseAndroid,\n DiscountOfferInputIOS,\n VoidResult,\n ReceiptValidationResult,\n} from './types';\nimport {PurchaseError} from './purchase-error';\n\n// Export all types\nexport * from './types';\nexport {ErrorCodeUtils, ErrorCodeMapping} from './purchase-error';\nexport * from './modules/android';\nexport * from './modules/ios';\n\n// Export subscription helpers\nexport {\n getActiveSubscriptions,\n hasActiveSubscriptions,\n} from './helpers/subscription';\n\n// Get the native constant value\nexport const PI = ExpoIapModule.PI;\n\nexport enum OpenIapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\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\n/**\n * TODO(v3.1.0): Remove legacy 'inapp' alias once downstream apps migrate to 'in-app'.\n */\nexport type ProductTypeInput = 'inapp' | 'in-app' | 'subs';\nexport type InAppTypeInput = Exclude<ProductTypeInput, 'subs'>;\n\ntype PurchaseRequestInApp = {\n request: RequestPurchasePropsByPlatforms;\n type?: InAppTypeInput;\n};\n\ntype PurchaseRequestSubscription = {\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n};\n\nexport type PurchaseRequestInput =\n | PurchaseRequestInApp\n | PurchaseRequestSubscription;\n\nexport type PurchaseRequest =\n | {\n request: RequestPurchaseProps;\n type?: InAppTypeInput;\n }\n | {\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n };\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (type === 'inapp') {\n console.warn(\n \"expo-iap: 'inapp' product type is deprecated and will be removed in v3.1.0. Use 'in-app' instead.\",\n );\n }\n\n if (!type || type === 'inapp' || type === 'in-app') {\n return {\n canonical: 'in-app' as const,\n native: 'inapp' as const,\n };\n }\n if (type === 'subs') {\n return {\n canonical: 'subs' as const,\n native: 'subs' as const,\n };\n }\n throw new Error(`Unsupported product type: ${type}`);\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n console.log('[JS] Registering purchaseUpdatedListener');\n const wrappedListener = (event: Purchase) => {\n console.log('[JS] purchaseUpdatedListener fired:', event);\n listener(event);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n console.log('[JS] purchaseUpdatedListener registered successfully');\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n console.log('[JS] Registering purchaseErrorListener');\n const wrappedListener = (error: PurchaseError) => {\n console.log('[JS] purchaseErrorListener fired:', error);\n listener(error);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseError,\n wrappedListener,\n );\n console.log('[JS] purchaseErrorListener registered successfully');\n return emitterSubscription;\n};\n\n/**\n * iOS-only listener for App Store promoted product events.\n * This fires when a user taps on a promoted product in the App Store.\n *\n * @param listener - Callback function that receives the promoted product details\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = promotedProductListenerIOS((product) => {\n * console.log('Promoted product:', product);\n * // Handle the promoted product\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform iOS\n */\nexport const promotedProductListenerIOS = (\n listener: (product: Product) => void,\n) => {\n if (Platform.OS !== 'ios') {\n console.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.PromotedProductIOS, listener);\n};\n\nexport function initConnection(): Promise<boolean> {\n const result = ExpoIapModule.initConnection();\n return Promise.resolve(result);\n}\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\n/**\n * Fetch products with unified API (v2.7.0+)\n *\n * @param params - Product fetch configuration\n * @param params.skus - Array of product SKUs to fetch\n * @param params.type - Type of products: 'in-app' for regular products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Regular products\n * const products = await fetchProducts({\n * skus: ['product1', 'product2'],\n * type: 'in-app'\n * });\n *\n * // Subscriptions\n * const subscriptions = await fetchProducts({\n * skus: ['sub1', 'sub2'],\n * type: 'subs'\n * });\n * ```\n */\nexport const fetchProducts = async ({\n skus,\n type,\n}: {\n skus: string[];\n type?: ProductTypeInput;\n}): Promise<Product[] | ProductSubscription[]> => {\n if (!skus?.length) {\n throw new PurchaseError({\n message: 'No SKUs provided',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {canonical, native} = normalizeProductType(type);\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.fetchProducts({skus, type: native});\n\n const filteredItems = rawItems.filter((item: unknown) => {\n if (!isProductIOS(item)) {\n return false;\n }\n const isValid =\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id);\n return isValid;\n });\n\n return canonical === 'in-app'\n ? (filteredItems as Product[])\n : (filteredItems as ProductSubscription[]);\n }\n\n if (Platform.OS === 'android') {\n const items = await ExpoIapModule.fetchProducts(native, 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 canonical === 'in-app'\n ? (filteredItems as Product[])\n : (filteredItems as ProductSubscription[]);\n }\n\n throw new Error('Unsupported platform');\n};\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListenerIOS = false,\n onlyIncludeActiveItemsIOS = true,\n}: {\n alsoPublishToEventListenerIOS?: boolean;\n onlyIncludeActiveItemsIOS?: boolean;\n} = {}): Promise<Purchase[]> =>\n (\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n alsoPublishToEventListenerIOS,\n onlyIncludeActiveItemsIOS,\n ),\n android: () => ExpoIapModule.getAvailableItems(),\n }) || (() => Promise.resolve([]))\n )();\n\n/**\n * Restore completed transactions (cross-platform behavior)\n *\n * - iOS: perform a lightweight sync to refresh transactions and ignore sync errors,\n * then fetch available purchases to surface restored items to the app.\n * - Android: simply fetch available purchases (restoration happens via query).\n *\n * This helper returns the restored/available purchases so callers can update UI/state.\n *\n * @param options.alsoPublishToEventListenerIOS - iOS only: whether to also publish to the event listener\n * @param options.onlyIncludeActiveItemsIOS - iOS only: whether to only include active items\n * @returns Promise resolving to the list of available/restored purchases\n */\nexport const restorePurchases = async (\n options: {\n alsoPublishToEventListenerIOS?: boolean;\n onlyIncludeActiveItemsIOS?: boolean;\n } = {},\n): Promise<Purchase[]> => {\n if (Platform.OS === 'ios') {\n // Perform best-effort sync on iOS and ignore sync errors to avoid blocking restore flow\n await syncIOS().catch(() => undefined);\n }\n\n // Then, fetch available purchases for both platforms\n const purchases = await getAvailablePurchases({\n alsoPublishToEventListenerIOS:\n options.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options.onlyIncludeActiveItemsIOS ?? true,\n });\n\n return purchases;\n};\n\nconst offerToRecordIOS = (\n offer: DiscountOfferInputIOS | undefined,\n): Record<keyof DiscountOfferInputIOS, 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/**\n * Helper to normalize request props to platform-specific format\n */\nconst normalizeRequestProps = (\n request:\n | RequestPurchasePropsByPlatforms\n | RequestSubscriptionPropsByPlatforms,\n platform: 'ios' | 'android',\n): any => {\n // Platform-specific format - directly return the appropriate platform data\n return platform === 'ios' ? request.ios : request.android;\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: 'in-app' 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: 'in-app'\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: PurchaseRequestInput,\n): Promise<Purchase | Purchase[] | void> => {\n const {request, type} = requestObj;\n const {canonical, native} = normalizeProductType(type);\n const isInAppPurchase = canonical === 'in-app';\n\n if (Platform.OS === 'ios') {\n const normalizedRequest = normalizeRequestProps(request, 'ios');\n\n if (!normalizedRequest?.sku) {\n throw new Error(\n 'Invalid request for iOS. The `sku` property is required and must be a string.',\n );\n }\n\n const {\n sku,\n andDangerouslyFinishTransactionAutomatically = false,\n appAccountToken,\n quantity,\n withOffer,\n } = normalizedRequest;\n\n return (async () => {\n const offer = offerToRecordIOS(withOffer);\n const purchase = await ExpoIapModule.requestPurchase({\n sku,\n andDangerouslyFinishTransactionAutomatically,\n appAccountToken,\n quantity,\n withOffer: offer,\n });\n\n return purchase as Purchase;\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 (isInAppPurchase) {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<Purchase[]>;\n })();\n }\n\n if (canonical === 'subs') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers = [],\n replacementModeAndroid = -1,\n purchaseToken,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken,\n replacementMode: replacementModeAndroid,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: subscriptionOffers.map((so: any) => so.offerToken),\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<Purchase[]>;\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\nexport const finishTransaction = ({\n purchase,\n isConsumable = false,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n}): Promise<VoidResult | boolean> => {\n return (\n Platform.select({\n ios: async () => {\n const transactionId = purchase.id;\n if (!transactionId) {\n return Promise.reject(\n new Error('purchase.id 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 PurchaseAndroid;\n\n // Use purchaseToken if available, fallback to purchaseTokenAndroid for backward compatibility\n const token = androidPurchase.purchaseToken;\n\n if (!token) {\n return Promise.reject(\n new PurchaseError({\n message: 'Purchase token is required to finish transaction',\n code: ErrorCode.DeveloperError,\n productId: androidPurchase.productId,\n platform: 'android',\n }),\n );\n }\n\n if (isConsumable) {\n return ExpoIapModule.consumePurchaseAndroid(token);\n }\n\n return ExpoIapModule.acknowledgePurchaseAndroid(token);\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.getStorefrontIOS();\n};\n\n/**\n * Gets the storefront country code from the underlying native store.\n * Returns a two-letter country code such as 'US', 'KR', or empty string on failure.\n *\n * @platform ios\n * @platform android\n */\nexport const getStorefront = (): Promise<string> => {\n // Cross-platform storefront\n if (Platform.OS === 'android') {\n if (typeof (ExpoIapModule as any).getStorefrontAndroid === 'function') {\n return (ExpoIapModule as any).getStorefrontAndroid();\n }\n return Promise.resolve('');\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<ReceiptValidationResult> => {\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 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"]}
@@ -1,9 +1,8 @@
1
1
  import type { ReceiptValidationResultAndroid, VoidResult } from '../types';
2
- import { Platform as PurchasePlatform } from '../types';
3
2
  export declare function isProductAndroid<T extends {
4
- platform?: string | PurchasePlatform;
3
+ platform?: string;
5
4
  }>(item: unknown): item is T & {
6
- platform: PurchasePlatform.Android | 'android';
5
+ platform: 'android';
7
6
  };
8
7
  /**
9
8
  * Deep link to subscriptions screen on Android.
@@ -33,7 +32,7 @@ export declare const deepLinkToSubscriptionsAndroid: ({ sku, packageName, }: {
33
32
  * @param {string} params.productId - product id for your in app product.
34
33
  * @param {string} params.productToken - token for your purchase (called 'token' in the API documentation).
35
34
  * @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.
35
+ * @param {boolean} params.isSub - whether this is subscription or in-app. `true` for subscription.
37
36
  * @returns {Promise<ReceiptAndroid>}
38
37
  */
39
38
  export declare const validateReceiptAndroid: ({ packageName, productId, productToken, accessToken, isSub, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,8BAA8B,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AACzE,OAAO,EAAC,QAAQ,IAAI,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAGtD,wBAAgB,gBAAgB,CAC9B,CAAC,SAAS;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAA;CAAC,EAChD,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,CAAC,GAAG;IAAC,QAAQ,EAAE,gBAAgB,CAAC,OAAO,GAAG,SAAS,CAAA;CAAC,CAQ7E;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,GAAU,uBAGlD;IACD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,KAAG,OAAO,CAAC,IAAI,CAoBf,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,8BAA8B,CAuBzC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAU,YAE9C;IACD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