react-native-iap 14.4.9 → 14.4.11

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 (30) hide show
  1. package/README.md +0 -8
  2. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +59 -8
  3. package/ios/RnIapHelper.swift +32 -1
  4. package/lib/module/utils/type-bridge.js +39 -1
  5. package/lib/module/utils/type-bridge.js.map +1 -1
  6. package/lib/typescript/src/specs/RnIap.nitro.d.ts +29 -0
  7. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  8. package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
  9. package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +2 -0
  10. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +4 -0
  11. package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +61 -0
  12. package/nitrogen/generated/android/c++/JNitroProduct.hpp +16 -2
  13. package/nitrogen/generated/android/c++/JNitroPurchase.hpp +74 -2
  14. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +35 -0
  15. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +10 -1
  16. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +55 -1
  17. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +18 -0
  18. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +3 -0
  19. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +3 -0
  20. package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +57 -0
  21. package/nitrogen/generated/ios/swift/NitroProduct.swift +91 -1
  22. package/nitrogen/generated/ios/swift/NitroPurchase.swift +520 -1
  23. package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +75 -0
  24. package/nitrogen/generated/shared/c++/NitroProduct.hpp +17 -2
  25. package/nitrogen/generated/shared/c++/NitroPurchase.hpp +74 -2
  26. package/openiap-versions.json +1 -1
  27. package/package.json +4 -4
  28. package/src/specs/RnIap.nitro.ts +32 -0
  29. package/src/utils/type-bridge.ts +76 -16
  30. package/android/src/main/java/com/margelo/nitro/iap/Types.kt +0 -173
@@ -20,10 +20,13 @@
20
20
 
21
21
  // Forward declaration of `IapPlatform` to properly resolve imports.
22
22
  namespace margelo::nitro::iap { enum class IapPlatform; }
23
+ // Forward declaration of `NitroOneTimePurchaseOfferDetail` to properly resolve imports.
24
+ namespace margelo::nitro::iap { struct NitroOneTimePurchaseOfferDetail; }
23
25
 
24
26
  #include <string>
25
27
  #include <optional>
26
28
  #include "IapPlatform.hpp"
29
+ #include "NitroOneTimePurchaseOfferDetail.hpp"
27
30
 
