be-components 6.5.7 → 6.5.9

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 (63) 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/GuideButton.js +48 -0
  4. package/lib/commonjs/Guide/GuideButton.js.map +1 -0
  5. package/lib/commonjs/Guide/api/index.js +33 -0
  6. package/lib/commonjs/Guide/api/index.js.map +1 -0
  7. package/lib/commonjs/Guide/index.js +27 -21
  8. package/lib/commonjs/Guide/index.js.map +1 -1
  9. package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +30 -3
  10. package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
  11. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js +1 -1
  12. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js.map +1 -1
  13. package/lib/commonjs/types.d.js +2 -0
  14. package/lib/commonjs/types.d.js.map +1 -1
  15. package/lib/module/Authenticator/Components/LoginForm.js +19 -30
  16. package/lib/module/Authenticator/Components/LoginForm.js.map +1 -1
  17. package/lib/module/Guide/GuideButton.js +41 -0
  18. package/lib/module/Guide/GuideButton.js.map +1 -0
  19. package/lib/module/Guide/api/index.js +27 -0
  20. package/lib/module/Guide/api/index.js.map +1 -0
  21. package/lib/module/Guide/index.js +28 -22
  22. package/lib/module/Guide/index.js.map +1 -1
  23. package/lib/module/MarketComponents/components/TeamEventMarket/index.js +30 -3
  24. package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
  25. package/lib/module/ProfileManager/Components/ProfileWizard.js +1 -1
  26. package/lib/module/ProfileManager/Components/ProfileWizard.js.map +1 -1
  27. package/lib/module/types.d.js +2 -0
  28. package/lib/module/types.d.js.map +1 -1
  29. package/lib/typescript/lib/commonjs/Authenticator/Components/LoginForm.d.ts.map +1 -1
  30. package/lib/typescript/lib/commonjs/Guide/GuideButton.d.ts +10 -0
  31. package/lib/typescript/lib/commonjs/Guide/GuideButton.d.ts.map +1 -0
  32. package/lib/typescript/lib/commonjs/Guide/api/index.d.ts +6 -0
  33. package/lib/typescript/lib/commonjs/Guide/api/index.d.ts.map +1 -0
  34. package/lib/typescript/lib/commonjs/Guide/index.d.ts +4 -1
  35. package/lib/typescript/lib/commonjs/Guide/index.d.ts.map +1 -1
  36. package/lib/typescript/lib/module/Authenticator/Components/LoginForm.d.ts.map +1 -1
  37. package/lib/typescript/lib/module/Guide/GuideButton.d.ts +10 -0
  38. package/lib/typescript/lib/module/Guide/GuideButton.d.ts.map +1 -0
  39. package/lib/typescript/lib/module/Guide/api/index.d.ts +5 -0
  40. package/lib/typescript/lib/module/Guide/api/index.d.ts.map +1 -0
  41. package/lib/typescript/lib/module/Guide/index.d.ts +4 -1
  42. package/lib/typescript/lib/module/Guide/index.d.ts.map +1 -1
  43. package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts +3 -2
  44. package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
  45. package/lib/typescript/src/Authenticator/Components/LoginForm.d.ts.map +1 -1
  46. package/lib/typescript/src/Guide/GuideButton.d.ts +12 -0
  47. package/lib/typescript/src/Guide/GuideButton.d.ts.map +1 -0
  48. package/lib/typescript/src/Guide/api/index.d.ts +13 -0
  49. package/lib/typescript/src/Guide/api/index.d.ts.map +1 -0
  50. package/lib/typescript/src/Guide/index.d.ts +6 -3
  51. package/lib/typescript/src/Guide/index.d.ts.map +1 -1
  52. package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts +4 -3
  53. package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
  54. package/lib/typescript/src/MarketComponents/index.d.ts +3 -2
  55. package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
  56. package/package.json +1 -1
  57. package/src/Authenticator/Components/LoginForm.tsx +11 -22
  58. package/src/Guide/GuideButton.tsx +34 -0
  59. package/src/Guide/api/index.ts +33 -0
  60. package/src/Guide/index.tsx +26 -23
  61. package/src/MarketComponents/components/TeamEventMarket/index.tsx +20 -9
  62. package/src/ProfileManager/Components/ProfileWizard.tsx +1 -1
  63. package/src/types.d.ts +61 -1
