@tyrads.com/tyrads-sdk 3.3.4 → 4.0.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 (429) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/tyradssdk/TyradsSdkModule.kt +161 -19
  3. package/ios/Tyrads/AcmoConfig.swift +1 -1
  4. package/ios/Tyrads/InitModel.swift +29 -15
  5. package/ios/Tyrads/Tyrads.swift +332 -274
  6. package/ios/Tyrads/WebViewController.swift +10 -17
  7. package/ios/Tyrads/core/models/TyradsUserInfo.swift +2 -0
  8. package/ios/Tyrads/core/utils/AcmoKeyNames.swift +1 -0
  9. package/ios/Tyrads/helpers/device_details.swift +122 -2
  10. package/ios/Tyrads/pushNotifications/APNsAppDelegateProxy.swift +37 -0
  11. package/ios/Tyrads/pushNotifications/APNsNotificationListener.swift +14 -0
  12. package/ios/Tyrads/pushNotifications/APNsNotificationManager.swift +68 -0
  13. package/ios/Tyrads/pushNotifications/APNsNotificationReceiver.swift +77 -0
  14. package/ios/Tyrads/pushNotifications/TyradsAPNsSwizzler.mm +179 -0
  15. package/ios/TyradsSdk-Bridging-Header.h +3 -0
  16. package/ios/TyradsSdk.mm +12 -1
  17. package/ios/TyradsSdk.swift +121 -4
  18. package/lib/commonjs/acmo/core/components/countdown-timer.js +48 -0
  19. package/lib/commonjs/acmo/core/components/countdown-timer.js.map +1 -0
  20. package/lib/commonjs/acmo/core/components/snap-carousel.js +86 -0
  21. package/lib/commonjs/acmo/core/components/snap-carousel.js.map +1 -0
  22. package/lib/commonjs/acmo/core/constants/api-endpoints.js +18 -0
  23. package/lib/commonjs/acmo/core/constants/api-endpoints.js.map +1 -0
  24. package/lib/commonjs/acmo/core/helpers/colors.js +20 -0
  25. package/lib/commonjs/acmo/core/helpers/colors.js.map +1 -0
  26. package/lib/commonjs/acmo/core/helpers/logger.js +18 -0
  27. package/lib/commonjs/acmo/core/helpers/logger.js.map +1 -0
  28. package/lib/commonjs/acmo/core/helpers/patches.js +7 -0
  29. package/lib/commonjs/acmo/core/helpers/patches.js.map +1 -0
  30. package/lib/commonjs/acmo/core/network/http-client.js +91 -0
  31. package/lib/commonjs/acmo/core/network/http-client.js.map +1 -0
  32. package/lib/commonjs/acmo/core/network/network-common.js +111 -0
  33. package/lib/commonjs/acmo/core/network/network-common.js.map +1 -0
  34. package/lib/commonjs/acmo/core/services/localization_service.js +7 -13
  35. package/lib/commonjs/acmo/core/services/localization_service.js.map +1 -1
  36. package/lib/commonjs/acmo/core/types/activated-campaings.d.js +2 -0
  37. package/lib/commonjs/acmo/core/types/activated-campaings.d.js.map +1 -0
  38. package/lib/commonjs/acmo/core/tyrads-sdk-core.js +203 -0
  39. package/lib/commonjs/acmo/core/tyrads-sdk-core.js.map +1 -0
  40. package/lib/commonjs/acmo/modules/inapp-notifications/components/gradient_card.js +98 -0
  41. package/lib/commonjs/acmo/modules/inapp-notifications/components/gradient_card.js.map +1 -0
  42. package/lib/commonjs/acmo/modules/inapp-notifications/components/modal-wrapper.js +55 -0
  43. package/lib/commonjs/acmo/modules/inapp-notifications/components/modal-wrapper.js.map +1 -0
  44. package/lib/commonjs/acmo/modules/inapp-notifications/controller.js +141 -0
  45. package/lib/commonjs/acmo/modules/inapp-notifications/controller.js.map +1 -0
  46. package/lib/commonjs/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js +183 -0
  47. package/lib/commonjs/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js.map +1 -0
  48. package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-host.js +37 -0
  49. package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-host.js.map +1 -0
  50. package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-manager.js +39 -0
  51. package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-manager.js.map +1 -0
  52. package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js +206 -0
  53. package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js.map +1 -0
  54. package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js +155 -0
  55. package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js.map +1 -0
  56. package/lib/commonjs/acmo/modules/inapp-notifications/repository.js +52 -0
  57. package/lib/commonjs/acmo/modules/inapp-notifications/repository.js.map +1 -0
  58. package/lib/commonjs/acmo/modules/inapp-notifications/tyrads-global-host.js +37 -0
  59. package/lib/commonjs/acmo/modules/inapp-notifications/tyrads-global-host.js.map +1 -0
  60. package/lib/commonjs/acmo/modules/premium-widgets/components/active_offers_button.js.map +1 -0
  61. package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/custom_card.js +1 -2
  62. package/lib/commonjs/acmo/modules/premium-widgets/components/custom_card.js.map +1 -0
  63. package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/custom_scroller.js +20 -11
  64. package/lib/commonjs/acmo/modules/premium-widgets/components/custom_scroller.js.map +1 -0
  65. package/lib/commonjs/acmo/modules/premium-widgets/components/custom_shimmer.js.map +1 -0
  66. package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/offer_card.js +12 -12
  67. package/lib/commonjs/acmo/modules/premium-widgets/components/offer_card.js.map +1 -0
  68. package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.js +3 -3
  69. package/lib/commonjs/acmo/modules/premium-widgets/components/offer_list_item.js.map +1 -0
  70. package/lib/commonjs/acmo/modules/premium-widgets/components/premium_empty_widget.js.map +1 -0
  71. package/lib/commonjs/acmo/modules/premium-widgets/components/premium_header.js.map +1 -0
  72. package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/premium_loading.js +3 -3
  73. package/lib/commonjs/acmo/modules/premium-widgets/components/premium_loading.js.map +1 -0
  74. package/lib/commonjs/acmo/modules/premium-widgets/controller.js +30 -0
  75. package/lib/commonjs/acmo/modules/premium-widgets/controller.js.map +1 -0
  76. package/lib/commonjs/acmo/modules/{dashboard/top_offers.js → premium-widgets/premium_offers_widget.js} +67 -30
  77. package/lib/commonjs/acmo/modules/premium-widgets/premium_offers_widget.js.map +1 -0
  78. package/lib/commonjs/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js +49 -0
  79. package/lib/commonjs/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js.map +1 -0
  80. package/lib/commonjs/acmo/modules/premium-widgets/repository.js +103 -0
  81. package/lib/commonjs/acmo/modules/premium-widgets/repository.js.map +1 -0
  82. package/lib/commonjs/acmo/modules/push-notifications/apns-manager.js +227 -0
  83. package/lib/commonjs/acmo/modules/push-notifications/apns-manager.js.map +1 -0
  84. package/lib/commonjs/acmo/modules/push-notifications/fcm-manager.js +148 -0
  85. package/lib/commonjs/acmo/modules/push-notifications/fcm-manager.js.map +1 -0
  86. package/lib/commonjs/acmo_config.js +6 -5
  87. package/lib/commonjs/acmo_config.js.map +1 -1
  88. package/lib/commonjs/assets/images/alarm-clock.png +0 -0
  89. package/lib/commonjs/assets/images/circle-x.png +0 -0
  90. package/lib/commonjs/assets/images/coin.png +0 -0
  91. package/lib/commonjs/index.js +33 -106
  92. package/lib/commonjs/index.js.map +1 -1
  93. package/lib/module/acmo/core/components/countdown-timer.js +42 -0
  94. package/lib/module/acmo/core/components/countdown-timer.js.map +1 -0
  95. package/lib/module/acmo/core/components/snap-carousel.js +81 -0
  96. package/lib/module/acmo/core/components/snap-carousel.js.map +1 -0
  97. package/lib/module/acmo/core/constants/api-endpoints.js +14 -0
  98. package/lib/module/acmo/core/constants/api-endpoints.js.map +1 -0
  99. package/lib/module/acmo/core/helpers/colors.js +15 -0
  100. package/lib/module/acmo/core/helpers/colors.js.map +1 -0
  101. package/lib/module/acmo/core/helpers/logger.js +14 -0
  102. package/lib/module/acmo/core/helpers/logger.js.map +1 -0
  103. package/lib/module/acmo/core/helpers/patches.js +7 -0
  104. package/lib/module/acmo/core/helpers/patches.js.map +1 -0
  105. package/lib/module/acmo/core/network/http-client.js +86 -0
  106. package/lib/module/acmo/core/network/http-client.js.map +1 -0
  107. package/lib/module/acmo/core/network/network-common.js +106 -0
  108. package/lib/module/acmo/core/network/network-common.js.map +1 -0
  109. package/lib/module/acmo/core/services/localization_service.js +7 -13
  110. package/lib/module/acmo/core/services/localization_service.js.map +1 -1
  111. package/lib/module/acmo/core/types/activated-campaings.d.js +2 -0
  112. package/lib/module/acmo/core/types/activated-campaings.d.js.map +1 -0
  113. package/lib/module/acmo/core/tyrads-sdk-core.js +197 -0
  114. package/lib/module/acmo/core/tyrads-sdk-core.js.map +1 -0
  115. package/lib/module/acmo/modules/inapp-notifications/components/gradient_card.js +92 -0
  116. package/lib/module/acmo/modules/inapp-notifications/components/gradient_card.js.map +1 -0
  117. package/lib/module/acmo/modules/inapp-notifications/components/modal-wrapper.js +49 -0
  118. package/lib/module/acmo/modules/inapp-notifications/components/modal-wrapper.js.map +1 -0
  119. package/lib/module/acmo/modules/inapp-notifications/controller.js +136 -0
  120. package/lib/module/acmo/modules/inapp-notifications/controller.js.map +1 -0
  121. package/lib/module/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js +176 -0
  122. package/lib/module/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js.map +1 -0
  123. package/lib/module/acmo/modules/inapp-notifications/inapp-notification-host.js +32 -0
  124. package/lib/module/acmo/modules/inapp-notifications/inapp-notification-host.js.map +1 -0
  125. package/lib/module/acmo/modules/inapp-notifications/inapp-notification-manager.js +35 -0
  126. package/lib/module/acmo/modules/inapp-notifications/inapp-notification-manager.js.map +1 -0
  127. package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js +200 -0
  128. package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js.map +1 -0
  129. package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js +149 -0
  130. package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js.map +1 -0
  131. package/lib/module/acmo/modules/inapp-notifications/repository.js +47 -0
  132. package/lib/module/acmo/modules/inapp-notifications/repository.js.map +1 -0
  133. package/lib/module/acmo/modules/inapp-notifications/tyrads-global-host.js +32 -0
  134. package/lib/module/acmo/modules/inapp-notifications/tyrads-global-host.js.map +1 -0
  135. package/lib/module/acmo/modules/premium-widgets/components/active_offers_button.js.map +1 -0
  136. package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/custom_card.js +1 -2
  137. package/lib/module/acmo/modules/premium-widgets/components/custom_card.js.map +1 -0
  138. package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/custom_scroller.js +20 -11
  139. package/lib/module/acmo/modules/premium-widgets/components/custom_scroller.js.map +1 -0
  140. package/lib/module/acmo/modules/premium-widgets/components/custom_shimmer.js.map +1 -0
  141. package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/offer_card.js +12 -12
  142. package/lib/module/acmo/modules/premium-widgets/components/offer_card.js.map +1 -0
  143. package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.js +3 -3
  144. package/lib/module/acmo/modules/premium-widgets/components/offer_list_item.js.map +1 -0
  145. package/lib/module/acmo/modules/premium-widgets/components/premium_empty_widget.js.map +1 -0
  146. package/lib/module/acmo/modules/premium-widgets/components/premium_header.js.map +1 -0
  147. package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/premium_loading.js +1 -1
  148. package/lib/module/acmo/modules/premium-widgets/components/premium_loading.js.map +1 -0
  149. package/lib/module/acmo/modules/premium-widgets/controller.js +25 -0
  150. package/lib/module/acmo/modules/premium-widgets/controller.js.map +1 -0
  151. package/lib/module/acmo/modules/{dashboard/top_offers.js → premium-widgets/premium_offers_widget.js} +69 -32
  152. package/lib/module/acmo/modules/premium-widgets/premium_offers_widget.js.map +1 -0
  153. package/lib/module/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js +41 -0
  154. package/lib/module/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js.map +1 -0
  155. package/lib/module/acmo/modules/premium-widgets/repository.js +98 -0
  156. package/lib/module/acmo/modules/premium-widgets/repository.js.map +1 -0
  157. package/lib/module/acmo/modules/push-notifications/apns-manager.js +222 -0
  158. package/lib/module/acmo/modules/push-notifications/apns-manager.js.map +1 -0
  159. package/lib/module/acmo/modules/push-notifications/fcm-manager.js +143 -0
  160. package/lib/module/acmo/modules/push-notifications/fcm-manager.js.map +1 -0
  161. package/lib/module/acmo_config.js +6 -5
  162. package/lib/module/acmo_config.js.map +1 -1
  163. package/lib/module/assets/images/alarm-clock.png +0 -0
  164. package/lib/module/assets/images/circle-x.png +0 -0
  165. package/lib/module/assets/images/coin.png +0 -0
  166. package/lib/module/index.js +16 -106
  167. package/lib/module/index.js.map +1 -1
  168. package/lib/typescript/commonjs/src/acmo/core/components/countdown-timer.d.ts +8 -0
  169. package/lib/typescript/commonjs/src/acmo/core/components/countdown-timer.d.ts.map +1 -0
  170. package/lib/typescript/commonjs/src/acmo/core/components/snap-carousel.d.ts +26 -0
  171. package/lib/typescript/commonjs/src/acmo/core/components/snap-carousel.d.ts.map +1 -0
  172. package/lib/typescript/commonjs/src/acmo/core/constants/api-endpoints.d.ts +12 -0
  173. package/lib/typescript/commonjs/src/acmo/core/constants/api-endpoints.d.ts.map +1 -0
  174. package/lib/typescript/commonjs/src/acmo/core/helpers/colors.d.ts +2 -0
  175. package/lib/typescript/commonjs/src/acmo/core/helpers/colors.d.ts.map +1 -0
  176. package/lib/typescript/commonjs/src/acmo/core/helpers/logger.d.ts +6 -0
  177. package/lib/typescript/commonjs/src/acmo/core/helpers/logger.d.ts.map +1 -0
  178. package/lib/typescript/commonjs/src/acmo/core/network/http-client.d.ts +28 -0
  179. package/lib/typescript/commonjs/src/acmo/core/network/http-client.d.ts.map +1 -0
  180. package/lib/typescript/commonjs/src/acmo/core/network/network-common.d.ts +13 -0
  181. package/lib/typescript/commonjs/src/acmo/core/network/network-common.d.ts.map +1 -0
  182. package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts +0 -1
  183. package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts.map +1 -1
  184. package/lib/typescript/commonjs/src/acmo/core/types/external_types.d.ts +5 -0
  185. package/lib/typescript/commonjs/src/acmo/core/types/external_types.d.ts.map +1 -1
  186. package/lib/typescript/commonjs/src/acmo/core/tyrads-sdk-core.d.ts +46 -0
  187. package/lib/typescript/commonjs/src/acmo/core/tyrads-sdk-core.d.ts.map +1 -0
  188. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts +17 -0
  189. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts +10 -0
  191. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts.map +1 -0
  192. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/controller.d.ts +22 -0
  193. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/controller.d.ts.map +1 -0
  194. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts +6 -0
  195. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts.map +1 -0
  196. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts +7 -0
  197. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts.map +1 -0
  198. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts +14 -0
  199. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts.map +1 -0
  200. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts +4 -0
  201. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts.map +1 -0
  202. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts +7 -0
  203. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts.map +1 -0
  204. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/repository.d.ts +8 -0
  205. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/repository.d.ts.map +1 -0
  206. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts +6 -0
  207. package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts.map +1 -0
  208. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/active_offers_button.d.ts.map +1 -0
  209. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/custom_card.d.ts.map +1 -0
  210. package/lib/typescript/{module/src/acmo/modules/dashboard → commonjs/src/acmo/modules/premium-widgets}/components/custom_scroller.d.ts +3 -0
  211. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/custom_scroller.d.ts.map +1 -0
  212. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/custom_shimmer.d.ts.map +1 -0
  213. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/offer_card.d.ts.map +1 -0
  214. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/offer_list_item.d.ts.map +1 -0
  215. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/premium_empty_widget.d.ts.map +1 -0
  216. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/premium_header.d.ts.map +1 -0
  217. package/lib/typescript/{module/src/acmo/modules/dashboard → commonjs/src/acmo/modules/premium-widgets}/components/premium_loading.d.ts +1 -1
  218. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/premium_loading.d.ts.map +1 -0
  219. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/controller.d.ts +14 -0
  220. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/controller.d.ts.map +1 -0
  221. package/lib/typescript/commonjs/src/acmo/modules/{dashboard/top_offers.d.ts → premium-widgets/premium_offers_widget.d.ts} +3 -3
  222. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/premium_offers_widget.d.ts.map +1 -0
  223. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts +9 -0
  224. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts.map +1 -0
  225. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/repository.d.ts +13 -0
  226. package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/repository.d.ts.map +1 -0
  227. package/lib/typescript/commonjs/src/acmo/modules/push-notifications/apns-manager.d.ts +40 -0
  228. package/lib/typescript/commonjs/src/acmo/modules/push-notifications/apns-manager.d.ts.map +1 -0
  229. package/lib/typescript/commonjs/src/acmo/modules/push-notifications/fcm-manager.d.ts +32 -0
  230. package/lib/typescript/commonjs/src/acmo/modules/push-notifications/fcm-manager.d.ts.map +1 -0
  231. package/lib/typescript/commonjs/src/acmo_config.d.ts +1 -0
  232. package/lib/typescript/commonjs/src/acmo_config.d.ts.map +1 -1
  233. package/lib/typescript/commonjs/src/index.d.ts +5 -11
  234. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  235. package/lib/typescript/module/src/acmo/core/components/countdown-timer.d.ts +8 -0
  236. package/lib/typescript/module/src/acmo/core/components/countdown-timer.d.ts.map +1 -0
  237. package/lib/typescript/module/src/acmo/core/components/snap-carousel.d.ts +26 -0
  238. package/lib/typescript/module/src/acmo/core/components/snap-carousel.d.ts.map +1 -0
  239. package/lib/typescript/module/src/acmo/core/constants/api-endpoints.d.ts +12 -0
  240. package/lib/typescript/module/src/acmo/core/constants/api-endpoints.d.ts.map +1 -0
  241. package/lib/typescript/module/src/acmo/core/helpers/colors.d.ts +2 -0
  242. package/lib/typescript/module/src/acmo/core/helpers/colors.d.ts.map +1 -0
  243. package/lib/typescript/module/src/acmo/core/helpers/logger.d.ts +6 -0
  244. package/lib/typescript/module/src/acmo/core/helpers/logger.d.ts.map +1 -0
  245. package/lib/typescript/module/src/acmo/core/network/http-client.d.ts +28 -0
  246. package/lib/typescript/module/src/acmo/core/network/http-client.d.ts.map +1 -0
  247. package/lib/typescript/module/src/acmo/core/network/network-common.d.ts +13 -0
  248. package/lib/typescript/module/src/acmo/core/network/network-common.d.ts.map +1 -0
  249. package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts +0 -1
  250. package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts.map +1 -1
  251. package/lib/typescript/module/src/acmo/core/types/external_types.d.ts +5 -0
  252. package/lib/typescript/module/src/acmo/core/types/external_types.d.ts.map +1 -1
  253. package/lib/typescript/module/src/acmo/core/tyrads-sdk-core.d.ts +46 -0
  254. package/lib/typescript/module/src/acmo/core/tyrads-sdk-core.d.ts.map +1 -0
  255. package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts +17 -0
  256. package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts.map +1 -0
  257. package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts +10 -0
  258. package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts.map +1 -0
  259. package/lib/typescript/module/src/acmo/modules/inapp-notifications/controller.d.ts +22 -0
  260. package/lib/typescript/module/src/acmo/modules/inapp-notifications/controller.d.ts.map +1 -0
  261. package/lib/typescript/module/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts +6 -0
  262. package/lib/typescript/module/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts.map +1 -0
  263. package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts +7 -0
  264. package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts.map +1 -0
  265. package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts +14 -0
  266. package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts.map +1 -0
  267. package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts +4 -0
  268. package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts.map +1 -0
  269. package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts +7 -0
  270. package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts.map +1 -0
  271. package/lib/typescript/module/src/acmo/modules/inapp-notifications/repository.d.ts +8 -0
  272. package/lib/typescript/module/src/acmo/modules/inapp-notifications/repository.d.ts.map +1 -0
  273. package/lib/typescript/module/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts +6 -0
  274. package/lib/typescript/module/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts.map +1 -0
  275. package/lib/typescript/module/src/acmo/modules/premium-widgets/components/active_offers_button.d.ts.map +1 -0
  276. package/lib/typescript/module/src/acmo/modules/premium-widgets/components/custom_card.d.ts.map +1 -0
  277. package/lib/typescript/{commonjs/src/acmo/modules/dashboard → module/src/acmo/modules/premium-widgets}/components/custom_scroller.d.ts +3 -0
  278. package/lib/typescript/module/src/acmo/modules/premium-widgets/components/custom_scroller.d.ts.map +1 -0
  279. package/lib/typescript/module/src/acmo/modules/premium-widgets/components/custom_shimmer.d.ts.map +1 -0
  280. package/lib/typescript/module/src/acmo/modules/premium-widgets/components/offer_card.d.ts.map +1 -0
  281. package/lib/typescript/module/src/acmo/modules/premium-widgets/components/offer_list_item.d.ts.map +1 -0
  282. package/lib/typescript/module/src/acmo/modules/premium-widgets/components/premium_empty_widget.d.ts.map +1 -0
  283. package/lib/typescript/module/src/acmo/modules/premium-widgets/components/premium_header.d.ts.map +1 -0
  284. package/lib/typescript/{commonjs/src/acmo/modules/dashboard → module/src/acmo/modules/premium-widgets}/components/premium_loading.d.ts +1 -1
  285. package/lib/typescript/module/src/acmo/modules/premium-widgets/components/premium_loading.d.ts.map +1 -0
  286. package/lib/typescript/module/src/acmo/modules/premium-widgets/controller.d.ts +14 -0
  287. package/lib/typescript/module/src/acmo/modules/premium-widgets/controller.d.ts.map +1 -0
  288. package/lib/typescript/module/src/acmo/modules/{dashboard/top_offers.d.ts → premium-widgets/premium_offers_widget.d.ts} +3 -3
  289. package/lib/typescript/module/src/acmo/modules/premium-widgets/premium_offers_widget.d.ts.map +1 -0
  290. package/lib/typescript/module/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts +9 -0
  291. package/lib/typescript/module/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts.map +1 -0
  292. package/lib/typescript/module/src/acmo/modules/premium-widgets/repository.d.ts +13 -0
  293. package/lib/typescript/module/src/acmo/modules/premium-widgets/repository.d.ts.map +1 -0
  294. package/lib/typescript/module/src/acmo/modules/push-notifications/apns-manager.d.ts +40 -0
  295. package/lib/typescript/module/src/acmo/modules/push-notifications/apns-manager.d.ts.map +1 -0
  296. package/lib/typescript/module/src/acmo/modules/push-notifications/fcm-manager.d.ts +32 -0
  297. package/lib/typescript/module/src/acmo/modules/push-notifications/fcm-manager.d.ts.map +1 -0
  298. package/lib/typescript/module/src/acmo_config.d.ts +1 -0
  299. package/lib/typescript/module/src/acmo_config.d.ts.map +1 -1
  300. package/lib/typescript/module/src/index.d.ts +5 -11
  301. package/lib/typescript/module/src/index.d.ts.map +1 -1
  302. package/package.json +5 -3
  303. package/readme.md +27 -14
  304. package/src/acmo/core/components/countdown-timer.tsx +52 -0
  305. package/src/acmo/core/components/snap-carousel.tsx +106 -0
  306. package/src/acmo/core/constants/api-endpoints.ts +12 -0
  307. package/src/acmo/core/helpers/colors.ts +16 -0
  308. package/src/acmo/core/helpers/logger.ts +11 -0
  309. package/src/acmo/core/helpers/patches.js +6 -0
  310. package/src/acmo/core/network/http-client.ts +89 -0
  311. package/src/acmo/core/network/network-common.ts +128 -0
  312. package/src/acmo/core/services/localization_service.ts +7 -14
  313. package/src/acmo/core/types/activated-campaings.d.ts +101 -0
  314. package/src/acmo/core/types/external_types.ts +7 -1
  315. package/src/acmo/core/types/types.d.ts +112 -76
  316. package/src/acmo/core/tyrads-sdk-core.tsx +256 -0
  317. package/src/acmo/modules/inapp-notifications/components/gradient_card.tsx +87 -0
  318. package/src/acmo/modules/inapp-notifications/components/modal-wrapper.tsx +59 -0
  319. package/src/acmo/modules/inapp-notifications/controller.ts +183 -0
  320. package/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.tsx +164 -0
  321. package/src/acmo/modules/inapp-notifications/inapp-notification-host.tsx +32 -0
  322. package/src/acmo/modules/inapp-notifications/inapp-notification-manager.ts +40 -0
  323. package/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.tsx +188 -0
  324. package/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.tsx +149 -0
  325. package/src/acmo/modules/inapp-notifications/repository.ts +49 -0
  326. package/src/acmo/modules/inapp-notifications/tyrads-global-host.tsx +25 -0
  327. package/src/acmo/modules/{dashboard → premium-widgets}/components/custom_card.tsx +1 -2
  328. package/src/acmo/modules/{dashboard → premium-widgets}/components/custom_scroller.tsx +24 -10
  329. package/src/acmo/modules/{dashboard → premium-widgets}/components/offer_card.tsx +11 -11
  330. package/src/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.tsx +3 -3
  331. package/src/acmo/modules/{dashboard → premium-widgets}/components/premium_loading.tsx +1 -1
  332. package/src/acmo/modules/premium-widgets/controller.ts +39 -0
  333. package/src/acmo/modules/{dashboard/top_offers.tsx → premium-widgets/premium_offers_widget.tsx} +67 -45
  334. package/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.tsx +39 -0
  335. package/src/acmo/modules/premium-widgets/repository.ts +107 -0
  336. package/src/acmo/modules/push-notifications/apns-manager.ts +254 -0
  337. package/src/acmo/modules/push-notifications/fcm-manager.ts +162 -0
  338. package/src/acmo_config.ts +6 -5
  339. package/src/assets/images/alarm-clock.png +0 -0
  340. package/src/assets/images/circle-x.png +0 -0
  341. package/src/assets/images/coin.png +0 -0
  342. package/src/index.tsx +19 -127
  343. package/ios/Tyrads/user/AcmoUserUpdatePage.swift +0 -302
  344. package/ios/Tyrads/user/AcmoUsersUpdateController.swift +0 -26
  345. package/ios/Tyrads/user/Repository.swift +0 -89
  346. package/lib/commonjs/acmo/core/helpers/native_methods.js +0 -48
  347. package/lib/commonjs/acmo/core/helpers/native_methods.js.map +0 -1
  348. package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js.map +0 -1
  349. package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js.map +0 -1
  350. package/lib/commonjs/acmo/modules/dashboard/components/custom_scroller.js.map +0 -1
  351. package/lib/commonjs/acmo/modules/dashboard/components/custom_shimmer.js.map +0 -1
  352. package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js.map +0 -1
  353. package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js.map +0 -1
  354. package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js.map +0 -1
  355. package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js.map +0 -1
  356. package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js.map +0 -1
  357. package/lib/commonjs/acmo/modules/dashboard/repository.js +0 -147
  358. package/lib/commonjs/acmo/modules/dashboard/repository.js.map +0 -1
  359. package/lib/commonjs/acmo/modules/dashboard/top_offers.js.map +0 -1
  360. package/lib/module/acmo/core/helpers/native_methods.js +0 -44
  361. package/lib/module/acmo/core/helpers/native_methods.js.map +0 -1
  362. package/lib/module/acmo/modules/dashboard/components/active_offers_button.js.map +0 -1
  363. package/lib/module/acmo/modules/dashboard/components/custom_card.js.map +0 -1
  364. package/lib/module/acmo/modules/dashboard/components/custom_scroller.js.map +0 -1
  365. package/lib/module/acmo/modules/dashboard/components/custom_shimmer.js.map +0 -1
  366. package/lib/module/acmo/modules/dashboard/components/offer_card.js.map +0 -1
  367. package/lib/module/acmo/modules/dashboard/components/offer_list_item.js.map +0 -1
  368. package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js.map +0 -1
  369. package/lib/module/acmo/modules/dashboard/components/premium_header.js.map +0 -1
  370. package/lib/module/acmo/modules/dashboard/components/premium_loading.js.map +0 -1
  371. package/lib/module/acmo/modules/dashboard/repository.js +0 -140
  372. package/lib/module/acmo/modules/dashboard/repository.js.map +0 -1
  373. package/lib/module/acmo/modules/dashboard/top_offers.js.map +0 -1
  374. package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts +0 -10
  375. package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts.map +0 -1
  376. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +0 -1
  377. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_card.d.ts.map +0 -1
  378. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +0 -1
  379. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +0 -1
  380. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_card.d.ts.map +0 -1
  381. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +0 -1
  382. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +0 -1
  383. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts.map +0 -1
  384. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +0 -1
  385. package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts +0 -3
  386. package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts.map +0 -1
  387. package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts.map +0 -1
  388. package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts +0 -10
  389. package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts.map +0 -1
  390. package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +0 -1
  391. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_card.d.ts.map +0 -1
  392. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +0 -1
  393. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +0 -1
  394. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_card.d.ts.map +0 -1
  395. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +0 -1
  396. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +0 -1
  397. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts.map +0 -1
  398. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +0 -1
  399. package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts +0 -3
  400. package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts.map +0 -1
  401. package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts.map +0 -1
  402. package/src/acmo/core/helpers/native_methods.ts +0 -59
  403. package/src/acmo/modules/dashboard/repository.ts +0 -170
  404. /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.js +0 -0
  405. /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.js +0 -0
  406. /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.js +0 -0
  407. /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/premium_header.js +0 -0
  408. /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.js +0 -0
  409. /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.js +0 -0
  410. /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.js +0 -0
  411. /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/premium_header.js +0 -0
  412. /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.d.ts +0 -0
  413. /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/custom_card.d.ts +0 -0
  414. /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.d.ts +0 -0
  415. /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/offer_card.d.ts +0 -0
  416. /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.d.ts +0 -0
  417. /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.d.ts +0 -0
  418. /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/premium_header.d.ts +0 -0
  419. /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.d.ts +0 -0
  420. /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/custom_card.d.ts +0 -0
  421. /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.d.ts +0 -0
  422. /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/offer_card.d.ts +0 -0
  423. /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.d.ts +0 -0
  424. /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.d.ts +0 -0
  425. /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/premium_header.d.ts +0 -0
  426. /package/src/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.tsx +0 -0
  427. /package/src/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.tsx +0 -0
  428. /package/src/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.tsx +0 -0
  429. /package/src/acmo/modules/{dashboard → premium-widgets}/components/premium_header.tsx +0 -0