28
31
  namespace margelo::nitro::iap {
29
32
 
@@ -44,6 +47,7 @@ namespace margelo::nitro::iap {
44
47
  std::optional<std::string> typeIOS SWIFT_PRIVATE;
45
48
  std::optional<bool> isFamilyShareableIOS SWIFT_PRIVATE;
46
49
  std::optional<std::string> jsonRepresentationIOS SWIFT_PRIVATE;
50
+ std::optional<std::string> discountsIOS SWIFT_PRIVATE;
47
51
  std::optional<std::string> introductoryPriceIOS SWIFT_PRIVATE;
48
52
  std::optional<double> introductoryPriceAsAmountIOS SWIFT_PRIVATE;
49
53
  std::optional<double> introductoryPriceNumberOfPeriodsIOS SWIFT_PRIVATE;
@@ -51,6 +55,7 @@ namespace margelo::nitro::iap {
51
55
  std::optional<std::string> introductoryPriceSubscriptionPeriodIOS SWIFT_PRIVATE;
52
56
  std::optional<double> subscriptionPeriodNumberIOS SWIFT_PRIVATE;
53
57
  std::optional<std::string> subscriptionPeriodUnitIOS SWIFT_PRIVATE;
58
+ std::optional<std::string> nameAndroid SWIFT_PRIVATE;
54
59
  std::optional<std::string> originalPriceAndroid SWIFT_PRIVATE;
55
60
  std::optional<double> originalPriceAmountMicrosAndroid SWIFT_PRIVATE;
56
61
  std::optional<double> introductoryPriceCyclesAndroid SWIFT_PRIVATE;
@@ -59,10 +64,11 @@ namespace margelo::nitro::iap {
59
64
  std::optional<std::string> subscriptionPeriodAndroid SWIFT_PRIVATE;
60
65
  std::optional<std::string> freeTrialPeriodAndroid SWIFT_PRIVATE;
61
66
  std::optional<std::string> subscriptionOfferDetailsAndroid SWIFT_PRIVATE;
67
+ std::optional<NitroOneTimePurchaseOfferDetail> oneTimePurchaseOfferDetailsAndroid SWIFT_PRIVATE;
62
68
 
63
69
  public:
64
70
  NitroProduct() = default;
65
- explicit NitroProduct(std::string id, std::string title, std::string description, std::string type, std::optional<std::string> displayName, std::optional<std::string> displayPrice, std::optional<std::string> currency, std::optional<double> price, IapPlatform platform, std::optional<std::string> typeIOS, std::optional<bool> isFamilyShareableIOS, std::optional<std::string> jsonRepresentationIOS, std::optional<std::string> introductoryPriceIOS, std::optional<double> introductoryPriceAsAmountIOS, std::optional<double> introductoryPriceNumberOfPeriodsIOS, std::optional<std::string> introductoryPricePaymentModeIOS, std::optional<std::string> introductoryPriceSubscriptionPeriodIOS, std::optional<double> subscriptionPeriodNumberIOS, std::optional<std::string> subscriptionPeriodUnitIOS, std::optional<std::string> originalPriceAndroid, std::optional<double> originalPriceAmountMicrosAndroid, std::optional<double> introductoryPriceCyclesAndroid, std::optional<std::string> introductoryPricePeriodAndroid, std::optional<double> introductoryPriceValueAndroid, std::optional<std::string> subscriptionPeriodAndroid, std::optional<std::string> freeTrialPeriodAndroid, std::optional<std::string> subscriptionOfferDetailsAndroid): id(id), title(title), description(description), type(type), displayName(displayName), displayPrice(displayPrice), currency(currency), price(price), platform(platform), typeIOS(typeIOS), isFamilyShareableIOS(isFamilyShareableIOS), jsonRepresentationIOS(jsonRepresentationIOS), introductoryPriceIOS(introductoryPriceIOS), introductoryPriceAsAmountIOS(introductoryPriceAsAmountIOS), introductoryPriceNumberOfPeriodsIOS(introductoryPriceNumberOfPeriodsIOS), introductoryPricePaymentModeIOS(introductoryPricePaymentModeIOS), introductoryPriceSubscriptionPeriodIOS(introductoryPriceSubscriptionPeriodIOS), subscriptionPeriodNumberIOS(subscriptionPeriodNumberIOS), subscriptionPeriodUnitIOS(subscriptionPeriodUnitIOS), originalPriceAndroid(originalPriceAndroid), originalPriceAmountMicrosAndroid(originalPriceAmountMicrosAndroid), introductoryPriceCyclesAndroid(introductoryPriceCyclesAndroid), introductoryPricePeriodAndroid(introductoryPricePeriodAndroid), introductoryPriceValueAndroid(introductoryPriceValueAndroid), subscriptionPeriodAndroid(subscriptionPeriodAndroid), freeTrialPeriodAndroid(freeTrialPeriodAndroid), subscriptionOfferDetailsAndroid(subscriptionOfferDetailsAndroid) {}
71
+ explicit NitroProduct(std::string id, std::string title, std::string description, std::string type, std::optional<std::string> displayName, std::optional<std::string> displayPrice, std::optional<std::string> currency, std::optional<double> price, IapPlatform platform, std::optional<std::string> typeIOS, std::optional<bool> isFamilyShareableIOS, std::optional<std::string> jsonRepresentationIOS, std::optional<std::string> discountsIOS, std::optional<std::string> introductoryPriceIOS, std::optional<double> introductoryPriceAsAmountIOS, std::optional<double> introductoryPriceNumberOfPeriodsIOS, std::optional<std::string> introductoryPricePaymentModeIOS, std::optional<std::string> introductoryPriceSubscriptionPeriodIOS, std::optional<double> subscriptionPeriodNumberIOS, std::optional<std::string> subscriptionPeriodUnitIOS, std::optional<std::string> nameAndroid, std::optional<std::string> originalPriceAndroid, std::optional<double> originalPriceAmountMicrosAndroid, std::optional<double> introductoryPriceCyclesAndroid, std::optional<std::string> introductoryPricePeriodAndroid, std::optional<double> introductoryPriceValueAndroid, std::optional<std::string> subscriptionPeriodAndroid, std::optional<std::string> freeTrialPeriodAndroid, std::optional<std::string> subscriptionOfferDetailsAndroid, std::optional<NitroOneTimePurchaseOfferDetail> oneTimePurchaseOfferDetailsAndroid): id(id), title(title), description(description), type(type), displayName(displayName), displayPrice(displayPrice), currency(currency), price(price), platform(platform), typeIOS(typeIOS), isFamilyShareableIOS(isFamilyShareableIOS), jsonRepresentationIOS(jsonRepresentationIOS), discountsIOS(discountsIOS), introductoryPriceIOS(introductoryPriceIOS), introductoryPriceAsAmountIOS(introductoryPriceAsAmountIOS), introductoryPriceNumberOfPeriodsIOS(introductoryPriceNumberOfPeriodsIOS), introductoryPricePaymentModeIOS(introductoryPricePaymentModeIOS), introductoryPriceSubscriptionPeriodIOS(introductoryPriceSubscriptionPeriodIOS), subscriptionPeriodNumberIOS(subscriptionPeriodNumberIOS), subscriptionPeriodUnitIOS(subscriptionPeriodUnitIOS), nameAndroid(nameAndroid), originalPriceAndroid(originalPriceAndroid), originalPriceAmountMicrosAndroid(originalPriceAmountMicrosAndroid), introductoryPriceCyclesAndroid(introductoryPriceCyclesAndroid), introductoryPricePeriodAndroid(introductoryPricePeriodAndroid), introductoryPriceValueAndroid(introductoryPriceValueAndroid), subscriptionPeriodAndroid(subscriptionPeriodAndroid), freeTrialPeriodAndroid(freeTrialPeriodAndroid), subscriptionOfferDetailsAndroid(subscriptionOfferDetailsAndroid), oneTimePurchaseOfferDetailsAndroid(oneTimePurchaseOfferDetailsAndroid) {}
66
72
  };
67
73
 
68
74
  } // namespace margelo::nitro::iap
@@ -87,6 +93,7 @@ namespace margelo::nitro {
87
93
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "typeIOS")),
88
94
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "isFamilyShareableIOS")),
89
95
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "jsonRepresentationIOS")),
96
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "discountsIOS")),
90
97
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceIOS")),
91
98
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceAsAmountIOS")),
92
99
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceNumberOfPeriodsIOS")),
@@ -94,6 +101,7 @@ namespace margelo::nitro {
94
101
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceSubscriptionPeriodIOS")),
95
102
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionPeriodNumberIOS")),
96
103
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionPeriodUnitIOS")),
104
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "nameAndroid")),
97
105
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "originalPriceAndroid")),
98
106
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "originalPriceAmountMicrosAndroid")),
99
107
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceCyclesAndroid")),
@@ -101,7 +109,8 @@ namespace margelo::nitro {
101
109
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceValueAndroid")),
102
110
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionPeriodAndroid")),
103
111
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "freeTrialPeriodAndroid")),
104
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionOfferDetailsAndroid"))
112
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionOfferDetailsAndroid")),
113
+ JSIConverter<std::optional<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail>>::fromJSI(runtime, obj.getProperty(runtime, "oneTimePurchaseOfferDetailsAndroid"))
105
114
  );