@@ -1,30 +1,32 @@
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,
8
7
  TouchableHighlight,
9
8
  TouchableWithoutFeedback,
10
9
  } from "react-native";
11
- import type { GuideWrapProps } from "../types";
10
+ import type { GuideResponseProps } from "../types";
12
11
  import { Button, Text, View } from "../Components/Themed";
13
12
  import { useColors } from "../constants/useColors";
14
13
  import { Icons } from "../Components";
15
14
 
16
15
  export type GuideWrapperProps = {
17
16
  children: React.ReactNode;
18
- guide?: GuideWrapProps;
17
+ active?:boolean,
18
+ prompt_location?:'bottom'|'top',
19
+ guide?: GuideResponseProps;
20
+ onComplete: (status:'cancelled'|'complete') => void
19
21
  };
20
22
 
21
23
  type Layout = { x: number; y: number; width: number; height: number };
22
24
 
23
- export default function GuideWrapper({ children, guide }: GuideWrapperProps) {
25
+ export default function GuideWrapper({ active, prompt_location, children, guide, onComplete }: GuideWrapperProps) {
24
26
  const Colors = useColors();
25
- const wrapper_guid = guide ?? {};
26
- const { tour, active, onComplete } = wrapper_guid;
27
-
27
+ const wrapper_guid:GuideResponseProps = guide ?? { view_type: 'prompt' };
28
+ const { tour_prompts } = wrapper_guid;
29
+ const tour = tour_prompts ?? []
28
30
  const refs = useRef<{ [key: string]: any }>({});
29
31
  const containerRef = useRef<any>(null);
30
32
 
@@ -38,13 +40,11 @@ export default function GuideWrapper({ children, guide }: GuideWrapperProps) {
38
40
  });
39
41
  const [tooltipHeight, setTooltipHeight] = useState(0);
40
42
 
41
- const { width: screenWidth } = useWindowDimensions();
42
-
43
43
  const sortedTour = tour
44
- ? [...tour].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0))
44
+ ? [...tour].sort((a, b) => (a.tour_priority ?? 0) - (b.tour_priority ?? 0))
45
45
  : [];
46
46
  const step = sortedTour[currentStep];
47
- const stepRef = step ? refs.current[step.nativeID] : undefined;
47
+ const stepRef = step ? refs.current[step.client_native_id] : undefined;
48
48
 
49
49
  const isTouchable = (child: any) => {
50
50
  const typeName = (child.type as any)?.displayName || child.type;
@@ -56,6 +56,12 @@ export default function GuideWrapper({ children, guide }: GuideWrapperProps) {
56
56
  );
57
57
  };
58
58
 
59
+ const handleDone = (status:'cancelled'|'complete') => {
60
+ setCurrentStep(0);
61
+ if(onComplete){ onComplete(status) }
62
+ }
63
+
64
+
59
65
  // Recursively attach refs to children with nativeID
