expo-iap 2.4.4 → 2.4.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.
- package/README.md +52 -1
- package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +31 -6
- package/build/ExpoIap.types.d.ts +116 -2
- package/build/ExpoIap.types.d.ts.map +1 -1
- package/build/ExpoIap.types.js +142 -1
- package/build/ExpoIap.types.js.map +1 -1
- package/build/ExpoIapModule.d.ts +3 -2
- package/build/ExpoIapModule.d.ts.map +1 -1
- package/build/ExpoIapModule.js +4 -1
- package/build/ExpoIapModule.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/useIap.js.map +1 -1
- package/build/utils/errorMapping.d.ts +29 -0
- package/build/utils/errorMapping.d.ts.map +1 -0
- package/build/utils/errorMapping.js +79 -0
- package/build/utils/errorMapping.js.map +1 -0
- package/bun.lockb +0 -0
- package/docs/ERROR_CODES.md +172 -0
- package/{iap.md → docs/IAP.md} +191 -192
- package/docs/README.md +30 -0
- package/ios/ExpoIapModule.swift +68 -43
- package/ios/Types.swift +26 -18
- package/package.json +5 -2
- package/src/ExpoIap.types.ts +173 -0
- package/src/ExpoIapModule.ts +6 -1
- package/src/index.ts +1 -0
- package/src/useIap.ts +1 -1
- package/src/utils/errorMapping.ts +88 -0
package/README.md
CHANGED
|
@@ -10,7 +10,58 @@ The `expo-iap` module has been migrated from [react-native-iap](https://github.c
|
|
|
10
10
|
|
|
11
11
|
# API documentation
|
|
12
12
|
|
|
13
|
-
- [Documentation](./
|
|
13
|
+
- [Documentation](./docs/IAP.md)
|
|
14
|
+
- [Error Code Management](./docs/ERROR_CODES.md)
|
|
15
|
+
|
|
16
|
+
## Error Handling
|
|
17
|
+
|
|
18
|
+
expo-iap now provides a centralized error code system that works consistently across iOS and Android platforms. This system maps platform-specific error codes to standardized TypeScript enums.
|
|
19
|
+
|
|
20
|
+
### Error Codes
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import {ErrorCode} from 'expo-iap';
|
|
24
|
+
|
|
25
|
+
// Standardized error codes
|
|
26
|
+
ErrorCode.E_USER_CANCELLED; // User cancelled the purchase
|
|
27
|
+
ErrorCode.E_NETWORK_ERROR; // Network connectivity issue
|
|
28
|
+
ErrorCode.E_ITEM_UNAVAILABLE; // Product not available
|
|
29
|
+
ErrorCode.E_SERVICE_ERROR; // Store service error
|
|
30
|
+
// ... and more
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Error Utilities
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import {
|
|
37
|
+
mapPlatformError,
|
|
38
|
+
isUserCancelledError,
|
|
39
|
+
getUserFriendlyErrorMessage,
|
|
40
|
+
} from 'expo-iap';
|
|
41
|
+
|
|
42
|
+
// Handle purchase errors
|
|
43
|
+
try {
|
|
44
|
+
await requestPurchase({sku: 'product_id'});
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (isUserCancelledError(error)) {
|
|
47
|
+
// User cancelled - don't show error
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Show user-friendly message
|
|
52
|
+
const message = getUserFriendlyErrorMessage(error);
|
|
53
|
+
Alert.alert('Purchase Failed', message);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Platform-Specific Error Mapping
|
|
58
|
+
|
|
59
|
+
The system automatically maps platform codes:
|
|
60
|
+
|
|
61
|
+
- **iOS**: Integer codes (0, 1, 2, etc.) → ErrorCode enum
|
|
62
|
+
- **Android**: String codes ("E_USER_CANCELLED", etc.) → ErrorCode enum
|
|
63
|
+
|
|
64
|
+
This ensures consistent error handling regardless of platform.
|
|
14
65
|
|
|
15
66
|
> Sharing your thoughts—any feedback would be greatly appreciated!
|
|
16
67
|
|
|
@@ -28,9 +28,20 @@ class ExpoIapModule :
|
|
|
28
28
|
PurchasesUpdatedListener {
|
|
29
29
|
companion object {
|
|
30
30
|
const val TAG = "ExpoIapModule"
|
|
31
|
+
|
|
32
|
+
// Error codes for IAP operations
|
|
31
33
|
const val E_NOT_PREPARED = "E_NOT_PREPARED"
|
|
32
34
|
const val E_INIT_CONNECTION = "E_INIT_CONNECTION"
|
|
33
35
|
const val E_QUERY_PRODUCT = "E_QUERY_PRODUCT"
|
|
36
|
+
const val E_UNKNOWN = "E_UNKNOWN"
|
|
37
|
+
const val E_SKU_OFFER_MISMATCH = "E_SKU_OFFER_MISMATCH"
|
|
38
|
+
const val E_SKU_NOT_FOUND = "E_SKU_NOT_FOUND"
|
|
39
|
+
const val E_USER_CANCELLED = "E_USER_CANCELLED"
|
|
40
|
+
const val E_DEVELOPER_ERROR = "E_DEVELOPER_ERROR"
|
|
41
|
+
const val E_ITEM_UNAVAILABLE = "E_ITEM_UNAVAILABLE"
|
|
42
|
+
const val E_SERVICE_ERROR = "E_SERVICE_ERROR"
|
|
43
|
+
const val E_PURCHASE_ERROR = "E_PURCHASE_ERROR"
|
|
44
|
+
|
|
34
45
|
const val EMPTY_SKU_LIST = "EMPTY_SKU_LIST"
|
|
35
46
|
private const val PROMISE_BUY_ITEM = "PROMISE_BUY_ITEM"
|
|
36
47
|
}
|
|
@@ -126,7 +137,21 @@ class ExpoIapModule :
|
|
|
126
137
|
ModuleDefinition {
|
|
127
138
|
Name("ExpoIap")
|
|
128
139
|
|
|
129
|
-
Constants(
|
|
140
|
+
Constants(
|
|
141
|
+
"ERROR_CODES" to mapOf(
|
|
142
|
+
"E_UNKNOWN" to E_UNKNOWN,
|
|
143
|
+
"E_USER_CANCELLED" to E_USER_CANCELLED,
|
|
144
|
+
"E_NOT_PREPARED" to E_NOT_PREPARED,
|
|
145
|
+
"E_SERVICE_ERROR" to E_SERVICE_ERROR,
|
|
146
|
+
"E_ITEM_UNAVAILABLE" to E_ITEM_UNAVAILABLE,
|
|
147
|
+
"E_PURCHASE_ERROR" to E_PURCHASE_ERROR,
|
|
148
|
+
"E_DEVELOPER_ERROR" to E_DEVELOPER_ERROR,
|
|
149
|
+
"E_SKU_NOT_FOUND" to E_SKU_NOT_FOUND,
|
|
150
|
+
"E_SKU_OFFER_MISMATCH" to E_SKU_OFFER_MISMATCH,
|
|
151
|
+
"E_INIT_CONNECTION" to E_INIT_CONNECTION,
|
|
152
|
+
"E_QUERY_PRODUCT" to E_QUERY_PRODUCT,
|
|
153
|
+
)
|
|
154
|
+
)
|
|
130
155
|
|
|
131
156
|
Events(IapEvent.PURCHASE_UPDATED, IapEvent.PURCHASE_ERROR)
|
|
132
157
|
|
|
@@ -330,7 +355,7 @@ class ExpoIapModule :
|
|
|
330
355
|
val isOfferPersonalized = params["isOfferPersonalized"] as? Boolean ?: false
|
|
331
356
|
|
|
332
357
|
if (currentActivity == null) {
|
|
333
|
-
promise.reject(
|
|
358
|
+
promise.reject(E_UNKNOWN, "getCurrentActivity returned null", null)
|
|
334
359
|
return@AsyncFunction
|
|
335
360
|
}
|
|
336
361
|
|
|
@@ -344,14 +369,14 @@ class ExpoIapModule :
|
|
|
344
369
|
IapEvent.PURCHASE_ERROR,
|
|
345
370
|
mapOf(
|
|
346
371
|
"debugMessage" to debugMessage,
|
|
347
|
-
"code" to
|
|
372
|
+
"code" to E_SKU_OFFER_MISMATCH,
|
|
348
373
|
"message" to debugMessage,
|
|
349
374
|
)
|
|
350
375
|
)
|
|
351
376
|
} catch (e: Exception) {
|
|
352
377
|
Log.e(TAG, "Failed to send PURCHASE_ERROR event: ${e.message}")
|
|
353
378
|
}
|
|
354
|
-
promise.reject(
|
|
379
|
+
promise.reject(E_SKU_OFFER_MISMATCH, debugMessage, null)
|
|
355
380
|
return@ensureConnection
|
|
356
381
|
}
|
|
357
382
|
|
|
@@ -366,7 +391,7 @@ class ExpoIapModule :
|
|
|
366
391
|
IapEvent.PURCHASE_ERROR,
|
|
367
392
|
mapOf(
|
|
368
393
|
"debugMessage" to debugMessage,
|
|
369
|
-
"code" to
|
|
394
|
+
"code" to E_SKU_NOT_FOUND,
|
|
370
395
|
"message" to debugMessage,
|
|
371
396
|
"productId" to sku,
|
|
372
397
|
),
|
|
@@ -374,7 +399,7 @@ class ExpoIapModule :
|
|
|
374
399
|
} catch (e: Exception) {
|
|
375
400
|
Log.e(TAG, "Failed to send PURCHASE_ERROR event: ${e.message}")
|
|
376
401
|
}
|
|
377
|
-
promise.reject(
|
|
402
|
+
promise.reject(E_SKU_NOT_FOUND, debugMessage, null)
|
|
378
403
|
return@ensureConnection
|
|
379
404
|
}
|
|
380
405
|
|
package/build/ExpoIap.types.d.ts
CHANGED
|
@@ -45,6 +45,10 @@ export type PurchaseResult = {
|
|
|
45
45
|
message?: string;
|
|
46
46
|
purchaseTokenAndroid?: string;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Centralized error codes for expo-iap
|
|
50
|
+
* These are mapped to platform-specific error codes and provide consistent error handling
|
|
51
|
+
*/
|
|
48
52
|
export declare enum ErrorCode {
|
|
49
53
|
E_UNKNOWN = "E_UNKNOWN",
|
|
50
54
|
E_USER_CANCELLED = "E_USER_CANCELLED",
|
|
@@ -62,8 +66,73 @@ export declare enum ErrorCode {
|
|
|
62
66
|
E_BILLING_RESPONSE_JSON_PARSE_ERROR = "E_BILLING_RESPONSE_JSON_PARSE_ERROR",
|
|
63
67
|
E_DEFERRED_PAYMENT = "E_DEFERRED_PAYMENT",
|
|
64
68
|
E_INTERRUPTED = "E_INTERRUPTED",
|
|
65
|
-
E_IAP_NOT_AVAILABLE = "E_IAP_NOT_AVAILABLE"
|
|
69
|
+
E_IAP_NOT_AVAILABLE = "E_IAP_NOT_AVAILABLE",
|
|
70
|
+
E_PURCHASE_ERROR = "E_PURCHASE_ERROR",
|
|
71
|
+
E_SYNC_ERROR = "E_SYNC_ERROR",
|
|
72
|
+
E_TRANSACTION_VALIDATION_FAILED = "E_TRANSACTION_VALIDATION_FAILED",
|
|
73
|
+
E_ACTIVITY_UNAVAILABLE = "E_ACTIVITY_UNAVAILABLE",
|
|
74
|
+
E_ALREADY_PREPARED = "E_ALREADY_PREPARED",
|
|
75
|
+
E_PENDING = "E_PENDING",
|
|
76
|
+
E_CONNECTION_CLOSED = "E_CONNECTION_CLOSED"
|
|
66
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Platform-specific error code mappings
|
|
80
|
+
* Maps ErrorCode enum values to platform-specific integer codes
|
|
81
|
+
*/
|
|
82
|
+
export declare const ErrorCodeMapping: {
|
|
83
|
+
readonly ios: {
|
|
84
|
+
readonly E_UNKNOWN: 0;
|
|
85
|
+
readonly E_SERVICE_ERROR: 1;
|
|
86
|
+
readonly E_USER_CANCELLED: 2;
|
|
87
|
+
readonly E_USER_ERROR: 3;
|
|
88
|
+
readonly E_ITEM_UNAVAILABLE: 4;
|
|
89
|
+
readonly E_REMOTE_ERROR: 5;
|
|
90
|
+
readonly E_NETWORK_ERROR: 6;
|
|
91
|
+
readonly E_RECEIPT_FAILED: 7;
|
|
92
|
+
readonly E_RECEIPT_FINISHED_FAILED: 8;
|
|
93
|
+
readonly E_DEVELOPER_ERROR: 9;
|
|
94
|
+
readonly E_PURCHASE_ERROR: 10;
|
|
95
|
+
readonly E_SYNC_ERROR: 11;
|
|
96
|
+
readonly E_DEFERRED_PAYMENT: 12;
|
|
97
|
+
readonly E_TRANSACTION_VALIDATION_FAILED: 13;
|
|
98
|
+
readonly E_NOT_PREPARED: 14;
|
|
99
|
+
readonly E_NOT_ENDED: 15;
|
|
100
|
+
readonly E_ALREADY_OWNED: 16;
|
|
101
|
+
readonly E_BILLING_RESPONSE_JSON_PARSE_ERROR: 17;
|
|
102
|
+
readonly E_INTERRUPTED: 18;
|
|
103
|
+
readonly E_IAP_NOT_AVAILABLE: 19;
|
|
104
|
+
readonly E_ACTIVITY_UNAVAILABLE: 20;
|
|
105
|
+
readonly E_ALREADY_PREPARED: 21;
|
|
106
|
+
readonly E_PENDING: 22;
|
|
107
|
+
readonly E_CONNECTION_CLOSED: 23;
|
|
108
|
+
};
|
|
109
|
+
readonly android: {
|
|
110
|
+
readonly E_UNKNOWN: "E_UNKNOWN";
|
|
111
|
+
readonly E_USER_CANCELLED: "E_USER_CANCELLED";
|
|
112
|
+
readonly E_USER_ERROR: "E_USER_ERROR";
|
|
113
|
+
readonly E_ITEM_UNAVAILABLE: "E_ITEM_UNAVAILABLE";
|
|
114
|
+
readonly E_REMOTE_ERROR: "E_REMOTE_ERROR";
|
|
115
|
+
readonly E_NETWORK_ERROR: "E_NETWORK_ERROR";
|
|
116
|
+
readonly E_SERVICE_ERROR: "E_SERVICE_ERROR";
|
|
117
|
+
readonly E_RECEIPT_FAILED: "E_RECEIPT_FAILED";
|
|
118
|
+
readonly E_RECEIPT_FINISHED_FAILED: "E_RECEIPT_FINISHED_FAILED";
|
|
119
|
+
readonly E_NOT_PREPARED: "E_NOT_PREPARED";
|
|
120
|
+
readonly E_NOT_ENDED: "E_NOT_ENDED";
|
|
121
|
+
readonly E_ALREADY_OWNED: "E_ALREADY_OWNED";
|
|
122
|
+
readonly E_DEVELOPER_ERROR: "E_DEVELOPER_ERROR";
|
|
123
|
+
readonly E_BILLING_RESPONSE_JSON_PARSE_ERROR: "E_BILLING_RESPONSE_JSON_PARSE_ERROR";
|
|
124
|
+
readonly E_DEFERRED_PAYMENT: "E_DEFERRED_PAYMENT";
|
|
125
|
+
readonly E_INTERRUPTED: "E_INTERRUPTED";
|
|
126
|
+
readonly E_IAP_NOT_AVAILABLE: "E_IAP_NOT_AVAILABLE";
|
|
127
|
+
readonly E_PURCHASE_ERROR: "E_PURCHASE_ERROR";
|
|
128
|
+
readonly E_SYNC_ERROR: "E_SYNC_ERROR";
|
|
129
|
+
readonly E_TRANSACTION_VALIDATION_FAILED: "E_TRANSACTION_VALIDATION_FAILED";
|
|
130
|
+
readonly E_ACTIVITY_UNAVAILABLE: "E_ACTIVITY_UNAVAILABLE";
|
|
131
|
+
readonly E_ALREADY_PREPARED: "E_ALREADY_PREPARED";
|
|
132
|
+
readonly E_PENDING: "E_PENDING";
|
|
133
|
+
readonly E_CONNECTION_CLOSED: "E_CONNECTION_CLOSED";
|
|
134
|
+
};
|
|
135
|
+
};
|
|
67
136
|
export declare class PurchaseError implements Error {
|
|
68
137
|
name: string;
|
|
69
138
|
message: string;
|
|
@@ -71,6 +140,51 @@ export declare class PurchaseError implements Error {
|
|
|
71
140
|
debugMessage?: string | undefined;
|
|
72
141
|
code?: ErrorCode | undefined;
|
|
73
142
|
productId?: string | undefined;
|
|
74
|
-
|
|
143
|
+
platform?: "ios" | "android" | undefined;
|
|
144
|
+
constructor(name: string, message: string, responseCode?: number | undefined, debugMessage?: string | undefined, code?: ErrorCode | undefined, productId?: string | undefined, platform?: "ios" | "android" | undefined);
|
|
145
|
+
/**
|
|
146
|
+
* Creates a PurchaseError from platform-specific error data
|
|
147
|
+
* @param errorData Raw error data from native modules
|
|
148
|
+
* @param platform Platform where the error occurred
|
|
149
|
+
* @returns Properly typed PurchaseError instance
|
|
150
|
+
*/
|
|
151
|
+
static fromPlatformError(errorData: any, platform: 'ios' | 'android'): PurchaseError;
|
|
152
|
+
/**
|
|
153
|
+
* Gets the platform-specific error code for this error
|
|
154
|
+
* @returns Platform-specific error code
|
|
155
|
+
*/
|
|
156
|
+
getPlatformCode(): string | number | undefined;
|
|
75
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Utility functions for error code mapping and validation
|
|
160
|
+
*/
|
|
161
|
+
export declare const ErrorCodeUtils: {
|
|
162
|
+
/**
|
|
163
|
+
* Gets the native error code for the current platform
|
|
164
|
+
* @param errorCode ErrorCode enum value
|
|
165
|
+
* @returns Platform-specific error code from native constants
|
|
166
|
+
*/
|
|
167
|
+
getNativeErrorCode: (errorCode: ErrorCode) => string;
|
|
168
|
+
/**
|
|
169
|
+
* Maps a platform-specific error code back to the standardized ErrorCode enum
|
|
170
|
+
* @param platformCode Platform-specific error code (string for Android, number for iOS)
|
|
171
|
+
* @param platform Target platform
|
|
172
|
+
* @returns Corresponding ErrorCode enum value or E_UNKNOWN if not found
|
|
173
|
+
*/
|
|
174
|
+
fromPlatformCode: (platformCode: string | number, platform: "ios" | "android") => ErrorCode;
|
|
175
|
+
/**
|
|
176
|
+
* Maps an ErrorCode enum to platform-specific code
|
|
177
|
+
* @param errorCode ErrorCode enum value
|
|
178
|
+
* @param platform Target platform
|
|
179
|
+
* @returns Platform-specific error code
|
|
180
|
+
*/
|
|
181
|
+
toPlatformCode: (errorCode: ErrorCode, platform: "ios" | "android") => string | number;
|
|
182
|
+
/**
|
|
183
|
+
* Checks if an error code is valid for the specified platform
|
|
184
|
+
* @param errorCode ErrorCode enum value
|
|
185
|
+
* @param platform Target platform
|
|
186
|
+
* @returns True if the error code is supported on the platform
|
|
187
|
+
*/
|
|
188
|
+
isValidForPlatform: (errorCode: ErrorCode, platform: "ios" | "android") => boolean;
|
|
189
|
+
};
|
|
76
190
|
//# sourceMappingURL=ExpoIap.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIap.types.d.ts","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,2BAA2B,EAC3B,+BAA+B,EAC/B,0BAA0B,EAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpoIap.types.d.ts","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,2BAA2B,EAC3B,+BAA+B,EAC/B,0BAA0B,EAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,MAAM,k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AC,EAAE,SAAS;IAChB,SAAS,CAAC,EAAE,MAAM;IAClB,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS;gBAN5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,YAAA,EACrB,YAAY,CAAC,EAAE,MAAM,YAAA,EACrB,IAAI,CAAC,EAAE,SAAS,YAAA,EAChB,SAAS,CAAC,EAAE,MAAM,YAAA,EAClB,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS,YAAA;IAWrC;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,CACtB,SAAS,EAAE,GAAG,EACd,QAAQ,EAAE,KAAK,GAAG,SAAS,GAC1B,aAAa;IAgBhB;;;OAGG;IACH,eAAe,IAAI,MAAM,GAAG,MAAM,GAAG,SAAS;CAI/C;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;IACzB;;;;OAIG;oCAC6B,SAAS,KAAG,MAAM;IAIlD;;;;;OAKG;qCAEa,MAAM,GAAG,MAAM,YACnB,KAAK,GAAG,SAAS,KAC1B,SAAS;IAYZ;;;;;OAKG;gCAEU,SAAS,YACV,KAAK,GAAG,SAAS,KAC1B,MAAM,GAAG,MAAM;IAOlB;;;;;OAKG;oCAEU,SAAS,YACV,KAAK,GAAG,SAAS,KAC1B,OAAO;CAGX,CAAC"}
|
package/build/ExpoIap.types.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { NATIVE_ERROR_CODES } from './ExpoIapModule';
|
|
2
|
+
/**
|
|
3
|
+
* Centralized error codes for expo-iap
|
|
4
|
+
* These are mapped to platform-specific error codes and provide consistent error handling
|
|
5
|
+
*/
|
|
1
6
|
export var ErrorCode;
|
|
2
7
|
(function (ErrorCode) {
|
|
3
8
|
ErrorCode["E_UNKNOWN"] = "E_UNKNOWN";
|
|
@@ -17,7 +22,72 @@ export var ErrorCode;
|
|
|
17
22
|
ErrorCode["E_DEFERRED_PAYMENT"] = "E_DEFERRED_PAYMENT";
|
|
18
23
|
ErrorCode["E_INTERRUPTED"] = "E_INTERRUPTED";
|
|
19
24
|
ErrorCode["E_IAP_NOT_AVAILABLE"] = "E_IAP_NOT_AVAILABLE";
|
|
25
|
+
ErrorCode["E_PURCHASE_ERROR"] = "E_PURCHASE_ERROR";
|
|
26
|
+
ErrorCode["E_SYNC_ERROR"] = "E_SYNC_ERROR";
|
|
27
|
+
ErrorCode["E_TRANSACTION_VALIDATION_FAILED"] = "E_TRANSACTION_VALIDATION_FAILED";
|
|
28
|
+
ErrorCode["E_ACTIVITY_UNAVAILABLE"] = "E_ACTIVITY_UNAVAILABLE";
|
|
29
|
+
ErrorCode["E_ALREADY_PREPARED"] = "E_ALREADY_PREPARED";
|
|
30
|
+
ErrorCode["E_PENDING"] = "E_PENDING";
|
|
31
|
+
ErrorCode["E_CONNECTION_CLOSED"] = "E_CONNECTION_CLOSED";
|
|
20
32
|
})(ErrorCode || (ErrorCode = {}));
|
|
33
|
+
/**
|
|
34
|
+
* Platform-specific error code mappings
|
|
35
|
+
* Maps ErrorCode enum values to platform-specific integer codes
|
|
36
|
+
*/
|
|
37
|
+
export const ErrorCodeMapping = {
|
|
38
|
+
ios: {
|
|
39
|
+
[ErrorCode.E_UNKNOWN]: 0,
|
|
40
|
+
[ErrorCode.E_SERVICE_ERROR]: 1,
|
|
41
|
+
[ErrorCode.E_USER_CANCELLED]: 2,
|
|
42
|
+
[ErrorCode.E_USER_ERROR]: 3,
|
|
43
|
+
[ErrorCode.E_ITEM_UNAVAILABLE]: 4,
|
|
44
|
+
[ErrorCode.E_REMOTE_ERROR]: 5,
|
|
45
|
+
[ErrorCode.E_NETWORK_ERROR]: 6,
|
|
46
|
+
[ErrorCode.E_RECEIPT_FAILED]: 7,
|
|
47
|
+
[ErrorCode.E_RECEIPT_FINISHED_FAILED]: 8,
|
|
48
|
+
[ErrorCode.E_DEVELOPER_ERROR]: 9,
|
|
49
|
+
[ErrorCode.E_PURCHASE_ERROR]: 10,
|
|
50
|
+
[ErrorCode.E_SYNC_ERROR]: 11,
|
|
51
|
+
[ErrorCode.E_DEFERRED_PAYMENT]: 12,
|
|
52
|
+
[ErrorCode.E_TRANSACTION_VALIDATION_FAILED]: 13,
|
|
53
|
+
[ErrorCode.E_NOT_PREPARED]: 14,
|
|
54
|
+
[ErrorCode.E_NOT_ENDED]: 15,
|
|
55
|
+
[ErrorCode.E_ALREADY_OWNED]: 16,
|
|
56
|
+
[ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]: 17,
|
|
57
|
+
[ErrorCode.E_INTERRUPTED]: 18,
|
|
58
|
+
[ErrorCode.E_IAP_NOT_AVAILABLE]: 19,
|
|
59
|
+
[ErrorCode.E_ACTIVITY_UNAVAILABLE]: 20,
|
|
60
|
+
[ErrorCode.E_ALREADY_PREPARED]: 21,
|
|
61
|
+
[ErrorCode.E_PENDING]: 22,
|
|
62
|
+
[ErrorCode.E_CONNECTION_CLOSED]: 23,
|
|
63
|
+
},
|
|
64
|
+
android: {
|
|
65
|
+
[ErrorCode.E_UNKNOWN]: 'E_UNKNOWN',
|
|
66
|
+
[ErrorCode.E_USER_CANCELLED]: 'E_USER_CANCELLED',
|
|
67
|
+
[ErrorCode.E_USER_ERROR]: 'E_USER_ERROR',
|
|
68
|
+
[ErrorCode.E_ITEM_UNAVAILABLE]: 'E_ITEM_UNAVAILABLE',
|
|
69
|
+
[ErrorCode.E_REMOTE_ERROR]: 'E_REMOTE_ERROR',
|
|
70
|
+
[ErrorCode.E_NETWORK_ERROR]: 'E_NETWORK_ERROR',
|
|
71
|
+
[ErrorCode.E_SERVICE_ERROR]: 'E_SERVICE_ERROR',
|
|
72
|
+
[ErrorCode.E_RECEIPT_FAILED]: 'E_RECEIPT_FAILED',
|
|
73
|
+
[ErrorCode.E_RECEIPT_FINISHED_FAILED]: 'E_RECEIPT_FINISHED_FAILED',
|
|
74
|
+
[ErrorCode.E_NOT_PREPARED]: 'E_NOT_PREPARED',
|
|
75
|
+
[ErrorCode.E_NOT_ENDED]: 'E_NOT_ENDED',
|
|
76
|
+
[ErrorCode.E_ALREADY_OWNED]: 'E_ALREADY_OWNED',
|
|
77
|
+
[ErrorCode.E_DEVELOPER_ERROR]: 'E_DEVELOPER_ERROR',
|
|
78
|
+
[ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]: 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',
|
|
79
|
+
[ErrorCode.E_DEFERRED_PAYMENT]: 'E_DEFERRED_PAYMENT',
|
|
80
|
+
[ErrorCode.E_INTERRUPTED]: 'E_INTERRUPTED',
|
|
81
|
+
[ErrorCode.E_IAP_NOT_AVAILABLE]: 'E_IAP_NOT_AVAILABLE',
|
|
82
|
+
[ErrorCode.E_PURCHASE_ERROR]: 'E_PURCHASE_ERROR',
|
|
83
|
+
[ErrorCode.E_SYNC_ERROR]: 'E_SYNC_ERROR',
|
|
84
|
+
[ErrorCode.E_TRANSACTION_VALIDATION_FAILED]: 'E_TRANSACTION_VALIDATION_FAILED',
|
|
85
|
+
[ErrorCode.E_ACTIVITY_UNAVAILABLE]: 'E_ACTIVITY_UNAVAILABLE',
|
|
86
|
+
[ErrorCode.E_ALREADY_PREPARED]: 'E_ALREADY_PREPARED',
|
|
87
|
+
[ErrorCode.E_PENDING]: 'E_PENDING',
|
|
88
|
+
[ErrorCode.E_CONNECTION_CLOSED]: 'E_CONNECTION_CLOSED',
|
|
89
|
+
},
|
|
90
|
+
};
|
|
21
91
|
export class PurchaseError {
|
|
22
92
|
name;
|
|
23
93
|
message;
|
|
@@ -25,19 +95,90 @@ export class PurchaseError {
|
|
|
25
95
|
debugMessage;
|
|
26
96
|
code;
|
|
27
97
|
productId;
|
|
28
|
-
|
|
98
|
+
platform;
|
|
99
|
+
constructor(name, message, responseCode, debugMessage, code, productId, platform) {
|
|
29
100
|
this.name = name;
|
|
30
101
|
this.message = message;
|
|
31
102
|
this.responseCode = responseCode;
|
|
32
103
|
this.debugMessage = debugMessage;
|
|
33
104
|
this.code = code;
|
|
34
105
|
this.productId = productId;
|
|
106
|
+
this.platform = platform;
|
|
35
107
|
this.name = '[expo-iap]: PurchaseError';
|
|
36
108
|
this.message = message;
|
|
37
109
|
this.responseCode = responseCode;
|
|
38
110
|
this.debugMessage = debugMessage;
|
|
39
111
|
this.code = code;
|
|
40
112
|
this.productId = productId;
|
|
113
|
+
this.platform = platform;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Creates a PurchaseError from platform-specific error data
|
|
117
|
+
* @param errorData Raw error data from native modules
|
|
118
|
+
* @param platform Platform where the error occurred
|
|
119
|
+
* @returns Properly typed PurchaseError instance
|
|
120
|
+
*/
|
|
121
|
+
static fromPlatformError(errorData, platform) {
|
|
122
|
+
const errorCode = errorData.code
|
|
123
|
+
? ErrorCodeUtils.fromPlatformCode(errorData.code, platform)
|
|
124
|
+
: ErrorCode.E_UNKNOWN;
|
|
125
|
+
return new PurchaseError('[expo-iap]: PurchaseError', errorData.message || 'Unknown error occurred', errorData.responseCode, errorData.debugMessage, errorCode, errorData.productId, platform);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Gets the platform-specific error code for this error
|
|
129
|
+
* @returns Platform-specific error code
|
|
130
|
+
*/
|
|
131
|
+
getPlatformCode() {
|
|
132
|
+
if (!this.code || !this.platform)
|
|
133
|
+
return undefined;
|
|
134
|
+
return ErrorCodeUtils.toPlatformCode(this.code, this.platform);
|
|
41
135
|
}
|
|
42
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Utility functions for error code mapping and validation
|
|
139
|
+
*/
|
|
140
|
+
export const ErrorCodeUtils = {
|
|
141
|
+
/**
|
|
142
|
+
* Gets the native error code for the current platform
|
|
143
|
+
* @param errorCode ErrorCode enum value
|
|
144
|
+
* @returns Platform-specific error code from native constants
|
|
145
|
+
*/
|
|
146
|
+
getNativeErrorCode: (errorCode) => {
|
|
147
|
+
return NATIVE_ERROR_CODES[errorCode] || errorCode;
|
|
148
|
+
},
|
|
149
|
+
/**
|
|
150
|
+
* Maps a platform-specific error code back to the standardized ErrorCode enum
|
|
151
|
+
* @param platformCode Platform-specific error code (string for Android, number for iOS)
|
|
152
|
+
* @param platform Target platform
|
|
153
|
+
* @returns Corresponding ErrorCode enum value or E_UNKNOWN if not found
|
|
154
|
+
*/
|
|
155
|
+
fromPlatformCode: (platformCode, platform) => {
|
|
156
|
+
const mapping = ErrorCodeMapping[platform];
|
|
157
|
+
for (const [errorCode, mappedCode] of Object.entries(mapping)) {
|
|
158
|
+
if (mappedCode === platformCode) {
|
|
159
|
+
return errorCode;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return ErrorCode.E_UNKNOWN;
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
* Maps an ErrorCode enum to platform-specific code
|
|
166
|
+
* @param errorCode ErrorCode enum value
|
|
167
|
+
* @param platform Target platform
|
|
168
|
+
* @returns Platform-specific error code
|
|
169
|
+
*/
|
|
170
|
+
toPlatformCode: (errorCode, platform) => {
|
|
171
|
+
return (ErrorCodeMapping[platform][errorCode] ??
|
|
172
|
+
(platform === 'ios' ? 0 : 'E_UNKNOWN'));
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* Checks if an error code is valid for the specified platform
|
|
176
|
+
* @param errorCode ErrorCode enum value
|
|
177
|
+
* @param platform Target platform
|
|
178
|
+
* @returns True if the error code is supported on the platform
|
|
179
|
+
*/
|
|
180
|
+
isValidForPlatform: (errorCode, platform) => {
|
|
181
|
+
return errorCode in ErrorCodeMapping[platform];
|
|
182
|
+
},
|
|
183
|
+
};
|
|
43
184
|
//# sourceMappingURL=ExpoIap.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIap.types.js","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAmFA,MAAM,CAAN,IAAY,SAkBX;AAlBD,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,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,wFAA2E,CAAA;IAC3E,sDAAyC,CAAA;IACzC,4CAA+B,CAAA;IAC/B,wDAA2C,CAAA;AAC7C,CAAC,EAlBW,SAAS,KAAT,SAAS,QAkBpB;AAED,MAAM,OAAO,aAAa;IAEf;IACA;IACA;IACA;IACA;IACA;IANT,YACS,IAAY,EACZ,OAAe,EACf,YAAqB,EACrB,YAAqB,EACrB,IAAgB,EAChB,SAAkB;QALlB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,iBAAY,GAAZ,YAAY,CAAS;QACrB,iBAAY,GAAZ,YAAY,CAAS;QACrB,SAAI,GAAJ,IAAI,CAAY;QAChB,cAAS,GAAT,SAAS,CAAS;QAEzB,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import {\n ProductAndroid,\n ProductPurchaseAndroid,\n RequestPurchaseAndroidProps,\n RequestSubscriptionAndroidProps,\n SubscriptionProductAndroid,\n} from './types/ExpoIapAndroid.types';\nimport {\n ProductIos,\n ProductPurchaseIos,\n RequestPurchaseIosProps,\n RequestSubscriptionIosProps,\n SubscriptionProductIos,\n} from './types/ExpoIapIos.types';\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\n/**\n * Base product type with common properties shared between iOS and Android\n */\nexport type ProductBase = {\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};\n\n// Define literal platform types for better type discrimination\nexport type IosPlatform = {platform: 'ios'};\nexport type AndroidPlatform = {platform: 'android'};\nexport type ProductType = 'inapp' | 'subs';\n\n// Common base purchase type\nexport type PurchaseBase = {\n id: string;\n transactionId?: string;\n transactionDate: number;\n transactionReceipt: string;\n};\n\n// Union type for platform-specific product types with proper discriminators\nexport type Product =\n | (ProductAndroid & AndroidPlatform)\n | (ProductIos & IosPlatform);\n\n// Union type for platform-specific purchase types with proper discriminators\nexport type ProductPurchase =\n | (ProductPurchaseAndroid & AndroidPlatform)\n | (ProductPurchaseIos & IosPlatform);\n\n// Union type for platform-specific subscription purchase types with proper discriminators\nexport type SubscriptionPurchase =\n | (ProductPurchaseAndroid & AndroidPlatform & {autoRenewingAndroid: boolean})\n | (ProductPurchaseIos & IosPlatform);\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\nexport type RequestPurchaseProps =\n | RequestPurchaseIosProps\n | RequestPurchaseAndroidProps;\n\nexport type SubscriptionProduct =\n | (SubscriptionProductAndroid & AndroidPlatform)\n | (SubscriptionProductIos & IosPlatform);\n\nexport type RequestSubscriptionProps =\n | RequestSubscriptionAndroidProps\n | RequestSubscriptionIosProps;\n\nexport type PurchaseResult = {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n purchaseTokenAndroid?: string;\n};\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}\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 ) {\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 }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoIap.types.js","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAsEnD;;;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,CAAA;IACnC,gDAAmC,CAAA;IACnC,kDAAqC,CAAA;IACrC,oEAAuD,CAAA;IACvD,8CAAiC,CAAA;IACjC,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,wFAA2E,CAAA;IAC3E,sDAAyC,CAAA;IACzC,4CAA+B,CAAA;IAC/B,wDAA2C,CAAA;IAC3C,kDAAqC,CAAA;IACrC,0CAA6B,CAAA;IAC7B,gFAAmE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CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACF,CAAC","sourcesContent":["import {\n ProductAndroid,\n ProductPurchaseAndroid,\n RequestPurchaseAndroidProps,\n RequestSubscriptionAndroidProps,\n SubscriptionProductAndroid,\n} from './types/ExpoIapAndroid.types';\nimport {\n ProductIos,\n ProductPurchaseIos,\n RequestPurchaseIosProps,\n RequestSubscriptionIosProps,\n SubscriptionProductIos,\n} from './types/ExpoIapIos.types';\nimport {NATIVE_ERROR_CODES} from './ExpoIapModule';\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\n/**\n * Base product type with common properties shared between iOS and Android\n */\nexport type ProductBase = {\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};\n\n// Define literal platform types for better type discrimination\nexport type IosPlatform = {platform: 'ios'};\nexport type AndroidPlatform = {platform: 'android'};\nexport type ProductType = 'inapp' | 'subs';\n\n// Common base purchase type\nexport type PurchaseBase = {\n id: string;\n transactionId?: string;\n transactionDate: number;\n transactionReceipt: string;\n};\n\n// Union type for platform-specific product types with proper discriminators\nexport type Product =\n | (ProductAndroid & AndroidPlatform)\n | (ProductIos & IosPlatform);\n\n// Union type for platform-specific purchase types with proper discriminators\nexport type ProductPurchase =\n | (ProductPurchaseAndroid & AndroidPlatform)\n | (ProductPurchaseIos & IosPlatform);\n\n// Union type for platform-specific subscription purchase types with proper discriminators\nexport type SubscriptionPurchase =\n | (ProductPurchaseAndroid & AndroidPlatform & {autoRenewingAndroid: boolean})\n | (ProductPurchaseIos & IosPlatform);\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\nexport type RequestPurchaseProps =\n | RequestPurchaseIosProps\n | RequestPurchaseAndroidProps;\n\nexport type SubscriptionProduct =\n | (SubscriptionProductAndroid & AndroidPlatform)\n | (SubscriptionProductIos & IosPlatform);\n\nexport type RequestSubscriptionProps =\n | RequestSubscriptionAndroidProps\n | RequestSubscriptionIosProps;\n\nexport type PurchaseResult = {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n purchaseTokenAndroid?: string;\n};\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"]}
|
package/build/ExpoIapModule.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIapModule.d.ts","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExpoIapModule.d.ts","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,aAAa,KAAiC,CAAC;AAGrD,eAAO,MAAM,kBAAkB,KAAkC,CAAC;AAElE,eAAe,aAAa,CAAC"}
|
package/build/ExpoIapModule.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { requireNativeModule } from 'expo-modules-core';
|
|
2
2
|
// It loads the native module object from the JSI or falls back to
|
|
3
3
|
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
|
|
4
|
-
|
|
4
|
+
const ExpoIapModule = requireNativeModule('ExpoIap');
|
|
5
|
+
// Platform-specific error codes from native modules
|
|
6
|
+
export const NATIVE_ERROR_CODES = ExpoIapModule.ERROR_CODES || {};
|
|
7
|
+
export default ExpoIapModule;
|
|
5
8
|
//# sourceMappingURL=ExpoIapModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIapModule.js","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAEtD,kEAAkE;AAClE,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"ExpoIapModule.js","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAEtD,kEAAkE;AAClE,4EAA4E;AAC5E,MAAM,aAAa,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;AAErD,oDAAoD;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,WAAW,IAAI,EAAE,CAAC;AAElE,eAAe,aAAa,CAAC","sourcesContent":["import {requireNativeModule} from 'expo-modules-core';\n\n// It loads the native module object from the JSI or falls back to\n// the bridge module (from NativeModulesProxy) if the remote debugger is on.\nconst ExpoIapModule = requireNativeModule('ExpoIap');\n\n// Platform-specific error codes from native modules\nexport const NATIVE_ERROR_CODES = ExpoIapModule.ERROR_CODES || {};\n\nexport default ExpoIapModule;\n"]}
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,OAAO,EACP,eAAe,EACf,QAAQ,EACR,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEL,2BAA2B,EAC3B,+BAA+B,EAChC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAIlC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAG9B,eAAO,MAAM,EAAE,KAAmB,CAAC;AAEnC,oBAAY,QAAQ;IAClB,eAAe,qBAAqB;IACpC,aAAa,mBAAmB;IAChC,yFAAyF;IACzF,qBAAqB,4BAA4B;CAClD;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,cAAc,EAAE,CACd,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAA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