@sleeperhq/mini-core 1.0.1 → 1.0.3

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.
@@ -0,0 +1,8 @@
1
+ ### Description
2
+
3
+
4
+ ### How To Test
5
+
6
+ 1.
7
+
8
+ ### Screenshots/Video
@@ -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): 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,3 @@
1
+ export * from './types';
2
+ declare const _default: any;
3
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { ColorValue, ViewStyle } from 'react-native';
2
+ import SleeperJersey from 'components/ui/jersey';
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,5 @@
1
+ import { NavigationType, NavigationTypeId } from './types';
2
+ declare class SleeperActions {
3
+ navigate: (navType: NavigationType, navTypeId: NavigationTypeId) => void;
4
+ }
5
+ export default SleeperActions;
@@ -0,0 +1,10 @@
1
+ import { User, Navigation, League } from './types';
2
+ import SleeperActions from './sleeper_actions';
3
+ declare class SleeperContext {
4
+ user: User;
5
+ navigation: Navigation;
6
+ league: League;
7
+ actions: SleeperActions;
8
+ constructor(user: User, navigation: Navigation, league: League);
9
+ }
10
+ export default SleeperContext;
@@ -0,0 +1,13 @@
1
+ import { PureComponent } from 'react';
2
+ import { TextProps } from 'react-native';
3
+ declare type Props = {
4
+ color?: string;
5
+ inheritStyles?: boolean;
6
+ screenShrink?: number;
7
+ } & TextProps;
8
+ export declare type AppTextProps = Props;
9
+ export default class AppText extends PureComponent<Props> {
10
+ private getStyles;
11
+ render(): JSX.Element;
12
+ }
13
+ export {};
@@ -0,0 +1,9 @@
1
+ import { NAVIGATION_ID, NAVIGATION_TYPE } from './redux/native_nav/constants.d';
2
+ export declare type NavigationType = typeof NAVIGATION_TYPE[keyof typeof NAVIGATION_TYPE];
3
+ export declare type NavigationTypeId = typeof NAVIGATION_ID[keyof typeof NAVIGATION_ID];
4
+ export * from './shared/graphql.d';
5
+ export declare type Navigation = {
6
+ selectedNavType: NavigationType;
7
+ selectedNavTypeId: NavigationTypeId;
8
+ selectedNavData: {};
9
+ };
@@ -0,0 +1,23 @@
1
+ export declare const NAVIGATION_TYPE: {
2
+ readonly DM: "DM";
3
+ readonly INBOX: "INBOX";
4
+ readonly MY_FEED: "MY_FEED";
5
+ readonly FRIENDS: "FRIENDS";
6
+ readonly LEAGUE: "LEAGUE";
7
+ readonly ASYNC_SPORT: "ASYNC_SPORT";
8
+ readonly CREATE_LEAGUE: "CREATE_LEAGUE";
9
+ readonly LEAGUE_SYNC: "LEAGUE_SYNC";
10
+ readonly DRAFTBOARDS: "DRAFTBOARDS";
11
+ readonly SOLO_OVER_UNDER: "SOLO_OVER_UNDER";
12
+ readonly CHANNEL: "CHANNEL";
13
+ readonly MANAGE_CHANNELS: "MANAGE_CHANNELS";
14
+ };
15
+ export declare const NAVIGATION_ID: {
16
+ readonly DRAFTBOARDS: 1;
17
+ readonly CREATE_DM: 2;
18
+ readonly DM_SCREEN: 3;
19
+ readonly CREATE_LEAGUE: 4;
20
+ readonly MY_FEED: 5;
21
+ readonly MENTIONS: 6;
22
+ readonly FRIENDS: 7;
23
+ };
@@ -0,0 +1,98 @@
1
+ export declare type Maybe<T> = T | null;
2
+ export declare type InputMaybe<T> = Maybe<T>;
3
+ export declare type Exact<T extends {
4
+ [key: string]: unknown;
5
+ }> = {
6
+ [K in keyof T]: T[K];
7
+ };
8
+ export declare type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
9
+ [SubKey in K]?: Maybe<T[SubKey]>;
10
+ };
11
+ export declare 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 declare 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 declare type League = {
42
+ __typename?: 'League';
43
+ avatar?: Maybe<Scalars['String']>;
44
+ company_id?: Maybe<Scalars['Snowflake']>;
45
+ display_order?: Maybe<Scalars['Int']>;
46
+ draft_id?: Maybe<Scalars['Snowflake']>;
47
+ group_id?: Maybe<Scalars['Snowflake']>;
48
+ last_author_avatar?: Maybe<Scalars['String']>;
49
+ last_author_display_name?: Maybe<Scalars['String']>;
50
+ last_author_id?: Maybe<Scalars['Snowflake']>;
51
+ last_author_is_bot?: Maybe<Scalars['Boolean']>;
52
+ last_message_attachment?: Maybe<Scalars['Json']>;
53
+ last_message_id?: Maybe<Scalars['Snowflake']>;
54
+ last_message_text?: Maybe<Scalars['String']>;
55
+ last_message_text_map?: Maybe<Scalars['Json']>;
56
+ last_message_time?: Maybe<Scalars['Int']>;
57
+ last_pinned_message_id?: Maybe<Scalars['Snowflake']>;
58
+ last_read_id?: Maybe<Scalars['Snowflake']>;
59
+ last_transaction_id?: Maybe<Scalars['Snowflake']>;
60
+ league_id?: Maybe<Scalars['Snowflake']>;
61
+ matchup_legs?: Maybe<Scalars['List']>;
62
+ metadata?: Maybe<Scalars['Map']>;
63
+ name?: Maybe<Scalars['String']>;
64
+ previous_league_id?: Maybe<Scalars['Snowflake']>;
65
+ roster_positions?: Maybe<Scalars['List']>;
66
+ scoring_settings?: Maybe<Scalars['Map']>;
67
+ season?: Maybe<Scalars['String']>;
68
+ season_type?: Maybe<Scalars['String']>;
69
+ settings?: Maybe<Scalars['Map']>;
70
+ sport?: Maybe<Scalars['String']>;
71
+ status?: Maybe<Scalars['String']>;
72
+ total_rosters?: Maybe<Scalars['Int']>;
73
+ };
74
+ export declare type User = {
75
+ __typename?: 'User';
76
+ async_bundles?: Maybe<Scalars['List']>;
77
+ avatar?: Maybe<Scalars['String']>;
78
+ cookies?: Maybe<Scalars['Int']>;
79
+ created?: Maybe<Scalars['Int']>;
80
+ currencies?: Maybe<Scalars['Map']>;
81
+ data_updated?: Maybe<Scalars['Map']>;
82
+ deleted?: Maybe<Scalars['Int']>;
83
+ display_name?: Maybe<Scalars['String']>;
84
+ email?: Maybe<Scalars['String']>;
85
+ is_bot?: Maybe<Scalars['Boolean']>;
86
+ metadata?: Maybe<Scalars['Json']>;
87
+ notifications?: Maybe<Scalars['Map']>;
88
+ pending?: Maybe<Scalars['Boolean']>;
89
+ phone?: Maybe<Scalars['String']>;
90
+ real_name?: Maybe<Scalars['String']>;
91
+ solicitable?: Maybe<Scalars['Boolean']>;
92
+ summoner_name?: Maybe<Scalars['String']>;
93
+ summoner_region?: Maybe<Scalars['String']>;
94
+ token?: Maybe<Scalars['String']>;
95
+ user_id?: Maybe<Scalars['Snowflake']>;
96
+ username?: Maybe<Scalars['String']>;
97
+ verification?: Maybe<Scalars['String']>;
98
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleeperhq/mini-core",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Core library frameworks for developing Sleeper Mini Apps.",
5
5
  "main": "index.ts",
6
6
  "types": "index.d.ts",
@@ -1,13 +1,8 @@
1
1
  import React from 'react';
2
- import {
3
- ColorValue,
4
- GestureResponderEvent,
5
- TextProps,
6
- View,
7
- ViewStyle,
8
- } from 'react-native';
2
+ import {TextProps, View} from 'react-native';
9
3
  import {Federated} from '@callstack/repack/client';
10
- import {Context} from '../types';
4
+ import type {ButtonProps} from '../../declarations/button';
5
+ import type {JerseyProps} from '../../declarations/jersey';
11
6
 
12
7
  const _SleeperModule = React.lazy(() =>
13
8
  Federated.importModule('sleeper', 'index').catch(() => ({
@@ -20,15 +15,6 @@ const _SleeperModule = React.lazy(() =>
20
15
  })),
21
16
  );
22
17
 
23
- type ButtonProps = {
24
- height?: number;
25
- gradient?: (string | number)[];
26
- start?: {x: number; y: number};
27
- end?: {x: number; y: number};
28
- disable?: boolean;
29
- onPress?: (event: GestureResponderEvent) => void;
30
- text?: string;
31
- };
32
18
  const Button = (props: ButtonProps) => {
33
19
  return (
34
20
  <React.Suspense fallback={<View />}>
@@ -45,12 +31,6 @@ const Text = (props: TextProps) => {
45
31
  );
46
32
  };
47
33
 
48
- type JerseyProps = {
49
- style: ViewStyle;
50
- sport: 'nfl' | 'nba' | 'cbb' | 'cfb' | 'mlb';
51
- number: string;
52
- fill: ColorValue;
53
- };
54
34
  const Jersey = (props: JerseyProps) => {
55
35
  return (
56
36
  <React.Suspense fallback={<View />}>
@@ -59,5 +39,5 @@ const Jersey = (props: JerseyProps) => {
59
39
  );
60
40
  };
61
41
 
62
- export type {ButtonProps, Context, TextProps, JerseyProps};
42
+ export type {ButtonProps, TextProps, JerseyProps};
63
43
  export {Button, Text, Jersey};
@@ -1,19 +1,5 @@
1
- export type Maybe<T> = T | null;
2
- export type Scalars = {
3
- ID: string;
4
- String: string;
5
- Boolean: boolean;
6
- Int: number;
7
- Float: number;
8
- Json: {[key: string]: any};
9
- List: string[];
10
- Map: {[key: string]: any};
11
- MapWithSnowflakeKey: {[key: string]: any};
12
- Set: string[];
13
- Snowflake: string;
14
- SnowflakeList: string[];
15
- SnowflakeSet: string[];
16
- };
1
+ export * from '../../declarations/types/index.d';
2
+ export { default as Context } from '../../declarations/sleeper_context.d';
17
3
 
18
4
  export type Config = {
19
5
  name: string,
@@ -24,103 +10,3 @@ export type Config = {
24
10
  remoteBundlePort: number,
25
11
  release: boolean,
26
12
  };
27
-
28
- export type User = {
29
- __typename?: 'User';
30
- async_bundles?: Maybe<Scalars['List']>;
31
- avatar?: Maybe<Scalars['String']>;
32
- cookies?: Maybe<Scalars['Int']>;
33
- created?: Maybe<Scalars['Int']>;
34
- currencies?: Maybe<Scalars['Map']>;
35
- data_updated?: Maybe<Scalars['Map']>;
36
- deleted?: Maybe<Scalars['Int']>;
37
- display_name?: Maybe<Scalars['String']>;
38
- email?: Maybe<Scalars['String']>;
39
- is_bot?: Maybe<Scalars['Boolean']>;
40
- metadata?: Maybe<Scalars['Json']>;
41
- notifications?: Maybe<Scalars['Map']>;
42
- pending?: Maybe<Scalars['Boolean']>;
43
- phone?: Maybe<Scalars['String']>;
44
- real_name?: Maybe<Scalars['String']>;
45
- solicitable?: Maybe<Scalars['Boolean']>;
46
- summoner_name?: Maybe<Scalars['String']>;
47
- summoner_region?: Maybe<Scalars['String']>;
48
- token?: Maybe<Scalars['String']>;
49
- user_id?: Maybe<Scalars['Snowflake']>;
50
- username?: Maybe<Scalars['String']>;
51
- verification?: Maybe<Scalars['String']>;
52
- };
53
-
54
- export type League = {
55
- __typename?: 'League';
56
- avatar?: Maybe<Scalars['String']>;
57
- company_id?: Maybe<Scalars['Snowflake']>;
58
- display_order?: Maybe<Scalars['Int']>;
59
- draft_id?: Maybe<Scalars['Snowflake']>;
60
- group_id?: Maybe<Scalars['Snowflake']>;
61
- last_author_avatar?: Maybe<Scalars['String']>;
62
- last_author_display_name?: Maybe<Scalars['String']>;
63
- last_author_id?: Maybe<Scalars['Snowflake']>;
64
- last_author_is_bot?: Maybe<Scalars['Boolean']>;
65
- last_message_attachment?: Maybe<Scalars['Json']>;
66
- last_message_id?: Maybe<Scalars['Snowflake']>;
67
- last_message_text?: Maybe<Scalars['String']>;
68
- last_message_text_map?: Maybe<Scalars['Json']>;
69
- last_message_time?: Maybe<Scalars['Int']>;
70
- last_pinned_message_id?: Maybe<Scalars['Snowflake']>;
71
- last_read_id?: Maybe<Scalars['Snowflake']>;
72
- last_transaction_id?: Maybe<Scalars['Snowflake']>;
73
- league_id?: Maybe<Scalars['Snowflake']>;
74
- matchup_legs?: Maybe<Scalars['List']>;
75
- metadata?: Maybe<Scalars['Map']>;
76
- name?: Maybe<Scalars['String']>;
77
- previous_league_id?: Maybe<Scalars['Snowflake']>;
78
- roster_positions?: Maybe<Scalars['List']>;
79
- scoring_settings?: Maybe<Scalars['Map']>;
80
- season?: Maybe<Scalars['String']>;
81
- season_type?: Maybe<Scalars['String']>;
82
- settings?: Maybe<Scalars['Map']>;
83
- sport?: Maybe<Scalars['String']>;
84
- status?: Maybe<Scalars['String']>;
85
- total_rosters?: Maybe<Scalars['Int']>;
86
- };
87
-
88
- export type NavigationType =
89
- | 'DM'
90
- | 'INBOX'
91
- | 'MY_FEED'
92
- | 'FRIENDS'
93
- | 'LEAGUE'
94
- | 'ASYNC_SPORT'
95
- | 'CREATE_LEAGUE'
96
- | 'LEAGUE_SYNC'
97
- | 'DRAFTBOARDS'
98
- | 'SOLO_OVER_UNDER'
99
- | 'CHANNEL'
100
- | 'MANAGE_CHANNELS';
101
-
102
- export type NavigationTypeId =
103
- | 1 // DRAFTBOARDS
104
- | 2 // CREATE_DM
105
- | 3 // DM_SCREEN
106
- | 4 // CREATE_LEAGUE
107
- | 5 // MY_FEED
108
- | 6 // MENTIONS
109
- | 7; // FRIENDS
110
-
111
- export type Navigation = {
112
- selectedNavType: NavigationType;
113
- selectedNavTypeId: NavigationTypeId;
114
- selectedNavData: {};
115
- };
116
-
117
- export type Actions = {
118
- navigate: (navType?: NavigationType, navTypeId?: NavigationTypeId) => void;
119
- };
120
-
121
- export type Context = {
122
- user?: User;
123
- league?: League;
124
- navigation?: Navigation;
125
- actions?: Actions;
126
- };