@sleeperhq/mini-core 0.0.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 (36) hide show
  1. package/.github/pull_request_template.md +8 -0
  2. package/README.md +9 -0
  3. package/bin/build_mini.js +189 -0
  4. package/bin/preload_packages.js +58 -0
  5. package/declarations/avatar/index.d.ts +23 -0
  6. package/declarations/button/index.d.ts +37 -0
  7. package/declarations/index.d.ts +5 -0
  8. package/declarations/jersey/index.d.ts +9 -0
  9. package/declarations/navigation/index.d.ts +35 -0
  10. package/declarations/sleeper_actions.d.ts +8 -0
  11. package/declarations/sleeper_context.d.ts +28 -0
  12. package/declarations/sleeper_message.d.ts +12 -0
  13. package/declarations/switch/index.d.ts +3 -0
  14. package/declarations/text/index.d.ts +14 -0
  15. package/declarations/types/components/app_icon_switch.d.ts +24 -0
  16. package/declarations/types/components/jersey.d.ts +3 -0
  17. package/declarations/types/index.d.ts +33 -0
  18. package/declarations/types/minis/index.d.ts +71 -0
  19. package/declarations/types/shared/graphql.d.ts +258 -0
  20. package/declarations/types/utils/toast_helper.d.ts +9 -0
  21. package/index.ts +7 -0
  22. package/mini_packages.json +109 -0
  23. package/package.json +87 -0
  24. package/src/common/packet_parser.js +79 -0
  25. package/src/components/MiniLogger.ts +18 -0
  26. package/src/components/index.tsx +85 -0
  27. package/src/dev_server/index.tsx +253 -0
  28. package/src/dev_server/url_resolver.tsx +72 -0
  29. package/src/plugins/rebuildNotifyPlugin.js +37 -0
  30. package/src/plugins/send_events.mjs +87 -0
  31. package/src/styles/fonts.ts +139 -0
  32. package/src/styles/index.ts +2 -0
  33. package/src/styles/theme.ts +69 -0
  34. package/src/types/index.ts +17 -0
  35. package/start.tsx +105 -0
  36. package/webpack.config.js +325 -0