@@ -0,0 +1,40 @@
1
+ export interface PushNotificationEvent {
2
+ type: 'received' | 'clicked' | 'dismissed';
3
+ id?: string;
4
+ data?: any;
5
+ }
6
+ export type PushEventCallback = (event: PushNotificationEvent) => void;
7
+ declare class ApnsManager {
8
+ private static instance;
9
+ private tokenFetched;
10
+ private pushEventSubscriptions;
11
+ private initialized;
12
+ private isLoggedIn;
13
+ private pendingEvent;
14
+ private constructor();
15
+ static getInstance(): ApnsManager;
16
+ setLoggedIn(status: boolean): void;
17
+ init(): Promise<void>;
18
+ private _fetchTokenSafely;
19
+ private _fetchTokenWithRetry;
20
+ private _requestPushPermission;
21
+ private _setupPushEventListeners;
22
+ private _handlePushEvent;
23
+ private _onNotificationReceived;
24
+ private _onNotificationClicked;
25
+ private _onNotificationDismissed;
26
+ private listeners;
27
+ on(event: string, callback: Function): void;
28
+ off(event: string, callback: Function): void;
29
+ private emit;
30
+ fetchToken(): Promise<string | null>;
31
+ requestPermission(): Promise<boolean>;
32
+ addPushEventHandler(callback: PushEventCallback): any;
33
+ dispose(): void;
34
+ isTokenFetched(): boolean;
35
+ getCurrentToken(): Promise<string | null>;
36
+ }
37
+ declare const _default: ApnsManager;
38
+ export default _default;
39
+ export { ApnsManager };
40
+ //# sourceMappingURL=apns-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apns-manager.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/modules/push-notifications/apns-manager.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;IAC3C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAEvE,cAAM,WAAW;IACf,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,sBAAsB,CAAa;IAE3C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAsD;IAE1E,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,WAAW;IAOjC,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAS5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAoBb,iBAAiB;YAmBjB,oBAAoB;YAyBpB,sBAAsB;IASpC,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,uBAAuB;YAKjB,sBAAsB;IAwBpC,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,SAAS,CAAsC;IAEvD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAO3C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAU5C,OAAO,CAAC,IAAI;IAaN,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAcpC,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAS3C,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,GAAG;IAIrD,OAAO,IAAI,IAAI;IASf,cAAc,IAAI,OAAO;IAInB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAMhD;;AAED,wBAAyC;AAEzC,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,32 @@
1
+ export interface PushNotificationEvent {
2
+ type: 'received' | 'clicked' | 'dismissed';
3
+ id?: string;
4
+ data?: any;
5
+ }
6
+ export type PushEventCallback = (event: PushNotificationEvent) => void;
7
+ declare class FcmManager {
8
+ private static instance;
9
+ private pushEventSubscriptions;
10
+ private initialized;
11
+ private isLoggedIn;
12
+ private pendingEvent;
13
+ private constructor();
14
+ static getInstance(): FcmManager;
15
+ setLoggedIn(status: boolean): void;
16
+ init(): Promise<void>;
17
+ private _setupPushEventListeners;
18
+ private _handlePushEvent;
19
+ private _onNotificationReceived;
20
+ private _onNotificationClicked;
21
+ private _onNotificationDismissed;
22
+ private listeners;
23
+ on(event: string, callback: Function): void;
24
+ off(event: string, callback: Function): void;
25
+ private emit;
26
+ addPushEventHandler(callback: PushEventCallback): any;
27
+ dispose(): void;
28
+ }
29
+ declare const _default: FcmManager;
30
+ export default _default;
31
+ export { FcmManager };
32
+ //# sourceMappingURL=fcm-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fcm-manager.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/modules/push-notifications/fcm-manager.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;IAC3C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAEvE,cAAM,UAAU;IACd,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAa;IACpC,OAAO,CAAC,sBAAsB,CAAa;IAE3C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAsD;IAE1E,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,UAAU;IAOhC,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAS5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB3B,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,uBAAuB;YAKjB,sBAAsB;IAsBpC,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,SAAS,CAAsC;IAEvD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAO3C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAU5C,OAAO,CAAC,IAAI;IAaZ,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,GAAG;IAIrD,OAAO,IAAI,IAAI;CAQhB;;AAED,wBAAwC;AAExC,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export declare class AcmoConfig {
2
2
  static API_VERSION: string;