106
115
  }
107
116
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroProduct& arg) {
@@ -118,6 +127,7 @@ namespace margelo::nitro {
118
127
  obj.setProperty(runtime, "typeIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.typeIOS));
119
128
  obj.setProperty(runtime, "isFamilyShareableIOS", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isFamilyShareableIOS));
120
129
  obj.setProperty(runtime, "jsonRepresentationIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.jsonRepresentationIOS));
130
+ obj.setProperty(runtime, "discountsIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.discountsIOS));
121
131
  obj.setProperty(runtime, "introductoryPriceIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.introductoryPriceIOS));
122
132
  obj.setProperty(runtime, "introductoryPriceAsAmountIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.introductoryPriceAsAmountIOS));
123
133
  obj.setProperty(runtime, "introductoryPriceNumberOfPeriodsIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.introductoryPriceNumberOfPeriodsIOS));
@@ -125,6 +135,7 @@ namespace margelo::nitro {
125
135
  obj.setProperty(runtime, "introductoryPriceSubscriptionPeriodIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.introductoryPriceSubscriptionPeriodIOS));
126
136
  obj.setProperty(runtime, "subscriptionPeriodNumberIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.subscriptionPeriodNumberIOS));
127
137
  obj.setProperty(runtime, "subscriptionPeriodUnitIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionPeriodUnitIOS));
138
+ obj.setProperty(runtime, "nameAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.nameAndroid));
128
139
  obj.setProperty(runtime, "originalPriceAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.originalPriceAndroid));
129
140
  obj.setProperty(runtime, "originalPriceAmountMicrosAndroid", JSIConverter<std::optional<double>>::toJSI(runtime, arg.originalPriceAmountMicrosAndroid));
130
141
  obj.setProperty(runtime, "introductoryPriceCyclesAndroid", JSIConverter<std::optional<double>>::toJSI(runtime, arg.introductoryPriceCyclesAndroid));
@@ -133,6 +144,7 @@ namespace margelo::nitro {
133
144
  obj.setProperty(runtime, "subscriptionPeriodAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionPeriodAndroid));
134
145
  obj.setProperty(runtime, "freeTrialPeriodAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.freeTrialPeriodAndroid));
135
146
  obj.setProperty(runtime, "subscriptionOfferDetailsAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionOfferDetailsAndroid));
147
+ obj.setProperty(runtime, "oneTimePurchaseOfferDetailsAndroid", JSIConverter<std::optional<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail>>::toJSI(runtime, arg.oneTimePurchaseOfferDetailsAndroid));
136
148
  return obj;
137
149
  }
138
150
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -152,6 +164,7 @@ namespace margelo::nitro {
152
164
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "typeIOS"))) return false;
153
165
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "isFamilyShareableIOS"))) return false;
154
166
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "jsonRepresentationIOS"))) return false;
167
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "discountsIOS"))) return false;
155
168
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceIOS"))) return false;
156
169
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceAsAmountIOS"))) return false;
157
170
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceNumberOfPeriodsIOS"))) return false;
@@ -159,6 +172,7 @@ namespace margelo::nitro {
159
172
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceSubscriptionPeriodIOS"))) return false;
160
173
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionPeriodNumberIOS"))) return false;
161
174
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionPeriodUnitIOS"))) return false;
175
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "nameAndroid"))) return false;
162
176
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "originalPriceAndroid"))) return false;
163
177
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "originalPriceAmountMicrosAndroid"))) return false;
164
178
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceCyclesAndroid"))) return false;
@@ -167,6 +181,7 @@ namespace margelo::nitro {
167
181
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionPeriodAndroid"))) return false;
168
182
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "freeTrialPeriodAndroid"))) return false;
169
183
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionOfferDetailsAndroid"))) return false;
184
+ if (!JSIConverter<std::optional<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail>>::canConvert(runtime, obj.getProperty(runtime, "oneTimePurchaseOfferDetailsAndroid"))) return false;
170
185
  return true;
171
186
  }
172
187
  };
