@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.
- package/.github/pull_request_template.md +8 -0
- package/README.md +9 -0
- package/bin/build_mini.js +189 -0
- package/bin/preload_packages.js +58 -0
- package/declarations/avatar/index.d.ts +23 -0
- package/declarations/button/index.d.ts +37 -0
- package/declarations/index.d.ts +5 -0
- package/declarations/jersey/index.d.ts +9 -0
- package/declarations/navigation/index.d.ts +35 -0
- package/declarations/sleeper_actions.d.ts +8 -0
- package/declarations/sleeper_context.d.ts +28 -0
- package/declarations/sleeper_message.d.ts +12 -0
- package/declarations/switch/index.d.ts +3 -0
- package/declarations/text/index.d.ts +14 -0
- package/declarations/types/components/app_icon_switch.d.ts +24 -0
- package/declarations/types/components/jersey.d.ts +3 -0
- package/declarations/types/index.d.ts +33 -0
- package/declarations/types/minis/index.d.ts +71 -0
- package/declarations/types/shared/graphql.d.ts +258 -0
- package/declarations/types/utils/toast_helper.d.ts +9 -0
- package/index.ts +7 -0
- package/mini_packages.json +109 -0
- package/package.json +87 -0
- package/src/common/packet_parser.js +79 -0
- package/src/components/MiniLogger.ts +18 -0
- package/src/components/index.tsx +85 -0
- package/src/dev_server/index.tsx +253 -0
- package/src/dev_server/url_resolver.tsx +72 -0
- package/src/plugins/rebuildNotifyPlugin.js +37 -0
- package/src/plugins/send_events.mjs +87 -0
- package/src/styles/fonts.ts +139 -0
- package/src/styles/index.ts +2 -0
- package/src/styles/theme.ts +69 -0
- package/src/types/index.ts +17 -0
- package/start.tsx +105 -0
- package/webpack.config.js +325 -0
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Sleeper-Mini Core
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
This package contains built in sleeper UI components and dev server functionality for creating mini apps.
|
|
8
|
+
|
|
9
|
+
Please see the main repo at [sleeper-mini](https://github.com/blitzstudios/sleeper-mini) for more information.
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const readLine = require('readline');
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
|
|
9
|
+
const isWindows = os.platform() === 'win32';
|
|
10
|
+
|
|
11
|
+
const getCommands = (projectName) => {
|
|
12
|
+
// Pathing
|
|
13
|
+
const distPath = path.join('dist', projectName);
|
|
14
|
+
const zipFilePath = `${distPath}.zip`;
|
|
15
|
+
const assetsDestPath = {
|
|
16
|
+
ios: path.join(distPath, 'ios'),
|
|
17
|
+
android: path.join(distPath, 'android'),
|
|
18
|
+
};
|
|
19
|
+
const bundleOutputPath = {
|
|
20
|
+
ios: path.join(assetsDestPath["ios"], 'index.bundle'),
|
|
21
|
+
android: path.join(assetsDestPath["android"], 'index.bundle'),
|
|
22
|
+
};
|
|
23
|
+
const sourcemapOutputPath = {
|
|
24
|
+
ios: path.join(assetsDestPath["ios"], 'index.bundle.map'),
|
|
25
|
+
android: path.join(assetsDestPath["android"], 'index.bundle.map'),
|
|
26
|
+
};
|
|
27
|
+
const reactNativeCliPath = path.join('node_modules', 'react-native', 'cli.js');
|
|
28
|
+
|
|
29
|
+
// Commands
|
|
30
|
+
const removeDir = (isWindows ? 'rmdir /s /q ' : 'rm -rf ');
|
|
31
|
+
// TODO (Windows): double check this zip command.
|
|
32
|
+
const zip = isWindows ?
|
|
33
|
+
`powershell Compress-Archive -Path "${distPath}" -DestinationPath "${zipFilePath}"` :
|
|
34
|
+
`cd dist && zip -r "${projectName}.zip" * && cd -`;
|
|
35
|
+
const cleanIndex = `${removeDir} "${bundleOutputPath["ios"]}" "${bundleOutputPath["android"]}" "${sourcemapOutputPath["ios"]}" "${sourcemapOutputPath["android"]}"`;
|
|
36
|
+
const cleanAll = `${removeDir} dist node_modules`;
|
|
37
|
+
const cleanBuild = `${removeDir} "${distPath}" "${assetsDestPath["ios"]}" "${assetsDestPath["android"]}"`;
|
|
38
|
+
const install = `yarn install`;
|
|
39
|
+
|
|
40
|
+
const getBundleCommand = (platform) => {
|
|
41
|
+
return `node "${reactNativeCliPath}" webpack-bundle \
|
|
42
|
+
--entry-file ./node_modules/@sleeperhq/mini-core/start.tsx \
|
|
43
|
+
--platform ${platform} \
|
|
44
|
+
--dev false \
|
|
45
|
+
--reset-cache \
|
|
46
|
+
--bundle-output "${bundleOutputPath[platform]}" \
|
|
47
|
+
--sourcemap-output "${sourcemapOutputPath[platform]}" \
|
|
48
|
+
--minify true \
|
|
49
|
+
--assets-dest "${assetsDestPath[platform]}" \
|
|
50
|
+
--webpackConfig ./node_modules/@sleeperhq/mini-core/webpack.config.js`;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Exposed
|
|
54
|
+
return {
|
|
55
|
+
bundleIOS: getBundleCommand('ios'),
|
|
56
|
+
bundleAndroid: getBundleCommand('android'),
|
|
57
|
+
zip,
|
|
58
|
+
cleanIndex,
|
|
59
|
+
cleanAll,
|
|
60
|
+
cleanBuild,
|
|
61
|
+
zipFilePath,
|
|
62
|
+
install,
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const spawnProcess = (command, errorMessage) => {
|
|
67
|
+
return new Promise((resolve) => {
|
|
68
|
+
const child = isWindows
|
|
69
|
+
? spawn('cmd.exe', ['/c', command])
|
|
70
|
+
: spawn(command, { env: process.env, shell: process.env.SHELL || true });
|
|
71
|
+
|
|
72
|
+
child.stdout.on('data', (data) => {
|
|
73
|
+
process.stdout.write(data); // output the data to the console
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
child.stderr.on('data', (data) => {
|
|
77
|
+
process.stderr.write(data); // output the error to the console
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
child.on('close', (code) => {
|
|
81
|
+
if (code !== 0) {
|
|
82
|
+
printError(errorMessage || `command exited with non-zero code: ${code}`);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
resolve();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const printError = (error) => {
|
|
91
|
+
console.error("\n\033[91m" + error + "\033[0m");
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const printInfo = (message) => {
|
|
95
|
+
console.log("\n\033[96m" + message + "\033[0m");
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const printComplete = (message) => {
|
|
99
|
+
console.log("\033[92m" + message + "\033[0m");
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const getInput = (message, fallback) => {
|
|
103
|
+
const interface = readLine.createInterface({
|
|
104
|
+
input: process.stdin,
|
|
105
|
+
output: process.stdout
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
return new Promise((resolve) => {
|
|
109
|
+
interface.question("\n\033[96m[current: " + fallback + "]\033[0m " + message, (name) => {
|
|
110
|
+
const result = name.trim();
|
|
111
|
+
if (!result) {
|
|
112
|
+
resolve(fallback);
|
|
113
|
+
} else {
|
|
114
|
+
resolve(name.trim());
|
|
115
|
+
}
|
|
116
|
+
interface.close();
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const getProjectName = () => {
|
|
122
|
+
const appJsonPath = 'app.json';
|
|
123
|
+
const appJson = JSON.parse(fs.readFileSync(appJsonPath));
|
|
124
|
+
return appJson.name;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const setProjectName = (name) => {
|
|
128
|
+
const podfilePath = path.join('ios', 'Podfile');
|
|
129
|
+
const podfileString = fs.readFileSync(podfilePath).toString();
|
|
130
|
+
const newPodfileString = podfileString.replace(/target '.*'/, `target '${name}'`);
|
|
131
|
+
fs.writeFileSync(podfilePath, newPodfileString);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const validateProjectName = (name) => {
|
|
135
|
+
const regex = /^[a-zA-Z0-9_]+$/;
|
|
136
|
+
return regex.test(name);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const main = async () => {
|
|
140
|
+
// Enter project name.
|
|
141
|
+
const fallback = getProjectName();
|
|
142
|
+
const projectName = await getInput("Enter project name (return to skip): ", fallback);
|
|
143
|
+
if (!validateProjectName(projectName)) {
|
|
144
|
+
printError("Invalid project name. Only alphanumeric characters and underscores are allowed.");
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (projectName !== fallback) {
|
|
149
|
+
await spawnProcess(`yarn react-native-rename "${projectName}" --skipAllGitChecks`, "rename command exited with non-zero code");
|
|
150
|
+
setProjectName(projectName);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const commands = getCommands(projectName);
|
|
154
|
+
|
|
155
|
+
const shouldClean = await getInput("Clean and rebuild project? (y/n): ", 'y');
|
|
156
|
+
if (shouldClean === 'y') {
|
|
157
|
+
// Clean build folders
|
|
158
|
+
await spawnProcess(commands.cleanAll, "clean command exited with non-zero code");
|
|
159
|
+
|
|
160
|
+
// Run yarn
|
|
161
|
+
await spawnProcess(commands.install, "install command exited with non-zero code");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Build iOS
|
|
165
|
+
printInfo("Building iOS...");
|
|
166
|
+
await spawnProcess(commands.bundleIOS, "webpack-bundle ios command exited with non-zero code");
|
|
167
|
+
printComplete("iOS build complete.");
|
|
168
|
+
|
|
169
|
+
// Build Android
|
|
170
|
+
printInfo("Building Android...");
|
|
171
|
+
await spawnProcess(commands.bundleAndroid, "webpack-bundle android command exited with non-zero code");
|
|
172
|
+
printComplete("Android build complete.");
|
|
173
|
+
|
|
174
|
+
// Copy the app.json file to the dist folder
|
|
175
|
+
fs.copyFileSync('app.json', path.join('dist', projectName, 'app.json'));
|
|
176
|
+
|
|
177
|
+
// Create Zip Archive
|
|
178
|
+
printInfo("Creating zip archive...");
|
|
179
|
+
await spawnProcess(commands.cleanIndex, "clean index command exited with non-zero code");
|
|
180
|
+
await spawnProcess(commands.zip, "zip command exited with non-zero code");
|
|
181
|
+
printComplete(`Zip archive created successfully at ${commands.zipFilePath}`);
|
|
182
|
+
|
|
183
|
+
// Clean build folders
|
|
184
|
+
await spawnProcess(commands.cleanBuild, "clean build command exited with non-zero code");
|
|
185
|
+
|
|
186
|
+
process.exit(0);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
main();
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const printError = (error) => {
|
|
8
|
+
console.error("\n\033[91m" + error + "\033[0m");
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const printInfo = (message) => {
|
|
12
|
+
console.log("\n\033[96m" + message + "\033[0m");
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const printComplete = (message) => {
|
|
16
|
+
console.log("\033[92m" + message + "\033[0m");
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const main = async () => {
|
|
20
|
+
// Load the package.json
|
|
21
|
+
const packageJsonPath = path.join('package.json');
|
|
22
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
|
|
23
|
+
|
|
24
|
+
// Get the dependencies
|
|
25
|
+
const dependencies = packageJson.dependencies;
|
|
26
|
+
|
|
27
|
+
// Remove packages that cause conflicts
|
|
28
|
+
delete dependencies['@babel/runtime'];
|
|
29
|
+
delete dependencies['@babel/plugin-transform-runtime'];
|
|
30
|
+
delete dependencies['regenerator-runtime'];
|
|
31
|
+
|
|
32
|
+
// Write a ./package_list.js file that imports all dependencies
|
|
33
|
+
const packageListPath = path.join('package_list.js');
|
|
34
|
+
const packageList = Object.keys(dependencies).map(
|
|
35
|
+
(packageName) => `import '${packageName}';`
|
|
36
|
+
).join('\n');
|
|
37
|
+
|
|
38
|
+
let output =
|
|
39
|
+
`/*
|
|
40
|
+
This file is automatically generated when you
|
|
41
|
+
add a package to your package.json and run yarn.
|
|
42
|
+
Please do not edit manually.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
${packageList}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
fs.writeFileSync(packageListPath, output);
|
|
49
|
+
|
|
50
|
+
// Write a ./mini_packages.json file that shows all available packages in sleeper.
|
|
51
|
+
const source = 'node_modules/@sleeperhq/mini-core/mini_packages.json';
|
|
52
|
+
const destination = 'mini_packages.json';
|
|
53
|
+
fs.copyFile(source, destination, () => {});
|
|
54
|
+
|
|
55
|
+
process.exit(0);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
main();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { League, Player, User } from "@sleeperhq/mini-core/declarations/types/shared/graphql.d";
|
|
3
|
+
export interface AvatarProps {
|
|
4
|
+
user: User;
|
|
5
|
+
width?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const Avatar: React.MemoExoticComponent<(props: AvatarProps) => React.JSX.Element>;
|
|
8
|
+
export interface AvatarPlayerProps {
|
|
9
|
+
player: Player;
|
|
10
|
+
width?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const AvatarPlayer: React.MemoExoticComponent<(props: AvatarPlayerProps) => React.JSX.Element>;
|
|
13
|
+
export interface AvatarTeamProps {
|
|
14
|
+
team: string;
|
|
15
|
+
sport: string;
|
|
16
|
+
width?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const AvatarTeam: React.MemoExoticComponent<(props: AvatarTeamProps) => React.JSX.Element>;
|
|
19
|
+
export interface AvatarLeagueProps {
|
|
20
|
+
league: League;
|
|
21
|
+
width?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare const AvatarLeague: React.MemoExoticComponent<(props: AvatarLeagueProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { GestureResponderEvent } from 'react-native';
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
height?: number;
|
|
5
|
+
gradient?: (string | number)[];
|
|
6
|
+
start?: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
end?: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
disable?: boolean;
|
|
15
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
16
|
+
text?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const Button: {
|
|
19
|
+
(props: ButtonProps): React.JSX.Element;
|
|
20
|
+
defaultProps: {
|
|
21
|
+
height: number;
|
|
22
|
+
shadowHeight: number;
|
|
23
|
+
gradient: string[];
|
|
24
|
+
type: string;
|
|
25
|
+
size: string;
|
|
26
|
+
isForSmallScreen: boolean;
|
|
27
|
+
start: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
end: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export default Button;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColorValue, ViewStyle } from 'react-native';
|
|
2
|
+
import SleeperJersey from '@sleeperhq/mini-core/declarations/types/components/jersey.d';
|
|
3
|
+
export interface JerseyProps {
|
|
4
|
+
style: ViewStyle;
|
|
5
|
+
sport: 'nfl' | 'nba' | 'cbb' | 'cfb' | 'mlb';
|
|
6
|
+
number: string;
|
|
7
|
+
fill: ColorValue;
|
|
8
|
+
}
|
|
9
|
+
export default SleeperJersey;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LeagueId, PlayerId, RosterId, SportType, TransactionId } from '@sleeperhq/mini-core/declarations/types';
|
|
2
|
+
export type NavigationParams = {
|
|
3
|
+
LeaguesIndexScreen: undefined;
|
|
4
|
+
LeaguesDetailScreen: LeaguesDetailScreenParams;
|
|
5
|
+
ScoreIndexScreen: undefined;
|
|
6
|
+
ScoreDetailScreen: undefined;
|
|
7
|
+
PicksIndexScreen: undefined;
|
|
8
|
+
FeedIndexScreen: undefined;
|
|
9
|
+
WebviewScreen: undefined;
|
|
10
|
+
ManageChannelsScreen: undefined;
|
|
11
|
+
MinisIndexScreen: undefined;
|
|
12
|
+
LeftDrawer: undefined;
|
|
13
|
+
TradeCenterTransactionScreen: TradeCenterTransactionScreenParams;
|
|
14
|
+
TradeCenterPlayersScreen: TradeCenterPlayersScreenParams;
|
|
15
|
+
PlayerPopupScreen: PlayerPopupScreenParams;
|
|
16
|
+
};
|
|
17
|
+
export type NavigationScreen = keyof NavigationParams;
|
|
18
|
+
export type LeaguesDetailScreenParams = {
|
|
19
|
+
leagueId: LeagueId;
|
|
20
|
+
};
|
|
21
|
+
export type TradeCenterTransactionScreenParams = {
|
|
22
|
+
leagueId: LeagueId;
|
|
23
|
+
transactionId: TransactionId;
|
|
24
|
+
};
|
|
25
|
+
export type TradeCenterPlayersScreenParams = {
|
|
26
|
+
leagueId: LeagueId;
|
|
27
|
+
myRosterId: RosterId;
|
|
28
|
+
rosterIds?: RosterId[];
|
|
29
|
+
addMap?: Record<RosterId, PlayerId[]>;
|
|
30
|
+
dropMap?: Record<RosterId, PlayerId[]>;
|
|
31
|
+
};
|
|
32
|
+
export type PlayerPopupScreenParams = {
|
|
33
|
+
playerId: PlayerId;
|
|
34
|
+
sport: SportType;
|
|
35
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NavigationParams, NavigationScreen, ToastConfig, Notification } from '@sleeperhq/mini-core/declarations/types';
|
|
2
|
+
export type SleeperActions = {
|
|
3
|
+
navigate?: <T extends NavigationScreen>(screen: T, params?: NavigationParams[T]) => void;
|
|
4
|
+
requestLocation?: () => void;
|
|
5
|
+
showToast?: (toastData: ToastConfig) => void;
|
|
6
|
+
scheduleNotification?: (notification: Notification) => Promise<string>;
|
|
7
|
+
cancelNotification?: (notificationId: string) => Promise<void>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { User, League, LeaguesMap, RostersInLeagueMap, UserMap, MatchupsInLeagueMap, UsersInLeagueMap, PlayoffsInLeagueMap, TransactionsInLeagueMap, TransactionsMap, SportInfoMap, DraftsInLeagueMap, DraftPickTradesInLeagueMap, DraftPicksInDraftMap, PlayersInSportMap, Topic, Location, SportType } from '@sleeperhq/mini-core/declarations/types';
|
|
2
|
+
import type { SleeperActions } from '@sleeperhq/mini-core/declarations/sleeper_actions';
|
|
3
|
+
declare class SleeperContext {
|
|
4
|
+
static apiLevel: string;
|
|
5
|
+
user: User;
|
|
6
|
+
league: League;
|
|
7
|
+
leaguesMap: LeaguesMap;
|
|
8
|
+
leaguesMapBySport: Record<SportType, LeaguesMap>;
|
|
9
|
+
userLeagueList: string[];
|
|
10
|
+
userLeagueListBySport: Record<SportType, string[]>;
|
|
11
|
+
rostersInLeagueMap: RostersInLeagueMap;
|
|
12
|
+
userMap: UserMap;
|
|
13
|
+
matchupsInLeagueMap: MatchupsInLeagueMap;
|
|
14
|
+
usersInLeagueMap: UsersInLeagueMap;
|
|
15
|
+
playoffsInLeagueMap: PlayoffsInLeagueMap;
|
|
16
|
+
transactionsInLeagueMap: TransactionsInLeagueMap;
|
|
17
|
+
transactionsMap: TransactionsMap;
|
|
18
|
+
sportInfoMap: SportInfoMap;
|
|
19
|
+
draftsInLeagueMap: DraftsInLeagueMap;
|
|
20
|
+
draftPickTradesInLeagueMap: DraftPickTradesInLeagueMap;
|
|
21
|
+
draftPicksInDraftMap: DraftPicksInDraftMap;
|
|
22
|
+
playersInSportMap: PlayersInSportMap;
|
|
23
|
+
podcasts: Topic[][];
|
|
24
|
+
videos: Topic[][];
|
|
25
|
+
location: Location;
|
|
26
|
+
actions: SleeperActions;
|
|
27
|
+
}
|
|
28
|
+
export default SleeperContext;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Entitlement, HeaderOptions, Metadata } from '@sleeperhq/mini-core/declarations/types';
|
|
2
|
+
type SocketMessage = {
|
|
3
|
+
_ip?: string;
|
|
4
|
+
_name?: string;
|
|
5
|
+
_webpack?: string;
|
|
6
|
+
_contextGet?: string;
|
|
7
|
+
_description?: string;
|
|
8
|
+
_entitlements?: Entitlement[];
|
|
9
|
+
_headerOptions?: HeaderOptions;
|
|
10
|
+
_metadata?: Metadata;
|
|
11
|
+
};
|
|
12
|
+
export default SocketMessage;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import { TextProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
color?: string;
|
|
6
|
+
inheritStyles?: boolean;
|
|
7
|
+
screenShrink?: number;
|
|
8
|
+
} & TextProps;
|
|
9
|
+
export type AppTextProps = Props;
|
|
10
|
+
export default class AppText extends PureComponent<Props> {
|
|
11
|
+
private getStyles;
|
|
12
|
+
render(): React.JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export type SwitchOption = {
|
|
4
|
+
colorToggleActive: string;
|
|
5
|
+
colorIconActive: string;
|
|
6
|
+
colorIconInactive?: string;
|
|
7
|
+
iconStyle?: any;
|
|
8
|
+
icon: any;
|
|
9
|
+
iconInactive?: any;
|
|
10
|
+
text?: string;
|
|
11
|
+
hideIconInactive?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type Props = {
|
|
14
|
+
options: [SwitchOption, SwitchOption];
|
|
15
|
+
value?: number;
|
|
16
|
+
onChange?: (value: number) => void;
|
|
17
|
+
height?: number;
|
|
18
|
+
width?: number;
|
|
19
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
20
|
+
toggleStyle?: StyleProp<ViewStyle>;
|
|
21
|
+
aspectRatio?: number;
|
|
22
|
+
confirmationFunction?: (nextSelection: 'on' | 'off', continueAction: () => void) => void;
|
|
23
|
+
};
|
|
24
|
+
export declare const AppIconSwitch: React.MemoExoticComponent<({ height, options, value, width, onChange, containerStyle, toggleStyle, aspectRatio, confirmationFunction }: Props) => React.JSX.Element>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ToastConfig as ToastConfigOriginal } from '@sleeperhq/mini-core/declarations/types/utils/toast_helper.d';
|
|
2
|
+
import { SportType } from '@sleeperhq/mini-core/declarations/types/minis/index.d';
|
|
3
|
+
export * from '@sleeperhq/mini-core/declarations/navigation/index.d';
|
|
4
|
+
export * from '@sleeperhq/mini-core/declarations/types/shared/graphql.d';
|
|
5
|
+
export * from '@sleeperhq/mini-core/declarations/types/minis/index.d';
|
|
6
|
+
export type Entitlement = 'user:email' | 'user:phone' | 'wallet:date_of_birth' | 'wallet:first_name' | 'wallet:last_name' | 'wallet:country_code' | 'wallet:city' | 'location:longitude' | 'location:latitude' | 'location:state' | 'location:country' | 'location:postalCode' | 'action:push_notification';
|
|
7
|
+
export type Entitlements = Partial<Record<Entitlement, any>>;
|
|
8
|
+
export declare const EntitlementDisplayText: Record<Entitlement, string>;
|
|
9
|
+
export type HeaderOptions = {
|
|
10
|
+
useLeagueSelector?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type Metadata = {
|
|
13
|
+
sports?: SportType[];
|
|
14
|
+
};
|
|
15
|
+
export type Mini = {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
id: string;
|
|
19
|
+
version?: number;
|
|
20
|
+
email?: string;
|
|
21
|
+
entitlements?: Entitlement[];
|
|
22
|
+
headerOptions?: HeaderOptions;
|
|
23
|
+
metadata?: Metadata;
|
|
24
|
+
};
|
|
25
|
+
export type Location = {
|
|
26
|
+
state: string;
|
|
27
|
+
country: string;
|
|
28
|
+
hasPermission: 'pending' | 'yes' | 'no';
|
|
29
|
+
};
|
|
30
|
+
export type VersionMap = Record<string, Mini>;
|
|
31
|
+
export type ToastConfig = Omit<ToastConfigOriginal, 'icon'> & {
|
|
32
|
+
icon?: 'success' | 'error';
|
|
33
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { League, Roster, User, MatchupLeg, LeagueTransaction, Draft, DraftPick, RosterDraftPick, Player, Topic } from '@sleeperhq/mini-core/declarations/types/shared/graphql.d';
|
|
2
|
+
export type LeagueId = string;
|
|
3
|
+
export type RosterId = string;
|
|
4
|
+
export type UserId = string;
|
|
5
|
+
export type MatchupWeek = number;
|
|
6
|
+
export type MatchId = string;
|
|
7
|
+
export type TransactionId = string;
|
|
8
|
+
export type SportType = string;
|
|
9
|
+
export type DraftId = string;
|
|
10
|
+
export type PlayerId = string;
|
|
11
|
+
export type TopicId = 'podcasts' | 'videos';
|
|
12
|
+
export type { Topic };
|
|
13
|
+
export type BracketFrom = {
|
|
14
|
+
w?: RosterId;
|
|
15
|
+
l?: RosterId;
|
|
16
|
+
};
|
|
17
|
+
export type Bracket = {
|
|
18
|
+
round: number;
|
|
19
|
+
matchId: MatchId;
|
|
20
|
+
t1: RosterId;
|
|
21
|
+
t2: RosterId;
|
|
22
|
+
w: RosterId;
|
|
23
|
+
l: RosterId;
|
|
24
|
+
t1_from: BracketFrom;
|
|
25
|
+
t2_from: BracketFrom;
|
|
26
|
+
};
|
|
27
|
+
export type BracketSet = {
|
|
28
|
+
bracket: Bracket[];
|
|
29
|
+
loserBracket: Bracket[];
|
|
30
|
+
};
|
|
31
|
+
export type SportInfo = {
|
|
32
|
+
season_type: string;
|
|
33
|
+
season: string;
|
|
34
|
+
week?: number;
|
|
35
|
+
display_week?: number;
|
|
36
|
+
leg?: number;
|
|
37
|
+
league_season?: string;
|
|
38
|
+
league_create_season?: string;
|
|
39
|
+
previous_season?: string;
|
|
40
|
+
season_start_date?: string;
|
|
41
|
+
season_end_date?: string;
|
|
42
|
+
};
|
|
43
|
+
export type LeaguesMap = Record<LeagueId, League>;
|
|
44
|
+
export type RostersMap = Record<RosterId, Roster>;
|
|
45
|
+
export type RostersInLeagueMap = Record<LeagueId, RostersMap>;
|
|
46
|
+
export type UserMap = Record<UserId, User>;
|
|
47
|
+
export type MathchupWeekMap = Record<MatchupWeek, MatchupLeg>;
|
|
48
|
+
export type MatchupsInLeagueMap = Record<LeagueId, MathchupWeekMap>;
|
|
49
|
+
export type UsersInLeagueMap = Record<LeagueId, UserMap>;
|
|
50
|
+
export type PlayoffsInLeagueMap = Record<LeagueId, BracketSet>;
|
|
51
|
+
export type TransactionsInLeagueMap = Record<LeagueId, TransactionId[]>;
|
|
52
|
+
export type TransactionsMap = Record<TransactionId, LeagueTransaction>;
|
|
53
|
+
export type SportInfoMap = Record<SportType, SportInfo>;
|
|
54
|
+
export type DraftsInLeagueMap = Record<LeagueId, Draft[]>;
|
|
55
|
+
export type DraftPickTradesInLeagueMap = Record<LeagueId, RosterDraftPick[]>;
|
|
56
|
+
export type DraftPicksInDraftMap = Record<DraftId, DraftPick[]>;
|
|
57
|
+
export type PlayersMap = Record<PlayerId, Player>;
|
|
58
|
+
export type PlayersInSportMap = Record<SportType, PlayersMap>;
|
|
59
|
+
export type Notification = {
|
|
60
|
+
title?: string | undefined;
|
|
61
|
+
body?: string | undefined;
|
|
62
|
+
timestamp?: number;
|
|
63
|
+
};
|
|
64
|
+
export declare const EventHandlerResult: {
|
|
65
|
+
readonly CONSUMED: "CONSUMED";
|
|
66
|
+
readonly PROPAGATE: "PROPAGATE";
|
|
67
|
+
};
|
|
68
|
+
export type EventHandlerResultType = typeof EventHandlerResult[keyof typeof EventHandlerResult];
|
|
69
|
+
export type Events = {
|
|
70
|
+
onBackButtonPressed?: () => EventHandlerResultType;
|
|
71
|
+
};
|