expo-iap 2.9.0 β†’ 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/CONTRIBUTING.md +2 -2
  3. package/README.md +3 -3
  4. package/build/ExpoIap.types.d.ts +33 -15
  5. package/build/ExpoIap.types.d.ts.map +1 -1
  6. package/build/ExpoIap.types.js +64 -17
  7. package/build/ExpoIap.types.js.map +1 -1
  8. package/build/index.d.ts +0 -13
  9. package/build/index.d.ts.map +1 -1
  10. package/build/index.js +22 -22
  11. package/build/index.js.map +1 -1
  12. package/build/modules/ios.d.ts +3 -7
  13. package/build/modules/ios.d.ts.map +1 -1
  14. package/build/modules/ios.js +1 -6
  15. package/build/modules/ios.js.map +1 -1
  16. package/build/types/ExpoIapAndroid.types.d.ts +0 -32
  17. package/build/types/ExpoIapAndroid.types.d.ts.map +1 -1
  18. package/build/types/ExpoIapAndroid.types.js +1 -5
  19. package/build/types/ExpoIapAndroid.types.js.map +1 -1
  20. package/build/types/ExpoIapIOS.types.d.ts +3 -27
  21. package/build/types/ExpoIapIOS.types.d.ts.map +1 -1
  22. package/build/types/ExpoIapIOS.types.js.map +1 -1
  23. package/build/useIAP.d.ts +1 -5
  24. package/build/useIAP.d.ts.map +1 -1
  25. package/build/useIAP.js +35 -26
  26. package/build/useIAP.js.map +1 -1
  27. package/build/utils/errorMapping.d.ts.map +1 -1
  28. package/build/utils/errorMapping.js +24 -0
  29. package/build/utils/errorMapping.js.map +1 -1
  30. package/ios/ExpoIap.podspec +1 -1
  31. package/ios/ExpoIapModule.swift +43 -30
  32. package/package.json +1 -1
  33. package/src/ExpoIap.types.ts +84 -37
  34. package/src/index.ts +25 -49
  35. package/src/modules/ios.ts +4 -9
  36. package/src/types/ExpoIapAndroid.types.ts +2 -36
  37. package/src/types/ExpoIapIOS.types.ts +3 -27
  38. package/src/useIAP.ts +41 -34
  39. package/src/utils/errorMapping.ts +24 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [2.9.1] - 2025-09-09
4
+
5
+ ### Added
6
+
7
+ - Expanded error codes and mappings (Android parity) with friendly messages in utilities
8
+ - New object-style `PurchaseError` constructor and guideline in docs (legacy positional args remain supported)
9
+ - Docs site can build for GitHub Pages via dynamic `baseUrl` switch
10
+ - Example iOS: pin `openiap` to `1.1.7` via Git to avoid CocoaPods index lag
11
+
12
+ ### Changed
13
+
14
+ - iOS: `getPromotedProductIOS` now returns a fully serialized Product (fetch by SKU then serialize)
15
+ - iOS: `subscriptionStatusIOS` returns `{ state, renewalInfo? }` where `renewalInfo.willAutoRenew` is a real boolean and `autoRenewPreference` is preserved
16
+ - Hook: register purchase error listener early and ignore `E_INIT_CONNECTION` until connected
17
+
3
18
  ## [2.9.0] - 2025-09-05
4
19
 
5
20
  ### Added
@@ -172,7 +187,7 @@
172
187
 
173
188
  - **iOS Field Naming Convention**: All iOS-related field names ending with "Ios" have been renamed to end with "IOS" to follow the convention that acronyms at the end of field names should be uppercase.
174
189
 
