@qonversion/react-native-sdk 10.0.0-RC1

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 (290) hide show
  1. package/README.md +129 -0
  2. package/android/build.gradle +92 -0
  3. package/android/gradle.properties +6 -0
  4. package/android/src/main/AndroidManifest.xml +2 -0
  5. package/android/src/main/java/com/qonversion/reactnativesdk/EntitiesConverter.kt +135 -0
  6. package/android/src/main/java/com/qonversion/reactnativesdk/NoCodesModule.kt +76 -0
  7. package/android/src/main/java/com/qonversion/reactnativesdk/QonversionModule.kt +278 -0
  8. package/android/src/main/java/com/qonversion/reactnativesdk/QonversionPackage.kt +43 -0
  9. package/android/src/main/java/com/qonversion/reactnativesdk/Utils.kt +32 -0
  10. package/ios/RNNoCodes.h +5 -0
  11. package/ios/RNNoCodes.mm +61 -0
  12. package/ios/RNNoCodesImpl.swift +69 -0
  13. package/ios/RNQonversion.h +5 -0
  14. package/ios/RNQonversion.mm +189 -0
  15. package/ios/RNQonversionImpl.swift +250 -0
  16. package/ios/qonversion-react-native-sdk-Bridging-Header.h +6 -0
  17. package/lib/module/NoCodes.js +32 -0
  18. package/lib/module/NoCodes.js.map +1 -0
  19. package/lib/module/NoCodesApi.js +2 -0
  20. package/lib/module/NoCodesApi.js.map +1 -0
  21. package/lib/module/NoCodesConfig.js +10 -0
  22. package/lib/module/NoCodesConfig.js.map +1 -0
  23. package/lib/module/NoCodesConfigBuilder.js +35 -0
  24. package/lib/module/NoCodesConfigBuilder.js.map +1 -0
  25. package/lib/module/Qonversion.js +35 -0
  26. package/lib/module/Qonversion.js.map +1 -0
  27. package/lib/module/QonversionApi.js +4 -0
  28. package/lib/module/QonversionApi.js.map +1 -0
  29. package/lib/module/QonversionConfig.js +16 -0
  30. package/lib/module/QonversionConfig.js.map +1 -0
  31. package/lib/module/QonversionConfigBuilder.js +90 -0
  32. package/lib/module/QonversionConfigBuilder.js.map +1 -0
  33. package/lib/module/dto/Entitlement.js +24 -0
  34. package/lib/module/dto/Entitlement.js.map +1 -0
  35. package/lib/module/dto/EntitlementsUpdateListener.js +4 -0
  36. package/lib/module/dto/EntitlementsUpdateListener.js.map +1 -0
  37. package/lib/module/dto/Experiment.js +11 -0
  38. package/lib/module/dto/Experiment.js.map +1 -0
  39. package/lib/module/dto/ExperimentGroup.js +11 -0
  40. package/lib/module/dto/ExperimentGroup.js.map +1 -0
  41. package/lib/module/dto/IntroEligibility.js +9 -0
  42. package/lib/module/dto/IntroEligibility.js.map +1 -0
  43. package/lib/module/dto/NoCodesAction.js +11 -0
  44. package/lib/module/dto/NoCodesAction.js.map +1 -0
  45. package/lib/module/dto/NoCodesError.js +13 -0
  46. package/lib/module/dto/NoCodesError.js.map +1 -0
  47. package/lib/module/dto/NoCodesListener.js +4 -0
  48. package/lib/module/dto/NoCodesListener.js.map +1 -0
  49. package/lib/module/dto/Offering.js +14 -0
  50. package/lib/module/dto/Offering.js.map +1 -0
  51. package/lib/module/dto/Offerings.js +13 -0
  52. package/lib/module/dto/Offerings.js.map +1 -0
  53. package/lib/module/dto/Product.js +114 -0
  54. package/lib/module/dto/Product.js.map +1 -0
  55. package/lib/module/dto/PromoPurchasesListener.js +4 -0
  56. package/lib/module/dto/PromoPurchasesListener.js.map +1 -0
  57. package/lib/module/dto/PromotionalOffer.js +10 -0
  58. package/lib/module/dto/PromotionalOffer.js.map +1 -0
  59. package/lib/module/dto/PurchaseModel.js +26 -0
  60. package/lib/module/dto/PurchaseModel.js.map +1 -0
  61. package/lib/module/dto/PurchaseOptions.js +15 -0
  62. package/lib/module/dto/PurchaseOptions.js.map +1 -0
  63. package/lib/module/dto/PurchaseOptionsBuilder.js +117 -0
  64. package/lib/module/dto/PurchaseOptionsBuilder.js.map +1 -0
  65. package/lib/module/dto/PurchaseUpdateModel.js +32 -0
  66. package/lib/module/dto/PurchaseUpdateModel.js.map +1 -0
  67. package/lib/module/dto/QonversionError.js +15 -0
  68. package/lib/module/dto/QonversionError.js.map +1 -0
  69. package/lib/module/dto/RemoteConfig.js +11 -0
  70. package/lib/module/dto/RemoteConfig.js.map +1 -0
  71. package/lib/module/dto/RemoteConfigList.js +18 -0
  72. package/lib/module/dto/RemoteConfigList.js.map +1 -0
  73. package/lib/module/dto/RemoteConfigurationSource.js +13 -0
  74. package/lib/module/dto/RemoteConfigurationSource.js.map +1 -0
  75. package/lib/module/dto/ScreenPresentationConfig.js +22 -0
  76. package/lib/module/dto/ScreenPresentationConfig.js.map +1 -0
  77. package/lib/module/dto/SubscriptionPeriod.js +26 -0
  78. package/lib/module/dto/SubscriptionPeriod.js.map +1 -0
  79. package/lib/module/dto/Transaction.js +18 -0
  80. package/lib/module/dto/Transaction.js.map +1 -0
  81. package/lib/module/dto/User.js +10 -0
  82. package/lib/module/dto/User.js.map +1 -0
  83. package/lib/module/dto/UserProperties.js +71 -0
  84. package/lib/module/dto/UserProperties.js.map +1 -0
  85. package/lib/module/dto/UserProperty.js +17 -0
  86. package/lib/module/dto/UserProperty.js.map +1 -0
  87. package/lib/module/dto/enums.js +425 -0
  88. package/lib/module/dto/enums.js.map +1 -0
  89. package/lib/module/dto/storeProducts/ProductInAppDetails.js +16 -0
  90. package/lib/module/dto/storeProducts/ProductInAppDetails.js.map +1 -0
  91. package/lib/module/dto/storeProducts/ProductInstallmentPlanDetails.js +25 -0
  92. package/lib/module/dto/storeProducts/ProductInstallmentPlanDetails.js.map +1 -0
  93. package/lib/module/dto/storeProducts/ProductOfferDetails.js +76 -0
  94. package/lib/module/dto/storeProducts/ProductOfferDetails.js.map +1 -0
  95. package/lib/module/dto/storeProducts/ProductPrice.js +37 -0
  96. package/lib/module/dto/storeProducts/ProductPrice.js.map +1 -0
  97. package/lib/module/dto/storeProducts/ProductPricingPhase.js +52 -0
  98. package/lib/module/dto/storeProducts/ProductPricingPhase.js.map +1 -0
  99. package/lib/module/dto/storeProducts/ProductStoreDetails.js +114 -0
  100. package/lib/module/dto/storeProducts/ProductStoreDetails.js.map +1 -0
  101. package/lib/module/dto/storeProducts/SKPaymentDiscount.js +13 -0
  102. package/lib/module/dto/storeProducts/SKPaymentDiscount.js.map +1 -0
  103. package/lib/module/dto/storeProducts/SKProduct.js +22 -0
  104. package/lib/module/dto/storeProducts/SKProduct.js.map +1 -0
  105. package/lib/module/dto/storeProducts/SKProductDiscount.js +16 -0
  106. package/lib/module/dto/storeProducts/SKProductDiscount.js.map +1 -0
  107. package/lib/module/dto/storeProducts/SKSubscriptionPeriod.js +10 -0
  108. package/lib/module/dto/storeProducts/SKSubscriptionPeriod.js.map +1 -0
  109. package/lib/module/dto/storeProducts/SkuDetails.js +30 -0
  110. package/lib/module/dto/storeProducts/SkuDetails.js.map +1 -0
  111. package/lib/module/index.js +40 -0
  112. package/lib/module/index.js.map +1 -0
  113. package/lib/module/internal/Mapper.js +676 -0
  114. package/lib/module/internal/Mapper.js.map +1 -0
  115. package/lib/module/internal/NoCodesInternal.js +70 -0
  116. package/lib/module/internal/NoCodesInternal.js.map +1 -0
  117. package/lib/module/internal/QonversionInternal.js +237 -0
  118. package/lib/module/internal/QonversionInternal.js.map +1 -0
  119. package/lib/module/internal/specs/NativeNoCodesModule.js +5 -0
  120. package/lib/module/internal/specs/NativeNoCodesModule.js.map +1 -0
  121. package/lib/module/internal/specs/NativeQonversionModule.js +5 -0
  122. package/lib/module/internal/specs/NativeQonversionModule.js.map +1 -0
  123. package/lib/module/internal/utils.js +10 -0
  124. package/lib/module/internal/utils.js.map +1 -0
  125. package/lib/module/package.json +1 -0
  126. package/lib/typescript/package.json +1 -0
  127. package/lib/typescript/src/NoCodes.d.ts +23 -0
  128. package/lib/typescript/src/NoCodes.d.ts.map +1 -0
  129. package/lib/typescript/src/NoCodesApi.d.ts +20 -0
  130. package/lib/typescript/src/NoCodesApi.d.ts.map +1 -0
  131. package/lib/typescript/src/NoCodesConfig.d.ts +8 -0
  132. package/lib/typescript/src/NoCodesConfig.d.ts.map +1 -0
  133. package/lib/typescript/src/NoCodesConfigBuilder.d.ts +26 -0
  134. package/lib/typescript/src/NoCodesConfigBuilder.d.ts.map +1 -0
  135. package/lib/typescript/src/Qonversion.d.ts +26 -0
  136. package/lib/typescript/src/Qonversion.d.ts.map +1 -0
  137. package/lib/typescript/src/QonversionApi.d.ts +285 -0
  138. package/lib/typescript/src/QonversionApi.d.ts.map +1 -0
  139. package/lib/typescript/src/QonversionConfig.d.ts +14 -0
  140. package/lib/typescript/src/QonversionConfig.d.ts.map +1 -0
  141. package/lib/typescript/src/QonversionConfigBuilder.d.ts +65 -0
  142. package/lib/typescript/src/QonversionConfigBuilder.d.ts.map +1 -0
  143. package/lib/typescript/src/dto/Entitlement.d.ts +22 -0
  144. package/lib/typescript/src/dto/Entitlement.d.ts.map +1 -0
  145. package/lib/typescript/src/dto/EntitlementsUpdateListener.d.ts +10 -0
  146. package/lib/typescript/src/dto/EntitlementsUpdateListener.d.ts.map +1 -0
  147. package/lib/typescript/src/dto/Experiment.d.ts +9 -0
  148. package/lib/typescript/src/dto/Experiment.d.ts.map +1 -0
  149. package/lib/typescript/src/dto/ExperimentGroup.d.ts +9 -0
  150. package/lib/typescript/src/dto/ExperimentGroup.d.ts.map +1 -0
  151. package/lib/typescript/src/dto/IntroEligibility.d.ts +7 -0
  152. package/lib/typescript/src/dto/IntroEligibility.d.ts.map +1 -0
  153. package/lib/typescript/src/dto/NoCodesAction.d.ts +10 -0
  154. package/lib/typescript/src/dto/NoCodesAction.d.ts.map +1 -0
  155. package/lib/typescript/src/dto/NoCodesError.d.ts +12 -0
  156. package/lib/typescript/src/dto/NoCodesError.d.ts.map +1 -0
  157. package/lib/typescript/src/dto/NoCodesListener.d.ts +34 -0
  158. package/lib/typescript/src/dto/NoCodesListener.d.ts.map +1 -0
  159. package/lib/typescript/src/dto/Offering.d.ts +11 -0
  160. package/lib/typescript/src/dto/Offering.d.ts.map +1 -0
  161. package/lib/typescript/src/dto/Offerings.d.ts +9 -0
  162. package/lib/typescript/src/dto/Offerings.d.ts.map +1 -0
  163. package/lib/typescript/src/dto/Product.d.ts +95 -0
  164. package/lib/typescript/src/dto/Product.d.ts.map +1 -0
  165. package/lib/typescript/src/dto/PromoPurchasesListener.d.ts +12 -0
  166. package/lib/typescript/src/dto/PromoPurchasesListener.d.ts.map +1 -0
  167. package/lib/typescript/src/dto/PromotionalOffer.d.ts +9 -0
  168. package/lib/typescript/src/dto/PromotionalOffer.d.ts.map +1 -0
  169. package/lib/typescript/src/dto/PurchaseModel.d.ts +19 -0
  170. package/lib/typescript/src/dto/PurchaseModel.d.ts.map +1 -0
  171. package/lib/typescript/src/dto/PurchaseOptions.d.ts +15 -0
  172. package/lib/typescript/src/dto/PurchaseOptions.d.ts.map +1 -0
  173. package/lib/typescript/src/dto/PurchaseOptionsBuilder.d.ts +84 -0
  174. package/lib/typescript/src/dto/PurchaseOptionsBuilder.d.ts.map +1 -0
  175. package/lib/typescript/src/dto/PurchaseUpdateModel.d.ts +25 -0
  176. package/lib/typescript/src/dto/PurchaseUpdateModel.d.ts.map +1 -0
  177. package/lib/typescript/src/dto/QonversionError.d.ts +11 -0
  178. package/lib/typescript/src/dto/QonversionError.d.ts.map +1 -0
  179. package/lib/typescript/src/dto/RemoteConfig.d.ts +10 -0
  180. package/lib/typescript/src/dto/RemoteConfig.d.ts.map +1 -0
  181. package/lib/typescript/src/dto/RemoteConfigList.d.ts +10 -0
  182. package/lib/typescript/src/dto/RemoteConfigList.d.ts.map +1 -0
  183. package/lib/typescript/src/dto/RemoteConfigurationSource.d.ts +11 -0
  184. package/lib/typescript/src/dto/RemoteConfigurationSource.d.ts.map +1 -0
  185. package/lib/typescript/src/dto/ScreenPresentationConfig.d.ts +18 -0
  186. package/lib/typescript/src/dto/ScreenPresentationConfig.d.ts.map +1 -0
  187. package/lib/typescript/src/dto/SubscriptionPeriod.d.ts +21 -0
  188. package/lib/typescript/src/dto/SubscriptionPeriod.d.ts.map +1 -0
  189. package/lib/typescript/src/dto/Transaction.d.ts +16 -0
  190. package/lib/typescript/src/dto/Transaction.d.ts.map +1 -0
  191. package/lib/typescript/src/dto/User.d.ts +7 -0
  192. package/lib/typescript/src/dto/User.d.ts.map +1 -0
  193. package/lib/typescript/src/dto/UserProperties.d.ts +49 -0
  194. package/lib/typescript/src/dto/UserProperties.d.ts.map +1 -0
  195. package/lib/typescript/src/dto/UserProperty.d.ts +13 -0
  196. package/lib/typescript/src/dto/UserProperty.d.ts.map +1 -0
  197. package/lib/typescript/src/dto/enums.d.ts +343 -0
  198. package/lib/typescript/src/dto/enums.d.ts.map +1 -0
  199. package/lib/typescript/src/dto/storeProducts/ProductInAppDetails.d.ts +13 -0
  200. package/lib/typescript/src/dto/storeProducts/ProductInAppDetails.d.ts.map +1 -0
  201. package/lib/typescript/src/dto/storeProducts/ProductInstallmentPlanDetails.d.ts +20 -0
  202. package/lib/typescript/src/dto/storeProducts/ProductInstallmentPlanDetails.d.ts.map +1 -0
  203. package/lib/typescript/src/dto/storeProducts/ProductOfferDetails.d.ts +63 -0
  204. package/lib/typescript/src/dto/storeProducts/ProductOfferDetails.d.ts.map +1 -0
  205. package/lib/typescript/src/dto/storeProducts/ProductPrice.d.ts +29 -0
  206. package/lib/typescript/src/dto/storeProducts/ProductPrice.d.ts.map +1 -0
  207. package/lib/typescript/src/dto/storeProducts/ProductPricingPhase.d.ts +44 -0
  208. package/lib/typescript/src/dto/storeProducts/ProductPricingPhase.d.ts.map +1 -0
  209. package/lib/typescript/src/dto/storeProducts/ProductStoreDetails.d.ts +97 -0
  210. package/lib/typescript/src/dto/storeProducts/ProductStoreDetails.d.ts.map +1 -0
  211. package/lib/typescript/src/dto/storeProducts/SKPaymentDiscount.d.ts +10 -0
  212. package/lib/typescript/src/dto/storeProducts/SKPaymentDiscount.d.ts.map +1 -0
  213. package/lib/typescript/src/dto/storeProducts/SKProduct.d.ts +21 -0
  214. package/lib/typescript/src/dto/storeProducts/SKProduct.d.ts.map +1 -0
  215. package/lib/typescript/src/dto/storeProducts/SKProductDiscount.d.ts +15 -0
  216. package/lib/typescript/src/dto/storeProducts/SKProductDiscount.d.ts.map +1 -0
  217. package/lib/typescript/src/dto/storeProducts/SKSubscriptionPeriod.d.ts +8 -0
  218. package/lib/typescript/src/dto/storeProducts/SKSubscriptionPeriod.d.ts.map +1 -0
  219. package/lib/typescript/src/dto/storeProducts/SkuDetails.d.ts +27 -0
  220. package/lib/typescript/src/dto/storeProducts/SkuDetails.d.ts.map +1 -0
  221. package/lib/typescript/src/index.d.ts +41 -0
  222. package/lib/typescript/src/index.d.ts.map +1 -0
  223. package/lib/typescript/src/internal/Mapper.d.ts +312 -0
  224. package/lib/typescript/src/internal/Mapper.d.ts.map +1 -0
  225. package/lib/typescript/src/internal/NoCodesInternal.d.ts +14 -0
  226. package/lib/typescript/src/internal/NoCodesInternal.d.ts.map +1 -0
  227. package/lib/typescript/src/internal/QonversionInternal.d.ts +60 -0
  228. package/lib/typescript/src/internal/QonversionInternal.d.ts.map +1 -0
  229. package/lib/typescript/src/internal/specs/NativeNoCodesModule.d.ts +17 -0
  230. package/lib/typescript/src/internal/specs/NativeNoCodesModule.d.ts.map +1 -0
  231. package/lib/typescript/src/internal/specs/NativeQonversionModule.d.ts +56 -0
  232. package/lib/typescript/src/internal/specs/NativeQonversionModule.d.ts.map +1 -0
  233. package/lib/typescript/src/internal/utils.d.ts +3 -0
  234. package/lib/typescript/src/internal/utils.d.ts.map +1 -0
  235. package/package.json +151 -0
  236. package/qonversion-react-native-sdk.podspec +21 -0
  237. package/src/NoCodes.ts +37 -0
  238. package/src/NoCodesApi.ts +22 -0
  239. package/src/NoCodesConfig.ts +16 -0
  240. package/src/NoCodesConfigBuilder.ts +40 -0
  241. package/src/Qonversion.ts +40 -0
  242. package/src/QonversionApi.ts +318 -0
  243. package/src/QonversionConfig.ts +32 -0
  244. package/src/QonversionConfigBuilder.ts +102 -0
  245. package/src/dto/Entitlement.ts +57 -0
  246. package/src/dto/EntitlementsUpdateListener.ts +11 -0
  247. package/src/dto/Experiment.ts +15 -0
  248. package/src/dto/ExperimentGroup.ts +15 -0
  249. package/src/dto/IntroEligibility.ts +11 -0
  250. package/src/dto/NoCodesAction.ts +21 -0
  251. package/src/dto/NoCodesError.ts +26 -0
  252. package/src/dto/NoCodesListener.ts +39 -0
  253. package/src/dto/Offering.ts +20 -0
  254. package/src/dto/Offerings.ts +17 -0
  255. package/src/dto/Product.ts +159 -0
  256. package/src/dto/PromoPurchasesListener.ts +13 -0
  257. package/src/dto/PromotionalOffer.ts +17 -0
  258. package/src/dto/PurchaseModel.ts +29 -0
  259. package/src/dto/PurchaseOptions.ts +33 -0
  260. package/src/dto/PurchaseOptionsBuilder.ts +127 -0
  261. package/src/dto/PurchaseUpdateModel.ts +43 -0
  262. package/src/dto/QonversionError.ts +24 -0
  263. package/src/dto/RemoteConfig.ts +16 -0
  264. package/src/dto/RemoteConfigList.ts +23 -0
  265. package/src/dto/RemoteConfigurationSource.ts +26 -0
  266. package/src/dto/ScreenPresentationConfig.ts +24 -0
  267. package/src/dto/SubscriptionPeriod.ts +33 -0
  268. package/src/dto/Transaction.ts +40 -0
  269. package/src/dto/User.ts +11 -0
  270. package/src/dto/UserProperties.ts +78 -0
  271. package/src/dto/UserProperty.ts +21 -0
  272. package/src/dto/enums.ts +389 -0
  273. package/src/dto/storeProducts/ProductInAppDetails.ts +17 -0
  274. package/src/dto/storeProducts/ProductInstallmentPlanDetails.ts +28 -0
  275. package/src/dto/storeProducts/ProductOfferDetails.ts +102 -0
  276. package/src/dto/storeProducts/ProductPrice.ts +46 -0
  277. package/src/dto/storeProducts/ProductPricingPhase.ts +71 -0
  278. package/src/dto/storeProducts/ProductStoreDetails.ts +151 -0
  279. package/src/dto/storeProducts/SKPaymentDiscount.ts +23 -0
  280. package/src/dto/storeProducts/SKProduct.ts +53 -0
  281. package/src/dto/storeProducts/SKProductDiscount.ts +38 -0
  282. package/src/dto/storeProducts/SKSubscriptionPeriod.ts +13 -0
  283. package/src/dto/storeProducts/SkuDetails.ts +68 -0
  284. package/src/index.ts +43 -0
  285. package/src/internal/Mapper.ts +1221 -0
  286. package/src/internal/NoCodesInternal.ts +84 -0
  287. package/src/internal/QonversionInternal.ts +370 -0
  288. package/src/internal/specs/NativeNoCodesModule.ts +20 -0
  289. package/src/internal/specs/NativeQonversionModule.ts +74 -0
  290. package/src/internal/utils.ts +9 -0