3
+ static BASE_URL: string;
3
4
  static MAJOR_VERSION: string;
4
5
  static MINOR_VERSION: string;
5
6
  static PATCH_VERSION: string;
@@ -1 +1 @@
1
- {"version":3,"file":"acmo_config.d.ts","sourceRoot":"","sources":["../../../../src/acmo_config.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,OAAc,WAAW,SAAS;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,YAAY,SAAkB;IAC5C,OAAc,WAAW,SAA6F;CACvH"}
1
+ {"version":3,"file":"acmo_config.d.ts","sourceRoot":"","sources":["../../../../src/acmo_config.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,OAAc,WAAW,SAAS;IAClC,OAAc,QAAQ,SAAkD;IACxE,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,YAAY,SAAkB;IAC5C,OAAc,WAAW,SAA6F;CACvH"}
@@ -1,21 +1,15 @@
1
- import { PremiumWidgetStyles } from './acmo/modules/dashboard/top_offers';
2
- import type { TyradsMediaSourceInfo, TyradsUserInfo } from './acmo/core/types/external_types';
3
- export type { TyradsMediaSourceInfo, TyradsUserInfo } from './acmo/core/types/external_types';
1
+ import type { TyradsConfig, TyradsMediaSourceInfo, TyradsUserInfo } from './acmo/core/types/external_types';
2
+ export type { TyradsConfig, TyradsMediaSourceInfo, TyradsUserInfo } from './acmo/core/types/external_types';
3
+ export { PremiumWidgetStyles } from './acmo/modules/premium-widgets/premium_offers_widget';
4
+ export { PremiumOffersWidget, PremiumOffersWidgetLoading } from './acmo/modules/premium-widgets/premium_offers_widget_wrapper';
4
5
  declare const Tyrads: {
5
- init: (apiKey: string, apiSecret: string, encKey?: string, engagementId?: string, mediaSourceInfo?: TyradsMediaSourceInfo, userInfo?: TyradsUserInfo) => Promise<any>;
6
+ init: (apiKey: string, apiSecret: string, encKey?: string, engagementId?: string, placementId?: string, mediaSourceInfo?: TyradsMediaSourceInfo, userInfo?: TyradsUserInfo, config?: TyradsConfig) => Promise<any>;
6
7
  loginUser: (userId: string) => Promise<any>;
7
8
  showOffers: ({ launchMode, route, campaignID, }?: {
8
9
  launchMode?: number;
9
10
  route?: string;
10
11
  campaignID?: number | null;
11
12
  }) => Promise<any>;
12
- topPremiumOffers: ({ widgetStyle, launchMode, }?: {
13
- widgetStyle?: PremiumWidgetStyles;
14
- launchMode?: number;
15
- }) => import("react/jsx-runtime").JSX.Element;
16
- topPremiumOffersLoading: ({ widgetStyle }: {
17
- widgetStyle?: PremiumWidgetStyles;
18
- }) => import("react/jsx-runtime").JSX.Element;
19
13
  changeLanguage: (lang: string) => Promise<any>;
20
14
  };
21
15
  export default Tyrads;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAkB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAMrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAC9F,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AA0B7F,QAAA,MAAM,MAAM;mBACW,MAAM,aAAa,MAAM,WAAW,MAAM,iBAAiB,MAAM,oBAAoB,qBAAqB,aAAa,cAAc;wBAuChI,MAAM;sDAoB7B;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;sDAgBnE;QACD,WAAW,CAAC,EAAE,mBAAmB,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;+CAgB6C;QAC1C,WAAW,CAAC,EAAE,mBAAmB,CAAC;KACnC;2BAQ0B,MAAM;CAGpC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAM3G,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,8DAA8D,CAAC;AAE/H,QAAA,MAAM,MAAM;mBACW,MAAM,aAAa,MAAM,WAAW,MAAM,iBAAiB,MAAM,gBAAgB,MAAM,oBAAoB,qBAAqB,aAAa,cAAc,WAAW,YAAY;wBAI7K,MAAM;sDAQ7B;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;2BAKzC,MAAM;CAGpC,CAAC;AAGF,eAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tyrads.com/tyrads-sdk",
3
- "version": "3.3.4",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "Tyrads SDK for React Native ",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -72,7 +72,7 @@
72
72
  "@types/jest": "^29.5.5",
73
73
  "@types/numeral": "^2.0.5",
74
74
  "@types/react": "^19.0.0",
75
- "@types/react-native-snap-carousel": "^3.8.11",
75
+ "@types/react-native-snap-carousel": "^3.8.12",
76
76
  "commitlint": "^17.0.2",
77
77
  "del-cli": "^5.1.0",
78
78
  "eslint": "^8.51.0",
@@ -190,6 +190,8 @@
190
190
  },
191
191
  "dependencies": {
192
192
  "@react-native-async-storage/async-storage": "^2.1.2",
193
- "axios": "^1.8.1"
193
+ "axios": "^1.8.1",
194
+ "react-native-linear-gradient": "^2.8.3",
195
+ "react-native-snap-carousel": "^3.9.1"
194
196
  }
195
197
  }
