diff --git a/src/components/InfoIcon/InfoIcon.tsx b/src/components/InfoIcon/InfoIcon.tsx new file mode 100644 index 00000000..3433ad37 --- /dev/null +++ b/src/components/InfoIcon/InfoIcon.tsx @@ -0,0 +1,5 @@ +import { Icon } from 'features/Icon' + +export const InfoIcon = () => ( + +) diff --git a/src/config/lexics/payment.tsx b/src/config/lexics/payment.tsx index f8f4d195..d7d33afd 100644 --- a/src/config/lexics/payment.tsx +++ b/src/config/lexics/payment.tsx @@ -17,4 +17,5 @@ export const paymentLexics = { payment_method: 2010, subscription_plan: 18182, sum: 838, + watch_match: 18199, } diff --git a/src/config/lexics/userAccount.tsx b/src/config/lexics/userAccount.tsx index 209248c6..dc98b64a 100644 --- a/src/config/lexics/userAccount.tsx +++ b/src/config/lexics/userAccount.tsx @@ -2,6 +2,7 @@ import { publicLexics } from './public' import { paymentLexics } from './payment' const navigations = { + about_the_project: 18170, bank_card: 14205, logout: 15058, my_devices: 15052, @@ -35,6 +36,7 @@ export const userAccountLexics = { subscriptions: 13016, subscriptions_active: 15061, subscriptions_removed: 15062, + unsubscribe_prompt: 18198, user_account: 12928, ...navigations, ...publicLexics, diff --git a/src/config/pages.tsx b/src/config/pages.tsx index cf088427..357ab69b 100644 --- a/src/config/pages.tsx +++ b/src/config/pages.tsx @@ -1,4 +1,5 @@ export const PAGES = { + about_the_project: 'https://instatsport.com/InStatTV/ott_platform', home: '/', match: '/matches', player: '/players', diff --git a/src/features/AuthServiceApp/components/Registration/index.tsx b/src/features/AuthServiceApp/components/Registration/index.tsx index 7f883aa6..c22cc405 100644 --- a/src/features/AuthServiceApp/components/Registration/index.tsx +++ b/src/features/AuthServiceApp/components/Registration/index.tsx @@ -20,6 +20,7 @@ import { ButtonSolid, Error, LanguageSelectWrapper, + Wrapper, } from '../../styled' import { Label, @@ -27,6 +28,7 @@ import { ButtonOutline, CheckboxWrapper, } from './styled' +import { CompanyInfo } from '../../../CompanyInfo' const Registration = () => { const history = useHistory() @@ -51,90 +53,93 @@ const Registration = () => { } = useRegistrationForm() return ( - - -
- + + + + + - - - - - - {formError - ? - : } - + + + + + + {formError + ? + : } + - - - - - -   - - - - - - )} - /> - - - - )} - /> - + + + + + +   + + + + + + )} + /> + + + + )} + /> + - - - { - isFetching - ? - : - } - - - - - - - - - - - + + + { + isFetching + ? + : + } + + + + + + + + + + +
+ + ) } diff --git a/src/features/BuyMatchPopup/components/BrazilPayment/hooks.tsx b/src/features/BuyMatchPopup/components/BrazilPayment/hooks.tsx new file mode 100644 index 00000000..5caaf332 --- /dev/null +++ b/src/features/BuyMatchPopup/components/BrazilPayment/hooks.tsx @@ -0,0 +1,84 @@ +import { + useEffect, + useState, + MouseEvent, +} from 'react' + +import { useHistory } from 'react-router-dom' + +import { ProfileTypes } from 'config' + +import isNumber from 'lodash/isNumber' + +import { useLexicsStore } from 'features/LexicsStore' +import { useBuyMatchPopupStore } from 'features/BuyMatchPopup/store' +import { getProfileUrl } from 'features/ProfileLink/helpers' + +import { getMatchInfo } from 'requests/getMatchInfo' +import { getBrazilPaymentUrl } from 'requests/getBrazilPaymentUrl' + +import type { Props } from './index' + +type ResponsePayment = { + url: string, +} + +type ResponsePaymentArray = ResponsePayment | null + +export const useBrazilPayment = ({ + match, + open, + selectedPackage, + setIsOpenBrasilian, +}: Props) => { + const history = useHistory() + const { close } = useBuyMatchPopupStore() + + const [src, setSrc] = useState('') + const { translate } = useLexicsStore() + + const { id, sportType } = match + + const { + name, + nameLexic, + originalObject, + pass, + } = selectedPackage + + const teams = isNumber(nameLexic) ? translate(String(nameLexic)) : name + const pack = translate(String(pass)) + + const matchLink = getProfileUrl({ + id, + profileType: ProfileTypes.MATCHES, + sportType, + }) + + const closePopup = async (e?: MouseEvent) => { + e?.stopPropagation() + setIsOpenBrasilian(false) + + const accessMatch = await getMatchInfo(sportType, id) + if (accessMatch?.access) { + close() + history.push(matchLink) + } + } + + useEffect(() => { + if (open) { + (async () => { + const json: ResponsePaymentArray = await getBrazilPaymentUrl({ item: originalObject, product_name: `${pack} ${teams}` }) + setSrc(json?.url || '') + })() + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [selectedPackage, open]) + + return { + closePopup, + matchLink, + src, + } +} diff --git a/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx b/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx index 5606c310..45ab0d83 100644 --- a/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx +++ b/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx @@ -1,66 +1,54 @@ -import { - useEffect, - useState, - MouseEvent, -} from 'react' - import { Loader } from 'features/Loader' -import { useLexicsStore } from 'features/LexicsStore' -import { MatchPackage } from 'features/BuyMatchPopup/types' +import { MatchPackage, Match } from 'features/BuyMatchPopup/types' +import { T9n } from 'features/T9n' -import { getBrazilPaymentUrl } from 'requests/getBrazilPaymentUrl' +import { useBrazilPayment } from './hooks' -import isNumber from 'lodash/isNumber' +import { + LoaderWrapper, + ScButton, + ScModal, +} from './styled' -import { ScModal, LoaderWrapper } from './styled' +import { Button } from '../../styled' -type Props = { +export type Props = { + match: Match, open: boolean, selectedPackage: MatchPackage, setIsOpenBrasilian: (open: boolean) => void, } -type ResponsePayment = { - url: string, -} - -type ResponsePaymentArray = ResponsePayment | null - export const BrazilPayment = ({ + match, open, selectedPackage, setIsOpenBrasilian, }: Props) => { const { - name, - nameLexic, - originalObject, - pass, - } = selectedPackage - const [src, setSrc] = useState('') - const { translate } = useLexicsStore() - const teams = isNumber(nameLexic) ? translate(String(nameLexic)) : name - const pack = translate(String(pass)) - - const closePopup = (e?: MouseEvent) => { - e?.stopPropagation() - setIsOpenBrasilian(false) - } - - useEffect(() => { - if (open) { - (async () => { - const json: ResponsePaymentArray = await getBrazilPaymentUrl({ item: originalObject, product_name: `${pack} ${teams}` }) - setSrc(json?.url || '') - })() - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [selectedPackage, open]) + closePopup, + matchLink, + src, + } = useBrazilPayment({ + match, + open, + selectedPackage, + setIsOpenBrasilian, + }) return ( {src && open ? ( -