|
|
|
@ -11,10 +11,12 @@ import { ProfileTypes } from 'config' |
|
|
|
import isNumber from 'lodash/isNumber' |
|
|
|
import isNumber from 'lodash/isNumber' |
|
|
|
|
|
|
|
|
|
|
|
import { useLexicsStore } from 'features/LexicsStore' |
|
|
|
import { useLexicsStore } from 'features/LexicsStore' |
|
|
|
|
|
|
|
import { useBuyMatchPopupStore } from 'features/BuyMatchPopup/store' |
|
|
|
import { getProfileUrl } from 'features/ProfileLink/helpers' |
|
|
|
import { getProfileUrl } from 'features/ProfileLink/helpers' |
|
|
|
|
|
|
|
|
|
|
|
import { getMatchInfo } from 'requests/getMatchInfo' |
|
|
|
import { getMatchInfo } from 'requests/getMatchInfo' |
|
|
|
import { getBrazilPaymentUrl } from 'requests/getBrazilPaymentUrl' |
|
|
|
import { getBrazilPaymentUrl } from 'requests/getBrazilPaymentUrl' |
|
|
|
|
|
|
|
|
|
|
|
import type { Props } from './index' |
|
|
|
import type { Props } from './index' |
|
|
|
|
|
|
|
|
|
|
|
type ResponsePayment = { |
|
|
|
type ResponsePayment = { |
|
|
|
@ -30,10 +32,13 @@ export const useBrazilPayment = ({ |
|
|
|
setIsOpenBrasilian, |
|
|
|
setIsOpenBrasilian, |
|
|
|
}: Props) => { |
|
|
|
}: Props) => { |
|
|
|
const history = useHistory() |
|
|
|
const history = useHistory() |
|
|
|
|
|
|
|
const { close } = useBuyMatchPopupStore() |
|
|
|
|
|
|
|
|
|
|
|
const [src, setSrc] = useState('') |
|
|
|
const [src, setSrc] = useState('') |
|
|
|
const { translate } = useLexicsStore() |
|
|
|
const { translate } = useLexicsStore() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { id, sportType } = match |
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
|
const { |
|
|
|
name, |
|
|
|
name, |
|
|
|
nameLexic, |
|
|
|
nameLexic, |
|
|
|
@ -44,19 +49,19 @@ export const useBrazilPayment = ({ |
|
|
|
const teams = isNumber(nameLexic) ? translate(String(nameLexic)) : name |
|
|
|
const teams = isNumber(nameLexic) ? translate(String(nameLexic)) : name |
|
|
|
const pack = translate(String(pass)) |
|
|
|
const pack = translate(String(pass)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const matchLink = getProfileUrl({ |
|
|
|
|
|
|
|
id, |
|
|
|
|
|
|
|
profileType: ProfileTypes.MATCHES, |
|
|
|
|
|
|
|
sportType, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const closePopup = async (e?: MouseEvent) => { |
|
|
|
const closePopup = async (e?: MouseEvent) => { |
|
|
|
e?.stopPropagation() |
|
|
|
e?.stopPropagation() |
|
|
|
setIsOpenBrasilian(false) |
|
|
|
setIsOpenBrasilian(false) |
|
|
|
|
|
|
|
|
|
|
|
const { id, sportType } = match |
|
|
|
|
|
|
|
const accessMatch = await getMatchInfo(sportType, id) |
|
|
|
const accessMatch = await getMatchInfo(sportType, id) |
|
|
|
|
|
|
|
if (!accessMatch?.access) { |
|
|
|
if (accessMatch?.access) { |
|
|
|
close() |
|
|
|
const matchLink = getProfileUrl({ |
|
|
|
|
|
|
|
id, |
|
|
|
|
|
|
|
profileType: ProfileTypes.MATCHES, |
|
|
|
|
|
|
|
sportType, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
history.push(matchLink) |
|
|
|
history.push(matchLink) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -73,6 +78,7 @@ export const useBrazilPayment = ({ |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
closePopup, |
|
|
|
closePopup, |
|
|
|
|
|
|
|
matchLink, |
|
|
|
src, |
|
|
|
src, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|