@@ -47,6 +47,23 @@ namespace margelo::nitro::iap {
47
47
  std::optional<double> originalTransactionDateIOS SWIFT_PRIVATE;
48
48
  std::optional<std::string> originalTransactionIdentifierIOS SWIFT_PRIVATE;
49
49
  std::optional<std::string> appAccountToken SWIFT_PRIVATE;
50
+ std::optional<std::string> appBundleIdIOS SWIFT_PRIVATE;
51
+ std::optional<std::string> countryCodeIOS SWIFT_PRIVATE;
52
+ std::optional<std::string> currencyCodeIOS SWIFT_PRIVATE;
53
+ std::optional<std::string> currencySymbolIOS SWIFT_PRIVATE;
54
+ std::optional<std::string> environmentIOS SWIFT_PRIVATE;
55
+ std::optional<double> expirationDateIOS SWIFT_PRIVATE;
56
+ std::optional<bool> isUpgradedIOS SWIFT_PRIVATE;
57
+ std::optional<std::string> offerIOS SWIFT_PRIVATE;
58
+ std::optional<std::string> ownershipTypeIOS SWIFT_PRIVATE;
59
+ std::optional<std::string> reasonIOS SWIFT_PRIVATE;
60
+ std::optional<std::string> reasonStringRepresentationIOS SWIFT_PRIVATE;
61
+ std::optional<double> revocationDateIOS SWIFT_PRIVATE;
62
+ std::optional<std::string> revocationReasonIOS SWIFT_PRIVATE;
63
+ std::optional<std::string> storefrontCountryCodeIOS SWIFT_PRIVATE;
64
+ std::optional<std::string> subscriptionGroupIdIOS SWIFT_PRIVATE;
65
+ std::optional<std::string> transactionReasonIOS SWIFT_PRIVATE;
66
+ std::optional<std::string> webOrderLineItemIdIOS SWIFT_PRIVATE;
50
67
  std::optional<std::string> purchaseTokenAndroid SWIFT_PRIVATE;
51
68
  std::optional<std::string> dataAndroid SWIFT_PRIVATE;
52
69
  std::optional<std::string> signatureAndroid SWIFT_PRIVATE;
@@ -56,10 +73,11 @@ namespace margelo::nitro::iap {
56
73
  std::optional<std::string> packageNameAndroid SWIFT_PRIVATE;
57
74
  std::optional<std::string> obfuscatedAccountIdAndroid SWIFT_PRIVATE;
58
75
  std::optional<std::string> obfuscatedProfileIdAndroid SWIFT_PRIVATE;
76
+ std::optional<std::string> developerPayloadAndroid SWIFT_PRIVATE;
59
77
 
60
78
  public:
61
79
  NitroPurchase() = default;
62
- explicit NitroPurchase(std::string id, std::string productId, double transactionDate, std::optional<std::string> purchaseToken, IapPlatform platform, double quantity, PurchaseState purchaseState, bool isAutoRenewing, std::optional<double> quantityIOS, std::optional<double> originalTransactionDateIOS, std::optional<std::string> originalTransactionIdentifierIOS, std::optional<std::string> appAccountToken, std::optional<std::string> purchaseTokenAndroid, std::optional<std::string> dataAndroid, std::optional<std::string> signatureAndroid, std::optional<bool> autoRenewingAndroid, std::optional<double> purchaseStateAndroid, std::optional<bool> isAcknowledgedAndroid, std::optional<std::string> packageNameAndroid, std::optional<std::string> obfuscatedAccountIdAndroid, std::optional<std::string> obfuscatedProfileIdAndroid): id(id), productId(productId), transactionDate(transactionDate), purchaseToken(purchaseToken), platform(platform), quantity(quantity), purchaseState(purchaseState), isAutoRenewing(isAutoRenewing), quantityIOS(quantityIOS), originalTransactionDateIOS(originalTransactionDateIOS), originalTransactionIdentifierIOS(originalTransactionIdentifierIOS), appAccountToken(appAccountToken), purchaseTokenAndroid(purchaseTokenAndroid), dataAndroid(dataAndroid), signatureAndroid(signatureAndroid), autoRenewingAndroid(autoRenewingAndroid), purchaseStateAndroid(purchaseStateAndroid), isAcknowledgedAndroid(isAcknowledgedAndroid), packageNameAndroid(packageNameAndroid), obfuscatedAccountIdAndroid(obfuscatedAccountIdAndroid), obfuscatedProfileIdAndroid(obfuscatedProfileIdAndroid) {}
80
+ explicit NitroPurchase(std::string id, std::string productId, double transactionDate, std::optional<std::string> purchaseToken, IapPlatform platform, double quantity, PurchaseState purchaseState, bool isAutoRenewing, std::optional<double> quantityIOS, std::optional<double> originalTransactionDateIOS, std::optional<std::string> originalTransactionIdentifierIOS, std::optional<std::string> appAccountToken, std::optional<std::string> appBundleIdIOS, std::optional<std::string> countryCodeIOS, std::optional<std::string> currencyCodeIOS, std::optional<std::string> currencySymbolIOS, std::optional<std::string> environmentIOS, std::optional<double> expirationDateIOS, std::optional<bool> isUpgradedIOS, std::optional<std::string> offerIOS, std::optional<std::string> ownershipTypeIOS, std::optional<std::string> reasonIOS, std::optional<std::string> reasonStringRepresentationIOS, std::optional<double> revocationDateIOS, std::optional<std::string> revocationReasonIOS, std::optional<std::string> storefrontCountryCodeIOS, std::optional<std::string> subscriptionGroupIdIOS, std::optional<std::string> transactionReasonIOS, std::optional<std::string> webOrderLineItemIdIOS, std::optional<std::string> purchaseTokenAndroid, std::optional<std::string> dataAndroid, std::optional<std::string> signatureAndroid, std::optional<bool> autoRenewingAndroid, std::optional<double> purchaseStateAndroid, std::optional<bool> isAcknowledgedAndroid, std::optional<std::string> packageNameAndroid, std::optional<std::string> obfuscatedAccountIdAndroid, std::optional<std::string> obfuscatedProfileIdAndroid, std::optional<std::string> developerPayloadAndroid): id(id), productId(productId), transactionDate(transactionDate), purchaseToken(purchaseToken), platform(platform), quantity(quantity), purchaseState(purchaseState), isAutoRenewing(isAutoRenewing), quantityIOS(quantityIOS), originalTransactionDateIOS(originalTransactionDateIOS), originalTransactionIdentifierIOS(originalTransactionIdentifierIOS), appAccountToken(appAccountToken), appBundleIdIOS(appBundleIdIOS), countryCodeIOS(countryCodeIOS), currencyCodeIOS(currencyCodeIOS), currencySymbolIOS(currencySymbolIOS), environmentIOS(environmentIOS), expirationDateIOS(expirationDateIOS), isUpgradedIOS(isUpgradedIOS), offerIOS(offerIOS), ownershipTypeIOS(ownershipTypeIOS), reasonIOS(reasonIOS), reasonStringRepresentationIOS(reasonStringRepresentationIOS), revocationDateIOS(revocationDateIOS), revocationReasonIOS(revocationReasonIOS), storefrontCountryCodeIOS(storefrontCountryCodeIOS), subscriptionGroupIdIOS(subscriptionGroupIdIOS), transactionReasonIOS(transactionReasonIOS), webOrderLineItemIdIOS(webOrderLineItemIdIOS), purchaseTokenAndroid(purchaseTokenAndroid), dataAndroid(dataAndroid), signatureAndroid(signatureAndroid), autoRenewingAndroid(autoRenewingAndroid), purchaseStateAndroid(purchaseStateAndroid), isAcknowledgedAndroid(isAcknowledgedAndroid), packageNameAndroid(packageNameAndroid), obfuscatedAccountIdAndroid(obfuscatedAccountIdAndroid), obfuscatedProfileIdAndroid(obfuscatedProfileIdAndroid), developerPayloadAndroid(developerPayloadAndroid) {}
63
81
  };
64
82
 
65
83
  } // namespace margelo::nitro::iap
