@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,318 @@
1
+ import Entitlement from './dto/Entitlement';
2
+ import Product from './dto/Product';
3
+ import {UserPropertyKey, AttributionProvider} from './dto/enums';
4
+ import Offerings from './dto/Offerings';
5
+ import IntroEligibility from './dto/IntroEligibility';
6
+ import User from './dto/User';
7
+ import type {EntitlementsUpdateListener} from './dto/EntitlementsUpdateListener';
8
+ import type {PromoPurchasesListener} from './dto/PromoPurchasesListener';
9
+ import RemoteConfig from "./dto/RemoteConfig";
10
+ import RemoteConfigList from "./dto/RemoteConfigList";
11
+ import UserProperties from './dto/UserProperties';
12
+ import PurchaseModel from './dto/PurchaseModel';
13
+ import PurchaseUpdateModel from './dto/PurchaseUpdateModel';
14
+ import PurchaseOptions from "./dto/PurchaseOptions";
15
+ import SKProductDiscount from './dto/storeProducts/SKProductDiscount';
16
+ import PromotionalOffer from './dto/PromotionalOffer';
17
+
18
+ export interface QonversionApi {
19
+
20
+ /**
21
+ * Call this function to sync the subscriber data with the first launch when Qonversion is implemented.
22
+ */
23
+ syncHistoricalData(): void;
24
+
25
+ /**
26
+ * iOS only
27
+ * Contact us before you start using this function
28
+ * Call this function to sync purchases if you are using StoreKit2 and our SDK in Analytics mode.
29
+ */
30
+ syncStoreKit2Purchases(): void;
31
+
32
+ /**
33
+ * Call this function to check if the fallback file is accessible.
34
+ * @returns the promise with the flag that indicates whether Qonversion was able to read data from the fallback file or not.
35
+ */
36
+ isFallbackFileAccessible(): Promise<boolean>;
37
+
38
+ /**
39
+ * iOS only.
40
+ * Retrieve the promotional offer for the product if it exists.
41
+ * Make sure to call this function before displaying product details to the user.
42
+ * The generated signature for the promotional offer is valid for a single transaction.
43
+ * If the purchase fails, you need to call this function again to obtain a new promotional offer signature.
44
+ * Use this signature to complete the purchase through the purchase function, along with the purchase options object.
45
+ * @param product - product you want to purchase.
46
+ * @param discount - discount to create promotional offer signature.
47
+ * @returns the promise with the PromotionalOffer.
48
+ */
49
+
50
+ getPromotionalOffer(product: Product, discount: SKProductDiscount): Promise<PromotionalOffer | null>;
51
+
52
+ /**
53
+ * Make a purchase and validate it through server-to-server using Qonversion's Backend
54
+ * @param product product to purchase
55
+ * @param options additional options for the purchase process.
56
+ * @returns the promise with the user entitlements including the ones obtained by the purchase
57
+ *
58
+ * @see [Making Purchases](https://documentation.qonversion.io/docs/making-purchases)
59
+ */
60
+ purchaseProduct(product: Product, options?: PurchaseOptions | undefined): Promise<Map<string, Entitlement>>
61
+
62
+ /**
63
+ * Make a purchase and validate it through server-to-server using Qonversion's Backend.
64
+ *
65
+ * @deprecated Use {@link purchaseProduct} function instead.
66
+ * @param purchaseModel necessary information for purchase
67
+ * @returns the promise with the user entitlements including the ones obtained by the purchase
68
+ * @see [Making Purchases](https://documentation.qonversion.io/docs/making-purchases)
69
+ */
70
+ purchase(purchaseModel: PurchaseModel): Promise<Map<string, Entitlement>>;
71
+
72
+ /**
73
+ * Android only. Returns `null` if called on iOS.
74
+ *
75
+ * Update (upgrade/downgrade) subscription on Google Play Store and validate it through server-to-server using Qonversion's Backend.
76
+ *
77
+ * @deprecated Use {@link purchaseProduct} function instead.
78
+ * @param purchaseUpdateModel necessary information for purchase update
79
+ * @returns the promise with the user entitlements including updated ones.
80
+ * @see [Update policy](https://developer.android.com/google/play/billing/subscriptions#replacement-modes)
81
+ * @see [Making Purchases](https://documentation.qonversion.io/docs/making-purchases)
82
+ */
83
+ updatePurchase(purchaseUpdateModel: PurchaseUpdateModel): Promise<Map<string, Entitlement> | null>;
84
+
85
+ /**
86
+ * Returns Qonversion products in association with Apple and Google Play Store Products.
87
+ *
88
+ * @returns the promise with Qonversion products
89
+ */
90
+ products(): Promise<Map<string, Product>>;
91
+
92
+ /**
93
+ * Return Qonversion Offerings Object.
94
+ *
95
+ * An offering is a group of products that you can offer to a user on a given paywall based on your business logic.
96
+ * For example, you can offer one set of products on a paywall immediately after onboarding and another
97
+ * set of products with discounts later on if a user has not converted.
98
+ * Offerings allow changing the products offered remotely without releasing app updates.
99
+ *
100
+ * @returns the promise with Qonversion offerings
101
+ *
102
+ * @see [Offerings](https://qonversion.io/docs/offerings) for more details
103
+ */
104
+ offerings(): Promise<Offerings | null>;
105
+
106
+ /**
107
+ * You can check if a user is eligible for an introductory offer, including a free trial.
108
+ * You can show only a regular price for users who are not eligible for an introductory offer.
109
+ *
110
+ * @param ids products identifiers that must be checked
111
+ * @returns the promise with eligibility map
112
+ */
113
+ checkTrialIntroEligibility(ids: string[]): Promise<Map<string, IntroEligibility>>;
114
+
115
+ /**
116
+ * You need to call the checkEntitlements method to check if a user has the required entitlement.
117
+ *
118
+ * This method will check the user receipt and will return the current entitlements.
119
+ *
120
+ * @returns the promise with the entitlements
121
+ *
122
+ * If Apple or Google servers are not responding at the time of the request, Qonversion provides the latest
123
+ * entitlements' data from its database.
124
+ */
125
+ checkEntitlements(): Promise<Map<string, Entitlement>>;
126
+
127
+ /**
128
+ * Restores users purchases in your app, to maintain access to purchased content.
129
+ * Users sometimes need to restore purchased content, such as when they upgrade to a new phone.
130
+ *
131
+ * @returns the promise with the user entitlements
132
+ */
133
+ restore(): Promise<Map<string, Entitlement>>;
134
+
135
+ /**
136
+ * Android only. Does nothing if called on iOS.
137
+ *
138
+ * This method will send all purchases to the Qonversion backend. Call this every time when purchase is handled
139
+ * by your own implementation.
140
+ *
141
+ * **Warning!**
142
+ *
143
+ * This method works for Android only.
144
+ * It should only be called if you're using Qonversion SDK in observer mode.
145
+ *
146
+ * @see [Observer mode for Android SDK](https://documentation.qonversion.io/docs/observer-mode#android-sdk)
147
+ */
148
+ syncPurchases(): void;
149
+
150
+ /**
151
+ * Call this function to link a user to his unique ID in your system and share purchase data.
152
+ *
153
+ * @param userId unique user ID in your system
154
+ * @returns the promise with the information about the identified user.
155
+ */
156
+ identify(userId: string): Promise<User>;
157
+
158
+ /**
159
+ * Call this function to unlink a user from his unique ID in your system and his purchase data.
160
+ */
161
+ logout(): void;
162
+
163
+ /**
164
+ * This method returns information about the current Qonversion user.
165
+ * @returns the promise with the information about the user.
166
+ */
167
+ userInfo(): Promise<User>;
168
+
169
+ /**
170
+ * Sends your attribution {@link data} to the {@link provider}.
171
+ *
172
+ * @param data an object containing your attribution data
173
+ * @param provider the provider to which the data will be sent
174
+ */
175
+ attribution(data: Object, provider: AttributionProvider): void;
176
+
177
+ /**
178
+ * Sets Qonversion reserved user properties, like email or user id
179
+ *
180
+ * User properties are attributes you can set on a user level.
181
+ * You can send user properties to third party platforms as well as use them in Qonversion for customer segmentation
182
+ * and analytics.
183
+ *
184
+ * Note that using {@link UserPropertyKey.CUSTOM} here will do nothing.
185
+ * To set custom user property, use {@link setCustomUserProperty} method instead.
186
+ *
187
+ * @param key defined enum key that will be transformed to string.
188
+ * @param value property value.
189
+ *
190
+ * @see [documentation](https://documentation.qonversion.io/docs/user-properties)
191
+ */
192
+ setUserProperty(key: UserPropertyKey, value: string): void;
193
+
194
+ /**
195
+ * Adds custom user property.
196
+ *
197
+ * User properties are attributes you can set on a user level.
198
+ * You can send user properties to third party platforms as well as use them in Qonversion for customer segmentation
199
+ * and analytics.
200
+ *
201
+ * @param key custom user property key.
202
+ * @param value property value.
203
+ *
204
+ * @see [documentation](https://documentation.qonversion.io/docs/user-properties)
205
+ */
206
+ setCustomUserProperty(key: string, value: string): void;
207
+
208
+ /**
209
+ * This method returns all the properties, set for the current Qonversion user.
210
+ * All set properties are sent to the server with delay, so if you call
211
+ * this function right after setting some property, it may not be included
212
+ * in the result.
213
+ * @returns the promise with the user properties
214
+ */
215
+ userProperties(): Promise<UserProperties>;
216
+
217
+ /**
218
+ * Provide a listener to be notified about asynchronous user entitlements updates.
219
+ *
220
+ * Make sure you provide this listener for being up-to-date with the user entitlements.
221
+ * Else you can lose some important updates. Also, please, consider that this listener
222
+ * should live for the whole lifetime of the application.
223
+ *
224
+ * You may set entitlements listener both *after* Qonversion SDK initializing
225
+ * with {@link QonversionApi.setEntitlementsUpdateListener} and *while* Qonversion initializing
226
+ * with {@link Qonversion.initialize}.
227
+ *
228
+ * @param listener listener to be called when entitlements update
229
+ */
230
+ setEntitlementsUpdateListener(listener: EntitlementsUpdateListener): void;
231
+
232
+ /**
233
+ * iOS only. Does nothing if called on Android.
234
+ *
235
+ * On iOS 14.5+, after requesting the app tracking permission using ATT, you need to notify Qonversion if tracking
236
+ * is allowed and IDFA is available.
237
+ */
238
+ collectAdvertisingId(): void;
239
+
240
+ /**
241
+ * iOS only. Does nothing if called on Android.
242
+ *
243
+ * Enable attribution collection from Apple Search Ads.
244
+ */
245
+ collectAppleSearchAdsAttribution(): void;
246
+
247
+ /**
248
+ * iOS only. Does nothing if called on Android.
249
+ *
250
+ * Set the delegate to handle promo purchases.
251
+ * The delegate is called when a promo purchase from the App Store happens.
252
+ * @param delegate delegate to be called when event happens.
253
+ */
254
+ setPromoPurchasesDelegate(delegate: PromoPurchasesListener): void;
255
+
256
+ /**
257
+ * iOS only. Does nothing if called on Android.
258
+ *
259
+ * On iOS 14.0+ shows up a sheet for users to redeem App Store offer codes.
260
+ */
261
+ presentCodeRedemptionSheet(): void;
262
+
263
+ /**
264
+ * Returns Qonversion remote config object by {@link contextKey} or default one if the key is not specified.
265
+ * Use this function to get the remote config with specific payload and experiment info.
266
+ * @returns the promise with the remote config.
267
+ */
268
+ remoteConfig(contextKey: string | undefined): Promise<RemoteConfig>
269
+
270
+ /**
271
+ * Returns Qonversion remote config objects for all existing context key (including empty one).
272
+ * Use this function to get the remote config with specific payload and experiment info.
273
+ * @returns the promise with the remote config list.
274
+ */
275
+ remoteConfigList(): Promise<RemoteConfigList>
276
+
277
+ /**
278
+ * Returns Qonversion remote config objects by a list of {@link contextKeys}.
279
+ * Use this function to get the remote config with specific payload and experiment info.
280
+ * @param contextKeys list of context keys to load remote configs for
281
+ * @param includeEmptyContextKey set to true if you want to include remote config with empty context key to the result
282
+ * @returns the promise with the remote config list.
283
+ */
284
+ remoteConfigListForContextKeys(contextKeys: string[], includeEmptyContextKey: boolean): Promise<RemoteConfigList>
285
+
286
+ /**
287
+ * This function should be used for the test purposes only. Do not forget to delete the usage of this function before the release.
288
+ * Use this function to attach the user to the experiment.
289
+ * @param experimentId identifier of the experiment
290
+ * @param groupId identifier of the experiment group
291
+ * @returns the promise for success result or throws an error otherwise.
292
+ */
293
+ attachUserToExperiment(experimentId: string, groupId: string): Promise<void>
294
+
295
+ /**
296
+ * This function should be used for the test purposes only. Do not forget to delete the usage of this function before the release.
297
+ * Use this function to detach the user from the experiment.
298
+ * @param experimentId identifier of the experiment
299
+ * @returns the promise for success result or throws an error otherwise.
300
+ */
301
+ detachUserFromExperiment(experimentId: string): Promise<void>
302
+
303
+ /**
304
+ * This function should be used for the test purposes only. Do not forget to delete the usage of this function before the release.
305
+ * Use this function to attach the user to the remote configuration.
306
+ * @param remoteConfigurationId identifier of the remote configuration
307
+ * @returns the promise for success result or throws an error otherwise.
308
+ */
309
+ attachUserToRemoteConfiguration(remoteConfigurationId: string): Promise<void>
310
+
311
+ /**
312
+ * This function should be used for the test purposes only. Do not forget to delete the usage of this function before the release.
313
+ * Use this function to detach the user from the remote configuration.
314
+ * @param remoteConfigurationId identifier of the remote configuration
315
+ * @returns the promise for success result or throws an error otherwise.
316
+ */
317
+ detachUserFromRemoteConfiguration(remoteConfigurationId: string): Promise<void>
318
+ }
@@ -0,0 +1,32 @@
1
+ import {EntitlementsCacheLifetime, Environment, LaunchMode} from './dto/enums';
2
+ import type {EntitlementsUpdateListener} from './dto/EntitlementsUpdateListener';
3
+
4
+ class QonversionConfig {
5
+ readonly projectKey: string;
6
+ readonly launchMode: LaunchMode;
7
+ readonly environment: Environment;
8
+ readonly entitlementsCacheLifetime: EntitlementsCacheLifetime;
9
+ readonly entitlementsUpdateListener: EntitlementsUpdateListener | undefined;
10
+ readonly proxyUrl: string | undefined;
11
+ readonly kidsMode: boolean;
12
+
13
+ constructor(
14
+ projectKey: string,
15
+ launchMode: LaunchMode,
16
+ environment: Environment = Environment.PRODUCTION,
17
+ entitlementsCacheLifetime: EntitlementsCacheLifetime = EntitlementsCacheLifetime.MONTH,
18
+ entitlementsUpdateListener: EntitlementsUpdateListener | undefined = undefined,
19
+ proxyUrl: string | undefined,
20
+ kidsMode: boolean = false
21
+ ) {
22
+ this.projectKey = projectKey;
23
+ this.launchMode = launchMode;
24
+ this.environment = environment;
25
+ this.entitlementsCacheLifetime = entitlementsCacheLifetime;
26
+ this.entitlementsUpdateListener = entitlementsUpdateListener;
27
+ this.proxyUrl = proxyUrl;
28
+ this.kidsMode = kidsMode;
29
+ }
30
+ }
31
+
32
+ export default QonversionConfig;
@@ -0,0 +1,102 @@
1
+ import {EntitlementsCacheLifetime, Environment, LaunchMode} from './dto/enums';
2
+ import type {EntitlementsUpdateListener} from './dto/EntitlementsUpdateListener';
3
+ import QonversionConfig from './QonversionConfig';
4
+
5
+ class QonversionConfigBuilder {
6
+ private readonly projectKey: string;
7
+ private readonly launchMode: LaunchMode;
8
+
9
+ constructor(projectKey: string, launchMode: LaunchMode) {
10
+ this.projectKey = projectKey;
11
+ this.launchMode = launchMode;
12
+ }
13
+
14
+ private environment: Environment = Environment.PRODUCTION;
15
+ private entitlementsCacheLifetime: EntitlementsCacheLifetime = EntitlementsCacheLifetime.MONTH;
16
+ private entitlementsUpdateListener: EntitlementsUpdateListener | undefined = undefined;
17
+ private proxyUrl: string | undefined = undefined;
18
+ private kidsMode: boolean = false;
19
+
20
+ /**
21
+ * Set current application {@link Environment}. Used to distinguish sandbox and production users.
22
+ *
23
+ * @param environment current environment.
24
+ * @return builder instance for chain calls.
25
+ */
26
+ setEnvironment(environment: Environment): QonversionConfigBuilder {
27
+ this.environment = environment;
28
+ return this;
29
+ }
30
+
31
+ /**
32
+ * Entitlements cache is used when there are problems with the Qonversion API
33
+ * or internet connection. If so, Qonversion will return the last successfully loaded
34
+ * entitlements. The current method allows you to configure how long that cache may be used.
35
+ * The default value is {@link EntitlementsCacheLifetime.MONTH}.
36
+ *
37
+ * @param lifetime desired entitlements cache lifetime duration
38
+ * @return builder instance for chain calls.
39
+ */
40
+ setEntitlementsCacheLifetime(lifetime: EntitlementsCacheLifetime): QonversionConfigBuilder {
41
+ this.entitlementsCacheLifetime = lifetime;
42
+ return this;
43
+ }
44
+
45
+ /**
46
+ * Provide a listener to be notified about asynchronous user entitlements updates.
47
+ *
48
+ * Make sure you provide this listener for being up-to-date with the user entitlements.
49
+ * Else you can lose some important updates. Also, please, consider that this listener
50
+ * should live for the whole lifetime of the application.
51
+ *
52
+ * @param entitlementsUpdateListener listener to be called when entitlements update.
53
+ * @return builder instance for chain calls.
54
+ */
55
+ setEntitlementsUpdateListener(entitlementsUpdateListener: EntitlementsUpdateListener): QonversionConfigBuilder {
56
+ this.entitlementsUpdateListener = entitlementsUpdateListener;
57
+ return this;
58
+ }
59
+
60
+ /**
61
+ * Provide a URL to your proxy server which will redirect all the requests from the app
62
+ * to our API. Please, contact us before using this feature.
63
+ *
64
+ * @param url your proxy server url
65
+ * @return builder instance for chain calls.
66
+ * @see [The documentation](https://documentation.qonversion.io/docs/custom-proxy-server-for-sdks)
67
+ */
68
+ setProxyURL(url: string): QonversionConfigBuilder {
69
+ this.proxyUrl = url;
70
+ return this;
71
+ }
72
+
73
+ /**
74
+ * Android only.
75
+ * Use this function to enable Qonversion SDK Kids mode.
76
+ * With this mode activated, our SDK does not collect any information that violates Google Children’s Privacy Policy.
77
+ * @return builder instance for chain calls.
78
+ */
79
+ enableKidsMode(): QonversionConfigBuilder {
80
+ this.kidsMode = true;
81
+ return this;
82
+ }
83
+
84
+ /**
85
+ * Generate {@link QonversionConfig} instance with all the provided configurations.
86
+ *
87
+ * @return the complete {@link QonversionConfig} instance.
88
+ */
89
+ build(): QonversionConfig {
90
+ return new QonversionConfig(
91
+ this.projectKey,
92
+ this.launchMode,
93
+ this.environment,
94
+ this.entitlementsCacheLifetime,
95
+ this.entitlementsUpdateListener,
96
+ this.proxyUrl,
97
+ this.kidsMode
98
+ )
99
+ }
100
+ }
101
+
102
+ export default QonversionConfigBuilder;
@@ -0,0 +1,57 @@
1
+ import {EntitlementSource, EntitlementRenewState, EntitlementGrantType} from "./enums";
2
+ import Transaction from "./Transaction";
3
+
4
+ class Entitlement {
5
+ id: string;
6
+ productId: string;
7
+ isActive: boolean;
8
+ renewState: EntitlementRenewState;
9
+ source: EntitlementSource;
10
+ startedDate: Date;
11
+ renewsCount: number;
12
+ grantType: EntitlementGrantType;
13
+ transactions: Array<Transaction>;
14
+ expirationDate?: Date;
15
+ trialStartDate?: Date;
16
+ firstPurchaseDate?: Date;
17
+ lastPurchaseDate?: Date;
18
+ autoRenewDisableDate?: Date;
19
+ lastActivatedOfferCode?: string;
20
+
21
+ constructor(
22
+ id: string,
23
+ productId: string,
24
+ isActive: boolean,
25
+ renewState: EntitlementRenewState,
26
+ source: EntitlementSource,
27
+ startedTimestamp: number,
28
+ renewsCount: number,
29
+ grantType: EntitlementGrantType,
30
+ transactions: Array<Transaction>,
31
+ expirationTimestamp: number | undefined,
32
+ trialStartTimestamp: number | undefined,
33
+ firstPurchaseTimestamp: number | undefined,
34
+ lastPurchaseTimestamp: number | undefined,
35
+ autoRenewDisableTimestamp: number | undefined,
36
+ lastActivatedOfferCode: string | undefined,
37
+ ) {
38
+ this.id = id;
39
+ this.productId = productId;
40
+ this.isActive = isActive;
41
+ this.renewState = renewState;
42
+ this.source = source;
43
+ this.startedDate = new Date(startedTimestamp);
44
+ this.expirationDate = expirationTimestamp ? new Date(expirationTimestamp) : undefined;
45
+ this.renewsCount = renewsCount;
46
+ this.grantType = grantType;
47
+ this.transactions = transactions;
48
+ this.expirationDate = expirationTimestamp ? new Date(expirationTimestamp) : undefined;
49
+ this.trialStartDate = trialStartTimestamp ? new Date(trialStartTimestamp) : undefined;
50
+ this.firstPurchaseDate = firstPurchaseTimestamp ? new Date(firstPurchaseTimestamp) : undefined;
51
+ this.lastPurchaseDate = lastPurchaseTimestamp ? new Date(lastPurchaseTimestamp) : undefined;
52
+ this.autoRenewDisableDate = autoRenewDisableTimestamp ? new Date(autoRenewDisableTimestamp) : undefined;
53
+ this.lastActivatedOfferCode = lastActivatedOfferCode;
54
+ }
55
+ }
56
+
57
+ export default Entitlement;
@@ -0,0 +1,11 @@
1
+ import Entitlement from './Entitlement';
2
+
3
+ export interface EntitlementsUpdateListener {
4
+
5
+ /**
6
+ * Called when entitlements update.
7
+ * For example, when pending purchases like SCA, Ask to buy, etc., happen.
8
+ * @param entitlements all the client's entitlements after update.
9
+ */
10
+ onEntitlementsUpdated(entitlements: Map<string, Entitlement>): void;
11
+ }
@@ -0,0 +1,15 @@
1
+ import ExperimentGroup from "./ExperimentGroup";
2
+
3
+ class Experiment {
4
+ id: string;
5
+ name: string;
6
+ group: ExperimentGroup;
7
+
8
+ constructor(id: string, name: string, group: ExperimentGroup) {
9
+ this.id = id;
10
+ this.name = name;
11
+ this.group = group;
12
+ }
13
+ }
14
+
15
+ export default Experiment;
@@ -0,0 +1,15 @@
1
+ import { ExperimentGroupType } from "./enums";
2
+
3
+ class ExperimentGroup {
4
+ id: string;
5
+ name: string;
6
+ type: ExperimentGroupType;
7
+
8
+ constructor(id: string, name: string, type: ExperimentGroupType) {
9
+ this.id = id;
10
+ this.name = name;
11
+ this.type = type;
12
+ }
13
+ }
14
+
15
+ export default ExperimentGroup;
@@ -0,0 +1,11 @@
1
+ import { IntroEligibilityStatus } from "./enums";
2
+
3
+ class IntroEligibility {
4
+ status?: IntroEligibilityStatus;
5
+
6
+ constructor(status: IntroEligibilityStatus | undefined) {
7
+ this.status = status;
8
+ }
9
+ }
10
+
11
+ export default IntroEligibility;
@@ -0,0 +1,21 @@
1
+ import {ActionType} from "./enums";
2
+ import NoCodesError from './NoCodesError';
3
+
4
+ class NoCodesAction {
5
+
6
+ type: ActionType;
7
+ value: Map<string, string | undefined> | undefined;
8
+ error: NoCodesError | undefined;
9
+
10
+ constructor(
11
+ type: ActionType,
12
+ value: Map<string, string | undefined> | undefined,
13
+ error: NoCodesError | undefined,
14
+ ) {
15
+ this.type = type;
16
+ this.value = value;
17
+ this.error = error;
18
+ }
19
+ }
20
+
21
+ export default NoCodesAction;
@@ -0,0 +1,26 @@
1
+ import {NoCodesErrorCode} from './enums';
2
+ import QonversionError from './QonversionError';
3
+
4
+ class NoCodesError {
5
+ code: NoCodesErrorCode;
6
+ description?: string | null;
7
+ additionalMessage?: string | null;
8
+ domain?: string | null;
9
+ error?: QonversionError;
10
+
11
+ constructor(
12
+ code: NoCodesErrorCode,
13
+ description?: string | null,
14
+ additionalMessage?: string | null,
15
+ domain?: string | null,
16
+ error?: QonversionError,
17
+ ) {
18
+ this.code = code;
19
+ this.domain = domain;
20
+ this.description = description;
21
+ this.additionalMessage = additionalMessage;
22
+ this.error = error;
23
+ }
24
+ }
25
+
26
+ export default NoCodesError;
@@ -0,0 +1,39 @@
1
+ import NoCodesAction from './NoCodesAction';
2
+ import NoCodesError from './NoCodesError';
3
+
4
+ export interface NoCodesListener {
5
+ /**
6
+ * Called when No-Codes screen is shown
7
+ * @param id screen identifier
8
+ */
9
+ onScreenShown: (id: string) => void;
10
+
11
+ /**
12
+ * Called when No-Codes starts executing action
13
+ * @param action No-Codes action
14
+ */
15
+ onActionStartedExecuting: (action: NoCodesAction) => void;
16
+
17
+ /**
18
+ * Called when No-Codes fails to execute action
19
+ * @param action No-Codes action
20
+ */
21
+ onActionFailedToExecute: (action: NoCodesAction) => void;
22
+
23
+ /**
24
+ * Called when No-Codes finishes executing action
25
+ * @param action No-Codes action
26
+ */
27
+ onActionFinishedExecuting: (action: NoCodesAction) => void;
28
+
29
+ /**
30
+ * Called when No-Codes flow is finished
31
+ */
32
+ onFinished: () => void;
33
+
34
+ /**
35
+ * Called when No-Codes fails to load screen
36
+ * @param error error that occurred
37
+ */
38
+ onScreenFailedToLoad: (error: NoCodesError) => void;
39
+ }
@@ -0,0 +1,20 @@
1
+ import type { OfferingTags } from "./enums";
2
+ import Product from "./Product";
3
+
4
+ class Offering {
5
+ id: string;
6
+ tag: OfferingTags;
7
+ products: Array<Product>;
8
+
9
+ constructor(id: string, tag: OfferingTags, products: Product[]) {
10
+ this.id = id;
11
+ this.tag = tag;
12
+ this.products = products;
13
+ }
14
+
15
+ productForIdentifier(identifier: string): Product | undefined {
16
+ return this.products.find((object) => object.qonversionId === identifier);
17
+ }
18
+ }
19
+
20
+ export default Offering;