package/readme.md CHANGED
@@ -14,14 +14,27 @@ yarn add @tyrads.com/tyrads-sdk
14
14
 
15
15
 
16
16
  ```js
17
- import Tyrads from '@tyrads.com/tyrads-sdk';
17
+ import Tyrads, { PremiumOffersWidget, PremiumWidgetStyles } from '@tyrads.com/tyrads-sdk';
18
18
 
19
- // ...
19
+ // 1. Initialize the SDK
20
+ // Tyrads.init(apiKey, apiSecret, encKey?, engagementId?, placementId?, mediaSourceInfo?, userInfo?, config?)
21
+ await Tyrads.init('YOUR_API_KEY', 'YOUR_API_SECRET');
20
22
 
23
+ // 2. Login User
24
+ await Tyrads.loginUser('user123');
21
25
 
22
- Tyrads.init('', '');
23
- Tyrads.loginUser('');
24
- Tyrads.showOffers();
26
+ // 3. Show Offerwall
27
+ await Tyrads.showOffers();
28
+ ```
29
+
30
+ ### Premium Offers Widget (v4+)
31
+ You can render premium offers natively inside your app views using the provided React components:
32
+
33
+ ```jsx
34
+ import { PremiumOffersWidget, PremiumOffersWidgetLoading, PremiumWidgetStyles } from '@tyrads.com/tyrads-sdk';
35
+
36
+ // Inside your screen/component:
37
+ <PremiumOffersWidget widgetStyle={PremiumWidgetStyles.list} />
25
38
  ```
