@tyrads.com/tyrads-sdk 2.0.0-beta.2 → 2.0.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 (122) hide show
  1. package/LICENSE +11 -11
  2. package/android/build.gradle +117 -117
  3. package/android/gradle.properties +5 -5
  4. package/android/src/main/AndroidManifest.xml +3 -3
  5. package/android/src/main/AndroidManifestNew.xml +2 -2
  6. package/android/src/main/java/com/tyradssdk/TyradsSdkComposeViewManager.kt +112 -112
  7. package/android/src/main/java/com/tyradssdk/TyradsSdkModule.kt +56 -56
  8. package/android/src/main/java/com/tyradssdk/TyradsSdkPackage.kt +18 -21
  9. package/ios/Tyrads/AcmoConfig.swift +32 -31
  10. package/ios/Tyrads/ApiHeaders.swift +12 -0
  11. package/ios/Tyrads/InitModel.swift +48 -46
  12. package/ios/Tyrads/Tyrads.swift +199 -176
  13. package/ios/TyradsSdk-Bridging-Header.h +2 -2
  14. package/ios/TyradsSdk.mm +14 -11
  15. package/ios/TyradsSdk.swift +47 -27
  16. package/lib/commonjs/acmo/core/marquee.js.map +1 -1
  17. package/lib/commonjs/acmo/core/storage/storage.js.map +1 -1
  18. package/lib/commonjs/acmo/core/types/types.d.js.map +1 -1
  19. package/lib/commonjs/acmo/modules/dashboard/components/auto_scroller.js.map +1 -1
  20. package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js.map +1 -1
  21. package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js +3 -5
  22. package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js.map +1 -1
  23. package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js +3 -8
  24. package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js.map +1 -1
  25. package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js +3 -3
  26. package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js.map +1 -1
  27. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js +2 -7
  28. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js.map +1 -1
  29. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js +4 -6
  30. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js.map +1 -1
  31. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js +4 -6
  32. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js.map +1 -1
  33. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js +5 -6
  34. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js.map +1 -1
  35. package/lib/commonjs/acmo/modules/dashboard/repository.js.map +1 -1
  36. package/lib/commonjs/acmo/modules/dashboard/top_offers.js +23 -7
  37. package/lib/commonjs/acmo/modules/dashboard/top_offers.js.map +1 -1
  38. package/lib/commonjs/i18n.js.map +1 -1
  39. package/lib/commonjs/index.js +12 -2
  40. package/lib/commonjs/index.js.map +1 -1
  41. package/lib/module/acmo/core/marquee.js.map +1 -1
  42. package/lib/module/acmo/core/storage/storage.js.map +1 -1
  43. package/lib/module/acmo/core/types/types.d.js.map +1 -1
  44. package/lib/module/acmo/modules/dashboard/components/auto_scroller.js.map +1 -1
  45. package/lib/module/acmo/modules/dashboard/components/custom_card.js.map +1 -1
  46. package/lib/module/acmo/modules/dashboard/components/my_games_button.js +3 -5
  47. package/lib/module/acmo/modules/dashboard/components/my_games_button.js.map +1 -1
  48. package/lib/module/acmo/modules/dashboard/components/offer_info_section.js +3 -8
  49. package/lib/module/acmo/modules/dashboard/components/offer_info_section.js.map +1 -1
  50. package/lib/module/acmo/modules/dashboard/components/premium_header.js +3 -3
  51. package/lib/module/acmo/modules/dashboard/components/premium_header.js.map +1 -1
  52. package/lib/module/acmo/modules/dashboard/components/premium_option_1.js +2 -7
  53. package/lib/module/acmo/modules/dashboard/components/premium_option_1.js.map +1 -1
  54. package/lib/module/acmo/modules/dashboard/components/premium_option_2.js +4 -6
  55. package/lib/module/acmo/modules/dashboard/components/premium_option_2.js.map +1 -1
  56. package/lib/module/acmo/modules/dashboard/components/premium_option_3.js +4 -6
  57. package/lib/module/acmo/modules/dashboard/components/premium_option_3.js.map +1 -1
  58. package/lib/module/acmo/modules/dashboard/components/premium_option_4.js +5 -6
  59. package/lib/module/acmo/modules/dashboard/components/premium_option_4.js.map +1 -1
  60. package/lib/module/acmo/modules/dashboard/repository.js.map +1 -1
  61. package/lib/module/acmo/modules/dashboard/top_offers.js +23 -7
  62. package/lib/module/acmo/modules/dashboard/top_offers.js.map +1 -1
  63. package/lib/module/i18n.js.map +1 -1
  64. package/lib/module/index.js +12 -2
  65. package/lib/module/index.js.map +1 -1
  66. package/lib/typescript/commonjs/src/acmo/core/storage/storage.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts +1 -0
  68. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts +1 -0
  70. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts +1 -0
  72. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
  73. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts +1 -0
  74. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts +1 -0
  76. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts +1 -0
  78. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts +1 -0
  80. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +1 -1
  81. package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts +1 -0
  83. package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  85. package/lib/typescript/module/src/acmo/core/storage/storage.d.ts.map +1 -1
  86. package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts +1 -0
  87. package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +1 -1
  88. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts +1 -0
  89. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +1 -1
  90. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts +1 -0
  91. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
  92. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts +1 -0
  93. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +1 -1
  94. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts +1 -0
  95. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +1 -1
  96. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts +1 -0
  97. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +1 -1
  98. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts +1 -0
  99. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +1 -1
  100. package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
  101. package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts +1 -0
  102. package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
  103. package/lib/typescript/module/src/index.d.ts.map +1 -1
  104. package/package.json +197 -197
  105. package/readme.md +95 -97
  106. package/src/acmo/core/marquee.tsx +61 -61
  107. package/src/acmo/core/storage/storage.ts +27 -27
  108. package/src/acmo/core/types/types.d.ts +93 -93
  109. package/src/acmo/modules/dashboard/components/auto_scroller.tsx +84 -84
  110. package/src/acmo/modules/dashboard/components/custom_card.tsx +30 -30
  111. package/src/acmo/modules/dashboard/components/my_games_button.tsx +39 -39
  112. package/src/acmo/modules/dashboard/components/offer_info_section.tsx +138 -143
  113. package/src/acmo/modules/dashboard/components/premium_header.tsx +80 -80
  114. package/src/acmo/modules/dashboard/components/premium_option_1.tsx +155 -160
  115. package/src/acmo/modules/dashboard/components/premium_option_2.tsx +99 -103
  116. package/src/acmo/modules/dashboard/components/premium_option_3.tsx +41 -45
  117. package/src/acmo/modules/dashboard/components/premium_option_4.tsx +184 -183
  118. package/src/acmo/modules/dashboard/repository.ts +94 -94
  119. package/src/acmo/modules/dashboard/top_offers.tsx +144 -131
  120. package/src/i18n.ts +114 -114
  121. package/src/index.tsx +89 -81
  122. package/tyrads-sdk.podspec +41 -41
