@tyrads.com/tyrads-sdk 3.0.0-beta.0 → 3.2.0-beta.0

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 (289) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/tyradssdk/TyradsSdkModule.kt +130 -29
  3. package/ios/Tyrads/AcmoAssets.swift +14 -0
  4. package/ios/Tyrads/ApiHeaders.swift +1 -0
  5. package/ios/Tyrads/InitModel.swift +3 -0
  6. package/ios/Tyrads/Tyrads.swift +255 -213
  7. package/ios/Tyrads/WebViewController.swift +195 -0
  8. package/ios/Tyrads/core/utils/AcmoKeyNames.swift +29 -0
  9. package/ios/Tyrads/core/utils/ColorExtension.swift +55 -0
  10. package/ios/Tyrads/core/utils/Services/LocalizationService.swift +175 -0
  11. package/ios/Tyrads/helpers/device_details.swift +160 -0
  12. package/ios/Tyrads/legal/AcmoPrivacyPage.swift +353 -0
  13. package/ios/Tyrads/legal/PrivacyPageController.swift +31 -0
  14. package/ios/Tyrads/user/AcmoUserUpdatePage.swift +302 -0
  15. package/ios/Tyrads/user/AcmoUsersUpdateController.swift +26 -0
  16. package/ios/Tyrads/user/Repository.swift +89 -0
  17. package/ios/TyradsSdk.mm +22 -4
  18. package/ios/TyradsSdk.swift +101 -31
  19. package/lib/commonjs/acmo/core/helpers/launcher.js +20 -0
  20. package/lib/commonjs/acmo/core/helpers/launcher.js.map +1 -0
  21. package/lib/commonjs/acmo/core/helpers/native_methods.js +37 -0
  22. package/lib/commonjs/acmo/core/helpers/native_methods.js.map +1 -0
  23. package/lib/commonjs/acmo/core/helpers/numeral.js +19 -0
  24. package/lib/commonjs/acmo/core/helpers/numeral.js.map +1 -0
  25. package/lib/commonjs/acmo/core/services/localization_service.js +164 -0
  26. package/lib/commonjs/acmo/core/services/localization_service.js.map +1 -0
  27. package/lib/commonjs/acmo/core/storage/storage.js +15 -1
  28. package/lib/commonjs/acmo/core/storage/storage.js.map +1 -1
  29. package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js +79 -0
  30. package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js.map +1 -0
  31. package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js +7 -10
  32. package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js.map +1 -1
  33. package/lib/commonjs/acmo/modules/dashboard/components/custom_scroller.js +141 -0
  34. package/lib/commonjs/acmo/modules/dashboard/components/custom_scroller.js.map +1 -0
  35. package/lib/commonjs/acmo/{core/marquee.js → modules/dashboard/components/custom_shimmer.js} +46 -34
  36. package/lib/commonjs/acmo/modules/dashboard/components/custom_shimmer.js.map +1 -0
  37. package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js +263 -0
  38. package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js.map +1 -0
  39. package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js +203 -0
  40. package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js.map +1 -0
  41. package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js +87 -0
  42. package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js.map +1 -0
  43. package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js +16 -14
  44. package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js.map +1 -1
  45. package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js +111 -0
  46. package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js.map +1 -0
  47. package/lib/commonjs/acmo/modules/dashboard/repository.js +108 -32
  48. package/lib/commonjs/acmo/modules/dashboard/repository.js.map +1 -1
  49. package/lib/commonjs/acmo/modules/dashboard/top_offers.js +85 -63
  50. package/lib/commonjs/acmo/modules/dashboard/top_offers.js.map +1 -1
  51. package/lib/commonjs/acmo/modules/localization/localization_context.js +56 -0
  52. package/lib/commonjs/acmo/modules/localization/localization_context.js.map +1 -0
  53. package/lib/commonjs/assets/images/angle_up.png +0 -0
  54. package/lib/commonjs/assets/images/diamond.png +0 -0
  55. package/lib/commonjs/assets/images/info.png +0 -0
  56. package/lib/commonjs/assets/images/info_icon.png +0 -0
  57. package/lib/commonjs/assets/images/premium-emptybg.jpeg +0 -0
  58. package/lib/commonjs/assets/images/rank_1.png +0 -0
  59. package/lib/commonjs/assets/images/rank_2.png +0 -0
  60. package/lib/commonjs/assets/images/rank_3.png +0 -0
  61. package/lib/commonjs/assets/images/rank_4.png +0 -0
  62. package/lib/commonjs/assets/images/rank_5.png +0 -0
  63. package/lib/commonjs/index.js +50 -16
  64. package/lib/commonjs/index.js.map +1 -1
  65. package/lib/module/acmo/core/helpers/launcher.js +15 -0
  66. package/lib/module/acmo/core/helpers/launcher.js.map +1 -0
  67. package/lib/module/acmo/core/helpers/native_methods.js +33 -0
  68. package/lib/module/acmo/core/helpers/native_methods.js.map +1 -0
  69. package/lib/module/acmo/core/helpers/numeral.js +14 -0
  70. package/lib/module/acmo/core/helpers/numeral.js.map +1 -0
  71. package/lib/module/acmo/core/services/localization_service.js +159 -0
  72. package/lib/module/acmo/core/services/localization_service.js.map +1 -0
  73. package/lib/module/acmo/core/storage/storage.js +13 -0
  74. package/lib/module/acmo/core/storage/storage.js.map +1 -1
  75. package/lib/module/acmo/modules/dashboard/components/active_offers_button.js +73 -0
  76. package/lib/module/acmo/modules/dashboard/components/active_offers_button.js.map +1 -0
  77. package/lib/module/acmo/modules/dashboard/components/custom_card.js +7 -10
  78. package/lib/module/acmo/modules/dashboard/components/custom_card.js.map +1 -1
  79. package/lib/module/acmo/modules/dashboard/components/custom_scroller.js +135 -0
  80. package/lib/module/acmo/modules/dashboard/components/custom_scroller.js.map +1 -0
  81. package/lib/module/acmo/modules/dashboard/components/custom_shimmer.js +66 -0
  82. package/lib/module/acmo/modules/dashboard/components/custom_shimmer.js.map +1 -0
  83. package/lib/module/acmo/modules/dashboard/components/offer_card.js +257 -0
  84. package/lib/module/acmo/modules/dashboard/components/offer_card.js.map +1 -0
  85. package/lib/module/acmo/modules/dashboard/components/offer_list_item.js +197 -0
  86. package/lib/module/acmo/modules/dashboard/components/offer_list_item.js.map +1 -0
  87. package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js +82 -0
  88. package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js.map +1 -0
  89. package/lib/module/acmo/modules/dashboard/components/premium_header.js +16 -14
  90. package/lib/module/acmo/modules/dashboard/components/premium_header.js.map +1 -1
  91. package/lib/module/acmo/modules/dashboard/components/premium_loading.js +106 -0
  92. package/lib/module/acmo/modules/dashboard/components/premium_loading.js.map +1 -0
  93. package/lib/module/acmo/modules/dashboard/repository.js +105 -30
  94. package/lib/module/acmo/modules/dashboard/repository.js.map +1 -1
  95. package/lib/module/acmo/modules/dashboard/top_offers.js +86 -64
  96. package/lib/module/acmo/modules/dashboard/top_offers.js.map +1 -1
  97. package/lib/module/acmo/modules/localization/localization_context.js +45 -0
  98. package/lib/module/acmo/modules/localization/localization_context.js.map +1 -0
  99. package/lib/module/assets/images/angle_up.png +0 -0
  100. package/lib/module/assets/images/diamond.png +0 -0
  101. package/lib/module/assets/images/info.png +0 -0
  102. package/lib/module/assets/images/info_icon.png +0 -0
  103. package/lib/module/assets/images/premium-emptybg.jpeg +0 -0
  104. package/lib/module/assets/images/rank_1.png +0 -0
  105. package/lib/module/assets/images/rank_2.png +0 -0
  106. package/lib/module/assets/images/rank_3.png +0 -0
  107. package/lib/module/assets/images/rank_4.png +0 -0
  108. package/lib/module/assets/images/rank_5.png +0 -0
  109. package/lib/module/index.js +49 -17
  110. package/lib/module/index.js.map +1 -1
  111. package/lib/typescript/commonjs/src/acmo/core/helpers/launcher.d.ts +3 -0
  112. package/lib/typescript/commonjs/src/acmo/core/helpers/launcher.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts +6 -0
  114. package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/src/acmo/core/helpers/numeral.d.ts +2 -0
  116. package/lib/typescript/commonjs/src/acmo/core/helpers/numeral.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts +18 -0
  118. package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/src/acmo/core/storage/storage.d.ts +1 -0
  120. package/lib/typescript/commonjs/src/acmo/core/storage/storage.d.ts.map +1 -1
  121. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/active_offers_button.d.ts +9 -0
  122. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_card.d.ts.map +1 -1
  124. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_scroller.d.ts +17 -0
  125. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_shimmer.d.ts +11 -0
  127. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_card.d.ts +12 -0
  129. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_card.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts +15 -0
  131. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts +7 -0
  133. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
  135. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts +8 -0
  136. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +1 -0
  137. package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts +2 -1
  138. package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
  139. package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts +8 -7
  140. package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
  141. package/lib/typescript/commonjs/src/acmo/modules/localization/localization_context.d.ts +14 -0
  142. package/lib/typescript/commonjs/src/acmo/modules/localization/localization_context.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/src/index.d.ts +8 -6
  144. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  145. package/lib/typescript/module/src/acmo/core/helpers/launcher.d.ts +3 -0
  146. package/lib/typescript/module/src/acmo/core/helpers/launcher.d.ts.map +1 -0
  147. package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts +6 -0
  148. package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts.map +1 -0
  149. package/lib/typescript/module/src/acmo/core/helpers/numeral.d.ts +2 -0
  150. package/lib/typescript/module/src/acmo/core/helpers/numeral.d.ts.map +1 -0
  151. package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts +18 -0
  152. package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts.map +1 -0
  153. package/lib/typescript/module/src/acmo/core/storage/storage.d.ts +1 -0
  154. package/lib/typescript/module/src/acmo/core/storage/storage.d.ts.map +1 -1
  155. package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts +9 -0
  156. package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +1 -0
  157. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_card.d.ts.map +1 -1
  158. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_scroller.d.ts +17 -0
  159. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +1 -0
  160. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_shimmer.d.ts +11 -0
  161. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +1 -0
  162. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_card.d.ts +12 -0
  163. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_card.d.ts.map +1 -0
  164. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts +15 -0
  165. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +1 -0
  166. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts +7 -0
  167. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +1 -0
  168. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
  169. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts +8 -0
  170. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +1 -0
  171. package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts +2 -1
  172. package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
  173. package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts +8 -7
  174. package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
  175. package/lib/typescript/module/src/acmo/modules/localization/localization_context.d.ts +14 -0
  176. package/lib/typescript/module/src/acmo/modules/localization/localization_context.d.ts.map +1 -0
  177. package/lib/typescript/module/src/index.d.ts +8 -6
  178. package/lib/typescript/module/src/index.d.ts.map +1 -1
  179. package/package.json +3 -6
  180. package/readme.md +8 -8
  181. package/src/acmo/core/helpers/launcher.ts +14 -0
  182. package/src/acmo/core/helpers/native_methods.ts +43 -0
  183. package/src/acmo/core/helpers/numeral.ts +14 -0
  184. package/src/acmo/core/services/localization_service.ts +200 -0
  185. package/src/acmo/core/storage/storage.ts +14 -0
  186. package/src/acmo/core/types/types.d.ts +11 -13
  187. package/src/acmo/modules/dashboard/components/active_offers_button.tsx +62 -0
  188. package/src/acmo/modules/dashboard/components/custom_card.tsx +5 -8
  189. package/src/acmo/modules/dashboard/components/custom_scroller.tsx +164 -0
  190. package/src/acmo/modules/dashboard/components/custom_shimmer.tsx +75 -0
  191. package/src/acmo/modules/dashboard/components/offer_card.tsx +248 -0
  192. package/src/acmo/modules/dashboard/components/offer_list_item.tsx +228 -0
  193. package/src/acmo/modules/dashboard/components/premium_empty_widget.tsx +79 -0
  194. package/src/acmo/modules/dashboard/components/premium_header.tsx +14 -13
  195. package/src/acmo/modules/dashboard/components/premium_loading.tsx +72 -0
  196. package/src/acmo/modules/dashboard/repository.ts +121 -46
  197. package/src/acmo/modules/dashboard/top_offers.tsx +105 -53
  198. package/src/acmo/modules/localization/localization_context.tsx +52 -0
  199. package/src/assets/images/angle_up.png +0 -0
  200. package/src/assets/images/diamond.png +0 -0
  201. package/src/assets/images/info.png +0 -0
  202. package/src/assets/images/info_icon.png +0 -0
  203. package/src/assets/images/premium-emptybg.jpeg +0 -0
  204. package/src/assets/images/rank_1.png +0 -0
  205. package/src/assets/images/rank_2.png +0 -0
  206. package/src/assets/images/rank_3.png +0 -0
  207. package/src/assets/images/rank_4.png +0 -0
  208. package/src/assets/images/rank_5.png +0 -0
  209. package/src/index.tsx +76 -34
  210. package/lib/commonjs/acmo/core/marquee.js.map +0 -1
  211. package/lib/commonjs/acmo/modules/dashboard/components/auto_scroller.js +0 -87
  212. package/lib/commonjs/acmo/modules/dashboard/components/auto_scroller.js.map +0 -1
  213. package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js +0 -48
  214. package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js.map +0 -1
  215. package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js +0 -158
  216. package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js.map +0 -1
  217. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js +0 -180
  218. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js.map +0 -1
  219. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js +0 -102
  220. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js.map +0 -1
  221. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js +0 -41
  222. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js.map +0 -1
  223. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js +0 -214
  224. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js.map +0 -1
  225. package/lib/commonjs/i18n.js +0 -112
  226. package/lib/commonjs/i18n.js.map +0 -1
  227. package/lib/module/acmo/core/marquee.js +0 -54
  228. package/lib/module/acmo/core/marquee.js.map +0 -1
  229. package/lib/module/acmo/modules/dashboard/components/auto_scroller.js +0 -81
  230. package/lib/module/acmo/modules/dashboard/components/auto_scroller.js.map +0 -1
  231. package/lib/module/acmo/modules/dashboard/components/my_games_button.js +0 -43
  232. package/lib/module/acmo/modules/dashboard/components/my_games_button.js.map +0 -1
  233. package/lib/module/acmo/modules/dashboard/components/offer_info_section.js +0 -153
  234. package/lib/module/acmo/modules/dashboard/components/offer_info_section.js.map +0 -1
  235. package/lib/module/acmo/modules/dashboard/components/premium_option_1.js +0 -174
  236. package/lib/module/acmo/modules/dashboard/components/premium_option_1.js.map +0 -1
  237. package/lib/module/acmo/modules/dashboard/components/premium_option_2.js +0 -97
  238. package/lib/module/acmo/modules/dashboard/components/premium_option_2.js.map +0 -1
  239. package/lib/module/acmo/modules/dashboard/components/premium_option_3.js +0 -36
  240. package/lib/module/acmo/modules/dashboard/components/premium_option_3.js.map +0 -1
  241. package/lib/module/acmo/modules/dashboard/components/premium_option_4.js +0 -209
  242. package/lib/module/acmo/modules/dashboard/components/premium_option_4.js.map +0 -1
  243. package/lib/module/i18n.js +0 -107
  244. package/lib/module/i18n.js.map +0 -1
  245. package/lib/typescript/commonjs/src/acmo/core/marquee.d.ts +0 -11
  246. package/lib/typescript/commonjs/src/acmo/core/marquee.d.ts.map +0 -1
  247. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/auto_scroller.d.ts +0 -10
  248. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/auto_scroller.d.ts.map +0 -1
  249. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts +0 -8
  250. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +0 -1
  251. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts +0 -11
  252. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +0 -1
  253. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts +0 -9
  254. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +0 -1
  255. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts +0 -9
  256. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +0 -1
  257. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts +0 -9
  258. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +0 -1
  259. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts +0 -9
  260. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +0 -1
  261. package/lib/typescript/commonjs/src/i18n.d.ts +0 -3
  262. package/lib/typescript/commonjs/src/i18n.d.ts.map +0 -1
  263. package/lib/typescript/module/src/acmo/core/marquee.d.ts +0 -11
  264. package/lib/typescript/module/src/acmo/core/marquee.d.ts.map +0 -1
  265. package/lib/typescript/module/src/acmo/modules/dashboard/components/auto_scroller.d.ts +0 -10
  266. package/lib/typescript/module/src/acmo/modules/dashboard/components/auto_scroller.d.ts.map +0 -1
  267. package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts +0 -8
  268. package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +0 -1
  269. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts +0 -11
  270. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +0 -1
  271. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts +0 -9
  272. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +0 -1
  273. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts +0 -9
  274. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +0 -1
  275. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts +0 -9
  276. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +0 -1
  277. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts +0 -9
  278. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +0 -1
  279. package/lib/typescript/module/src/i18n.d.ts +0 -3
  280. package/lib/typescript/module/src/i18n.d.ts.map +0 -1
  281. package/src/acmo/core/marquee.tsx +0 -62
  282. package/src/acmo/modules/dashboard/components/auto_scroller.tsx +0 -85
  283. package/src/acmo/modules/dashboard/components/my_games_button.tsx +0 -40
  284. package/src/acmo/modules/dashboard/components/offer_info_section.tsx +0 -139
  285. package/src/acmo/modules/dashboard/components/premium_option_1.tsx +0 -163
  286. package/src/acmo/modules/dashboard/components/premium_option_2.tsx +0 -100
  287. package/src/acmo/modules/dashboard/components/premium_option_3.tsx +0 -42
  288. package/src/acmo/modules/dashboard/components/premium_option_4.tsx +0 -185
  289. package/src/i18n.ts +0 -115
