be-components 3.6.3 → 3.6.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 (38) hide show
  1. package/lib/commonjs/Authenticator/Components/AuthStrategyIdentifier.js +1 -1
  2. package/lib/commonjs/Authenticator/Components/AuthStrategyIdentifier.js.map +1 -1
  3. package/lib/commonjs/Authenticator/Components/StrategyForm.js +3 -7
  4. package/lib/commonjs/Authenticator/Components/StrategyForm.js.map +1 -1
  5. package/lib/commonjs/Authenticator/index.js +92 -66
  6. package/lib/commonjs/Authenticator/index.js.map +1 -1
  7. package/lib/commonjs/Components/Themed.js +5 -1
  8. package/lib/commonjs/Components/Themed.js.map +1 -1
  9. package/lib/commonjs/constants/useColors.js +2 -2
  10. package/lib/commonjs/constants/useColors.js.map +1 -1
  11. package/lib/module/Authenticator/Components/AuthStrategyIdentifier.js +1 -1
  12. package/lib/module/Authenticator/Components/AuthStrategyIdentifier.js.map +1 -1
  13. package/lib/module/Authenticator/Components/StrategyForm.js +3 -7
  14. package/lib/module/Authenticator/Components/StrategyForm.js.map +1 -1
  15. package/lib/module/Authenticator/index.js +93 -67
  16. package/lib/module/Authenticator/index.js.map +1 -1
  17. package/lib/module/Components/Themed.js +5 -1
  18. package/lib/module/Components/Themed.js.map +1 -1
  19. package/lib/module/constants/useColors.js +2 -2
  20. package/lib/module/constants/useColors.js.map +1 -1
  21. package/lib/typescript/lib/commonjs/Authenticator/Components/StrategyForm.d.ts.map +1 -1
  22. package/lib/typescript/lib/commonjs/Authenticator/index.d.ts +1 -3
  23. package/lib/typescript/lib/commonjs/Authenticator/index.d.ts.map +1 -1
  24. package/lib/typescript/lib/commonjs/Components/Themed.d.ts.map +1 -1
  25. package/lib/typescript/lib/module/Authenticator/Components/StrategyForm.d.ts.map +1 -1
  26. package/lib/typescript/lib/module/Authenticator/index.d.ts +2 -6
  27. package/lib/typescript/lib/module/Authenticator/index.d.ts.map +1 -1
  28. package/lib/typescript/lib/module/Components/Themed.d.ts.map +1 -1
  29. package/lib/typescript/src/Authenticator/Components/AuthStrategyIdentifier.d.ts.map +1 -1
  30. package/lib/typescript/src/Authenticator/index.d.ts +1 -1
  31. package/lib/typescript/src/Authenticator/index.d.ts.map +1 -1
  32. package/lib/typescript/src/Components/Themed.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/Authenticator/Components/AuthStrategyIdentifier.tsx +1 -2
  35. package/src/Authenticator/Components/StrategyForm.tsx +3 -3
  36. package/src/Authenticator/index.tsx +64 -46
  37. package/src/Components/Themed.tsx +5 -3
  38. package/src/constants/useColors.tsx +2 -2
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import StrategyForm from './Components/StrategyForm';
3
3
  import { AuthenticateApi } from './api';
4
- import { Image } from 'react-native';
4
+ import { FlatList, Image } from 'react-native';
5
5
  import LoginForm from './Components/LoginForm';
6
6
  import { Text, View, Button } from '../Components/Themed';
7
7
  import type { AuthStrategyIdentifierProps, AuthStrategyProps, AuthenticatedProps } from './api/types';
@@ -26,9 +26,9 @@ type AuthenticateWizardProps = {
26
26
  onClose: () => void
27
27
  }
28
28
 