@@ -1,161 +1,156 @@
1
- import React from 'react';
2
- import numeral from 'numeral';
3
- import {
4
- View,
5
- Text,
6
- Image,
7
- TouchableOpacity,
8
- StyleSheet,
9
- } from 'react-native';
10
- import TextTicker from 'react-native-text-ticker';
11
- import Tyrads from '../../../../index';
12
- import { useTranslation } from 'react-i18next';
13
-
14
- interface PremiumOption1Props {
15
- data: TransformedCampaign[];
16
- premiumColor?: string;
17
- }
18
-
19
- const PremiumOption1: React.FC<PremiumOption1Props> = ({ data, premiumColor }) => {
20
- const { t } = useTranslation();
21
- console.log("Prmium Color", premiumColor);
22
-
23
- return (
24
- <View>
25
- {data.map((item, index) => (
26
- <TouchableOpacity
27
- key={index}
28
- onPress={() => {
29
- Tyrads.showOffers({
30
- route: "campaign-details",
31
- campaignID: item.campaignId,
32
- });
33
- }}
34
- style={styles.itemContainer}
35
- activeOpacity={0.75}
36
- >
37
- <View style={{ flexDirection: 'row', flex: 8, marginRight: 10 }}>
38
- <Image source={{ uri: item.thumbnail }} style={styles.thumbnail} />
39
- <View style={styles.infoContainer}>
40
- <View style={{ width: '100%' }}>
41
- {item.title.length > 25 ? (
42
- <View style={{ overflow: 'hidden' }}>
43
- <TextTicker
44
- style={styles.titleText}
45
- duration={3000}
46
- loop
47
- bounce
48
- repeatSpacer={50}
49
- marqueeDelay={1000}
50
- >
51
- {item.title}
52
- </TextTicker>
53
- </View>
54
- ) : (
55
- <Text numberOfLines={1} style={styles.titleText}>
56
- {item.title}
57
- </Text>
58
- )}
59
- </View>
60
- <View style={styles.infoRow}>
61
- <View style={[styles.rankContainer, { backgroundColor: premiumColor || '#1C90DF' }]}>
62
- <Text numberOfLines={1} style={styles.rankText} adjustsFontSizeToFit={true}>
63
- {t('dashboard.top_ranking', { number: index + 1 })}
64
- </Text>
65
- </View>
66
- <View style={styles.rewardDetails}>
67
- <Image
68
- source={{ uri: item.currency.adUnitCurrencyIcon }}
69
- resizeMode="contain"
70
- style={styles.coinIcon}
71
- />
72
- <Text style={styles.points}>{numeral(item.points).format("0.00a").toUpperCase()}</Text>
73
- <Text style={styles.points}>{''}{item.currency.adUnitCurrencyName}</Text>
74
- </View>
75
- </View>
76
- </View>
77
- </View>
78
- <View style={[styles.playButton, { backgroundColor: premiumColor || '#1C90DF' }]}>
79
- <Text style={styles.playButtonText}>{t('dashboard.play_button')}</Text>
80
- </View>
81
- </TouchableOpacity>
82
- ))}
83
- </View>
84
- );
85
- };
86
-
87
- const styles = StyleSheet.create({
88
- itemContainer: {
89
- flexDirection: 'row',
90
- flex: 1,
91
- width: '100%',
92
- justifyContent: 'space-between',
93
- alignItems: 'center',
94
- paddingHorizontal: 16,
95
- paddingVertical: 8,
96
- },
97
- thumbnail: {
98
- height: 40,
99
- width: 40,
100
- borderRadius: 10,
101
- },
102
- infoContainer: {
103
- marginLeft: 8,
104
- },
105
- titleText: {
106
- fontSize: 14,
107
- fontWeight: 'bold',
108
- },
109
- infoRow: {
110
- flexDirection: 'row',
111
- alignItems: 'center',
112
- alignContent: 'center',
113
- },
114
- rankContainer: {
115
- marginTop: 4,
116
- borderRadius: 12,
117
- paddingHorizontal: 4,
118
- paddingVertical: 2,
119
- width: 43,
120
- alignItems: 'center',
121
- },
122
- rankText: {
123
- fontSize: 10,
124
- color: 'white',
125
- fontWeight: 'bold',
126
- },
127
- rewardDetails: {
128
- flexDirection: 'row',
129
- alignItems: 'center',
130
- marginTop: 4,
131
- left: 4,
132
- },
133
- coinIcon: {
134
- width: 14,
135
- height: 14,
136
- },
137
- points: {
138
- fontSize: 13,
139
- marginLeft: 4,
140
- fontWeight: '500',
141
- },
142
- rewards: {
143
- fontSize: 10,
144
- fontStyle: 'italic',
145
- },
146
- playButton: {
147
- paddingHorizontal: 12,
148
- paddingVertical: 5,
149
- height: 30,
150
- borderRadius: 8,
151
- alignItems: 'center',
152
- justifyContent: 'center',
153
- },
154
- playButtonText: {
155
- fontSize: 14,
156
- fontWeight: 'bold',
157
- color: 'white',
158
- },
159
- });
160
-
1
+ import React from 'react';
2
+ import numeral from 'numeral';
3
+ import {
4
+ View,
5
+ Text,
6
+ Image,
7
+ TouchableOpacity,
8
+ StyleSheet,
9
+ } from 'react-native';
10
+ import TextTicker from 'react-native-text-ticker';
11
+ import { useTranslation } from 'react-i18next';
12
+
13
+ interface PremiumOption1Props {
14
+ data: TransformedCampaign[];
15
+ premiumColor?: string;
16
+ onCampaignPress?: (campaignId: number) => void;
17
+ }
18
+
19
+ const PremiumOption1: React.FC<PremiumOption1Props> = ({ data, onCampaignPress, premiumColor }) => {
20
+ const { t } = useTranslation();
21
+ console.log("Prmium Color", premiumColor);
22
+
23
+ return (
24
+ <View>
25
+ {data.map((item, index) => (
26
+ <TouchableOpacity
27
+ key={index}
28
+ onPress={() => onCampaignPress && onCampaignPress(item.campaignId)}
29
+ style={styles.itemContainer}
30
+ activeOpacity={0.75}
31
+ >
32
+ <View style={{ flexDirection: 'row', flex: 8, marginRight: 10 }}>
33
+ <Image source={{ uri: item.thumbnail }} style={styles.thumbnail} />
34
+ <View style={styles.infoContainer}>
35
+ <View style={{ width: '100%' }}>
36
+ {item.title.length > 25 ? (
37
+ <View style={{ overflow: 'hidden' }}>
38
+ <TextTicker
39
+ style={styles.titleText}
40
+ duration={3000}
41
+ loop
42
+ bounce
43
+ repeatSpacer={50}
44
+ marqueeDelay={1000}
45
+ >
46
+ {item.title}
47
+ </TextTicker>
48
+ </View>
49
+ ) : (
50
+ <Text numberOfLines={1} style={styles.titleText}>
51
+ {item.title}
52
+ </Text>
53
+ )}
54
+ </View>
55
+ <View style={styles.infoRow}>
56
+ <View style={[styles.rankContainer, { backgroundColor: premiumColor || '#1C90DF' }]}>
57
+ <Text numberOfLines={1} style={styles.rankText} adjustsFontSizeToFit={true}>
58
+ {t('dashboard.top_ranking', { number: index + 1 })}
59
+ </Text>
60
+ </View>
61
+ <View style={styles.rewardDetails}>
62
+ <Image
63
+ source={{ uri: item.currency.adUnitCurrencyIcon }}
64
+ resizeMode="contain"
65
+ style={styles.coinIcon}
66
+ />
67
+ <Text style={styles.points}>{numeral(item.points).format("0.00a").toUpperCase()}</Text>
68
+ <Text style={styles.points}>{''}{item.currency.adUnitCurrencyName}</Text>
69
+ </View>
70
+ </View>
71
+ </View>
72
+ </View>
73
+ <View style={[styles.playButton, { backgroundColor: premiumColor || '#1C90DF' }]}>
74
+ <Text style={styles.playButtonText}>{t('dashboard.play_button')}</Text>
75
+ </View>
76
+ </TouchableOpacity>
77
+ ))}
78
+ </View>
79
+ );
80
+ };
81
+
82
+ const styles = StyleSheet.create({
83
+ itemContainer: {
84
+ flexDirection: 'row',
85
+ flex: 1,
86
+ width: '100%',
87
+ justifyContent: 'space-between',
88
+ alignItems: 'center',
89
+ paddingHorizontal: 16,
90
+ paddingVertical: 8,
91
+ },
92
+ thumbnail: {
93
+ height: 40,
94
+ width: 40,
95
+ borderRadius: 10,
96
+ },
97
+ infoContainer: {
98
+ marginLeft: 8,
99
+ },
100
+ titleText: {
101
+ fontSize: 14,
102
+ fontWeight: 'bold',
103
+ },
104
+ infoRow: {
105
+ flexDirection: 'row',
106
+ alignItems: 'center',
107
+ alignContent: 'center',
108
+ },
109
+ rankContainer: {
110
+ marginTop: 4,
111
+ borderRadius: 12,
112
+ paddingHorizontal: 4,
113
+ paddingVertical: 2,
114
+ width: 43,
115
+ alignItems: 'center',
116
+ },
117
+ rankText: {
118
+ fontSize: 10,
119
+ color: 'white',
120
+ fontWeight: 'bold',
121
+ },
122
+ rewardDetails: {
123
+ flexDirection: 'row',
124
+ alignItems: 'center',
125
+ marginTop: 4,
126
+ left: 4,
127
+ },
128
+ coinIcon: {
129
+ width: 14,
130
+ height: 14,
131
+ },
132
+ points: {
133
+ fontSize: 13,
134
+ marginLeft: 4,
135
+ fontWeight: '500',
136
+ },
137
+ rewards: {
138
+ fontSize: 10,
139
+ fontStyle: 'italic',
140
+ },
141
+ playButton: {
142
+ paddingHorizontal: 12,
143
+ paddingVertical: 5,
144
+ height: 30,
145
+ borderRadius: 8,
146
+ alignItems: 'center',
147
+ justifyContent: 'center',
148
+ },
149
+ playButtonText: {
150
+ fontSize: 14,
151
+ fontWeight: 'bold',
152
+ color: 'white',
153
+ },
154
+ });
155
+
161
156
  export default PremiumOption1;
