be-components 0.3.4 → 0.3.5

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 (53) hide show
  1. package/lib/commonjs/ApiOverrides/index.js +29 -9
  2. package/lib/commonjs/ApiOverrides/index.js.map +1 -1
  3. package/lib/commonjs/Authenticator/Components/LoginForm.js +1 -1
  4. package/lib/commonjs/Authenticator/index.js.map +1 -1
  5. package/lib/commonjs/ProfileManager/Components/BasicStatus.js +46 -7
  6. package/lib/commonjs/ProfileManager/Components/BasicStatus.js.map +1 -1
  7. package/lib/commonjs/ProfileManager/Components/CodeRedeem.js +80 -57
  8. package/lib/commonjs/ProfileManager/Components/CodeRedeem.js.map +1 -1
  9. package/lib/commonjs/ProfileManager/Components/ProfileWelcome.js +1 -1
  10. package/lib/commonjs/ProfileManager/Components/ProfileWelcome.js.map +1 -1
  11. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js +94 -32
  12. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js.map +1 -1
  13. package/lib/commonjs/ProfileManager/Components/SettingsManager.js +25 -3
  14. package/lib/commonjs/ProfileManager/Components/SettingsManager.js.map +1 -1
  15. package/lib/commonjs/ProfileManager/Components/VouchCard.js +112 -19
  16. package/lib/commonjs/ProfileManager/Components/VouchCard.js.map +1 -1
  17. package/lib/module/ApiOverrides/index.js +29 -9
  18. package/lib/module/ApiOverrides/index.js.map +1 -1
  19. package/lib/module/Authenticator/Components/LoginForm.js +1 -1
  20. package/lib/module/Authenticator/index.js.map +1 -1
  21. package/lib/module/ProfileManager/Components/BasicStatus.js +46 -7
  22. package/lib/module/ProfileManager/Components/BasicStatus.js.map +1 -1
  23. package/lib/module/ProfileManager/Components/CodeRedeem.js +80 -57
  24. package/lib/module/ProfileManager/Components/CodeRedeem.js.map +1 -1
  25. package/lib/module/ProfileManager/Components/ProfileWelcome.js +1 -1
  26. package/lib/module/ProfileManager/Components/ProfileWelcome.js.map +1 -1
  27. package/lib/module/ProfileManager/Components/ProfileWizard.js +94 -32
  28. package/lib/module/ProfileManager/Components/ProfileWizard.js.map +1 -1
  29. package/lib/module/ProfileManager/Components/SettingsManager.js +25 -3
  30. package/lib/module/ProfileManager/Components/SettingsManager.js.map +1 -1
  31. package/lib/module/ProfileManager/Components/VouchCard.js +113 -20
  32. package/lib/module/ProfileManager/Components/VouchCard.js.map +1 -1
  33. package/lib/typescript/src/ApiOverrides/index.d.ts +5 -2
  34. package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -1
  35. package/lib/typescript/src/Authenticator/index.d.ts.map +1 -1
  36. package/lib/typescript/src/ProfileManager/Components/BasicStatus.d.ts.map +1 -1
  37. package/lib/typescript/src/ProfileManager/Components/CodeRedeem.d.ts +1 -2
  38. package/lib/typescript/src/ProfileManager/Components/CodeRedeem.d.ts.map +1 -1
  39. package/lib/typescript/src/ProfileManager/Components/ProfileWizard.d.ts.map +1 -1
  40. package/lib/typescript/src/ProfileManager/Components/SettingsManager.d.ts +3 -2
  41. package/lib/typescript/src/ProfileManager/Components/SettingsManager.d.ts.map +1 -1
  42. package/lib/typescript/src/ProfileManager/Components/VouchCard.d.ts +11 -2
  43. package/lib/typescript/src/ProfileManager/Components/VouchCard.d.ts.map +1 -1
  44. package/package.json +1 -1
  45. package/src/ApiOverrides/index.ts +29 -13
  46. package/src/Authenticator/Components/LoginForm.tsx +1 -1
  47. package/src/Authenticator/index.tsx +0 -1
  48. package/src/ProfileManager/Components/BasicStatus.tsx +29 -6
  49. package/src/ProfileManager/Components/CodeRedeem.tsx +42 -35
  50. package/src/ProfileManager/Components/ProfileWelcome.tsx +1 -1
  51. package/src/ProfileManager/Components/ProfileWizard.tsx +67 -33
  52. package/src/ProfileManager/Components/SettingsManager.tsx +14 -6
  53. package/src/ProfileManager/Components/VouchCard.tsx +72 -19