@@ -84,6 +102,23 @@ namespace margelo::nitro {
84
102
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "originalTransactionDateIOS")),
85
103
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "originalTransactionIdentifierIOS")),
86
104
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "appAccountToken")),
105
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "appBundleIdIOS")),
106
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "countryCodeIOS")),
107
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "currencyCodeIOS")),
108
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "currencySymbolIOS")),
109
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "environmentIOS")),
110
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "expirationDateIOS")),
111
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "isUpgradedIOS")),
112
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "offerIOS")),
113
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "ownershipTypeIOS")),
114
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "reasonIOS")),
115
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "reasonStringRepresentationIOS")),
116
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "revocationDateIOS")),
117
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "revocationReasonIOS")),
118
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "storefrontCountryCodeIOS")),
119
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionGroupIdIOS")),
120
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "transactionReasonIOS")),
121
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "webOrderLineItemIdIOS")),
87
122
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "purchaseTokenAndroid")),
88
123
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "dataAndroid")),
89
124
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "signatureAndroid")),
@@ -92,7 +127,8 @@ namespace margelo::nitro {
92
127
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "isAcknowledgedAndroid")),
93
128
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "packageNameAndroid")),
94
129
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "obfuscatedAccountIdAndroid")),
95
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "obfuscatedProfileIdAndroid"))
130
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "obfuscatedProfileIdAndroid")),
131
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "developerPayloadAndroid"))
96
132
  );
97
133
  }
