@tyrads.com/tyrads-sdk 3.0.0-beta.0 → 3.1.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 (225) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/tyradssdk/TyradsSdkModule.kt +21 -4
  3. package/ios/Tyrads/InitModel.swift +3 -0
  4. package/ios/Tyrads/Tyrads.swift +106 -191
  5. package/ios/Tyrads/WebViewController.swift +171 -0
  6. package/ios/Tyrads/helpers/device_details.swift +58 -0
  7. package/ios/TyradsSdk.mm +7 -1
  8. package/ios/TyradsSdk.swift +42 -27
  9. package/lib/commonjs/acmo/core/helpers/launcher.js +20 -0
  10. package/lib/commonjs/acmo/core/helpers/launcher.js.map +1 -0
  11. package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js +76 -0
  12. package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js.map +1 -0
  13. package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js +7 -10
  14. package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js.map +1 -1
  15. package/lib/commonjs/acmo/modules/dashboard/components/custom_scroller.js +141 -0
  16. package/lib/commonjs/acmo/modules/dashboard/components/custom_scroller.js.map +1 -0
  17. package/lib/commonjs/acmo/{core/marquee.js → modules/dashboard/components/custom_shimmer.js} +46 -34
  18. package/lib/commonjs/acmo/modules/dashboard/components/custom_shimmer.js.map +1 -0
  19. package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js +264 -0
  20. package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js.map +1 -0
  21. package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js +197 -0
  22. package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js.map +1 -0
  23. package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js +83 -0
  24. package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js.map +1 -0
  25. package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js +12 -10
  26. package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js.map +1 -1
  27. package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js +118 -0
  28. package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js.map +1 -0
  29. package/lib/commonjs/acmo/modules/dashboard/repository.js +108 -32
  30. package/lib/commonjs/acmo/modules/dashboard/repository.js.map +1 -1
  31. package/lib/commonjs/acmo/modules/dashboard/top_offers.js +70 -63
  32. package/lib/commonjs/acmo/modules/dashboard/top_offers.js.map +1 -1
  33. package/lib/commonjs/assets/images/angle_up.png +0 -0
  34. package/lib/commonjs/assets/images/diamond.png +0 -0
  35. package/lib/commonjs/assets/images/info.png +0 -0
  36. package/lib/commonjs/assets/images/info_icon.png +0 -0
  37. package/lib/commonjs/assets/images/premium-emptybg.jpeg +0 -0
  38. package/lib/commonjs/assets/images/rank_1.png +0 -0
  39. package/lib/commonjs/assets/images/rank_2.png +0 -0
  40. package/lib/commonjs/assets/images/rank_3.png +0 -0
  41. package/lib/commonjs/assets/images/rank_4.png +0 -0
  42. package/lib/commonjs/assets/images/rank_5.png +0 -0
  43. package/lib/commonjs/index.js +11 -11
  44. package/lib/commonjs/index.js.map +1 -1
  45. package/lib/module/acmo/core/helpers/launcher.js +15 -0
  46. package/lib/module/acmo/core/helpers/launcher.js.map +1 -0
  47. package/lib/module/acmo/modules/dashboard/components/active_offers_button.js +70 -0
  48. package/lib/module/acmo/modules/dashboard/components/active_offers_button.js.map +1 -0
  49. package/lib/module/acmo/modules/dashboard/components/custom_card.js +7 -10
  50. package/lib/module/acmo/modules/dashboard/components/custom_card.js.map +1 -1
  51. package/lib/module/acmo/modules/dashboard/components/custom_scroller.js +135 -0
  52. package/lib/module/acmo/modules/dashboard/components/custom_scroller.js.map +1 -0
  53. package/lib/module/acmo/modules/dashboard/components/custom_shimmer.js +66 -0
  54. package/lib/module/acmo/modules/dashboard/components/custom_shimmer.js.map +1 -0
  55. package/lib/module/acmo/modules/dashboard/components/offer_card.js +257 -0
  56. package/lib/module/acmo/modules/dashboard/components/offer_card.js.map +1 -0
  57. package/lib/module/acmo/modules/dashboard/components/offer_list_item.js +191 -0
  58. package/lib/module/acmo/modules/dashboard/components/offer_list_item.js.map +1 -0
  59. package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js +78 -0
  60. package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js.map +1 -0
  61. package/lib/module/acmo/modules/dashboard/components/premium_header.js +12 -10
  62. package/lib/module/acmo/modules/dashboard/components/premium_header.js.map +1 -1
  63. package/lib/module/acmo/modules/dashboard/components/premium_loading.js +113 -0
  64. package/lib/module/acmo/modules/dashboard/components/premium_loading.js.map +1 -0
  65. package/lib/module/acmo/modules/dashboard/repository.js +105 -30
  66. package/lib/module/acmo/modules/dashboard/repository.js.map +1 -1
  67. package/lib/module/acmo/modules/dashboard/top_offers.js +71 -64
  68. package/lib/module/acmo/modules/dashboard/top_offers.js.map +1 -1
  69. package/lib/module/assets/images/angle_up.png +0 -0
  70. package/lib/module/assets/images/diamond.png +0 -0
  71. package/lib/module/assets/images/info.png +0 -0
  72. package/lib/module/assets/images/info_icon.png +0 -0
  73. package/lib/module/assets/images/premium-emptybg.jpeg +0 -0
  74. package/lib/module/assets/images/rank_1.png +0 -0
  75. package/lib/module/assets/images/rank_2.png +0 -0
  76. package/lib/module/assets/images/rank_3.png +0 -0
  77. package/lib/module/assets/images/rank_4.png +0 -0
  78. package/lib/module/assets/images/rank_5.png +0 -0
  79. package/lib/module/index.js +11 -11
  80. package/lib/module/index.js.map +1 -1
  81. package/lib/typescript/commonjs/src/acmo/core/helpers/launcher.d.ts +3 -0
  82. package/lib/typescript/commonjs/src/acmo/core/helpers/launcher.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/src/acmo/core/storage/storage.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/active_offers_button.d.ts +9 -0
  85. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_card.d.ts.map +1 -1
  87. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_scroller.d.ts +17 -0
  88. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_shimmer.d.ts +11 -0
  90. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +1 -0
  91. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_card.d.ts +12 -0
  92. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_card.d.ts.map +1 -0
  93. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts +15 -0
  94. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts +7 -0
  96. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts +9 -0
  98. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts +2 -1
  100. package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts +8 -7
  102. package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/src/index.d.ts +4 -6
  104. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  105. package/lib/typescript/module/src/acmo/core/helpers/launcher.d.ts +3 -0
  106. package/lib/typescript/module/src/acmo/core/helpers/launcher.d.ts.map +1 -0
  107. package/lib/typescript/module/src/acmo/core/storage/storage.d.ts.map +1 -1
  108. package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts +9 -0
  109. package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +1 -0
  110. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_card.d.ts.map +1 -1
  111. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_scroller.d.ts +17 -0
  112. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +1 -0
  113. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_shimmer.d.ts +11 -0
  114. package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +1 -0
  115. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_card.d.ts +12 -0
  116. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_card.d.ts.map +1 -0
  117. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts +15 -0
  118. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +1 -0
  119. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts +7 -0
  120. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +1 -0
  121. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts +9 -0
  122. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +1 -0
  123. package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts +2 -1
  124. package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
  125. package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts +8 -7
  126. package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
  127. package/lib/typescript/module/src/index.d.ts +4 -6
  128. package/lib/typescript/module/src/index.d.ts.map +1 -1
  129. package/package.json +3 -2
  130. package/readme.md +8 -8
  131. package/src/acmo/core/helpers/launcher.ts +14 -0
  132. package/src/acmo/core/types/types.d.ts +11 -13
  133. package/src/acmo/modules/dashboard/components/active_offers_button.tsx +61 -0
  134. package/src/acmo/modules/dashboard/components/custom_card.tsx +5 -8
  135. package/src/acmo/modules/dashboard/components/custom_scroller.tsx +164 -0
  136. package/src/acmo/modules/dashboard/components/custom_shimmer.tsx +75 -0
  137. package/src/acmo/modules/dashboard/components/offer_card.tsx +248 -0
  138. package/src/acmo/modules/dashboard/components/offer_list_item.tsx +225 -0
  139. package/src/acmo/modules/dashboard/components/premium_empty_widget.tsx +76 -0
  140. package/src/acmo/modules/dashboard/components/premium_header.tsx +8 -8
  141. package/src/acmo/modules/dashboard/components/premium_loading.tsx +78 -0
  142. package/src/acmo/modules/dashboard/repository.ts +121 -46
  143. package/src/acmo/modules/dashboard/top_offers.tsx +89 -52
  144. package/src/assets/images/angle_up.png +0 -0
  145. package/src/assets/images/diamond.png +0 -0
  146. package/src/assets/images/info.png +0 -0
  147. package/src/assets/images/info_icon.png +0 -0
  148. package/src/assets/images/premium-emptybg.jpeg +0 -0
  149. package/src/assets/images/rank_1.png +0 -0
  150. package/src/assets/images/rank_2.png +0 -0
  151. package/src/assets/images/rank_3.png +0 -0
  152. package/src/assets/images/rank_4.png +0 -0
  153. package/src/assets/images/rank_5.png +0 -0
  154. package/src/index.tsx +15 -18
  155. package/lib/commonjs/acmo/core/marquee.js.map +0 -1
  156. package/lib/commonjs/acmo/modules/dashboard/components/auto_scroller.js +0 -87
  157. package/lib/commonjs/acmo/modules/dashboard/components/auto_scroller.js.map +0 -1
  158. package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js +0 -48
  159. package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js.map +0 -1
  160. package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js +0 -158
  161. package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js.map +0 -1
  162. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js +0 -180
  163. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js.map +0 -1
  164. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js +0 -102
  165. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js.map +0 -1
  166. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js +0 -41
  167. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js.map +0 -1
  168. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js +0 -214
  169. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js.map +0 -1
  170. package/lib/module/acmo/core/marquee.js +0 -54
  171. package/lib/module/acmo/core/marquee.js.map +0 -1
  172. package/lib/module/acmo/modules/dashboard/components/auto_scroller.js +0 -81
  173. package/lib/module/acmo/modules/dashboard/components/auto_scroller.js.map +0 -1
  174. package/lib/module/acmo/modules/dashboard/components/my_games_button.js +0 -43
  175. package/lib/module/acmo/modules/dashboard/components/my_games_button.js.map +0 -1
  176. package/lib/module/acmo/modules/dashboard/components/offer_info_section.js +0 -153
  177. package/lib/module/acmo/modules/dashboard/components/offer_info_section.js.map +0 -1
  178. package/lib/module/acmo/modules/dashboard/components/premium_option_1.js +0 -174
  179. package/lib/module/acmo/modules/dashboard/components/premium_option_1.js.map +0 -1
  180. package/lib/module/acmo/modules/dashboard/components/premium_option_2.js +0 -97
  181. package/lib/module/acmo/modules/dashboard/components/premium_option_2.js.map +0 -1
  182. package/lib/module/acmo/modules/dashboard/components/premium_option_3.js +0 -36
  183. package/lib/module/acmo/modules/dashboard/components/premium_option_3.js.map +0 -1
  184. package/lib/module/acmo/modules/dashboard/components/premium_option_4.js +0 -209
  185. package/lib/module/acmo/modules/dashboard/components/premium_option_4.js.map +0 -1
  186. package/lib/typescript/commonjs/src/acmo/core/marquee.d.ts +0 -11
  187. package/lib/typescript/commonjs/src/acmo/core/marquee.d.ts.map +0 -1
  188. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/auto_scroller.d.ts +0 -10
  189. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/auto_scroller.d.ts.map +0 -1
  190. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts +0 -8
  191. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +0 -1
  192. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts +0 -11
  193. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +0 -1
  194. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts +0 -9
  195. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +0 -1
  196. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts +0 -9
  197. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +0 -1
  198. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts +0 -9
  199. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +0 -1
  200. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts +0 -9
  201. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +0 -1
  202. package/lib/typescript/module/src/acmo/core/marquee.d.ts +0 -11
  203. package/lib/typescript/module/src/acmo/core/marquee.d.ts.map +0 -1
  204. package/lib/typescript/module/src/acmo/modules/dashboard/components/auto_scroller.d.ts +0 -10
  205. package/lib/typescript/module/src/acmo/modules/dashboard/components/auto_scroller.d.ts.map +0 -1
  206. package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts +0 -8
  207. package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +0 -1
  208. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts +0 -11
  209. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +0 -1
  210. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts +0 -9
  211. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +0 -1
  212. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts +0 -9
  213. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +0 -1
  214. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts +0 -9
  215. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +0 -1
  216. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts +0 -9
  217. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +0 -1
  218. package/src/acmo/core/marquee.tsx +0 -62
  219. package/src/acmo/modules/dashboard/components/auto_scroller.tsx +0 -85
  220. package/src/acmo/modules/dashboard/components/my_games_button.tsx +0 -40
  221. package/src/acmo/modules/dashboard/components/offer_info_section.tsx +0 -139
  222. package/src/acmo/modules/dashboard/components/premium_option_1.tsx +0 -163
  223. package/src/acmo/modules/dashboard/components/premium_option_2.tsx +0 -100
  224. package/src/acmo/modules/dashboard/components/premium_option_3.tsx +0 -42
  225. package/src/acmo/modules/dashboard/components/premium_option_4.tsx +0 -185