175
- **Migration Guide**: See the full migration guide at [expo-iap.hyo.dev/blog/v2-8-0-migration-guide](https://expo-iap.hyo.dev/blog/v2-8-0-migration-guide)
190
+ **Migration Guide**: See the full migration guide at [hyochan.github.io/expo-iap/blog/v2-8-0-migration-guide](https://hyochan.github.io/expo-iap/blog/v2-8-0-migration-guide)
176
191
 
177
192
  Affected fields:
178
193
 
package/CONTRIBUTING.md CHANGED
@@ -417,8 +417,8 @@ We welcome feature requests! Please:
417
417
 
418
418
  ## πŸ“š Additional Resources
419
419
 
420
- - [Documentation Site](https://expo-iap.hyo.dev)
421
- - [API Reference](https://expo-iap.hyo.dev/docs/api/use-iap)
420
+ - [Documentation Site](https://hyochan.github.io/expo-iap)
421
+ - [API Reference](https://hyochan.github.io/expo-iap/docs/api/use-iap)
422
422
  - [Example App](./example)
423
423
 
424
424
  Thank you for contributing to expo-iap! πŸŽ‰
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Expo IAP
2
2
 
3
3
  <div align="center">
4
- <img src="https://expo-iap.hyo.dev/img/icon.png" alt="Expo IAP Logo" width="150" />
4
+ <img src="https://hyochan.github.io/expo-iap/img/icon.png" alt="Expo IAP Logo" width="150" />
5
5
 
6
6
  [![Version](http://img.shields.io/npm/v/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![Download](http://img.shields.io/npm/dm/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap.svg?type=shield&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap?ref=badge_shield&issueType=license)
7
7
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  ## πŸ“š Documentation
14
14
 
15
- **[πŸ“– Visit our comprehensive documentation site β†’](https://expo-iap.hyo.dev)**
15
+ **[πŸ“– Visit our comprehensive documentation site β†’](https://hyochan.github.io/expo-iap)**
16
16
 
17
17
  ## Notice
18
18
 
@@ -55,7 +55,7 @@ We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md)
55
55
  - Code style and conventions
56
56
  - Submitting pull requests
57
57
 
58
- For detailed usage examples and error handling, see the [documentation](https://expo-iap.hyo.dev).
58
+ For detailed usage examples and error handling, see the [documentation](https://hyochan.github.io/expo-iap).
59
59
 
60
60
  > Sharing your thoughtsβ€”any feedback would be greatly appreciated!
61
61
 
@@ -40,14 +40,6 @@ export type SubscriptionProduct = (ProductSubscriptionAndroid & AndroidPlatform)
40
40
  export * from './types/ExpoIapAndroid.types';
41
41
  export * from './types/ExpoIapIOS.types';
42
42
  export type Purchase = (PurchaseAndroid & AndroidPlatform) | (PurchaseIOS & IosPlatform);
43
- /**
44
- * @deprecated Use `Purchase` instead. This type alias will be removed in v2.9.0.
45
- */
46
- export type ProductPurchase = Purchase;
47
- /**
48
- * @deprecated Use `Purchase` instead. This type alias will be removed in v2.9.0.
49
- */
50
- export type SubscriptionPurchase = Purchase;
51
43
  export type PurchaseResult = {
52
44
  responseCode?: number;
53
45
  debugMessage?: string;
@@ -87,7 +79,16 @@ export declare enum ErrorCode {
87
79
  E_ACTIVITY_UNAVAILABLE = "E_ACTIVITY_UNAVAILABLE",
88
80
  E_ALREADY_PREPARED = "E_ALREADY_PREPARED",
89
81
  E_PENDING = "E_PENDING",
90
- E_CONNECTION_CLOSED = "E_CONNECTION_CLOSED"
82
+ E_CONNECTION_CLOSED = "E_CONNECTION_CLOSED",
83
+ E_INIT_CONNECTION = "E_INIT_CONNECTION",
84
+ E_SERVICE_DISCONNECTED = "E_SERVICE_DISCONNECTED",
85
+ E_QUERY_PRODUCT = "E_QUERY_PRODUCT",
86
+ E_SKU_NOT_FOUND = "E_SKU_NOT_FOUND",
87
+ E_SKU_OFFER_MISMATCH = "E_SKU_OFFER_MISMATCH",
88
+ E_ITEM_NOT_OWNED = "E_ITEM_NOT_OWNED",
89
+ E_BILLING_UNAVAILABLE = "E_BILLING_UNAVAILABLE",
90
+ E_FEATURE_NOT_SUPPORTED = "E_FEATURE_NOT_SUPPORTED",
91
+ E_EMPTY_SKU_LIST = "E_EMPTY_SKU_LIST"
91
92
  }
92
93
  /**
93
94
  * Platform-specific error code mappings
@@ -145,17 +146,34 @@ export declare const ErrorCodeMapping: {
145
146
  readonly E_ALREADY_PREPARED: "E_ALREADY_PREPARED";
146
147
  readonly E_PENDING: "E_PENDING";
147
148
  readonly E_CONNECTION_CLOSED: "E_CONNECTION_CLOSED";
149
+ readonly E_INIT_CONNECTION: "E_INIT_CONNECTION";
150
+ readonly E_SERVICE_DISCONNECTED: "E_SERVICE_DISCONNECTED";
151
+ readonly E_QUERY_PRODUCT: "E_QUERY_PRODUCT";
152
+ readonly E_SKU_NOT_FOUND: "E_SKU_NOT_FOUND";
153
+ readonly E_SKU_OFFER_MISMATCH: "E_SKU_OFFER_MISMATCH";
154
+ readonly E_ITEM_NOT_OWNED: "E_ITEM_NOT_OWNED";
155
+ readonly E_BILLING_UNAVAILABLE: "E_BILLING_UNAVAILABLE";
156
+ readonly E_FEATURE_NOT_SUPPORTED: "E_FEATURE_NOT_SUPPORTED";
157
+ readonly E_EMPTY_SKU_LIST: "E_EMPTY_SKU_LIST";
148
158
  };
149
159
  };
160
+ export type PurchaseErrorProps = {
161
+ message: string;
162
+ responseCode?: number;
163
+ debugMessage?: string;
164
+ code?: ErrorCode;
165
+ productId?: string;
166
+ platform?: 'ios' | 'android';
167
+ };
150
168
  export declare class PurchaseError implements Error {
151
169
  name: string;
152
170
  message: string;
153
- responseCode?: number | undefined;
154
- debugMessage?: string | undefined;
155
- code?: ErrorCode | undefined;
156
- productId?: string | undefined;
157
- platform?: "ios" | "android" | undefined;
158
- constructor(name: string, message: string, responseCode?: number | undefined, debugMessage?: string | undefined, code?: ErrorCode | undefined, productId?: string | undefined, platform?: "ios" | "android" | undefined);
171
+ responseCode?: number;
172
+ debugMessage?: string;
173
+ code?: ErrorCode;
174
+ productId?: string;
175
+ platform?: 'ios' | 'android';
176
+ constructor(messageOrProps: string | PurchaseErrorProps, ...rest: any[]);
159
177
  /**
160
178
  * Creates a PurchaseError from platform-specific error data
161
179
  * @param errorData Raw error data from native modules
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoIap.types.d.ts","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,0BAA0B,EAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAM3C,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,E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,SAAS,CAAC,EAAE,OAAO,0BAA0B,EAAE,eAAe,CAAC;CACzE;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,+BACf,SAAQ,2BAA2B;IACnC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,kBAAkB,EAAE;QAC3B,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,EAAE,MAAM,CAAC;KACpB,EAAE,CAAC;CACL;AAED;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,GAAG,CAAC,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,2BAA2B,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,GAAG,CAAC,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,+BAA+B,CAAC;CACpD;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,mCAAmC,CAAC"}
@@ -32,6 +32,16 @@ export var ErrorCode;
32
32
  ErrorCode["E_ALREADY_PREPARED"] = "E_ALREADY_PREPARED";
33
33
  ErrorCode["E_PENDING"] = "E_PENDING";
34
34
  ErrorCode["E_CONNECTION_CLOSED"] = "E_CONNECTION_CLOSED";
35
+ // Additional detailed errors (Android-focused, kept cross-platform)
36
+ ErrorCode["E_INIT_CONNECTION"] = "E_INIT_CONNECTION";
37
+ ErrorCode["E_SERVICE_DISCONNECTED"] = "E_SERVICE_DISCONNECTED";
38
+ ErrorCode["E_QUERY_PRODUCT"] = "E_QUERY_PRODUCT";
39
+ ErrorCode["E_SKU_NOT_FOUND"] = "E_SKU_NOT_FOUND";
40
+ ErrorCode["E_SKU_OFFER_MISMATCH"] = "E_SKU_OFFER_MISMATCH";
41
+ ErrorCode["E_ITEM_NOT_OWNED"] = "E_ITEM_NOT_OWNED";
42
+ ErrorCode["E_BILLING_UNAVAILABLE"] = "E_BILLING_UNAVAILABLE";
43
+ ErrorCode["E_FEATURE_NOT_SUPPORTED"] = "E_FEATURE_NOT_SUPPORTED";
44
+ ErrorCode["E_EMPTY_SKU_LIST"] = "E_EMPTY_SKU_LIST";
35
45
  })(ErrorCode || (ErrorCode = {}));
36
46
  /**
37
47
  * Platform-specific error code mappings
@@ -89,6 +99,15 @@ export const ErrorCodeMapping = {
89
99
  [ErrorCode.E_ALREADY_PREPARED]: 'E_ALREADY_PREPARED',
90
100
  [ErrorCode.E_PENDING]: 'E_PENDING',
91
101
  [ErrorCode.E_CONNECTION_CLOSED]: 'E_CONNECTION_CLOSED',
102
+ [ErrorCode.E_INIT_CONNECTION]: 'E_INIT_CONNECTION',
103
+ [ErrorCode.E_SERVICE_DISCONNECTED]: 'E_SERVICE_DISCONNECTED',
104
+ [ErrorCode.E_QUERY_PRODUCT]: 'E_QUERY_PRODUCT',
105
+ [ErrorCode.E_SKU_NOT_FOUND]: 'E_SKU_NOT_FOUND',
106
+ [ErrorCode.E_SKU_OFFER_MISMATCH]: 'E_SKU_OFFER_MISMATCH',
107
+ [ErrorCode.E_ITEM_NOT_OWNED]: 'E_ITEM_NOT_OWNED',
108
+ [ErrorCode.E_BILLING_UNAVAILABLE]: 'E_BILLING_UNAVAILABLE',
109
+ [ErrorCode.E_FEATURE_NOT_SUPPORTED]: 'E_FEATURE_NOT_SUPPORTED',
110
+ [ErrorCode.E_EMPTY_SKU_LIST]: 'E_EMPTY_SKU_LIST',
92
111
  },
93
112
  };
94
113
  export class PurchaseError {
@@ -99,21 +118,29 @@ export class PurchaseError {
99
118
  code;
100
119
  productId;
101
120
  platform;
102
- constructor(name, message, responseCode, debugMessage, code, productId, platform) {
103
- this.name = name;
104
- this.message = message;
105
- this.responseCode = responseCode;
106
- this.debugMessage = debugMessage;
107
- this.code = code;
108
- this.productId = productId;
109
- this.platform = platform;
121
+ // Backwards-compatible constructor: accepts either props object or legacy positional args
122
+ constructor(messageOrProps, ...rest) {
110
123
  this.name = '[expo-iap]: PurchaseError';
111
- this.message = message;
112
- this.responseCode = responseCode;
113
- this.debugMessage = debugMessage;
114
- this.code = code;
115
- this.productId = productId;
116
- this.platform = platform;
124
+ if (typeof messageOrProps === 'string') {
125
+ // Legacy signature: (name, message, responseCode?, debugMessage?, code?, productId?, platform?)
126
+ // The first legacy argument was a name which we always override, so treat it as message here
127
+ const message = messageOrProps;
128
+ this.message = message;
129
+ this.responseCode = rest[0];
130
+ this.debugMessage = rest[1];
131
+ this.code = rest[2];
132
+ this.productId = rest[3];
133
+ this.platform = rest[4];
134
+ }
135
+ else {
136
+ const props = messageOrProps;
137
+ this.message = props.message;
138
+ this.responseCode = props.responseCode;
139
+ this.debugMessage = props.debugMessage;
140
+ this.code = props.code;
141
+ this.productId = props.productId;
142
+ this.platform = props.platform;
143
+ }
117
144
  }
118
145
  /**
119
146
  * Creates a PurchaseError from platform-specific error data
@@ -125,7 +152,14 @@ export class PurchaseError {
125
152
  const errorCode = errorData.code
126
153
  ? ErrorCodeUtils.fromPlatformCode(errorData.code, platform)
127
154
  : ErrorCode.E_UNKNOWN;
128
- return new PurchaseError('[expo-iap]: PurchaseError', errorData.message || 'Unknown error occurred', errorData.responseCode, errorData.debugMessage, errorCode, errorData.productId, platform);
155
+ return new PurchaseError({
156
+ message: errorData.message || 'Unknown error occurred',
157
+ responseCode: errorData.responseCode,
158
+ debugMessage: errorData.debugMessage,
159
+ code: errorCode,
160
+ productId: errorData.productId,
161
+ platform,
162
+ });
129
163
  }
130
164
  /**
131
165
  * Gets the platform-specific error code for this error
@@ -156,6 +190,14 @@ export const ErrorCodeUtils = {
156
190
  * @returns Corresponding ErrorCode enum value or E_UNKNOWN if not found
157
191
  */
158
192
  fromPlatformCode: (platformCode, platform) => {
193
+ // Prefer dynamic native mapping for iOS to avoid drift
194
+ if (platform === 'ios') {
195
+ for (const [key, value] of Object.entries(NATIVE_ERROR_CODES || {})) {
196
+ if (value === platformCode) {
197
+ return key;
198
+ }
199
+ }
200
+ }
159
201
  const mapping = ErrorCodeMapping[platform];
160
202
  for (const [errorCode, mappedCode] of Object.entries(mapping)) {
161
203
  if (mappedCode === platformCode) {
@@ -171,8 +213,13 @@ export const ErrorCodeUtils = {
171
213
  * @returns Platform-specific error code
172
214
  */
173
215
  toPlatformCode: (errorCode, platform) => {
174
- return (ErrorCodeMapping[platform][errorCode] ??
175
- (platform === 'ios' ? 0 : 'E_UNKNOWN'));
216
+ if (platform === 'ios') {
217
+ const native = NATIVE_ERROR_CODES?.[errorCode];
218
+ if (native !== undefined)
219
+ return native;
220
+ }
221
+ const mapping = ErrorCodeMapping[platform];
222
+ return mapping[errorCode] ?? (platform === 'ios' ? 0 : 'E_UNKNOWN');
176
223
  },
177
224
  /**
178
225
  * Checks if an error code is valid for the specified platform
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoIap.types.js","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAUA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAqDnD,8DAA8D;AAC9D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AA4BzC;;;GAGG;AACH,MAAM,CAAN,IAAY,SAyBX;AAzBD,WAAY,SAAS;IACnB,oCAAuB,CAAA;IACvB,kDAAqC,CAAA;IACrC,0CAA6B,CAAA;IAC7B,sDAAyC,CAAA;IACzC,8CAAiC,CAAA;IACjC,gDAAmC,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2B,EACV,EAAE;QACnB,OAAO,CACL,gBAAgB,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC;YACrC,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CACvC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,kBAAkB,EAAE,CAClB,SAAoB,EACpB,QAA2B,EAClB,EAAE;QACX,OAAO,SAAS,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACF,CAAC","sourcesContent":["import type {\n ProductAndroid,\n PurchaseAndroid,\n ProductSubscriptionAndroid,\n} from './types/ExpoIapAndroid.types';\nimport type {\n ProductIOS,\n PurchaseIOS,\n ProductSubscriptionIOS,\n} from './types/ExpoIapIOS.types';\nimport {NATIVE_ERROR_CODES} from './ExpoIapModule';\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type ProductType = 'inapp' | 'subs';\n\n// =============================================================================\n// COMMON TYPES (Base types shared across all platforms)\n// =============================================================================\n\nexport type ProductCommon = {\n id: string;\n title: string;\n description: string;\n type: ProductType;\n displayName?: string;\n displayPrice: string;\n currency: string;\n price?: number;\n debugDescription?: string;\n platform?: string;\n};\n\nexport type PurchaseCommon = {\n id: string; // Transaction identifier - used by finishTransaction\n productId: string; // Product identifier - which product was purchased\n ids?: string[]; // Product identifiers for purchases that include multiple products\n transactionId?: string; // @deprecated - use id instead\n transactionDate: number;\n transactionReceipt: string;\n purchaseToken?: string; // Unified purchase token (jwsRepresentation for iOS, purchaseToken for Android)\n platform?: string;\n};\n\nexport type ProductSubscriptionCommon = ProductCommon & {\n type: 'subs';\n};\n\n// Define literal platform types for better type discrimination\nexport type IosPlatform = {platform: 'ios'};\nexport type AndroidPlatform = {platform: 'android'};\n\n// Platform-agnostic unified product types (public API)\nexport type Product =\n | (ProductAndroid & AndroidPlatform)\n | (ProductIOS & IosPlatform);\n\nexport type SubscriptionProduct =\n | (ProductSubscriptionAndroid & AndroidPlatform)\n | (ProductSubscriptionIOS & IosPlatform);\n\n// Re-export all platform-specific types to avoid deep imports\nexport * from './types/ExpoIapAndroid.types';\nexport * from './types/ExpoIapIOS.types';\n\n// Unified purchase type for both products and subscriptions\nexport type Purchase =\n | (PurchaseAndroid & AndroidPlatform)\n | (PurchaseIOS & IosPlatform);\n\n// Legacy type aliases - deprecated, use Purchase instead\n/**\n * @deprecated Use `Purchase` instead. This type alias will be removed in v2.9.0.\n */\nexport type ProductPurchase = Purchase;\n/**\n * @deprecated Use `Purchase` instead. This type alias will be removed in v2.9.0.\n */\nexport type SubscriptionPurchase = Purchase;\n\nexport type PurchaseResult = {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n /**\n * @deprecated Use `purchaseToken` instead. This field will be removed in a future version.\n */\n purchaseTokenAndroid?: string;\n purchaseToken?: string;\n};\n/**\n * Centralized error codes for expo-iap\n * These are mapped to platform-specific error codes and provide consistent error handling\n */\nexport enum ErrorCode {\n E_UNKNOWN = 'E_UNKNOWN',\n E_USER_CANCELLED = 'E_USER_CANCELLED',\n E_USER_ERROR = 'E_USER_ERROR',\n E_ITEM_UNAVAILABLE = 'E_ITEM_UNAVAILABLE',\n E_REMOTE_ERROR = 'E_REMOTE_ERROR',\n E_NETWORK_ERROR = 'E_NETWORK_ERROR',\n E_SERVICE_ERROR = 'E_SERVICE_ERROR',\n E_RECEIPT_FAILED = 'E_RECEIPT_FAILED',\n E_RECEIPT_FINISHED_FAILED = 'E_RECEIPT_FINISHED_FAILED',\n E_NOT_PREPARED = 'E_NOT_PREPARED',\n E_NOT_ENDED = 'E_NOT_ENDED',\n E_ALREADY_OWNED = 'E_ALREADY_OWNED',\n E_DEVELOPER_ERROR = 'E_DEVELOPER_ERROR',\n E_BILLING_RESPONSE_JSON_PARSE_ERROR = 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n E_DEFERRED_PAYMENT = 'E_DEFERRED_PAYMENT',\n E_INTERRUPTED = 'E_INTERRUPTED',\n E_IAP_NOT_AVAILABLE = 'E_IAP_NOT_AVAILABLE',\n E_PURCHASE_ERROR = 'E_PURCHASE_ERROR',\n E_SYNC_ERROR = 'E_SYNC_ERROR',\n E_TRANSACTION_VALIDATION_FAILED = 'E_TRANSACTION_VALIDATION_FAILED',\n E_ACTIVITY_UNAVAILABLE = 'E_ACTIVITY_UNAVAILABLE',\n E_ALREADY_PREPARED = 'E_ALREADY_PREPARED',\n E_PENDING = 'E_PENDING',\n E_CONNECTION_CLOSED = 'E_CONNECTION_CLOSED',\n}\n\n/**\n * Platform-specific error code mappings\n * Maps ErrorCode enum values to platform-specific integer codes\n */\nexport const ErrorCodeMapping = {\n ios: {\n [ErrorCode.E_UNKNOWN]: 0,\n [ErrorCode.E_SERVICE_ERROR]: 1,\n [ErrorCode.E_USER_CANCELLED]: 2,\n [ErrorCode.E_USER_ERROR]: 3,\n [ErrorCode.E_ITEM_UNAVAILABLE]: 4,\n [ErrorCode.E_REMOTE_ERROR]: 5,\n [ErrorCode.E_NETWORK_ERROR]: 6,\n [ErrorCode.E_RECEIPT_FAILED]: 7,\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 8,\n [ErrorCode.E_DEVELOPER_ERROR]: 9,\n [ErrorCode.E_PURCHASE_ERROR]: 10,\n [ErrorCode.E_SYNC_ERROR]: 11,\n [ErrorCode.E_DEFERRED_PAYMENT]: 12,\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]: 13,\n [ErrorCode.E_NOT_PREPARED]: 14,\n [ErrorCode.E_NOT_ENDED]: 15,\n [ErrorCode.E_ALREADY_OWNED]: 16,\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]: 17,\n [ErrorCode.E_INTERRUPTED]: 18,\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 19,\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 20,\n [ErrorCode.E_ALREADY_PREPARED]: 21,\n [ErrorCode.E_PENDING]: 22,\n [ErrorCode.E_CONNECTION_CLOSED]: 23,\n },\n android: {\n [ErrorCode.E_UNKNOWN]: 'E_UNKNOWN',\n [ErrorCode.E_USER_CANCELLED]: 'E_USER_CANCELLED',\n [ErrorCode.E_USER_ERROR]: 'E_USER_ERROR',\n [ErrorCode.E_ITEM_UNAVAILABLE]: 'E_ITEM_UNAVAILABLE',\n [ErrorCode.E_REMOTE_ERROR]: 'E_REMOTE_ERROR',\n [ErrorCode.E_NETWORK_ERROR]: 'E_NETWORK_ERROR',\n [ErrorCode.E_SERVICE_ERROR]: 'E_SERVICE_ERROR',\n [ErrorCode.E_RECEIPT_FAILED]: 'E_RECEIPT_FAILED',\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 'E_RECEIPT_FINISHED_FAILED',\n [ErrorCode.E_NOT_PREPARED]: 'E_NOT_PREPARED',\n [ErrorCode.E_NOT_ENDED]: 'E_NOT_ENDED',\n [ErrorCode.E_ALREADY_OWNED]: 'E_ALREADY_OWNED',\n [ErrorCode.E_DEVELOPER_ERROR]: 'E_DEVELOPER_ERROR',\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]:\n 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n [ErrorCode.E_DEFERRED_PAYMENT]: 'E_DEFERRED_PAYMENT',\n [ErrorCode.E_INTERRUPTED]: 'E_INTERRUPTED',\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 'E_IAP_NOT_AVAILABLE',\n [ErrorCode.E_PURCHASE_ERROR]: 'E_PURCHASE_ERROR',\n [ErrorCode.E_SYNC_ERROR]: 'E_SYNC_ERROR',\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]:\n 'E_TRANSACTION_VALIDATION_FAILED',\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 'E_ACTIVITY_UNAVAILABLE',\n [ErrorCode.E_ALREADY_PREPARED]: 'E_ALREADY_PREPARED',\n [ErrorCode.E_PENDING]: 'E_PENDING',\n [ErrorCode.E_CONNECTION_CLOSED]: 'E_CONNECTION_CLOSED',\n },\n} as const;\n\nexport class PurchaseError implements Error {\n constructor(\n public name: string,\n public message: string,\n public responseCode?: number,\n public debugMessage?: string,\n public code?: ErrorCode,\n public productId?: string,\n public platform?: 'ios' | 'android',\n ) {\n this.name = '[expo-iap]: PurchaseError';\n this.message = message;\n this.responseCode = responseCode;\n this.debugMessage = debugMessage;\n this.code = code;\n this.productId = productId;\n this.platform = platform;\n }\n\n /**\n * Creates a PurchaseError from platform-specific error data\n * @param errorData Raw error data from native modules\n * @param platform Platform where the error occurred\n * @returns Properly typed PurchaseError instance\n */\n static fromPlatformError(\n errorData: any,\n platform: 'ios' | 'android',\n ): PurchaseError {\n const errorCode = errorData.code\n ? ErrorCodeUtils.fromPlatformCode(errorData.code, platform)\n : ErrorCode.E_UNKNOWN;\n\n return new PurchaseError(\n '[expo-iap]: PurchaseError',\n errorData.message || 'Unknown error occurred',\n errorData.responseCode,\n errorData.debugMessage,\n errorCode,\n errorData.productId,\n platform,\n );\n }\n\n /**\n * Gets the platform-specific error code for this error\n * @returns Platform-specific error code\n */\n getPlatformCode(): string | number | undefined {\n if (!this.code || !this.platform) return undefined;\n return ErrorCodeUtils.toPlatformCode(this.code, this.platform);\n }\n}\n\n/**\n * Utility functions for error code mapping and validation\n */\nexport const ErrorCodeUtils = {\n /**\n * Gets the native error code for the current platform\n * @param errorCode ErrorCode enum value\n * @returns Platform-specific error code from native constants\n */\n getNativeErrorCode: (errorCode: ErrorCode): string => {\n return NATIVE_ERROR_CODES[errorCode] || errorCode;\n },\n\n /**\n * Maps a platform-specific error code back to the standardized ErrorCode enum\n * @param platformCode Platform-specific error code (string for Android, number for iOS)\n * @param platform Target platform\n * @returns Corresponding ErrorCode enum value or E_UNKNOWN if not found\n */\n fromPlatformCode: (\n platformCode: string | number,\n platform: 'ios' | 'android',\n ): ErrorCode => {\n const mapping = ErrorCodeMapping[platform];\n\n for (const [errorCode, mappedCode] of Object.entries(mapping)) {\n if (mappedCode === platformCode) {\n return errorCode as ErrorCode;\n }\n }\n\n return ErrorCode.E_UNKNOWN;\n },\n\n /**\n * Maps an ErrorCode enum to platform-specific code\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns Platform-specific error code\n */\n toPlatformCode: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): string | number => {\n return (\n ErrorCodeMapping[platform][errorCode] ??\n (platform === 'ios' ? 0 : 'E_UNKNOWN')\n );\n },\n\n /**\n * Checks if an error code is valid for the specified platform\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns True if the error code is supported on the platform\n */\n isValidForPlatform: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): boolean => {\n return errorCode in ErrorCodeMapping[platform];\n },\n};\n\n// ============================================================================\n// Enhanced Unified Request Types\n// ============================================================================\n\n/**\n * Unified request props that work on both iOS and Android platforms\n * iOS will use 'sku', Android will use 'skus' (or convert sku to skus array)\n */\nexport interface UnifiedRequestPurchaseProps {\n // Universal properties - works on both platforms\n readonly sku?: string; // Single SKU (iOS native, Android fallback)\n readonly skus?: string[]; // Multiple SKUs (Android native, iOS uses first item)\n\n // iOS-specific properties (ignored on Android)\n readonly andDangerouslyFinishTransactionAutomatically?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIOS.types').PaymentDiscount;\n\n // Android-specific properties (ignored on iOS)\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n// ============================================================================\n// New Platform-Specific Request Types (v2.7.0+)\n// ============================================================================\n\n/**\n * iOS-specific purchase request parameters\n */\nexport interface RequestPurchaseIosProps {\n readonly sku: string;\n readonly andDangerouslyFinishTransactionAutomatically?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIOS.types').PaymentDiscount;\n}\n\n/**\n * Android-specific purchase request parameters\n */\nexport interface RequestPurchaseAndroidProps {\n readonly skus: string[];\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n/**\n * Android-specific subscription request parameters\n */\nexport interface RequestSubscriptionAndroidProps\n extends RequestPurchaseAndroidProps {\n readonly purchaseTokenAndroid?: string;\n readonly replacementModeAndroid?: number;\n readonly subscriptionOffers: {\n sku: string;\n offerToken: string;\n }[];\n}\n\n/**\n * Modern platform-specific request structure (v2.7.0+)\n * Allows clear separation of iOS and Android parameters\n */\nexport interface RequestPurchasePropsByPlatforms {\n readonly ios?: RequestPurchaseIosProps;\n readonly android?: RequestPurchaseAndroidProps;\n}\n\n/**\n * Modern platform-specific subscription request structure (v2.7.0+)\n */\nexport interface RequestSubscriptionPropsByPlatforms {\n readonly ios?: RequestPurchaseIosProps;\n readonly android?: RequestSubscriptionAndroidProps;\n}\n\n/**\n * Modern request purchase parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestPurchaseProps = RequestPurchasePropsByPlatforms;\n\n/**\n * Modern request subscription parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms;\n"]}
1
+ {"version":3,"file":"ExpoIap.types.js","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAUA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAqDnD,8DAA8D;AAC9D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AAoBzC;;;GAGG;AACH,MAAM,CAAN,IAAY,SAmCX;AAnCD,WAAY,SAAS;IACnB,oCAAuB,CAAA;IACvB,kDAAqC,CAAA;IACrC,0CAA6B,CAAA;IAC7B,sDAAyC,CAAA;IACzC,8CAAiC,CAAA;IACjC,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,kDAAqC,CAAA;IACrC,oEAAuD,CAAA;IACvD,8CAAiC,CAAA;IACjC,wC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,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC,SAAS,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,cAAc,EAAE,CACd,SAAoB,EACpB,QAA2B,EACV,EAAE;QACnB,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC,SAAS,CAAC,CAAC;YAC/C,IAAI,MAAM,KAAK,SAAS;gBAAE,OAAO,MAAM,CAAC;QAC1C,CAAC;QACD,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,CAGxC,CAAC;QACF,OAAO,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACtE,CAAC;IAED;;;;;OAKG;IACH,kBAAkB,EAAE,CAClB,SAAoB,EACpB,QAA2B,EAClB,EAAE;QACX,OAAO,SAAS,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACF,CAAC","sourcesContent":["import type {\n ProductAndroid,\n PurchaseAndroid,\n ProductSubscriptionAndroid,\n} from './types/ExpoIapAndroid.types';\nimport type {\n ProductIOS,\n PurchaseIOS,\n ProductSubscriptionIOS,\n} from './types/ExpoIapIOS.types';\nimport {NATIVE_ERROR_CODES} from './ExpoIapModule';\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type ProductType = 'inapp' | 'subs';\n\n// =============================================================================\n// COMMON TYPES (Base types shared across all platforms)\n// =============================================================================\n\nexport type ProductCommon = {\n id: string;\n title: string;\n description: string;\n type: ProductType;\n displayName?: string;\n displayPrice: string;\n currency: string;\n price?: number;\n debugDescription?: string;\n platform?: string;\n};\n\nexport type PurchaseCommon = {\n id: string; // Transaction identifier - used by finishTransaction\n productId: string; // Product identifier - which product was purchased\n ids?: string[]; // Product identifiers for purchases that include multiple products\n transactionId?: string; // @deprecated - use id instead\n transactionDate: number;\n transactionReceipt: string;\n purchaseToken?: string; // Unified purchase token (jwsRepresentation for iOS, purchaseToken for Android)\n platform?: string;\n};\n\nexport type ProductSubscriptionCommon = ProductCommon & {\n type: 'subs';\n};\n\n// Define literal platform types for better type discrimination\nexport type IosPlatform = {platform: 'ios'};\nexport type AndroidPlatform = {platform: 'android'};\n\n// Platform-agnostic unified product types (public API)\nexport type Product =\n | (ProductAndroid & AndroidPlatform)\n | (ProductIOS & IosPlatform);\n\nexport type SubscriptionProduct =\n | (ProductSubscriptionAndroid & AndroidPlatform)\n | (ProductSubscriptionIOS & IosPlatform);\n\n// Re-export all platform-specific types to avoid deep imports\nexport * from './types/ExpoIapAndroid.types';\nexport * from './types/ExpoIapIOS.types';\n\n// Unified purchase type for both products and subscriptions\nexport type Purchase =\n | (PurchaseAndroid & AndroidPlatform)\n | (PurchaseIOS & IosPlatform);\n\n// Removed legacy type aliases `ProductPurchase` and `SubscriptionPurchase` in v2.9.0\n\nexport type PurchaseResult = {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n /**\n * @deprecated Use `purchaseToken` instead. This field will be removed in a future version.\n */\n purchaseTokenAndroid?: string;\n purchaseToken?: string;\n};\n/**\n * Centralized error codes for expo-iap\n * These are mapped to platform-specific error codes and provide consistent error handling\n */\nexport enum ErrorCode {\n E_UNKNOWN = 'E_UNKNOWN',\n E_USER_CANCELLED = 'E_USER_CANCELLED',\n E_USER_ERROR = 'E_USER_ERROR',\n E_ITEM_UNAVAILABLE = 'E_ITEM_UNAVAILABLE',\n E_REMOTE_ERROR = 'E_REMOTE_ERROR',\n E_NETWORK_ERROR = 'E_NETWORK_ERROR',\n E_SERVICE_ERROR = 'E_SERVICE_ERROR',\n E_RECEIPT_FAILED = 'E_RECEIPT_FAILED',\n E_RECEIPT_FINISHED_FAILED = 'E_RECEIPT_FINISHED_FAILED',\n E_NOT_PREPARED = 'E_NOT_PREPARED',\n E_NOT_ENDED = 'E_NOT_ENDED',\n E_ALREADY_OWNED = 'E_ALREADY_OWNED',\n E_DEVELOPER_ERROR = 'E_DEVELOPER_ERROR',\n E_BILLING_RESPONSE_JSON_PARSE_ERROR = 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n E_DEFERRED_PAYMENT = 'E_DEFERRED_PAYMENT',\n E_INTERRUPTED = 'E_INTERRUPTED',\n E_IAP_NOT_AVAILABLE = 'E_IAP_NOT_AVAILABLE',\n E_PURCHASE_ERROR = 'E_PURCHASE_ERROR',\n E_SYNC_ERROR = 'E_SYNC_ERROR',\n E_TRANSACTION_VALIDATION_FAILED = 'E_TRANSACTION_VALIDATION_FAILED',\n E_ACTIVITY_UNAVAILABLE = 'E_ACTIVITY_UNAVAILABLE',\n E_ALREADY_PREPARED = 'E_ALREADY_PREPARED',\n E_PENDING = 'E_PENDING',\n E_CONNECTION_CLOSED = 'E_CONNECTION_CLOSED',\n // Additional detailed errors (Android-focused, kept cross-platform)\n E_INIT_CONNECTION = 'E_INIT_CONNECTION',\n E_SERVICE_DISCONNECTED = 'E_SERVICE_DISCONNECTED',\n E_QUERY_PRODUCT = 'E_QUERY_PRODUCT',\n E_SKU_NOT_FOUND = 'E_SKU_NOT_FOUND',\n E_SKU_OFFER_MISMATCH = 'E_SKU_OFFER_MISMATCH',\n E_ITEM_NOT_OWNED = 'E_ITEM_NOT_OWNED',\n E_BILLING_UNAVAILABLE = 'E_BILLING_UNAVAILABLE',\n E_FEATURE_NOT_SUPPORTED = 'E_FEATURE_NOT_SUPPORTED',\n E_EMPTY_SKU_LIST = 'E_EMPTY_SKU_LIST',\n}\n\n/**\n * Platform-specific error code mappings\n * Maps ErrorCode enum values to platform-specific integer codes\n */\nexport const ErrorCodeMapping = {\n ios: {\n [ErrorCode.E_UNKNOWN]: 0,\n [ErrorCode.E_SERVICE_ERROR]: 1,\n [ErrorCode.E_USER_CANCELLED]: 2,\n [ErrorCode.E_USER_ERROR]: 3,\n [ErrorCode.E_ITEM_UNAVAILABLE]: 4,\n [ErrorCode.E_REMOTE_ERROR]: 5,\n [ErrorCode.E_NETWORK_ERROR]: 6,\n [ErrorCode.E_RECEIPT_FAILED]: 7,\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 8,\n [ErrorCode.E_DEVELOPER_ERROR]: 9,\n [ErrorCode.E_PURCHASE_ERROR]: 10,\n [ErrorCode.E_SYNC_ERROR]: 11,\n [ErrorCode.E_DEFERRED_PAYMENT]: 12,\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]: 13,\n [ErrorCode.E_NOT_PREPARED]: 14,\n [ErrorCode.E_NOT_ENDED]: 15,\n [ErrorCode.E_ALREADY_OWNED]: 16,\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]: 17,\n [ErrorCode.E_INTERRUPTED]: 18,\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 19,\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 20,\n [ErrorCode.E_ALREADY_PREPARED]: 21,\n [ErrorCode.E_PENDING]: 22,\n [ErrorCode.E_CONNECTION_CLOSED]: 23,\n },\n android: {\n [ErrorCode.E_UNKNOWN]: 'E_UNKNOWN',\n [ErrorCode.E_USER_CANCELLED]: 'E_USER_CANCELLED',\n [ErrorCode.E_USER_ERROR]: 'E_USER_ERROR',\n [ErrorCode.E_ITEM_UNAVAILABLE]: 'E_ITEM_UNAVAILABLE',\n [ErrorCode.E_REMOTE_ERROR]: 'E_REMOTE_ERROR',\n [ErrorCode.E_NETWORK_ERROR]: 'E_NETWORK_ERROR',\n [ErrorCode.E_SERVICE_ERROR]: 'E_SERVICE_ERROR',\n [ErrorCode.E_RECEIPT_FAILED]: 'E_RECEIPT_FAILED',\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 'E_RECEIPT_FINISHED_FAILED',\n [ErrorCode.E_NOT_PREPARED]: 'E_NOT_PREPARED',\n [ErrorCode.E_NOT_ENDED]: 'E_NOT_ENDED',\n [ErrorCode.E_ALREADY_OWNED]: 'E_ALREADY_OWNED',\n [ErrorCode.E_DEVELOPER_ERROR]: 'E_DEVELOPER_ERROR',\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]:\n 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n [ErrorCode.E_DEFERRED_PAYMENT]: 'E_DEFERRED_PAYMENT',\n [ErrorCode.E_INTERRUPTED]: 'E_INTERRUPTED',\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 'E_IAP_NOT_AVAILABLE',\n [ErrorCode.E_PURCHASE_ERROR]: 'E_PURCHASE_ERROR',\n [ErrorCode.E_SYNC_ERROR]: 'E_SYNC_ERROR',\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]:\n 'E_TRANSACTION_VALIDATION_FAILED',\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 'E_ACTIVITY_UNAVAILABLE',\n [ErrorCode.E_ALREADY_PREPARED]: 'E_ALREADY_PREPARED',\n [ErrorCode.E_PENDING]: 'E_PENDING',\n [ErrorCode.E_CONNECTION_CLOSED]: 'E_CONNECTION_CLOSED',\n [ErrorCode.E_INIT_CONNECTION]: 'E_INIT_CONNECTION',\n [ErrorCode.E_SERVICE_DISCONNECTED]: 'E_SERVICE_DISCONNECTED',\n [ErrorCode.E_QUERY_PRODUCT]: 'E_QUERY_PRODUCT',\n [ErrorCode.E_SKU_NOT_FOUND]: 'E_SKU_NOT_FOUND',\n [ErrorCode.E_SKU_OFFER_MISMATCH]: 'E_SKU_OFFER_MISMATCH',\n [ErrorCode.E_ITEM_NOT_OWNED]: 'E_ITEM_NOT_OWNED',\n [ErrorCode.E_BILLING_UNAVAILABLE]: 'E_BILLING_UNAVAILABLE',\n [ErrorCode.E_FEATURE_NOT_SUPPORTED]: 'E_FEATURE_NOT_SUPPORTED',\n [ErrorCode.E_EMPTY_SKU_LIST]: 'E_EMPTY_SKU_LIST',\n },\n} as const;\n\nexport type PurchaseErrorProps = {\n message: string;\n responseCode?: number;\n debugMessage?: string;\n code?: ErrorCode;\n productId?: string;\n platform?: 'ios' | 'android';\n};\n\nexport class PurchaseError implements Error {\n public name: string;\n public message: string;\n public responseCode?: number;\n public debugMessage?: string;\n public code?: ErrorCode;\n public productId?: string;\n public platform?: 'ios' | 'android';\n\n // Backwards-compatible constructor: accepts either props object or legacy positional args\n constructor(messageOrProps: string | PurchaseErrorProps, ...rest: any[]) {\n this.name = '[expo-iap]: PurchaseError';\n\n if (typeof messageOrProps === 'string') {\n // Legacy signature: (name, message, responseCode?, debugMessage?, code?, productId?, platform?)\n // The first legacy argument was a name which we always override, so treat it as message here\n const message = messageOrProps;\n this.message = message;\n this.responseCode = rest[0];\n this.debugMessage = rest[1];\n this.code = rest[2];\n this.productId = rest[3];\n this.platform = rest[4];\n } else {\n const props = messageOrProps;\n this.message = props.message;\n this.responseCode = props.responseCode;\n this.debugMessage = props.debugMessage;\n this.code = props.code;\n this.productId = props.productId;\n this.platform = props.platform;\n }\n }\n\n /**\n * Creates a PurchaseError from platform-specific error data\n * @param errorData Raw error data from native modules\n * @param platform Platform where the error occurred\n * @returns Properly typed PurchaseError instance\n */\n static fromPlatformError(\n errorData: any,\n platform: 'ios' | 'android',\n ): PurchaseError {\n const errorCode = errorData.code\n ? ErrorCodeUtils.fromPlatformCode(errorData.code, platform)\n : ErrorCode.E_UNKNOWN;\n\n return new PurchaseError({\n message: errorData.message || 'Unknown error occurred',\n responseCode: errorData.responseCode,\n debugMessage: errorData.debugMessage,\n code: errorCode,\n productId: errorData.productId,\n platform,\n });\n }\n\n /**\n * Gets the platform-specific error code for this error\n * @returns Platform-specific error code\n */\n getPlatformCode(): string | number | undefined {\n if (!this.code || !this.platform) return undefined;\n return ErrorCodeUtils.toPlatformCode(this.code, this.platform);\n }\n}\n\n/**\n * Utility functions for error code mapping and validation\n */\nexport const ErrorCodeUtils = {\n /**\n * Gets the native error code for the current platform\n * @param errorCode ErrorCode enum value\n * @returns Platform-specific error code from native constants\n */\n getNativeErrorCode: (errorCode: ErrorCode): string => {\n return NATIVE_ERROR_CODES[errorCode] || errorCode;\n },\n\n /**\n * Maps a platform-specific error code back to the standardized ErrorCode enum\n * @param platformCode Platform-specific error code (string for Android, number for iOS)\n * @param platform Target platform\n * @returns Corresponding ErrorCode enum value or E_UNKNOWN if not found\n */\n fromPlatformCode: (\n platformCode: string | number,\n platform: 'ios' | 'android',\n ): ErrorCode => {\n // Prefer dynamic native mapping for iOS to avoid drift\n if (platform === 'ios') {\n for (const [key, value] of Object.entries(NATIVE_ERROR_CODES || {})) {\n if (value === platformCode) {\n return key as ErrorCode;\n }\n }\n }\n\n const mapping = ErrorCodeMapping[platform];\n for (const [errorCode, mappedCode] of Object.entries(mapping)) {\n if (mappedCode === platformCode) {\n return errorCode as ErrorCode;\n }\n }\n\n return ErrorCode.E_UNKNOWN;\n },\n\n /**\n * Maps an ErrorCode enum to platform-specific code\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns Platform-specific error code\n */\n toPlatformCode: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): string | number => {\n if (platform === 'ios') {\n const native = NATIVE_ERROR_CODES?.[errorCode];\n if (native !== undefined) return native;\n }\n const mapping = ErrorCodeMapping[platform] as Record<\n ErrorCode,\n string | number\n >;\n return mapping[errorCode] ?? (platform === 'ios' ? 0 : 'E_UNKNOWN');\n },\n\n /**\n * Checks if an error code is valid for the specified platform\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns True if the error code is supported on the platform\n */\n isValidForPlatform: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): boolean => {\n return errorCode in ErrorCodeMapping[platform];\n },\n};\n\n// ============================================================================\n// Enhanced Unified Request Types\n// ============================================================================\n\n/**\n * Unified request props that work on both iOS and Android platforms\n * iOS will use 'sku', Android will use 'skus' (or convert sku to skus array)\n */\nexport interface UnifiedRequestPurchaseProps {\n // Universal properties - works on both platforms\n readonly sku?: string; // Single SKU (iOS native, Android fallback)\n readonly skus?: string[]; // Multiple SKUs (Android native, iOS uses first item)\n\n // iOS-specific properties (ignored on Android)\n readonly andDangerouslyFinishTransactionAutomatically?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIOS.types').PaymentDiscount;\n\n // Android-specific properties (ignored on iOS)\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n// ============================================================================\n// New Platform-Specific Request Types (v2.7.0+)\n// ============================================================================\n\n/**\n * iOS-specific purchase request parameters\n */\nexport interface RequestPurchaseIosProps {\n readonly sku: string;\n readonly andDangerouslyFinishTransactionAutomatically?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIOS.types').PaymentDiscount;\n}\n\n/**\n * Android-specific purchase request parameters\n */\nexport interface RequestPurchaseAndroidProps {\n readonly skus: string[];\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n/**\n * Android-specific subscription request parameters\n */\nexport interface RequestSubscriptionAndroidProps\n extends RequestPurchaseAndroidProps {\n readonly purchaseTokenAndroid?: string;\n readonly replacementModeAndroid?: number;\n readonly subscriptionOffers: {\n sku: string;\n offerToken: string;\n }[];\n}\n\n/**\n * Modern platform-specific request structure (v2.7.0+)\n * Allows clear separation of iOS and Android parameters\n */\nexport interface RequestPurchasePropsByPlatforms {\n readonly ios?: RequestPurchaseIosProps;\n readonly android?: RequestPurchaseAndroidProps;\n}\n\n/**\n * Modern platform-specific subscription request structure (v2.7.0+)\n */\nexport interface RequestSubscriptionPropsByPlatforms {\n readonly ios?: RequestPurchaseIosProps;\n readonly android?: RequestSubscriptionAndroidProps;\n}\n\n/**\n * Modern request purchase parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestPurchaseProps = RequestPurchasePropsByPlatforms;\n\n/**\n * Modern request subscription parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms;\n"]}
package/build/index.d.ts CHANGED
@@ -114,19 +114,6 @@ export declare const getPurchaseHistory: ({ alsoPublishToEventListener, onlyIncl
114
114
  alsoPublishToEventListenerIOS?: boolean;
115
115
  onlyIncludeActiveItemsIOS?: boolean;
116
116
  }) => Promise<Purchase[]>;
117
- /**
118
- * @deprecated Use getAvailablePurchases instead. This function is just calling getAvailablePurchases internally on iOS
119
- * and returns an empty array on Android (Google Play Billing v8 removed purchase history API).
120
- * Will be removed in v2.9.0
121
- */
122
- export declare const getPurchaseHistories: ({ alsoPublishToEventListener, onlyIncludeActiveItems, alsoPublishToEventListenerIOS, onlyIncludeActiveItemsIOS, }?: {
123
- /** @deprecated Use alsoPublishToEventListenerIOS instead */
124
- alsoPublishToEventListener?: boolean;
125
- /** @deprecated Use onlyIncludeActiveItemsIOS instead */
126
- onlyIncludeActiveItems?: boolean;
127
- alsoPublishToEventListenerIOS?: boolean;
128
- onlyIncludeActiveItemsIOS?: boolean;
129
- }) => Promise<Purchase[]>;
130
117
  export declare const getAvailablePurchases: ({ alsoPublishToEventListener, onlyIncludeActiveItems, alsoPublishToEventListenerIOS, onlyIncludeActiveItemsIOS, }?: {
131
118
  /** @deprecated Use alsoPublishToEventListenerIOS instead */
132
119
  alsoPublishToEventListener?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EAEb,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EAIpB,MAAM,iBAAiB,CAAC;AAGzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAG9B,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,kBAAkB,GACxB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,EAAE,KAAmB,CAAC;AA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C;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
@@ -6,7 +6,7 @@ import ExpoIapModule from './ExpoIapModule';
6
6
  import { isProductIOS, validateReceiptIOS, deepLinkToSubscriptionsIOS, } from './modules/ios';
7
7
  import { isProductAndroid, validateReceiptAndroid, deepLinkToSubscriptionsAndroid, } from './modules/android';
8
8
  // Types
9
- import { PurchaseError, } from './ExpoIap.types';
9
+ import { PurchaseError, ErrorCode, } from './ExpoIap.types';
10
10
  // Export all types
11
11
  export * from './ExpoIap.types';
12
12
  export * from './modules/android';
@@ -82,7 +82,10 @@ export function initConnection() {
82
82
  export const getProducts = async (skus) => {
83
83
  console.warn("`getProducts` is deprecated. Use `fetchProducts({ skus, type: 'inapp' })` instead. This function will be removed in version 3.0.0.");
84
84
  if (!skus?.length) {
85
- return Promise.reject(new Error('"skus" is required'));
85
+ return Promise.reject(new PurchaseError({
86
+ message: 'No SKUs provided',
87
+ code: ErrorCode.E_EMPTY_SKU_LIST,
88
+ }));
86
89
  }
87
90
  return Platform.select({
88
91
  ios: async () => {
@@ -107,7 +110,10 @@ export const getProducts = async (skus) => {
107
110
  export const getSubscriptions = async (skus) => {
108
111
  console.warn("`getSubscriptions` is deprecated. Use `fetchProducts({ skus, type: 'subs' })` instead. This function will be removed in version 3.0.0.");
109
112
  if (!skus?.length) {
110
- return Promise.reject(new Error('"skus" is required'));
113
+ return Promise.reject(new PurchaseError({
114
+ message: 'No SKUs provided',
115
+ code: ErrorCode.E_EMPTY_SKU_LIST,
116
+ }));
111
117
  }
112
118
  return Platform.select({
113
119
  ios: async () => {
@@ -164,7 +170,10 @@ export async function endConnection() {
164
170
  */
165
171
  export const fetchProducts = async ({ skus, type = 'inapp', }) => {
166
172
  if (!skus?.length) {
167
- throw new Error('No SKUs provided');
173
+ throw new PurchaseError({
174
+ message: 'No SKUs provided',
175
+ code: ErrorCode.E_EMPTY_SKU_LIST,
176
+ });
168
177
  }
169
178
  if (Platform.OS === 'ios') {
170
179
  const rawItems = await ExpoIapModule.fetchProducts({ skus, type });
@@ -231,27 +240,13 @@ export const requestProducts = async ({ skus, type = 'inapp', }) => {
231
240
  */
232
241
  export const getPurchaseHistory = ({ alsoPublishToEventListener = false, onlyIncludeActiveItems = false, alsoPublishToEventListenerIOS, onlyIncludeActiveItemsIOS, } = {}) => {
233
242
  console.warn('`getPurchaseHistory` is deprecated. Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.');
234
- return getPurchaseHistories({
243
+ // Use available purchases as a best-effort replacement
244
+ return getAvailablePurchases({
235
245
  alsoPublishToEventListenerIOS: alsoPublishToEventListenerIOS ?? alsoPublishToEventListener,
236
246
  onlyIncludeActiveItemsIOS: onlyIncludeActiveItemsIOS ?? onlyIncludeActiveItems,
237
247
  });
238
248
  };
239
- /**
240
- * @deprecated Use getAvailablePurchases instead. This function is just calling getAvailablePurchases internally on iOS
241
- * and returns an empty array on Android (Google Play Billing v8 removed purchase history API).
242
- * Will be removed in v2.9.0
243
- */
244
- export const getPurchaseHistories = ({ alsoPublishToEventListener = false, onlyIncludeActiveItems = false, alsoPublishToEventListenerIOS, onlyIncludeActiveItemsIOS, } = {}) => (Platform.select({
245
- ios: async () => {
246
- return ExpoIapModule.getAvailableItems(alsoPublishToEventListenerIOS ?? alsoPublishToEventListener, onlyIncludeActiveItemsIOS ?? onlyIncludeActiveItems);
247
- },
248
- android: async () => {
249
- // getPurchaseHistoryByType was removed in Google Play Billing Library v8
250
- // Android doesn't provide purchase history anymore, only active purchases
251
- console.warn('getPurchaseHistories is not supported on Android with Google Play Billing Library v8. Use getAvailablePurchases instead to get active purchases.');
252
- return [];
253
- },
254
- }) || (() => Promise.resolve([])))();
249
+ // NOTE: `getPurchaseHistories` removed in v2.9.0. Use `getAvailablePurchases` instead.
255
250
  export const getAvailablePurchases = ({ alsoPublishToEventListener = false, onlyIncludeActiveItems = true, alsoPublishToEventListenerIOS, onlyIncludeActiveItemsIOS, } = {}) => (Platform.select({
256
251
  ios: () => ExpoIapModule.getAvailableItems(alsoPublishToEventListenerIOS ?? alsoPublishToEventListener, onlyIncludeActiveItemsIOS ?? onlyIncludeActiveItems),
257
252
  android: async () => {
@@ -412,7 +407,12 @@ export const finishTransaction = ({ purchase, isConsumable = false, }) => {
412
407
  // Use purchaseToken if available, fallback to purchaseTokenAndroid for backward compatibility
413
408
  const token = androidPurchase.purchaseToken || androidPurchase.purchaseTokenAndroid;
414
409
  if (!token) {
415
- return Promise.reject(new PurchaseError('[expo-iap]: PurchaseError', 'Purchase token is required to finish transaction', undefined, undefined, 'E_DEVELOPER_ERROR', androidPurchase.productId, 'android'));
410
+ return Promise.reject(new PurchaseError({
411
+ message: 'Purchase token is required to finish transaction',
412
+ code: 'E_DEVELOPER_ERROR',
413
+ productId: androidPurchase.productId,
414
+ platform: 'android',
415
+ }));
416
416
  }
417
417
  if (isConsumable) {
418
418
  return ExpoIapModule.consumeProductAndroid(token);