98
134
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroPurchase& arg) {
@@ -109,6 +145,23 @@ namespace margelo::nitro {
109
145
  obj.setProperty(runtime, "originalTransactionDateIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.originalTransactionDateIOS));
110
146
  obj.setProperty(runtime, "originalTransactionIdentifierIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.originalTransactionIdentifierIOS));
111
147
  obj.setProperty(runtime, "appAccountToken", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.appAccountToken));
148
+ obj.setProperty(runtime, "appBundleIdIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.appBundleIdIOS));
149
+ obj.setProperty(runtime, "countryCodeIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.countryCodeIOS));
150
+ obj.setProperty(runtime, "currencyCodeIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currencyCodeIOS));
151
+ obj.setProperty(runtime, "currencySymbolIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currencySymbolIOS));
152
+ obj.setProperty(runtime, "environmentIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.environmentIOS));
153
+ obj.setProperty(runtime, "expirationDateIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.expirationDateIOS));
154
+ obj.setProperty(runtime, "isUpgradedIOS", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isUpgradedIOS));
155
+ obj.setProperty(runtime, "offerIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.offerIOS));
156
+ obj.setProperty(runtime, "ownershipTypeIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.ownershipTypeIOS));
157
+ obj.setProperty(runtime, "reasonIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.reasonIOS));
158
+ obj.setProperty(runtime, "reasonStringRepresentationIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.reasonStringRepresentationIOS));
159
+ obj.setProperty(runtime, "revocationDateIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.revocationDateIOS));
160
+ obj.setProperty(runtime, "revocationReasonIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.revocationReasonIOS));
161
+ obj.setProperty(runtime, "storefrontCountryCodeIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.storefrontCountryCodeIOS));
162
+ obj.setProperty(runtime, "subscriptionGroupIdIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionGroupIdIOS));
163
+ obj.setProperty(runtime, "transactionReasonIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.transactionReasonIOS));
164
+ obj.setProperty(runtime, "webOrderLineItemIdIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.webOrderLineItemIdIOS));
112
165
  obj.setProperty(runtime, "purchaseTokenAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.purchaseTokenAndroid));
113
166
  obj.setProperty(runtime, "dataAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.dataAndroid));
114
167
  obj.setProperty(runtime, "signatureAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.signatureAndroid));
@@ -118,6 +171,7 @@ namespace margelo::nitro {
118
171
  obj.setProperty(runtime, "packageNameAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.packageNameAndroid));
119
172
  obj.setProperty(runtime, "obfuscatedAccountIdAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.obfuscatedAccountIdAndroid));
120
173
  obj.setProperty(runtime, "obfuscatedProfileIdAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.obfuscatedProfileIdAndroid));
174
+ obj.setProperty(runtime, "developerPayloadAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.developerPayloadAndroid));
121
175
  return obj;
122
176
  }
123
177
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -137,6 +191,23 @@ namespace margelo::nitro {
137
191
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "originalTransactionDateIOS"))) return false;
138
192
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "originalTransactionIdentifierIOS"))) return false;
139
193
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "appAccountToken"))) return false;
194
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "appBundleIdIOS"))) return false;
195
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "countryCodeIOS"))) return false;
196
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "currencyCodeIOS"))) return false;
197
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "currencySymbolIOS"))) return false;
198
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "environmentIOS"))) return false;
199
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "expirationDateIOS"))) return false;
200
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "isUpgradedIOS"))) return false;
201
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "offerIOS"))) return false;
202
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "ownershipTypeIOS"))) return false;
203
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "reasonIOS"))) return false;
204
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "reasonStringRepresentationIOS"))) return false;
205
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "revocationDateIOS"))) return false;
206
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "revocationReasonIOS"))) return false;
207
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "storefrontCountryCodeIOS"))) return false;
208
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionGroupIdIOS"))) return false;
209
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "transactionReasonIOS"))) return false;
210
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "webOrderLineItemIdIOS"))) return false;
140
211
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "purchaseTokenAndroid"))) return false;
141
212
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "dataAndroid"))) return false;
142
213
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "signatureAndroid"))) return false;
@@ -146,6 +217,7 @@ namespace margelo::nitro {
146
217
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "packageNameAndroid"))) return false;
147
218
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "obfuscatedAccountIdAndroid"))) return false;
148
219
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "obfuscatedProfileIdAndroid"))) return false;
220
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "developerPayloadAndroid"))) return false;
149
221
  return true;
150
222
  }
151
223
  };
@@ -1,5 +1,5 @@
1
1
  {
2
- "apple": "1.2.4",
2
+ "apple": "1.2.6",
3
3
  "google": "1.2.10",
4
4
  "gql": "1.0.9"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "14.4.9",
3
+ "version": "14.4.11",
4
4
  "description": "React Native In-App Purchases module for iOS and Android using Nitro",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -52,7 +52,7 @@
52
52
  "clean": "rm -rf android/build node_modules/**/android/build lib nitrogen/generated",
53
53
  "lint": "eslint --ext .ts,.tsx,.js,.jsx src",
54
54
  "lint:eslint": "eslint --fix 'src/**/*.{ts,tsx}' 'plugin/src/**/*.{ts,tsx}'",
55
- "lint:prettier": "prettier --write \"**/*.{md,js,jsx,ts,tsx}\"",
55
+ "lint:prettier": "prettier --write \"**/*.{md,js,jsx,ts,tsx}\" \"!example-expo/**\"",
56
56
  "lint:tsc": "tsc -p tsconfig.json --noEmit --skipLibCheck",
57
57
  "lint:ci": "yarn lint:tsc && yarn lint:eslint && yarn lint:prettier",
58
58
  "prepare": "npx tsx scripts/check-nitro-versions.ts && bob build && yarn nitrogen && yarn build:plugin",
@@ -163,8 +163,8 @@
163
163
  "eslint --fix",
164
164
  "prettier --write"
165
165
  ],
166
- "*.{json,md}": [
167
- "node -p \"process.argv.slice(2).filter(f => { try { return !require('fs').lstatSync(f).isSymbolicLink(); } catch { return false; } }).join(' ')\" | xargs prettier --write"
166
+ "**/*.{json,md}": [
167
+ "prettier --write"
168
168
  ]
169
169
  },
170
170
  "packageManager": "yarn@3.6.1"
@@ -179,6 +179,15 @@ export interface NitroReceiptValidationResultAndroid {
179
179
  testTransaction: ReceiptValidationResultAndroid['testTransaction'];
180
180
  }
181
181
 