60
66
  const attachRefs = (nodes: React.ReactNode): React.ReactNode => {
61
67
  return React.Children.map(nodes, (child) => {
@@ -140,7 +146,7 @@ export default function GuideWrapper({ children, guide }: GuideWrapperProps) {
140
146
  if (currentStep + 1 < sortedTour.length) {
141
147
  setCurrentStep(currentStep + 1);
142
148
  } else {
143
- onComplete?.("complete");
149
+ handleDone('complete')
144
150
  }
145
151
  };
146
152
 
@@ -192,23 +198,22 @@ export default function GuideWrapper({ children, guide }: GuideWrapperProps) {
192
198
 
193
199
  {/* Tooltip: always above overlay */}
194
200
  <View
201
+ float
195
202
  onLayout={(ev) => setTooltipHeight(ev.nativeEvent.layout.height)}
196
203
  style={{
197
204
  position: "absolute",
198
- maxWidth: screenWidth - 10,
199
- minWidth: 300,
205
+ maxWidth: 330,
206
+ minWidth: 225,
200
207
  borderColor: Colors.text.success,
201
208
  borderWidth: 1,
202
- borderRadius: 8,
203
- padding: 10,
204
- 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
205
210
  left: right ? undefined : layout.x,
206
211
  right: right ? 5 : undefined,
207
212
  zIndex: 99999999,
208
213
  }}
209
214
  >
210
215
  {step.title && (
211
- <View type='header' style={{ flexDirection: "row", alignItems: "center", marginBottom: 5, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
216
+ <View type='header' style={{ flexDirection: "row", alignItems: "center", padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
212
217
  <Icons.AlertIcon size={14} color={Colors.text.warning} />
213
218
  <Text theme="h1" style={{ flex: 1, marginLeft: 10, marginRight: 10 }}>
214
219
  {step.title}
@@ -224,24 +229,22 @@ export default function GuideWrapper({ children, guide }: GuideWrapperProps) {
224
229
  }}
225
230
  title="X"
226
231
  type="error"
227
- onPress={() => (onComplete ? onComplete("cancelled") : null)}
232
+ onPress={() => handleDone('cancelled')}
228
233
  />
229
234
  </View>
230
235
  )}
231
236
 
232
237
  {step.body && (
233
- <View type='body' style={{ padding: 5 }}>
238
+ <View type='body' style={{ padding: 10 }}>
234
239
  <Text theme="h2">{step.body}</Text>
235
240
  </View>
236
241
  )}
237
242
 
238
- <View type='footer' style={{ flexDirection: "row", alignItems: "center", marginTop: 5, borderBottomRightRadius:8,borderBottomLeftRadius:8 }}>
243
+ <View type='footer' style={{ flexDirection: "row", alignItems: "center", padding: 10, borderBottomRightRadius:8,borderBottomLeftRadius:8 }}>
239
244
  {currentStep > 0 && (
240
245
  <Button type="action" onPress={handlePrev} style={{ flex: 1, marginRight: 5 }} title="BACK" />
241
246
  )}
242
- {!step.clickable && (
243
247
  <Button type="success" onPress={handleNext} style={{ flex: 1 }} title={isLastStep ? "Done" : "Next"} />
244
- )}
245
248
  </View>
246
249
  </View>
247
250
  </View>
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { Image, FlatList, ActivityIndicator, ScrollView } from 'react-native';
3
- import type { AthleteProps, BEEventProps, BestAvailableOrderProps, CompanyProps, CompetitionProps, EventOrderStatProps, EventProps, GuideWrapProps, LeagueProps, MarketProps, MarketSideOptionProps, OrderProps, ParlayProps, PodcastProps, PollProps, SquaresCompetitionProps, TradeProps } from '../../../types';
3
+ import type { AthleteProps, BEEventProps, BestAvailableOrderProps, CompanyProps, CompetitionProps, EventOrderStatProps, EventProps, GuideResponseProps, LeagueProps, MarketProps, MarketSideOptionProps, OrderProps, ParlayProps, PodcastProps, PollProps, SquaresCompetitionProps, TradeProps } from '../../../types';
4
4
  import { view_styles } from '../../../constants/styles';
5
5
  import { Icons, LinearDiagnal } from '../../../Components';
6
6
  import {TeamEventMarketHelpers} from './api';
@@ -20,13 +20,15 @@ import { useColors } from '../../../constants/useColors';
20
20
  import OrderGradeBar from '../OrderGradeBar';
21
21
  import moment from 'moment-mini';
22
22
  import { GuideView } from 'be-components';
23
+ import GuideButton from '../../../Guide/GuideButton';
23
24
 
24
25
  type TeamEventMarketProps = {
25
26
  event:EventProps,
26
27
  markets:MarketProps[],
27
28
  parlays?:ParlayProps[],
28
29
  init_expanded?:boolean,
29
- guide?: GuideWrapProps,
30
+ show_help?:boolean,
31
+ help_location?:'bottom'|'top',
30
32
  onViewMarketStats?:() => void,
31
33
  onSetMarket?:(market_id:string, side_type?:string, side_id?:string) => void,
32
34
  league?:LeagueProps,
@@ -63,9 +65,11 @@ type TeamEventMarketProps = {
63
65
  onActivate?:(event_id:string, event_type:string) => void
64
66
  activate_loading?:boolean
65
67
  }
66
- const TeamEventMarket = ({ event, guide, 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) => {
68
+ 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, onSetMarket, onTeamSelect, onFlashSelect, onParlaySelect, onSquaresSelect, onCompetitionSelect, onExpand, onOrder, onViewMarketStats, onView, onViewAdditionalMarkets, onTradeLongPress, onTVSelect, onActivate, onEvent, onShare, onPodcastSelect }:TeamEventMarketProps) => {
67
69
  const C = useColors();
68
70
  const [ market_width, setMarketWidth ] = useState(180);
71
+ const [ guide_response, setGuide ] = useState<{guide_active:boolean, guide?:GuideResponseProps}>({ guide_active:false });
72
+ const { guide_active, guide } = guide_response;
69
73
  const [ expanded_data, setExpandedData ] = useState<{
70
74
  expanded:boolean,
71
75
  loaded:boolean,
@@ -410,9 +414,9 @@ const TeamEventMarket = ({ event, guide, parlays, hide_non_primary, disabled_mar
410
414
  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])
411
415
  const tv_link = event.info?.broadcast?.link && onTVSelect ? event.info?.broadcast?.link : undefined
412
416
  return (
413
- <GuideView guide={guide}>
417
+ <GuideView prompt_location={help_location} guide={guide} active={guide_active} onComplete={() => setGuide({ guide_active: false })}>
414
418
 
415
- <View ref={ref} float={float} style={[style]}>
419
+ <View nativeID='team_event_market' ref={ref} float={float} style={[style]}>
416
420
  {sponsor ?
417
421
  <LinearGradient style={{ marginTop:-1, marginLeft:-1, marginRight:-1, padding:10, flexDirection:'row', alignItems:'center', borderTopRightRadius:8, borderTopLeftRadius:8 }} start={{x: 0, y: 0}} end={{x: 1, y: 0}} colors={[sponsor.brand_primary ?? C.text.h1, sponsor.brand_secondary ?? C.text.h1]}>
418
422
  {onActivate && event_status != 'closed' ?
@@ -503,7 +507,14 @@ const TeamEventMarket = ({ event, guide, parlays, hide_non_primary, disabled_mar
503
507
  <Text theme='light' selectable>{event.event_id}</Text>
504
508
  :<></>}
505
509
  </View>
506
-
510
+ {show_help ?
511
+ <GuideButton
512
+ onError={() => alert('Unable to get help')}
513
+ onHelp={(guide) => { setGuide({ guide_active:true, guide })}}
514
+ show_label
515
+ client_native_id='team_event_market'
516
+ />
517
+ :<></>}
507
518
  </View>
508
519
  <Button transparent disabled={!tv_link} style={{ flexDirection:'row', alignItems:'center', padding:0 }}
509
520
  onPress={() => tv_link && onTVSelect ? onTVSelect(tv_link) : console.log('')}>
@@ -637,7 +648,7 @@ const TeamEventMarket = ({ event, guide, parlays, hide_non_primary, disabled_mar
637
648
  }
638
649
  </View>
639
650
  {flash_markets && onFlashSelect && flash_markets.length > 1 ?
640
- <View style={{ borderTopWidth:1, borderColor:C.borders.light, paddingTop:5 }}>
651
+ <View style={{ borderTopWidth:1, borderColor:C.borders.light, paddingTop:5 }}>
641
652
  <FlatList
642
653
  data={flash_markets.sort((a,b) => (a.total_responses??0) - (b.total_responses??0) || moment(a.end_datetime).unix() - moment(b.end_datetime).unix())}
643
654
  key='flash_markets_event'
@@ -648,7 +659,7 @@ const TeamEventMarket = ({ event, guide, parlays, hide_non_primary, disabled_mar
648
659
  </View>
649
660
  :<></>}
650
661
  {onFlashSelect && upcoming_flash_market ?
651
- <View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderColor:C.borders.light }}>
662
+ <View nativeID='team_event_flash_markets' type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderColor:C.borders.light }}>
652
663
  {upcoming_flash_market.poll_image && flash_markets && flash_markets.length == 1 ?
653
664
  <Image
654
665
  source={{ uri: upcoming_flash_market.poll_image.url }}
@@ -670,7 +681,7 @@ const TeamEventMarket = ({ event, guide, parlays, hide_non_primary, disabled_mar
670
681
  </View>
671
682
  :<></>}
672
683
  {event_status == 'active' ?
673
- <View type='footer' style={{ padding:10, flexDirection:'row', alignItems:'center', flexWrap:'wrap', borderBottomLeftRadius:8, borderBottomRightRadius:8 }}>
684
+ <View type='footer' nativeID='team_event_activities' style={{ padding:10, flexDirection:'row', alignItems:'center', flexWrap:'wrap', borderBottomLeftRadius:8, borderBottomRightRadius:8 }}>
674
685
  {!hide_liquidity ?
675
686
  <Button
676
687
  nativeID='team_event_liquidity'
@@ -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 ?
package/src/types.d.ts CHANGED
@@ -7,8 +7,68 @@ export interface ErrorProps {
7
7
  message: string
8
8
  }
9
9
 
10
+ //HELP
11
+
12
+ export interface HelpActionProps {
13
+ action_label:string,
14
+ action_type:string,
15
+ action_url?:string,
16
+ internal_nav_options: {
17
+ page_stack:string,
18
+ page:string,
19
+ page_params:any
20
+ },
21
+ button_color:string,
22
+ button_border_color:string,
23
+ action_label_font:string
24
+ }
25
+ export interface HelpMediaObjProps {
26
+ media_url:string,
27
+ height:string,
28
+ width:string
29
+ }
30
+ export interface HelpTourProps {
31
+ help_tour_id:string,
32
+ help_tour_name:string,
33
+ help_tour_description:string,
34
+ status:'active' | 'inactive',
35
+ carousel_change_seconds:number,
36
+ create_datetime:any,
37
+ last_update_datetime:any
38
+ }
39
+ export interface HelpPromptProps {
40
+ help_prompt_id:string,
41
+ client_native_id:string,
42
+ help_tour_id?:string,
43
+ tour_priority?:number,
44
+ title:string,
45
+ title_font_color?:string,
46
+ body:string,
47
+ body_font_color?:string,
48
+ media_type?:'IMAGE'|'VIDEO',
49
+ media_obj?:HelpMediaObjProps,
50
+ footer?:string,
51
+ footer_font_color?:string,
52
+ help_background_color?:string,
53
+ help_background_opacity_color:string,
54
+ actions:HelpActionProps[],
55
+ status:'active'|'inactive',
56
+ create_datetime:any,
57
+ last_update_datetime:any,
58
+ prompt_type:string
59
+ }
60
+
61
+ export interface GuideResponseProps {
62
+ view_type:'prompt'|'tour',
63
+ help_prompt?:HelpPromptProps,
64
+ help_tour?:HelpTourProps,
65
+ tour_prompts?:HelpPromptProps[],
66
+ active_tour_prompt?:string
67
+ }
68
+
10
69
  export interface GuideWrapProps {
11
- tour?:TourStepProps[],
70
+ tour?:HelpPromptProps[],
71
+ help_tour?:HelpTourProps,
12
72
  onComplete?:(state:'cancelled'|'complete') => void,
13
73
  active?:boolean
14
74
  }