29
- const Authenticator = ({ visible, theme, show_referral, auth_strategy_id, default_view, company_id, source, referral_code, maxWidth, opt_in_url, onTryAuthenticate, onAuthenticated, onClose }:AuthenticateWizardProps) => {
29
+ const auth_sections = ['header','strategy','login','actions']
30
+ const Authenticator = ({ show_referral, auth_strategy_id, default_view, company_id, source, referral_code, maxWidth, opt_in_url, onTryAuthenticate, onAuthenticated, onClose }:AuthenticateWizardProps) => {
30
31
  const C = useColors();
31
- const [ loaded, setLoaded ] = useState(false);
32
32
  const [ company, setCompany ] = useState<CompanyProps>();
33
33
  const [ distinct_id, setDistinctID ] = useState<string>();
34
34
  const [ active_view, setActiveView ] = useState(default_view ?? 'register')
@@ -73,64 +73,82 @@ const Authenticator = ({ visible, theme, show_referral, auth_strategy_id, defaul
73
73
  auth_strategy_identifiers,
74
74
  loading:false
75
75
  })
76
- setLoaded(true);
77
76
  }
78
77
 
79
78
  const handleAuthenticated = async(auth_response:AuthenticatedProps) => {
80
79
  return onAuthenticated(auth_response)
81
80
  }
82
81
 
83
- if(!loaded || !distinct_id){ return <></> }
84
- if(!visible){ return <></> }
85
- return (
86
- <View style={{ maxWidth }}>
87
- {company && theme != 'mini' ?
88
- <View style={{ padding:20, flexDirection:'row', alignItems:'center', borderTopRightRadius:22, borderTopLeftRadius:22, borderBottomWidth:1, borderColor:C.borders.light }}>
89
- <View style={{ flex:1, marginRight:10 }}>
90
- <Text size={28} weight='bold' color={C.text.h1}>{active_view == 'login' ? 'Log In!': 'Welcome!'}</Text>
91
- <Text theme='h2'>{active_view == 'login' ? 'Continue to login with':'Complete the form below to participate with'} {company?.company_name ?? 'Bettoredge'}</Text>
92
- </View>
93
- <View>
94
- <Image
95
- source={{ uri: company?.company_image?.url }}
96
- style={{ width: 50, height: 50, borderRadius:8 }}
97
- resizeMode='cover'
82
+ const renderSections = (data: { item:string, index:number }) => {
83
+ switch(data.item){
84
+ case 'header':
85
+ if(!company){ return <></> }
86
+ return (
87
+ <View type='header' style={{ padding:20, flexDirection:'row', alignItems:'center', borderTopRightRadius:40, borderTopLeftRadius:40, borderBottomWidth:1, borderColor:C.borders.light }}>
88
+ <View transparent style={{ flex:1, marginRight:10 }}>
89
+ <Text size={28} weight='bold' color={C.text.h1}>{active_view == 'login' ? 'Log In!': 'Welcome!'}</Text>
90
+ <Text theme='h2'>{active_view == 'login' ? 'Continue to login with':'Complete the form below to participate with'} {company?.company_name ?? 'Bettoredge'}</Text>
91
+ </View>
92
+ <View float style={{ borderRadius:100, padding:10, backgroundColor:C.text.white }}>
93
+ <Image
94
+ source={{ uri: company?.company_image?.url }}
95
+ style={{ width: 50, height: 50, borderRadius:8 }}
96
+ resizeMode='cover'
97
+ />
98
+ </View>
99
+ </View>
100
+ )
101
+ case 'strategy':
102
+ return (
103
+ <StrategyForm
104
+ visible={active_view == 'register' ? true : false}
105
+ maxWidth={maxWidth}
106
+ company={company}
107
+ strategy={strategy}
108
+ onLogin={() => setActiveView('login')}
109
+ auth_strategy_id={auth_strategy_id}
110
+ company_id={company_id}
111
+ show_referral={show_referral}
112
+ distinct_id={distinct_id ?? ''}
113
+ source={source}
114
+ referral_code={referral_code ?? 'tipoff'}
115
+ opt_in_url={opt_in_url}
116
+ onAuthenticated={handleAuthenticated}
117
+ />
118
+ )
119
+ case 'login':
120
+ return (
121
+ <LoginForm
122
+ maxWidth={maxWidth}
123
+ visible={ active_view == 'login' ? true : false }
124
+ onAuthenticated={handleAuthenticated}
125
+ onTryAuthenticate={(attribute, result) => onTryAuthenticate ? onTryAuthenticate(attribute, result) : console.log()}
126
+ onRegister={() => setActiveView('register')}
98
127
  />
99
- </View>
128
+ )
129
+ default: return <></>
130
+ }
131
+ }
132
+
133
+ return (
134
+ <View transparent>
135
+ <View transparent>
136
+ <FlatList
137
+ key='auth_section_list'
138
+ keyExtractor={(item) => item}
139
+ data={auth_sections}
140
+ renderItem={renderSections}
141
+ />
100
142
  </View>
101
- :<></>}
102
- <StrategyForm
103
- visible={active_view == 'register' ? true : false}
104
- maxWidth={maxWidth}
105
- company={company}
106
- strategy={strategy}
107
- onLogin={() => setActiveView('login')}
108
- auth_strategy_id={auth_strategy_id}
109
- company_id={company_id}
110
- show_referral={show_referral}
111
- distinct_id={distinct_id}
112
- source={source}
113
- referral_code={referral_code ?? 'tipoff'}
114
- opt_in_url={opt_in_url}
115
- onAuthenticated={handleAuthenticated}
116
- />
117
- <LoginForm
118
- maxWidth={maxWidth}
119
- visible={ active_view == 'login' ? true : false }
120
- onAuthenticated={handleAuthenticated}
121
- onTryAuthenticate={(attribute, result) => onTryAuthenticate ? onTryAuthenticate(attribute, result) : console.log()}
122
- onRegister={() => setActiveView('register')}
123
- />
124
- {theme != 'mini' ?
125
- <View style={{ padding:10 }}>
143
+ <View type='footer' style={{ padding:10, flexDirection:'row', alignItems:'center' }}>
126
144
  <Button
127
145
  title='CLOSE'
128
146
  title_color={C.text.error}
147
+ style={{ flex:1 }}
129
148
  type='close'
130
149
  onPress={() => onClose()}
131
150
  />
132
151
  </View>
133
- :<></>}
134
152
  </View>
135
153
  )
136
154
  }
@@ -95,11 +95,12 @@ export const View = forwardRef(({ ...props }:ViewProps, ref:any) => {
95
95
  const color = getColor();
96
96
  let border_color = type == 'input' ? C.borders.input : undefined
97
97
  let border_width = type == 'input' ? 1 : undefined
98
- let floated = float ? color_mode == 'dark' ? MyViewStyles.floatDark : MyViewStyles.floatLight : {}
98
+ const borderRadius = type=='input' ? 8 : undefined
99
+ let floated = (float || type=='input') ? color_mode == 'dark' ? MyViewStyles.floatDark : MyViewStyles.floatLight : {}
99
100
  let flexDirection:'row'|'column' = type == 'row' ? 'row' : 'column'
100
101
  let alignItems:'center'|undefined = type == 'row' ? 'center' : undefined
101
102
 
102
- return <DefaultView ref={ref} style={[{ backgroundColor:color, borderColor: border_color, borderWidth: border_width, ...floated }, { flexDirection, alignItems }, style]} {...otherProps} />;
103
+ return <DefaultView ref={ref} style={[{ backgroundColor:color, borderRadius, borderColor: border_color, borderWidth: border_width, ...floated }, { flexDirection, alignItems }, style]} {...otherProps} />;
103
104
  })
104
105
 
105
106
 
@@ -221,6 +222,7 @@ export const TextInput = (props:TextInputProps) => {
221
222
  const C = useColors();
222
223
  const { type, style, transparent, ...otherProps } = props;
223
224
 
225
+ const borderRadius = 8
224
226
  const background = transparent ? undefined : C.views.input
225
227
  const border = transparent ? undefined : C.borders.input
226
228
  const color = C.text.input
@@ -228,6 +230,6 @@ export const TextInput = (props:TextInputProps) => {
228
230
  const placeholder_color = C.text.placholder
229
231
 
230
232
  return (
231
- <DefaultTextInput placeholderTextColor={placeholder_color} style={[{ padding:15, backgroundColor: background, borderColor: border, borderWidth, color }, style]} { ...otherProps }/>
233
+ <DefaultTextInput placeholderTextColor={placeholder_color} style={[{ padding:15, borderRadius, backgroundColor: background, borderColor: border, borderWidth, color }, style]} { ...otherProps }/>
232
234
  )
233
235
  }
@@ -129,7 +129,7 @@ export const useColors = () => {
129
129
  background: 'rgba(17, 17, 17, 0.9)', // #111111
130
130
  header: Colors.shades.blackFadedHeavy, // **(NEW)** #222831
131
131
  body: Colors.shades.shade500,
132
- input: Colors.shades.black_faded,
132
+ input: 'rgba(255, 255, 255, 0.05)',
133
133
  footer: Colors.shades.blackFadedHeavy, // **(NEW)** #222831,
134
134
  gold: Colors.incentive.goldDark,
135
135
  blur: 'rgba(17, 17, 17, 0.7)',
@@ -141,7 +141,7 @@ export const useColors = () => {
141
141
  borders: {
142
142
  light: Colors.shades.shade500, // Slightly lighter gray for subtle contrast in dark mode
143
143
  dark: Colors.accents.accent200, // Deeper accent color for strong contrast
144
- input: Colors.shades.shade500
144
+ input: 'rgba(255, 255, 255, 0.1)'
145
145
  },
146
146
  text: {
147
147
  white:Colors.shades.white,