@@ -0,0 +1,17 @@
1
+ import Offering from "./Offering";
2
+
3
+ class Offerings {
4
+ main: Offering | null;
5
+ availableOffering: Array<Offering>;
6
+
7
+ constructor(main: Offering | null, availableOfferings: Array<Offering>) {
8
+ this.main = main;
9
+ this.availableOffering = availableOfferings;
10
+ }
11
+
12
+ offeringForIdentifier(identifier: string): Offering | undefined {
13
+ return this.availableOffering.find((object) => object.id === identifier);
14
+ }
15
+ }
16
+
17
+ export default Offerings;
@@ -0,0 +1,159 @@
1
+ import {ProductType, PurchaseUpdatePolicy} from "./enums";
2
+ import SKProduct from "./storeProducts/SKProduct";
3
+ import SkuDetails from "./storeProducts/SkuDetails";
4
+ import ProductStoreDetails from "./storeProducts/ProductStoreDetails";
5
+ import ProductOfferDetails from './storeProducts/ProductOfferDetails';
6
+ import PurchaseModel from './PurchaseModel';
7
+ import PurchaseUpdateModel from './PurchaseUpdateModel';
8
+ import SubscriptionPeriod from './SubscriptionPeriod';
9
+
10
+ class Product {
11
+ qonversionId: string;
12
+ storeId: string | null;
13
+
14
+ /**
15
+ * Identifier of the base plan for Google product.
16
+ */
17
+ basePlanId: string | null;
18
+
19
+ /**
20
+ * Google Play Store details of this product.
21
+ * Android only. Null for iOS, or if the product was not found.
22
+ * Doesn't take into account {@link basePlanId}.
23
+ * @deprecated Consider using {@link storeDetails} instead.
24
+ */
25
+ skuDetails: SkuDetails | null;
26
+
27
+ /**
28
+ * Google Play Store details of this product.
29
+ * Android only. Null for iOS, or if the product was not found.
30
+ */
31
+ storeDetails: ProductStoreDetails | null;
32
+
33
+ /**
34
+ * App store details of this product.
35
+ * iOS only. Null for Android, or if the product was not found.
36
+ */
37
+ skProduct: SKProduct | null;
38
+
39
+ offeringId?: string | null;
40
+
41
+ /**
42
+ * For Android - the subscription base plan duration. If the {@link basePlanId} is not specified,
43
+ * the duration is calculated using the deprecated {@link skuDetails}.
44
+ * For iOS - the duration of the {@link skProduct}.
45
+ * Null, if it's not a subscription product or the product was not found in the store.
46
+ */
47
+ subscriptionPeriod: SubscriptionPeriod | null;
48
+
49
+ /**
50
+ * The subscription trial duration of the default offer for Android or of the product for iOS.
51
+ * See {@link ProductStoreDetails.defaultSubscriptionOfferDetails} for the information on how we
52
+ * choose the default offer for Android.
53
+ * Null, if it's not a subscription product or the product was not found the store.
54
+ */
55
+ trialPeriod: SubscriptionPeriod | null;
56
+
57
+ /**
58
+ * The calculated type of this product based on the store information.
59
+ * On Android uses deprecated {@link skuDetails} for the old subscription products
60
+ * where {@link basePlanId} is not specified, and {@link storeDetails} for all the other products.
61
+ * On iOS uses {@link skProduct} information.
62
+ */
63
+ type: ProductType;
64
+
65
+ /**
66
+ * Formatted price of for this product, including the currency sign.
67
+ */
68
+ prettyPrice: string | null;
69
+
70
+ price?: number;
71
+ currencyCode?: string;
72
+ storeTitle?: string;
73
+ storeDescription?: string;
74
+ prettyIntroductoryPrice?: string;
75
+
76
+ constructor(
77
+ qonversionId: string,
78
+ storeId: string,
79
+ basePlanId: string | null,
80
+ skuDetails: SkuDetails | null,
81
+ storeDetails: ProductStoreDetails | null,
82
+ skProduct: SKProduct | null,
83
+ offeringId: string | null,
84
+ subscriptionPeriod: SubscriptionPeriod | null,
85
+ trialPeriod: SubscriptionPeriod | null,
86
+ type: ProductType,
87
+ prettyPrice: string | null,
88
+ price: number | undefined,
89
+ currencyCode: string | undefined,
90
+ storeTitle: string | undefined,
91
+ storeDescription: string | undefined,
92
+ prettyIntroductoryPrice: string | undefined,
93
+ ) {
94
+ this.qonversionId = qonversionId;
95
+ this.storeId = storeId;
96
+ this.basePlanId = basePlanId;
97
+ this.skuDetails = skuDetails;
98
+ this.storeDetails = storeDetails;
99
+ this.skProduct = skProduct;
100
+ this.offeringId = offeringId;
101
+ this.subscriptionPeriod = subscriptionPeriod;
102
+ this.trialPeriod = trialPeriod;
103
+ this.type = type;
104
+ this.prettyPrice = prettyPrice;
105
+ this.price = price;
106
+ this.currencyCode = currencyCode;
107
+ this.storeTitle = storeTitle;
108
+ this.storeDescription = storeDescription;
109
+ this.prettyIntroductoryPrice = prettyIntroductoryPrice;
110
+ }
111
+
112
+ /**
113
+ * Converts this product to purchase model to pass to {@link Qonversion.purchase}.
114
+ * @param offerId concrete Android offer identifier if necessary.
115
+ * If the products' base plan id is specified, but offer id is not provided for
116
+ * purchase, then default offer will be used.
117
+ * Ignored if base plan id is not specified.
118
+ * Ignored for iOS.
119
+ * To know how we choose the default offer, see {@link ProductStoreDetails.defaultSubscriptionOfferDetails}.
120
+ * @returns purchase model to pass to the purchase method.
121
+ */
122
+ toPurchaseModel(offerId: string | null = null): PurchaseModel {
123
+ return new PurchaseModel(this.qonversionId, offerId);
124
+ }
125
+
126
+ /**
127
+ * Converts this product to purchase model to pass to {@link Qonversion.purchase}.
128
+ * @param offer concrete Android offer which you'd like to purchase.
129
+ * @return purchase model to pass to the purchase method.
130
+ */
131
+ toPurchaseModelWithOffer(offer: ProductOfferDetails): PurchaseModel {
132
+ const model = this.toPurchaseModel(offer.offerId);
133
+ // Remove offer for the case when provided offer details are for bare base plan.
134
+ if (offer.offerId == null) {
135
+ model.removeOffer();
136
+ }
137
+
138
+ return model;
139
+ }
140
+
141
+ /**
142
+ * Android only.
143
+ *
144
+ * Converts this product to purchase update (upgrade/downgrade) model
145
+ * to pass to {@link Qonversion.updatePurchase}.
146
+ * @param oldProductId Qonversion product identifier from which the upgrade/downgrade
147
+ * will be initialized.
148
+ * @param updatePolicy purchase update policy.
149
+ * @return purchase model to pass to the update purchase method.
150
+ */
151
+ toPurchaseUpdateModel(
152
+ oldProductId: string,
153
+ updatePolicy: PurchaseUpdatePolicy | null = null
154
+ ): PurchaseUpdateModel {
155
+ return new PurchaseUpdateModel(this.qonversionId, oldProductId, updatePolicy);
156
+ }
157
+ }
158
+
159
+ export default Product;
@@ -0,0 +1,13 @@
1
+ import Entitlement from './Entitlement';
2
+
3
+ export interface PromoPurchasesListener {
4
+
5
+ /**
6
+ * Fired each time a promo purchase from the App Store happens.
7
+ * Call {@param promoPurchaseExecutor} in case of your app is ready to start promo purchase.
8
+ * Or cache that executor and call later when you need.
9
+ * @param productId StoreKit product identifier.
10
+ * @param promoPurchaseExecutor a function that will start a promo purchase flow.
11
+ */
12
+ onPromoPurchaseReceived(productId: string, promoPurchaseExecutor: () => Promise<Map<string, Entitlement>>): void;
13
+ }
@@ -0,0 +1,17 @@
1
+ import SKProductDiscount from './storeProducts/SKProductDiscount';
2
+ import SKPaymentDiscount from './storeProducts/SKPaymentDiscount';
3
+
4
+ class PromotionalOffer {
5
+ public readonly productDiscount: SKProductDiscount;
6
+ public readonly paymentDiscount: SKPaymentDiscount;
7
+
8
+ constructor (
9
+ productDiscount: SKProductDiscount,
10
+ paymentDiscount: SKPaymentDiscount
11
+ ) {
12
+ this.productDiscount = productDiscount;
13
+ this.paymentDiscount = paymentDiscount;
14
+ }
15
+ }
16
+
17
+ export default PromotionalOffer;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Used to provide all the necessary purchase data to the {@link Qonversion.purchase} method.
3
+ * Can be created manually or using the {@link Product.toPurchaseModel} method.
4
+ *
5
+ * If {@link offerId} is not specified for Android, then the default offer will be applied.
6
+ * To know how we choose the default offer, see {@link ProductStoreDetails.defaultSubscriptionOfferDetails}.
7
+ *
8
+ * If you want to remove any intro/trial offer from the purchase on Android (use only a bare base plan),
9
+ * call the {@link removeOffer} method.
10
+ */
11
+ class PurchaseModel {
12
+
13
+ public readonly productId: string;
14
+ public offerId: string | null = null;
15
+
16
+ public applyOffer: boolean = true;
17
+
18
+ constructor(productId: string, offerId: string | null = null) {
19
+ this.productId = productId;
20
+ this.offerId = offerId;
21
+ }
22
+
23
+ removeOffer(): PurchaseModel {
24
+ this.applyOffer = false;
25
+ return this;
26
+ }
27
+ }
28
+
29
+ export default PurchaseModel;
@@ -0,0 +1,33 @@
1
+ import Product from "./Product";
2
+ import {PurchaseUpdatePolicy} from "./enums";
3
+ import PromotionalOffer from './PromotionalOffer';
4
+
5
+ class PurchaseOptions {
6
+ public readonly offerId: string | null;
7
+ public readonly applyOffer: boolean;
8
+ public readonly oldProduct: Product | null;
9
+ public readonly updatePolicy: PurchaseUpdatePolicy | null;
10
+ public readonly contextKeys: string[] | null;
11
+ public readonly quantity: number;
12
+ public readonly promotionalOffer: PromotionalOffer | null;
13
+
14
+ constructor (
15
+ offerId: string | null,
16
+ applyOffer: boolean,
17
+ oldProduct: Product | null,
18
+ updatePolicy: PurchaseUpdatePolicy | null,
19
+ contextKeys: string[] | null,
20
+ quantity: number,
21
+ promotionalOffer: PromotionalOffer | null
22
+ ) {
23
+ this.offerId = offerId;
24
+ this.applyOffer = applyOffer;
25
+ this.oldProduct = oldProduct;
26
+ this.updatePolicy = updatePolicy;
27
+ this.contextKeys = contextKeys;
28
+ this.quantity = quantity;
29
+ this.promotionalOffer = promotionalOffer;
30
+ }
31
+ }
32
+
33
+ export default PurchaseOptions;
@@ -0,0 +1,127 @@
1
+ import Product from "./Product";
2
+ import {PurchaseUpdatePolicy} from "./enums";
3
+ import ProductOfferDetails from "./storeProducts/ProductOfferDetails";
4
+ import PurchaseOptions from "./PurchaseOptions";
5
+ import PromotionalOffer from "./PromotionalOffer";
6
+
7
+ class PurchaseOptionsBuilder {
8
+ private offerId: string | null = null;
9
+ private applyOffer: boolean = true;
10
+ private oldProduct: Product | null = null;
11
+ private updatePolicy: PurchaseUpdatePolicy | null = null;
12
+ private contextKeys: string[] | null = null;
13
+ private quantity: number = 1;
14
+ private promoOffer: PromotionalOffer | null = null;
15
+
16
+ /**
17
+ * iOS only.
18
+ * Set quantity of product purchasing. Use for consumable in-app products.
19
+ * @param quantity of product purchasing.
20
+ * @return builder instance for chain calls.
21
+ */
22
+ setQuantity(quantity: number): PurchaseOptionsBuilder {
23
+ this.quantity = quantity;
24
+ return this;
25
+ }
26
+
27
+ /**
28
+ * Android only.
29
+ * Set offer for the purchase.
30
+ * If offer is not specified, then the default offer will be applied. To know how we choose
31
+ * the default offer, see {@link ProductStoreDetails.defaultSubscriptionOfferDetails}.
32
+ * @param offer concrete offer which you'd like to purchase.
33
+ * @return builder instance for chain calls.
34
+ */
35
+ setOffer(offer: ProductOfferDetails) {
36
+ this.offerId = offer.offerId;
37
+ return this;
38
+ }
39
+
40
+ /**
41
+ * Android only.
42
+ * Set the offer Id to the purchase.
43
+ * If {@link offerId} is not specified, then the default offer will be applied. To know how we choose
44
+ * the default offer, see {@link ProductStoreDetails.defaultSubscriptionOfferDetails}.
45
+ * @param offerId concrete offer Id which you'd like to purchase.
46
+ * @return builder instance for chain calls.
47
+ */
48
+ setOfferId(offerId: string): PurchaseOptionsBuilder {
49
+ this.offerId = offerId;
50
+ return this;
51
+ }
52
+
53
+ /**
54
+ * Android only.
55
+ * Call this function to remove any intro/trial offer from the purchase (use only a bare base plan).
56
+ * @return builder instance for chain calls.
57
+ */
58
+ removeOffer(): PurchaseOptionsBuilder {
59
+ this.applyOffer = false;
60
+ return this;
61
+ }
62
+
63
+ /**
64
+ * Android only.
65
+ * Set Qonversion product from which the upgrade/downgrade will be initialized.
66
+ *
67
+ * @param oldProduct Qonversion product from which the upgrade/downgrade
68
+ * will be initialized.
69
+ * @return builder instance for chain calls.
70
+ */
71
+ setOldProduct(oldProduct: Product): PurchaseOptionsBuilder {
72
+ this.oldProduct = oldProduct;
73
+ return this;
74
+ }
75
+
76
+ /**
77
+ * Android only.
78
+ * Set the update policy for the purchase.
79
+ * If the {@link updatePolicy} is not provided, then default one
80
+ * will be selected - {@link PurchaseUpdatePolicy.WITH_TIME_PRORATION}.
81
+ * @param updatePolicy update policy for the purchase.
82
+ * @return builder instance for chain calls.
83
+ */
84
+ setUpdatePolicy(updatePolicy: PurchaseUpdatePolicy): PurchaseOptionsBuilder {
85
+ this.updatePolicy = updatePolicy;
86
+ return this;
87
+ }
88
+
89
+ /**
90
+ * Set the context keys associated with a purchase.
91
+ *
92
+ * @param contextKeys context keys for the purchase.
93
+ * @return builder instance for chain calls.
94
+ */
95
+ setContextKeys(contextKeys: string[]): PurchaseOptionsBuilder {
96
+ this.contextKeys = contextKeys;
97
+ return this;
98
+ }
99
+
100
+ /**
101
+ * Set the promotional offer details.
102
+ *
103
+ * @param promoOffer promotional offer details.
104
+ * @return builder instance for chain calls.
105
+ */
106
+ setPromotionalOffer(promoOffer: PromotionalOffer): PurchaseOptionsBuilder {
107
+ this.promoOffer = promoOffer;
108
+ return this;
109
+ }
110
+
111
+ /**
112
+ * Generate {@link PurchaseOptions} instance with all the provided options.
113
+ * @return the complete {@link PurchaseOptions} instance.
114
+ */
115
+ build(): PurchaseOptions {
116
+ return new PurchaseOptions(
117
+ this.offerId,
118
+ this.applyOffer,
119
+ this.oldProduct,
120
+ this.updatePolicy,
121
+ this.contextKeys,
122
+ this.quantity,
123
+ this.promoOffer);
124
+ }
125
+ }
126
+
127
+ export default PurchaseOptionsBuilder;
@@ -0,0 +1,43 @@
1
+ import {PurchaseUpdatePolicy} from './enums';
2
+
3
+ /**
4
+ * Used to provide all the necessary purchase data to the {@link Qonversion.updatePurchase} method.
5
+ * Can be created manually or using the {@link Product.toPurchaseUpdateModel} method.
6
+ *
7
+ * Requires Qonversion product identifiers - {@link productId} for the purchasing one and
8
+ * {@link oldProductId} for the purchased one.
9
+ *
10
+ * If {@link offerId} is not specified for Android, then the default offer will be applied.
11
+ * To know how we choose the default offer, see {@link ProductStoreDetails.defaultSubscriptionOfferDetails}.
12
+ *
13
+ * If you want to remove any intro/trial offer from the purchase on Android (use only a bare base plan),
14
+ * call the {@link removeOffer} method.
15
+ */
16
+ class PurchaseUpdateModel {
17
+
18
+ public readonly productId: string;
19
+ public readonly oldProductId: string;
20
+ public updatePolicy: PurchaseUpdatePolicy | null = null;
21
+ public offerId: string | null = null;
22
+
23
+ public applyOffer: boolean = true;
24
+
25
+ constructor(
26
+ productId: string,
27
+ oldProductId: string,
28
+ updatePolicy: PurchaseUpdatePolicy | null = null,
29
+ offerId: string | null = null,
30
+ ) {
31
+ this.productId = productId;
32
+ this.oldProductId = oldProductId;
33
+ this.updatePolicy = updatePolicy;
34
+ this.offerId = offerId;
35
+ }
36
+
37
+ removeOffer(): PurchaseUpdateModel {
38
+ this.applyOffer = false;
39
+ return this;
40
+ }
41
+ }
42
+
43
+ export default PurchaseUpdateModel;
@@ -0,0 +1,24 @@
1
+ import {QonversionErrorCode} from './enums';
2
+
3
+ class QonversionError {
4
+ code: QonversionErrorCode;
5
+ domain?: string | null;
6
+ description?: string | null;
7
+ additionalMessage?: string | null;
8
+ userCanceled: boolean = false;
9
+
10
+ constructor(
11
+ code: QonversionErrorCode,
12
+ description?: string | null,
13
+ additionalMessage?: string | null,
14
+ domain?: string | null,
15
+ ) {
16
+ this.code = code;
17
+ this.domain = domain;
18
+ this.description = description;
19
+ this.additionalMessage = additionalMessage;
20
+ this.userCanceled = code === QonversionErrorCode.PURCHASE_CANCELED;
21
+ }
22
+ }
23
+
24
+ export default QonversionError;
@@ -0,0 +1,16 @@
1
+ import Experiment from "./Experiment";
2
+ import RemoteConfigurationSource from "./RemoteConfigurationSource";
3
+
4
+ class RemoteConfig {
5
+ payload: Record<string, Object>;
6
+ experiment?: Experiment | null;
7
+ source: RemoteConfigurationSource;
8
+
9
+ constructor(payload: Record<string, Object>, experiment: Experiment | null, source: RemoteConfigurationSource) {
10
+ this.payload = payload;
11
+ this.experiment = experiment;
12
+ this.source = source;
13
+ }
14
+ }
15
+
16
+ export default RemoteConfig;
@@ -0,0 +1,23 @@
1
+ import RemoteConfig from './RemoteConfig';
2
+
3
+ class RemoteConfigList {
4
+ remoteConfigs: Array<RemoteConfig>;
5
+
6
+ constructor(remoteConfigs: Array<RemoteConfig>) {
7
+ this.remoteConfigs = remoteConfigs;
8
+ }
9
+
10
+ remoteConfigForContextKey(contextKey: string): RemoteConfig | undefined {
11
+ return this.findRemoteConfigForContextKey(contextKey);
12
+ }
13
+
14
+ remoteConfigForEmptyContextKey(): RemoteConfig | undefined {
15
+ return this.findRemoteConfigForContextKey(null);
16
+ }
17
+
18
+ private findRemoteConfigForContextKey(contextKey: string | null): RemoteConfig | undefined {
19
+ return this.remoteConfigs.find(config => config.source.contextKey == contextKey);
20
+ }
21
+ }
22
+
23
+ export default RemoteConfigList;
@@ -0,0 +1,26 @@
1
+ import {RemoteConfigurationAssignmentType, RemoteConfigurationSourceType} from "./enums";
2
+
3
+
4
+ class RemoteConfigurationSource {
5
+ id: string;
6
+ name: string;
7
+ type: RemoteConfigurationSourceType;
8
+ assignmentType: RemoteConfigurationAssignmentType;
9
+ contextKey: string | null;
10
+
11
+ constructor(
12
+ id: string,
13
+ name: string,
14
+ type: RemoteConfigurationSourceType,
15
+ assignmentType: RemoteConfigurationAssignmentType,
16
+ contextKey: string | null,
17
+ ) {
18
+ this.id = id;
19
+ this.name = name;
20
+ this.type = type;
21
+ this.assignmentType = assignmentType;
22
+ this.contextKey = contextKey;
23
+ }
24
+ }
25
+
26
+ export default RemoteConfigurationSource;
@@ -0,0 +1,24 @@
1
+ import {ScreenPresentationStyle} from './enums';
2
+
3
+ class ScreenPresentationConfig {
4
+ /**
5
+ * Describes how screens will be displayed.
6
+ * For mode details see the enum description.
7
+ */
8
+ presentationStyle: ScreenPresentationStyle;
9
+
10
+ /**
11
+ * iOS only. For Android consider using {@link ScreenPresentationStyle.NO_ANIMATION}.
12
+ *
13
+ * Describes whether should transaction be animated or not.
14
+ * Default value is true.
15
+ */
16
+ animated: boolean;
17
+
18
+ constructor(presentationStyle: ScreenPresentationStyle, animated?: boolean) {
19
+ this.presentationStyle = presentationStyle;
20
+ this.animated = animated === undefined ? true : animated;
21
+ }
22
+ }
23
+
24
+ export default ScreenPresentationConfig;
@@ -0,0 +1,33 @@
1
+ import {SubscriptionPeriodUnit} from "./enums";
2
+
3
+ /**
4
+ * A class describing a subscription period
5
+ */
6
+ class SubscriptionPeriod {
7
+ /**
8
+ * A count of subsequent intervals.
9
+ */
10
+ unitCount: number;
11
+
12
+ /**
13
+ * Interval unit.
14
+ */
15
+ unit: SubscriptionPeriodUnit;
16
+
17
+ /**
18
+ * ISO 8601 representation of the period, e.g. "P7D", meaning 7 days period.
19
+ */
20
+ iso: string;
21
+
22
+ constructor(
23
+ unitCount: number,
24
+ unit: SubscriptionPeriodUnit,
25
+ iso: string,
26
+ ) {
27
+ this.unitCount = unitCount;
28
+ this.unit = unit;
29
+ this.iso = iso;
30
+ }
31
+ }
32
+
33
+ export default SubscriptionPeriod;
@@ -0,0 +1,40 @@
1
+ import {TransactionEnvironment, TransactionOwnershipType, TransactionType} from "./enums";
2
+
3
+ class Transaction {
4
+ originalTransactionId: string;
5
+ transactionId: string;
6
+ transactionDate: Date;
7
+ environment: TransactionEnvironment;
8
+ ownershipType: TransactionOwnershipType;
9
+ type: TransactionType;
10
+ expirationDate?: Date;
11
+ transactionRevocationDate?: Date;
12
+ offerCode?: string;
13
+ promoOfferId?: string;
14
+
15
+ constructor(
16
+ originalTransactionId: string,
17
+ transactionId: string,
18
+ transactionTimestamp: number,
19
+ environment: TransactionEnvironment,
20
+ ownershipType: TransactionOwnershipType,
21
+ type: TransactionType,
22
+ expirationTimestamp: number | undefined,
23
+ transactionRevocationTimestamp: number | undefined,
24
+ offerCode: string | undefined,
25
+ promoOfferId: string | undefined,
26
+ ) {
27
+ this.originalTransactionId = originalTransactionId;
28
+ this.transactionId = transactionId;
29
+ this.transactionDate = new Date(transactionTimestamp);
30
+ this.environment = environment;
31
+ this.ownershipType = ownershipType;
32
+ this.type = type;
33
+ this.expirationDate = expirationTimestamp ? new Date(expirationTimestamp) : undefined;
34
+ this.transactionRevocationDate = transactionRevocationTimestamp ? new Date(transactionRevocationTimestamp) : undefined;
35
+ this.offerCode = offerCode;
36
+ this.promoOfferId = promoOfferId;
37
+ }
38
+ }
39
+
40
+ export default Transaction;
@@ -0,0 +1,11 @@
1
+ class User {
2
+ qonversionId: string;
3
+ identityId?: string | null;
4
+
5
+ constructor(qonversionId: string, identityId?: string | null) {
6
+ this.qonversionId = qonversionId;
7
+ this.identityId = identityId;
8
+ }
9
+ }
10
+
11
+ export default User;