@@ -1,104 +1,100 @@
1
- import React from 'react';
2
- import {
3
- View,
4
- Text,
5
- Image,
6
- StyleSheet,
7
- Dimensions,
8
- TouchableOpacity,
9
- } from 'react-native';
10
- import AutoScrollPagerWithIndicators from './auto_scroller';
11
- import OfferInfoSection from './offer_info_section';
12
- import Tyrads from '../../../..';
13
-
14
- const { width } = Dimensions.get('window');
15
-
16
- interface PremiumOption2Props {
17
- data: TransformedCampaign[];
18
- premiumColor?: string;
19
- }
20
-
21
- const PremiumOption2: React.FC<PremiumOption2Props> = ({ data, premiumColor }) => {
22
- return (
23
- <AutoScrollPagerWithIndicators
24
- totalPages={data.length}
25
- premiumColor={premiumColor}
26
- content={(page) => (
27
- <TouchableOpacity
28
- key={page}
29
- onPress={() =>
30
- Tyrads.showOffers({
31
- route: 'campaign-details',
32
- campaignID: data[page]?.campaignId,
33
- })
34
- }
35
- activeOpacity={0.8}
36
- >
37
- {data[page] && (
38
- <>
39
- <OfferBanner details={data[page]} index={page} premiumColor={premiumColor} />
40
- <OfferInfoSection details={data[page]} premiumColor={premiumColor} />
41
- </>
42
- )}
43
- </TouchableOpacity>
44
- )}
45
- />
46
- );
47
- };
48
-
49
- interface OfferBannerProps {
50
- details: TransformedCampaign;
51
- index: number;
52
- premiumColor?: string;
53
- }
54
-
55
- const OfferBanner: React.FC<OfferBannerProps> = ({ details, index, premiumColor }) => {
56
- return (
57
- <View style={styles.bannerContainer}>
58
- <Image style={styles.bannerImage} source={{ uri: details.fileUrl }} resizeMode="cover" />
59
- <View style={styles.starContainer}>
60
- <Image
61
- source={require('../../../../assets/images/premium_star.png')}
62
- style={[styles.starIcon, { tintColor: premiumColor || '#1C90DF' }]}
63
- />
64
- <Text style={styles.index} numberOfLines={1} ellipsizeMode="tail">
65
- {index + 1}
66
- </Text>
67
- </View>
68
- </View>
69
- );
70
- };
71
-
72
- const styles = StyleSheet.create({
73
- bannerContainer: {
74
- width: width,
75
- height: 180,
76
- },
77
- bannerImage: {
78
- flex: 1,
79
- },
80
- starContainer: {
81
- position: 'absolute',
82
- top: 10,
83
- left: 10,
84
- backgroundColor: 'rgba(0,0,0,0)',
85
- },
86
- starIcon: {
87
- width: 30,
88
- height: 30,
89
- },
90
- index: {
91
- position: 'absolute',
92
- top: 0,
93
- left: 0,
94
- right: 0,
95
- bottom: 0,
96
- textAlign: 'center',
97
- textAlignVertical: 'center',
98
- color: 'white',
99
- fontSize: 14,
100
- fontWeight: 'bold',
101
- },
102
- });
103
-
1
+ import React from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ Image,
6
+ StyleSheet,
7
+ Dimensions,
8
+ TouchableOpacity,
9
+ } from 'react-native';
10
+ import AutoScrollPagerWithIndicators from './auto_scroller';
11
+ import OfferInfoSection from './offer_info_section';
12
+
13
+ const { width } = Dimensions.get('window');
14
+
15
+ interface PremiumOption2Props {
16
+ data: TransformedCampaign[];
17
+ premiumColor?: string;
18
+ onCampaignPress?: (campaignId: number) => void;
19
+ }
20
+
21
+ const PremiumOption2: React.FC<PremiumOption2Props> = ({ data, onCampaignPress, premiumColor }) => {
22
+ return (
23
+ <AutoScrollPagerWithIndicators
24
+ totalPages={data.length}
25
+ premiumColor={premiumColor}
26
+ content={(page) => (
27
+ <TouchableOpacity
28
+ key={page}
29
+ onPress={() => onCampaignPress && onCampaignPress(data[page]?.campaignId ?? 0)
30
+ }
31
+ activeOpacity={0.8}
32
+ >
33
+ {data[page] && (
34
+ <>
35
+ <OfferBanner details={data[page]} index={page} premiumColor={premiumColor} />
36
+ <OfferInfoSection details={data[page]} premiumColor={premiumColor} onButtonPress={() => onCampaignPress && onCampaignPress(data[page]?.campaignId ?? 0)}/>
37
+ </>
38
+ )}
39
+ </TouchableOpacity>
40
+ )}
41
+ />
42
+ );
43
+ };
44
+
45
+ interface OfferBannerProps {
46
+ details: TransformedCampaign;
47
+ index: number;
48
+ premiumColor?: string;
49
+ }
50
+
51
+ const OfferBanner: React.FC<OfferBannerProps> = ({ details, index, premiumColor }) => {
52
+ return (
53
+ <View style={styles.bannerContainer}>
54
+ <Image style={styles.bannerImage} source={{ uri: details.fileUrl }} resizeMode="cover" />
55
+ <View style={styles.starContainer}>
56
+ <Image
57
+ source={require('../../../../assets/images/premium_star.png')}
58
+ style={[styles.starIcon, { tintColor: premiumColor || '#1C90DF' }]}
59
+ />
60
+ <Text style={styles.index} numberOfLines={1} ellipsizeMode="tail">
61
+ {index + 1}
62
+ </Text>
63
+ </View>
64
+ </View>
65
+ );
66
+ };
67
+
68
+ const styles = StyleSheet.create({
69
+ bannerContainer: {
70
+ width: width,
71
+ height: 180,
72
+ },
73
+ bannerImage: {
74
+ flex: 1,
75
+ },
76
+ starContainer: {
77
+ position: 'absolute',
78
+ top: 10,
79
+ left: 10,
80
+ backgroundColor: 'rgba(0,0,0,0)',
81
+ },
82
+ starIcon: {
83
+ width: 30,
84
+ height: 30,
85
+ },
86
+ index: {
87
+ position: 'absolute',
88
+ top: 0,
89
+ left: 0,
90
+ right: 0,
91
+ bottom: 0,
92
+ textAlign: 'center',
93
+ textAlignVertical: 'center',
94
+ color: 'white',
95
+ fontSize: 14,
96
+ fontWeight: 'bold',
97
+ },
98
+ });
99
+
104
100
  export default PremiumOption2;