@@ -1,14 +1,15 @@
1
1
  import React from 'react';
2
- import type { SettingProps } from '../api/types';
2
+ import type { MyPlayerProps, SettingProps } from '../api/types';
3
3
  import type { PlayerSettingProps } from '../../types';
4
4
  type SettingsManagerProps = {
5
5
  title: string;
6
6
  description: string;
7
+ player: MyPlayerProps;
7
8
  settings: SettingProps[];
8
9
  icon: any;
9
10
  player_settings: PlayerSettingProps[];
10
11
  onUpdatePlayerSetting: (ps: PlayerSettingProps) => void;
11
12
  };
12
- declare const SettingsManager: ({ title, description, icon, settings, player_settings, onUpdatePlayerSetting }: SettingsManagerProps) => React.JSX.Element;
13
+ declare const SettingsManager: ({ player, title, description, icon, settings, player_settings, onUpdatePlayerSetting }: SettingsManagerProps) => React.JSX.Element;
13
14
  export default SettingsManager;
14
15
  //# sourceMappingURL=SettingsManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsManager.d.ts","sourceRoot":"","sources":["../../../../../src/ProfileManager/Components/SettingsManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,KAAK,oBAAoB,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAC,YAAY,EAAE,CAAC;IACxB,IAAI,EAAC,GAAG,CAAC;IACT,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,qBAAqB,EAAC,CAAC,EAAE,EAAC,kBAAkB,KAAK,IAAI,CAAA;CACxD,CAAA;AAED,QAAA,MAAM,eAAe,mFAAmF,oBAAoB,sBA4H3H,CAAA;AAUD,eAAe,eAAe,CAAA"}
