be-components 6.5.8 → 6.6.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 (36) hide show
  1. package/lib/commonjs/Authenticator/Components/LoginForm.js +18 -29
  2. package/lib/commonjs/Authenticator/Components/LoginForm.js.map +1 -1
  3. package/lib/commonjs/Guide/index.js +12 -8
  4. package/lib/commonjs/Guide/index.js.map +1 -1
  5. package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +14 -3
  6. package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
  7. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js +1 -1
  8. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js.map +1 -1
  9. package/lib/module/Authenticator/Components/LoginForm.js +19 -30
  10. package/lib/module/Authenticator/Components/LoginForm.js.map +1 -1
  11. package/lib/module/Guide/index.js +13 -9
  12. package/lib/module/Guide/index.js.map +1 -1
  13. package/lib/module/MarketComponents/components/TeamEventMarket/index.js +14 -3
  14. package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
  15. package/lib/module/ProfileManager/Components/ProfileWizard.js +1 -1
  16. package/lib/module/ProfileManager/Components/ProfileWizard.js.map +1 -1
  17. package/lib/typescript/lib/commonjs/Authenticator/Components/LoginForm.d.ts.map +1 -1
  18. package/lib/typescript/lib/commonjs/Guide/index.d.ts +2 -1
  19. package/lib/typescript/lib/commonjs/Guide/index.d.ts.map +1 -1
  20. package/lib/typescript/lib/module/Authenticator/Components/LoginForm.d.ts.map +1 -1
  21. package/lib/typescript/lib/module/Guide/index.d.ts +2 -1
  22. package/lib/typescript/lib/module/Guide/index.d.ts.map +1 -1
  23. package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts +3 -1
  24. package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
  25. package/lib/typescript/src/Authenticator/Components/LoginForm.d.ts.map +1 -1
  26. package/lib/typescript/src/Guide/index.d.ts +2 -1
  27. package/lib/typescript/src/Guide/index.d.ts.map +1 -1
  28. package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts +3 -1
  29. package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
  30. package/lib/typescript/src/MarketComponents/index.d.ts +3 -1
  31. package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
  32. package/package.json +1 -1
  33. package/src/Authenticator/Components/LoginForm.tsx +11 -22
  34. package/src/Guide/index.tsx +11 -9
  35. package/src/MarketComponents/components/TeamEventMarket/index.tsx +11 -3
  36. package/src/ProfileManager/Components/ProfileWizard.tsx +1 -1
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Keyboard, TouchableOpacity } from "react-native"
3
- import { Icons } from '../../Components';
3
+ import { Icons, Toggle } from '../../Components';
4
4
  import Colors from '../../constants/colors';
5
5
  import { AuthenticateApi, AuthenticateHelpers } from '../api';
6
6
  import type { AuthenticatedProps } from '../api/types';
@@ -19,7 +19,6 @@ type LoginFormProps = {
19
19
  }
20
20
 
21
21
 
