react-native-iap 15.3.6 → 15.4.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/android/build.gradle +13 -5
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +19 -6
- package/ios/HybridRnIap.swift +13 -1
- package/lib/module/index.js +56 -16
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.kepler.js +170 -0
- package/lib/module/index.kepler.js.map +1 -0
- package/lib/module/types/amazon-devices-kepler/index.d.js +2 -0
- package/lib/module/types/amazon-devices-kepler/index.d.js.map +1 -0
- package/lib/module/types.js +5 -2
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/error.js +2 -2
- package/lib/module/utils/error.js.map +1 -1
- package/lib/module/utils/type-bridge.js +4 -1
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/module/vega-adapter.js +981 -0
- package/lib/module/vega-adapter.js.map +1 -0
- package/lib/module/vega.js +10 -0
- package/lib/module/vega.js.map +1 -0
- package/lib/module/vega.kepler.js +18 -0
- package/lib/module/vega.kepler.js.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.kepler.d.ts +55 -0
- package/lib/typescript/src/index.kepler.d.ts.map +1 -0
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +10 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +16 -3
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/lib/typescript/src/vega-adapter.d.ts +76 -0
- package/lib/typescript/src/vega-adapter.d.ts.map +1 -0
- package/lib/typescript/src/vega.d.ts +4 -0
- package/lib/typescript/src/vega.d.ts.map +1 -0
- package/lib/typescript/src/vega.kepler.d.ts +4 -0
- package/lib/typescript/src/vega.kepler.d.ts.map +1 -0
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +5 -0
- package/nitrogen/generated/android/c++/JIapStore.hpp +3 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitAmazonProps.hpp +71 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitProps.hpp +9 -1
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderProps.hpp +4 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.hpp +75 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitProps.hpp +4 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapStore.kt +2 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitAmazonProps.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitProps.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.kt +53 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +47 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/swift/IapStore.swift +4 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitAmazonProps.swift +103 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitProps.swift +38 -1
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.swift +18 -0
- package/nitrogen/generated/shared/c++/IapStore.hpp +4 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitAmazonProps.hpp +94 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitProps.hpp +8 -1
- package/openiap-versions.json +2 -2
- package/package.json +19 -12
- package/src/index.kepler.ts +311 -0
- package/src/index.ts +65 -19
- package/src/specs/RnIap.nitro.ts +13 -2
- package/src/types/amazon-devices-kepler/index.d.ts +14 -0
- package/src/types.ts +17 -3
- package/src/utils/error.ts +2 -2
- package/src/utils/type-bridge.ts +4 -1
- package/src/vega-adapter.ts +1503 -0
- package/src/vega.kepler.ts +21 -0
- package/src/vega.ts +10 -0
- package/android/src/test/java/com/margelo/nitro/iap/ListenerThreadSafetyTest.kt +0 -154
- package/android/src/test/java/com/margelo/nitro/iap/OpenIapExceptionTest.kt +0 -93
- package/android/src/test/java/com/margelo/nitro/iap/ProductQueryHelpersTest.kt +0 -140
- package/app.plugin.js +0 -1
- package/lib/typescript/plugin/src/withIAP.d.ts +0 -48
- package/lib/typescript/plugin/src/withIAP.d.ts.map +0 -1
- package/plugin/build/withIAP.d.ts +0 -47
- package/plugin/build/withIAP.js +0 -314
- package/plugin/src/withIAP.ts +0 -500
- package/plugin/tsconfig.json +0 -18
- package/plugin/tsconfig.tsbuildinfo +0 -1
package/src/types.ts
CHANGED
|
@@ -511,7 +511,7 @@ export type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product
|
|
|
511
511
|
|
|
512
512
|
export type IapPlatform = 'ios' | 'android';
|
|
513
513
|
|
|
514
|
-
export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
|
|
514
|
+
export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon' | 'amazon';
|
|
515
515
|
|
|
516
516
|
/** Unified purchase states from IAPKit verification response. */
|
|
517
517
|
export type IapkitPurchaseState = 'entitled' | 'pending-acknowledgment' | 'pending' | 'canceled' | 'expired' | 'ready-to-consume' | 'consumed' | 'unknown' | 'inauthentic';
|
|
@@ -1614,7 +1614,8 @@ export type RequestPurchaseProps =
|
|
|
1614
1614
|
*
|
|
1615
1615
|
* Note: "Platforms" refers to the SDK/OS level (apple, google), not the store.
|
|
1616
1616
|
* - apple: Always targets App Store
|
|
1617
|
-
* - google: Targets Play Store by default,
|
|
1617
|
+
* - google: Targets Play Store by default, Horizon when built with horizon flavor,
|
|
1618
|
+
* or Fire OS when built with amazon flavor
|
|
1618
1619
|
* (determined at build time, not runtime)
|
|
1619
1620
|
*/
|
|
1620
1621
|
export interface RequestPurchasePropsByPlatforms {
|
|
@@ -1713,7 +1714,8 @@ export interface RequestSubscriptionIosProps {
|
|
|
1713
1714
|
*
|
|
1714
1715
|
* Note: "Platforms" refers to the SDK/OS level (apple, google), not the store.
|
|
1715
1716
|
* - apple: Always targets App Store
|
|
1716
|
-
* - google: Targets Play Store by default,
|
|
1717
|
+
* - google: Targets Play Store by default, Horizon when built with horizon flavor,
|
|
1718
|
+
* or Fire OS when built with amazon flavor
|
|
1717
1719
|
* (determined at build time, not runtime)
|
|
1718
1720
|
*/
|
|
1719
1721
|
export interface RequestSubscriptionPropsByPlatforms {
|
|
@@ -1727,6 +1729,15 @@ export interface RequestSubscriptionPropsByPlatforms {
|
|
|
1727
1729
|
ios?: (RequestSubscriptionIosProps | null);
|
|
1728
1730
|
}
|
|
1729
1731
|
|
|
1732
|
+
export interface RequestVerifyPurchaseWithIapkitAmazonProps {
|
|
1733
|
+
/** Amazon Appstore receipt id returned by PurchaseResponse.getReceipt().getReceiptId(). */
|
|
1734
|
+
receiptId: string;
|
|
1735
|
+
/** Use Amazon RVS Cloud Sandbox for App Tester receipts. */
|
|
1736
|
+
sandbox?: (boolean | null);
|
|
1737
|
+
/** Amazon Appstore user id returned by PurchaseResponse.getUserData().getUserId(). */
|
|
1738
|
+
userId?: (string | null);
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1730
1741
|
export interface RequestVerifyPurchaseWithIapkitAppleProps {
|
|
1731
1742
|
/** The JWS token returned with the purchase response. */
|
|
1732
1743
|
jws: string;
|
|
@@ -1742,8 +1753,11 @@ export interface RequestVerifyPurchaseWithIapkitGoogleProps {
|
|
|
1742
1753
|
*
|
|
1743
1754
|
* - apple: Verifies via App Store (JWS token)
|
|
1744
1755
|
* - google: Verifies via Play Store (purchase token)
|
|
1756
|
+
* - amazon: Verifies via Amazon Appstore RVS (userId + receiptId)
|
|
1745
1757
|
*/
|
|
1746
1758
|
export interface RequestVerifyPurchaseWithIapkitProps {
|
|
1759
|
+
/** Amazon Appstore verification parameters. */
|
|
1760
|
+
amazon?: (RequestVerifyPurchaseWithIapkitAmazonProps | null);
|
|
1747
1761
|
/** API key used for the Authorization header (Bearer {apiKey}). */
|
|
1748
1762
|
apiKey?: (string | null);
|
|
1749
1763
|
/** Apple App Store verification parameters. */
|
package/src/utils/error.ts
CHANGED
|
@@ -116,12 +116,12 @@ const parseStructuredError = (error: Error): IapError | null => {
|
|
|
116
116
|
unknown
|
|
117
117
|
>;
|
|
118
118
|
|
|
119
|
-
if (
|
|
119
|
+
if (errorWithCode.code != null) {
|
|
120
120
|
const {code, message, ...extraFields} = errorWithCode;
|
|
121
121
|
|
|
122
122
|
return {
|
|
123
123
|
...extraFields,
|
|
124
|
-
code,
|
|
124
|
+
code: String(code),
|
|
125
125
|
message: typeof message === 'string' ? message : error.message,
|
|
126
126
|
};
|
|
127
127
|
}
|
package/src/utils/type-bridge.ts
CHANGED
|
@@ -35,6 +35,7 @@ const STORE_UNKNOWN: IapStore = 'unknown';
|
|
|
35
35
|
const STORE_APPLE: IapStore = 'apple';
|
|
36
36
|
const STORE_GOOGLE: IapStore = 'google';
|
|
37
37
|
const STORE_HORIZON: IapStore = 'horizon';
|
|
38
|
+
const STORE_AMAZON: IapStore = 'amazon';
|
|
38
39
|
const PRODUCT_TYPE_SUBS: ProductType = 'subs';
|
|
39
40
|
const PRODUCT_TYPE_IN_APP: ProductType = 'in-app';
|
|
40
41
|
const PURCHASE_STATE_PENDING: PurchaseState = 'pending';
|
|
@@ -67,6 +68,8 @@ function normalizeStore(value?: Nullable<string>): IapStore {
|
|
|
67
68
|
return STORE_GOOGLE;
|
|
68
69
|
case 'horizon':
|
|
69
70
|
return STORE_HORIZON;
|
|
71
|
+
case 'amazon':
|
|
72
|
+
return STORE_AMAZON;
|
|
70
73
|
default:
|
|
71
74
|
return STORE_UNKNOWN;
|
|
72
75
|
}
|
|
@@ -191,7 +194,7 @@ function toNullableBoolean(value: unknown): boolean | null {
|
|
|
191
194
|
function parseSubscriptionOffers(value?: Nullable<string> | any[]) {
|
|
192
195
|
if (!value) return undefined;
|
|
193
196
|
|
|
194
|
-
//
|
|
197
|
+
// Keep pre-normalized native values intact.
|
|
195
198
|
if (Array.isArray(value)) {
|
|
196
199
|
return value;
|
|
197
200
|
}
|