be-components 6.6.0 → 6.6.2

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 (86) hide show
  1. package/lib/commonjs/Engage/components/CompetitionCard.js +54 -1
  2. package/lib/commonjs/Engage/components/CompetitionCard.js.map +1 -1
  3. package/lib/commonjs/Group/api/index.js +203 -0
  4. package/lib/commonjs/Group/api/index.js.map +1 -0
  5. package/lib/commonjs/Group/components/GroupCTAButton.js +85 -0
  6. package/lib/commonjs/Group/components/GroupCTAButton.js.map +1 -0
  7. package/lib/commonjs/Group/components/GroupPlayerActionForm.js +166 -0
  8. package/lib/commonjs/Group/components/GroupPlayerActionForm.js.map +1 -0
  9. package/lib/commonjs/Group/components/ManageGroupForm.js +476 -0
  10. package/lib/commonjs/Group/components/ManageGroupForm.js.map +1 -0
  11. package/lib/commonjs/Group/index.js +671 -0
  12. package/lib/commonjs/Group/index.js.map +1 -0
  13. package/lib/commonjs/Wallet/index.js +8 -1
  14. package/lib/commonjs/Wallet/index.js.map +1 -1
  15. package/lib/commonjs/index.js +7 -0
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/module/Engage/components/CompetitionCard.js +54 -1
  18. package/lib/module/Engage/components/CompetitionCard.js.map +1 -1
  19. package/lib/module/Group/api/index.js +197 -0
  20. package/lib/module/Group/api/index.js.map +1 -0
  21. package/lib/module/Group/components/GroupCTAButton.js +78 -0
  22. package/lib/module/Group/components/GroupCTAButton.js.map +1 -0
  23. package/lib/module/Group/components/GroupPlayerActionForm.js +159 -0
  24. package/lib/module/Group/components/GroupPlayerActionForm.js.map +1 -0
  25. package/lib/module/Group/components/ManageGroupForm.js +469 -0
  26. package/lib/module/Group/components/ManageGroupForm.js.map +1 -0
  27. package/lib/module/Group/index.js +663 -0
  28. package/lib/module/Group/index.js.map +1 -0
  29. package/lib/module/Wallet/index.js +8 -1
  30. package/lib/module/Wallet/index.js.map +1 -1
  31. package/lib/module/index.js +2 -1
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/typescript/lib/commonjs/Engage/components/CompetitionCard.d.ts +4 -1
  34. package/lib/typescript/lib/commonjs/Engage/components/CompetitionCard.d.ts.map +1 -1
  35. package/lib/typescript/lib/commonjs/Group/api/index.d.ts +38 -0
  36. package/lib/typescript/lib/commonjs/Group/api/index.d.ts.map +1 -0
  37. package/lib/typescript/lib/commonjs/Group/components/GroupCTAButton.d.ts +10 -0
  38. package/lib/typescript/lib/commonjs/Group/components/GroupCTAButton.d.ts.map +1 -0
  39. package/lib/typescript/lib/commonjs/Group/components/GroupPlayerActionForm.d.ts +9 -0
  40. package/lib/typescript/lib/commonjs/Group/components/GroupPlayerActionForm.d.ts.map +1 -0
  41. package/lib/typescript/lib/commonjs/Group/components/ManageGroupForm.d.ts +10 -0
  42. package/lib/typescript/lib/commonjs/Group/components/ManageGroupForm.d.ts.map +1 -0
  43. package/lib/typescript/lib/commonjs/Group/index.d.ts +12 -0
  44. package/lib/typescript/lib/commonjs/Group/index.d.ts.map +1 -0
  45. package/lib/typescript/lib/commonjs/Wallet/index.d.ts.map +1 -1
  46. package/lib/typescript/lib/commonjs/index.d.ts +1 -0
  47. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
  48. package/lib/typescript/lib/module/Engage/components/CompetitionCard.d.ts +4 -1
  49. package/lib/typescript/lib/module/Engage/components/CompetitionCard.d.ts.map +1 -1
  50. package/lib/typescript/lib/module/Group/api/index.d.ts +37 -0
  51. package/lib/typescript/lib/module/Group/api/index.d.ts.map +1 -0
  52. package/lib/typescript/lib/module/Group/components/GroupCTAButton.d.ts +10 -0
  53. package/lib/typescript/lib/module/Group/components/GroupCTAButton.d.ts.map +1 -0
  54. package/lib/typescript/lib/module/Group/components/GroupPlayerActionForm.d.ts +9 -0
  55. package/lib/typescript/lib/module/Group/components/GroupPlayerActionForm.d.ts.map +1 -0
  56. package/lib/typescript/lib/module/Group/components/ManageGroupForm.d.ts +10 -0
  57. package/lib/typescript/lib/module/Group/components/ManageGroupForm.d.ts.map +1 -0
  58. package/lib/typescript/lib/module/Group/index.d.ts +12 -0
  59. package/lib/typescript/lib/module/Group/index.d.ts.map +1 -0
  60. package/lib/typescript/lib/module/Wallet/index.d.ts.map +1 -1
  61. package/lib/typescript/lib/module/index.d.ts +2 -1
  62. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  63. package/lib/typescript/src/Engage/components/CompetitionCard.d.ts +5 -2
  64. package/lib/typescript/src/Engage/components/CompetitionCard.d.ts.map +1 -1
  65. package/lib/typescript/src/Group/api/index.d.ts +47 -0
  66. package/lib/typescript/src/Group/api/index.d.ts.map +1 -0
  67. package/lib/typescript/src/Group/components/GroupCTAButton.d.ts +13 -0
  68. package/lib/typescript/src/Group/components/GroupCTAButton.d.ts.map +1 -0
  69. package/lib/typescript/src/Group/components/GroupPlayerActionForm.d.ts +12 -0
  70. package/lib/typescript/src/Group/components/GroupPlayerActionForm.d.ts.map +1 -0
  71. package/lib/typescript/src/Group/components/ManageGroupForm.d.ts +12 -0
  72. package/lib/typescript/src/Group/components/ManageGroupForm.d.ts.map +1 -0
  73. package/lib/typescript/src/Group/index.d.ts +14 -0
  74. package/lib/typescript/src/Group/index.d.ts.map +1 -0
  75. package/lib/typescript/src/Wallet/index.d.ts.map +1 -1
  76. package/lib/typescript/src/index.d.ts +2 -1
  77. package/lib/typescript/src/index.d.ts.map +1 -1
  78. package/package.json +1 -1
  79. package/src/Engage/components/CompetitionCard.tsx +29 -2
  80. package/src/Group/api/index.ts +176 -0
  81. package/src/Group/components/GroupCTAButton.tsx +57 -0
  82. package/src/Group/components/GroupPlayerActionForm.tsx +137 -0
  83. package/src/Group/components/ManageGroupForm.tsx +239 -0
  84. package/src/Group/index.tsx +497 -0
  85. package/src/Wallet/index.tsx +6 -1
  86. package/src/index.tsx +2 -0