182
+ /**
183
+ * Android one-time purchase offer details
184
+ */
185
+ export interface NitroOneTimePurchaseOfferDetail {
186
+ formattedPrice: string;
187
+ priceAmountMicros: string;
188
+ priceCurrencyCode: string;
189
+ }
190
+
182
191
  export interface NitroPurchase {
183
192
  id: PurchaseCommon['id'];
184
193
  productId: PurchaseCommon['productId'];
@@ -188,10 +197,29 @@ export interface NitroPurchase {
188
197
  quantity: PurchaseCommon['quantity'];
189
198
  purchaseState: PurchaseCommon['purchaseState'];
190
199
  isAutoRenewing: PurchaseCommon['isAutoRenewing'];
200
+ // iOS specific fields
191
201
  quantityIOS?: number | null;
192
202
  originalTransactionDateIOS?: number | null;
193
203
  originalTransactionIdentifierIOS?: string | null;
194
204
  appAccountToken?: string | null;
205
+ appBundleIdIOS?: string | null;
206
+ countryCodeIOS?: string | null;
207
+ currencyCodeIOS?: string | null;
208
+ currencySymbolIOS?: string | null;
209
+ environmentIOS?: string | null;
210
+ expirationDateIOS?: number | null;
211
+ isUpgradedIOS?: boolean | null;
212
+ offerIOS?: string | null;
213
+ ownershipTypeIOS?: string | null;
214
+ reasonIOS?: string | null;
215
+ reasonStringRepresentationIOS?: string | null;
216
+ revocationDateIOS?: number | null;
217
+ revocationReasonIOS?: string | null;
218
+ storefrontCountryCodeIOS?: string | null;
219
+ subscriptionGroupIdIOS?: string | null;
220
+ transactionReasonIOS?: string | null;
221
+ webOrderLineItemIdIOS?: string | null;
222
+ // Android specific fields
195
223
  purchaseTokenAndroid?: string | null;
196
224
  dataAndroid?: string | null;
197
225
  signatureAndroid?: string | null;
@@ -201,6 +229,7 @@ export interface NitroPurchase {
201
229
  packageNameAndroid?: string | null;
202
230
  obfuscatedAccountIdAndroid?: string | null;
203
231
  obfuscatedProfileIdAndroid?: string | null;
232
+ developerPayloadAndroid?: string | null;
204
233
  }
205
234
 
206
235
  export interface NitroProduct {
@@ -217,6 +246,7 @@ export interface NitroProduct {
217
246
  typeIOS?: string | null;
218
247
  isFamilyShareableIOS?: boolean | null;
219
248
  jsonRepresentationIOS?: string | null;
249
+ discountsIOS?: string | null;
220
250
  introductoryPriceIOS?: string | null;
221
251
  introductoryPriceAsAmountIOS?: number | null;
222
252
  introductoryPriceNumberOfPeriodsIOS?: number | null;
@@ -225,6 +255,7 @@ export interface NitroProduct {
225
255
  subscriptionPeriodNumberIOS?: number | null;
226
256
  subscriptionPeriodUnitIOS?: string | null;
227
257
  // Android specific fields
258
+ nameAndroid?: string | null;
228
259
  originalPriceAndroid?: string | null;
229
260
  originalPriceAmountMicrosAndroid?: number | null;
230
261
  introductoryPriceCyclesAndroid?: number | null;
@@ -233,6 +264,7 @@ export interface NitroProduct {
233
264
  subscriptionPeriodAndroid?: string | null;
234
265
  freeTrialPeriodAndroid?: string | null;
235
266
  subscriptionOfferDetailsAndroid?: string | null;
267
+ oneTimePurchaseOfferDetailsAndroid?: NitroOneTimePurchaseOfferDetail | null;
236
268
  }
237
269
 
238
270
  // ╔══════════════════════════════════════════════════════════════════════════╗
@@ -220,48 +220,57 @@ export function convertNitroProductToProduct(
220
220
  const iosProduct: any = {
221
221
  ...base,
222
222
  displayNameIOS: nitroProduct.displayName ?? nitroProduct.title,
223
- isFamilyShareableIOS: Boolean(
224
- (nitroProduct as any).isFamilyShareableIOS ?? false,
225
- ),
223
+ isFamilyShareableIOS: Boolean(nitroProduct.isFamilyShareableIOS ?? false),
226
224
  jsonRepresentationIOS:
227
- (nitroProduct as any).jsonRepresentationIOS ?? DEFAULT_JSON_REPR,
228
- typeIOS: normalizeProductTypeIOS((nitroProduct as any).typeIOS),
225
+ nitroProduct.jsonRepresentationIOS ?? DEFAULT_JSON_REPR,
226
+ typeIOS: normalizeProductTypeIOS(nitroProduct.typeIOS),
229
227
  subscriptionInfoIOS: undefined,
230
228
  };
231
229
 
232
230
  iosProduct.introductoryPriceAsAmountIOS = toNullableString(
233
- (nitroProduct as any).introductoryPriceAsAmountIOS,
231
+ nitroProduct.introductoryPriceAsAmountIOS,
234
232
  );
235
233
  iosProduct.introductoryPriceIOS = toNullableString(
236
- (nitroProduct as any).introductoryPriceIOS,
234
+ nitroProduct.introductoryPriceIOS,
237
235
  );
238
236
  iosProduct.introductoryPriceNumberOfPeriodsIOS = toNullableString(
239
- (nitroProduct as any).introductoryPriceNumberOfPeriodsIOS,
237
+ nitroProduct.introductoryPriceNumberOfPeriodsIOS,
240
238
  );
241
239
  iosProduct.introductoryPricePaymentModeIOS = normalizePaymentMode(
242
- (nitroProduct as any).introductoryPricePaymentModeIOS,
240
+ nitroProduct.introductoryPricePaymentModeIOS,
243
241
  );
244
242
  iosProduct.introductoryPriceSubscriptionPeriodIOS =
245
243
  normalizeSubscriptionPeriod(
246
- (nitroProduct as any).introductoryPriceSubscriptionPeriodIOS,
244
+ nitroProduct.introductoryPriceSubscriptionPeriodIOS,
247
245
  );
248
246
  iosProduct.subscriptionPeriodNumberIOS = toNullableString(
249
- (nitroProduct as any).subscriptionPeriodNumberIOS,
247
+ nitroProduct.subscriptionPeriodNumberIOS,
250
248
  );
251
249
  iosProduct.subscriptionPeriodUnitIOS = normalizeSubscriptionPeriod(
252
- (nitroProduct as any).subscriptionPeriodUnitIOS,
250
+ nitroProduct.subscriptionPeriodUnitIOS,
253
251
  );
254
252
 
253
+ // Parse discountsIOS from JSON string if present
254
+ if (nitroProduct.discountsIOS) {
255
+ try {
256
+ iosProduct.discountsIOS = JSON.parse(nitroProduct.discountsIOS);
257
+ } catch {
258
+ iosProduct.discountsIOS = null;
259
+ }
260
+ } else {
261
+ iosProduct.discountsIOS = null;
262
+ }
263
+
255
264
  return iosProduct as Product;
256
265
  }
257
266
 
258
267
  const androidProduct: any = {
259
268
  ...base,
260
- nameAndroid: (nitroProduct as any).nameAndroid ?? nitroProduct.title,
261
- oneTimePurchaseOfferDetailsAndroid: (nitroProduct as any)
262
- .oneTimePurchaseOfferDetailsAndroid,
269
+ nameAndroid: nitroProduct.nameAndroid ?? nitroProduct.title,
270
+ oneTimePurchaseOfferDetailsAndroid:
271
+ nitroProduct.oneTimePurchaseOfferDetailsAndroid ?? null,
263
272
  subscriptionOfferDetailsAndroid: parseSubscriptionOffers(
264
- (nitroProduct as any).subscriptionOfferDetailsAndroid,
273
+ nitroProduct.subscriptionOfferDetailsAndroid,
265
274
  ),
266
275
  };
267
276
 
@@ -340,6 +349,54 @@ export function convertNitroPurchaseToPurchase(
340
349
  iosPurchase.appAccountToken = toNullableString(
341
350
  nitroPurchase.appAccountToken,
342
351
  );
352
+ iosPurchase.appBundleIdIOS = toNullableString(nitroPurchase.appBundleIdIOS);
353
+ iosPurchase.countryCodeIOS = toNullableString(nitroPurchase.countryCodeIOS);
354
+ iosPurchase.currencyCodeIOS = toNullableString(
355
+ nitroPurchase.currencyCodeIOS,
356
+ );
357
+ iosPurchase.currencySymbolIOS = toNullableString(
358
+ nitroPurchase.currencySymbolIOS,
359
+ );
360
+ iosPurchase.environmentIOS = toNullableString(nitroPurchase.environmentIOS);
361
+ iosPurchase.expirationDateIOS = toNullableNumber(
362
+ nitroPurchase.expirationDateIOS,
363
+ );
364
+ iosPurchase.isUpgradedIOS = toNullableBoolean(nitroPurchase.isUpgradedIOS);
365
+ // Parse offerIOS from JSON string if present
366
+ if (nitroPurchase.offerIOS) {
367
+ try {
368
+ iosPurchase.offerIOS = JSON.parse(nitroPurchase.offerIOS);
369
+ } catch {
370
+ iosPurchase.offerIOS = null;
371
+ }
372
+ } else {
373
+ iosPurchase.offerIOS = null;
374
+ }
375
+ iosPurchase.ownershipTypeIOS = toNullableString(
376
+ nitroPurchase.ownershipTypeIOS,
377
+ );
378
+ iosPurchase.reasonIOS = toNullableString(nitroPurchase.reasonIOS);
379
+ iosPurchase.reasonStringRepresentationIOS = toNullableString(
380
+ nitroPurchase.reasonStringRepresentationIOS,
381
+ );
382
+ iosPurchase.revocationDateIOS = toNullableNumber(
383
+ nitroPurchase.revocationDateIOS,
384
+ );
385
+ iosPurchase.revocationReasonIOS = toNullableString(
386
+ nitroPurchase.revocationReasonIOS,
387
+ );
388
+ iosPurchase.storefrontCountryCodeIOS = toNullableString(
389
+ nitroPurchase.storefrontCountryCodeIOS,
390
+ );
391
+ iosPurchase.subscriptionGroupIdIOS = toNullableString(
392
+ nitroPurchase.subscriptionGroupIdIOS,
393
+ );
394
+ iosPurchase.transactionReasonIOS = toNullableString(
395
+ nitroPurchase.transactionReasonIOS,
396
+ );
397
+ iosPurchase.webOrderLineItemIdIOS = toNullableString(
398
+ nitroPurchase.webOrderLineItemIdIOS,
399
+ );
343
400
  return iosPurchase as Purchase;
344
401
  }
345
402
 
@@ -363,6 +420,9 @@ export function convertNitroPurchaseToPurchase(
363
420
  androidPurchase.obfuscatedProfileIdAndroid = toNullableString(
364
421
  nitroPurchase.obfuscatedProfileIdAndroid,
365
422
  );
423
+ androidPurchase.developerPayloadAndroid = toNullableString(
424
+ nitroPurchase.developerPayloadAndroid,
425
+ );
366
426
 
367
427
  return androidPurchase as Purchase;
368
428
  }