26
39
 
27
40
 
@@ -47,7 +60,7 @@ Available launch modes:
47
60
 
48
61
  // Note: The launchMode parameter is optional, if not specified the default would be opening the Offerwall in an external browser (Safari)
49
62
 
50
- Tyrads.showOffers({ launchMode: 3 });// provide launchMode: 2 to open the Offerwall in a webkit view that is embedded in the app
63
+ await Tyrads.showOffers({ launchMode: 3 });// provide launchMode: 2 to open the Offerwall in a webkit view that is embedded in the app
51
64
 
52
65
  ```
53
66
  </details>
@@ -61,7 +74,7 @@ Tyrads.showOffers({ launchMode: 3 });// provide launchMode: 2 to open the Offerw
61
74
 
62
75
  </br>
63
76
 
64
- ##### Min SDK version required: v1.1.6
77
+ ##### Min SDK version required: v4.0.0-beta.0
65
78
 
66
79
  </br>
67
80
 
@@ -70,25 +83,25 @@ The Tyrads SDK supports deeplinking to specific sections of the offerwall. When
70
83
  Available routes and their usage:
71
84
  - `offers` - opens the Campaigns Page
72
85
  - `active-offers` - opens the Activated Campaigns Page
73
- - `offer-details` - opens the Campaign Details Page (requires campaignID)
74
- - `support` - opens the Campaign Tickets Page (requires campaignID)
86
+ - `offers` with campaignID - opens the Campaign Details Page (requires campaignID)
87
+ - `support` with campaignID - opens the Campaign Tickets Page (requires campaignID)
75
88
 
76
89
  ```js