@@ -0,0 +1,47 @@
1
+ import type { CompetitionPayoutTypeProps, CompetitionPlayerProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionTypeProps, GroupMessageProps, GroupPlayerProps, GroupProps, NewOverallAnalytics, OrderAnalyticsProps, OrderProps, PostProps, PublicPlayerProps } from "../../types";
2
+ export { GroupApi, GroupHelpers };
3
+ declare const GroupApi: {
4
+ setEnvironment: () => void;
5
+ getGroupById: (group_id: string) => Promise<undefined | {
6
+ group: GroupProps;
7
+ group_messages: GroupMessageProps[];
8
+ group_players: GroupPlayerProps[];
9
+ my_group_player?: GroupPlayerProps;
10
+ }>;
11
+ acceptInvite: (group_player_id: string) => Promise<GroupPlayerProps | undefined>;
12
+ declineInvite: (group_player_id: string) => Promise<GroupPlayerProps | undefined>;
13
+ join: (group_id: string) => Promise<GroupPlayerProps | undefined>;
14
+ leave: (group_player_id: string) => Promise<GroupPlayerProps | undefined>;
15
+ updateGroup: (group: GroupProps) => Promise<GroupProps | undefined>;
16
+ getPlayersByIds: (player_ids: string[]) => Promise<PublicPlayerProps[]>;
17
+ getGroupAnalytics: (group_id: string, to: number, from: number) => Promise<OrderAnalyticsProps[]>;
18
+ getCompetitionOptions: () => Promise<{
19
+ competition_types: CompetitionTypeProps[];
20
+ competition_result_types: CompetitionResultTypeProps[];
21
+ competition_payout_types: CompetitionPayoutTypeProps[];
22
+ }>;
23
+ getActiveCompetitions: (group_id: string) => Promise<{
24
+ competitions: CompetitionProps[];
25
+ competition_players: CompetitionPlayerProps[];
26
+ competition_records: CompetitionRecordProps[];
27
+ competition_results: CompetitionResultProps[];
28
+ }>;
29
+ getHistoryCompetitions: (group_id: string, offset: number) => Promise<{
30
+ competitions: CompetitionProps[];
31
+ competition_players: CompetitionPlayerProps[];
32
+ competition_records: CompetitionRecordProps[];
33
+ competition_results: CompetitionResultProps[];
34
+ }>;
35
+ getPostsByGroupId: (group_id: string, offset: number) => Promise<PostProps[]>;
36
+ getBulkOrders: (order_ids: string[]) => Promise<OrderProps[]>;
37
+ };
38
+ declare const GroupHelpers: {
39
+ sortMembers: (group_players: GroupPlayerProps[], order_analytics: OrderAnalyticsProps[]) => {
40
+ sorted_players: GroupPlayerProps[];
41
+ player_analytics: {
42
+ [key: string]: NewOverallAnalytics;
43
+ };
44
+ };
45
+ aggregateAnalytics: (analytics: OrderAnalyticsProps[]) => NewOverallAnalytics;
46
+ };
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/Group/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAS/U,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;AAEjC,QAAA,MAAM,QAAQ;;6BASmB,MAAM,KAAE,OAAO,CAAC,SAAS,GAAC;QAAE,KAAK,EAAC,UAAU,CAAC;QAAC,cAAc,EAAC,iBAAiB,EAAE,CAAC;QAAC,aAAa,EAAC,gBAAgB,EAAE,CAAC;QAAC,eAAe,CAAC,EAAC,gBAAgB,CAAA;KAAE,CAAC;oCASlJ,MAAM,KAAE,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;qCAQ5C,MAAM,KAAE,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;qBAQ7D,MAAM,KAAE,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;6BAQrC,MAAM,KAAE,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;yBAQhD,UAAU,KAAE,OAAO,CAAC,UAAU,GAAC,SAAS,CAAC;kCAShC,MAAM,EAAE,KAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC;kCAStC,MAAM,MAAK,MAAM,QAAO,MAAM,KAAE,OAAO,CAAC,mBAAmB,EAAE,CAAC;iCASjE,OAAO,CAAC;QAAC,iBAAiB,EAAC,oBAAoB,EAAE,CAAC;QAAC,wBAAwB,EAAC,0BAA0B,EAAE,CAAC;QAAC,wBAAwB,EAAC,0BAA0B,EAAE,CAAA;KAAC,CAAC;sCAI1J,MAAM,KAAE,OAAO,CAAC;QAAE,YAAY,EAAC,gBAAgB,EAAE,CAAC;QAAC,mBAAmB,EAAC,sBAAsB,EAAE,CAAC;QAAC,mBAAmB,EAAC,sBAAsB,EAAE,CAAC;QAAC,mBAAmB,EAAC,sBAAsB,EAAE,CAAA;KAAE,CAAC;uCAS7L,MAAM,UAAS,MAAM,KAAE,OAAO,CAAC;QAAE,YAAY,EAAC,gBAAgB,EAAE,CAAC;QAAC,mBAAmB,EAAC,sBAAsB,EAAE,CAAC;QAAC,mBAAmB,EAAC,sBAAsB,EAAE,CAAC;QAAC,mBAAmB,EAAC,sBAAsB,EAAE,CAAA;KAAE,CAAC;kCASlN,MAAM,UAAS,MAAM,KAAE,OAAO,CAAC,SAAS,EAAE,CAAC;+BAS9C,MAAM,EAAE,KAAE,OAAO,CAAC,UAAU,EAAE,CAAC;CASjE,CAAA;AAGD,QAAA,MAAM,YAAY;iCACc,gBAAgB,EAAE,mBAAkB,mBAAmB,EAAE;;;;;;oCAcrD,mBAAmB,EAAE,KAAE,mBAAmB;CA2B7E,CAAA"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { GroupMessageProps, GroupPlayerProps, GroupProps, PublicPlayerProps } from "../../types";
3
+ type GroupCTAButtonProps = {
4
+ group: GroupProps;
5
+ message_length?: number;
6
+ group_messages: GroupMessageProps[];
7
+ players: PublicPlayerProps[];
8
+ group_players: GroupPlayerProps[];
9
+ onSelectChat: (group: GroupProps) => void;
10
+ };
11
+ declare const GroupCTAButton: ({ group, players, message_length, group_messages, onSelectChat }: GroupCTAButtonProps) => React.JSX.Element;
12
+ export default GroupCTAButton;
13
+ //# sourceMappingURL=GroupCTAButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupCTAButton.d.ts","sourceRoot":"","sources":["../../../../../src/Group/components/GroupCTAButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAMrG,KAAK,mBAAmB,GAAG;IACvB,KAAK,EAAC,UAAU,CAAC;IACjB,cAAc,CAAC,EAAC,MAAM,CAAC;IACvB,cAAc,EAAC,iBAAiB,EAAE,CAAC;IACnC,OAAO,EAAC,iBAAiB,EAAE,CAAC;IAC5B,aAAa,EAAC,gBAAgB,EAAE,CAAC;IACjC,YAAY,EAAC,CAAC,KAAK,EAAC,UAAU,KAAK,IAAI,CAAA;CAC1C,CAAA;AAED,QAAA,MAAM,cAAc,GAAI,kEAAiE,mBAAmB,sBAqC3G,CAAA;AACD,eAAe,cAAc,CAAA"}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { GroupPlayerProps, GroupProps, MyPlayerProps } from '../../types';
3
+ type GroupPlayerActionFormProps = {
4
+ me: MyPlayerProps;
5
+ group: GroupProps;
6
+ group_player?: GroupPlayerProps;
7
+ onResponse: (gp: GroupPlayerProps) => void;
8
+ onClose: () => void;
9
+ };
10
+ declare const GroupPlayerActionForm: ({ group, group_player, onResponse, onClose }: GroupPlayerActionFormProps) => React.JSX.Element;
11
+ export default GroupPlayerActionForm;
12
+ //# sourceMappingURL=GroupPlayerActionForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupPlayerActionForm.d.ts","sourceRoot":"","sources":["../../../../../src/Group/components/GroupPlayerActionForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG/E,KAAK,0BAA0B,GAAG;IAC9B,EAAE,EAAC,aAAa,CAAC;IACjB,KAAK,EAAC,UAAU,CAAC;IACjB,YAAY,CAAC,EAAC,gBAAgB,CAAC;IAC/B,UAAU,EAAC,CAAC,EAAE,EAAC,gBAAgB,KAAK,IAAI,CAAC;IACzC,OAAO,EAAC,MAAM,IAAI,CAAA;CACrB,CAAA;AACD,QAAA,MAAM,qBAAqB,GAAI,8CAA6C,0BAA0B,sBA0HrG,CAAA;AAED,eAAe,qBAAqB,CAAA"}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { FocusPositionProps, GroupProps } from '../../types';
3
+ type ManageGroupFormProps = {
4
+ group: GroupProps;
5
+ onUpdateGroup: (group: GroupProps) => void;
6
+ onInvitePlayer: () => void;
7
+ onClose: () => void;
8
+ onFocusPosition?: (position: FocusPositionProps) => void;
9
+ };
10
+ declare const ManageGroupForm: ({ group, onFocusPosition, onUpdateGroup, onClose, onInvitePlayer }: ManageGroupFormProps) => React.JSX.Element;
11
+ export default ManageGroupForm;
12
+ //# sourceMappingURL=ManageGroupForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManageGroupForm.d.ts","sourceRoot":"","sources":["../../../../../src/Group/components/ManageGroupForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKlE,KAAK,oBAAoB,GAAG;IACxB,KAAK,EAAC,UAAU,CAAC;IACjB,aAAa,EAAC,CAAC,KAAK,EAAC,UAAU,KAAK,IAAI,CAAC;IACzC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,OAAO,EAAC,MAAM,IAAI,CAAC;IACnB,eAAe,CAAC,EAAC,CAAC,QAAQ,EAAC,kBAAkB,KAAK,IAAI,CAAC;CAC1D,CAAA;AACD,QAAA,MAAM,eAAe,GAAI,oEAAoE,oBAAoB,sBA6NhH,CAAA;AAED,eAAe,eAAe,CAAA"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { CompetitionProps, GroupProps, MyPlayerProps, PublicPlayerProps } from '../types';
3
+ type GroupComponentProps = {
4
+ group_id: string;
5
+ mode: 'desktop' | 'mobile';
6
+ onSelectChat?: (group: GroupProps) => void;
7
+ onInvitePlayer: () => void;
8
+ onSelectPlayer: (p: PublicPlayerProps) => void;
9
+ onSelectCompetition: (c: CompetitionProps) => void;
10
+ player?: MyPlayerProps;
11
+ };
12
+ declare const GroupComponent: ({ group_id, player, mode, onInvitePlayer, onSelectCompetition, onSelectChat, onSelectPlayer }: GroupComponentProps) => React.JSX.Element;
13
+ export default GroupComponent;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Group/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EAAsD,gBAAgB,EAAyI,UAAU,EAAE,aAAa,EAA8C,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAYtU,KAAK,mBAAmB,GAAG;IACvB,QAAQ,EAAC,MAAM,CAAC;IAChB,IAAI,EAAC,SAAS,GAAC,QAAQ,CAAC;IACxB,YAAY,CAAC,EAAC,CAAC,KAAK,EAAC,UAAU,KAAK,IAAI,CAAA;IACxC,cAAc,EAAC,MAAM,IAAI,CAAC;IAC1B,cAAc,EAAC,CAAC,CAAC,EAAC,iBAAiB,KAAK,IAAI,CAAC;IAC7C,mBAAmB,EAAC,CAAC,CAAC,EAAC,gBAAgB,KAAK,IAAI,CAAC;IACjD,MAAM,CAAC,EAAC,aAAa,CAAA;CACxB,CAAA;AAmBD,QAAA,MAAM,cAAc,GAAI,+FAAgG,mBAAmB,sBAoc1I,CAAA;AAED,eAAe,cAAc,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Wallet/index.tsx"],"names":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QAAQ,CAAC;IAC9B,MAAM,CAAC,EAAC;QAAE,GAAG,EAAC,MAAM,CAAC;QAAC,MAAM,EAAC,MAAM,CAAC;QAAC,IAAI,EAAC,MAAM,CAAC;QAAC,KAAK,EAAC,MAAM,CAAA;KAAE,CAAC;IACjE,eAAe,CAAC,EAAC,CAAC,GAAG,EAAC,kBAAkB,KAAK,IAAI,CAAC;IAClD,OAAO,EAAC,MAAM,IAAI,CAAC;IACnB,OAAO,EAAC,CAAC,KAAK,EAAC,YAAY,KAAK,IAAI,CAAA;IACpC,UAAU,EAAE,CAAC,UAAU,EAAC,cAAc,EAAE,UAAU,CAAC,EAAC,MAAM,KAAK,IAAI,CAAA;CACtE,CAAA;AAED,QAAA,MAAM,QAAQ,GAAI,uGAAsG,aAAa,sBA2iBpI,CAAA;AAED,eAAe,QAAQ,CAAA"}
@@ -55,5 +55,6 @@ import ManageFilter from './BetMatch/components/ManageFilter';
55
55
  import ClaritySmartEvents from './Clarity/SmartEvents';