1
+ {"version":3,"file":"SettingsManager.d.ts","sourceRoot":"","sources":["../../../../../src/ProfileManager/Components/SettingsManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,KAAK,oBAAoB,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAC,aAAa,CAAC;IACrB,QAAQ,EAAC,YAAY,EAAE,CAAC;IACxB,IAAI,EAAC,GAAG,CAAC;IACT,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,qBAAqB,EAAC,CAAC,EAAE,EAAC,kBAAkB,KAAK,IAAI,CAAA;CACxD,CAAA;AAED,QAAA,MAAM,eAAe,2FAA2F,oBAAoB,sBAmInI,CAAA;AAUD,eAAe,eAAe,CAAA"}
@@ -1,10 +1,19 @@
1
1
  import React from 'react';
2
- import type { MyPlayerProps } from '../api/types';
2
+ import type { CodeRequestProps, MyPlayerProps, PlayerReferralProps, PromoProps } from '../api/types';
3
+ import type { PublicPlayerProps } from '../../types';
3
4
  type VouchCardProps = {
4
5
  player: MyPlayerProps;
6
+ walkthrough?: boolean;
7
+ code_details: {
8
+ code_request?: CodeRequestProps;
9
+ referrer?: PublicPlayerProps;
10
+ promo?: PromoProps;
11
+ player_referral?: PlayerReferralProps;
12
+ };
5
13
  onPlayerUpdate: (player: MyPlayerProps) => void;
14
+ onClaimGift: () => void;
6
15
  onClose: () => void;
7
16
  };
8
- declare const VouchCard: ({ player, onPlayerUpdate, onClose }: VouchCardProps) => React.JSX.Element;
17
+ declare const VouchCard: ({ player, walkthrough, code_details, onPlayerUpdate, onClaimGift, onClose }: VouchCardProps) => React.JSX.Element;
9
18
  export default VouchCard;
10
19
  //# sourceMappingURL=VouchCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VouchCard.d.ts","sourceRoot":"","sources":["../../../../../src/ProfileManager/Components/VouchCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD,KAAK,cAAc,GAAG;IAClB,MAAM,EAAC,aAAa,CAAC;IACrB,cAAc,EAAC,CAAC,MAAM,EAAC,aAAa,KAAK,IAAI,CAAC;IAC9C,OAAO,EAAC,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,QAAA,MAAM,SAAS,wCAAwC,cAAc,sBA8PpE,CAAA;AAED,eAAe,SAAS,CAAA"}
1
+ {"version":3,"file":"VouchCard.d.ts","sourceRoot":"","sources":["../../../../../src/ProfileManager/Components/VouchCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAGrG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,KAAK,cAAc,GAAG;IAClB,MAAM,EAAC,aAAa,CAAC;IACrB,WAAW,CAAC,EAAC,OAAO,CAAC;IACrB,YAAY,EAAE;QACV,YAAY,CAAC,EAAC,gBAAgB,CAAC;QAC/B,QAAQ,CAAC,EAAC,iBAAiB,CAAC;QAC5B,KAAK,CAAC,EAAC,UAAU,CAAC;QAClB,eAAe,CAAC,EAAC,mBAAmB,CAAA;KACvC,CAAA;IACD,cAAc,EAAC,CAAC,MAAM,EAAC,aAAa,KAAK,IAAI,CAAC;IAC9C,WAAW,EAAC,MAAM,IAAI,CAAC;IACvB,OAAO,EAAC,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,QAAA,MAAM,SAAS,gFAAgF,cAAc,sBAyS5G,CAAA;AAED,eAAe,SAAS,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "be-components",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Components for BettorEdge Apps",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -8,7 +8,7 @@ const ENVIRONMENT_ENDPOINTS = {
8
8
  DEVELOPMENT: {
9
9
  AUTH_SVC_API: 'http://localhost:5000',
10
10
  VOUCH_ID: 'adqEZph8t*_NBFy6u_l4!t~Hin6kpK',
11
- VOUCHED_CALLBACK_URL: 'https://d98b-75-168-152-8.ngrok-free.app/v1/players/vouch/hook',
11
+ VOUCHED_CALLBACK_URL: 'https://1f9b-64-159-204-178.ngrok-free.app/v1/players/vouch/hook',
12
12
  VOUCHED_SANDBOX: true,
13
13
  EVENT_SVC_API: 'http://localhost:3002',
14
14
  SOCIAL_SVC_API: 'http://localhost:3011'
@@ -44,13 +44,15 @@ export { APIOverrides }
44
44
 
45
45
  const APIOverrides = {
46
46
  start: async({ env, no_cache }: { env:'PRODUCTION'|'STAGING'|'DEVELOPMENT', no_cache:boolean }):Promise<AuthStateProps> => {
47
+
47
48
  APIOverrides.setEnvironment(env);
48
49
  let distinct_id = await APIOverrides.getDistinctID();
50
+ APIOverrides.setDistinctToken(distinct_id);
49
51
  const session_id = v4();
52
+ APIOverrides.setSessionToken(session_id)
50
53
  auth_state = { authenticated: false, distinct_id, session_id }
51
54
  if(no_cache){ return auth_state }
52
55
  let cached_token = await AsyncStorage.getItem('access_token');
53
- console.log(cached_token)
54
56
  if(!cached_token){ return { authenticated: false, distinct_id, session_id } }
55
57
  let cached_refresh_token = await AsyncStorage.getItem('refresh_token');
56
58
  if(!cached_refresh_token){ return { authenticated: false, distinct_id, session_id } }
@@ -94,7 +96,7 @@ const APIOverrides = {
94
96
  const { access_token, player_id, refresh_token, expire_datetime, distinct_id } = auth_response
95
97
  if(!access_token || !refresh_token || !player_id){ return { result: 'fail' } }
96
98
  APIOverrides.setBearerToken(access_token);
97
- APIOverrides.setRefreshTokenInterceptor(access_token, distinct_id, options.cache)
99
+ APIOverrides.setRefreshTokenInterceptor(access_token, distinct_id)
98
100
  if(options.cache){
99
101
  await APIOverrides.cacheTokens(access_token, player_id, refresh_token, expire_datetime)
100
102
  }
@@ -113,9 +115,9 @@ const APIOverrides = {
113
115
  getEndpoints: () => {
114
116
  return ENDPOINTS
115
117
  },
116
- cacheTokens: async(access_token:string, player_id:string, refresh_token?:string, expire_datetime?:any) => {
118
+ cacheTokens: async(access_token:string, player_id?:string, refresh_token?:string, expire_datetime?:any) => {
117
119
  await AsyncStorage.setItem('access_token', access_token);
118
- await AsyncStorage.setItem('player_id', player_id);
120
+ if(player_id){ await AsyncStorage.setItem('player_id', player_id) };
119
121
  if(refresh_token){ await AsyncStorage.setItem('refresh_token', refresh_token) }
120
122
  if(expire_datetime){ await AsyncStorage.setItem('auth_expire_time', expire_datetime) }
121
123
  },
@@ -140,17 +142,34 @@ const APIOverrides = {
140
142
  delete axios.defaults.headers.common['Authorization'];
141
143
  }
142
144
  },
143
- refreshToken: async(token:string, distinct_id:string):Promise<{refresh_token:string, access_token:string, expire_datetime:string } | undefined> => {
145
+ setDistinctToken: (distinct_id?:string) => {
146
+ if (distinct_id) {
147
+ axios.defaults.headers.common['distinctid'] = distinct_id;
148
+ } else {
149
+ delete axios.defaults.headers.common['distinctid'];
150
+ }
151
+ },
152
+ setSessionToken: (session_id?:string) => {
153
+ if (session_id) {
154
+ axios.defaults.headers.common['sessionid'] = session_id;
155
+ } else {
156
+ delete axios.defaults.headers.common['sessionid'];
157
+ }
158
+ },
159
+ refreshToken: async(token:string, distinct_id:string):Promise<{refresh_token:string, access_token:string, expire_datetime:string, player_id:string } | undefined> => {
144
160
  try {
161
+ console.log('REFRESHING TOKEN!!!!')
145
162
  let AUTH_SVC_API = ENDPOINTS['AUTH_SVC_API']
146
163
  const resp = await axios.post(`${AUTH_SVC_API}/v1/players/tokens/token/refresh`, { refresh_token:token, device_id:distinct_id })
164
+ console.log(resp.data)
147
165
  return resp.data
148
166
  } catch (error) {
167
+ console.log(error)
168
+ console.log('THERE WAS AN ERROR')
149
169
  return undefined
150
170
  }
151
-
152
171
  },
153
- setRefreshTokenInterceptor: async(token:string, distinct_id:string, cache?:boolean) => {
172
+ setRefreshTokenInterceptor: async(token:string, distinct_id:string) => {
154
173
  //Set the endpoint based on the environment that is past
155
174
  axios.interceptors.response.use((response) => {
156
175
  return response
@@ -164,17 +183,14 @@ const APIOverrides = {
164
183
  }
165
184
  //If the user gets a 401 - check for a refresh_token and attempt to get another access token to use the request
166
185
  if(error?.response?.status === 401 && !originalRequest._retry) {
167
- console.log('IN HERE!!!')
168
186
  originalRequest._retry = true;
169
187
  let refresh_resp = await APIOverrides.refreshToken(token, distinct_id);
170
188
  if(!refresh_resp){
171
189
  return Promise.reject({ message: 'Unable to authenticate request' })
172
190
  }
173
- const { access_token, refresh_token, expire_datetime } = refresh_resp;
191
+ const { player_id, access_token, refresh_token, expire_datetime } = refresh_resp;
174
192
  APIOverrides.setBearerToken(access_token)
175
- if(cache){
176
- await APIOverrides.cacheTokens(access_token, refresh_token, expire_datetime);
177
- }
193
+ await APIOverrides.cacheTokens(access_token, player_id, refresh_token, expire_datetime);
178
194
  return Promise.resolve(axios({ ...originalRequest, headers: { ...originalRequest.headers, Authorization: `Bearer ${access_token}` }}));
179
195
  }
180
196
  return Promise.reject(error)
@@ -117,7 +117,7 @@ const LoginForm = ({ width, visible, onRegister, onAuthenticated }:LoginFormProp
117
117
  <View style={{ flex:1, width }}>
118
118
  {!login_try.visible ?
119
119
  <View style={{ flex:1 }}>
120
- <View style={{ padding:30 }}>
120
+ <View style={{ padding:20 }}>
121
121
  <View>
122
122
  <Text size={18} color={Colors.brand.midnight} weight='bold'>Login Using My:</Text>
123
123
  </View>
@@ -26,7 +26,6 @@ const Authenticator = ({ visible, auth_strategy_id, default_view, company_id, so
26
26
  const [ company, setCompany ] = useState<CompanyProps>();
27
27
  const [ distinct_id, setDistinctID ] = useState<string>();
28
28
  const [ active_view, setActiveView ] = useState(default_view ?? 'register')
29
-
30
29
  useEffect(() => {
31
30
  getWidgetData();
32
31
  },[])
@@ -5,7 +5,6 @@ import Colors from '../../constants/colors';
5
5
  import type { CodeRequestProps, MyPlayerProps, PlayerReferralProps, PromoProps } from '../api/types';
6
6
  import type { PublicPlayerProps } from '../../types';
7
7
  import { view_styles } from '../../constants/styles';
8
- import { ProfileHelpers } from '../api';
9
8
 
10
9
  type BasicStatusProps = {
11
10
  player:MyPlayerProps,
@@ -21,7 +20,7 @@ type BasicStatusProps = {
21
20
 
22
21
  const BasicStatus = ({ onVerify, code_details, player, onClose }:BasicStatusProps) => {
23
22
 
24
- const { code_request, promo, referrer } = code_details;
23
+ const { code_request, promo } = code_details;
25
24
 
26
25
  const getStatus = (p:MyPlayerProps) => {
27
26
  let errors:string[] = []
@@ -50,7 +49,8 @@ const BasicStatus = ({ onVerify, code_details, player, onClose }:BasicStatusProp
50
49
  <Text weight='bold' size={16} color={Colors.shades.white}>FREE TO PLAY - ENGAGED!</Text>
51
50
  <Text style={{ marginTop:5 }} color={Colors.shades.white} size={14} textAlign='left'>Your profile is ready to go for play money betting and all our FREE TO PLAY games.</Text>
52
51
  </View>
53
- </View>
52
+ </View>
53
+ {player.vouched_status != 'verified' ?
54
54
  <View style={{ padding:10, flexDirection:'row' }}>
55
55
  <Icons.AlertIcon color={Colors.utility.warning} size={32}/>
56
56
  <View style={{ flex:1, marginLeft:20 }}>
@@ -72,19 +72,29 @@ const BasicStatus = ({ onVerify, code_details, player, onClose }:BasicStatusProp
72
72
  }
73
73
  </View>
74
74
  </View>
75
+ :
76
+ <View style={{ padding:10, flexDirection:'row' }}>
77
+ <Icons.CheckCirlceIcon color={Colors.utility.success} size={32}/>
78
+ <View style={{ flex:1, marginLeft:20 }}>
79
+ <Text weight='bold' size={16} color={Colors.shades.white}>REAL MONEY - ENGAGED!</Text>
80
+ <Text style={{ marginTop:5 }} color={Colors.shades.white} size={14} textAlign='left'>Way to go! Your profile is ready to go for real-money activities!</Text>
81
+ </View>
82
+ </View>
83
+ }
75
84
  </View>
76
85
  </ScrollView>
77
- {code_request && promo ?
86
+ {code_request && !['closed','fulfilled'].includes(code_request.status) && promo ?
78
87
  <View style={{ margin:15, marginTop:-50, flexDirection:'row', backgroundColor:Colors.shades.white, borderRadius:8, ...view_styles.float }}>
79
88
  <View style={{ padding:10, justifyContent:'center' }}>
80
89
  <Icons.GiftIcon size={40} color={Colors.incentive.gold} />
81
90
  </View>
82
91
  <View style={{flex:1, backgroundColor:Colors.incentive.gold_faded, padding:10 }}>
83
- <Text style={{ paddingBottom:10, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }} size={16} color={Colors.brand.midnight} weight='bold'>@{referrer?.username} has a gift for you</Text>
84
- <Text style={{ paddingTop:5 }} size={12} color={Colors.brand.midnight} weight='semibold'>{ProfileHelpers.getReferralDescription(promo)}</Text>
92
+ <Text style={{ paddingBottom:10, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }} size={16} color={Colors.brand.midnight} weight='bold'>Verify to claim your gift!</Text>
93
+ <Text style={{ paddingTop:5 }} size={12} color={Colors.brand.midnight} weight='semibold'>Did you know on average it only takes 3 minutes to complete the verification process?</Text>
85
94
  </View>
86
95
  </View>
87
96
  :<></>}
97
+ {player.vouched_status != 'verified' ?
88
98
  <View nativeID='action_row' style={{ flexDirection:'row', padding:10 }}>
89
99
  <Button
90
100
  title='DO IT LATER'
@@ -105,6 +115,19 @@ const BasicStatus = ({ onVerify, code_details, player, onClose }:BasicStatusProp
105
115
  onPress={() => onVerify()}
106
116
  />
107
117
  </View>
118
+ :
119
+ <View nativeID='action_row' style={{ flexDirection:'row', padding:10 }}>
120
+ <Button
121
+ title='CLOSE'
122
+ style={{ flex:3, marginRight:5 }}
123
+ padding={15}
124
+ borderWidth={1}
125
+ borderColor={Colors.brand.electric}
126
+ title_color={Colors.brand.electric}
127
+ onPress={() => onClose()}
128
+ />
129
+ </View>
130
+ }
108
131
  </View>
109
132
  )
110
133
  }
@@ -9,12 +9,11 @@ import type { PublicPlayerProps } from '../../types';
9
9
  type CodeRedeemProps = {
10
10
  player:MyPlayerProps,
11
11
  walkthrough?:boolean,
12
- onNext:() => void,
13
12
  onVerify:() => void,
14
13
  onClose:() => void
15
14
  }
16
15
 
17
- const CodeRedeem = ({ walkthrough, onNext, onVerify, onClose }:CodeRedeemProps) => {
16
+ const CodeRedeem = ({ walkthrough, onVerify, onClose }:CodeRedeemProps) => {
18
17
  const [ loading, setLoading ] = useState(false);
19
18
  const [ show_reward, setShowReward ] = useState(false);
20
19
  const [ action_loading, setActionLoading ] = useState(false);
@@ -76,13 +75,14 @@ const CodeRedeem = ({ walkthrough, onNext, onVerify, onClose }:CodeRedeemProps)
76
75
  const change_allowed = !loading && ProfileHelpers.isChangeCodeAllowed(code_request) ? true : false
77
76
  return (
78
77
  <View style={{ flex:1 }}>
79
- <View style={{ flex:1 }}>
80
- <View style={{ padding:10 }}>
81
- <Text weight='bold' size={16} textAlign='left' color={Colors.brand.midnight}>Referral Code</Text>
82
- <Text style={{ marginTop:5 }} color={Colors.brand.midnight} size={14} textAlign='left'>You can find the code used to sign up for your account below. Feel free to change it before redeeming.</Text>
83
- </View>
84
- <View style={{ padding:10 }}>
85
- <View style={{ backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
78
+ <View style={{ flex:1, padding:20 }}>
79
+ <View style={{ padding:20 }}>
80
+ <Text size={30} color={Colors.brand.midnight} weight='bold'>How Did You Find Us?</Text>
81
+ <Text style={{ marginTop:15 }} size={16} color={Colors.brand.midnight} weight='regular'>All new players are eligible for a one-time sign up bonus. Below is the code / referrer used during sign up.</Text>
82
+ </View>
83
+ <View style={{ padding:10, marginTop:20 }}>
84
+ <Text size={20} weight='bold' textAlign='center' color={Colors.brand.midnight}>CODE USED</Text>
85
+ <View style={{ marginTop:20, backgroundColor:Colors.shades.white, borderRadius:22, flexDirection:'row', alignItems:'center' }}>
86
86
  <View style={{ paddingLeft:15, paddingRight:15 }}>
87
87
  <Icons.USDIcon
88
88
  color={Colors.brand.midnight}
@@ -131,37 +131,44 @@ const CodeRedeem = ({ walkthrough, onNext, onVerify, onClose }:CodeRedeemProps)
131
131
  <Text size={14} color={Colors.utility.warning}>{'ERROR GOES HERE'}</Text>
132
132
  :<></>}
133
133
  </View>
134
- <View style={{ margin:10, padding:5, backgroundColor:Colors.shades.white, borderRadius:8 }}>
135
- {referrer ?
136
- <View nativeID='referrer_details' style={{ flexDirection:'row', padding:5, borderBottomColor:Colors.shades.shade600, borderBottomWidth:1 }}>
137
- <Image
138
- source={{ uri:referrer.profile_pic }}
139
- style={{ height:50, width:50, borderRadius:8 }}
140
- resizeMode='cover'
141
- />
142
- <View style={{ flex:1, marginLeft:20 }}>
143
- <Text size={16} weight='bold'>Referred By: {referrer.first_name} {referrer.last_name}</Text>
144
- <Text style={{ marginTop:5 }} size={14} weight='regular'>@{referrer.username}</Text>
145
- </View>
146
-
147
- </View>
148
- :<></>}
134
+ {!reward_option ?
135
+ <View style={{ padding:10, marginTop:20 }}>
136
+ <Text size={20} weight='bold' textAlign='center' color={Colors.brand.midnight}>CODE OFFER</Text>
149
137
  {promo ?
150
- <View style={{ marginTop:5, padding:10 }}>
151
- <Text size={16} color={Colors.brand.midnight} weight='bold' textAlign='left'>Code Offer</Text>
152
- <Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign='left'>{ProfileHelpers.getReferralDescription(promo)}</Text>
153
- {reward_option ?
154
- <View style={{ marginTop:10, backgroundColor:Colors.highlights.highlight400Faded, padding:10, borderRadius:8 }}>
155
- <Text size={14} color={Colors.brand.midnight} weight='bold'>AWARD REDEEMED: {reward_option.reward_name}</Text>
156
- {code_request && promo && ['referral_sweepstakes','referral_code'].includes(promo.type) ?
157
- <Text style={{ marginTop:4 }} size={14} color={Colors.brand.midnight} weight='bold'>KICKBACK STATUS: {code_request.status == 'fulfilled' ? 'Pending Deposit': 'Kickback received'}</Text>
158
- :<></>}
159
- </View>
138
+ <View style={{ marginTop:20, backgroundColor:Colors.shades.white, borderRadius:8, padding:10 }}>
139
+ <Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign='center'>{ProfileHelpers.getReferralDescription(promo)}</Text>
140
+ </View>
141
+ :<></>}
142
+ </View>
143
+ :
144
+ <View style={{ padding:10, marginTop:20 }}>
145
+ <Text size={20} weight='bold' textAlign='center' color={Colors.brand.midnight}>CODE REDEEMED</Text>
146
+ {reward_option ?
147
+ <View style={{ marginTop:10, backgroundColor:Colors.highlights.highlight400Faded, padding:10, borderRadius:8 }}>
148
+ <Text size={14} color={Colors.brand.midnight} weight='semibold'>AWARDED: {reward_option.reward_name}</Text>
149
+ {code_request && promo && ['referral_sweepstakes','referral_code'].includes(promo.type) ?
150
+ <Text style={{ marginTop:10 }} size={14} color={Colors.brand.midnight} weight='semibold'>KICKBACK STATUS: {code_request.status == 'fulfilled' ? 'Referrer will get the same reward amount after you make your first deposit': 'Kickback received'}</Text>
160
151
  :<></>}
161
152
  </View>
162
153
  :<></>}
163
154
  </View>
155
+ }
164
156
  </View>
157
+ {referrer ?
158
+ <View style={{ margin:10, marginRight:30, marginLeft:30, padding:5, backgroundColor:Colors.shades.white, borderRadius:8 }}>
159
+ <View nativeID='referrer_details' style={{ flexDirection:'row', padding:5}}>
160
+ <Image
161
+ source={{ uri:referrer.profile_pic }}
162
+ style={{ height:50, width:50, borderRadius:8 }}
163
+ resizeMode='cover'
164
+ />
165
+ <View style={{ flex:1, marginLeft:20 }}>
166
+ <Text size={16} weight='bold'>Referred By: {referrer.first_name} {referrer.last_name}</Text>
167
+ <Text style={{ marginTop:5 }} size={14} weight='regular'>@{referrer.username}</Text>
168
+ </View>
169
+ </View>
170
+ </View>
171
+ :<></>}
165
172
  <View style={{ flexDirection:'row', padding:10 }}>
166
173
  <Button
167
174
  title={walkthrough ? 'SKIP' : 'CLOSE'}
@@ -170,7 +177,7 @@ const CodeRedeem = ({ walkthrough, onNext, onVerify, onClose }:CodeRedeemProps)
170
177
  title_color={Colors.brand.electric}
171
178
  borderWidth={1}
172
179
  padding={15}
173
- onPress={() => walkthrough ? onNext() : onClose()}
180
+ onPress={() => onClose()}
174
181
  />
175
182
  {code_request?.status == 'requested' ?
176
183
  <Button
@@ -37,7 +37,7 @@ const ProfileWelcome = ({ player, code_details, width, onStartSetup, onClose }:P
37
37
  resizeMode='cover'
38
38
  />
39
39
  </ScrollView>
40
- {code_request && promo ?
40
+ {code_request && !['closed','fulfilled'].includes(code_request.status) && promo ?
41
41
  <View style={{ margin:15, marginTop:-50, flexDirection:'row', backgroundColor:Colors.shades.white, borderRadius:8, ...view_styles.float }}>
42
42
  <View style={{ padding:10, justifyContent:'center' }}>
43
43
  <Icons.GiftIcon size={40} color={Colors.incentive.gold} />