react-native-iap 14.7.1 → 14.7.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/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +128 -1
- package/ios/RnIapHelper.swift +24 -0
- package/lib/module/types.js +63 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +49 -0
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +11 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +244 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +8 -0
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +9 -1
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +4 -0
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +11 -3
- package/nitrogen/generated/android/c++/JSubscriptionProductReplacementParamsAndroid.hpp +63 -0
- package/nitrogen/generated/android/c++/JSubscriptionReplacementModeAndroid.hpp +74 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +8 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/SubscriptionProductReplacementParamsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/SubscriptionReplacementModeAndroid.kt +26 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +21 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +6 -0
- package/nitrogen/generated/ios/swift/NitroProduct.swift +61 -1
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +24 -1
- package/nitrogen/generated/ios/swift/SubscriptionProductReplacementParamsAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/SubscriptionReplacementModeAndroid.swift +60 -0
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +9 -1
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +9 -2
- package/nitrogen/generated/shared/c++/SubscriptionProductReplacementParamsAndroid.hpp +81 -0
- package/nitrogen/generated/shared/c++/SubscriptionReplacementModeAndroid.hpp +96 -0
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/specs/RnIap.nitro.ts +12 -0
- package/src/types.ts +250 -1
- package/src/utils/type-bridge.ts +53 -0
package/src/utils/type-bridge.ts
CHANGED
|
@@ -277,6 +277,30 @@ export function convertNitroProductToProduct(
|
|
|
277
277
|
iosProduct.discountsIOS = null;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
+
// Parse standardized subscriptionOffers (cross-platform, OpenIAP 1.3.10+)
|
|
281
|
+
if (nitroProduct.subscriptionOffers) {
|
|
282
|
+
try {
|
|
283
|
+
iosProduct.subscriptionOffers = JSON.parse(
|
|
284
|
+
nitroProduct.subscriptionOffers,
|
|
285
|
+
);
|
|
286
|
+
} catch {
|
|
287
|
+
iosProduct.subscriptionOffers = null;
|
|
288
|
+
}
|
|
289
|
+
} else {
|
|
290
|
+
iosProduct.subscriptionOffers = null;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Parse standardized discountOffers (cross-platform, OpenIAP 1.3.10+)
|
|
294
|
+
if (nitroProduct.discountOffers) {
|
|
295
|
+
try {
|
|
296
|
+
iosProduct.discountOffers = JSON.parse(nitroProduct.discountOffers);
|
|
297
|
+
} catch {
|
|
298
|
+
iosProduct.discountOffers = null;
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
iosProduct.discountOffers = null;
|
|
302
|
+
}
|
|
303
|
+
|
|
280
304
|
return iosProduct as Product;
|
|
281
305
|
}
|
|
282
306
|
|
|
@@ -290,10 +314,39 @@ export function convertNitroProductToProduct(
|
|
|
290
314
|
),
|
|
291
315
|
};
|
|
292
316
|
|
|
317
|
+
// Parse standardized subscriptionOffers (cross-platform, OpenIAP 1.3.10+)
|
|
318
|
+
if (nitroProduct.subscriptionOffers) {
|
|
319
|
+
try {
|
|
320
|
+
androidProduct.subscriptionOffers = JSON.parse(
|
|
321
|
+
nitroProduct.subscriptionOffers,
|
|
322
|
+
);
|
|
323
|
+
} catch {
|
|
324
|
+
androidProduct.subscriptionOffers = null;
|
|
325
|
+
}
|
|
326
|
+
} else {
|
|
327
|
+
androidProduct.subscriptionOffers = null;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Parse standardized discountOffers (cross-platform, OpenIAP 1.3.10+)
|
|
331
|
+
if (nitroProduct.discountOffers) {
|
|
332
|
+
try {
|
|
333
|
+
androidProduct.discountOffers = JSON.parse(nitroProduct.discountOffers);
|
|
334
|
+
} catch {
|
|
335
|
+
androidProduct.discountOffers = null;
|
|
336
|
+
}
|
|
337
|
+
} else {
|
|
338
|
+
androidProduct.discountOffers = null;
|
|
339
|
+
}
|
|
340
|
+
|
|
293
341
|
if (type === PRODUCT_TYPE_SUBS) {
|
|
342
|
+
// Ensure subscriptionOfferDetailsAndroid is always an array for subscriptions
|
|
294
343
|
if (!Array.isArray(androidProduct.subscriptionOfferDetailsAndroid)) {
|
|
295
344
|
androidProduct.subscriptionOfferDetailsAndroid = [];
|
|
296
345
|
}
|
|
346
|
+
// Ensure subscriptionOffers is always an array for subscriptions (non-nullable in ProductSubscriptionAndroid)
|
|
347
|
+
if (!Array.isArray(androidProduct.subscriptionOffers)) {
|
|
348
|
+
androidProduct.subscriptionOffers = [];
|
|
349
|
+
}
|
|
297
350
|
}
|
|
298
351
|
|
|
299
352
|
return androidProduct as Product;
|