56
56
  import RankingsCard from './RankingsCard';
57
57
  import GuideView from './Guide';
58
- export { Authenticator, Observer, BEEventApi, RankingsCard, BELinkApi, GuideView, BetMatch, ManageFilter, Ticker, Premium, LeaderboardCard, LocationTracker, BEClarity, FlashMarket, ContactsCard, PlayerRecommender, GolfScoreboard, ContactsSelector, Campaign, BEPostHog, ManageBracketCompetitionForm, NotificationModule, FlashHolder, useNotifications, ClaritySmartEvents, ProfileManager, CompetitionManager, Components, SocialComponents, APIOverrides, LinearGradient, usePlayerLocation, BettorSearch, Colors, MyWallet, Share, Checkout, MarketComponents, EventComponents, PollCampaign, PollCampaignApi, PollApi, MarketMaker, CompetitionModule, SeasonManager, CreateCompetitionForm, CreateSeasonForm, SeasonModule, AdminCompetitionList, AdServer, Leaderboard, AdProvider, BracketRoom, SquaresModule, SocketManager, PromotedOrder, EngageModule, CompetitionCard, SquaresCompetitionCard, BracketCompetitionCard, SeasonCard };
58
+ import GroupComponent from './Group';
59
+ export { Authenticator, Observer, BEEventApi, RankingsCard, BELinkApi, GuideView, BetMatch, ManageFilter, Ticker, Premium, LeaderboardCard, GroupComponent, LocationTracker, BEClarity, FlashMarket, ContactsCard, PlayerRecommender, GolfScoreboard, ContactsSelector, Campaign, BEPostHog, ManageBracketCompetitionForm, NotificationModule, FlashHolder, useNotifications, ClaritySmartEvents, ProfileManager, CompetitionManager, Components, SocialComponents, APIOverrides, LinearGradient, usePlayerLocation, BettorSearch, Colors, MyWallet, Share, Checkout, MarketComponents, EventComponents, PollCampaign, PollCampaignApi, PollApi, MarketMaker, CompetitionModule, SeasonManager, CreateCompetitionForm, CreateSeasonForm, SeasonModule, AdminCompetitionList, AdServer, Leaderboard, AdProvider, BracketRoom, SquaresModule, SocketManager, PromotedOrder, EngageModule, CompetitionCard, SquaresCompetitionCard, BracketCompetitionCard, SeasonCard };
59
60
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AACpD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,QAAQ,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EA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;AAChC,OAAO,cAAc,MAAM,SAAS,CAAC;AAErC,OAAO,EACL,aAAa,EACb,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,OAAO,EACP,eAAe,EACf,cAAc,EACd,eAAe,EACf,SAAS,EACT,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,4BAA4B,EAC5B,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,UAAU,EACX,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "be-components",
3
- "version": "6.6.0",
3
+ "version": "6.6.2",
4
4
  "description": "Components for BettorEdge Apps",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,21 +1,25 @@