@@ -0,0 +1,164 @@
1
+ import React, { useRef, useState, useEffect } from 'react';
2
+ import {
3
+ View,
4
+ Animated,
5
+ StyleSheet,
6
+ type ViewStyle,
7
+ type StyleProp,
8
+ type LayoutChangeEvent,
9
+ } from 'react-native';
10
+
11
+ interface PagerProps {
12
+ totalPages: number;
13
+ delayInMillis?: number;
14
+ premiumColor?: string;
15
+ content: (index: number) => React.ReactNode;
16
+ viewportFraction?: number;
17
+ scaleFactor?: number;
18
+ spacing?: number;
19
+ indicatorStyle?: StyleProp<ViewStyle>;
20
+ activeIndicatorColor?: string;
21
+ inactiveIndicatorColor?: string;
22
+ }
23
+
24
+ const AcmoScrollPager: React.FC<PagerProps> = ({
25
+ totalPages,
26
+ delayInMillis = 5000,
27
+ content,
28
+ viewportFraction = 0.92,
29
+ scaleFactor = 0.94,
30
+ spacing = 2,
31
+ indicatorStyle,
32
+ activeIndicatorColor = 'red',
33
+ inactiveIndicatorColor = 'lightgray',
34
+ }) => {
35
+ const scrollX = useRef(new Animated.Value(0)).current;
36
+ const scrollViewRef = useRef<React.RefObject<typeof Animated.ScrollView> | any>(null);
37
+ const [currentPage, setCurrentPage] = useState(0);
38
+ const [containerWidth, setContainerWidth] = useState<number | null>(null);
39
+
40
+ const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
41
+
42
+ const onContainerLayout = (e: LayoutChangeEvent) => {
43
+ const { width } = e.nativeEvent.layout;
44
+ if (width !== containerWidth) setContainerWidth(width);
45
+ };
46
+
47
+ useEffect(() => {
48
+ if (!containerWidth) return;
49
+
50
+ const itemWidth = containerWidth * viewportFraction;
51
+ const offset = itemWidth + spacing;
52
+
53
+ intervalRef.current = setInterval(() => {
54
+ const next = (currentPage + 1) % totalPages;
55
+ setCurrentPage(next);
56
+ scrollViewRef.current.scrollTo({
57
+ x: next * offset,
58
+ animated: true,
59
+ });
60
+ }, delayInMillis);
61
+
62
+ return () => {
63
+ if (intervalRef.current) clearInterval(intervalRef.current);
64
+ };
65
+ }, [containerWidth, currentPage, delayInMillis, totalPages, viewportFraction, spacing]);
66
+
67
+ const handleScroll = Animated.event(
68
+ [{ nativeEvent: { contentOffset: { x: scrollX } } }],
69
+ {
70
+ useNativeDriver: true,
71
+ listener: (event: { nativeEvent: { contentOffset: { x: number } } }) => {
72
+ if (!containerWidth) return;
73
+ const offset = containerWidth * viewportFraction + spacing;
74
+ const index = Math.round(event.nativeEvent.contentOffset.x / offset);
75
+ setCurrentPage(index);
76
+ },
77
+ }
78
+ );
79
+
80
+ const renderIndicators = () => (
81
+ <View style={[styles.indicatorContainer, indicatorStyle]}>
82
+ {Array.from({ length: totalPages }, (_, i) => (
83
+ <View
84
+ key={i}
85
+ style={[
86
+ styles.indicator,
87
+ {
88
+ backgroundColor:
89
+ i === currentPage ? activeIndicatorColor : inactiveIndicatorColor,
90
+ },
91
+ ]}
92
+ />
93
+ ))}
94
+ </View>
95
+ );
96
+
97
+ if (!containerWidth) {
98
+ return <View onLayout={onContainerLayout} style={{ width: '100%' }} />;
99
+ }
100
+
101
+ const itemWidth = containerWidth * viewportFraction;
102
+ const itemOffset = itemWidth + spacing;
103
+ const sidePadding = (containerWidth - itemWidth - 16) / 2;
104
+
105
+ return (
106
+ <View onLayout={onContainerLayout} style={{ width: '100%', alignItems: 'center' }}>
107
+ <Animated.ScrollView
108
+ ref={scrollViewRef}
109
+ horizontal
110
+ pagingEnabled={false}
111
+ snapToInterval={itemOffset}
112
+ decelerationRate="fast"
113
+ showsHorizontalScrollIndicator={false}
114
+ scrollEventThrottle={16}
115
+ onScroll={handleScroll}
116
+ contentContainerStyle={{ paddingHorizontal: sidePadding }}
117
+ >
118
+ {Array.from({ length: totalPages }, (_, i) => {
119
+ const inputRange = [
120
+ itemOffset * (i - 1),
121
+ itemOffset * i,
122
+ itemOffset * (i + 1),
123
+ ];
124
+
125
+ const scale = scrollX.interpolate({
126
+ inputRange,
127
+ outputRange: [scaleFactor, 1, scaleFactor],
128
+ extrapolate: 'clamp',
129
+ });
130
+
131
+ return (
132
+ <Animated.View
133
+ key={i}
134
+ style={{
135
+ width: itemWidth,
136
+ transform: [{ scale }],
137
+ }}
138
+ >
139
+ {content(i)}
140
+ </Animated.View>
141
+ );
142
+ })}
143
+ </Animated.ScrollView>
144
+ {renderIndicators()}
145
+ </View>
146
+ );
147
+ };
148
+
149
+ const styles = StyleSheet.create({
150
+ indicatorContainer: {
151
+ flexDirection: 'row',
152
+ justifyContent: 'center',
153
+ marginTop: 6,
154
+ marginBottom: 8,
155
+ },
156
+ indicator: {
157
+ width: 8,
158
+ height: 8,
159
+ borderRadius: 4,
160
+ marginHorizontal: 4,
161
+ },
162
+ });
163
+
164
+ export default AcmoScrollPager;
@@ -0,0 +1,75 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import { View, Animated, StyleSheet, Dimensions, type DimensionValue, type ViewStyle, type StyleProp } from 'react-native';
3
+
4
+ interface ShimmerProps {
5
+ width?: DimensionValue;
6
+ shimmerHeight?: number;
7
+ style?: StyleProp<ViewStyle>;
8
+ duration?: number;
9
+ }
10
+
11
+ const SCREEN_WIDTH = Dimensions.get('window').width;
12
+
13
+ const Shimmer: React.FC<ShimmerProps> = ({
14
+ width = '100%',
15
+ shimmerHeight: height = 16,
16
+ style,
17
+ duration = 1500,
18
+ }) => {
19
+ const translateX = useRef(new Animated.Value(-1)).current;
20
+
21
+ useEffect(() => {
22
+ const animation = Animated.loop(
23
+ Animated.timing(translateX, {
24
+ toValue: 1,
25
+ duration,
26
+ useNativeDriver: true,
27
+ }),
28
+ );
29
+ animation.start();
30
+ return () => animation.stop();
31
+ }, [translateX, duration]);
32
+
33
+ const translateXInterpolate = translateX.interpolate({
34
+ inputRange: [-1, 1],
35
+ outputRange: [-SCREEN_WIDTH, SCREEN_WIDTH],
36
+ });
37
+
38
+ return (
39
+ <View style={[styles.container, { width }, style]}>
40
+ <View style={[styles.shimmerBackground, { height }]} />
41
+ <Animated.View
42
+ style={[
43
+ styles.shimmerOverlay,
44
+ {
45
+ width: SCREEN_WIDTH,
46
+ height,
47
+ transform: [{ translateX: translateXInterpolate }],
48
+ },
49
+ ]}
50
+ />
51
+ </View>
52
+ );
53
+ };
54
+
55
+ const styles = StyleSheet.create({
56
+ container: {
57
+ overflow: 'hidden',
58
+ backgroundColor: '#e1e1e1',
59
+ borderRadius: 4,
60
+ },
61
+ shimmerBackground: {
62
+ flex: 1,
63
+ backgroundColor: '#d3d3d3',
64
+ },
65
+ shimmerOverlay: {
66
+ position: 'absolute',
67
+ top: 0,
68
+ left: 0,
69
+ backgroundColor: 'rgba(255,255,255,0.5)',
70
+ opacity: 0.4,
71
+ borderRadius: 4,
72
+ },
73
+ });
74
+
75
+ export default Shimmer;
@@ -0,0 +1,248 @@
1
+ import numeral from 'numeral';
2
+ import React, { useState } from 'react';
3
+ import {
4
+ View,
5
+ Text,
6
+ Image,
7
+ StyleSheet,
8
+ TouchableOpacity,
9
+ ActivityIndicator,
10
+ } from 'react-native';
11
+
12
+
13
+ interface Props {
14
+ item: Campaign;
15
+ onButtonClick: () => Promise<void>;
16
+ currencySaleModel?: CurrencySales;
17
+ premiumColor?: string;
18
+ isLoading: boolean;
19
+ onTap?: () => Promise<void>;
20
+ }
21
+
22
+ const AcmoOfferCard: React.FC<Props> = ({
23
+ item,
24
+ onButtonClick,
25
+ currencySaleModel,
26
+ premiumColor,
27
+ isLoading,
28
+ onTap,
29
+ }) => {
30
+ const [loading, setLoading] = useState<boolean>(isLoading);
31
+ const bonusMultiplier = currencySaleModel?.multiplier ?? 1;
32
+ const itemHeight = 132;
33
+
34
+ const handleClick = async () => {
35
+ if (loading) return;
36
+ setLoading(true);
37
+ await onButtonClick();
38
+ setLoading(false);
39
+ };
40
+
41
+ return (
42
+ <TouchableOpacity
43
+ key={item.campaignId}
44
+ activeOpacity={0.9}
45
+ style={styles.container}
46
+ onPress={() => {
47
+ if (!loading && onTap) onTap();
48
+ }}
49
+ >
50
+ <View style={styles.cardShadow}>
51
+ <View style={[styles.imageContainer, { height: itemHeight }]}>
52
+ <Image
53
+ source={{ uri: item.creative.creativePacks[0]?.creatives[0]?.fileUrl || '' }}
54
+ style={styles.image}
55
+ />
56
+ {item.premium && (
57
+ <View style={styles.diamondIcon}>
58
+ <Image
59
+ style={{ width: 12, height: 12, objectFit: 'contain', tintColor: 'white' }}
60
+ source={require('../../../../assets/images/diamond.png')}
61
+ />
62
+ </View>
63
+ )}
64
+ </View>
65
+
66
+ <View style={styles.detailCard}>
67
+ <View style={styles.header}>
68
+ <Image source={{ uri: item.app.thumbnail }} style={styles.appIcon} />
69
+ <Text style={styles.title}>{item.app.title}</Text>
70
+
71
+ <View style={styles.payoutSection}>
72
+ {currencySaleModel?.multiplier && (
73
+ <Text style={styles.strikePayout}>
74
+ {numeral(item.campaignPayout.totalPlayablePayoutConverted).format("0.00a").toUpperCase()}
75
+ </Text>
76
+ )}
77
+ <View style={styles.payoutRow}>
78
+ <Image source={{ uri: item.currency.adUnitCurrencyIcon }} style={styles.currencyIcon} />
79
+ <Text style={styles.payoutText}>
80
+ {numeral(item.campaignPayout.totalPlayablePayoutConverted * bonusMultiplier).format("0.00a").toUpperCase()}
81
+ </Text>
82
+ </View>
83
+ </View>
84
+
85
+ <TouchableOpacity onPress={onTap} disabled={loading}>
86
+ <Image source={require('../../../../assets/images/info_icon.png')} style={styles.infoIcon} />
87
+ </TouchableOpacity>
88
+ </View>
89
+
90
+ <TouchableOpacity
91
+ style={[styles.button, loading && styles.buttonDisabled, { backgroundColor: loading ? '#888' : premiumColor || '#1C90DF' }]}
92
+ onPress={handleClick}
93
+ disabled={loading}
94
+ >
95
+ {loading ? (
96
+ <ActivityIndicator color="white" />
97
+ ) : (
98
+ <Text style={styles.buttonText}>Play Now</Text>
99
+ )}
100
+ </TouchableOpacity>
101
+ </View>
102
+
103
+ {currencySaleModel?.multiplier && (
104
+ <View style={[styles.bonusBadge, { backgroundColor: `${premiumColor}` || '#1C90DF' }]}>
105
+ <Text style={styles.bonusText}>{currencySaleModel?.multiplier.toFixed(1)}x Bonus</Text>
106
+ </View>
107
+ )}
108
+ {currencySaleModel?.multiplier && (
109
+ <View style={[styles.trianlge, { backgroundColor: `${premiumColor}cc` || '#1C90DF' }]}>
110
+ </View>
111
+
112
+ )}
113
+ </View>
114
+ </TouchableOpacity>
115
+ );
116
+ };
117
+
118
+ const styles = StyleSheet.create({
119
+ container: {
120
+ margin: 16,
121
+ width: "100%"
122
+ },
123
+ cardShadow: {
124
+ borderRadius: 16,
125
+ backgroundColor: 'white',
126
+ shadowColor: 'black',
127
+ shadowOffset: { width: 0, height: 16 },
128
+ shadowOpacity: 0.06,
129
+ shadowRadius: 18,
130
+ elevation: 4,
131
+ },
132
+ imageContainer: {
133
+ borderTopLeftRadius: 16,
134
+ borderTopRightRadius: 16,
135
+ overflow: 'hidden',
136
+ },
137
+ image: {
138
+ width: '100%',
139
+ height: '100%',
140
+ resizeMode: 'cover',
141
+ },
142
+ diamondIcon: {
143
+ position: 'absolute',
144
+ top: 16,
145
+ right: 16,
146
+ backgroundColor: '#1E2020DD',
147
+ width: 28,
148
+ height: 28,
149
+ borderRadius: 8,
150
+ justifyContent: 'center',
151
+ alignItems: 'center',
152
+ },
153
+ diamondText: {
154
+ color: 'white',
155
+ fontSize: 14,
156
+ },
157
+ detailCard: {
158
+ padding: 16,
159
+ },
160
+ header: {
161
+ flexDirection: 'row',
162
+ justifyContent: 'space-between',
163
+ alignItems: 'center',
164
+ },
165
+ appIcon: {
166
+ width: 38,
167
+ height: 38,
168
+ borderRadius: 8,
169
+ marginRight: 8,
170
+ },
171
+ title: {
172
+ flex: 1,
173
+ fontWeight: '600',
174
+ fontSize: 14,
175
+ },
176
+ payoutSection: {
177
+ alignItems: 'flex-end',
178
+ },
179
+ strikePayout: {
180
+ textDecorationLine: 'line-through',
181
+ color: '#454646',
182
+ fontSize: 12,
183
+ },
184
+ payoutRow: {
185
+ flexDirection: 'row',
186
+ alignItems: 'center',
187
+ },
188
+ currencyIcon: {
189
+ width: 16,
190
+ height: 16,
191
+ marginRight: 4,
192
+ },
193
+ payoutText: {
194
+ fontWeight: '700',
195
+ fontSize: 14,
196
+ },
197
+ infoIcon: {
198
+ width: 16,
199
+ height: 16,
200
+ marginLeft: 8,
201
+ },
202
+ button: {
203
+ marginTop: 12,
204
+ height: 42,
205
+ borderRadius: 8,
206
+ justifyContent: 'center',
207
+ alignItems: 'center',
208
+ },
209
+ buttonDisabled: {
210
+ backgroundColor: '#e0e2e7',
211
+ },
212
+ buttonText: {
213
+ color: 'white',
214
+ fontWeight: '600',
215
+ fontSize: 14,
216
+ },
217
+ bonusBadge: {
218
+ position: 'absolute',
219
+ top: 16,
220
+ left: -6,
221
+ paddingVertical: 8,
222
+ paddingHorizontal: 14,
223
+ borderTopRightRadius: 100,
224
+ borderTopLeftRadius: 10,
225
+ borderBottomRightRadius: 100,
226
+ shadowColor: 'black',
227
+ shadowOffset: { width: 0, height: 8 },
228
+ shadowOpacity: 0.3,
229
+ shadowRadius: 10,
230
+ backgroundColor: 'transparent',
231
+ },
232
+ trianlge: {
233
+ position: 'absolute',
234
+ top: 46.6,
235
+ left: -7.4,
236
+ zIndex: -10,
237
+ width: 20,
238
+ height: 10,
239
+ transform: [{ rotate: '65deg' }]
240
+ },
241
+ bonusText: {
242
+ color: 'white',
243
+ fontWeight: '700',
244
+ fontSize: 12,
245
+ },
246
+ });
247
+
248
+ export default AcmoOfferCard;
@@ -0,0 +1,225 @@
1
+ import React from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ TouchableOpacity,
6
+ Image,
7
+ StyleSheet,
8
+ ActivityIndicator,
9
+ } from 'react-native';
10
+ import numeral from 'numeral';
11
+
12
+
13
+
14
+ type Props = {
15
+ offer: Campaign;
16
+ currencySales?: CurrencySales;
17
+ onButtonTap: () => Promise<void>;
18
+ onPress: () => Promise<void>;
19
+ index: number;
20
+ colorPremium?: string;
21
+ colorPremiumFg?: string;
22
+ loadingIndex: number | null;
23
+ setLoadingIndex: (index: number | null) => void;
24
+ };
25
+
26
+ const rankIcons = [
27
+ require('../../../../assets/images/rank_1.png'),
28
+ require('../../../../assets/images/rank_2.png'),
29
+ require('../../../../assets/images/rank_3.png'),
30
+ require('../../../../assets/images/rank_4.png'),
31
+ require('../../../../assets/images/rank_5.png'),
32
+ ];
33
+
34
+ export const AcmoOfferListItem: React.FC<Props> = ({
35
+ offer,
36
+ currencySales,
37
+ onButtonTap,
38
+ onPress,
39
+ index,
40
+ colorPremium,
41
+ colorPremiumFg,
42
+ loadingIndex,
43
+ setLoadingIndex,
44
+ }) => {
45
+ const bonusMultiplier = currencySales?.multiplier ?? 1;
46
+ const isLoading = loadingIndex === index;
47
+ const anyLoading = loadingIndex != null;
48
+
49
+ return (
50
+ <TouchableOpacity
51
+ disabled={anyLoading}
52
+ onPress={onPress}
53
+ style={styles.itemContainer}
54
+ activeOpacity={0.75}
55
+ >
56
+ <View style={styles.container}>
57
+ <Image source={rankIcons[index]} style={styles.rankIcon} />
58
+
59
+ <Image source={{ uri: offer.app.thumbnail }} style={styles.icon} />
60
+
61
+ <View style={styles.details}>
62
+ {currencySales && (
63
+ <View style={[styles.bonusBadge, { backgroundColor: `${colorPremium}20` }]}>
64
+ <Text style={[styles.bonusText, { color: colorPremium }]}>
65
+ {bonusMultiplier}x BONUS
66
+ </Text>
67
+ </View>
68
+ )}
69
+
70
+ <Text numberOfLines={1} style={styles.title} ellipsizeMode="tail">
71
+ {offer.app.title}
72
+ </Text>
73
+
74
+ <View style={styles.payoutRow}>
75
+ {currencySales && (
76
+ <Text style={styles.strikeText}>
77
+ {numeral(offer.campaignPayout.totalPlayablePayoutConverted).format('0.00a')}
78
+ </Text>
79
+ )}
80
+
81
+ <Image
82
+ source={{ uri: offer.currency.adUnitCurrencyIcon }}
83
+ style={styles.currencyIcon}
84
+ />
85
+
86
+ <Text style={styles.payoutText}>
87
+ {numeral(
88
+ offer.campaignPayout.totalPlayablePayoutConverted * bonusMultiplier
89
+ ).format('0.00a')}
90
+ </Text>
91
+ </View>
92
+ </View>
93
+
94
+ <TouchableOpacity
95
+ disabled={anyLoading}
96
+ style={[
97
+ styles.button,
98
+ { backgroundColor: anyLoading ? '#e0e2e7' : colorPremium },
99
+ ]}
100
+ onPress={async () => {
101
+ setLoadingIndex(index)
102
+ await onButtonTap();
103
+ setLoadingIndex(null);
104
+ }}
105
+ >
106
+ {isLoading ? (
107
+ <ActivityIndicator size="small" color="#a3a9b6" />
108
+ ) : null}
109
+ <Text
110
+ style={[
111
+ styles.buttonText,
112
+ {
113
+ color: anyLoading ? '#a3a9b6' : colorPremiumFg ?? '#fff',
114
+ marginLeft: isLoading ? 8 : 0,
115
+ },
116
+ ]}
117
+ >
118
+ Play
119
+ </Text>
120
+ </TouchableOpacity>
121
+
122
+ </View>
123
+ </TouchableOpacity>
124
+ );
125
+ };
126
+
127
+
128
+ const styles = StyleSheet.create({
129
+ itemContainer: {
130
+ flexDirection: 'row',
131
+ flex: 1,
132
+ width: '100%',
133
+ justifyContent: 'space-between',
134
+ alignItems: 'center',
135
+ paddingHorizontal: 16,
136
+ paddingVertical: 8,
137
+ },
138
+ container: {
139
+ flexDirection: 'row',
140
+ marginVertical: 2,
141
+ paddingHorizontal: 0,
142
+ width: '100%',
143
+ position: 'relative',
144
+ },
145
+ rankIcon: {
146
+ position: 'absolute',
147
+ zIndex: 99,
148
+ left: -10,
149
+ top: -8,
150
+ width: 24,
151
+ height: 24,
152
+ resizeMode: 'contain',
153
+ },
154
+ row: {
155
+ flexDirection: 'row',
156
+ alignItems: 'center',
157
+ backgroundColor: '#fff',
158
+ borderRadius: 8,
159
+ padding: 10,
160
+ elevation: 2,
161
+ },
162
+ icon: {
163
+ width: 54,
164
+ height: 54,
165
+ borderRadius: 4,
166
+ marginRight: 10,
167
+ },
168
+ details: {
169
+ flex: 1,
170
+ justifyContent: 'center',
171
+ },
172
+ bonusBadge: {
173
+ alignSelf: 'flex-start',
174
+ paddingHorizontal: 8,
175
+ paddingVertical: 2,
176
+ borderRadius: 16,
177
+ marginBottom: 4,
178
+ },
179
+ bonusText: {
180
+ fontSize: 10,
181
+ fontWeight: '700',
182
+ },
183
+ title: {
184
+ fontSize: 12,
185
+ fontWeight: '500',
186
+ marginBottom: 4,
187
+ color: '#323434',
188
+ },
189
+ payoutRow: {
190
+ flexDirection: 'row',
191
+ alignItems: 'center',
192
+ gap: 10,
193
+ },
194
+ strikeText: {
195
+ fontSize: 12,
196
+ textDecorationLine: 'line-through',
197
+ color: '#323434',
198
+ fontWeight: '300',
199
+ },
200
+ currencyIcon: {
201
+ width: 14,
202
+ height: 14,
203
+ marginHorizontal: 4,
204
+ },
205
+ payoutText: {
206
+ fontSize: 12,
207
+ fontWeight: '700',
208
+ color: '#323434',
209
+ },
210
+ button: {
211
+ marginLeft: 4,
212
+ paddingHorizontal: 12,
213
+ height: 42,
214
+ minWidth: 75,
215
+ justifyContent: 'center',
216
+ alignItems: 'center',
217
+ borderRadius: 8,
218
+ flexDirection: 'row',
219
+ },
220
+ buttonText: {
221
+ fontSize: 14,
222
+ fontWeight: '600',
223
+ color: '#fff',
224
+ },
225
+ });