@@ -1,46 +1,42 @@
1
- import React from 'react';
2
- import { TouchableOpacity, View, } from 'react-native';
3
- import AutoScrollPagerWithIndicators from './auto_scroller';
4
- import OfferInfoSection from './offer_info_section';
5
- import Tyrads from "../../../..";
6
-
7
- interface PremiumOption3Props {
8
- data: TransformedCampaign[];
9
- premiumColor?: string;
10
- }
11
-
12
- const PremiumOption3: React.FC<PremiumOption3Props> = ({ data, premiumColor }) => {
13
- return (
14
- <AutoScrollPagerWithIndicators
15
- totalPages={data.length}
16
- premiumColor={premiumColor}
17
- content={(page) => (
18
- <TouchableOpacity
19
- key={page}
20
- style={{ flex: 1 }}
21
- activeOpacity={0.8}
22
- onPress={() =>
23
- Tyrads.showOffers({
24
- route: 'campaign-details',
25
- campaignID: data[page]?.campaignId,
26
- })
27
- }
28
- >
29
- <View>
30
- {
31
- data[page] && (
32
- <OfferInfoSection
33
- details={data[page]}
34
- premiumColor={premiumColor}
35
- style={{ paddingVertical: 23 }}
36
- />
37
- )
38
- }
39
- </View>
40
- </TouchableOpacity>
41
- )}
42
- />
43
- );
44
- };
45
-
1
+ import React from 'react';
2
+ import { TouchableOpacity, View, } from 'react-native';
3
+ import AutoScrollPagerWithIndicators from './auto_scroller';
4
+ import OfferInfoSection from './offer_info_section';
5
+
6
+ interface PremiumOption3Props {
7
+ data: TransformedCampaign[];
8
+ premiumColor?: string;
9
+ onCampaignPress?: (campaignId: number) => void;
10
+ }
11
+
12
+ const PremiumOption3: React.FC<PremiumOption3Props> = ({ data, onCampaignPress, premiumColor }) => {
13
+ return (
14
+ <AutoScrollPagerWithIndicators
15
+ totalPages={data.length}
16
+ premiumColor={premiumColor}
17
+ content={(page) => (
18
+ <TouchableOpacity
19
+ key={page}
20
+ style={{ flex: 1 }}
21
+ activeOpacity={0.8}
22
+ onPress={() => onCampaignPress && onCampaignPress(data[page]?.campaignId ?? 0)}
23
+ >
24
+ <View>
25
+ {
26
+ data[page] && (
27
+ <OfferInfoSection
28
+ details={data[page]}
29
+ premiumColor={premiumColor}
30
+ style={{ paddingVertical: 23 }}
31
+ onButtonPress={() => onCampaignPress && onCampaignPress(data[page]?.campaignId ?? 0)}
32
+ />
33
+ )
34
+ }
35
+ </View>
36
+ </TouchableOpacity>
37
+ )}
38
+ />
39
+ );
40
+ };
41
+
46
42
  export default PremiumOption3;