77
90
 
78
91
  // Default route (Campaigns Page)
79
- Tyrads.showOffers();
92
+ await Tyrads.showOffers();
80
93
 
81
94
  // Explicitly specifying the Campaigns Page
82
- Tyrads.showOffers({ route: "offers" });
95
+ await Tyrads.showOffers({ route: "offers" });
83
96
 
84
97
  // Activated Campaigns Page
85
- Tyrads.showOffers({ route: "active-offers" });
98
+ await Tyrads.showOffers({ route: "active-offers" });
86
99
 
87
100
  // Campaign Details Page (requires campaignID)
88
- Tyrads.showOffers({ route: "offer-details", campaignID: "your_campaign_id_here" });
101
+ await Tyrads.showOffers({ route: "offers", campaignID: "your_campaign_id_here" });
89
102
 
90
103
  // Campaign Tickets Page (requires campaignID)
91
- Tyrads.showOffers({ route: "support", campaignID: "your_campaign_id_here" });
104
+ await Tyrads.showOffers({ route: "support", campaignID: "your_campaign_id_here" });
92
105
 
93
106
  ```
94
107
  </details>
@@ -0,0 +1,52 @@
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+ import { Text } from 'react-native';
3
+
4
+ interface CountdownTimerProps {
5
+ duration: number;
6
+ style?: any;
7
+ }
8
+
9
+ export const CountdownTimer: React.FC<CountdownTimerProps> = ({
10
+ duration,
11
+ style,
12
+ }) => {
13
+ const [timeLeft, setTimeLeft] = useState(duration);
14
+ const intervalRef = useRef<NodeJS.Timeout>();
15
+
16
+ useEffect(() => {
17
+ intervalRef.current = setInterval(() => {
18
+ setTimeLeft((prev) => {
19
+ if (prev <= 1) {
20
+ clearInterval(intervalRef.current!);
21
+ return 0;
22
+ }
23
+ return prev - 1;
24
+ });
25
+ }, 1000);
26
+
27
+ return () => clearInterval(intervalRef.current!);
28
+ }, []);
29
+
30
+ const formatTime = (seconds: number): string => {
31
+ if (seconds <= 0) return '00:00:00';
32
+
33
+ const days = Math.floor(seconds / 86400);
34
+ const hours = Math.floor((seconds % 86400) / 3600);
35
+ const minutes = Math.floor((seconds % 3600) / 60);
36
+ const secs = seconds % 60;
37
+
38
+ const pad = (num: number) => num.toString().padStart(2, '0');
39
+
40
+ if (days > 0) {
41
+ return `${pad(days)} d ${pad(hours)} h`;
42
+ } else {
43
+ return `${pad(hours)}:${pad(minutes)}:${pad(secs)}`;
44
+ }
45
+ };
46
+
47
+ return (
48
+ <Text style={style}>
49
+ {formatTime(timeLeft)}
50
+ </Text>
51
+ );
52
+ };
@@ -0,0 +1,106 @@
1
+ import '../helpers/patches'
2
+
3
+ import React, { useRef, useState } from "react";
4
+ import { View, Dimensions, StyleSheet, type ViewStyle } from "react-native";
5
+ import Carousel, { Pagination } from "react-native-snap-carousel";
6
+
7
+ interface SnapCarouselProps {
8
+ data: any[];
9
+ renderItem: ({ item, index }: any) => JSX.Element;
10
+ sliderWidth?: number;
11
+ itemWidth?: number;
12
+ showPagination?: boolean;
13
+ onSnapToItem?: (index: number) => void;
14
+ inactiveSlideScale?: number;
15
+ inactiveSlideOpacity?: number;
16
+ activeSlideAlignment?: "start" | "center" | "end";
17
+ containerStyle?: ViewStyle;
18
+ paginationContainerStyle?: ViewStyle;
19
+ dotStyle?: ViewStyle;
20
+ inActiveDotStyle?: ViewStyle;
21
+ inActiveDotScale?: number;
22
+ loop?: boolean;
23
+ autoplay?: boolean;
24
+ autoPlayDelay?: number;
25
+ [key: string]: any;
26
+ }
27
+
28
+ const { width: screenWidth } = Dimensions.get("window");
29
+
30
+ const SnapCarousel: React.FC<SnapCarouselProps> = ({
31
+ data,
32
+ renderItem,
33
+ sliderWidth = screenWidth,
34
+ itemWidth = screenWidth * 0.75,
35
+ showPagination = true,
36
+ onSnapToItem = () => {},
37
+ inactiveSlideScale = 1,
38
+ inactiveSlideOpacity = 0.99,
39
+ activeSlideAlignment = "center",
40
+ containerStyle,
41
+ paginationContainerStyle,
42
+ dotStyle,
43
+ inActiveDotStyle,
44
+ inActiveDotScale = 0.95,
45
+ loop = false,
46
+ autoplay = false,
47
+ autoPlayDelay = 5000,
48
+ ...rest
49
+ }) => {
50
+ const carouselRef = useRef<Carousel<any>>(null);
51
+ const [activeIndex, setActiveIndex] = useState(0);
52
+
53
+ const sidePadding = (sliderWidth - itemWidth) / 2;
54
+
55
+ const safeData = data || [];
56
+
57
+ return (
58
+ <View style={[containerStyle]}>
59
+ <Carousel
60
+ ref={carouselRef}
61
+ data={safeData}
62
+ renderItem={renderItem}
63
+ sliderWidth={sliderWidth}
64
+ itemWidth={itemWidth}
65
+ inactiveSlideScale={inactiveSlideScale}
66
+ inactiveSlideOpacity={inactiveSlideOpacity}
67
+ activeSlideAlignment={activeSlideAlignment}
68
+ onSnapToItem={(index) => {
69
+ setActiveIndex(index);
70
+ onSnapToItem(index);
71
+ }}
72
+ contentContainerCustomStyle={{
73
+ paddingHorizontal: sidePadding,
74
+ }}
75
+ loop={loop}
76
+ autoplay={autoplay}
77
+ autoplayDelay={autoPlayDelay}
78
+ {...rest}
79
+ />
80
+
81
+ {showPagination && (
82
+ <Pagination
83
+ dotsLength={safeData.length}
84
+ activeDotIndex={activeIndex}
85
+ dotStyle={[styles.dot, dotStyle]}
86
+ inactiveDotOpacity={0.3}
87
+ inactiveDotStyle={[inActiveDotStyle]}
88
+ inactiveDotScale={inActiveDotScale}
89
+ dotContainerStyle={[{ marginHorizontal: 4 , marginBottom: 0}]}
90
+ containerStyle={paginationContainerStyle}
91
+ />
92
+ )}
93
+ </View>
94
+ );
95
+ };
96
+
97
+ const styles = StyleSheet.create({
98
+ dot: {
99
+ width: 8,
100
+ height: 8,
101
+ borderRadius: 4,
102
+ backgroundColor: "#fff",
103
+ },
104
+ });
105
+
106
+ export default SnapCarousel;
@@ -0,0 +1,12 @@
1
+ class AcmoAPIEndpoints {
2
+ public static readonly TARGETED_CAMPAIGNS = "campaigns";
3
+ public static readonly ACTIVE_CAMPAIGNS = "campaigns/activated";
4
+ public static readonly SUMMARY = "campaigns/activated/summary";
5
+ public static readonly ENGAGEMENT = "account/engagement";
6
+ public static readonly USER_ACTIVITIES = "account/activity";
7
+ public static readonly ACTIVATE_CAMPAIGN = (id: number) => `campaigns/${id}/activate`;
8
+ public static readonly TRANSLATIONS = (locale: string) => `translations/${locale}`;
9
+ public static readonly TRANSLATIONS_VERSION = "translations/version";
10
+ }
11
+
12
+ export default AcmoAPIEndpoints;
@@ -0,0 +1,16 @@
1
+ export const getContrastColor = (hexColor: string | null | undefined): string => {
2
+ if (!hexColor) return 'white';
3
+
4
+ let hex = hexColor.replace('#', '');
5
+
6
+ if (hex.length === 3) {
7
+ hex = hex.split('').map(char => char + char).join('');
8
+ }
9
+
10
+ const r = parseInt(hex.substring(0, 2), 16);
11
+ const g = parseInt(hex.substring(2, 4), 16);
12
+ const b = parseInt(hex.substring(4, 6), 16);
13
+ const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
14
+
15
+ return (yiq >= 128) ? 'black' : 'white';
16
+ };
@@ -0,0 +1,11 @@
1
+ export const Logger = {
2
+ log: (...args: any[]) => {
3
+ if (__DEV__) console.log(...args);
4
+ },
5
+ warn: (...args: any[]) => {
6
+ if (__DEV__) console.warn(...args);
7
+ },
8
+ error: (...args: any[]) => {
9
+ if (__DEV__) console.error(...args);
10
+ }
11
+ };
@@ -0,0 +1,6 @@
1
+ import { View } from 'react-native';
2
+
3
+ if (typeof View.propTypes === 'undefined') {
4
+ View.propTypes = {};
5
+ }
6
+
@@ -0,0 +1,89 @@
1
+ import axios from "axios";
2
+ import NetworkCommon from "./network-common";
3
+
4
+ export type HttpError = {
5
+ type: "network" | "server" | "timeout" | "unknown";
6
+ status?: number;
7
+ data?: any;
8
+ message: string;
9
+ };
10
+
11
+ class HttpClient {
12
+ private handleError(error: any): HttpError {
13
+ if (axios.isAxiosError(error)) {
14
+ const status = error.response?.status;
15
+ const data = error.response?.data;
16
+
17
+ if (!error.response) {
18
+ return {
19
+ type: 'network',
20
+ message: 'Network error or no response from server',
21
+ };
22
+ }
23
+
24
+ if (error.code === 'ECONNABORTED') {
25
+ return {
26
+ type: 'timeout',
27
+ message: 'Request timed out',
28
+ };
29
+ }
30
+
31
+ return {
32
+ type: 'server',
33
+ status,
34
+ data,
35
+ message: error.message,
36
+ };
37
+ }
38
+
39
+ return {
40
+ type: 'unknown',
41
+ message: String(error),
42
+ };
43
+ }
44
+
45
+ async get(url: string, params?: any) {
46
+ const api = NetworkCommon.getInstance().getAxios();
47
+ try {
48
+ const response = await api.get(url, {
49
+ params: params ?? {},
50
+ });
51
+ return { status: response.status, data: response.data };
52
+ } catch (error) {
53
+ throw this.handleError(error);
54
+ }
55
+ }
56
+
57
+ async post(url: string, data?: any, config?: any) {
58
+ const api = NetworkCommon.getInstance().getAxios();
59
+ try {
60
+ const response = await api.post(url, data, config);
61
+ return { status: response.status, data: response.data };
62
+ } catch (error) {
63
+ throw this.handleError(error);
64
+ }
65
+ }
66
+
67
+ async put(url: string, data?: any, config?: any) {
68
+ const api = NetworkCommon.getInstance().getAxios();
69
+ try {
70
+ const response = await api.put(url, data, config);
71
+ return { status: response.status, data: response.data };
72
+ } catch (error) {
73
+ throw this.handleError(error);
74
+ }
75
+ }
76
+
77
+ async delete(url: string, config?: any) {
78
+ const api = NetworkCommon.getInstance().getAxios();
79
+ try {
80
+ const response = await api.delete(url, config);
81
+ return { status: response.status, data: response.data };
82
+ } catch (error) {
83
+ throw this.handleError(error);
84
+ }
85
+ }
86
+ }
87
+
88
+ export const http = new HttpClient();
89
+
@@ -0,0 +1,128 @@
1
+ import axios, { type AxiosInstance, AxiosError } from 'axios';
2
+ import { AcmoConfig } from '../../../acmo_config';
3
+ import { Logger } from '../helpers/logger';
4
+ import TyradsSdkCore from '../tyrads-sdk-core';
5
+ import { getData } from '../storage/storage';
6
+
7
+ const BASE_URL = AcmoConfig.BASE_URL;
8
+
9
+ class NetworkCommon {
10
+ private static instance: NetworkCommon;
11
+ private axiosInstance: AxiosInstance | null = null;
12
+
13
+ private constructor() { }
14
+
15
+
16
+ public static getInstance(): NetworkCommon {
17
+ if (!NetworkCommon.instance) {
18
+ NetworkCommon.instance = new NetworkCommon();
19
+ }
20
+ return NetworkCommon.instance;
21
+ }
22
+
23
+ public async init(): Promise<void> {
24
+ if (this.axiosInstance) return;
25
+
26
+ this.axiosInstance = axios.create({
27
+ baseURL: BASE_URL,
28
+ timeout: 10000,
29
+ headers: {
30
+ 'Content-Type': 'application/json',
31
+ Accept: 'application/json',
32
+ },
33
+ });
34
+
35
+ this.addInterceptors();
36
+ }
37
+
38
+ private logSafe(title: string, data: any) {
39
+ if (!__DEV__) return;
40
+
41
+ try {
42
+ console.group(title);
43
+ console.log(JSON.stringify(data, null, 2));
44
+ console.groupEnd();
45
+ } catch {
46
+ console.log(title, data);
47
+ }
48
+ }
49
+
50
+ private addInterceptors() {
51
+ if (!this.axiosInstance) return;
52
+
53
+ this.axiosInstance.interceptors.request.use(
54
+ async (config) => {
55
+ const apiKey = TyradsSdkCore.apiKey;
56
+ const apiSecret = TyradsSdkCore.apiSecret;
57
+ const sdkPlatform = AcmoConfig.SDK_PLATFORM;
58
+ const sdkVersion = AcmoConfig.SDK_VERSION;
59
+
60
+ let userId = TyradsSdkCore.userId;
61
+ if (!userId) {
62
+ userId = (await getData<string>('xUserId')) || '';
63
+ }
64
+
65
+ config.headers['X-API-Key'] = apiKey;
66
+ config.headers['X-API-Secret'] = apiSecret;
67
+ config.headers['X-User-ID'] = userId;
68
+ config.headers['X-SDK-Platform'] = sdkPlatform;
69
+ config.headers['X-SDK-Version'] = sdkVersion;
70
+
71
+ if (__DEV__) {
72
+ this.logSafe('HTTP REQUEST', {
73
+ timestamp: new Date().toISOString(),
74
+ method: config.method?.toUpperCase(),
75
+ url: `${config.baseURL}${config.url}`,
76
+ headers: {
77
+ ...config.headers,
78
+ 'X-API-Key': '***',
79
+ 'X-API-Secret': '***',
80
+ },
81
+ body: config.data,
82
+ });
83
+ }
84
+ return config;
85
+ },
86
+ (error) => {
87
+ Logger.error('Request Interceptor Error:', error);
88
+ return Promise.reject(error);
89
+ }
90
+ );
91
+
92
+ this.axiosInstance.interceptors.response.use(
93
+ (response) => {
94
+ if (__DEV__) {
95
+ this.logSafe('HTTP RESPONSE', {
96
+ timestamp: new Date().toISOString(),
97
+ status: response.status,
98
+ url: response.config.url,
99
+ data: response.data,
100
+ });
101
+ }
102
+ return response;
103
+ },
104
+ (error: AxiosError) => {
105
+ if (__DEV__) {
106
+ this.logSafe('HTTP ERROR', {
107
+ timestamp: new Date().toISOString(),
108
+ isAxiosError: axios.isAxiosError(error),
109
+ status: error.response?.status,
110
+ url: error.config?.url,
111
+ message: error.message,
112
+ responseData: error.response?.data,
113
+ });
114
+ }
115
+ return Promise.reject(error);
116
+ }
117
+ );
118
+ }
119
+
120
+ public getAxios(): AxiosInstance {
121
+ if (!this.axiosInstance) {
122
+ throw new Error('NetworkCommon not initialized. Call init() first.');
123
+ }
124
+ return this.axiosInstance;
125
+ }
126
+ }
127
+
128
+ export default NetworkCommon;