be-components 5.1.8 → 5.1.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.
- package/lib/commonjs/Components/Icons.js +28 -1
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/Components/Themed.js +13 -1
- package/lib/commonjs/Components/Themed.js.map +1 -1
- package/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.js +47 -24
- package/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.js.map +1 -1
- package/lib/commonjs/SocialComponents/FormattedTextInput/index.js +41 -8
- package/lib/commonjs/SocialComponents/FormattedTextInput/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/GifSelector/NativeSelector.js +14 -0
- package/lib/commonjs/SocialComponents/GifSelector/NativeSelector.js.map +1 -0
- package/lib/commonjs/SocialComponents/GifSelector/WebSelector.js +123 -0
- package/lib/commonjs/SocialComponents/GifSelector/WebSelector.js.map +1 -0
- package/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.js +89 -0
- package/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.js.map +1 -0
- package/lib/commonjs/SocialComponents/GroupChat/index.js +426 -0
- package/lib/commonjs/SocialComponents/GroupChat/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/ImageRenderer.js +55 -0
- package/lib/commonjs/SocialComponents/ImageRenderer.js.map +1 -0
- package/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.js +219 -0
- package/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.js.map +1 -0
- package/lib/commonjs/SocialComponents/InputBar/index.js +59 -5
- package/lib/commonjs/SocialComponents/InputBar/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.js +2 -0
- package/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js +37 -25
- package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js.map +1 -1
- package/lib/commonjs/SocialComponents/PostCard/index.js +148 -70
- package/lib/commonjs/SocialComponents/PostCard/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/Poster/index.js +325 -0
- package/lib/commonjs/SocialComponents/Poster/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/SocialOrderCard.js +8 -3
- package/lib/commonjs/SocialComponents/SocialOrderCard.js.map +1 -1
- package/lib/commonjs/SocialComponents/SocialOrdersList.js +20 -2
- package/lib/commonjs/SocialComponents/SocialOrdersList.js.map +1 -1
- package/lib/commonjs/SocialComponents/UrlPreviewCard.js +115 -0
- package/lib/commonjs/SocialComponents/UrlPreviewCard.js.map +1 -0
- package/lib/commonjs/SocialComponents/api/index.js +383 -0
- package/lib/commonjs/SocialComponents/api/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/index.js +14 -0
- package/lib/commonjs/SocialComponents/index.js.map +1 -1
- package/lib/module/Components/Icons.js +28 -1
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/Components/Themed.js +13 -1
- package/lib/module/Components/Themed.js.map +1 -1
- package/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.js +48 -25
- package/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.js.map +1 -1
- package/lib/module/SocialComponents/FormattedTextInput/index.js +41 -8
- package/lib/module/SocialComponents/FormattedTextInput/index.js.map +1 -1
- package/lib/module/SocialComponents/GifSelector/NativeSelector.js +7 -0
- package/lib/module/SocialComponents/GifSelector/NativeSelector.js.map +1 -0
- package/lib/module/SocialComponents/GifSelector/WebSelector.js +125 -0
- package/lib/module/SocialComponents/GifSelector/WebSelector.js.map +1 -0
- package/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.js +82 -0
- package/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.js.map +1 -0
- package/lib/module/SocialComponents/GroupChat/index.js +418 -0
- package/lib/module/SocialComponents/GroupChat/index.js.map +1 -0
- package/lib/module/SocialComponents/ImageRenderer.js +48 -0
- package/lib/module/SocialComponents/ImageRenderer.js.map +1 -0
- package/lib/module/SocialComponents/InputBar/components/ActionSelector.js +210 -0
- package/lib/module/SocialComponents/InputBar/components/ActionSelector.js.map +1 -0
- package/lib/module/SocialComponents/InputBar/index.js +58 -6
- package/lib/module/SocialComponents/InputBar/index.js.map +1 -1
- package/lib/module/SocialComponents/PostCard/components/ArticleCard.js +2 -0
- package/lib/module/SocialComponents/PostCard/components/ArticleCard.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/components/ImageList.js +37 -25
- package/lib/module/SocialComponents/PostCard/components/ImageList.js.map +1 -1
- package/lib/module/SocialComponents/PostCard/index.js +148 -70
- package/lib/module/SocialComponents/PostCard/index.js.map +1 -1
- package/lib/module/SocialComponents/Poster/index.js +316 -0
- package/lib/module/SocialComponents/Poster/index.js.map +1 -0
- package/lib/module/SocialComponents/SocialOrderCard.js +8 -3
- package/lib/module/SocialComponents/SocialOrderCard.js.map +1 -1
- package/lib/module/SocialComponents/SocialOrdersList.js +21 -3
- package/lib/module/SocialComponents/SocialOrdersList.js.map +1 -1
- package/lib/module/SocialComponents/UrlPreviewCard.js +106 -0
- package/lib/module/SocialComponents/UrlPreviewCard.js.map +1 -0
- package/lib/module/SocialComponents/api/index.js +383 -0
- package/lib/module/SocialComponents/api/index.js.map +1 -1
- package/lib/module/SocialComponents/index.js +3 -1
- package/lib/module/SocialComponents/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts +5 -0
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Themed.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.d.ts +2 -1
- package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/index.d.ts +6 -1
- package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/NativeSelector.d.ts +4 -0
- package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/NativeSelector.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/WebSelector.d.ts +4 -0
- package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/WebSelector.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.d.ts +11 -0
- package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/index.d.ts +14 -0
- package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/ImageRenderer.d.ts +11 -0
- package/lib/typescript/lib/commonjs/SocialComponents/ImageRenderer.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.d.ts +9 -0
- package/lib/typescript/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/InputBar/index.d.ts +3 -1
- package/lib/typescript/lib/commonjs/SocialComponents/InputBar/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.d.ts +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ImageList.d.ts +1 -2
- package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/PostCard/index.d.ts +4 -1
- package/lib/typescript/lib/commonjs/SocialComponents/PostCard/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/Poster/index.d.ts +9 -0
- package/lib/typescript/lib/commonjs/SocialComponents/Poster/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/SocialOrderCard.d.ts +2 -1
- package/lib/typescript/lib/commonjs/SocialComponents/SocialOrderCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/SocialOrdersList.d.ts +2 -1
- package/lib/typescript/lib/commonjs/SocialComponents/SocialOrdersList.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/UrlPreviewCard.d.ts +9 -0
- package/lib/typescript/lib/commonjs/SocialComponents/UrlPreviewCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/api/index.d.ts +89 -0
- package/lib/typescript/lib/commonjs/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/index.d.ts +2 -0
- package/lib/typescript/lib/module/Components/Icons.d.ts +5 -0
- package/lib/typescript/lib/module/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Themed.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.d.ts +3 -2
- package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/index.d.ts +6 -1
- package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/GifSelector/NativeSelector.d.ts +4 -0
- package/lib/typescript/lib/module/SocialComponents/GifSelector/NativeSelector.d.ts.map +1 -0
- package/lib/typescript/lib/module/SocialComponents/GifSelector/WebSelector.d.ts +13 -0
- package/lib/typescript/lib/module/SocialComponents/GifSelector/WebSelector.d.ts.map +1 -0
- package/lib/typescript/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.d.ts +11 -0
- package/lib/typescript/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/SocialComponents/GroupChat/index.d.ts +14 -0
- package/lib/typescript/lib/module/SocialComponents/GroupChat/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/SocialComponents/ImageRenderer.d.ts +11 -0
- package/lib/typescript/lib/module/SocialComponents/ImageRenderer.d.ts.map +1 -0
- package/lib/typescript/lib/module/SocialComponents/InputBar/components/ActionSelector.d.ts +10 -0
- package/lib/typescript/lib/module/SocialComponents/InputBar/components/ActionSelector.d.ts.map +1 -0
- package/lib/typescript/lib/module/SocialComponents/InputBar/index.d.ts +3 -1
- package/lib/typescript/lib/module/SocialComponents/InputBar/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/PostCard/components/ArticleCard.d.ts +1 -0
- package/lib/typescript/lib/module/SocialComponents/PostCard/components/ArticleCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/SocialComponents/PostCard/components/ImageList.d.ts +1 -2
- package/lib/typescript/lib/module/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/PostCard/index.d.ts +4 -1
- package/lib/typescript/lib/module/SocialComponents/PostCard/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/Poster/index.d.ts +11 -0
- package/lib/typescript/lib/module/SocialComponents/Poster/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/SocialComponents/SocialOrderCard.d.ts +3 -2
- package/lib/typescript/lib/module/SocialComponents/SocialOrderCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/SocialOrdersList.d.ts +2 -1
- package/lib/typescript/lib/module/SocialComponents/SocialOrdersList.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/UrlPreviewCard.d.ts +9 -0
- package/lib/typescript/lib/module/SocialComponents/UrlPreviewCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/SocialComponents/api/index.d.ts +89 -0
- package/lib/typescript/lib/module/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/index.d.ts +3 -1
- package/lib/typescript/lib/module/SocialComponents/index.d.ts.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +1 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/Components/Themed.d.ts +1 -0
- package/lib/typescript/src/Components/Themed.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/FormattedTextInput/components/TagSelector.d.ts +2 -1
- package/lib/typescript/src/SocialComponents/FormattedTextInput/components/TagSelector.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/FormattedTextInput/index.d.ts +6 -1
- package/lib/typescript/src/SocialComponents/FormattedTextInput/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/GifSelector/NativeSelector.d.ts +4 -0
- package/lib/typescript/src/SocialComponents/GifSelector/NativeSelector.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/GifSelector/WebSelector.d.ts +11 -0
- package/lib/typescript/src/SocialComponents/GifSelector/WebSelector.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/GroupChat/components/GroupMessageCard.d.ts +18 -0
- package/lib/typescript/src/SocialComponents/GroupChat/components/GroupMessageCard.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/GroupChat/index.d.ts +25 -0
- package/lib/typescript/src/SocialComponents/GroupChat/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/ImageRenderer.d.ts +21 -0
- package/lib/typescript/src/SocialComponents/ImageRenderer.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/InputBar/components/ActionSelector.d.ts +16 -0
- package/lib/typescript/src/SocialComponents/InputBar/components/ActionSelector.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/InputBar/index.d.ts +10 -1
- package/lib/typescript/src/SocialComponents/InputBar/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PostCard/components/ArticleCard.d.ts +1 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/ArticleCard.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/ImageList.d.ts +1 -1
- package/lib/typescript/src/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PostCard/index.d.ts +4 -2
- package/lib/typescript/src/SocialComponents/PostCard/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/Poster/index.d.ts +16 -0
- package/lib/typescript/src/SocialComponents/Poster/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts +2 -1
- package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts +2 -1
- package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/UrlPreviewCard.d.ts +10 -0
- package/lib/typescript/src/SocialComponents/UrlPreviewCard.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/api/index.d.ts +37 -1
- package/lib/typescript/src/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/index.d.ts +3 -1
- package/lib/typescript/src/SocialComponents/index.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/Components/Icons.tsx +18 -1
- package/src/Components/Themed.tsx +11 -1
- package/src/SocialComponents/FormattedTextInput/components/TagSelector.tsx +24 -17
- package/src/SocialComponents/FormattedTextInput/index.tsx +32 -7
- package/src/SocialComponents/GifSelector/NativeSelector.tsx +13 -0
- package/src/SocialComponents/GifSelector/WebSelector.tsx +91 -0
- package/src/SocialComponents/GroupChat/components/GroupMessageCard.tsx +84 -0
- package/src/SocialComponents/GroupChat/index.tsx +333 -0
- package/src/SocialComponents/ImageRenderer.tsx +42 -0
- package/src/SocialComponents/InputBar/components/ActionSelector.tsx +164 -0
- package/src/SocialComponents/InputBar/index.tsx +40 -6
- package/src/SocialComponents/PostCard/components/ArticleCard.tsx +2 -0
- package/src/SocialComponents/PostCard/components/ImageList.tsx +28 -21
- package/src/SocialComponents/PostCard/index.tsx +122 -56
- package/src/SocialComponents/Poster/index.tsx +264 -0
- package/src/SocialComponents/SocialOrderCard.tsx +4 -6
- package/src/SocialComponents/SocialOrdersList.tsx +14 -8
- package/src/SocialComponents/UrlPreviewCard.tsx +75 -0
- package/src/SocialComponents/api/index.ts +345 -3
- package/src/SocialComponents/index.tsx +4 -0
- package/src/types.d.ts +58 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { APIOverrides } from "../../ApiOverrides";
|
|
3
|
-
import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, PlayerFollowerProps, PlayerPodcastEpisodeProps, PlayerPodcastProps, PodcastEpisodesProps, PodcastProps, PostReactionProps, PublicPlayerProps, TextTagProps, TeamProps, TournamentProps } from "../../types";
|
|
3
|
+
import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, PlayerFollowerProps, PlayerPodcastEpisodeProps, PlayerPodcastProps, PodcastEpisodesProps, PodcastProps, PostReactionProps, PublicPlayerProps, TextTagProps, TeamProps, TournamentProps, GroupProps, GroupMessageProps, GroupPlayerProps, MyPlayerProps, URLMetadataProps, PostProps, ArticleProps } from "../../types";
|
|
4
4
|
import Colors from "../../constants/colors";
|
|
5
5
|
import moment from "moment-mini";
|
|
6
6
|
|
|
@@ -27,6 +27,15 @@ const SocialComponentApi = {
|
|
|
27
27
|
return []
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
+
getPlayersByIds: async(player_ids:string[]):Promise<PublicPlayerProps[]> => {
|
|
31
|
+
try {
|
|
32
|
+
if(player_ids.length == 0){ return [] }
|
|
33
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/bulk/get`, { player_ids });
|
|
34
|
+
return resp.data.players
|
|
35
|
+
} catch (e) {
|
|
36
|
+
return []
|
|
37
|
+
}
|
|
38
|
+
},
|
|
30
39
|
reverseOrder: async(order:OrderProps):Promise<OrderProps | undefined> => {
|
|
31
40
|
try {
|
|
32
41
|
const resp = await axios.post(`${MK_SVC_API}/v1/orders/order/reverse`, { order })
|
|
@@ -43,6 +52,54 @@ const SocialComponentApi = {
|
|
|
43
52
|
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/followers/player/create`, { player_follower })
|
|
44
53
|
return resp.data.player_follower
|
|
45
54
|
},
|
|
55
|
+
getPostById: async(memo_post_id:string):Promise<PostProps | undefined> => {
|
|
56
|
+
try {
|
|
57
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/posts/post/${memo_post_id}`);
|
|
58
|
+
return resp.data.post
|
|
59
|
+
} catch (e) {
|
|
60
|
+
console.log(e)
|
|
61
|
+
return undefined
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
getMyAction:async():Promise<OrderProps[]> => {
|
|
65
|
+
try {
|
|
66
|
+
const resp = await axios.get(`${MK_SVC_API}/v1/orders/action/me`);
|
|
67
|
+
return resp.data.orders
|
|
68
|
+
} catch (e) {
|
|
69
|
+
console.log(e);
|
|
70
|
+
return []
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
getBulkOrders: async(order_ids:string[]):Promise<OrderProps[]> => {
|
|
74
|
+
try {
|
|
75
|
+
if(order_ids.length == 0){ return [] }
|
|
76
|
+
const resp = await axios.post(`${MK_SVC_API}/v1/orders/bulk/get`, { order_ids });
|
|
77
|
+
return resp.data.orders
|
|
78
|
+
} catch (e) {
|
|
79
|
+
console.log('error ggetting orders')
|
|
80
|
+
return []
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
createPost: async(post:PostProps):Promise<PostProps | undefined> => {
|
|
84
|
+
try {
|
|
85
|
+
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/posts/post/create`, { post });
|
|
86
|
+
console.log(resp.data)
|
|
87
|
+
return resp.data.post
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.log(e);
|
|
90
|
+
return undefined
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
updatePost: async(post:PostProps):Promise<PostProps | undefined> => {
|
|
94
|
+
try {
|
|
95
|
+
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/posts/post/update`, { post });
|
|
96
|
+
console.log(resp.data)
|
|
97
|
+
return resp.data.post
|
|
98
|
+
} catch (e) {
|
|
99
|
+
console.log(e);
|
|
100
|
+
return undefined
|
|
101
|
+
}
|
|
102
|
+
},
|
|
46
103
|
getEventsByEventIds: async(event_ids:string[]):Promise<EventProps[]> => {
|
|
47
104
|
if(event_ids.length == 0){ return [] }
|
|
48
105
|
try {
|
|
@@ -70,6 +127,15 @@ const SocialComponentApi = {
|
|
|
70
127
|
return []
|
|
71
128
|
}
|
|
72
129
|
},
|
|
130
|
+
getMyDetails: async():Promise<MyPlayerProps|undefined> => {
|
|
131
|
+
try {
|
|
132
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/player/me`)
|
|
133
|
+
return resp.data.player
|
|
134
|
+
} catch (e) {
|
|
135
|
+
return undefined
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
},
|
|
73
139
|
getMatchesByMatchIds: async(match_ids:string[]):Promise<MatchProps[]> => {
|
|
74
140
|
if(match_ids.length == 0){ return [] }
|
|
75
141
|
try {
|
|
@@ -115,6 +181,16 @@ const SocialComponentApi = {
|
|
|
115
181
|
return undefined
|
|
116
182
|
}
|
|
117
183
|
},
|
|
184
|
+
getUrlMetadata: async(url:string):Promise<URLMetadataProps | undefined> => {
|
|
185
|
+
try {
|
|
186
|
+
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/posts/link/preview`, { url });
|
|
187
|
+
console.log(resp.data)
|
|
188
|
+
return resp.data.link_preview
|
|
189
|
+
} catch (e) {
|
|
190
|
+
console.log(e);
|
|
191
|
+
return undefined
|
|
192
|
+
}
|
|
193
|
+
},
|
|
118
194
|
updatePostReaction : async(post_reaction:PostReactionProps):Promise<PostReactionProps|undefined> => {
|
|
119
195
|
try {
|
|
120
196
|
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/posts/reaction/update`, { post_reaction })
|
|
@@ -167,7 +243,33 @@ const SocialComponentApi = {
|
|
|
167
243
|
console.log(e)
|
|
168
244
|
return undefined
|
|
169
245
|
}
|
|
170
|
-
}
|
|
246
|
+
},
|
|
247
|
+
getChat: async(player_id:string):Promise<{ group:GroupProps, group_messages:GroupMessageProps[], group_players:GroupPlayerProps[] }|undefined> => {
|
|
248
|
+
try {
|
|
249
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/groups/chat/direct/${player_id}`)
|
|
250
|
+
return resp.data
|
|
251
|
+
} catch (e) {
|
|
252
|
+
return undefined
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
getGroupById: async(group_id:string):Promise<{ group:GroupProps, group_messages:GroupMessageProps[], group_players:GroupPlayerProps[] }|undefined> => {
|
|
256
|
+
try {
|
|
257
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/groups/group/${group_id}`);
|
|
258
|
+
return resp.data
|
|
259
|
+
} catch (e) {
|
|
260
|
+
console.log(e);
|
|
261
|
+
return undefined
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
sendChat: async(group_message:GroupMessageProps) => {
|
|
265
|
+
try {
|
|
266
|
+
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/groups/message/create`, { group_message });
|
|
267
|
+
return resp.data.group_message
|
|
268
|
+
} catch (e) {
|
|
269
|
+
console.log(e)
|
|
270
|
+
return undefined
|
|
271
|
+
}
|
|
272
|
+
},
|
|
171
273
|
}
|
|
172
274
|
|
|
173
275
|
|
|
@@ -251,6 +353,214 @@ const SocialOrderHelpers = {
|
|
|
251
353
|
}
|
|
252
354
|
|
|
253
355
|
const SocialComponentHelpers = {
|
|
356
|
+
getPostsData: async(posts:PostProps[]):Promise<{ posts:PostProps[], orders:OrderProps[], players:PublicPlayerProps[], articles:ArticleProps[] }> => {
|
|
357
|
+
try {
|
|
358
|
+
let player_ids:string[] = []
|
|
359
|
+
let order_ids:string[] = []
|
|
360
|
+
let article_ids:string[] = []
|
|
361
|
+
|
|
362
|
+
//Map through the posts and add everything we need!
|
|
363
|
+
posts.map(p => {
|
|
364
|
+
player_ids.push(p.player_id);
|
|
365
|
+
if(p.tags){ p.tags.map(t => {
|
|
366
|
+
if(t.type == 'player'){ player_ids.push(t.tag_type_id ?? '0') }
|
|
367
|
+
//Add more functionality
|
|
368
|
+
}) }
|
|
369
|
+
if(p.memo_articles){ p.memo_articles.map(a => article_ids.push(a)) }
|
|
370
|
+
if(p.memo_orders){ p.memo_orders.map(o => order_ids.push(o)) }
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
order_ids = [ ...new Set(order_ids.map(id => id)) ]
|
|
374
|
+
player_ids = [ ...new Set(player_ids.map(id => id)) ]
|
|
375
|
+
article_ids = [ ...new Set(article_ids.map(id => id)) ]
|
|
376
|
+
|
|
377
|
+
let players = await SocialComponentApi.getPlayersByIds(player_ids);
|
|
378
|
+
let orders = await SocialComponentApi.getBulkOrders(order_ids);
|
|
379
|
+
|
|
380
|
+
//Lets now map back through if there are any tags and we should add the tag for them!
|
|
381
|
+
posts = posts.map(p => {
|
|
382
|
+
if(!p.tags){ return p }
|
|
383
|
+
p.tags = p.tags.map(t => {
|
|
384
|
+
if(t.type == 'player'){
|
|
385
|
+
let player = players.find(p => p.player_id == t.tag_type_id)
|
|
386
|
+
t.data = player
|
|
387
|
+
}
|
|
388
|
+
return t
|
|
389
|
+
});
|
|
390
|
+
return p
|
|
391
|
+
});
|
|
392
|
+
return { posts, players: players, orders:orders, articles:[] }
|
|
393
|
+
} catch (e) {
|
|
394
|
+
console.log(e);
|
|
395
|
+
return { posts, players:[], orders:[], articles:[] }
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
organizeImages:(images:any[], containerWidth:number, maxHeight:number, padding = 10, minWidth = 100) => {
|
|
399
|
+
// Calculate aspect ratios and add to image objects
|
|
400
|
+
const imagesWithRatio = images.map(img => ({
|
|
401
|
+
...img,
|
|
402
|
+
aspectRatio: img.width / img.height
|
|
403
|
+
}));
|
|
404
|
+
|
|
405
|
+
// Sort by aspect ratio for consistency
|
|
406
|
+
imagesWithRatio.sort((a, b) => a.aspectRatio - b.aspectRatio);
|
|
407
|
+
|
|
408
|
+
const rows = [];
|
|
409
|
+
let currentRow = [];
|
|
410
|
+
//const ratioThreshold = 0.3; // Used as a preference, not a hard requirement
|
|
411
|
+
|
|
412
|
+
for (const image of imagesWithRatio) {
|
|
413
|
+
currentRow.push(image);
|
|
414
|
+
|
|
415
|
+
const rowFit = SocialComponentHelpers.calculateRowFit(currentRow, containerWidth, maxHeight, padding, minWidth);
|
|
416
|
+
|
|
417
|
+
// Only split if row doesn't fit and we have more than one image
|
|
418
|
+
if (!rowFit.fits && currentRow.length > 1) {
|
|
419
|
+
currentRow.pop();
|
|
420
|
+
rows.push(SocialComponentHelpers.adjustRow(currentRow, containerWidth, maxHeight, padding, minWidth));
|
|
421
|
+
currentRow = [image];
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (currentRow.length > 0) {
|
|
426
|
+
rows.push(SocialComponentHelpers.adjustRow(currentRow, containerWidth, maxHeight, padding, minWidth));
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return rows;
|
|
430
|
+
},
|
|
431
|
+
|
|
432
|
+
// Helper function to check if row fits
|
|
433
|
+
calculateRowFit: (row:any, containerWidth:number, maxHeight:number, padding:number, minWidth:number) => {
|
|
434
|
+
const totalPadding = (row.length + 1) * padding;
|
|
435
|
+
const availableWidth = containerWidth - totalPadding;
|
|
436
|
+
|
|
437
|
+
let totalMinWidth = 0;
|
|
438
|
+
row.forEach((img:any) => {
|
|
439
|
+
const heightForMinWidth = minWidth / img.aspectRatio;
|
|
440
|
+
const height = Math.min(maxHeight, heightForMinWidth);
|
|
441
|
+
totalMinWidth += Math.max(minWidth, height * img.aspectRatio);
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
return {
|
|
445
|
+
fits: totalMinWidth <= availableWidth,
|
|
446
|
+
totalWidth: totalMinWidth + totalPadding
|
|
447
|
+
};
|
|
448
|
+
},
|
|
449
|
+
|
|
450
|
+
// Helper function to adjust images in a row
|
|
451
|
+
adjustRow:(row:any, containerWidth:number, maxHeight:number, padding:number, minWidth:number) => {
|
|
452
|
+
const totalPadding = (row.length + 1) * padding;
|
|
453
|
+
const availableWidth = containerWidth - totalPadding;
|
|
454
|
+
|
|
455
|
+
let totalAspectRatio = row.reduce((sum:any, img:any) => sum + img.aspectRatio, 0);
|
|
456
|
+
let rowHeight = availableWidth / totalAspectRatio;
|
|
457
|
+
|
|
458
|
+
if (rowHeight > maxHeight) {
|
|
459
|
+
rowHeight = maxHeight;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
return row.map((img:any) => {
|
|
463
|
+
let scaledWidth = rowHeight * img.aspectRatio;
|
|
464
|
+
let scaledHeight = rowHeight;
|
|
465
|
+
|
|
466
|
+
if (scaledWidth < minWidth) {
|
|
467
|
+
scaledWidth = minWidth;
|
|
468
|
+
scaledHeight = minWidth / img.aspectRatio;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
return {
|
|
472
|
+
...img,
|
|
473
|
+
scaledWidth: scaledWidth,
|
|
474
|
+
scaledHeight: scaledHeight,
|
|
475
|
+
paddingLeft: padding,
|
|
476
|
+
paddingRight: padding
|
|
477
|
+
};
|
|
478
|
+
});
|
|
479
|
+
},
|
|
480
|
+
getEmptyPost: ():PostProps => {
|
|
481
|
+
return {
|
|
482
|
+
memo_post_id: '',
|
|
483
|
+
title: '',
|
|
484
|
+
body: '',
|
|
485
|
+
formatted_text:'',
|
|
486
|
+
tags:[],
|
|
487
|
+
memo_competitions:[],
|
|
488
|
+
memo_urls: [],
|
|
489
|
+
memo_events: [],
|
|
490
|
+
memo_hashtags:[],
|
|
491
|
+
memo_images:[],
|
|
492
|
+
memo_location: {},
|
|
493
|
+
memo_orders: [],
|
|
494
|
+
memo_players: [],
|
|
495
|
+
memo_positions:[],
|
|
496
|
+
memo_teams:[],
|
|
497
|
+
memo_topics:[],
|
|
498
|
+
memo_videos:[],
|
|
499
|
+
memo_article_feeds:[],
|
|
500
|
+
memo_articles:[],
|
|
501
|
+
memo_podcast_episodes:[],
|
|
502
|
+
memo_podcasts:[],
|
|
503
|
+
memo_polls:[],
|
|
504
|
+
status: 'active',
|
|
505
|
+
player_id: '',
|
|
506
|
+
post_type: 'memo',
|
|
507
|
+
edited: false,
|
|
508
|
+
external_social_id:'',
|
|
509
|
+
url_metadata:[],
|
|
510
|
+
url_preview: undefined,
|
|
511
|
+
my_reactions:[],
|
|
512
|
+
comment_count: 0,
|
|
513
|
+
reaction_details:[],
|
|
514
|
+
comment_details:[],
|
|
515
|
+
create_datetime:'',
|
|
516
|
+
last_update_datetime:''
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
isPostValid: (post?:PostProps):boolean => {
|
|
520
|
+
if(!post){ return false }
|
|
521
|
+
if(!post.title){ return false }
|
|
522
|
+
if(!post.body){ return false }
|
|
523
|
+
if(!post.formatted_text){ return false }
|
|
524
|
+
return true
|
|
525
|
+
},
|
|
526
|
+
getUrlsFromString: (str:string) => {
|
|
527
|
+
const regex = /https?:\/\/(?:[a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,}(?:\/[^\s]*)?(\?[^\s]*)?(#[^\s]*)?/;
|
|
528
|
+
let res = str.match(regex)
|
|
529
|
+
if(res && res[0]){
|
|
530
|
+
let url = res[0]
|
|
531
|
+
url = url.replace(/[.,!?;]+$/, '');
|
|
532
|
+
return url
|
|
533
|
+
}
|
|
534
|
+
return undefined
|
|
535
|
+
},
|
|
536
|
+
getEmptyMessage:():GroupMessageProps => {
|
|
537
|
+
return {
|
|
538
|
+
group_message_id: '',
|
|
539
|
+
group_id: '',
|
|
540
|
+
player_id: '',
|
|
541
|
+
message: '',
|
|
542
|
+
formatted_text: '',
|
|
543
|
+
create_datetime:'',
|
|
544
|
+
last_update_datetime:'',
|
|
545
|
+
message_images:[],
|
|
546
|
+
message_orders:[],
|
|
547
|
+
message_urls:[],
|
|
548
|
+
message_videos:[],
|
|
549
|
+
url_metadata:[],
|
|
550
|
+
status:'published',
|
|
551
|
+
visibility_status:true,
|
|
552
|
+
formatted_body: {
|
|
553
|
+
blocks: [],
|
|
554
|
+
entityMap: {
|
|
555
|
+
value: {
|
|
556
|
+
type:'',
|
|
557
|
+
mutability: '',
|
|
558
|
+
data: {}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
},
|
|
254
564
|
extractTagsFromText: (text:string, cursor?:number):TextTagProps[] => {
|
|
255
565
|
let tags:TextTagProps[] = []
|
|
256
566
|
let split_text = text.split(' ');
|
|
@@ -288,7 +598,39 @@ const SocialComponentHelpers = {
|
|
|
288
598
|
|
|
289
599
|
|
|
290
600
|
return final_tags
|
|
291
|
-
}
|
|
601
|
+
},
|
|
602
|
+
addTagsToMessages: async(gms:GroupMessageProps[]):Promise<GroupMessageProps[]> => {
|
|
603
|
+
try {
|
|
604
|
+
if(gms.length == 0){ return [] }
|
|
605
|
+
let gms_with_tags = gms.filter(m => m.tags && m.tags.length > 0);
|
|
606
|
+
if(gms_with_tags.length == 0){ return gms }
|
|
607
|
+
let player_ids:string[] = []
|
|
608
|
+
gms_with_tags.map(gm => {
|
|
609
|
+
if(!gm.tags || gm.tags.length == 0){ return }
|
|
610
|
+
let gm_player_ids = gm.tags.filter(t => t.type == 'player' && t.tag_type_id).map(t => t.tag_type_id ?? '');
|
|
611
|
+
player_ids = player_ids.concat(gm_player_ids);
|
|
612
|
+
});
|
|
613
|
+
let players = await SocialComponentApi.getPlayersByIds(player_ids);
|
|
614
|
+
|
|
615
|
+
gms = gms.map(gm => {
|
|
616
|
+
if(!gm.tags || gm.tags.length == 0){ return gm }
|
|
617
|
+
gm.tags = gm.tags.map(tag => {
|
|
618
|
+
switch(tag.type){
|
|
619
|
+
case 'player':
|
|
620
|
+
let player = players.find(p => p.player_id == tag.tag_type_id);
|
|
621
|
+
if(!player){ return tag }
|
|
622
|
+
return { ...tag, data: player }
|
|
623
|
+
default: return tag
|
|
624
|
+
}
|
|
625
|
+
})
|
|
626
|
+
return gm
|
|
627
|
+
})
|
|
628
|
+
return gms
|
|
629
|
+
} catch (e) {
|
|
630
|
+
console.log('unable');
|
|
631
|
+
return gms
|
|
632
|
+
}
|
|
633
|
+
},
|
|
292
634
|
}
|
|
293
635
|
|
|
294
636
|
const SocialPodcastHelpers = {
|
|
@@ -9,16 +9,20 @@ import PostCard from './PostCard';
|
|
|
9
9
|
import FormattedTextInput from "./FormattedTextInput";
|
|
10
10
|
import { FormattedText } from "./FormattedTextInput/FormattedText";
|
|
11
11
|
import InputBar from "./InputBar";
|
|
12
|
+
import GroupChat from "./GroupChat";
|
|
13
|
+
import Poster from "./Poster";
|
|
12
14
|
|
|
13
15
|
export {
|
|
14
16
|
PlayerCard,
|
|
15
17
|
PlayerList,
|
|
16
18
|
FormattedTextInput,
|
|
17
19
|
InputBar,
|
|
20
|
+
Poster,
|
|
18
21
|
FormattedText,
|
|
19
22
|
PlayerProfile,
|
|
20
23
|
CompanyProfile,
|
|
21
24
|
PodcastModule,
|
|
25
|
+
GroupChat,
|
|
22
26
|
AudioPlayer,
|
|
23
27
|
useContacts,
|
|
24
28
|
PostCard
|
package/src/types.d.ts
CHANGED
|
@@ -500,6 +500,62 @@ export interface PlayerFollowerStatsProps {
|
|
|
500
500
|
team_member_count:number
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
+
//GROUPS
|
|
504
|
+
|
|
505
|
+
export interface GroupProps {
|
|
506
|
+
group_id:string,
|
|
507
|
+
type: 'direct' | 'multiple',
|
|
508
|
+
description:string,
|
|
509
|
+
related_id?:string,
|
|
510
|
+
related_type?:string,
|
|
511
|
+
name:string,
|
|
512
|
+
invite_only: boolean,
|
|
513
|
+
invite_code?:string,
|
|
514
|
+
group_image?:any,
|
|
515
|
+
order_alerts:boolean,
|
|
516
|
+
position_alerts:boolean,
|
|
517
|
+
leaderboard_ind:boolean,
|
|
518
|
+
competition_alerts:boolean,
|
|
519
|
+
group_admin:string,
|
|
520
|
+
last_message?:string,
|
|
521
|
+
create_datetime:any,
|
|
522
|
+
status:string,
|
|
523
|
+
last_update_datetime:any,
|
|
524
|
+
last_message_datetime?:any
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export interface GroupPlayerProps {
|
|
528
|
+
group_player_id:string,
|
|
529
|
+
group_id:string,
|
|
530
|
+
player_id:string,
|
|
531
|
+
create_datetime:any,
|
|
532
|
+
status:'invited'|'active'|'inactive',
|
|
533
|
+
last_update_datetime:any,
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export interface GroupMessageProps {
|
|
537
|
+
group_message_id:string,
|
|
538
|
+
group_id:string,
|
|
539
|
+
player_id:string,
|
|
540
|
+
message:string,
|
|
541
|
+
formatted_body:RawDraftJSProps,
|
|
542
|
+
formatted_text: any,
|
|
543
|
+
tags?:TextTagProps[],
|
|
544
|
+
status:'published'|'hidden',
|
|
545
|
+
visibility_status:boolean,
|
|
546
|
+
related_message_id?:string|undefined,
|
|
547
|
+
related_content_type?:string | undefined,
|
|
548
|
+
related_content?:any,
|
|
549
|
+
related_content_id?:string | undefined,
|
|
550
|
+
message_orders?:string[],
|
|
551
|
+
message_urls?:string[],
|
|
552
|
+
message_images?:any[],
|
|
553
|
+
message_videos?:any[],
|
|
554
|
+
url_metadata?:any[],
|
|
555
|
+
create_datetime:any,
|
|
556
|
+
last_update_datetime:any
|
|
557
|
+
}
|
|
558
|
+
|
|
503
559
|
export interface TextTagProps {
|
|
504
560
|
local_id:string,
|
|
505
561
|
type: 'player' | string,
|
|
@@ -2253,6 +2309,8 @@ export interface PostProps {
|
|
|
2253
2309
|
memo_post_id:string,
|
|
2254
2310
|
player_id:string,
|
|
2255
2311
|
title:string,
|
|
2312
|
+
formatted_text?:string,
|
|
2313
|
+
tags?:TextTagProps[],
|
|
2256
2314
|
body:string,
|
|
2257
2315
|
formatted_body?: RawDraftJSProps,
|
|
2258
2316
|
status:'active'|'hidden',
|