@@ -0,0 +1,258 @@
1
+ export type Maybe<T> = T | null;
2
+ export type InputMaybe<T> = Maybe<T>;
3
+ export type Exact<T extends {
4
+ [key: string]: unknown;
5
+ }> = {
6
+ [K in keyof T]: T[K];
7
+ };
8
+ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
9
+ [SubKey in K]?: Maybe<T[SubKey]>;
10
+ };
11
+ export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
12
+ [SubKey in K]: Maybe<T[SubKey]>;
13
+ };
14
+ /** All built-in and custom scalars, mapped to their actual values */
15
+ export type Scalars = {
16
+ ID: string;
17
+ String: string;
18
+ Boolean: boolean;
19
+ Int: number;
20
+ Float: number;
21
+ /** JSON */
22
+ Json: {
23
+ [key: string]: any;
24
+ };
25
+ /** Lists */
26
+ List: string[];
27
+ /** Map / Dictionary */
28
+ Map: {
29
+ [key: string]: any;
30
+ };
31
+ MapWithSnowflakeKey: {
32
+ [key: string]: any;
33
+ };
34
+ /** Sets */
35
+ Set: string[];
36
+ /** Snowflake ID */
37
+ Snowflake: string;
38
+ SnowflakeList: string[];
39
+ SnowflakeSet: string[];
40
+ };
41
+ export type Draft = {
42
+ __typename?: 'Draft';
43
+ created?: Maybe<Scalars['Int']>;
44
+ creators?: Maybe<Scalars['SnowflakeList']>;
45
+ draft_id?: Maybe<Scalars['Snowflake']>;
46
+ draft_order?: Maybe<Scalars['MapWithSnowflakeKey']>;
47
+ last_message_id?: Maybe<Scalars['Snowflake']>;
48
+ last_message_time?: Maybe<Scalars['Int']>;
49
+ last_picked?: Maybe<Scalars['Int']>;
50
+ league_id?: Maybe<Scalars['Snowflake']>;
51
+ metadata?: Maybe<Scalars['Map']>;
52
+ season?: Maybe<Scalars['String']>;
53
+ season_type?: Maybe<Scalars['String']>;
54
+ settings?: Maybe<Scalars['Map']>;
55
+ sport?: Maybe<Scalars['String']>;
56
+ start_time?: Maybe<Scalars['Int']>;
57
+ status?: Maybe<Scalars['String']>;
58
+ type?: Maybe<Scalars['String']>;
59
+ };
60
+ export type DraftPick = {
61
+ __typename?: 'DraftPick';
62
+ draft_id?: Maybe<Scalars['Snowflake']>;
63
+ is_keeper?: Maybe<Scalars['Boolean']>;
64
+ metadata?: Maybe<Scalars['Map']>;
65
+ pick_no?: Maybe<Scalars['Int']>;
66
+ picked_by?: Maybe<Scalars['Snowflake']>;
67
+ player_id?: Maybe<Scalars['String']>;
68
+ };
69
+ export type League = {
70
+ __typename?: 'League';
71
+ avatar?: Maybe<Scalars['String']>;
72
+ company_id?: Maybe<Scalars['Snowflake']>;
73
+ display_order?: Maybe<Scalars['Int']>;
74
+ draft_id?: Maybe<Scalars['Snowflake']>;
75
+ group_id?: Maybe<Scalars['Snowflake']>;
76
+ last_author_avatar?: Maybe<Scalars['String']>;
77
+ last_author_display_name?: Maybe<Scalars['String']>;
78
+ last_author_id?: Maybe<Scalars['Snowflake']>;
79
+ last_author_is_bot?: Maybe<Scalars['Boolean']>;
80
+ last_message_attachment?: Maybe<Scalars['Json']>;
81
+ last_message_id?: Maybe<Scalars['Snowflake']>;
82
+ last_message_text?: Maybe<Scalars['String']>;
83
+ last_message_text_map?: Maybe<Scalars['Json']>;
84
+ last_message_time?: Maybe<Scalars['Int']>;
85
+ last_pinned_message_id?: Maybe<Scalars['Snowflake']>;
86
+ last_read_id?: Maybe<Scalars['Snowflake']>;
87
+ last_transaction_id?: Maybe<Scalars['Snowflake']>;
88
+ league_id?: Maybe<Scalars['Snowflake']>;
89
+ matchup_legs?: Maybe<Scalars['List']>;
90
+ metadata?: Maybe<Scalars['Map']>;
91
+ name?: Maybe<Scalars['String']>;
92
+ previous_league_id?: Maybe<Scalars['Snowflake']>;
93
+ roster_positions?: Maybe<Scalars['List']>;
94
+ scoring_settings?: Maybe<Scalars['Map']>;
95
+ season?: Maybe<Scalars['String']>;
96
+ season_type?: Maybe<Scalars['String']>;
97
+ settings?: Maybe<Scalars['Map']>;
98
+ sport?: Maybe<Scalars['String']>;
99
+ status?: Maybe<Scalars['String']>;
100
+ total_rosters?: Maybe<Scalars['Int']>;
101
+ };
102
+ export type LeagueTransaction = {
103
+ __typename?: 'LeagueTransaction';
104
+ adds?: Maybe<Scalars['Map']>;
105
+ consenter_ids?: Maybe<Scalars['List']>;
106
+ created?: Maybe<Scalars['Int']>;
107
+ creator?: Maybe<Scalars['Snowflake']>;
108
+ draft_picks?: Maybe<Scalars['List']>;
109
+ drops?: Maybe<Scalars['Map']>;
110
+ league_id?: Maybe<Scalars['Snowflake']>;
111
+ leg?: Maybe<Scalars['Int']>;
112
+ metadata?: Maybe<Scalars['Map']>;
113
+ player_map?: Maybe<Scalars['Map']>;
114
+ roster_ids?: Maybe<Scalars['List']>;
115
+ settings?: Maybe<Scalars['Map']>;
116
+ status?: Maybe<Scalars['String']>;
117
+ status_updated?: Maybe<Scalars['Int']>;
118
+ transaction_id?: Maybe<Scalars['Snowflake']>;
119
+ type?: Maybe<Scalars['String']>;
120
+ waiver_budget?: Maybe<Scalars['List']>;
121
+ };
122
+ export type MatchupLeg = {
123
+ __typename?: 'MatchupLeg';
124
+ bans?: Maybe<Scalars['Map']>;
125
+ custom_points?: Maybe<Scalars['Float']>;
126
+ league_id?: Maybe<Scalars['Snowflake']>;
127
+ leg?: Maybe<Scalars['Int']>;
128
+ matchup_id?: Maybe<Scalars['Int']>;
129
+ max_points?: Maybe<Scalars['Float']>;
130
+ picks?: Maybe<Scalars['Map']>;
131
+ player_map?: Maybe<Scalars['Map']>;
132
+ players?: Maybe<Scalars['Set']>;
133
+ points?: Maybe<Scalars['Float']>;
134
+ proj_points?: Maybe<Scalars['Float']>;
135
+ roster_id?: Maybe<Scalars['Int']>;
136
+ round?: Maybe<Scalars['Int']>;
137
+ starters?: Maybe<Scalars['List']>;
138
+ starters_games?: Maybe<Scalars['Map']>;
139
+ };
140
+ export type Player = {
141
+ __typename?: 'Player';
142
+ active?: Maybe<Scalars['Boolean']>;
143
+ age?: Maybe<Scalars['Int']>;
144
+ birth_city?: Maybe<Scalars['String']>;
145
+ birth_country?: Maybe<Scalars['String']>;
146
+ birth_date?: Maybe<Scalars['String']>;
147
+ birth_state?: Maybe<Scalars['String']>;
148
+ college?: Maybe<Scalars['String']>;
149
+ depth_chart_order?: Maybe<Scalars['Int']>;
150
+ depth_chart_position?: Maybe<Scalars['String']>;
151
+ espn_id?: Maybe<Scalars['Int']>;
152
+ fantasy_data_id?: Maybe<Scalars['Int']>;
153
+ fantasy_positions?: Maybe<Scalars['Set']>;
154
+ first_name?: Maybe<Scalars['String']>;
155
+ hashtag?: Maybe<Scalars['String']>;
156
+ height?: Maybe<Scalars['String']>;
157
+ high_school?: Maybe<Scalars['String']>;
158
+ injury_body_part?: Maybe<Scalars['String']>;
159
+ injury_notes?: Maybe<Scalars['String']>;
160
+ injury_start_date?: Maybe<Scalars['String']>;
161
+ injury_status?: Maybe<Scalars['String']>;
162
+ last_name?: Maybe<Scalars['String']>;
163
+ metadata?: Maybe<Scalars['Map']>;
164
+ number?: Maybe<Scalars['Int']>;
165
+ player_id?: Maybe<Scalars['String']>;
166
+ position?: Maybe<Scalars['String']>;
167
+ practice_description?: Maybe<Scalars['String']>;
168
+ practice_participation?: Maybe<Scalars['String']>;
169
+ rotowire_id?: Maybe<Scalars['Int']>;
170
+ rotoworld_id?: Maybe<Scalars['Int']>;
171
+ sport?: Maybe<Scalars['String']>;
172
+ sportradar_id?: Maybe<Scalars['String']>;
173
+ stats_id?: Maybe<Scalars['Int']>;
174
+ status?: Maybe<Scalars['String']>;
175
+ swish_id?: Maybe<Scalars['Int']>;
176
+ team?: Maybe<Scalars['String']>;
177
+ weight?: Maybe<Scalars['String']>;
178
+ yahoo_id?: Maybe<Scalars['Int']>;
179
+ years_exp?: Maybe<Scalars['Int']>;
180
+ };
181
+ export type Roster = {
182
+ __typename?: 'Roster';
183
+ co_owners?: Maybe<Scalars['SnowflakeSet']>;
184
+ keepers?: Maybe<Scalars['Set']>;
185
+ league_id?: Maybe<Scalars['Snowflake']>;
186
+ metadata?: Maybe<Scalars['Map']>;
187
+ owner_id?: Maybe<Scalars['Snowflake']>;
188
+ player_map?: Maybe<Scalars['Map']>;
189
+ players?: Maybe<Scalars['Set']>;
190
+ reserve?: Maybe<Scalars['Set']>;
191
+ roster_id?: Maybe<Scalars['Int']>;
192
+ settings?: Maybe<Scalars['Map']>;
193
+ starters?: Maybe<Scalars['List']>;
194
+ taxi?: Maybe<Scalars['Set']>;
195
+ };
196
+ export type RosterDraftPick = {
197
+ __typename?: 'RosterDraftPick';
198
+ league_id?: Maybe<Scalars['Snowflake']>;
199
+ owner_id?: Maybe<Scalars['Int']>;
200
+ previous_owner_id?: Maybe<Scalars['Int']>;
201
+ roster_id?: Maybe<Scalars['Int']>;
202
+ round?: Maybe<Scalars['Int']>;
203
+ season?: Maybe<Scalars['String']>;
204
+ };
205
+ export type Topic = {
206
+ __typename?: 'Topic';
207
+ attachment?: Maybe<Scalars['Json']>;
208
+ author_avatar?: Maybe<Scalars['String']>;
209
+ author_display_name?: Maybe<Scalars['String']>;
210
+ author_id?: Maybe<Scalars['Snowflake']>;
211
+ author_is_bot?: Maybe<Scalars['Boolean']>;
212
+ channel_id?: Maybe<Scalars['Snowflake']>;
213
+ channel_tags?: Maybe<Scalars['Set']>;
214
+ client_id?: Maybe<Scalars['String']>;
215
+ created?: Maybe<Scalars['Int']>;
216
+ hidden?: Maybe<Scalars['Boolean']>;
217
+ last_message_id?: Maybe<Scalars['Snowflake']>;
218
+ last_pinned_message_id?: Maybe<Scalars['Snowflake']>;
219
+ last_read_id?: Maybe<Scalars['Snowflake']>;
220
+ num_messages?: Maybe<Scalars['Int']>;
221
+ num_viewers?: Maybe<Scalars['Int']>;
222
+ pinned?: Maybe<Scalars['Boolean']>;
223
+ player_tags?: Maybe<Scalars['Set']>;
224
+ pushed_by?: Maybe<Scalars['Json']>;
225
+ score?: Maybe<Scalars['Int']>;
226
+ shadowed?: Maybe<Scalars['Boolean']>;
227
+ shard_max?: Maybe<Scalars['Int']>;
228
+ shard_min?: Maybe<Scalars['Int']>;
229
+ title?: Maybe<Scalars['String']>;
230
+ title_map?: Maybe<Scalars['Json']>;
231
+ topic_id?: Maybe<Scalars['Snowflake']>;
232
+ upvotes?: Maybe<Scalars['Int']>;
233
+ };
234
+ export type User = {
235
+ __typename?: 'User';
236
+ async_bundles?: Maybe<Scalars['List']>;
237
+ avatar?: Maybe<Scalars['String']>;
238
+ cookies?: Maybe<Scalars['Int']>;
239
+ created?: Maybe<Scalars['Int']>;
240
+ currencies?: Maybe<Scalars['Map']>;
241
+ data_updated?: Maybe<Scalars['Map']>;
242
+ deleted?: Maybe<Scalars['Int']>;
243
+ display_name?: Maybe<Scalars['String']>;
244
+ email?: Maybe<Scalars['String']>;
245
+ is_bot?: Maybe<Scalars['Boolean']>;
246
+ metadata?: Maybe<Scalars['Json']>;
247
+ notifications?: Maybe<Scalars['Map']>;
248
+ pending?: Maybe<Scalars['Boolean']>;
249
+ phone?: Maybe<Scalars['String']>;
250
+ real_name?: Maybe<Scalars['String']>;
251
+ solicitable?: Maybe<Scalars['Boolean']>;
252
+ summoner_name?: Maybe<Scalars['String']>;
253
+ summoner_region?: Maybe<Scalars['String']>;
254
+ token?: Maybe<Scalars['String']>;
255
+ user_id?: Maybe<Scalars['Snowflake']>;
256
+ username?: Maybe<Scalars['String']>;
257
+ verification?: Maybe<Scalars['String']>;
258
+ };
@@ -0,0 +1,9 @@
1
+ import { TextStyle, ViewStyle } from 'react-native';
2
+ export type ToastConfig = {
3
+ text: string;
4
+ icon?: 'success' | 'error' | 'trade' | 'voice';
5
+ time?: number;
6
+ style?: ViewStyle;
7
+ slideTop?: boolean;
8
+ textStyle?: TextStyle;
9
+ };
package/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ import * as Sleeper from './src/components';
2
+ import DevServer from './src/dev_server';
3
+ import * as Types from './src/types';
4
+ import { Fonts, Theme } from './src/styles';
5
+ import MiniLogger from './src/components/MiniLogger';
6
+
7
+ export { Sleeper, DevServer, Types, Fonts, Theme, MiniLogger };
@@ -0,0 +1,109 @@
1
+ {
2
+ "packages": {
3
+ "@babel/runtime": "7.26.0",
4
+ "@babel/plugin-transform-runtime": "7.25.9",
5
+ "@mattermost/react-native-paste-input": "0.8.0",
6
+ "@notifee/react-native": "7.8.0",
7
+ "@ptomasroos/react-native-multi-slider": "2.2.2",
8
+ "@react-native-camera-roll/camera-roll": "5.2.0",
9
+ "@react-native-community/blur": "4.4.0",
10
+ "@react-native-community/datetimepicker": "2.6.2",
11
+ "@react-native-community/hooks": "2.8.0",
12
+ "@react-native-community/netinfo": "11.3.2",
13
+ "@react-native-masked-view/masked-view": "0.3.1",
14
+ "@react-native-picker/picker": "1.16.8",
15
+ "@react-navigation/bottom-tabs": "6.6.0",
16
+ "@react-navigation/compat": "5.3.20",
17
+ "@react-navigation/drawer": "6.7.0",
18
+ "@react-navigation/elements": "1.3.30",
19
+ "@react-navigation/native": "6.1.17",
20
+ "@react-navigation/stack": "6.4.0",
21
+ "@shopify/flash-list": "1.7.0",
22
+ "@sleeperhq/mini-core": "0.0.2",
23
+ "amazon-cognito-identity-js": "6.3.2",
24
+ "crypto-js": "3.3.0",
25
+ "decimal.js-light": "2.5.1",
26
+ "deep-diff": "1.0.2",
27
+ "he": "1.2.0",
28
+ "path": "0.12.7",
29
+ "react": "18.3.1",
30
+ "react-freeze": "1.0.4",
31
+ "react-native": "0.76.1",
32
+ "react-native-action-sheet": "2.2.0",
33
+ "react-native-animatable": "1.3.3",
34
+ "react-native-check-version": "1.0.20",
35
+ "react-native-color-matrix-image-filters": "5.2.10",
36
+ "react-native-compressor": "1.9.0",
37
+ "react-native-confirmation-code-field": "6.7.0",
38
+ "react-native-contacts": "5.2.8",
39
+ "react-native-create-thumbnail": "2.0.0-rc.2",
40
+ "react-native-date-picker": "4.2.2",
41
+ "react-native-detector": "0.2.1",
42
+ "react-native-device-info": "8.4.1",
43
+ "react-native-draggable-flatlist": "4.0.1",
44
+ "react-native-draggable-reanimated": "1.0.5",
45
+ "react-native-dropdownalert": "4.3.0",
46
+ "react-native-emoji-rain": "0.0.1",
47
+ "react-native-fs": "2.18.0",
48
+ "react-native-gesture-handler": "2.21.0",
49
+ "react-native-google-places-autocomplete": "2.4.1",
50
+ "react-native-haptic-feedback": "1.6.0",
51
+ "react-native-image-crop-picker": "0.39.0",
52
+ "react-native-image-pan-zoom": "2.1.12",
53
+ "react-native-image-picker": "4.10.3",
54
+ "react-native-image-resizer": "1.4.5",
55
+ "react-native-iphone-x-helper": "1.3.1",
56
+ "react-native-json-tree": "1.3.0",
57
+ "react-native-keep-awake": "4.0.0",
58
+ "react-native-keyboard-aware-scroll-view": "0.9.5",
59
+ "react-native-keyboard-spacer": "0.4.1",
60
+ "react-native-linear-gradient": "2.8.3",
61
+ "react-native-modal": "13.0.0",
62
+ "react-native-modal-datetime-picker": "13.0.1",
63
+ "react-native-parsed-text": "0.0.21",
64
+ "react-native-permissions": "3.6.1",
65
+ "react-native-platform-touchable": "1.1.1",
66
+ "react-native-popup-dialog": "0.11.46",
67
+ "react-native-popup-menu": "0.16.1",
68
+ "react-native-progress": "4.1.2",
69
+ "react-native-qrcode-svg": "6.1.1",
70
+ "react-native-reanimated": "3.16.1",
71
+ "react-native-redash": "18.1.0",
72
+ "react-native-safe-area-context": "4.10.5",
73
+ "react-native-screens": "4.1.0",
74
+ "react-native-section-list-get-item-layout": "2.2.3",
75
+ "react-native-shake": "5.3.1",
76
+ "react-native-share": "7.3.9",
77
+ "react-native-shimmer-placeholder": "1.0.36",
78
+ "react-native-simple-toast": "1.1.3",
79
+ "react-native-sms": "1.11.0",
80
+ "react-native-snap-carousel": "3.9.1",
81
+ "react-native-sound": "0.11.1",
82
+ "react-native-sound-level": "1.1.5",
83
+ "react-native-spinkit": "1.5.1",
84
+ "react-native-svg": "15.8.0",
85
+ "react-native-swiper": "1.6.0-rc.3",
86
+ "react-native-tab-view": "3.5.0",
87
+ "react-native-tcp-socket": "6.0.6",
88
+ "react-native-triangle": "0.0.9",
89
+ "react-native-vector-icons": "10.1.0",
90
+ "react-native-video": "6.4.2",
91
+ "react-native-view-shot": "3.7.0",
92
+ "react-native-webview": "13.10.4",
93
+ "react-native-webp-format": "1.1.2",
94
+ "regenerator-runtime": "0.13.11",
95
+ "recyclerlistview": "4.2.0",
96
+ "rn-prompt": "1.0.4"
97
+ },
98
+ "overrides": {
99
+ "@callstack/repack": "0.5.3",
100
+ "@react-native-async-storage/async-storage": "1.15.15",
101
+ "@react-native-community/audio-toolkit": "2.0.3",
102
+ "react-native-chart-kit": "6.7.0",
103
+ "react-native-circular-progress": "1.3.6",
104
+ "react-native-fast-image": "8.5.11"
105
+ },
106
+ "requiredBy": {
107
+ "amazon-cognito-identity-js": "flexfantasy"
108
+ }
109
+ }
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@sleeperhq/mini-core",
3
+ "version": "0.0.2",
4
+ "description": "Core library frameworks for developing Sleeper Mini Apps.",
5
+ "main": "index.ts",
6
+ "types": "index.d.ts",
7
+ "bin": {
8
+ "build-mini": "./bin/build_mini.js",
9
+ "preload-packages": "./bin/preload_packages.js"
10
+ },
11
+ "scripts": {
12
+ "test": "jest",
13
+ "lint": "eslint ."
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/blitzstudios/sleeper-mini-core.git"
18
+ },
19
+ "keywords": [
20
+ "sleeper",
21
+ "mini",
22
+ "apps",
23
+ "fantasy",
24
+ "sports"
25
+ ],
26
+ "author": "Luke Herbold <luke@sleeper.app>",
27
+ "license": "MIT",
28
+ "bugs": {
29
+ "url": "https://github.com/blitzstudios/sleeper-mini-core/issues"
30
+ },
31
+ "homepage": "https://github.com/blitzstudios/sleeper-mini-core#readme",
32
+ "publishConfig": {
33
+ "registry": "https://registry.npmjs.org/",
34
+ "access": "public"
35
+ },
36
+ "dependencies": {
37
+ "@babel/plugin-transform-runtime": "7.25.9",
38
+ "@babel/runtime": "7.26.0",
39
+ "@callstack/repack": "blitzstudios/repack.git#callstack-repack-v0.5.3-gitpkg",
40
+ "@react-native-community/cli": "15.0.0",
41
+ "@react-native-community/cli-platform-android": "15.0.0",
42
+ "@react-native-community/cli-platform-apple": "15.0.0",
43
+ "@react-native-community/cli-platform-ios": "15.0.0",
44
+ "@react-native-community/netinfo": "11.3.2",
45
+ "axios": "0.15.3",
46
+ "babel-loader": "9.1.3",
47
+ "react-native-fast-image": "https://github.com/blitzstudios/react-native-fast-image.git#release/1.2",
48
+ "react-native-linear-gradient": "2.8.3",
49
+ "react-native-rename": "blitzstudios/react-native-rename.git#react-native-rename-v3.2.17-gitpkg",
50
+ "react-refresh": "0.14.0",
51
+ "regenerator-runtime": "0.13.11",
52
+ "rx": "4.1.0",
53
+ "string-replace-loader": "3.1.0",
54
+ "terser-webpack-plugin": "5.3.10",
55
+ "webpack": "5.94.0"
56
+ },
57
+ "peerDependencies": {
58
+ "react": "18.3.1",
59
+ "react-native": "0.76.1",
60
+ "react-native-svg": "15.8.0"
61
+ },
62
+ "devDependencies": {
63
+ "@babel/core": "7.26.0",
64
+ "@babel/preset-typescript": "7.26.0",
65
+ "@react-native-community/eslint-config": "^2.0.0",
66
+ "@react-native/babel-preset": "0.76.1",
67
+ "@react-native/typescript-config": "0.76.1",
68
+ "@types/react": "18.2.31",
69
+ "@typescript-eslint/eslint-plugin": "^5.31.0",
70
+ "@typescript-eslint/parser": "^5.31.0",
71
+ "babel-jest": "^29.6.3",
72
+ "eslint": "8.38.0",
73
+ "jest": "29.6.3",
74
+ "lodash": "4.17.21",
75
+ "react-native-tcp-socket": "6.0.6",
76
+ "typescript": "5.2.2"
77
+ },
78
+ "resolutions": {
79
+ "react-devtools-core": "4.23.0"
80
+ },
81
+ "jest": {
82
+ "preset": "react-native"
83
+ },
84
+ "engines": {
85
+ "node": ">=18"
86
+ }
87
+ }
@@ -0,0 +1,79 @@
1
+ class PacketParser {
2
+ constructor(props) {
3
+ this.logsEnabled = props.logsEnabled || false;
4
+ this.messageLength = 0;
5
+ this.messageType = '';
6
+ this.messageLength = 0;
7
+ this.partialMessage = '';
8
+ this.onMessageRecieved = props.onMessageRecieved;
9
+ }
10
+
11
+ parseMessage(msgString) {
12
+ while (msgString.length > 0) {
13
+ if (this.messageLength === 0) {
14
+ const delimit = msgString.indexOf('\n');
15
+ if (delimit === -1) {
16
+ console.log("[Sleeper] Message header not found, throwing out message.");
17
+ return;
18
+ }
19
+
20
+ const header = msgString.substring(0, delimit);
21
+ try {
22
+ const headerObject = JSON.parse(header);
23
+ this.messageType = headerObject.type;
24
+ this.messageLength = headerObject.size;
25
+ } catch (e) {
26
+ console.log("[Sleeper] Message header malformed, throwing out message.");
27
+ this.messageLength = 0;
28
+ this.messageType = '';
29
+ return;
30
+ }
31
+
32
+ msgString = msgString.substring(delimit + 1);
33
+ }
34
+
35
+ const partialLength = this.messageLength - this.partialMessage.length;
36
+ if (partialLength < 0) {
37
+ // We need to wait for more data
38
+ this.partialMessage += msgString;
39
+ return;
40
+ }
41
+
42
+ const remainingLength = msgString.length - partialLength;
43
+ if (remainingLength === 0) {
44
+ // We have the full message
45
+ this.partialMessage += msgString;
46
+ msgString = '';
47
+ if (this.logsEnabled) console.log("[Sleeper] Message built.", this.partialMessage.length);
48
+
49
+ } else {
50
+ // We have more than the full message
51
+ this.partialMessage += msgString.substring(0, partialLength);
52
+ msgString = msgString.substring(partialLength);
53
+
54
+ if (remainingLength <= 0) {
55
+ // We have less than the full message
56
+ if (this.logsEnabled) console.log("[Sleeper] Building message: ", this.partialMessage.length, this.messageLength, remainingLength);
57
+ return;
58
+ }
59
+ }
60
+
61
+ try {
62
+ const json = JSON.parse(this.partialMessage);
63
+ this.partialMessage = '';
64
+ this.messageLength = 0;
65
+
66
+ this.onMessageRecieved({
67
+ type: this.messageType,
68
+ data: json,
69
+ });
70
+ } catch (e) {
71
+ console.log("[Sleeper] Failed to parse message: ", e);
72
+ return;
73
+ }
74
+ }
75
+ }
76
+
77
+ };
78
+
79
+ module.exports = PacketParser;
@@ -0,0 +1,18 @@
1
+ import Rx from 'rx';
2
+
3
+ class MiniLogger {
4
+ public static messages = new Rx.Subject;
5
+
6
+ static log(...args: any[]) {
7
+ this.messages.onNext({
8
+ type: 'mini_dev_server',
9
+ action: 'onConsoleLog',
10
+ message: Array.from(args).join(' '),
11
+ });
12
+ }
13
+ }
14
+
15
+ // Add global function for mini logging
16
+ global.log_mini = (...args: any[]) => { MiniLogger.log(...args); }
17
+
18
+ export default MiniLogger;
@@ -0,0 +1,85 @@
1
+ import React from 'react';
2
+ import {TextProps, View} from 'react-native';
3
+ import {Federated} from '@callstack/repack/client';
4
+ import type {ButtonProps} from '../../declarations/button';
5
+ import type {JerseyProps} from '../../declarations/jersey';
6
+ import type {SwitchProps} from '../../declarations/switch';
7
+ import { AvatarProps, AvatarLeagueProps, AvatarPlayerProps, AvatarTeamProps } from '../../declarations/avatar';
8
+
9
+ const _SleeperModule = React.lazy(() =>
10
+ Federated.importModule('sleeper', 'index').catch(() => ({
11
+ default: props => {
12
+ console.log(
13
+ `[Sleeper] Failed to load <${props?.component}>. Check connection to the app.`,
14
+ );
15
+ return <View />;
16
+ },
17
+ })),
18
+ );
19
+
20
+ const Avatar = (props: AvatarProps) => {
21
+ return (
22
+ <React.Suspense fallback={<View />}>
23
+ <_SleeperModule component="Avatar" {...props} />
24
+ </React.Suspense>
25
+ );
26
+ };
27
+
28
+ const AvatarLeague = (props: AvatarLeagueProps) => {
29
+ return (
30
+ <React.Suspense fallback={<View />}>
31
+ <_SleeperModule component="AvatarLeague" {...props} />
32
+ </React.Suspense>
33
+ );
34
+ };
35
+
36
+ const AvatarPlayer = (props: AvatarPlayerProps) => {
37
+ return (
38
+ <React.Suspense fallback={<View />}>
39
+ <_SleeperModule component="AvatarPlayer" {...props} />
40
+ </React.Suspense>
41
+ );
42
+ };
43
+
44
+ const AvatarTeam = (props: AvatarTeamProps) => {
45
+ return (
46
+ <React.Suspense fallback={<View />}>
47
+ <_SleeperModule component="AvatarTeam" {...props} />
48
+ </React.Suspense>
49
+ );
50
+ };
51
+
52
+ const Button = (props: ButtonProps) => {
53
+ return (
54
+ <React.Suspense fallback={<View />}>
55
+ <_SleeperModule component="Button" {...props} />
56
+ </React.Suspense>
57
+ );
58
+ };
59
+
60
+ const Text = (props: TextProps) => {
61
+ return (
62
+ <React.Suspense fallback={<View />}>
63
+ <_SleeperModule component="Text" {...props} />
64
+ </React.Suspense>
65
+ );
66
+ };
67
+
68
+ const Switch = (props: SwitchProps) => {
69
+ return (
70
+ <React.Suspense fallback={<View />}>
71
+ <_SleeperModule component="Switch" {...props} />
72
+ </React.Suspense>
73
+ );
74
+ };
75
+
76
+ const Jersey = (props: JerseyProps) => {
77
+ return (
78
+ <React.Suspense fallback={<View />}>
79
+ <_SleeperModule component="Jersey" {...props} />
80
+ </React.Suspense>
81
+ );
82
+ };
83
+
84
+ export type {ButtonProps, TextProps, JerseyProps, SwitchProps};
85
+ export {Button, Text, Jersey, Switch, Avatar, AvatarLeague, AvatarPlayer, AvatarTeam};