22
- const attribute_options = ['username', 'email', 'phone']
23
22
  const LoginForm = ({ maxWidth, visible, onRegister, onFocusPosition, onAuthenticated, onTryAuthenticate }:LoginFormProps) => {
24
23
  const C = useColors();
25
24
  const [ auth_check, setAuthCheck ] = useState<{
@@ -131,26 +130,16 @@ const LoginForm = ({ maxWidth, visible, onRegister, onFocusPosition, onAuthentic
131
130
  <View>
132
131
  <Text theme='h1'>Login Using My:</Text>
133
132
  </View>
134
- <View nativeID='attribute_toggle' style={{ marginTop:10, flexDirection:'row', borderRadius:22, borderWidth:1, backgroundColor:Colors.shades.shade400, borderColor:Colors.shades.shade600 }}>
135
- {attribute_options.map((a,i) => {
136
- const selected = a == attribute ? true : false
137
- return (
138
- <Button
139
- title={a.toUpperCase()}
140
- style={{
141
- flex:1,
142
- padding:15,
143
- borderTopLeftRadius: i == 0 ? 22 : 0,
144
- borderBottomLeftRadius: i == 0 ? 22 : 0,
145
- borderTopRightRadius: i == attribute_options.length -1 ? 22 : 0,
146
- borderBottomRightRadius: i == attribute_options.length -1 ? 22 : 0,
147
- }}
148
- title_color={selected ? Colors.shades.white : Colors.brand.electric}
149
- backgroundColor={selected ? Colors.brand.electric : 'transparent'}
150
- onPress={() => setAuthCheck({ attribute:a as 'username'|'email'|'phone', value: '', loading:false })}
151
- />
152
- )
153
- })}
133
+ <View style={{ marginTop:10 }}>
134
+ <Toggle
135
+ options={[
136
+ { key: 'username', label: 'Username' },
137
+ { key: 'email', label: 'Email'},
138
+ { key: 'phone', label: 'Phone' }
139
+ ]}
140
+ selected_option={attribute}
141
+ onSelectOption={(a) => setAuthCheck({ ...auth_check, attribute: a as 'username'|'email'|'phone' })}
142
+ />
154
143
  </View>
155
144
  </View>
156
145
  <View style={{ flexGrow:1 }}>
@@ -1,7 +1,6 @@
1
1
  import React, { useRef, useState, useEffect } from "react";
2
2
  import {
3
3
  Platform,
4
- useWindowDimensions,
5
4
  UIManager,
6
5
  findNodeHandle,
7
6
  TouchableOpacity,
@@ -16,13 +15,14 @@ import { Icons } from "../Components";
16
15
  export type GuideWrapperProps = {
17
16
  children: React.ReactNode;
18
17
  active?:boolean,
18
+ prompt_location?:'bottom'|'top',
19
19
  guide?: GuideResponseProps;
20
20
  onComplete: (status:'cancelled'|'complete') => void
21
21
  };
22
22
 
23
23
  type Layout = { x: number; y: number; width: number; height: number };
24
24
 
25
- export default function GuideWrapper({ active, children, guide, onComplete }: GuideWrapperProps) {
25
+ export default function GuideWrapper({ active, prompt_location, children, guide, onComplete }: GuideWrapperProps) {
26
26
  const Colors = useColors();
27
27
  const wrapper_guid:GuideResponseProps = guide ?? { view_type: 'prompt' };
28
28
  const { tour_prompts } = wrapper_guid;
@@ -40,8 +40,6 @@ export default function GuideWrapper({ active, children, guide, onComplete }: Gu
40
40
  });
41
41
  const [tooltipHeight, setTooltipHeight] = useState(0);
42
42
 
43
- const { width: screenWidth } = useWindowDimensions();
44
-
45
43
  const sortedTour = tour
46
44
  ? [...tour].sort((a, b) => (a.tour_priority ?? 0) - (b.tour_priority ?? 0))
47
45
  : [];
@@ -58,6 +56,10 @@ export default function GuideWrapper({ active, children, guide, onComplete }: Gu
58
56
  );
59
57
  };
60
58
 
59
+ const handleDone = (status:'cancelled'|'complete') => {
60
+ setCurrentStep(0);
61
+ if(onComplete){ onComplete(status) }
62
+ }
61
63
 
62
64
 
63
65
  // Recursively attach refs to children with nativeID
@@ -144,7 +146,7 @@ export default function GuideWrapper({ active, children, guide, onComplete }: Gu
144
146
  if (currentStep + 1 < sortedTour.length) {
145
147
  setCurrentStep(currentStep + 1);
146
148
  } else {
147
- onComplete?.("complete");
149
+ handleDone('complete')
148
150
  }
149
151
  };
150
152
 
@@ -200,11 +202,11 @@ export default function GuideWrapper({ active, children, guide, onComplete }: Gu
200
202
  onLayout={(ev) => setTooltipHeight(ev.nativeEvent.layout.height)}
201
203
  style={{
202
204
  position: "absolute",
203
- maxWidth: screenWidth - 10,
204
- minWidth: 300,
205
+ maxWidth: 330,
206
+ minWidth: 225,
205
207
  borderColor: Colors.text.success,
206
208
  borderWidth: 1,
207
- top: layout.y - tooltipHeight - 10, // 10px margin above overlay
209
+ top: prompt_location == 'bottom' ? layout.y + layout.height + 10 : layout.y - tooltipHeight - 10, // 10px margin above overlay
208
210
  left: right ? undefined : layout.x,
209
211
  right: right ? 5 : undefined,
210
212
  zIndex: 99999999,
@@ -227,7 +229,7 @@ export default function GuideWrapper({ active, children, guide, onComplete }: Gu
227
229
  }}
228
230
  title="X"
229
231
  type="error"
230
- onPress={() => (onComplete ? onComplete("cancelled") : null)}
232
+ onPress={() => handleDone('cancelled')}
231
233
  />
232
234
  </View>
233
235
  )}
@@ -28,6 +28,8 @@ type TeamEventMarketProps = {
28
28
  parlays?:ParlayProps[],
29
29
  init_expanded?:boolean,
30
30
  show_help?:boolean,
31
+ onHelpToggle?:(visible:boolean) => void,
32
+ help_location?:'bottom'|'top',
31
33
  onViewMarketStats?:() => void,
32
34
  onSetMarket?:(market_id:string, side_type?:string, side_id?:string) => void,
33
35
  league?:LeagueProps,
@@ -64,7 +66,7 @@ type TeamEventMarketProps = {
64
66
  onActivate?:(event_id:string, event_type:string) => void
65
67
  activate_loading?:boolean
66
68
  }
67
- const TeamEventMarket = ({ event, show_help, parlays, hide_non_primary, disabled_markets, flash_markets, league, float, style, init_expanded, hot_markets_direction, show_id, hide_liquidity, show_podcasts, activate_loading, competitions, squares_competitions, show_grades, markets, latest_trades, best_available_orders, event_order_stats, default_price_view, onSetMarket, onTeamSelect, onFlashSelect, onParlaySelect, onSquaresSelect, onCompetitionSelect, onExpand, onOrder, onViewMarketStats, onView, onViewAdditionalMarkets, onTradeLongPress, onTVSelect, onActivate, onEvent, onShare, onPodcastSelect }:TeamEventMarketProps) => {
69
+ const TeamEventMarket = ({ event, show_help, help_location, parlays, hide_non_primary, disabled_markets, flash_markets, league, float, style, init_expanded, hot_markets_direction, show_id, hide_liquidity, show_podcasts, activate_loading, competitions, squares_competitions, show_grades, markets, latest_trades, best_available_orders, event_order_stats, default_price_view, onHelpToggle, onSetMarket, onTeamSelect, onFlashSelect, onParlaySelect, onSquaresSelect, onCompetitionSelect, onExpand, onOrder, onViewMarketStats, onView, onViewAdditionalMarkets, onTradeLongPress, onTVSelect, onActivate, onEvent, onShare, onPodcastSelect }:TeamEventMarketProps) => {
68
70
  const C = useColors();
69
71
  const [ market_width, setMarketWidth ] = useState(180);
70
72
  const [ guide_response, setGuide ] = useState<{guide_active:boolean, guide?:GuideResponseProps}>({ guide_active:false });
@@ -413,7 +415,10 @@ const TeamEventMarket = ({ event, show_help, parlays, hide_non_primary, disabled
413
415
  const { non_primary_markets, available } = useMemo(() => TeamEventMarketHelpers.sortNonPrimaryMarkets(TeamEventMarketHelpers.getNonPrimaryMarkets(event, markets), event_order_stats, latest_trades),[JSON.stringify(event_order_stats), JSON.stringify(latest_trades), markets.length, event.last_update_datetime])
414
416
  const tv_link = event.info?.broadcast?.link && onTVSelect ? event.info?.broadcast?.link : undefined
415
417
  return (
416
- <GuideView guide={guide} active={guide_active} onComplete={() => setGuide({ guide_active: false })}>
418
+ <GuideView prompt_location={help_location} guide={guide} active={guide_active} onComplete={() => {
419
+ setGuide({ guide_active: false })
420
+ if(onHelpToggle){ onHelpToggle(false) }
421
+ }}>
417
422
 
418
423
  <View nativeID='team_event_market' ref={ref} float={float} style={[style]}>
419
424
  {sponsor ?
@@ -509,7 +514,10 @@ const TeamEventMarket = ({ event, show_help, parlays, hide_non_primary, disabled
509
514
  {show_help ?
510
515
  <GuideButton
511
516
  onError={() => alert('Unable to get help')}
512
- onHelp={(guide) => { setGuide({ guide_active:true, guide })}}
517
+ onHelp={(guide) => {
518
+ setGuide({ guide_active:true, guide });
519
+ if(onHelpToggle){ onHelpToggle(true) }
520
+ }}
513
521
  show_label
514
522
  client_native_id='team_event_market'
515
523
  />
@@ -364,7 +364,7 @@ const ProfileWizard = ({ player, view_mode, settings, player_settings, insets,
364
364
  type='error'
365
365
  style={{ marginLeft:20 }}
366
366
  >
367
- <Icons.LogoutIcon color={C.text.h1} size={20}/>
367
+ <Icons.LogoutIcon color={C.text.white} size={20}/>
368
368
  </Button>
369
369
  </View>
370
370
  {show_logout ?