diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/1_project.iml b/.idea/1_project.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/1_project.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..24eb271 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7061e05 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/my-app/src/App.js b/my-app/src/App.js deleted file mode 100644 index 01b8f29..0000000 --- a/my-app/src/App.js +++ /dev/null @@ -1,59 +0,0 @@ -import React, {Component} from 'react'; -import './App.css'; -import NavBar from './components/NavBar/NavBar'; -import DialogsContainer from './components/Dialogs/DialogsContainer' -import { Route, withRouter} from 'react-router-dom'; -import UsersContainer from './components/Users/UsersContainer'; -// import ProfileContainer from './components/Profile/ProfileContainer'; -import HeaderContainer from './components/Header/HeaderContainer'; -import Login from './components/Login/Login'; -import { initializeApp } from './redux/app-reducer'; -import { connect } from 'react-redux'; -import Preloader from './components/common/Preloader'; -import { compose } from 'redux'; -import { withSuspense } from './hoc/withSuspense'; -const ProfileContainer = React.lazy(() => import('./components/Profile/ProfileContainer')); - -class App extends Component { - - componentDidMount(){ - this.props.initializeApp() - } - - render() { - if(!this.props.initialized){ - - return - } - return ( -
- - -
- - } /> - - - - } /> - } /> - - -
- -
- - - ) - } -} - -const mapStateToProps=(state)=>({ - initialized:state.app.initialized -}) - -export default compose( - withRouter, - connect(mapStateToProps, {initializeApp}) -)(App) - diff --git a/my-app/src/App.tsx b/my-app/src/App.tsx new file mode 100644 index 0000000..a1ebed9 --- /dev/null +++ b/my-app/src/App.tsx @@ -0,0 +1,65 @@ +import React, {Component} from 'react'; +import './App.css'; +import NavBar from './components/NavBar/NavBar'; +import DialogsContainer from './components/Dialogs/DialogsContainer' +import {Route, withRouter} from 'react-router-dom'; +import UsersContainer from './components/Users/UsersContainer'; +import HeaderContainer from './components/Header/HeaderContainer'; +import Login from './components/Login/Login'; +import {initializeApp} from './redux/app-reducer'; +import {connect} from 'react-redux'; +import Preloader from './components/common/Preloader'; +import {compose} from 'redux'; +import {withSuspense} from './hoc/withSuspense'; +import {AppStateType} from "./redux/redux-store"; + +const ProfileContainer = React.lazy(() => import('./components/Profile/ProfileContainer')); + +type MapPropsType= ReturnType +type DispatchPropsType= { + initializeApp:()=>void +} + +class App extends Component { + + componentDidMount() { + this.props.initializeApp() + } + + render() { + if (!this.props.initialized) { + + return + } + return ( +
+ + +
+ + }/> + + + + }/> + }/> + + +
+ +
+ + + ) + } +} + +const mapStateToProps=(state: AppStateType)=>({ + initialized:state.app.initialized +}) + +export default compose( + withRouter, + connect(mapStateToProps, {initializeApp}) +)(App) + diff --git a/my-app/src/api/api.ts b/my-app/src/api/api.ts index ace4b15..49455a6 100644 --- a/my-app/src/api/api.ts +++ b/my-app/src/api/api.ts @@ -10,6 +10,8 @@ export const instance = axios.create({ }) export type GetItemsType={ items: Array + totalCount:number + error:string | null } export enum ResultCodesEnum{ Success=0, @@ -21,8 +23,8 @@ export enum ResultCodeForCaptchaEnum{ } -export type ResponseType = { +export type ResponseType = { data: D, resultCode: RC, - message: Array + messages: Array } \ No newline at end of file diff --git a/my-app/src/api/users-api.ts b/my-app/src/api/users-api.ts index 688b9f6..6750366 100644 --- a/my-app/src/api/users-api.ts +++ b/my-app/src/api/users-api.ts @@ -27,7 +27,7 @@ export const usersAPI = { return instance.get(`profile/status/${userId}`).then(res=>res.data) }, updateStatus(status: string) { - return instance.put(`profile/status`, {status: status}).then(res=>res.data) + return instance.put(`profile/status`, {status: status}).then(res=>res.data) }, savePhoto(photo: any) { const form = new FormData(); diff --git a/my-app/src/components/Dialogs/Dialogs.jsx b/my-app/src/components/Dialogs/Dialogs.tsx similarity index 68% rename from my-app/src/components/Dialogs/Dialogs.jsx rename to my-app/src/components/Dialogs/Dialogs.tsx index 9c505d8..5768f93 100644 --- a/my-app/src/components/Dialogs/Dialogs.jsx +++ b/my-app/src/components/Dialogs/Dialogs.tsx @@ -2,20 +2,33 @@ import React from 'react'; import styles from './Dialogs.module.css' import DialogsItem from './DialogsItem/DialogsItem' import Messages from './Messages/Messages'; -import { Field, reduxForm } from 'redux-form'; +import {Field, InjectedFormProps, reduxForm} from 'redux-form'; import { Textarea } from '../common/FormsControls/FormsContols'; import { required, maxLengthCreator } from '../../utils/validators.js/validator'; +import {initialStateType} from "../../redux/dialogs-reducer"; const maxLength10=maxLengthCreator(10) -const Dialogs = (props) => { +type PropsType = { + dialogsPage: initialStateType, + sendMessage: (messageText:string)=>void +} + +type OwnPropsType = {} + +export type NewMessageFormType={ + newMessageBody:string +} + + +const Dialogs: React.FC = (props) => { let state=props.dialogsPage; let newDialogsData=state.dialogsData.map(val=>); let newMessagesData=state.messagesData.map(val=>); - let addNewMessage=(values)=>{ + let addNewMessage=(values: NewMessageFormType)=>{ props.sendMessage(values.newMessageBody); } @@ -30,6 +43,7 @@ const Dialogs = (props) => {
{newMessagesData} +
@@ -37,7 +51,8 @@ const Dialogs = (props) => { ) } -const DialogsForm = (props) => { +const DialogsForm :React.FC & OwnPropsType> + = (props) => { return (
@@ -49,7 +64,7 @@ const DialogsForm = (props) => { ) } -const DialogsFormRedux=reduxForm({ +const DialogsFormRedux=reduxForm({ form:"NewMessage" })(DialogsForm) diff --git a/my-app/src/components/Dialogs/DialogsContainer.jsx b/my-app/src/components/Dialogs/DialogsContainer.jsx deleted file mode 100644 index 9a93cc3..0000000 --- a/my-app/src/components/Dialogs/DialogsContainer.jsx +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react'; -import { sendMessageCreator } from '../../redux/dialogs-reducer'; -import Dialogs from "./Dialogs" -import { connect } from 'react-redux'; -import { withAuthRedirect } from '../../hoc/withAuthRedirect'; -import { compose } from 'redux'; - -let mapStateToProps=(state)=>{ - return{ - dialogsPage: state.dialogsPage - } -} - -let mapDispatchToProps=(dispatch)=>{ - return{ - sendMessage:(newMessageBody)=>{ - dispatch(sendMessageCreator(newMessageBody)) - - } - } -} - - - -export default compose( - connect(mapStateToProps, mapDispatchToProps), - withAuthRedirect -)(Dialogs); \ No newline at end of file diff --git a/my-app/src/components/Dialogs/DialogsContainer.tsx b/my-app/src/components/Dialogs/DialogsContainer.tsx new file mode 100644 index 0000000..1551bb9 --- /dev/null +++ b/my-app/src/components/Dialogs/DialogsContainer.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import Dialogs from "./Dialogs" +import { connect } from 'react-redux'; +import { withAuthRedirect } from '../../hoc/withAuthRedirect'; +import { compose } from 'redux'; +import {actions} from "../../redux/dialogs-reducer"; +import {AppStateType} from "../../redux/redux-store"; + + + +let mapStateToProps=(state: AppStateType)=>{ + return{ + dialogsPage: state.dialogsPage + } +} + + + +export default compose( + connect(mapStateToProps, {...actions}), + withAuthRedirect +)(Dialogs); \ No newline at end of file diff --git a/my-app/src/components/Profile/MyPosts/MyPostsContainer.jsx b/my-app/src/components/Profile/MyPosts/MyPostsContainer.jsx index 48b83b4..6920f38 100644 --- a/my-app/src/components/Profile/MyPosts/MyPostsContainer.jsx +++ b/my-app/src/components/Profile/MyPosts/MyPostsContainer.jsx @@ -1,6 +1,6 @@ import React from 'react'; import MyPosts from './MyPosts' -import { newPostActionCreator, updatePostActionCreator } from '../../../redux/profile-reducer'; +import { actions } from '../../../redux/profile-reducer'; import { connect } from 'react-redux'; @@ -15,7 +15,7 @@ let mapStateToProps=(state)=>{ let mapDispatchToProps=(dispatch)=>{ return{ newPost:(newPostText)=>{ - dispatch(newPostActionCreator(newPostText)); + dispatch(actions.newPostActionCreator(newPostText)); } } } diff --git a/my-app/src/components/Users/UsersContainer.tsx b/my-app/src/components/Users/UsersContainer.tsx index b7fbe8e..5e5f883 100644 --- a/my-app/src/components/Users/UsersContainer.tsx +++ b/my-app/src/components/Users/UsersContainer.tsx @@ -90,7 +90,7 @@ let mapStateProps=(state:AppStateType)=>{ // } -export default compose( +export default compose( connect(mapStateProps, {followThunkCreator,unfollowThunkCreator,getUsersThunkCreator}) diff --git a/my-app/src/hoc/withAuthRedirect.jsx b/my-app/src/hoc/withAuthRedirect.jsx deleted file mode 100644 index 9a68697..0000000 --- a/my-app/src/hoc/withAuthRedirect.jsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import { Redirect } from 'react-router-dom'; -import { connect } from 'react-redux'; - - -let mapStateToPropsForRedirect=(state)=>({ - isAuth: state.auth.isAuth - }); - -export const withAuthRedirect=(Component)=>{ - class RedirectComponent extends React.Component{ - render(){ - - if(!this.props.isAuth) return - return - } - } - let ConnectedAuthRedirectComponent=connect(mapStateToPropsForRedirect)(RedirectComponent) - return ConnectedAuthRedirectComponent; -} \ No newline at end of file diff --git a/my-app/src/hoc/withAuthRedirect.tsx b/my-app/src/hoc/withAuthRedirect.tsx new file mode 100644 index 0000000..fa2a7be --- /dev/null +++ b/my-app/src/hoc/withAuthRedirect.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import {Redirect} from 'react-router-dom'; +import {connect} from 'react-redux'; +import {AppStateType} from "../redux/redux-store"; + + +let mapStateToPropsForRedirect=(state :AppStateType)=>({ + isAuth: state.auth.isAuth + }); + +export function withAuthRedirect(WrappedComponent: React.ComponentType){ + + function RedirectComponent(props: WCP) { + + if (!props.isAuth) return + return + } + + let ConnectedAuthRedirectComponent=connect(mapStateToPropsForRedirect)(RedirectComponent) + return ConnectedAuthRedirectComponent; +} \ No newline at end of file diff --git a/my-app/src/hoc/withSuspense.jsx b/my-app/src/hoc/withSuspense.tsx similarity index 61% rename from my-app/src/hoc/withSuspense.jsx rename to my-app/src/hoc/withSuspense.tsx index 2453112..45deeb2 100644 --- a/my-app/src/hoc/withSuspense.jsx +++ b/my-app/src/hoc/withSuspense.tsx @@ -1,8 +1,9 @@ import React, {Suspense} from 'react'; -export const withSuspense = (Component) => { - return (props) => { +export function withSuspense (Component :React.ComponentType) { + + return (props: WCP) => { return Loading...}> diff --git a/my-app/src/redux/app-reducer.ts b/my-app/src/redux/app-reducer.ts index d0cb9de..4271337 100644 --- a/my-app/src/redux/app-reducer.ts +++ b/my-app/src/redux/app-reducer.ts @@ -1,22 +1,20 @@ import { authUserThunkCreator } from "./auth-reducer"; import {ThunkAction} from "redux-thunk"; -import {AppStateType} from "./redux-store"; +import {AppStateType, InferActionsTypes} from "./redux-store"; // import {authAPI} from "../api/api"; // import {stopSubmit} from "redux-form"; -const INITIALIZED_SUCCESS="INITIALIZED_SUCCESS"; - -export type initialStateType={ - initialized:false -} -let initialState: initialStateType = { +let initialState = { initialized:false } - const appReducer=(state=initialState, action:ActionType)=>{ +export type initialStateType= typeof initialState +type ActionsType=InferActionsTypes + + const appReducer=(state=initialState, action:ActionsType) :initialStateType=>{ switch (action.type) { - case INITIALIZED_SUCCESS: + case 'SN/APP/INITIALIZED_SUCCESS': return{ ...state, initialized:true @@ -27,21 +25,17 @@ let initialState: initialStateType = { } } - type ActionType=initializedSuccessActionType; - -type initializedSuccessActionType={ - type: typeof INITIALIZED_SUCCESS +const actions={ + initializedSuccess: ()=>({type:'SN/APP/INITIALIZED_SUCCESS'} as const) } - const initializedSuccess=():initializedSuccessActionType=>({type:INITIALIZED_SUCCESS}); - -export const initializeApp = () :ThunkAction => { +export const initializeApp = () :ThunkAction => { return (dispatch) => { let promise = dispatch(authUserThunkCreator()); Promise.all([promise]).then(() => { - dispatch(initializedSuccess()); + dispatch(actions.initializedSuccess()); }) }; } diff --git a/my-app/src/redux/auth-reducer.ts b/my-app/src/redux/auth-reducer.ts index 161d332..7d6ae60 100644 --- a/my-app/src/redux/auth-reducer.ts +++ b/my-app/src/redux/auth-reducer.ts @@ -1,21 +1,10 @@ import {ResultCodeForCaptchaEnum, ResultCodesEnum} from "../api/api"; -import { stopSubmit } from "redux-form"; +import {FormAction, stopSubmit} from "redux-form"; import {ThunkAction} from "redux-thunk"; -import {AppStateType} from "./redux-store"; +import {AppStateType, BaseThunkType, InferActionsTypes} from "./redux-store"; import {authAPI} from "../api/auth-api"; import {securityAPI} from "../api/security-api"; -const SET_USER_DATA = "SET_USER_DATA"; -const GET_CAPTCHA_URL_SUCCESS= "GET_CAPTCHA_URL_SUCCESS"; - -// export type initialStateType = { -// id: number | null -// email: string | null -// login: string | null -// isAuth: boolean | null -// captcha: string | null -// } - let initialState = { id: null as number |null, @@ -25,60 +14,35 @@ let initialState = { captcha:null as string | null } -type initialStateType=typeof initialState - const authReducer = (state = initialState, action:ActionTypes):initialStateType => { switch (action.type) { - case SET_USER_DATA: + case "SN/auth/SET_USER_DATA": return { ...state, ...action.data, } - case GET_CAPTCHA_URL_SUCCESS: + case "SN/auth/GET_CAPTCHA_URL_SUCCESS": return { - id:"asdsa", ...state, captcha:action.captchaUrl, } - // case LOGIN_USER_DATA: - // return { - // ...state, - // id:action.id, - // isAuth: true - // } default: return state; } } -type ActionTypes=setAuthUserDataActionType | getCaptchaUrlActionType - -type setAuthUserDataActionDataType={ - id:number | null - email:string | null - login: string | null - isAuth:boolean -} -type setAuthUserDataActionType={ - type: typeof SET_USER_DATA - data: setAuthUserDataActionDataType -} -const setAuthUserData = (id:number|null, email:string|null, login:string|null, isAuth:boolean) :setAuthUserDataActionType=> ({ type: SET_USER_DATA, data: { id, email, login, isAuth } }); +const actions={ + setAuthUserData : (id:number|null, email:string|null, login:string|null, isAuth:boolean) => + ({ type: "SN/auth/SET_USER_DATA", data: { id, email, login, isAuth } } as const), -type getCaptchaUrlActionType={ - type:typeof GET_CAPTCHA_URL_SUCCESS - captchaUrl:string + getCaptchaUrl :(captchaUrl :string)=> ({ type: "SN/auth/GET_CAPTCHA_URL_SUCCESS", captchaUrl } as const) } -const getCaptchaUrl = (captchaUrl :string):getCaptchaUrlActionType=> ({ type: GET_CAPTCHA_URL_SUCCESS, captchaUrl }); -// const LoginAuthUserData=(id)=>({type:LOGIN_USER_DATA, id}); - -type ThunkType=ThunkAction, AppStateType, unknown, ActionTypes> export const authUserThunkCreator = () : ThunkType => { return async (dispatch) => { @@ -86,7 +50,7 @@ export const authUserThunkCreator = () : ThunkType => { if (response.resultCode === ResultCodesEnum.Success) { let { id, email, login } = response.data - dispatch(setAuthUserData(id, email, login, true)); + dispatch(actions.setAuthUserData(id, email, login, true)); } @@ -94,20 +58,20 @@ export const authUserThunkCreator = () : ThunkType => { } export const LoginUserThunkCreator = (email:string, password: string, rememberMe:boolean, captcha:string) :ThunkType => { - return async (dispatch:any) => { + return async (dispatch) => { let response = await authAPI.login(email, password, rememberMe, captcha) if (response.resultCode === ResultCodesEnum.Success) { - dispatch(authUserThunkCreator()); + await dispatch(authUserThunkCreator()); } else { if(response.resultCode===ResultCodeForCaptchaEnum.captchaIsRequired){ let captchaUrl=await securityAPI.getCaptchaUrl() - dispatch(getCaptchaUrl(captchaUrl.data.url)); + dispatch(actions.getCaptchaUrl(captchaUrl.url)); } else{ let error = response.messages[0] @@ -126,7 +90,7 @@ export const LogoutUserThunkCreator = () :ThunkType => { let response = await authAPI.logout() if (response.data.resultCode === 0) { - dispatch(setAuthUserData(null, null, null, false)); + dispatch(actions.setAuthUserData(null, null, null, false)); } @@ -135,3 +99,7 @@ export const LogoutUserThunkCreator = () :ThunkType => { } export default authReducer; + +type initialStateType=typeof initialState +type ActionTypes=InferActionsTypes +type ThunkType=BaseThunkType \ No newline at end of file diff --git a/my-app/src/redux/dialogs-reducer.ts b/my-app/src/redux/dialogs-reducer.ts index 0caf619..bf20bdc 100644 --- a/my-app/src/redux/dialogs-reducer.ts +++ b/my-app/src/redux/dialogs-reducer.ts @@ -1,5 +1,5 @@ +import {InferActionsTypes} from "./redux-store"; -const SEND_MESSAGE="SEND-MESSAGE" type dialogsDataType={ name:string @@ -31,11 +31,13 @@ let initialState = { export type initialStateType=typeof initialState - const dialogsReducer=(state=initialState, action:any):initialStateType=>{ +type ActionsType=InferActionsTypes + + const dialogsReducer=(state=initialState, action:ActionsType):initialStateType=>{ switch (action.type) { - case SEND_MESSAGE: + case "SN/DIALOGS/SEND-MESSAGE": let messageBody = action.newMessageBody; return{ ...state, @@ -46,19 +48,11 @@ export type initialStateType=typeof initialState return state } } - type sendMessageCreatorType={ - type: typeof SEND_MESSAGE - newMessageBody:string - } -export const sendMessageCreator=(newMessageBody:string): sendMessageCreatorType=>{ - - return{ - type:SEND_MESSAGE, - newMessageBody - } -} +export const actions={ + sendMessage:(newMessageBody:string)=>({type:"SN/DIALOGS/SEND-MESSAGE", newMessageBody} as const) +} // @ts-ignore export default dialogsReducer; \ No newline at end of file diff --git a/my-app/src/redux/profile-reducer.test.js b/my-app/src/redux/profile-reducer.test.js index c4ac9f1..c4990f4 100644 --- a/my-app/src/redux/profile-reducer.test.js +++ b/my-app/src/redux/profile-reducer.test.js @@ -1,5 +1,5 @@ -import profileReducer, { deletePost } from './profile-reducer'; +import profileReducer, { actions } from './profile-reducer'; let state={ postMessageData: [ @@ -10,7 +10,7 @@ let state={ } test("delete post", ()=>{ - let action=deletePost(2); + let action=actions.deletePost(2); let newState=profileReducer(state, action) expect(newState.postMessageData.length).toBe(1) diff --git a/my-app/src/redux/profile-reducer.ts b/my-app/src/redux/profile-reducer.ts index d63203a..bf8f6a6 100644 --- a/my-app/src/redux/profile-reducer.ts +++ b/my-app/src/redux/profile-reducer.ts @@ -1,14 +1,7 @@ import {PhotosType, PostType, ProfileType} from "./types/types"; import {usersAPI} from "../api/users-api"; - -// const UPDATE_POST="UPDATE-POST"; -const ADD_POST="ADD-POST" -const SET_PROFILE="SET_PROFILE" -const SET_STATUS="SET_STATUS" -const DELETE_POST="DELETE_POST" -const SAVE_PHOTO="SAVE_PHOTO" - - +import {BaseThunkType, InferActionsTypes} from "./redux-store"; +import {FormAction} from "redux-form"; let initialState={ postMessageData: [ @@ -21,12 +14,9 @@ let initialState={ status:"" } -export type initialStateType=typeof initialState - - -const profileReducer=(state=initialState, action:any):initialStateType=>{ +const profileReducer=(state=initialState, action:ActionsType):initialStateType=>{ switch (action.type){ - case ADD_POST: + case "SN/PROFILE/ADD-POST": return{ ...state, postMessageData:[...state.postMessageData, @@ -34,20 +24,20 @@ const profileReducer=(state=initialState, action:any):initialStateType=>{ ], newPostText:"" }; - case SET_PROFILE: + case "SN/PROFILE/SET_PROFILE": return{ ...state, profile:action.profile }; - case SET_STATUS: + case "SN/PROFILE/SET_STATUS": return{ ...state, status:action.status }; - case DELETE_POST: + case "SN/PROFILE/DELETE_POST": return{ ...state,postMessageData:state.postMessageData.filter(p=>p.id!==action.postId)} - case SAVE_PHOTO: + case "SN/PROFILE/SAVE_PHOTO": return{ ...state, profile:{...state.profile, photos:action.photo} as ProfileType @@ -58,108 +48,73 @@ const profileReducer=(state=initialState, action:any):initialStateType=>{ } } -type newPostActionCreatorType={ - type: typeof ADD_POST, - newPostText:string -} -export const newPostActionCreator=(newPostText:string) : newPostActionCreatorType=>{ - return{ - type:ADD_POST, - newPostText - } -} -type setProfileType={ - type: typeof SET_PROFILE, - profile:ProfileType -} -const setProfile=(profile:ProfileType) : setProfileType=>{ - - return{ - type:SET_PROFILE, - profile - } -} +export const actions={ + newPostActionCreator: (newPostText: string) => ({type: "SN/PROFILE/ADD-POST", newPostText} as const), + setProfile: (profile: ProfileType) => ({type: "SN/PROFILE/SET_PROFILE", profile} as const), + setStatus: (status: string) => ({type: "SN/PROFILE/SET_STATUS", status} as const), + savePhotoSuccess: (photo: PhotosType) => ({type: "SN/PROFILE/SAVE_PHOTO", photo} as const), + deletePost: (postId: number) => ({type: "SN/PROFILE/DELETE_POST", postId} as const) -type setStatusType={ - type: typeof SET_STATUS, - status:string } -const setStatus=(status:string):setStatusType=>{ - - return{ - type:SET_STATUS, - status - } -} - -type savePhotoSuccessType={ - type: typeof SAVE_PHOTO, - photo:PhotosType -} -const savePhotoSuccess=(photo:PhotosType): savePhotoSuccessType=>{ - - return{ - type:SAVE_PHOTO, - photo - } -} - -type deletePostType={ - type: typeof DELETE_POST, - postId:number -} -export const deletePost=(postId: number) :deletePostType=>({type:DELETE_POST,postId}); - -export const getProfileThunkCreator = (userId: number) => { - return (dispatch :any) => { - usersAPI.getProfile(userId) - .then((response: { data: ProfileType; }) => { - dispatch(setProfile(response.data)); - }); +export const getProfileThunkCreator = (userId: number) :ThunkType => { + return async (dispatch ) => { + let response =await usersAPI.getProfile(userId) + dispatch(actions.setProfile(response)) } } -export const getProfileStatusThunkCreator = (userId:number) => { - return (dispatch:any) => { - usersAPI.getStatus(userId) - .then((response: { data: string; }) => { - dispatch(setStatus(response.data)); - - }); +export const getProfileStatusThunkCreator = (userId:number) :ThunkType => { + return async (dispatch) => { + let response= await usersAPI.getStatus(userId) + dispatch(actions.setStatus(response)); } } -export const updateProfileStatusThunkCreator = (status: string) => { - return (dispatch: any) => { - usersAPI.updateStatus(status) - .then((response: { data: { resultCode: number; }; }) => { - if(response.data.resultCode===0){ - dispatch(setStatus(status)); +export const updateProfileStatusThunkCreator = (status: string): ThunkType => { + return async (dispatch) => { + try{ + let response = await usersAPI.updateStatus(status) + if (response.resultCode === 0) { + dispatch(actions.setStatus(status)); + } + } catch (error){ + throw new Error(error) } - }); - } + + } } -export const savePhoto = (photo:PhotosType) => { - return async (dispatch:any) => { +export const savePhoto = (photo:PhotosType) :ThunkType=> { + return async (dispatch) => { let response=await usersAPI.savePhoto(photo) - if(response.data.resulCode===0){ - dispatch(savePhotoSuccess(response.data.data.photos)); + if(response.resultCode===0){ + dispatch(actions.savePhotoSuccess(response.data.photos)); } } } -export const saveProfile = (profile:ProfileType) => { +export const saveProfile = (profile:ProfileType) :ThunkType => { - return async (dispatch:any, getState:any) => { + return async (dispatch, getState) => { const userId=getState().auth.id let response=await usersAPI.saveProfile(profile) - if(response.data.resulCode===0){ - dispatch(getProfileThunkCreator(userId)); + if(response.data.resultCode===0){ + if(userId!==null){ + await dispatch(getProfileThunkCreator(userId)) + } else{ + throw new Error("userid cant be null") + } + } } } + +export type initialStateType=typeof initialState +type ActionsType=InferActionsTypes +type ThunkType=BaseThunkType + + export default profileReducer \ No newline at end of file diff --git a/my-app/src/redux/redux-store.ts b/my-app/src/redux/redux-store.ts index 9adf35f..6480047 100644 --- a/my-app/src/redux/redux-store.ts +++ b/my-app/src/redux/redux-store.ts @@ -1,9 +1,9 @@ -import {combineReducers, createStore, applyMiddleware} from "redux"; +import {combineReducers, createStore, applyMiddleware, Action} from "redux"; import profileReducer from "./profile-reducer"; import dialogsReducer from "./dialogs-reducer"; import userReducer from "./user-reducer"; import authReducer from "./auth-reducer"; -import thunkMiddleware from "redux-thunk"; +import thunkMiddleware, {ThunkAction} from "redux-thunk"; import { reducer as formReducer } from 'redux-form'; import appReducer from "./app-reducer"; @@ -25,6 +25,8 @@ type PropertiesTypes = T extends {[key: string]: infer U} ? U : never export type InferActionsTypesany} >=ReturnType> +export type BaseThunkType> = ThunkAction + let store=createStore(reducers, applyMiddleware(thunkMiddleware)); // @ts-ignore diff --git a/my-app/src/redux/user-reducer.ts b/my-app/src/redux/user-reducer.ts index 81bc51b..4fdc7c3 100644 --- a/my-app/src/redux/user-reducer.ts +++ b/my-app/src/redux/user-reducer.ts @@ -1,5 +1,5 @@ import { UserType} from "./types/types"; -import {AppStateType, InferActionsTypes} from "./redux-store"; +import {AppStateType, BaseThunkType, InferActionsTypes} from "./redux-store"; import {Dispatch} from "redux"; import {ThunkAction} from "redux-thunk"; import {usersAPI} from "../api/users-api"; @@ -13,11 +13,10 @@ let initialState = { followingInProgress: [] as Array // array for user ids } -export type initialStateType =typeof initialState const userReducer = (state = initialState, action:ActionTypes): initialStateType => { switch (action.type) { - case "FOLLOW": + case "SN/USERS/FOLLOW": return { ...state, users: state.users.map(u => { @@ -27,7 +26,7 @@ const userReducer = (state = initialState, action:ActionTypes): initialStateType return u; }) } - case "UNFOLLOW": + case"SN/USERS/UNFOLLOW": return { ...state, users: state.users.map(u => { @@ -37,15 +36,15 @@ const userReducer = (state = initialState, action:ActionTypes): initialStateType return u; }) } - case 'SET_USERS': + case "SN/USERS/SET_USERS": return { ...state, users: action.users } - case 'SET_CURRENT_PAGE': + case "SN/USERS/SET_CURRENT_PAGE": return { ...state, currentPage: action.currentPage } - case 'SET_TOTAL_USERS_COUNT': + case "SN/USERS/SET_TOTAL_USERS_COUNT": return { ...state, totalUsersCount: action.count } - case 'TOGGLE_IS_FETCHING': + case "SN/USERS/TOGGLE_IS_FETCHING": return { ...state, isFetching: action.isFetching } - case 'FOLLOW_IN_PROGRESS': + case "SN/USERS/FOLLOW_IN_PROGRESS": return { ...state, followingInProgress:action.isFetching @@ -59,41 +58,38 @@ const userReducer = (state = initialState, action:ActionTypes): initialStateType } } -type ActionTypes=InferActionsTypes export const actions={ - followSuccess: (userId:number) => ({ type: 'FOLLOW', userId }as const), + followSuccess: (userId:number) => ({ type: "SN/USERS/FOLLOW", userId }as const), - unFollowSuccess: (userId:number) => ({ type: 'UNFOLLOW', userId }as const), + unFollowSuccess: (userId:number) => ({ type:"SN/USERS/UNFOLLOW", userId }as const), - setUsers: (users:Array) => ({ type: 'SET_USERS', users }as const), + setUsers: (users:Array) => ({ type: "SN/USERS/SET_USERS", users }as const), - setCurrentPage: (currentPage:number) => ({ type: 'SET_CURRENT_PAGE', currentPage }as const), + setCurrentPage: (currentPage:number) => ({ type: "SN/USERS/SET_CURRENT_PAGE", currentPage }as const), - setTotalUsersCount: (count: number) => ({ type: 'SET_TOTAL_USERS_COUNT', count }as const), + setTotalUsersCount: (count: number) => ({ type: "SN/USERS/SET_TOTAL_USERS_COUNT", count }as const), - setToggleIsFetching :(isFetching: boolean) => ({ type: 'TOGGLE_IS_FETCHING', isFetching }as const), + setToggleIsFetching :(isFetching: boolean) => ({ type: "SN/USERS/TOGGLE_IS_FETCHING", isFetching }as const), - toggleFollow :(isFetching:boolean, userId:number) => ({ type: 'FOLLOW_IN_PROGRESS', isFetching, userId }as const) + toggleFollow :(isFetching:boolean, userId:number) => ({ type: "SN/USERS/FOLLOW_IN_PROGRESS", isFetching, userId }as const) } - -type getStateType=()=>AppStateType; type DispatchType=Dispatch; -type ThunkType=ThunkAction, AppStateType, unknown, ActionTypes> -export const getUsersThunkCreator = (currentPage :number, pageSize:number) => { - return (dispatch:DispatchType, getState:getStateType) => { + +export const getUsersThunkCreator = (currentPage :number, pageSize:number) :ThunkType => { + return async (dispatch, getState) => { dispatch(actions.setToggleIsFetching(true)); dispatch(actions.setCurrentPage(currentPage)); usersAPI.getUsers(currentPage, pageSize) - .then((data: { items: Array; totalCount: number; }) => { + .then( data => { dispatch(actions.setToggleIsFetching(false)); dispatch(actions.setUsers(data.items)); dispatch(actions.setTotalUsersCount(data.totalCount)) @@ -101,7 +97,6 @@ export const getUsersThunkCreator = (currentPage :number, pageSize:number) => { } } - const followUnfollowFlow = async (dispatch:DispatchType, userId:number, apiMethod:any, actionCreator : (userId: number)=> ActionTypes) => { dispatch(actions.toggleFollow(true, userId)); let response=await apiMethod(userId); @@ -120,7 +115,6 @@ export const followThunkCreator = (userId:number) :ThunkType=> { } } - export const unfollowThunkCreator = (userId:number): ThunkType => { return async (dispatch) => { let apiMethod=usersAPI.unfollow.bind(usersAPI); @@ -129,4 +123,9 @@ export const unfollowThunkCreator = (userId:number): ThunkType => { } } + export default userReducer; + +export type initialStateType =typeof initialState +type ActionTypes=InferActionsTypes +type ThunkType=BaseThunkType \ No newline at end of file diff --git a/node_modules/.bin/loose-envify b/node_modules/.bin/loose-envify new file mode 100644 index 0000000..bbdb1df --- /dev/null +++ b/node_modules/.bin/loose-envify @@ -0,0 +1,15 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/../loose-envify/cli.js" "$@" + ret=$? +else + node "$basedir/../loose-envify/cli.js" "$@" + ret=$? +fi +exit $ret diff --git a/node_modules/.bin/loose-envify.cmd b/node_modules/.bin/loose-envify.cmd new file mode 100644 index 0000000..2b21056 --- /dev/null +++ b/node_modules/.bin/loose-envify.cmd @@ -0,0 +1,17 @@ +@ECHO off +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +"%_prog%" "%dp0%\..\loose-envify\cli.js" %* +ENDLOCAL +EXIT /b %errorlevel% +:find_dp0 +SET dp0=%~dp0 +EXIT /b diff --git a/node_modules/.bin/loose-envify.ps1 b/node_modules/.bin/loose-envify.ps1 new file mode 100644 index 0000000..7b96ac6 --- /dev/null +++ b/node_modules/.bin/loose-envify.ps1 @@ -0,0 +1,18 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + & "$basedir/node$exe" "$basedir/../loose-envify/cli.js" $args + $ret=$LASTEXITCODE +} else { + & "node$exe" "$basedir/../loose-envify/cli.js" $args + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/@types/history/DOMUtils.d.ts b/node_modules/@types/history/DOMUtils.d.ts new file mode 100644 index 0000000..2b0a597 --- /dev/null +++ b/node_modules/@types/history/DOMUtils.d.ts @@ -0,0 +1,17 @@ +declare global { + // Some users of this package are don't use "dom" libs + interface EventTarget {} + interface EventListener {} + interface EventListenerObject {} +} + +export const isExtraneousPopstateEvent: boolean; +export function addEventListener(node: EventTarget, event: string, listener: EventListener | EventListenerObject): void; +export function removeEventListener( + node: EventTarget, + event: string, + listener: EventListener | EventListenerObject, +): void; +export function getConfirmation(message: string, callback: (result: boolean) => void): void; +export function supportsHistory(): boolean; +export function supportsGoWithoutReloadUsingHash(): boolean; diff --git a/node_modules/@types/history/ExecutionEnvironment.d.ts b/node_modules/@types/history/ExecutionEnvironment.d.ts new file mode 100644 index 0000000..ac15888 --- /dev/null +++ b/node_modules/@types/history/ExecutionEnvironment.d.ts @@ -0,0 +1 @@ +export const canUseDOM: boolean; diff --git a/node_modules/@types/history/LICENSE b/node_modules/@types/history/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/node_modules/@types/history/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/history/LocationUtils.d.ts b/node_modules/@types/history/LocationUtils.d.ts new file mode 100644 index 0000000..26e9324 --- /dev/null +++ b/node_modules/@types/history/LocationUtils.d.ts @@ -0,0 +1,9 @@ +import { Path, LocationState, LocationKey, Location, LocationDescriptor } from './index'; + +export function locationsAreEqual(lv: LocationDescriptor, rv: LocationDescriptor): boolean; +export function createLocation( + path: LocationDescriptor, + state?: S, + key?: LocationKey, + currentLocation?: Location, +): Location; diff --git a/node_modules/@types/history/PathUtils.d.ts b/node_modules/@types/history/PathUtils.d.ts new file mode 100644 index 0000000..18952a2 --- /dev/null +++ b/node_modules/@types/history/PathUtils.d.ts @@ -0,0 +1,9 @@ +import { Path, Location, LocationDescriptorObject } from './index'; + +export function addLeadingSlash(path: Path): Path; +export function stripLeadingSlash(path: Path): Path; +export function hasBasename(path: Path): boolean; +export function stripBasename(path: Path, prefix: string): Path; +export function stripTrailingSlash(path: Path): Path; +export function parsePath(path: Path): Location; +export function createPath(location: LocationDescriptorObject): Path; diff --git a/node_modules/@types/history/README.md b/node_modules/@types/history/README.md new file mode 100644 index 0000000..448d14f --- /dev/null +++ b/node_modules/@types/history/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/history` + +# Summary +This package contains type definitions for history (https://github.com/mjackson/history). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history. + +### Additional Details + * Last updated: Wed, 16 Sep 2020 22:59:19 GMT + * Dependencies: none + * Global values: `History` + +# Credits +These definitions were written by [Sergey Buturlakin](https://github.com/sergey-buturlakin), [Nathan Brown](https://github.com/ngbrown), [Young Rok Kim](https://github.com/rokoroku), and [Daniel Nixon](https://github.com/danielnixon). diff --git a/node_modules/@types/history/createBrowserHistory.d.ts b/node_modules/@types/history/createBrowserHistory.d.ts new file mode 100644 index 0000000..1b51b14 --- /dev/null +++ b/node_modules/@types/history/createBrowserHistory.d.ts @@ -0,0 +1,11 @@ +import { History, LocationState } from './index'; +import { getConfirmation } from './DOMUtils'; + +export interface BrowserHistoryBuildOptions { + basename?: string; + forceRefresh?: boolean; + getUserConfirmation?: typeof getConfirmation; + keyLength?: number; +} + +export default function createBrowserHistory(options?: BrowserHistoryBuildOptions): History; diff --git a/node_modules/@types/history/createHashHistory.d.ts b/node_modules/@types/history/createHashHistory.d.ts new file mode 100644 index 0000000..ae0377c --- /dev/null +++ b/node_modules/@types/history/createHashHistory.d.ts @@ -0,0 +1,12 @@ +import { History, LocationState } from './index'; +import { getConfirmation } from './DOMUtils'; + +export type HashType = 'hashbang' | 'noslash' | 'slash'; + +export interface HashHistoryBuildOptions { + basename?: string; + hashType?: HashType; + getUserConfirmation?: typeof getConfirmation; +} + +export default function createHashHistory(options?: HashHistoryBuildOptions): History; diff --git a/node_modules/@types/history/createMemoryHistory.d.ts b/node_modules/@types/history/createMemoryHistory.d.ts new file mode 100644 index 0000000..fc1d1e9 --- /dev/null +++ b/node_modules/@types/history/createMemoryHistory.d.ts @@ -0,0 +1,17 @@ +import { History, Location, LocationState } from './index'; +import { getConfirmation } from './DOMUtils'; + +export interface MemoryHistoryBuildOptions { + getUserConfirmation?: typeof getConfirmation; + initialEntries?: string[]; + initialIndex?: number; + keyLength?: number; +} + +export interface MemoryHistory extends History { + index: number; + entries: Location[]; + canGo(n: number): boolean; +} + +export default function createMemoryHistory(options?: MemoryHistoryBuildOptions): MemoryHistory; diff --git a/node_modules/@types/history/createTransitionManager.d.ts b/node_modules/@types/history/createTransitionManager.d.ts new file mode 100644 index 0000000..135ee54 --- /dev/null +++ b/node_modules/@types/history/createTransitionManager.d.ts @@ -0,0 +1,20 @@ +import { Location, Action, LocationListener, LocationState, UnregisterCallback } from './index'; +import { getConfirmation } from './DOMUtils'; + +export type PromptFunction = (location: Location, action: Action) => any; + +export type Prompt = PromptFunction | boolean; + +export interface TransitionManager { + setPrompt(nextPrompt?: Prompt): UnregisterCallback; + appendListener(listener: LocationListener): UnregisterCallback; + notifyListeners(location: Location, action: Action): void; + confirmTransitionTo( + location: Location, + action: Action, + getUserConfirmation: typeof getConfirmation, + callback: (result: boolean) => void, + ): void; +} + +export default function createTransitionManager(): TransitionManager; diff --git a/node_modules/@types/history/index.d.ts b/node_modules/@types/history/index.d.ts new file mode 100644 index 0000000..695f04e --- /dev/null +++ b/node_modules/@types/history/index.d.ts @@ -0,0 +1,97 @@ +// Type definitions for history 4.7.2 +// Project: https://github.com/mjackson/history +// Definitions by: Sergey Buturlakin , Nathan Brown , Young Rok Kim , Daniel Nixon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 +export as namespace History; + +export type Action = 'PUSH' | 'POP' | 'REPLACE'; +export type UnregisterCallback = () => void; + +export interface History { + length: number; + action: Action; + location: Location; + push(path: Path, state?: HistoryLocationState): void; + push(location: LocationDescriptor): void; + replace(path: Path, state?: HistoryLocationState): void; + replace(location: LocationDescriptor): void; + go(n: number): void; + goBack(): void; + goForward(): void; + block(prompt?: boolean | string | TransitionPromptHook): UnregisterCallback; + listen(listener: LocationListener): UnregisterCallback; + createHref(location: LocationDescriptorObject): Href; +} + +export interface Location { + pathname: Pathname; + search: Search; + state: S; + hash: Hash; + key?: LocationKey; +} + +export interface LocationDescriptorObject { + pathname?: Pathname; + search?: Search; + state?: S; + hash?: Hash; + key?: LocationKey; +} + +export namespace History { + export type LocationDescriptor = Path | LocationDescriptorObject; + export type LocationKey = string; + export type LocationListener = (location: Location, action: Action) => void; + + export type LocationState = unknown; + export type Path = string; + export type Pathname = string; + export type Search = string; + export type TransitionHook = (location: Location, callback: (result: any) => void) => any; + export type TransitionPromptHook = ( + location: Location, + action: Action, + ) => string | false | void; + export type Hash = string; + export type Href = string; +} + +export type LocationDescriptor = History.LocationDescriptor; +export type LocationKey = History.LocationKey; +export type LocationListener = History.LocationListener; +export type LocationState = History.LocationState; +export type Path = History.Path; +export type Pathname = History.Pathname; +export type Search = History.Search; +export type TransitionHook = History.TransitionHook; +export type TransitionPromptHook = History.TransitionPromptHook; +export type Hash = History.Hash; +export type Href = History.Href; + +import { default as createBrowserHistory } from './createBrowserHistory'; +import { default as createHashHistory } from './createHashHistory'; +import { default as createMemoryHistory } from './createMemoryHistory'; +import { createLocation, locationsAreEqual } from './LocationUtils'; +import { parsePath, createPath } from './PathUtils'; + +// Global usage, without modules, needs the small trick, because lib.d.ts +// already has `history` and `History` global definitions: +// var createHistory = ((window as any).History as HistoryModule.Module).createHistory; +export interface Module { + createBrowserHistory: typeof createBrowserHistory; + createHashHistory: typeof createHashHistory; + createMemoryHistory: typeof createMemoryHistory; + createLocation: typeof createLocation; + locationsAreEqual: typeof locationsAreEqual; + parsePath: typeof parsePath; + createPath: typeof createPath; +} + +export * from './createBrowserHistory'; +export * from './createHashHistory'; +export * from './createMemoryHistory'; +export { createLocation, locationsAreEqual } from './LocationUtils'; +export { parsePath, createPath } from './PathUtils'; +export { createBrowserHistory, createHashHistory, createMemoryHistory }; diff --git a/node_modules/@types/history/package.json b/node_modules/@types/history/package.json new file mode 100644 index 0000000..de4f032 --- /dev/null +++ b/node_modules/@types/history/package.json @@ -0,0 +1,66 @@ +{ + "_from": "@types/history@*", + "_id": "@types/history@4.7.8", + "_inBundle": false, + "_integrity": "sha512-S78QIYirQcUoo6UJZx9CSP0O2ix9IaeAXwQi26Rhr/+mg7qqPy8TzaxHSUut7eGjL8WmLccT7/MXf304WjqHcA==", + "_location": "/@types/history", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@types/history@*", + "name": "@types/history", + "escapedName": "@types%2fhistory", + "scope": "@types", + "rawSpec": "*", + "saveSpec": null, + "fetchSpec": "*" + }, + "_requiredBy": [ + "/@types/react-router", + "/@types/react-router-dom" + ], + "_resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.8.tgz", + "_shasum": "49348387983075705fe8f4e02fb67f7daaec4934", + "_spec": "@types/history@*", + "_where": "C:\\Users\\ferid\\Desktop\\react_project\\1_project\\node_modules\\@types\\react-router-dom", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Sergey Buturlakin", + "url": "https://github.com/sergey-buturlakin" + }, + { + "name": "Nathan Brown", + "url": "https://github.com/ngbrown" + }, + { + "name": "Young Rok Kim", + "url": "https://github.com/rokoroku" + }, + { + "name": "Daniel Nixon", + "url": "https://github.com/danielnixon" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "TypeScript definitions for history", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", + "license": "MIT", + "main": "", + "name": "@types/history", + "repository": { + "type": "git", + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/history" + }, + "scripts": {}, + "typeScriptVersion": "3.2", + "types": "index.d.ts", + "typesPublisherContentHash": "e55dcbc32a4f1bf9b7dc3625f4d3b5c9171463b3c173ab41c555c51d79846aef", + "version": "4.7.8" +} diff --git a/node_modules/@types/hoist-non-react-statics/LICENSE b/node_modules/@types/hoist-non-react-statics/LICENSE new file mode 100644 index 0000000..2107107 --- /dev/null +++ b/node_modules/@types/hoist-non-react-statics/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/hoist-non-react-statics/README.md b/node_modules/@types/hoist-non-react-statics/README.md new file mode 100644 index 0000000..359cd1d --- /dev/null +++ b/node_modules/@types/hoist-non-react-statics/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/hoist-non-react-statics` + +# Summary +This package contains type definitions for hoist-non-react-statics ( https://github.com/mridgway/hoist-non-react-statics#readme ). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hoist-non-react-statics + +Additional Details + * Last updated: Thu, 04 Apr 2019 18:42:22 GMT + * Dependencies: @types/react + * Global values: none + +# Credits +These definitions were written by JounQin , James Reggio . diff --git a/node_modules/@types/hoist-non-react-statics/index.d.ts b/node_modules/@types/hoist-non-react-statics/index.d.ts new file mode 100644 index 0000000..fc90d97 --- /dev/null +++ b/node_modules/@types/hoist-non-react-statics/index.d.ts @@ -0,0 +1,80 @@ +// Type definitions for hoist-non-react-statics 3.3 +// Project: https://github.com/mridgway/hoist-non-react-statics#readme +// Definitions by: JounQin , James Reggio +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from 'react'; + +interface REACT_STATICS { + childContextTypes: true; + contextType: true; + contextTypes: true; + defaultProps: true; + displayName: true; + getDefaultProps: true; + getDerivedStateFromError: true; + getDerivedStateFromProps: true; + mixins: true; + propTypes: true; + type: true; +} + +interface KNOWN_STATICS { + name: true; + length: true; + prototype: true; + caller: true; + callee: true; + arguments: true; + arity: true; +} + +interface MEMO_STATICS { + '$$typeof': true; + compare: true; + defaultProps: true; + displayName: true; + propTypes: true; + type: true; +} + +interface FORWARD_REF_STATICS { + '$$typeof': true; + render: true; + defaultProps: true; + displayName: true; + propTypes: true; +} + +declare namespace hoistNonReactStatics { + type NonReactStatics< + S extends React.ComponentType, + C extends { + [key: string]: true + } = {} + > = { + [key in Exclude< + keyof S, + S extends React.MemoExoticComponent + ? keyof MEMO_STATICS | keyof C + : S extends React.ForwardRefExoticComponent + ? keyof FORWARD_REF_STATICS | keyof C + : keyof REACT_STATICS | keyof KNOWN_STATICS | keyof C + >]: S[key] + }; +} + +declare function hoistNonReactStatics< + T extends React.ComponentType, + S extends React.ComponentType, + C extends { + [key: string]: true + } = {} +>( + TargetComponent: T, + SourceComponent: S, + customStatic?: C, +): T & hoistNonReactStatics.NonReactStatics; + +export = hoistNonReactStatics; diff --git a/node_modules/@types/hoist-non-react-statics/package.json b/node_modules/@types/hoist-non-react-statics/package.json new file mode 100644 index 0000000..faeb7fd --- /dev/null +++ b/node_modules/@types/hoist-non-react-statics/package.json @@ -0,0 +1,60 @@ +{ + "_from": "@types/hoist-non-react-statics@^3.3.0", + "_id": "@types/hoist-non-react-statics@3.3.1", + "_inBundle": false, + "_integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", + "_location": "/@types/hoist-non-react-statics", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@types/hoist-non-react-statics@^3.3.0", + "name": "@types/hoist-non-react-statics", + "escapedName": "@types%2fhoist-non-react-statics", + "scope": "@types", + "rawSpec": "^3.3.0", + "saveSpec": null, + "fetchSpec": "^3.3.0" + }, + "_requiredBy": [ + "/@types/react-redux" + ], + "_resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "_shasum": "1124aafe5118cb591977aeb1ceaaed1070eb039f", + "_spec": "@types/hoist-non-react-statics@^3.3.0", + "_where": "C:\\Users\\ferid\\Desktop\\react_project\\1_project\\node_modules\\@types\\react-redux", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "JounQin", + "url": "https://github.com/JounQin" + }, + { + "name": "James Reggio", + "url": "https://github.com/jamesreggio" + } + ], + "dependencies": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + }, + "deprecated": false, + "description": "TypeScript definitions for hoist-non-react-statics", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", + "license": "MIT", + "main": "", + "name": "@types/hoist-non-react-statics", + "repository": { + "type": "git", + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/hoist-non-react-statics" + }, + "scripts": {}, + "typeScriptVersion": "2.8", + "types": "index", + "typesPublisherContentHash": "666e47d028495104f280da8e5a0caa7bfd4d6ecc4f113c4b60bec065e6e4c5f2", + "version": "3.3.1" +} diff --git a/node_modules/@types/prop-types/LICENSE b/node_modules/@types/prop-types/LICENSE new file mode 100644 index 0000000..2107107 --- /dev/null +++ b/node_modules/@types/prop-types/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/prop-types/README.md b/node_modules/@types/prop-types/README.md new file mode 100644 index 0000000..9e337ea --- /dev/null +++ b/node_modules/@types/prop-types/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/prop-types` + +# Summary +This package contains type definitions for prop-types (https://github.com/reactjs/prop-types). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/prop-types + +Additional Details + * Last updated: Tue, 24 Sep 2019 20:14:29 GMT + * Dependencies: none + * Global values: none + +# Credits +These definitions were written by DovydasNavickas , Ferdy Budhidharma , and Sebastian Silbermann . diff --git a/node_modules/@types/prop-types/index.d.ts b/node_modules/@types/prop-types/index.d.ts new file mode 100644 index 0000000..691e32f --- /dev/null +++ b/node_modules/@types/prop-types/index.d.ts @@ -0,0 +1,92 @@ +// Type definitions for prop-types 15.7 +// Project: https://github.com/reactjs/prop-types, https://facebook.github.io/react +// Definitions by: DovydasNavickas +// Ferdy Budhidharma +// Sebastian Silbermann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +export type ReactComponentLike = + | string + | ((props: any, context?: any) => any) + | (new (props: any, context?: any) => any); + +export interface ReactElementLike { + type: ReactComponentLike; + props: any; + key: string | number | null; +} + +export interface ReactNodeArray extends Array {} + +export type ReactNodeLike = + | {} + | ReactElementLike + | ReactNodeArray + | string + | number + | boolean + | null + | undefined; + +export const nominalTypeHack: unique symbol; + +export type IsOptional = undefined extends T ? true : false; + +export type RequiredKeys = { [K in keyof V]-?: Exclude extends Validator ? IsOptional extends true ? never : K : never }[keyof V]; +export type OptionalKeys = Exclude>; +export type InferPropsInner = { [K in keyof V]-?: InferType; }; + +export interface Validator { + (props: { [key: string]: any }, propName: string, componentName: string, location: string, propFullName: string): Error | null; + [nominalTypeHack]?: { + type: T; + }; +} + +export interface Requireable extends Validator { + isRequired: Validator>; +} + +export type ValidationMap = { [K in keyof T]?: Validator }; + +export type InferType = V extends Validator ? T : any; +export type InferProps = + & InferPropsInner>> + & Partial>>>; + +export const any: Requireable; +export const array: Requireable; +export const bool: Requireable; +export const func: Requireable<(...args: any[]) => any>; +export const number: Requireable; +export const object: Requireable; +export const string: Requireable; +export const node: Requireable; +export const element: Requireable; +export const symbol: Requireable; +export const elementType: Requireable; +export function instanceOf(expectedClass: new (...args: any[]) => T): Requireable; +export function oneOf(types: ReadonlyArray): Requireable; +export function oneOfType>(types: T[]): Requireable>>; +export function arrayOf(type: Validator): Requireable; +export function objectOf(type: Validator): Requireable<{ [K in keyof any]: T; }>; +export function shape

>(type: P): Requireable>; +export function exact

>(type: P): Requireable>>; + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param typeSpecs Map of name to a ReactPropType + * @param values Runtime values that need to be type-checked + * @param location e.g. "prop", "context", "child context" + * @param componentName Name of the component for error messages + * @param getStack Returns the component stack + */ +export function checkPropTypes(typeSpecs: any, values: any, location: string, componentName: string, getStack?: () => any): void; + +/** + * Only available if NODE_ENV=production + */ +export function resetWarningCache(): void; diff --git a/node_modules/@types/prop-types/package.json b/node_modules/@types/prop-types/package.json new file mode 100644 index 0000000..7baa150 --- /dev/null +++ b/node_modules/@types/prop-types/package.json @@ -0,0 +1,61 @@ +{ + "_from": "@types/prop-types@*", + "_id": "@types/prop-types@15.7.3", + "_inBundle": false, + "_integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==", + "_location": "/@types/prop-types", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@types/prop-types@*", + "name": "@types/prop-types", + "escapedName": "@types%2fprop-types", + "scope": "@types", + "rawSpec": "*", + "saveSpec": null, + "fetchSpec": "*" + }, + "_requiredBy": [ + "/@types/react" + ], + "_resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz", + "_shasum": "2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7", + "_spec": "@types/prop-types@*", + "_where": "C:\\Users\\ferid\\Desktop\\react_project\\1_project\\node_modules\\@types\\react", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "DovydasNavickas", + "url": "https://github.com/DovydasNavickas" + }, + { + "name": "Ferdy Budhidharma", + "url": "https://github.com/ferdaber" + }, + { + "name": "Sebastian Silbermann", + "url": "https://github.com/eps1lon" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "TypeScript definitions for prop-types", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", + "license": "MIT", + "main": "", + "name": "@types/prop-types", + "repository": { + "type": "git", + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/prop-types" + }, + "scripts": {}, + "typeScriptVersion": "2.8", + "types": "index", + "typesPublisherContentHash": "09cbaa49bc0d7139a168388028da20f8772c641a1e83848ef2cdcd0f91c7ee79", + "version": "15.7.3" +} diff --git a/node_modules/@types/react-redux/LICENSE b/node_modules/@types/react-redux/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/node_modules/@types/react-redux/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/react-redux/README.md b/node_modules/@types/react-redux/README.md new file mode 100644 index 0000000..6d2e9ac --- /dev/null +++ b/node_modules/@types/react-redux/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/react-redux` + +# Summary +This package contains type definitions for react-redux (https://github.com/reduxjs/react-redux). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-redux. + +### Additional Details + * Last updated: Tue, 19 May 2020 18:38:09 GMT + * Dependencies: [@types/react](https://npmjs.com/package/@types/react), [@types/redux](https://npmjs.com/package/@types/redux), [@types/hoist-non-react-statics](https://npmjs.com/package/@types/hoist-non-react-statics) + * Global values: none + +# Credits +These definitions were written by [Qubo](https://github.com/tkqubo), [Kenzie Togami](https://github.com/kenzierocks), [Curits Layne](https://github.com/clayne11), [Frank Tan](https://github.com/tansongyang), [Nicholas Boll](https://github.com/nicholasboll), [Dibyo Majumdar](https://github.com/mdibyo), [Thomas Charlat](https://github.com/kallikrein), [Valentin Descamps](https://github.com/val1984), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Anatoli Papirovski](https://github.com/apapirovski), [Boris Sergeyev](https://github.com/surgeboris), [Søren Bruus Frank](https://github.com/soerenbf), [Jonathan Ziller](https://github.com/mrwolfz), [Dylan Vann](https://github.com/dylanvann), [Yuki Ito](https://github.com/Lazyuki), and [Kazuma Ebina](https://github.com/kazuma1989). diff --git a/node_modules/@types/react-redux/index.d.ts b/node_modules/@types/react-redux/index.d.ts new file mode 100644 index 0000000..6541aa1 --- /dev/null +++ b/node_modules/@types/react-redux/index.d.ts @@ -0,0 +1,625 @@ +// Type definitions for react-redux 7.1 +// Project: https://github.com/reduxjs/react-redux +// Definitions by: Qubo , +// Kenzie Togami , +// Curits Layne +// Frank Tan +// Nicholas Boll +// Dibyo Majumdar +// Thomas Charlat +// Valentin Descamps +// Johann Rakotoharisoa +// Anatoli Papirovski +// Boris Sergeyev +// Søren Bruus Frank +// Jonathan Ziller +// Dylan Vann +// Yuki Ito +// Kazuma Ebina +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +import { + ClassAttributes, + Component, + ComponentClass, + ComponentType, + StatelessComponent, + Context, + NamedExoticComponent +} from 'react'; + +import { + Action, + ActionCreator, + AnyAction, + Dispatch, + Store +} from 'redux'; + +import hoistNonReactStatics = require('hoist-non-react-statics'); + +/** + * This interface can be augmented by users to add default types for the root state when + * using `react-redux`. + * Use module augmentation to append your own type definition in a your_custom_type.d.ts file. + * https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation + */ +// tslint:disable-next-line:no-empty-interface +export interface DefaultRootState {} + +export type AnyIfEmpty = keyof T extends never ? any : T; +export type RootStateOrAny = AnyIfEmpty; + +// Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html +export type Omit = Pick>; + +export interface DispatchProp { + dispatch: Dispatch; +} + +export type AdvancedComponentDecorator = + (component: ComponentType) => NamedExoticComponent; + +/** + * A property P will be present if: + * - it is present in DecorationTargetProps + * + * Its value will be dependent on the following conditions + * - if property P is present in InjectedProps and its definition extends the definition + * in DecorationTargetProps, then its definition will be that of DecorationTargetProps[P] + * - if property P is not present in InjectedProps then its definition will be that of + * DecorationTargetProps[P] + * - if property P is present in InjectedProps but does not extend the + * DecorationTargetProps[P] definition, its definition will be that of InjectedProps[P] + */ +export type Matching = { + [P in keyof DecorationTargetProps]: P extends keyof InjectedProps + ? InjectedProps[P] extends DecorationTargetProps[P] + ? DecorationTargetProps[P] + : InjectedProps[P] + : DecorationTargetProps[P]; +}; + +/** + * a property P will be present if : + * - it is present in both DecorationTargetProps and InjectedProps + * - InjectedProps[P] can satisfy DecorationTargetProps[P] + * ie: decorated component can accept more types than decorator is injecting + * + * For decoration, inject props or ownProps are all optionally + * required by the decorated (right hand side) component. + * But any property required by the decorated component must be satisfied by the injected property. + */ +export type Shared< + InjectedProps, + DecorationTargetProps + > = { + [P in Extract]?: InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : never; + }; + +// Infers prop type from component C +export type GetProps = C extends ComponentType + ? C extends ComponentClass

? ClassAttributes> & P : P + : never; + +// Applies LibraryManagedAttributes (proper handling of defaultProps +// and propTypes), as well as defines WrappedComponent. +export type ConnectedComponent< + C extends ComponentType, + P +> = NamedExoticComponent> & hoistNonReactStatics.NonReactStatics & { + WrappedComponent: C; +}; + +// Injects props and removes them from the prop requirements. +// Will not pass through the injected props if they are passed in during +// render. Also adds new prop requirements from TNeedsProps. +export type InferableComponentEnhancerWithProps = + >>>( + component: C + ) => ConnectedComponent, keyof Shared>> & TNeedsProps>; + +// Injects props and removes them from the prop requirements. +// Will not pass through the injected props if they are passed in during +// render. +export type InferableComponentEnhancer = + InferableComponentEnhancerWithProps; + +export type InferThunkActionCreatorType any> = + TActionCreator extends (...args: infer TParams) => (...args: any[]) => infer TReturn + ? (...args: TParams) => TReturn + : TActionCreator; + +export type HandleThunkActionCreator = + TActionCreator extends (...args: any[]) => any + ? InferThunkActionCreatorType + : TActionCreator; + +// redux-thunk middleware returns thunk's return value from dispatch call +// https://github.com/reduxjs/redux-thunk#composition +export type ResolveThunks = + TDispatchProps extends { [key: string]: any } + ? { + [C in keyof TDispatchProps]: HandleThunkActionCreator + } + : TDispatchProps; + +// the conditional type is to support TypeScript 3.0, which does not support mapping over tuples and arrays; +// once the typings are updated to at least TypeScript 3.1, a simple mapped type can replace this mess +export type ResolveArrayThunks> = + TDispatchProps extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, infer A7, infer A8, infer A9] + ? [HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, + HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator] + : TDispatchProps extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, infer A7, infer A8] + ? [HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, + HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator] + : TDispatchProps extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, infer A7] + ? [HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, + HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator] + : TDispatchProps extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6] + ? [HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator] + : TDispatchProps extends [infer A1, infer A2, infer A3, infer A4, infer A5] + ? [HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator] + : TDispatchProps extends [infer A1, infer A2, infer A3, infer A4] ? [HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator] + : TDispatchProps extends [infer A1, infer A2, infer A3] ? [HandleThunkActionCreator, HandleThunkActionCreator, HandleThunkActionCreator] + : TDispatchProps extends [infer A1, infer A2] ? [HandleThunkActionCreator, HandleThunkActionCreator] + : TDispatchProps extends [infer A1] ? [HandleThunkActionCreator] + : TDispatchProps extends Array ? Array> + : TDispatchProps extends ReadonlyArray ? ReadonlyArray> + : never + ; + +/** + * Connects a React component to a Redux store. + * + * - Without arguments, just wraps the component, without changing the behavior / props + * + * - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior + * is to override ownProps (as stated in the docs), so what remains is everything that's + * not a state or dispatch prop + * + * - When 3rd param is passed, we don't know if ownProps propagate and whether they + * should be valid component props, because it depends on mergeProps implementation. + * As such, it is the user's responsibility to extend ownProps interface from state or + * dispatch props or both when applicable + * + * @param mapStateToProps + * @param mapDispatchToProps + * @param mergeProps + * @param options + */ +export interface Connect { + // tslint:disable:no-unnecessary-generics + (): InferableComponentEnhancer; + + ( + mapStateToProps: MapStateToPropsParam + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: null | undefined, + mapDispatchToProps: MapDispatchToPropsNonObject + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: null | undefined, + mapDispatchToProps: MapDispatchToPropsParam, + ): InferableComponentEnhancerWithProps< + ResolveThunks, + TOwnProps + >; + + ( + mapStateToProps: MapStateToPropsParam, + mapDispatchToProps: MapDispatchToPropsNonObject + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: MapStateToPropsParam, + mapDispatchToProps: MapDispatchToPropsParam, + ): InferableComponentEnhancerWithProps< + TStateProps & ResolveThunks, + TOwnProps + >; + + ( + mapStateToProps: null | undefined, + mapDispatchToProps: null | undefined, + mergeProps: MergeProps, + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: MapStateToPropsParam, + mapDispatchToProps: null | undefined, + mergeProps: MergeProps, + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: null | undefined, + mapDispatchToProps: MapDispatchToPropsParam, + mergeProps: MergeProps, + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: MapStateToPropsParam, + mapDispatchToProps: null | undefined, + mergeProps: null | undefined, + options: Options + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: null | undefined, + mapDispatchToProps: MapDispatchToPropsNonObject, + mergeProps: null | undefined, + options: Options<{}, TStateProps, TOwnProps> + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: null | undefined, + mapDispatchToProps: MapDispatchToPropsParam, + mergeProps: null | undefined, + options: Options<{}, TStateProps, TOwnProps> + ): InferableComponentEnhancerWithProps< + ResolveThunks, + TOwnProps + >; + + ( + mapStateToProps: MapStateToPropsParam, + mapDispatchToProps: MapDispatchToPropsNonObject, + mergeProps: null | undefined, + options: Options + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: MapStateToPropsParam, + mapDispatchToProps: MapDispatchToPropsParam, + mergeProps: null | undefined, + options: Options + ): InferableComponentEnhancerWithProps< + TStateProps & ResolveThunks, + TOwnProps + >; + + ( + mapStateToProps: MapStateToPropsParam, + mapDispatchToProps: MapDispatchToPropsParam, + mergeProps: MergeProps, + options?: Options + ): InferableComponentEnhancerWithProps; + // tslint:enable:no-unnecessary-generics +} + +/** + * Infers the type of props that a connector will inject into a component. + */ +export type ConnectedProps = + TConnector extends InferableComponentEnhancerWithProps + ? TInjectedProps + : never; + +/** + * The connect function. See {@type Connect} for details. + */ +export const connect: Connect; + +export type MapStateToProps = + (state: State, ownProps: TOwnProps) => TStateProps; + +export type MapStateToPropsFactory = + (initialState: State, ownProps: TOwnProps) => MapStateToProps; + +export type MapStateToPropsParam = + MapStateToPropsFactory | MapStateToProps | null | undefined; + +export type MapDispatchToPropsFunction = + (dispatch: Dispatch, ownProps: TOwnProps) => TDispatchProps; + +export type MapDispatchToProps = + MapDispatchToPropsFunction | TDispatchProps; + +export type MapDispatchToPropsFactory = + (dispatch: Dispatch, ownProps: TOwnProps) => MapDispatchToPropsFunction; + +export type MapDispatchToPropsParam = MapDispatchToPropsFactory | MapDispatchToProps; + +export type MapDispatchToPropsNonObject = MapDispatchToPropsFactory | MapDispatchToPropsFunction; + +export type MergeProps = + (stateProps: TStateProps, dispatchProps: TDispatchProps, ownProps: TOwnProps) => TMergedProps; + +export interface Options extends ConnectOptions { + /** + * If true, implements shouldComponentUpdate and shallowly compares the result of mergeProps, + * preventing unnecessary updates, assuming that the component is a “pure” component + * and does not rely on any input or state other than its props and the selected Redux store’s state. + * Defaults to true. + * @default true + */ + pure?: boolean; + + /** + * When pure, compares incoming store state to its previous value. + * @default strictEqual + */ + areStatesEqual?: (nextState: State, prevState: State) => boolean; + + /** + * When pure, compares incoming props to its previous value. + * @default shallowEqual + */ + areOwnPropsEqual?: (nextOwnProps: TOwnProps, prevOwnProps: TOwnProps) => boolean; + + /** + * When pure, compares the result of mapStateToProps to its previous value. + * @default shallowEqual + */ + areStatePropsEqual?: (nextStateProps: TStateProps, prevStateProps: TStateProps) => boolean; + + /** + * When pure, compares the result of mergeProps to its previous value. + * @default shallowEqual + */ + areMergedPropsEqual?: (nextMergedProps: TMergedProps, prevMergedProps: TMergedProps) => boolean; + + /** + * If true, use React's forwardRef to expose a ref of the wrapped component + * + * @default false + */ + forwardRef?: boolean; +} + +/** + * Connects a React component to a Redux store. It is the base for {@link connect} but is less opinionated about + * how to combine state, props, and dispatch into your final props. It makes no + * assumptions about defaults or memoization of results, leaving those responsibilities to the caller.It does not + * modify the component class passed to it; instead, it returns a new, connected component for you to use. + * + * @param selectorFactory The selector factory. See SelectorFactory type for details. + * @param connectOptions If specified, further customizes the behavior of the connector. Additionally, any extra + * options will be passed through to your selectorFactory in the factoryOptions argument. + */ +export function connectAdvanced( + // tslint:disable-next-line no-unnecessary-generics + selectorFactory: SelectorFactory, + connectOptions?: ConnectOptions & TFactoryOptions +): AdvancedComponentDecorator; + +/** + * Initializes a selector function (during each instance's constructor). That selector function is called any time the + * connector component needs to compute new props, as a result of a store state change or receiving new props. The + * result of selector is expected to be a plain object, which is passed as the props to the wrapped + * component. If a consecutive call to selector returns the same object (===) as its previous + * call, the component will not be re-rendered. It's the responsibility of selector to return that + * previous object when appropriate. + */ +export type SelectorFactory = + (dispatch: Dispatch, factoryOptions: TFactoryOptions) => Selector; + +export type Selector = TOwnProps extends null | undefined + ? (state: S) => TProps + : (state: S, ownProps: TOwnProps) => TProps; + +export interface ConnectOptions { + /** + * Computes the connector component's displayName property relative to that of the wrapped component. Usually + * overridden by wrapper functions. + * + * @default name => 'ConnectAdvanced('+name+')' + * @param componentName + */ + getDisplayName?: (componentName: string) => string; + /** + * Shown in error messages. Usually overridden by wrapper functions. + * + * @default 'connectAdvanced' + */ + methodName?: string; + /** + * If defined, a property named this value will be added to the props passed to the wrapped component. Its value + * will be the number of times the component has been rendered, which can be useful for tracking down unnecessary + * re-renders. + * + * @default undefined + */ + renderCountProp?: string; + /** + * Controls whether the connector component subscribes to redux store state changes. If set to false, it will only + * re-render on componentWillReceiveProps. + * + * @default true + */ + shouldHandleStateChanges?: boolean; + /** + * The key of props/context to get the store. You probably only need this if you are in the inadvisable position of + * having multiple stores. + * + * @default 'store' + */ + storeKey?: string; + /** + * @deprecated Use forwardRef + * + * @default false + */ + withRef?: boolean; + /** + * The react context to get the store from. + * + * @default ReactReduxContext + */ + context?: Context; +} + +export interface ReactReduxContextValue { + store: Store; + storeState: SS; +} + +export interface ProviderProps { + /** + * The single Redux store in your application. + */ + store: Store; + /** + * Optional context to be used internally in react-redux. Use React.createContext() to create a context to be used. + * If this is used, generate own connect HOC by using connectAdvanced, supplying the same context provided to the + * Provider. Initial value doesn't matter, as it is overwritten with the internal state of Provider. + */ + context?: Context; +} + +/** + * Makes the Redux store available to the connect() calls in the component hierarchy below. + */ +export class Provider extends Component> { } + +/** + * Exposes the internal context used in react-redux. It is generally advised to use the connect HOC to connect to the + * redux store instead of this approeach. + */ +export const ReactReduxContext: Context; + +/** + * Wraps ReactDOM or React Native's internal unstable_batchedUpdate function. You can use it to ensure that + * multiple actions dispatched outside of React only result in a single render update. + */ +export function batch(cb: () => void): void; + +// tslint:disable:no-unnecessary-generics + +/** + * Compares two arbitrary values for shallow equality. Object values are compared based on their keys, i.e. they must + * have the same keys and for each key the value must be equal according to the `Object.is()` algorithm. Non-object + * values are also compared with the same algorithm as `Object.is()`. + */ +export function shallowEqual(left: T, right: any): boolean; + +/** + * A hook to access the redux `dispatch` function. + * + * Note for `redux-thunk` users: the return type of the returned `dispatch` functions for thunks is incorrect. + * However, it is possible to get a correctly typed `dispatch` function by creating your own custom hook typed + * from the store's dispatch function like this: `const useThunkDispatch = () => useDispatch();` + * + * @returns redux store's `dispatch` function + * + * @example + * + * import React from 'react' + * import { useDispatch } from 'react-redux' + * + * export const CounterComponent = ({ value }) => { + * const dispatch = useDispatch() + * return ( + *

+ * ) + * } + */ +// NOTE: the first overload below and note above can be removed if redux-thunk typings add an overload for +// the Dispatch function (see also this PR: https://github.com/reduxjs/redux-thunk/pull/247) +export function useDispatch>(): TDispatch; +export function useDispatch(): Dispatch; + +/** + * A hook to access the redux store's state. This hook takes a selector function + * as an argument. The selector is called with the store state. + * + * This hook takes an optional equality comparison function as the second parameter + * that allows you to customize the way the selected state is compared to determine + * whether the component needs to be re-rendered. + * + * If you do not want to have to specify the root state type for whenever you use + * this hook with an inline selector you can use the `TypedUseSelectorHook` interface + * to create a version of this hook that is properly typed for your root state. + * + * @param selector the selector function + * @param equalityFn the function that will be used to determine equality + * + * @returns the selected state + * + * @example + * + * import React from 'react' + * import { useSelector } from 'react-redux' + * import { RootState } from './store' + * + * export const CounterComponent = () => { + * const counter = useSelector((state: RootState) => state.counter) + * return
{counter}
+ * } + */ +export function useSelector( + selector: (state: TState) => TSelected, + equalityFn?: (left: TSelected, right: TSelected) => boolean +): TSelected; + +/** + * This interface allows you to easily create a hook that is properly typed for your + * store's root state. + * + * @example + * + * interface RootState { + * property: string; + * } + * + * const useTypedSelector: TypedUseSelectorHook = useSelector; + * + */ +export interface TypedUseSelectorHook { + ( + selector: (state: TState) => TSelected, + equalityFn?: (left: TSelected, right: TSelected) => boolean + ): TSelected; +} + +/** + * A hook to access the redux store. + * + * @returns the redux store + * + * @example + * + * import React from 'react' + * import { useStore } from 'react-redux' + * + * export const ExampleComponent = () => { + * const store = useStore() + * return
{store.getState()}
+ * } + */ +export function useStore(): Store; + +/** + * Hook factory, which creates a `useSelector` hook bound to a given context. + * + * @param Context passed to your ``. + * @returns A `useSelector` hook bound to the specified context. + */ +export function createSelectorHook(context?: Context): typeof useSelector; + +/** + * Hook factory, which creates a `useStore` hook bound to a given context. + * + * @param Context passed to your ``. + * @returns A `useStore` hook bound to the specified context. + */ +export function createStoreHook(context?: Context): typeof useStore; + +/** + * Hook factory, which creates a `useDispatch` hook bound to a given context. + * + * @param Context passed to your ``. + * @returns A `useDispatch` hook bound to the specified context. + */ +export function createDispatchHook(context?: Context): typeof useDispatch; + +// tslint:enable:no-unnecessary-generics diff --git a/node_modules/@types/react-redux/package.json b/node_modules/@types/react-redux/package.json new file mode 100644 index 0000000..097db8a --- /dev/null +++ b/node_modules/@types/react-redux/package.json @@ -0,0 +1,119 @@ +{ + "_from": "@types/react-redux", + "_id": "@types/react-redux@7.1.9", + "_inBundle": false, + "_integrity": "sha512-mpC0jqxhP4mhmOl3P4ipRsgTgbNofMRXJb08Ms6gekViLj61v1hOZEKWDCyWsdONr6EjEA6ZHXC446wdywDe0w==", + "_location": "/@types/react-redux", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "@types/react-redux", + "name": "@types/react-redux", + "escapedName": "@types%2freact-redux", + "scope": "@types", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.9.tgz", + "_shasum": "280c13565c9f13ceb727ec21e767abe0e9b4aec3", + "_spec": "@types/react-redux", + "_where": "C:\\Users\\ferid\\Desktop\\react_project\\1_project", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Qubo", + "url": "https://github.com/tkqubo" + }, + { + "name": "Kenzie Togami", + "url": "https://github.com/kenzierocks" + }, + { + "name": "Curits Layne", + "url": "https://github.com/clayne11" + }, + { + "name": "Frank Tan", + "url": "https://github.com/tansongyang" + }, + { + "name": "Nicholas Boll", + "url": "https://github.com/nicholasboll" + }, + { + "name": "Dibyo Majumdar", + "url": "https://github.com/mdibyo" + }, + { + "name": "Thomas Charlat", + "url": "https://github.com/kallikrein" + }, + { + "name": "Valentin Descamps", + "url": "https://github.com/val1984" + }, + { + "name": "Johann Rakotoharisoa", + "url": "https://github.com/jrakotoharisoa" + }, + { + "name": "Anatoli Papirovski", + "url": "https://github.com/apapirovski" + }, + { + "name": "Boris Sergeyev", + "url": "https://github.com/surgeboris" + }, + { + "name": "Søren Bruus Frank", + "url": "https://github.com/soerenbf" + }, + { + "name": "Jonathan Ziller", + "url": "https://github.com/mrwolfz" + }, + { + "name": "Dylan Vann", + "url": "https://github.com/dylanvann" + }, + { + "name": "Yuki Ito", + "url": "https://github.com/Lazyuki" + }, + { + "name": "Kazuma Ebina", + "url": "https://github.com/kazuma1989" + } + ], + "dependencies": { + "@types/hoist-non-react-statics": "^3.3.0", + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0", + "redux": "^4.0.0" + }, + "deprecated": false, + "description": "TypeScript definitions for react-redux", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", + "license": "MIT", + "main": "", + "name": "@types/react-redux", + "repository": { + "type": "git", + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/react-redux" + }, + "scripts": {}, + "typeScriptVersion": "3.0", + "types": "index.d.ts", + "typesPublisherContentHash": "e8dea1604d884348b13dd8859f8f7b3c7d1fbd782d3ebbab9f142081f149aa72", + "version": "7.1.9" +} diff --git a/node_modules/@types/react-router-dom/LICENSE b/node_modules/@types/react-router-dom/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/node_modules/@types/react-router-dom/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/react-router-dom/README.md b/node_modules/@types/react-router-dom/README.md new file mode 100644 index 0000000..dbb2213 --- /dev/null +++ b/node_modules/@types/react-router-dom/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/react-router-dom` + +# Summary +This package contains type definitions for React Router (https://github.com/ReactTraining/react-router). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router-dom. + +### Additional Details + * Last updated: Tue, 06 Oct 2020 15:25:29 GMT + * Dependencies: [@types/react-router](https://npmjs.com/package/@types/react-router), [@types/react](https://npmjs.com/package/@types/react), [@types/history](https://npmjs.com/package/@types/history) + * Global values: none + +# Credits +These definitions were written by [Huy Nguyen](https://github.com/huy-nguyen), [Philip Jackson](https://github.com/p-jackson), [John Reilly](https://github.com/johnnyreilly), [Sebastian Silbermann](https://github.com/eps1lon), [Daniel Nixon](https://github.com/danielnixon), and [Tony Ward](https://github.com/ynotdraw). diff --git a/node_modules/@types/react-router-dom/index.d.ts b/node_modules/@types/react-router-dom/index.d.ts new file mode 100644 index 0000000..933e235 --- /dev/null +++ b/node_modules/@types/react-router-dom/index.d.ts @@ -0,0 +1,85 @@ +// Type definitions for React Router 5.1 +// Project: https://github.com/ReactTraining/react-router +// Definitions by: Huy Nguyen +// Philip Jackson +// John Reilly +// Sebastian Silbermann +// Daniel Nixon +// Tony Ward +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 + +import { match } from 'react-router'; +import * as React from 'react'; +import * as H from 'history'; + +export { + generatePath, + Prompt, + MemoryRouter, + RedirectProps, + Redirect, + RouteChildrenProps, + RouteComponentProps, + RouteProps, + Route, + Router, + StaticRouter, + SwitchProps, + Switch, + match, + matchPath, + withRouter, + RouterChildContext, + useHistory, + useLocation, + useParams, + useRouteMatch, +} from 'react-router'; + +export interface BrowserRouterProps { + basename?: string; + getUserConfirmation?: (message: string, callback: (ok: boolean) => void) => void; + forceRefresh?: boolean; + keyLength?: number; +} +export class BrowserRouter extends React.Component {} + +export interface HashRouterProps { + basename?: string; + getUserConfirmation?: (message: string, callback: (ok: boolean) => void) => void; + hashType?: 'slash' | 'noslash' | 'hashbang'; +} +export class HashRouter extends React.Component {} + +export interface LinkProps extends React.AnchorHTMLAttributes { + component?: React.ComponentType; + to: H.LocationDescriptor | ((location: H.Location) => H.LocationDescriptor); + replace?: boolean; + innerRef?: React.Ref; +} +export function Link( + ...params: Parameters> +): ReturnType>; + +export interface Link + extends React.ForwardRefExoticComponent< + React.PropsWithoutRef> & React.RefAttributes + > {} + +export interface NavLinkProps extends LinkProps { + activeClassName?: string; + activeStyle?: React.CSSProperties; + exact?: boolean; + strict?: boolean; + isActive?(match: match | null, location: H.Location): boolean; + location?: H.Location; +} +export function NavLink( + // TODO: Define this as ...params: Parameters> when only TypeScript >= 3.1 support is needed. + props: React.PropsWithoutRef> & React.RefAttributes, +): ReturnType>; +export interface NavLink + extends React.ForwardRefExoticComponent< + React.PropsWithoutRef> & React.RefAttributes + > {} diff --git a/node_modules/@types/react-router-dom/package.json b/node_modules/@types/react-router-dom/package.json new file mode 100644 index 0000000..a4750dd --- /dev/null +++ b/node_modules/@types/react-router-dom/package.json @@ -0,0 +1,78 @@ +{ + "_from": "@types/react-router-dom", + "_id": "@types/react-router-dom@5.1.6", + "_inBundle": false, + "_integrity": "sha512-gjrxYqxz37zWEdMVvQtWPFMFj1dRDb4TGOcgyOfSXTrEXdF92L00WE3C471O3TV/RF1oskcStkXsOU0Ete4s/g==", + "_location": "/@types/react-router-dom", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "@types/react-router-dom", + "name": "@types/react-router-dom", + "escapedName": "@types%2freact-router-dom", + "scope": "@types", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-5.1.6.tgz", + "_shasum": "07b14e7ab1893a837c8565634960dc398564b1fb", + "_spec": "@types/react-router-dom", + "_where": "C:\\Users\\ferid\\Desktop\\react_project\\1_project", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Huy Nguyen", + "url": "https://github.com/huy-nguyen" + }, + { + "name": "Philip Jackson", + "url": "https://github.com/p-jackson" + }, + { + "name": "John Reilly", + "url": "https://github.com/johnnyreilly" + }, + { + "name": "Sebastian Silbermann", + "url": "https://github.com/eps1lon" + }, + { + "name": "Daniel Nixon", + "url": "https://github.com/danielnixon" + }, + { + "name": "Tony Ward", + "url": "https://github.com/ynotdraw" + } + ], + "dependencies": { + "@types/history": "*", + "@types/react": "*", + "@types/react-router": "*" + }, + "deprecated": false, + "description": "TypeScript definitions for React Router", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", + "license": "MIT", + "main": "", + "name": "@types/react-router-dom", + "repository": { + "type": "git", + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/react-router-dom" + }, + "scripts": {}, + "typeScriptVersion": "3.2", + "types": "index.d.ts", + "typesPublisherContentHash": "2791a6cf56eeaaf5ab5683fa38f7948190889da47cc8af3ddc0520c4a0611c35", + "version": "5.1.6" +} diff --git a/node_modules/@types/react-router/LICENSE b/node_modules/@types/react-router/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/node_modules/@types/react-router/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/react-router/README.md b/node_modules/@types/react-router/README.md new file mode 100644 index 0000000..47c620c --- /dev/null +++ b/node_modules/@types/react-router/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/react-router` + +# Summary +This package contains type definitions for React Router (https://github.com/ReactTraining/react-router). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router. + +### Additional Details + * Last updated: Mon, 22 Jun 2020 06:28:51 GMT + * Dependencies: [@types/react](https://npmjs.com/package/@types/react), [@types/history](https://npmjs.com/package/@types/history) + * Global values: none + +# Credits +These definitions were written by [Sergey Buturlakin](https://github.com/sergey-buturlakin), [Yuichi Murata](https://github.com/mrk21), [Václav Ostrožlík](https://github.com/vasek17), [Nathan Brown](https://github.com/ngbrown), [Alex Wendland](https://github.com/awendland), [Kostya Esmukov](https://github.com/KostyaEsmukov), [John Reilly](https://github.com/johnnyreilly), [Karol Janyst](https://github.com/LKay), [Dovydas Navickas](https://github.com/DovydasNavickas), [Huy Nguyen](https://github.com/huy-nguyen), [Jérémy Fauvel](https://github.com/grmiade), [Daniel Roth](https://github.com/DaIgeb), [Egor Shulga](https://github.com/egorshulga), [Rahul Raina](https://github.com/rraina), [Duong Tran](https://github.com/t49tran), [Ben Smith](https://github.com/8enSmith), [Wesley Tsai](https://github.com/wezleytsai), [Sebastian Silbermann](https://github.com/eps1lon), [Nicholas Hehr](https://github.com/HipsterBrown), and [Pawel Fajfer](https://github.com/pawfa). diff --git a/node_modules/@types/react-router/index.d.ts b/node_modules/@types/react-router/index.d.ts new file mode 100644 index 0000000..15d0865 --- /dev/null +++ b/node_modules/@types/react-router/index.d.ts @@ -0,0 +1,169 @@ +// Type definitions for React Router 5.1 +// Project: https://github.com/ReactTraining/react-router +// Definitions by: Sergey Buturlakin +// Yuichi Murata +// Václav Ostrožlík +// Nathan Brown +// Alex Wendland +// Kostya Esmukov +// John Reilly +// Karol Janyst +// Dovydas Navickas +// Huy Nguyen +// Jérémy Fauvel +// Daniel Roth +// Egor Shulga +// Rahul Raina +// Duong Tran +// Ben Smith +// Wesley Tsai +// Sebastian Silbermann +// Nicholas Hehr +// Pawel Fajfer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from 'react'; +import * as H from 'history'; + +// This is the type of the context object that will be passed down to all children of +// a `Router` component: +export interface RouterChildContext { + router: { + history: H.History; + route: { + location: H.Location; + match: match; + }; + }; +} +export interface MemoryRouterProps { + initialEntries?: H.LocationDescriptor[]; + initialIndex?: number; + getUserConfirmation?: (message: string, callback: (ok: boolean) => void) => void; + keyLength?: number; +} + +export class MemoryRouter extends React.Component {} + +export interface PromptProps { + message: string | ((location: H.Location, action: H.Action) => string | boolean); + when?: boolean; +} +export class Prompt extends React.Component {} + +export interface RedirectProps { + to: H.LocationDescriptor; + push?: boolean; + from?: string; + path?: string; + exact?: boolean; + strict?: boolean; +} +export class Redirect extends React.Component {} + +export interface StaticContext { + statusCode?: number; +} + +export interface RouteComponentProps< + Params extends { [K in keyof Params]?: string } = {}, + C extends StaticContext = StaticContext, + S = H.LocationState +> { + history: H.History; + location: H.Location; + match: match; + staticContext?: C; +} + +export interface RouteChildrenProps { + history: H.History; + location: H.Location; + match: match | null; +} + +export interface RouteProps { + location?: H.Location; + component?: React.ComponentType> | React.ComponentType; + render?: (props: RouteComponentProps) => React.ReactNode; + children?: ((props: RouteChildrenProps) => React.ReactNode) | React.ReactNode; + path?: string | string[]; + exact?: boolean; + sensitive?: boolean; + strict?: boolean; +} +export class Route extends React.Component {} + +export interface RouterProps { + history: H.History; +} +export class Router extends React.Component {} + +export interface StaticRouterContext extends StaticContext { + url?: string; + action?: 'PUSH' | 'REPLACE'; + location?: object; +} +export interface StaticRouterProps { + basename?: string; + location?: string | object; + context?: StaticRouterContext; +} + +export class StaticRouter extends React.Component {} +export interface SwitchProps { + children?: React.ReactNode; + location?: H.Location; +} +export class Switch extends React.Component {} + +export interface match { + params: Params; + isExact: boolean; + path: string; + url: string; +} + +// Omit taken from https://github.com/Microsoft/TypeScript/issues/28339#issuecomment-467220238 +export type Omit = T extends any ? Pick> : never; + +export function matchPath( + pathname: string, + props: string | string[] | RouteProps, + parent?: match | null, +): match | null; + +export function generatePath( + pattern: string, + params?: { [paramName: string]: string | number | boolean | undefined }, +): string; + +export type WithRouterProps> = C extends React.ComponentClass + ? { wrappedComponentRef?: React.Ref> } + : {}; + +export interface WithRouterStatics> { + WrappedComponent: C; +} + +// There is a known issue in TypeScript, which doesn't allow decorators to change the signature of the classes +// they are decorating. Due to this, if you are using @withRouter decorator in your code, +// you will see a bunch of errors from TypeScript. The current workaround is to use withRouter() as a function call +// on a separate line instead of as a decorator. +export function withRouter

, C extends React.ComponentType

>( + component: C & React.ComponentType

, +): React.ComponentClass> & WithRouterProps> & WithRouterStatics; + +export const __RouterContext: React.Context; + +export function useHistory(): H.History; + +export function useLocation(): H.Location; + +export function useParams(): Params; + +export function useRouteMatch(): match; +export function useRouteMatch( + path: string | string[] | RouteProps, +): match | null; diff --git a/node_modules/@types/react-router/package.json b/node_modules/@types/react-router/package.json new file mode 100644 index 0000000..2e22728 --- /dev/null +++ b/node_modules/@types/react-router/package.json @@ -0,0 +1,132 @@ +{ + "_from": "@types/react-router@*", + "_id": "@types/react-router@5.1.8", + "_inBundle": false, + "_integrity": "sha512-HzOyJb+wFmyEhyfp4D4NYrumi+LQgQL/68HvJO+q6XtuHSDvw6Aqov7sCAhjbNq3bUPgPqbdvjXC5HeB2oEAPg==", + "_location": "/@types/react-router", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@types/react-router@*", + "name": "@types/react-router", + "escapedName": "@types%2freact-router", + "scope": "@types", + "rawSpec": "*", + "saveSpec": null, + "fetchSpec": "*" + }, + "_requiredBy": [ + "/@types/react-router-dom" + ], + "_resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-5.1.8.tgz", + "_shasum": "4614e5ba7559657438e17766bb95ef6ed6acc3fa", + "_spec": "@types/react-router@*", + "_where": "C:\\Users\\ferid\\Desktop\\react_project\\1_project\\node_modules\\@types\\react-router-dom", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Sergey Buturlakin", + "url": "https://github.com/sergey-buturlakin" + }, + { + "name": "Yuichi Murata", + "url": "https://github.com/mrk21" + }, + { + "name": "Václav Ostrožlík", + "url": "https://github.com/vasek17" + }, + { + "name": "Nathan Brown", + "url": "https://github.com/ngbrown" + }, + { + "name": "Alex Wendland", + "url": "https://github.com/awendland" + }, + { + "name": "Kostya Esmukov", + "url": "https://github.com/KostyaEsmukov" + }, + { + "name": "John Reilly", + "url": "https://github.com/johnnyreilly" + }, + { + "name": "Karol Janyst", + "url": "https://github.com/LKay" + }, + { + "name": "Dovydas Navickas", + "url": "https://github.com/DovydasNavickas" + }, + { + "name": "Huy Nguyen", + "url": "https://github.com/huy-nguyen" + }, + { + "name": "Jérémy Fauvel", + "url": "https://github.com/grmiade" + }, + { + "name": "Daniel Roth", + "url": "https://github.com/DaIgeb" + }, + { + "name": "Egor Shulga", + "url": "https://github.com/egorshulga" + }, + { + "name": "Rahul Raina", + "url": "https://github.com/rraina" + }, + { + "name": "Duong Tran", + "url": "https://github.com/t49tran" + }, + { + "name": "Ben Smith", + "url": "https://github.com/8enSmith" + }, + { + "name": "Wesley Tsai", + "url": "https://github.com/wezleytsai" + }, + { + "name": "Sebastian Silbermann", + "url": "https://github.com/eps1lon" + }, + { + "name": "Nicholas Hehr", + "url": "https://github.com/HipsterBrown" + }, + { + "name": "Pawel Fajfer", + "url": "https://github.com/pawfa" + } + ], + "dependencies": { + "@types/history": "*", + "@types/react": "*" + }, + "deprecated": false, + "description": "TypeScript definitions for React Router", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", + "license": "MIT", + "main": "", + "name": "@types/react-router", + "repository": { + "type": "git", + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/react-router" + }, + "scripts": {}, + "typeScriptVersion": "3.0", + "types": "index.d.ts", + "typesPublisherContentHash": "ebbcba9f704fc9b8cb4477bb7c543cc65aca22bfa45eaad517ec1ec478e5fd64", + "version": "5.1.8" +} diff --git a/node_modules/@types/react/LICENSE b/node_modules/@types/react/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/node_modules/@types/react/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/react/README.md b/node_modules/@types/react/README.md new file mode 100644 index 0000000..26f2242 --- /dev/null +++ b/node_modules/@types/react/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/react` + +# Summary +This package contains type definitions for React (http://facebook.github.io/react/). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react. + +### Additional Details + * Last updated: Wed, 28 Oct 2020 18:56:19 GMT + * Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/prop-types](https://npmjs.com/package/@types/prop-types) + * Global values: `React` + +# Credits +These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Digiguru](https://github.com/digiguru), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), and [Dale Tan](https://github.com/hellatan). diff --git a/node_modules/@types/react/experimental.d.ts b/node_modules/@types/react/experimental.d.ts new file mode 100644 index 0000000..2e0aa29 --- /dev/null +++ b/node_modules/@types/react/experimental.d.ts @@ -0,0 +1,189 @@ +/** + * These are types for things that are present in the `experimental` builds of React but not yet + * on a stable build. + * + * Once they are promoted to stable they can just be moved to the main index file. + * + * To load the types declared here in an actual project, there are three ways. The easiest one, + * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, + * is to add `"react/experimental"` to the `"types"` array. + * + * Alternatively, a specific import syntax can to be used from a typescript file. + * This module does not exist in reality, which is why the {} is important: + * + * ```ts + * import {} from 'react/experimental' + * ``` + * + * It is also possible to include it through a triple-slash reference: + * + * ```ts + * /// + * ``` + * + * Either the import or the reference only needs to appear once, anywhere in the project. + */ + +// See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared, +// and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are +// flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`. +// +// For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js +// is a good place to start looking for details; it generally calls prop validation functions or delegates +// all tasks done as part of the render phase (the concurrent part of the React update cycle). +// +// Suspense-related handling can be found in ReactFiberThrow.js. + +import React = require('.'); + +export {}; + +declare module '.' { + export interface SuspenseProps { + /** + * The presence of this prop indicates that the content is computationally expensive to render. + * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data). + * @see {@link https://github.com/facebook/react/pull/19936} + */ + unstable_expectedLoadTime?: number; + } + + export type SuspenseListRevealOrder = 'forwards' | 'backwards' | 'together'; + export type SuspenseListTailMode = 'collapsed' | 'hidden'; + + export interface SuspenseListCommonProps { + /** + * Note that SuspenseList require more than one child; + * it is a runtime warning to provide only a single child. + * + * It does, however, allow those children to be wrapped inside a single + * level of ``. + */ + children: ReactElement | Iterable; + } + + interface DirectionalSuspenseListProps extends SuspenseListCommonProps { + /** + * Defines the order in which the `SuspenseList` children should be revealed. + */ + revealOrder: 'forwards' | 'backwards'; + /** + * Dictates how unloaded items in a SuspenseList is shown. + * + * - By default, `SuspenseList` will show all fallbacks in the list. + * - `collapsed` shows only the next fallback in the list. + * - `hidden` doesn’t show any unloaded items. + */ + tail?: SuspenseListTailMode; + } + + interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps { + /** + * Defines the order in which the `SuspenseList` children should be revealed. + */ + revealOrder?: Exclude; + /** + * The tail property is invalid when not using the `forwards` or `backwards` reveal orders. + */ + tail?: never; + } + + export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps; + + /** + * `SuspenseList` helps coordinate many components that can suspend by orchestrating the order + * in which these components are revealed to the user. + * + * When multiple components need to fetch data, this data may arrive in an unpredictable order. + * However, if you wrap these items in a `SuspenseList`, React will not show an item in the list + * until previous items have been displayed (this behavior is adjustable). + * + * @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist + * @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist + */ + export const unstable_SuspenseList: ExoticComponent; + + export interface SuspenseConfig { + busyDelayMs?: number; + busyMinDurationMs?: number; + } + + // undocumented, considered for removal + export function unstable_withSuspenseConfig( + scope: () => void | undefined, + config: SuspenseConfig | null | undefined, + ): void; + + // must be synchronous + export type TransitionFunction = () => void | undefined; + // strange definition to allow vscode to show documentation on the invocation + export interface TransitionStartFunction { + /** + * State updates caused inside the callback are allowed to be deferred. + * + * **If some state update causes a component to suspend, that state update should be wrapped in a transition.** + * + * @param callback A _synchronous_ function which causes state updates that can be deferred. + */ + (callback: TransitionFunction): void; + } + + /** + * Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`. + * + * This is commonly used to keep the interface responsive when you have something that renders immediately + * based on user input and something that needs to wait for a data fetch. + * + * A good example of this is a text input. + * + * @param value The value that is going to be deferred + * + * @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue + */ + export function unstable_useDeferredValue(value: T): T; + + /** + * Allows components to avoid undesirable loading states by waiting for content to load + * before transitioning to the next screen. It also allows components to defer slower, + * data fetching updates until subsequent renders so that more crucial updates can be + * rendered immediately. + * + * The `useTransition` hook returns two values in an array. + * + * The first is a function that takes a callback. We can use it to tell React which state we want to defer. + * The seconda boolean. It’s React’s way of informing us whether we’re waiting for the transition to finish. + * + * **If some state update causes a component to suspend, that state update should be wrapped in a transition.** + * + * @param config An optional object with `timeoutMs` + * + * @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition + */ + export function unstable_useTransition(config?: SuspenseConfig | null): [TransitionStartFunction, boolean]; + + const opaqueIdentifierBranding: unique symbol; + /** + * WARNING: Don't use this as a `string`. + * + * This is an opaque type that is not supposed to type-check structurally. + * It is only valid if returned from React methods and passed to React e.g. `