@@ -1,5 +1,6 @@
1
- import axios, { type AxiosResponse } from 'axios';
1
+ import axios from 'axios';
2
2
  import { getData } from '../../core/storage/storage';
3
+ import { acmoLaunchURLForce } from '../../core/helpers/launcher';
3
4
 
4
5
  interface ApiHeaders {
5
6
  languageCode: string;
@@ -12,28 +13,11 @@ interface ApiHeaders {
12
13
  userAgent: string;
13
14
  }
14
15
 
15
- const transformCampaigns = (campaigns: Campaign[]): TransformedCampaign[] => {
16
- return campaigns.map((campaign) => ({
17
- campaignId: campaign.campaignId || 0,
18
- appId: campaign.app?.id || 0,
19
- title: campaign.app?.title || 'Unknown Title',
20
- creativePackName:
21
- campaign.creative?.creativePacks?.[0]?.creativePackName || '',
22
- fileUrl:
23
- campaign.creative?.creativePacks?.[0]?.creatives?.[0]?.fileUrl || '',
24
- points: campaign.campaignPayout?.totalPayoutConverted || 0,
25
- rewards: campaign.campaignPayout?.totalEvents || 0,
26
- currency: campaign.currency || {},
27
- thumbnail: campaign.app?.thumbnail || '',
28
- premium: campaign.premium || false,
29
- sortingScore: campaign.sortingScore || 0,
30
- }));
31
- };
32
-
33
- export const fetchCampaignsData = async (
34
- // setLanguage: (language: string) => void,
16
+ export const fetchPremiumOfferDetails = async (
35
17
  setPremiumColor: (color: string) => void,
36
- setCampaigns: (campaigns: TransformedCampaign[]) => void,
18
+ setCampaigns: (campaigns: Campaign[]) => void,
19
+ setCurrencySale: (currencySale: CurrencySales) => void,
20
+ setActiveCount: (activeCount: number) => void,
37
21
  setError: (error: string) => void,
38
22
  setIsLoading: (loading: boolean) => void
39
23
  ): Promise<void> => {
@@ -41,11 +25,9 @@ export const fetchCampaignsData = async (
41
25
 
42
26
  try {
43
27
  const data: any = await getData('apiHeaders');
44
- if (!data) {
45
- throw new Error('apiHeaders data not found.');
46
- }
28
+ if (!data) throw new Error('apiHeaders data not found.');
29
+
47
30
  const parsedHeaderData: ApiHeaders = JSON.parse(data);
48
- // setLanguage(parsedHeaderData.languageCode);
49
31
  setPremiumColor(parsedHeaderData.premiumColor);
50
32
 
51
33
  const headers = {
@@ -59,37 +41,130 @@ export const fetchCampaignsData = async (
59
41
  'User-Agent': parsedHeaderData.userAgent,
60
42
  };
61
43
 
62
- const response: AxiosResponse<{ data: Campaign[] }> = await axios.get(
63
- `https://api.tyrads.com/v3.0/campaigns?lang=${parsedHeaderData.languageCode}`,
64
- {
65
- headers: headers,
66
- }
67
- );
44
+ const langParam = `?lang=${parsedHeaderData.languageCode}`;
68
45
 
69
- const transformedCampaigns = transformCampaigns(response.data.data);
46
+ const [campaignsRes, currencyRes, summaryRes] = await Promise.all([
47
+ axios.get<{ data: Campaign[] }>(`https://api.tyrads.com/v3.0/campaigns${langParam}`, { headers }),
48
+ axios.get<{ data: { CurrencySales: CurrencySales } }>(`https://api.tyrads.com/v3.0/engagement${langParam}`, { headers }),
49
+ axios.get<{ data: { activeCampaignCount: number } }>(`https://api.tyrads.com/v3.0/activated-campaigns/summary${langParam}`, { headers })
50
+ ]);
70
51
 
71
- const hotOffers = transformedCampaigns
72
- .sort((a, b) => {
73
- if (a.premium && !b.premium) return -1;
74
- if (!a.premium && b.premium) return 1;
75
- return b.sortingScore - a.sortingScore;
76
- })
77
- .filter((item) => item.points > 0)
78
- .slice(0, 5);
52
+ const hotOffers = campaignsRes.data.data
53
+ .sort((a, b) => {
54
+ if (a.premium && !b.premium) return -1;
55
+ if (!a.premium && b.premium) return 1;
56
+ return b.sortingScore - a.sortingScore;
57
+ })
58
+ .filter(item => item.campaignPayout.totalPlayablePayoutConverted > 0)
59
+ .slice(0, 5);
60
+ // const currency: CurrencySales = {
61
+ // "name": "Ramadhan Karem",
62
+ // "multiplier": 1.5,
63
+ // "bannerUrl": "",
64
+ // "dateStart": "2025-03-10T00:00:00.000Z",
65
+ // "dateEnd": "2025-03-10T23:59:59.000Z",
66
+ // remainingTimeSeconds: 3090
67
+ // };
79
68
 
80
69
  setCampaigns(hotOffers);
70
+
71
+ setCurrencySale(currencyRes.data.data.CurrencySales);
72
+
73
+ setActiveCount(summaryRes.data.data.activeCampaignCount);
81
74
  } catch (error: any) {
82
75
  if (axios.isAxiosError(error) && error.response) {
83
76
  console.log('Response Error:', error.response.data);
84
- console.log('Status Code:', error.response.status);
85
- console.log('Response Headers:', error.response.headers);
86
77
  } else if (axios.isAxiosError(error) && error.request) {
87
78
  console.log('No Response from API:', error.request);
88
79
  } else {
89
- console.log('Error setting up request:', error.message);
80
+ console.log('Request Setup Error:', error.message);
90
81
  }
91
- setError('Something went wrong, please try again');
82
+ setError('Something went wrong, please try again.');
92
83
  } finally {
93
84
  setIsLoading(false);
94
85
  }
95
- };
86
+ };
87
+
88
+ const track = async (activity: string) => {
89
+ const data: any = await getData('apiHeaders');
90
+ if (!data) throw new Error('apiHeaders data not found.');
91
+
92
+ const parsedHeaderData: ApiHeaders = JSON.parse(data);
93
+
94
+ const headers = {
95
+ 'Content-Type': 'application/json',
96
+ Accept: 'application/json',
97
+ 'X-User-ID': parsedHeaderData.xUserId,
98
+ 'X-API-Key': parsedHeaderData.xApiKey,
99
+ 'X-API-Secret': parsedHeaderData.xApiSecret,
100
+ 'X-SDK-Platform': parsedHeaderData.xSdkPlatform,
101
+ 'X-SDK-Version': parsedHeaderData.xSdkVersion,
102
+ 'User-Agent': parsedHeaderData.userAgent,
103
+ };
104
+ try {
105
+ const fd = {
106
+ "activity": activity
107
+ };
108
+ await axios.post('https://api.tyrads.com/v3.0/user-activities', fd, { headers });
109
+ } catch (error) {
110
+ if (axios.isAxiosError(error) && error.response) {
111
+ console.log('Response Error:', error.response.data);
112
+ } else if (axios.isAxiosError(error) && error.request) {
113
+ console.log('No Response from API:', error.request);
114
+ } else {
115
+ console.log('Request Setup Error:', error);
116
+ }
117
+ }
118
+ }
119
+
120
+ export const openOffer = async (campaign: Campaign) => {
121
+ const campaignId = campaign.campaignId;
122
+ const clickUrl = campaign.tracking.clickUrl;
123
+ const isRetryDownload = campaign.isRetryDownload;
124
+ const isInstalled = campaign.isInstalled;
125
+ const previewUrl = campaign.app.previewUrl;
126
+ const s2sClickUrl = campaign.tracking.s2sClickUrl;
127
+
128
+ const data: any = await getData('apiHeaders');
129
+ if (!data) throw new Error('apiHeaders data not found.');
130
+
131
+ const parsedHeaderData: ApiHeaders = JSON.parse(data);
132
+
133
+ const headers = {
134
+ 'Content-Type': 'application/json',
135
+ Accept: 'application/json',
136
+ 'X-User-ID': parsedHeaderData.xUserId,
137
+ 'X-API-Key': parsedHeaderData.xApiKey,
138
+ 'X-API-Secret': parsedHeaderData.xApiSecret,
139
+ 'X-SDK-Platform': parsedHeaderData.xSdkPlatform,
140
+ 'X-SDK-Version': parsedHeaderData.xSdkVersion,
141
+ 'User-Agent': parsedHeaderData.userAgent,
142
+ };
143
+
144
+ try {
145
+ var url = clickUrl;
146
+ if (isInstalled) {
147
+ url = previewUrl;
148
+ } else {
149
+ if (isRetryDownload) {
150
+ await track("CampaignActivatedRetry");
151
+ } else {
152
+ await track("CampaignActivated");
153
+ }
154
+ await axios.post(`https://api.tyrads.com/v3.0/campaigns/active/${campaignId}`, {}, { headers });
155
+ }
156
+ if (s2sClickUrl != null) {
157
+ const res = await axios.get(s2sClickUrl);
158
+ if (res.status == 200) {
159
+ // url = res.data.url;
160
+ return;
161
+ }
162
+ }
163
+ await acmoLaunchURLForce(url);
164
+ } catch (error) {
165
+ console.log('=============Error=============');
166
+ console.log(error);
167
+ console.log('====================================');
168
+ }
169
+ }
170
+
@@ -2,65 +2,95 @@ import React, { useState, useEffect } from 'react';
2
2
  import {
3
3
  View,
4
4
  Text,
5
- ActivityIndicator,
6
5
  StyleSheet,
7
6
  } from 'react-native';
8
- import { fetchCampaignsData } from './repository';
7
+ import { fetchPremiumOfferDetails, openOffer } from './repository';
9
8
  import PremiumHeaderSection from './components/premium_header';
10
9
  import CustomCard from './components/custom_card';
11
- import MyGamesButton from './components/my_games_button';
12
- import PremiumOption1 from './components/premium_option_1';
13
- import PremiumOption2 from './components/premium_option_2';
14
- import PremiumOption3 from './components/premium_option_3';
15
- import PremiumOption4 from './components/premium_option_4';
10
+ import ActiveOffersButton from './components/active_offers_button';
11
+ import { AcmoOfferListItem } from './components/offer_list_item';
12
+ import AcmoOfferCard from './components/offer_card';
13
+ import AcmoScrollPager from './components/custom_scroller';
14
+ import PremiumEmptyView from './components/premium_empty_widget';
15
+ import PremiumWidgetsLoading from './components/premium_loading';
16
+ import TyradsNativeMethods from '../../core/helpers/native_methods';
16
17
 
17
- interface TopOffersProps {
18
- showMore?: boolean;
19
- showMyOffers?: boolean;
20
- showMyOffersEmptyView?: boolean;
21
- style?: number;
18
+ export const enum PremiumWidgetStyles {
19
+ list,
20
+ sliderCards,
21
+ }
22
+
23
+ interface PremiumWidgetProps {
24
+ widgetStyle?: PremiumWidgetStyles;
22
25
  onNavigate: (route?: string, campaignID?: number) => void;
23
26
  }
24
27
 
25
- const TopOffers: React.FC<TopOffersProps> = ({
26
- showMore,
27
- showMyOffers = false,
28
- showMyOffersEmptyView = false,
29
- style = 1,
28
+ const PremiumWidgets: React.FC<PremiumWidgetProps> = ({
29
+ widgetStyle = PremiumWidgetStyles.list,
30
30
  onNavigate
31
31
  }) => {
32
- const [campaigns, setCampaigns] = useState<TransformedCampaign[]>([]);
32
+ const [campaigns, setCampaigns] = useState<Campaign[]>([]);
33
33
  const [isLoading, setIsLoading] = useState<boolean>(true);
34
34
  const [error, setError] = useState<string | null>(null);
35
35
  const [premiumColor, setPremiumColor] = useState<string>('#1C90DF');
36
- // const [language, setLanguage] = useState<string>('en');
36
+ const [currencySale, setCurrencySale] = useState<CurrencySales>();
37
+ const [activeCount, setActiveCount] = useState<number>(0);
38
+ const [loadingIndex, setLoadingIndex] = useState<number | null>(null);
37
39
 
38
40
  useEffect(() => {
39
- fetchCampaignsData(
40
- // setLanguage,
41
+ fetchPremiumOfferDetails(
41
42
  setPremiumColor,
42
43
  setCampaigns,
44
+ setCurrencySale,
45
+ setActiveCount,
43
46
  setError,
44
- setIsLoading
47
+ setIsLoading,
45
48
  );
49
+
46
50
  }, []);
47
51
 
48
52
  const handleShowOffers = () => {
49
53
  onNavigate();
50
54
  };
51
55
  const handleCampaignPress = (campaignId: number) => {
52
- onNavigate('campaign-details',campaignId );
56
+ onNavigate("offers", campaignId);
53
57
  };
54
58
 
55
- const handleMoreOffersPress = (route: string) => {
59
+ const handleActiveOffersPress = (route: string) => {
56
60
  onNavigate(route);
57
61
  };
58
62
 
63
+ const handleButtonPress = async (campaign: Campaign) => {
64
+ let isReady = await TyradsNativeMethods.isPrivacyAccepted()
65
+ if (!isReady) {
66
+ try {
67
+ const result = await TyradsNativeMethods.checkOnboardingProcess();
68
+ console.log("Privacy flow result:", result);
69
+ isReady = result === true;
70
+ } catch (err) {
71
+ console.error("Privacy flow error:", err);
72
+ isReady = false;
73
+ }
74
+ }
75
+ if (!isReady) {
76
+ return
77
+ }
78
+ await openOffer(campaign);
79
+ await fetchPremiumOfferDetails(
80
+ setPremiumColor,
81
+ setCampaigns,
82
+ setCurrencySale,
83
+ setActiveCount,
84
+ setError,
85
+ setIsLoading,
86
+ );
87
+ }
88
+
59
89
  if (isLoading) {
60
90
  return (
61
- <View style={styles.loadingContainer}>
62
- <ActivityIndicator size="large" color="#007AFF" />
63
- </View>
91
+ <PremiumWidgetsLoading
92
+ widgetStyle={widgetStyle}
93
+ />
64
94
  );
65
95
  }
66
96
 
@@ -72,53 +102,75 @@ const TopOffers: React.FC<TopOffersProps> = ({
72
102
  );
73
103
  }
74
104
 
105
+
75
106
  if (campaigns.length === 0) {
76
- if (showMyOffersEmptyView) {
77
- return (
78
- <View style={styles.noCampaignContainer}>
79
- <Text>No campaigns available</Text>
80
- </View>
81
- );
82
- } else {
83
- return <View />;
84
- }
107
+ return <PremiumEmptyView
108
+ colorPremium={premiumColor}
109
+ onContinue={handleShowOffers}
110
+ />
85
111
  }
86
112
 
87
113
  return (
88
- <CustomCard style={{}}>
114
+ <CustomCard style={{ flexDirection: 'row' }}>
89
115
  <View style={{ flex: 1 }}>
90
- <PremiumHeaderSection showMore={showMore} premiumColor={premiumColor} onShowOffers={handleShowOffers} />
116
+ <PremiumHeaderSection premiumColor={premiumColor} onShowOffers={handleShowOffers} />
91
117
  <View style={styles.headerSpacer} />
92
118
  {(() => {
93
- switch (style) {
94
- case 1:
95
- return (
96
- <PremiumOption1 data={campaigns} premiumColor={premiumColor} onCampaignPress={handleCampaignPress} />
97
- );
98
- case 2:
119
+ switch (widgetStyle) {
120
+ case PremiumWidgetStyles.list:
99
121
  return (
100
- <PremiumOption2 data={campaigns} premiumColor={premiumColor} onCampaignPress={handleCampaignPress} />
122
+ campaigns.map((item, index) => (
123
+ <AcmoOfferListItem
124
+ key={index}
125
+ onPress={async () => handleCampaignPress && handleCampaignPress(item.campaignId)}
126
+ offer={item}
127
+ currencySales={currencySale}
128
+ index={index}
129
+ loadingIndex={loadingIndex}
130
+ setLoadingIndex={setLoadingIndex}
131
+ colorPremium={premiumColor}
132
+ onButtonTap={async () => handleButtonPress(item)}
133
+ />
134
+ ))
101
135
  );
102
- case 3:
136
+ case PremiumWidgetStyles.sliderCards:
103
137
  return (
104
- <PremiumOption3 data={campaigns} premiumColor={premiumColor} onCampaignPress={handleCampaignPress} />
105
- );
106
- case 4:
107
- return (
108
- <PremiumOption4 data={campaigns} premiumColor={premiumColor} onCampaignPress={handleCampaignPress} />
138
+ <AcmoScrollPager
139
+ totalPages={campaigns.length}
140
+ activeIndicatorColor={premiumColor}
141
+ content={(index) => (
142
+ <AcmoOfferCard
143
+ item={campaigns[index]!}
144
+ onButtonClick={async () => handleButtonPress(campaigns[index]!)}
145
+ currencySaleModel={currencySale}
146
+ premiumColor={premiumColor}
147
+ isLoading={false}
148
+ onTap={async () => handleCampaignPress && handleCampaignPress(campaigns[index]!.campaignId)}
149
+ />
150
+ )}
151
+ />
109
152
  );
110
153
  default:
111
154
  return <Text>Please specify a correct style</Text>;
112
155
  }
113
156
  })()}
114
157
  <View style={styles.gameListSpacer} />
115
- {showMyOffers && <MyGamesButton premiumColor={premiumColor} onPress={handleMoreOffersPress}/>}
158
+ <ActiveOffersButton activeCount={activeCount} premiumColor={premiumColor} onPress={handleActiveOffersPress} />
116
159
  </View>
117
160
  </CustomCard>
118
161
  );
119
162
  };
120
163
 
121
164
  const styles = StyleSheet.create({
165
+ itemContainer: {
166
+ flexDirection: 'row',
167
+ flex: 1,
168
+ width: '100%',
169
+ justifyContent: 'space-between',
170
+ alignItems: 'center',
171
+ paddingHorizontal: 16,
172
+ paddingVertical: 8,
173
+ },
122
174
  loadingContainer: {
123
175
  flex: 1,
124
176
  justifyContent: 'center',
@@ -141,4 +193,4 @@ const styles = StyleSheet.create({
141
193
  },
142
194
  });
143
195
 
144
- export default TopOffers;
196
+ export default PremiumWidgets;
@@ -0,0 +1,52 @@
1
+ import React, { createContext, useContext, useState, useEffect } from 'react';
2
+ import LocalizationService from '../../core/services/localization_service';
3
+
4
+ interface LocalizationContextProps {
5
+ t: (key: string, args?: Record<string, string | number>) => string;
6
+ changeLanguage: (lang: string) => Promise<void>;
7
+ currentLanguage: string;
8
+ }
9
+
10
+ const LocalizationContext = createContext<LocalizationContextProps>({
11
+ t: (key) => key,
12
+ changeLanguage: async () => {},
13
+ currentLanguage: 'en',
14
+ });
15
+
16
+ let _updateLanguage: ((lang: string) => void) | null = null;
17
+
18
+ export const LocalizationProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
19
+ const [currentLanguage, setCurrentLanguage] = useState('en');
20
+ const service = LocalizationService.getInstance();
21
+
22
+ useEffect(() => {
23
+ _updateLanguage = setCurrentLanguage;
24
+ }, []);
25
+
26
+ const changeLanguage = async (lang: string) => {
27
+ await service.changeLanguage(lang);
28
+ setCurrentLanguage(lang);
29
+ };
30
+
31
+ const t = (key: string, args?: Record<string, string | number>) => service.translate(key, args);
32
+
33
+ return (
34
+ <LocalizationContext.Provider value={{ t, changeLanguage, currentLanguage }}>
35
+ {children}
36
+ </LocalizationContext.Provider>
37
+ );
38
+ };
39
+
40
+ export const useLocalization = () => useContext(LocalizationContext);
41
+
42
+ export const updateProviderLanguage = async (lang: string) => {
43
+ const service = LocalizationService.getInstance();
44
+ await service.init(lang);
45
+ _updateLanguage?.(lang);
46
+ };
47
+
48
+ export const changeProviderLanguage = async (lang: string) => {
49
+ const service = LocalizationService.getInstance();
50
+ await service.changeLanguage(lang);
51
+ _updateLanguage?.(lang);
52
+ };
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/src/index.tsx CHANGED
@@ -1,9 +1,10 @@
1
- import { NativeModules, Platform, View,} from 'react-native';
1
+ import { NativeEventEmitter, NativeModules, Platform, View, } from 'react-native';
2
2
 
3
- import TopOffers from './acmo/modules/dashboard/top_offers';
3
+ import TopOffers, { PremiumWidgetStyles } from './acmo/modules/dashboard/top_offers';
4
4
  import { saveData } from './acmo/core/storage/storage';
5
- import { I18nextProvider } from 'react-i18next';
6
- import i18n from './i18n';
5
+ import Localization from './acmo/core/services/localization_service';
6
+ import { changeProviderLanguage, LocalizationProvider, updateProviderLanguage } from './acmo/modules/localization/localization_context';
7
+ import PremiumWidgetsLoading from './acmo/modules/dashboard/components/premium_loading';
7
8
 
8
9
  // const TyradsSdkComposeView = requireNativeComponent('TyradsSdkComposeView');
9
10
 
@@ -17,23 +18,54 @@ const LINKING_ERROR =
17
18
  const TyradsSdk = NativeModules.TyradsSdk
18
19
  ? NativeModules.TyradsSdk
19
20
  : new Proxy(
20
- {},
21
- {
22
- get() {
23
- throw new Error(LINKING_ERROR);
24
- },
25
- }
26
- );
21
+ {},
22
+ {
23
+ get() {
24
+ throw new Error(LINKING_ERROR);
25
+ },
26
+ }
27
+ );
28
+
29
+ const tyradsEmitter = new NativeEventEmitter(TyradsSdk);
30
+
31
+ let languageChangedSubscription: any = null;
27
32
 
28
33
  const Tyrads = {
29
34
  init: async (apiKey: string, apiSecret: string, encKey?: string) => {
30
35
  const data = await TyradsSdk.init(apiKey, apiSecret, encKey);
36
+
37
+ await saveData("credentials", {
38
+ 'X-API-Key': apiKey,
39
+ 'X-API-Secret': apiSecret
40
+ });
41
+
42
+ let languageCode = "en";
43
+ try {
44
+ const parsed = typeof data === "string" ? JSON.parse(data) : data;
45
+ if (parsed?.languageCode) {
46
+ languageCode = parsed.languageCode;
47
+ }
48
+ } catch { }
49
+
50
+ TyradsSdk.startObserving();
51
+ languageChangedSubscription?.remove();
52
+ languageChangedSubscription = tyradsEmitter.addListener(
53
+ 'LanguageChanged',
54
+ async (lang: string) => {
55
+ console.log('LanguageChanged event from Android SDK:', lang);
56
+ await changeProviderLanguage(lang);
57
+ }
58
+ );
59
+
60
+ await saveData("language", languageCode);
61
+ await Localization.getInstance().init(languageCode);
62
+ await updateProviderLanguage(languageCode);
63
+
31
64
  return data;
32
65
  },
33
66
  loginUser: async (userId: string) => {
34
67
  try {
35
68
  const data = await TyradsSdk.loginUser(userId);
36
-
37
69
  if (typeof data === "object") {
38
70
  await saveData('apiHeaders', JSON.stringify(data));
39
71
  await saveData('language', data.languageCode);
@@ -41,54 +73,64 @@ const Tyrads = {
41
73
  await saveData('apiHeaders', data);
42
74
  await saveData('language', JSON.parse(data).languageCode);
43
75
  }
44
-
45
76
  return data;
46
77
  } catch (err) {
47
78
  return null;
48
79
  }
49
80
  },
50
-
81
+
51
82
  showOffers: async ({
52
83
  launchMode = 3,
53
84
  route,
54
- campaignID = 0,
55
- }: { launchMode?: number; route?: string; campaignID?: number } = {}) => {
85
+ campaignID,
86
+ }: { launchMode?: number; route?: string; campaignID?: number | null } = {}) => {
56
87
  if (Platform.OS === 'ios') {
57
- return await TyradsSdk.showOffers(launchMode, route, campaignID);
88
+ if (campaignID == null) {
89
+ return await TyradsSdk.showOffers(launchMode, route);
90
+ }
91
+ return await TyradsSdk.showOfferDetails(launchMode, route, campaignID);
58
92
  } else {
59
- return await TyradsSdk.showOffers(route, campaignID);
93
+ if (campaignID == null) {
94
+ return await TyradsSdk.showOffers(route);
95
+ }
96
+ return await TyradsSdk.showOfferDetails(route, campaignID);
60
97
  }
61
98
  },
62
99
  topPremiumOffers: ({
63
- showMore = true,
64
- showMyOffers = true,
65
- showMyOffersEmptyView = false,
66
- viewStyle = 1,
100
+ widgetStyle,
67
101
  launchMode = 2,
68
102
  }: {
69
- showMore?: boolean;
70
- showMyOffers?: boolean;
71
- showMyOffersEmptyView?: boolean;
72
- viewStyle?: number;
103
+ widgetStyle?: PremiumWidgetStyles;
73
104
  launchMode?: number;
74
105
  } = {}) => {
75
- const handleNavigation = (route?: string, campaignID?: number) => {
76
- Tyrads.showOffers({ route: route, campaignID: campaignID, launchMode: launchMode});
106
+ const handleNavigation = (route?: string, campaignID?: number | null) => {
107
+ Tyrads.showOffers({ route: route, campaignID: campaignID, launchMode: launchMode });
77
108
  };
78
109
  return (
79
- <I18nextProvider i18n={i18n}>
110
+ <LocalizationProvider>
80
111
  <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
81
112
  <TopOffers
82
- showMore={showMore}
83
- showMyOffers={showMyOffers}
84
- showMyOffersEmptyView={showMyOffersEmptyView}
85
- style={viewStyle}
113
+ widgetStyle={widgetStyle}
86
114
  onNavigate={handleNavigation}
87
115
  />
88
116
  </View>
89
- </I18nextProvider>
117
+ </LocalizationProvider>
90
118
  );
91
119
  },
120
+ topPremiumOffersLoading: (
121
+ { widgetStyle = PremiumWidgetStyles.list }: {
122
+ widgetStyle?: PremiumWidgetStyles;
123
+ }
124
+ ) => {
125
+ return (
126
+ <PremiumWidgetsLoading
127
+ widgetStyle={widgetStyle}
128
+ />
129
+ );
130
+ },
131
+ changeLanguage: async (lang: string) => {
132
+ return await TyradsSdk.changeLanguage(lang);
133
+ },
92
134
  };
93
135
 
94
136
  export default Tyrads;