1
1
  import React from 'react';
2
2
  import { Image } from 'react-native';
3
- import type { CompanyProps, CompetitionProps, CompetitionResultTypeProps, CompetitionTypeProps, PublicPlayerProps } from '../../types';
3
+ import type { CompanyProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionTypeProps, MyPlayerProps, PublicPlayerProps } from '../../types';
4
4
  import { Icons } from '../../Components';
5
5
  import moment from 'moment-mini';
6
6
  import { useColors } from '../../constants/useColors';
7
7
  import { Button, Text, View } from '../../Components/Themed';
8
+ import { CompetitionHelpers } from '../../Competition/api';
8
9
 
9
10
  type CompetitionCardProps = {
10
11
  competition:CompetitionProps,
12
+ player?:MyPlayerProps,
11
13
  competition_type:CompetitionTypeProps,
14
+ competition_result?:CompetitionResultProps,
15
+ competition_record?:CompetitionRecordProps,
12
16
  competition_result_type:CompetitionResultTypeProps,
13
17
  company?:CompanyProps,
14
18
  admin?:PublicPlayerProps,
15
19
  pacer?:PublicPlayerProps,
16
20
  onCompetitionSelect:(c:CompetitionProps) => void
17
21
  }
18
- const CompetitionCard = ({ competition, competition_type, company, admin, onCompetitionSelect }:CompetitionCardProps) => {
22
+ const CompetitionCard = ({ competition, competition_record, player, competition_result, competition_type, company, admin, onCompetitionSelect }:CompetitionCardProps) => {
19
23
  const Colors = useColors();
20
24
  const cl = competition.market_type == 'FOR_MONEY' ? '$' : 'E'
21
25
  let current_payout = competition.ticket_revenue
@@ -79,6 +83,29 @@ const CompetitionCard = ({ competition, competition_type, company, admin, onComp
79
83
  </View>
80
84
  </View>
81
85
  </View>
86
+ {player && competition_result && competition_record ?
87
+ <View type='footer' style={{ padding:10, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}>
88
+ <Image
89
+ source={{ uri: player.profile_pic }}
90
+ style={{ height:30, width:30, borderRadius:100 }}
91
+ resizeMode='contain'
92
+ />
93
+ <View transparent style={{ flex:1, marginLeft:10 }}>
94
+ <Text theme='h1'>@{player.username}</Text>
95
+ <View transparent style={{ marginTop:3 }}>
96
+ {competition_type.type == 'pick' ?
97
+ <Text theme="description">{competition_record.wins} - {competition_record.losses} - {competition_record.draws} ({competition_record.remaining_picks} Remaining)</Text>
98
+ :competition_type.type == 'wager' ?
99
+ <Text theme="description">{competition_record.earnings.toFixed(2)} Earned ({competition_record.remaining_stakes.toFixed(2)} at risk)</Text>
100
+ :<></>}
101
+ </View>
102
+ </View>
103
+ <View transparent style={{ alignItems:'flex-end' }}>
104
+ <Text theme='h2' color={competition_result.winnings > 0 ? Colors.text.success : Colors.text.warning}>{cl}{competition_result.winnings.toFixed(2)}</Text>
105
+ <Text theme='description' style={{ marginTop:3 }}>{CompetitionHelpers.formatPlace(competition_result.place)} / {competition.tickets_sold}</Text>
106
+ </View>
107
+ </View>
108
+ :<></>}
82
109
  <View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
83
110
  {company ?
84
111
  <Image
@@ -0,0 +1,176 @@
1
+ import axios from "axios";
2
+ import { APIOverrides } from "../../ApiOverrides"
3
+ import type { CompetitionPayoutTypeProps, CompetitionPlayerProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionTypeProps, GroupMessageProps, GroupPlayerProps, GroupProps, NewOverallAnalytics, OrderAnalyticsProps, OrderProps, PostProps, PublicPlayerProps } from "../../types";
4
+
5
+
6
+ //let EVENT_SVC_API = ''
7
+ let AUTH_SVC_API = ''
8
+ let MK_SVC_API = ''
9
+ let SOCIAL_SVC_API = ''
10
+ let TP_SVC_API = ''
11
+
12
+ export { GroupApi, GroupHelpers }
13
+
14
+ const GroupApi = {
15
+ setEnvironment: () => {
16
+ const endpoints = APIOverrides.getEndpoints();
17
+ //EVENT_SVC_API = endpoints['EVENT_SVC_API'] as string;
18
+ MK_SVC_API = endpoints['MK_SVC_API'] as string;
19
+ TP_SVC_API = endpoints['TP_SVC_API'] as string;
20
+ AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
21
+ SOCIAL_SVC_API = endpoints['SOCIAL_SVC_API'] as string;
22
+ },
23
+ getGroupById: async(group_id:string):Promise<undefined|{ group:GroupProps, group_messages:GroupMessageProps[], group_players:GroupPlayerProps[], my_group_player?:GroupPlayerProps }> => {
24
+ try {
25
+ const resp = await axios.get(`${SOCIAL_SVC_API}/v2/groups/group/${group_id}`);
26
+ return resp.data
27
+ } catch (e) {
28
+ console.log(e);
29
+ return undefined
30
+ }
31
+ },
32
+ acceptInvite:async(group_player_id:string):Promise<GroupPlayerProps | undefined> => {
33
+ try {
34
+ const resp = await axios.post(`${SOCIAL_SVC_API}/v2/groups/player/accept`, { group_player_id });
35
+ return resp.data.group_player
36
+ } catch (e) {
37
+ return undefined
38
+ }
39
+ },
40
+ declineInvite:async(group_player_id:string):Promise<GroupPlayerProps | undefined> => {
41
+ try {
42
+ const resp = await axios.post(`${SOCIAL_SVC_API}/v2/groups/player/decline`, { group_player_id });
43
+ return resp.data.group_player
44
+ } catch (e) {
45
+ return undefined
46
+ }
47
+ },
48
+ join:async(group_id:string):Promise<GroupPlayerProps | undefined> => {
49
+ try {
50
+ const resp = await axios.post(`${SOCIAL_SVC_API}/v2/groups/player/join`, { group_id });
51
+ return resp.data.group_player
52
+ } catch (e) {
53
+ return undefined
54
+ }
55
+ },
56
+ leave:async(group_player_id:string):Promise<GroupPlayerProps | undefined> => {
57
+ try {
58
+ const resp = await axios.post(`${SOCIAL_SVC_API}/v2/groups/player/leave`, { group_player_id });
59
+ return resp.data.group_player
60
+ } catch (e) {
61
+ return undefined
62
+ }
63
+ },
64
+ updateGroup: async(group:GroupProps):Promise<GroupProps|undefined> => {
65
+ try {
66
+ const resp = await axios.post(`${SOCIAL_SVC_API}/v2/groups/group/update`, {group});
67
+ return resp.data.group
68
+ } catch (e) {
69
+ console.log(e);
70
+ return undefined
71
+ }
72
+ },
73
+ getPlayersByIds: async(player_ids:string[]):Promise<PublicPlayerProps[]> => {
74
+ try {
75
+ if(player_ids.length == 0){ return [] }
76
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/players/bulk/get`, { player_ids });
77
+ return resp.data.players
78
+ } catch (e) {
79
+ return []
80
+ }
81
+ },
82
+ getGroupAnalytics: async(group_id:string, to:number, from:number):Promise<OrderAnalyticsProps[]> => {
83
+ try {
84
+ const resp = await axios.get(`${MK_SVC_API}/v1/analytics/group/details/${group_id}?to=${to}&from=${from}`);
85
+ console.log(resp.data)
86
+ return resp.data.analytics
87
+ } catch (e) {
88
+ return []
89
+ }
90
+ },
91
+ getCompetitionOptions: async():Promise<{competition_types:CompetitionTypeProps[], competition_result_types:CompetitionResultTypeProps[], competition_payout_types:CompetitionPayoutTypeProps[]}> => {
92
+ const resp = await axios.get(`${TP_SVC_API}/v1/competitions/options`)
93
+ return resp.data
94
+ },
95
+ getActiveCompetitions: async(group_id:string):Promise<{ competitions:CompetitionProps[], competition_players:CompetitionPlayerProps[], competition_records:CompetitionRecordProps[], competition_results:CompetitionResultProps[] }> => {
96
+ try {
97
+ const resp = await axios.get(`${TP_SVC_API}/v2/competitions/group/active/${group_id}`);
98
+ return resp.data
99
+ } catch (e) {
100
+ console.log(e);
101
+ return { competition_players:[], competition_records:[], competition_results:[], competitions:[] }
102
+ }
103
+ },
104
+ getHistoryCompetitions: async(group_id:string, offset:number):Promise<{ competitions:CompetitionProps[], competition_players:CompetitionPlayerProps[], competition_records:CompetitionRecordProps[], competition_results:CompetitionResultProps[] }> => {
105
+ try {
106
+ const resp = await axios.get(`${TP_SVC_API}/v2/competitions/group/history/${group_id}?offset=${offset}`);
107
+ return resp.data
108
+ } catch (e) {
109
+ console.log(e);
110
+ return { competition_players:[], competition_records:[], competition_results:[], competitions:[] }
111
+ }
112
+ },
113
+ getPostsByGroupId: async(group_id:string, offset:number):Promise<PostProps[]> => {
114
+ try {
115
+ const resp = await axios.get(`${SOCIAL_SVC_API}/v1/posts/group/${group_id}?offset=${offset}`);
116
+ return resp.data.posts
117
+ } catch (e) {
118
+ console.log(e)
119
+ return []
120
+ }
121
+ },
122
+ getBulkOrders: async(order_ids:string[]):Promise<OrderProps[]> => {
123
+ try {
124
+ const resp = await axios.post(`${MK_SVC_API}/v1/orders/bulk/get`, { order_ids })
125
+ return resp.data.orders
126
+ } catch (e) {
127
+ console.log(e);
128
+ return []
129
+ }
130
+ },
131
+ }
132
+
133
+
134
+ const GroupHelpers = {
135
+ sortMembers: (group_players:GroupPlayerProps[], order_analytics:OrderAnalyticsProps[]) => {
136
+ let player_analytics: { [key:string]: NewOverallAnalytics } = {}
137
+ group_players.map(p => {
138
+ let my_analytics = order_analytics.filter(oa => oa.player_id == p.player_id);
139
+ player_analytics[p.player_id] = GroupHelpers.aggregateAnalytics(my_analytics);
140
+ });
141
+
142
+ let sorted_players = group_players.filter(gp => gp.status == 'active').sort((a,b) => {
143
+ let a_analytics = player_analytics[a.player_id]?.roi_pct ?? 0
144
+ let b_analytcs = player_analytics[b.player_id]?.roi_pct ?? 0
145
+ return b_analytcs - a_analytics
146
+ });
147
+ return { sorted_players, player_analytics }
148
+ },
149
+ aggregateAnalytics: (analytics:OrderAnalyticsProps[]):NewOverallAnalytics => {
150
+ const wins = analytics.reduce((a,b) => a + b.wins, 0);
151
+ const losses = analytics.reduce((a,b) => a + b.losses, 0);
152
+ const draws = analytics.reduce((a,b) => a + b.draws, 0);
153
+ const fulfilled_positions = analytics.reduce((a,b) => a + parseFloat(b.fulfilled_positions as any), 0);
154
+ const winnings = analytics.reduce((a,b) => a + b.winnings, 0);
155
+ const original_stake = analytics.reduce((a,b) => a + b.original_stake, 0);
156
+ const cash_rcvd = analytics.reduce((a,b) => a + b.cash_rcvd, 0);
157
+
158
+ const win_pct = (wins + (draws / 2)) / fulfilled_positions
159
+ const earnings = (winnings + cash_rcvd) - original_stake
160
+ const roi_pct = original_stake > 0 ? earnings / original_stake : 0
161
+ return {
162
+ winnings,
163
+ original_stake,
164
+ wins,
165
+ losses,
166
+ draws,
167
+ net_winnings: 0,
168
+ player_id: '',
169
+ fulfilled_positions,
170
+ cash_rcvd,
171
+ earnings,
172
+ win_pct,
173
+ roi_pct
174
+ }
175
+ }
176
+ }
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import moment from "moment-mini"
3
+ import { useEffect } from "react"
4
+ import type { GroupMessageProps, GroupPlayerProps, GroupProps, PublicPlayerProps } from "../../types"
5
+ import { useColors } from "../../constants/useColors"
6
+ import { Button, Text, View } from "../../Components/Themed"
7
+ import { Icons } from '../../Components';
8
+ import { Image } from 'react-native';
9
+
10
+ type GroupCTAButtonProps = {
11
+ group:GroupProps,
12
+ message_length?:number,
13
+ group_messages:GroupMessageProps[],
14
+ players:PublicPlayerProps[],
15
+ group_players:GroupPlayerProps[],
16
+ onSelectChat:(group:GroupProps) => void
17
+ }
18
+
19
+ const GroupCTAButton = ({ group, players, message_length, group_messages, onSelectChat }:GroupCTAButtonProps) => {
20
+ const Colors = useColors();
21
+
22
+ useEffect(( ) => {
23
+ if(!group){ return }
24
+ //setUpCta();
25
+ },[group.group_id]);
26
+
27
+
28
+ let last_message = group_messages.sort((a,b) => moment(b.create_datetime).unix() - moment(a.create_datetime).unix())[0]
29
+ let cta_message = group.name
30
+ if(last_message?.message){ cta_message = `${last_message.message.slice(0, message_length ?? 15)}...` }
31
+ const last_player = players.find(p => p.player_id == last_message?.player_id)
32
+ return (
33
+ <View transparent>
34
+ <Button transparent style={{ flexDirection:'row', alignItems:'center', padding:2 }} onPress={() => onSelectChat(group)}>
35
+ {last_player ?
36
+ <Image
37
+ source={{ uri: last_player.profile_pic }}
38
+ style={{ height:30, width:30, borderRadius:100 }}
39
+ resizeMode='contain'
40
+ />
41
+ :<></>}
42
+ <View transparent style={{ flex:1, marginLeft:10, marginRight:10 }}>
43
+ <Text theme='h2'>{cta_message}</Text>
44
+ {last_player ?
45
+ <Text theme='description' style={{ marginTop:3 }}>@{last_player.username}</Text>
46
+ :<></>}
47
+ </View>
48
+ <View float style={{ padding:10, flexDirection:'row', alignItems:'center' }}>
49
+ <Icons.ChatIcon size={16} color={Colors.text.h1}/>
50
+ <Text theme='h2' size={12}> Chat</Text>
51
+ </View>
52
+ </Button>
53
+ </View>
54
+
55
+ )
56
+ }
57
+ export default GroupCTAButton
@@ -0,0 +1,137 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, Text, View } from "../../Components/Themed"
3
+ import type { GroupPlayerProps, GroupProps, MyPlayerProps } from '../../types';
4
+ import { GroupApi } from '../api';
5
+
6
+ type GroupPlayerActionFormProps = {
7
+ me:MyPlayerProps,
8
+ group:GroupProps,
9
+ group_player?:GroupPlayerProps,
10
+ onResponse:(gp:GroupPlayerProps) => void,
11
+ onClose:() => void
12
+ }
13
+ const GroupPlayerActionForm = ({ group, group_player, onResponse, onClose }:GroupPlayerActionFormProps) => {
14
+ const [ action_loading, setActionLoading ] = useState(false);
15
+
16
+ const handleAccept = async() => {
17
+ if(!group_player){ return }
18
+ setActionLoading(true)
19
+ const new_gp = await GroupApi.acceptInvite(group_player.group_player_id);
20
+ if(!new_gp){ alert('Unable to process') }
21
+ else {
22
+ onResponse(new_gp);
23
+ }
24
+ setActionLoading(false)
25
+ }
26
+
27
+ const handleDecline = async() => {
28
+ if(!group_player){ return }
29
+ setActionLoading(true)
30
+ const new_gp = await GroupApi.declineInvite(group_player.group_player_id);
31
+ if(!new_gp){ alert('Unable to process') }
32
+ else {
33
+ onResponse(new_gp);
34
+ }
35
+ setActionLoading(false)
36
+ }
37
+
38
+ const handleJoin= async() => {
39
+ setActionLoading(true)
40
+ const new_gp = await GroupApi.join(group.group_id);
41
+ if(!new_gp){ alert('Unable to process') }
42
+ else {
43
+ onResponse(new_gp);
44
+ }
45
+ setActionLoading(false)
46
+ }
47
+
48
+ const handleLeave = async() => {
49
+ if(!group_player){ return }
50
+ setActionLoading(true)
51
+ const new_gp = await GroupApi.leave(group_player.group_player_id);
52
+ if(!new_gp){ alert('Unable to process') }
53
+ else {
54
+ onResponse(new_gp);
55
+ }
56
+ setActionLoading(false)
57
+ }
58
+ return (
59
+ <View float>
60
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
61
+ <View transparent style={{ flex:1 }}>
62
+ <Text theme='h1'>{group.name}</Text>
63
+ <Text theme='description' style={{ marginTop:3 }}>{group.description}</Text>
64
+ </View>
65
+ <Button
66
+ title='X'
67
+ float
68
+ style={{ padding:10 }}
69
+ onPress={() => onClose()}
70
+ />
71
+ </View>
72
+ <View type='body' style={{ padding:10 }}>
73
+ {group_player ?
74
+ <View>
75
+ {group_player.status == 'invited' ?
76
+ <Text theme='h1'>YOU HAVE BEEN INVITED</Text>
77
+ :<></>}
78
+ {group_player.status == 'active' ?
79
+ <Text theme='h1'>YOU ARE A MEMBER OF THIS GROUP</Text>
80
+ :<></>}
81
+ {group_player.status == 'inactive' ?
82
+ <Text theme='h1'>JOIN THIS GROUP NOW</Text>
83
+ :<></>}
84
+ </View>
85
+ :
86
+ <View>
87
+ <Text theme='h1'>JOIN THIS GROUP NOW</Text>
88
+ </View>
89
+ }
90
+ </View>
91
+ <View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:5, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
92
+ {group_player?.status == 'invited' ?
93
+ <Button
94
+ title='DECLINE'
95
+ type='error'
96
+ loading={action_loading}
97
+ style={{ flex:1, opacity: action_loading ? 0.5:1, margin:5 }}
98
+ disabled={action_loading}
99
+ onPress={() => handleDecline()}
100
+ />
101
+ :<></>}
102
+ {group_player?.status == 'invited' ?
103
+ <Button
104
+ title='ACCEPT'
105
+ type='success'
106
+ loading={action_loading}
107
+ style={{ flex:1, opacity: action_loading ? 0.5:1, margin:5 }}
108
+ disabled={action_loading}
109
+ onPress={() => handleAccept()}
110
+ />
111
+ :<></>}
112
+ {group_player?.status == 'active' ?
113
+ <Button
114
+ title='LEAVE GROUP'
115
+ type='error'
116
+ loading={action_loading}
117
+ style={{ flex:1, opacity: action_loading ? 0.5:1, margin:5 }}
118
+ disabled={action_loading}
119
+ onPress={() => handleLeave()}
120
+ />
121
+ :<></>}
122
+ {!group_player || group_player.status == 'inactive' ?
123
+ <Button
124
+ title='JOIN GROUP'
125
+ type='success'
126
+ loading={action_loading}
127
+ style={{ flex:1, opacity: action_loading ? 0.5:1, margin:5 }}
128
+ disabled={action_loading}
129
+ onPress={() => handleJoin()}
130
+ />
131
+ :<></>}
132
+ </View>
133
+ </View>
134
+ )
135
+ }
136
+
137
+ export default GroupPlayerActionForm