feat(#2428): Edit page of subsribtions

keep-around/e74c2f530308c2d1e8ddf434ff2c47c342c26b86
Дектерев Андрей 4 years ago
parent 423dc333a2
commit e74c2f5303
  1. 48
      package-lock.json
  2. 2
      package.json
  3. 12
      src/config/lexics/payment.tsx
  4. 1
      src/config/procedures.tsx
  5. 11
      src/features/BuyMatchPopup/components/CardStep/index.tsx
  6. 100
      src/features/UserAccount/components/CancelSubPopup/index.tsx
  7. 195
      src/features/UserAccount/components/CancelSubPopup/styled.tsx
  8. 36
      src/features/UserAccount/components/ChangeCardPopup/index.tsx
  9. 25
      src/features/UserAccount/components/ChangeCardPopup/styled.tsx
  10. 15
      src/features/UserAccount/components/Header/index.tsx
  11. 62
      src/features/UserAccount/components/PageSubscriptions/hooks.tsx
  12. 232
      src/features/UserAccount/components/PageSubscriptions/index.tsx
  13. 178
      src/features/UserAccount/components/PageSubscriptions/styled.tsx
  14. 10
      src/features/UserAccount/components/ScoreSwitch/index.tsx
  15. 7
      src/features/UserAccount/index.tsx
  16. 2
      src/features/UserAccount/styled.tsx
  17. 1
      src/libs/index.ts
  18. 15
      src/libs/objects/Edit.tsx
  19. 15
      src/requests/cancelSubscribe.tsx
  20. 53
      src/requests/getUserSubscribes.tsx

48
package-lock.json generated

@ -18,7 +18,7 @@
"lodash": "^4.17.15",
"m3u8-parser": "^4.7.0",
"mobx": "^6.5.0",
"mobx-react": "^7.3.0",
"mobx-react-lite": "^3.4.0",
"oidc-client": "^1.11.5",
"react": "^17.0.2",
"react-datepicker": "^3.1.3",
@ -22974,41 +22974,17 @@
"url": "https://opencollective.com/mobx"
}
},
"node_modules/mobx-react": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/mobx-react/-/mobx-react-7.3.0.tgz",
"integrity": "sha512-RGEcwZokopqyJE5JPwXKB9FWMSqFM9NJVO2QPI+z6laJTJeBHqvPicjnKgY5mvihxTeXB1+72TnooqUePeGV1g==",
"dependencies": {
"mobx-react-lite": "^3.3.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mobx"
},
"peerDependencies": {
"mobx": "^6.1.0",
"react": "^16.8.0 || ^17"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true
},
"react-native": {
"optional": true
}
}
},
"node_modules/mobx-react-lite": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-3.3.0.tgz",
"integrity": "sha512-U/kMSFtV/bNVgY01FuiGWpRkaQVHozBq5CEBZltFvPt4FcV111hEWkgwqVg9GPPZSEuEdV438PEz8mk8mKpYlA==",
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-3.4.0.tgz",
"integrity": "sha512-bRuZp3C0itgLKHu/VNxi66DN/XVkQG7xtoBVWxpvC5FhAqbOCP21+nPhULjnzEqd7xBMybp6KwytdUpZKEgpIQ==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mobx"
},
"peerDependencies": {
"mobx": "^6.1.0",
"react": "^16.8.0 || ^17"
"react": "^16.8.0 || ^17 || ^18"
},
"peerDependenciesMeta": {
"react-dom": {
@ -50839,18 +50815,10 @@
"resolved": "https://registry.npmjs.org/mobx/-/mobx-6.5.0.tgz",
"integrity": "sha512-pHZ/cySF00FVENDWIDzJyoObFahK6Eg4d0papqm6d7yMkxWTZ/S/csqJX1A3PsYy4t5k3z2QnlwuCfMW5lSEwA=="
},
"mobx-react": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/mobx-react/-/mobx-react-7.3.0.tgz",
"integrity": "sha512-RGEcwZokopqyJE5JPwXKB9FWMSqFM9NJVO2QPI+z6laJTJeBHqvPicjnKgY5mvihxTeXB1+72TnooqUePeGV1g==",
"requires": {
"mobx-react-lite": "^3.3.0"
}
},
"mobx-react-lite": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-3.3.0.tgz",
"integrity": "sha512-U/kMSFtV/bNVgY01FuiGWpRkaQVHozBq5CEBZltFvPt4FcV111hEWkgwqVg9GPPZSEuEdV438PEz8mk8mKpYlA==",
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-3.4.0.tgz",
"integrity": "sha512-bRuZp3C0itgLKHu/VNxi66DN/XVkQG7xtoBVWxpvC5FhAqbOCP21+nPhULjnzEqd7xBMybp6KwytdUpZKEgpIQ==",
"requires": {}
},
"move-concurrently": {

@ -28,7 +28,7 @@
"lodash": "^4.17.15",
"m3u8-parser": "^4.7.0",
"mobx": "^6.5.0",
"mobx-react": "^7.3.0",
"mobx-react-lite": "^3.4.0",
"oidc-client": "^1.11.5",
"react": "^17.0.2",
"react-datepicker": "^3.1.3",

@ -1,8 +1,12 @@
export const paymentLexics = {
add_card: 8313,
address: 15203,
after_canceling: 18191,
and_month: 18186,
billing_address: 15489,
cancel_sub: 12671,
card_holder_name: 2021,
change_card: 14018,
city: 15206,
country: 835,
error_address_latin_letters: 15758,
@ -13,9 +17,17 @@ export const paymentLexics = {
error_empty_country: 15753,
error_empty_name: 15290,
error_payment_unsuccessful: 14446,
if_you_cancel: 18189,
next_payment: 18183,
payment_date: 15603,
payment_method: 2010,
save_sub: 18190,
still_cancel: 2646,
sub_not_renewed: 15060,
subscription_plan: 18182,
sum: 838,
unsubscribe: 18188,
using_payment: 18187,
watch_match: 18199,
will_automatically: 18185,
}

@ -21,6 +21,7 @@ export const PROCEDURES = {
get_user_match_second: 'get_user_match_second',
get_user_payments: 'get_user_payments',
get_user_preferences: 'get_user_preferences',
get_user_subscribes: 'get_user_subscribes',
get_user_subscriptions: 'get_user_subscriptions',
landing_get_match_info: 'landing_get_match_info',
lst_c_country: 'lst_c_country',

@ -21,7 +21,12 @@ import {
ButtonPrevious,
} from '../../styled'
export const CardStep = () => {
type CardStepType = {
btnName?: string,
title?: string,
}
export const CardStep = ({ btnName, title }: CardStepType) => {
const { cards } = useCardsStore()
const { close, goBack } = useBuyMatchPopupStore()
@ -34,7 +39,7 @@ export const CardStep = () => {
<Arrow direction='left' />
</ButtonPrevious>
<HeaderTitle>
<T9n t='pay' />
<T9n t={title ?? 'pay'} />
</HeaderTitle>
<HeaderActions position='right'>
<CloseButton onClick={close} />
@ -48,7 +53,7 @@ export const CardStep = () => {
inputsBackground='rgba(255, 255, 255, 0.1)'
>
<Button type='submit'>
<T9n t='add' />
<T9n t={btnName ?? 'add'} />
</Button>
</AddCardFormInner>
</Body>

@ -0,0 +1,100 @@
import { ArrowLoader } from 'features/ArrowLoader'
import { T9n } from 'features/T9n'
import type { Subscribe } from 'requests/getUserSubscribes'
import { format } from 'date-fns'
import {
Modal,
Wrapper,
Header,
HeaderTitle,
Body,
Footer,
ScSaveSubBtn,
Text,
ScCancelSub,
ScStillCancelBtn,
ScNotificationPopup,
ScOkBtn,
} from './styled'
type Props = {
cancelSub: () => void,
error: string,
handleModalClose: () => void,
isFetching: boolean,
isModalOpen: boolean,
isSubCanceled: boolean,
subscribe: Subscribe,
}
export const CancelSubPopup = (props: Props) => {
const {
cancelSub,
error,
handleModalClose,
isFetching,
isModalOpen,
isSubCanceled,
subscribe,
} = props
const {
access_to,
name,
option_name,
} = subscribe
return (
<Modal isOpen={isModalOpen} withCloseButton={false}>
<Wrapper>
{isSubCanceled || error ? (
<ScNotificationPopup>
<Text>
<T9n t={error || 'sub_not_renewed'} />
</Text>
<ScOkBtn onClick={() => handleModalClose()}>Ok</ScOkBtn>
</ScNotificationPopup>
) : (
<>
<Header>
<HeaderTitle>
<T9n t='unsubscribe' />
</HeaderTitle>
</Header>
<Body>
<Text>
<T9n t='if_you_cancel' />
</Text>
<ScCancelSub>
{option_name} {name}
</ScCancelSub>
<Text>
<T9n t='after_canceling' />
&nbsp;
{access_to && format(new Date(access_to), 'dd.MM.yyyy')}
</Text>
<Footer>
<ScStillCancelBtn
onClick={() => cancelSub()}
isFetching={isFetching}
>
{isFetching ? (
<ArrowLoader />
) : (
<T9n t='still_cancel' />
)}
</ScStillCancelBtn>
<ScSaveSubBtn onClick={() => handleModalClose()}>
<T9n t='save_sub' />
</ScSaveSubBtn>
</Footer>
</Body>
</>
)}
</Wrapper>
</Modal>
)
}

@ -0,0 +1,195 @@
import styled, { css } from 'styled-components/macro'
import { isMobileDevice } from 'config/userAgent'
import { devices } from 'config/devices'
import { ModalWindow } from 'features/Modal/styled'
import { Modal as BaseModal } from 'features/Modal'
import { Header as BaseHeader } from 'features/PopupComponents'
import { ButtonSolid, ButtonOutline } from 'features/Common'
export const Modal = styled(BaseModal)`
background-color: rgba(0, 0, 0, 0.7);
${ModalWindow} {
max-width: 642px;
max-height: 340px;
padding-top: 40px;
background-color: #333333;
border-radius: 5px;
${isMobileDevice
? css`
height: auto;
top: -7vh;
width: 98%;
max-height: none;
padding: 0;
`
: ''};
}
`
type WrapperProps = {
isFetching?: boolean,
}
export const Wrapper = styled.div<WrapperProps>`
${({ isFetching }) => (
isFetching
? css`pointer-events: none;`
: ''
)}
`
export const Header = styled(BaseHeader)`
height: auto;
justify-content: center;
${isMobileDevice
? css`
@media ${devices.mobile}{
padding-top: 33px;
}
`
: ''};
`
export const HeaderTitle = styled.span`
font-weight: 700;
font-size: 24px;
line-height: 24px;
color: #FFFFFF;
${isMobileDevice
? css`
font-size: 14px;
line-height: 20px;
@media (orientation: landscape) {
font-size: 20px;
}
`
: ''};
`
export const Body = styled.div`
padding: 20px 40px;
display: flex;
flex-direction: column;
font-weight: normal;
font-size: 20px;
line-height: 27px;
${isMobileDevice
? css`
padding: 13px 25px 0;
flex-direction: column;
@media (orientation: landscape){
padding: 22px 23px 0 29px;
}
`
: ''};
`
export const Footer = styled.div`
width: 100%;
display: flex;
justify-content: center;
margin-top: 25px;
${isMobileDevice
? css`
flex-direction: column;
`
: ''};
`
export const ScSaveSubBtn = styled(ButtonSolid)`
max-width: 270px;
border-radius: 5px;
font-weight: 600;
height: 50px;
font-size: 20px;
${isMobileDevice
? css`
max-width: none;
width: 100%;
min-height: 42px;
margin-bottom: 20px;
@media (orientation: landscape){
width: 290px;
min-height: 42px;
}
`
: ''};
`
export const ScStillCancelBtn = styled(ButtonOutline)<{isFetching: boolean}>`
max-width: 270px;
height: 50px;
border-radius: 5px;
font-weight: 500;
font-size: 20px;
margin-right: 24px;
${({ isFetching }) => (isFetching ? 'border: none' : '')};
${isMobileDevice
? css`
max-width: none;
margin-bottom: 20px;
width: 100%;
@media (orientation: landscape){
width: 290px;
}
`
: ''};
`
export const Text = styled.span`
display: block;
color: rgba(255, 255, 255, 0.7);
font-weight: 500;
font-size: 16px;
line-height: 20px;
${isMobileDevice
? css`
font-size: 13px;
`
: ''};
`
export const ScCancelSub = styled.div`
max-width: 562px;
height: 59px;
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0.1) 0%,
rgba(255, 255, 255, 0) 100%
),
#3f3f3f;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3);
border-radius: 2px;
font-weight: 500;
font-size: 18px;
line-height: 22px;
padding: 20px;
margin: 20px 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
`
export const ScNotificationPopup = styled.div`
display: flex;
flex-direction: column;
align-items: center;
`
export const ScOkBtn = styled(ScSaveSubBtn)`
max-width: 70px;
margin-top: 40px;
`

@ -0,0 +1,36 @@
import { useEffect } from 'react'
import { useCardsStore } from 'features/CardsStore'
import { CardStep } from 'features/BuyMatchPopup/components/CardStep'
import { Modal } from './styled'
type Props = {
changeCardPopupOpen: boolean,
setChangeCardPopupOpen: (open: boolean) => void,
}
export const ChangeCardPopup = ({
changeCardPopupOpen,
setChangeCardPopupOpen,
}: Props) => {
const { fetchCards } = useCardsStore()
useEffect(() => {
fetchCards()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
return (
<Modal
isOpen={changeCardPopupOpen}
close={() => setChangeCardPopupOpen(false)}
withCloseButton
>
<CardStep
title='change_card'
btnName='change'
/>
</Modal>
)
}

@ -0,0 +1,25 @@
import styled, { css } from 'styled-components/macro'
import { ModalWindow } from 'features/Modal/styled'
import { Modal as BaseModal } from 'features/Modal'
import { isMobileDevice } from 'config/userAgent'
export const Modal = styled(BaseModal)`
background-color: rgba(0, 0, 0, 0.7);
${ModalWindow} {
padding: 0;
background-color: #333333;
border-radius: 5px;
${isMobileDevice
? css`
width: calc(100vw - 60px);
@media screen and (orientation: landscape){
max-width: calc(100vw - 80px);
height: calc(100vh - 20px);
overflow: auto;
}
`
: ''};
}
`

@ -20,18 +20,15 @@ const HeaderStyled = styled.header`
min-height: auto;
}
${isMobileDevice ? css`
@media (max-width: 650px) {
margin-bottom: 20px;
}
@media (orientation: landscape) {
margin-bottom: 20px;
}
` : ''};
${isMobileDevice
? css`
padding: 20px 0;
`
: ''};
`
export const HeaderLogo = styled(Logo)`
${client.styles.userAccountLogo}
${client.styles.userAccountLogo};
${isMobileDevice
? client.styles.mobileHeaderLogo

@ -0,0 +1,62 @@
import { useEffect, useState } from 'react'
import { getUserSubscribes, Subscribe } from 'requests/getUserSubscribes'
import { cancelSubscribe } from 'requests/cancelSubscribe'
import { useAuthStore } from 'features/AuthStore'
export const useUserSubscribes = () => {
const [selectedSubscribe, setSelectedSubscribe] = useState<Subscribe>({} as Subscribe)
const [subscribes, setSubscribes] = useState<any>([])
const [isCancelPopupOpen, setIsCancelPopupOpen] = useState(false)
const [changeCardPopupOpen, setChangeCardPopupOpen] = useState(false)
const [isSubCanceled, setSubCanceled] = useState(false)
const [isFetching, setIsFetching] = useState(false)
const [error, setError] = useState('')
const { user } = useAuthStore()
const handleClose = () => {
setIsCancelPopupOpen(false)
setChangeCardPopupOpen(false)
setError('')
}
const cancelSub = async () => {
try {
setIsFetching(true)
if (selectedSubscribe?.sub_id) {
await cancelSubscribe(selectedSubscribe?.sub_id)
setSubCanceled(true)
}
} catch {
setError('error_payment_unsuccessful')
}
setIsFetching(false)
}
useEffect(() => {
(async () => {
setIsFetching(true)
const allSubscribes = (await (getUserSubscribes(user?.profile?.email || '')))
.sort((a, b) => Date.parse(b.access_to) - Date.parse(a.access_to))
setSubscribes(allSubscribes)
setIsFetching(false)
})()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
return {
cancelSub,
changeCardPopupOpen,
error,
handleClose,
isCancelPopupOpen,
isFetching,
isSubCanceled,
selectedSubscribe,
setChangeCardPopupOpen,
setIsCancelPopupOpen,
setSelectedSubscribe,
subscribes,
}
}

@ -1,16 +1,26 @@
import map from 'lodash/map'
import { SportTypes } from 'config'
import { SubscriptionType } from 'features/BuyMatchPopup/types'
import { T9n } from 'features/T9n'
import { Loader } from 'features/Loader'
import type { Subscribe } from 'requests/getUserSubscribes'
import format from 'date-fns/format'
import { useUserSubscribes } from './hooks'
import { ChangeCardPopup } from '../ChangeCardPopup'
import { CancelSubPopup } from '../CancelSubPopup'
import { UserSubscriptionsList } from '../UserSubscriptionsList'
import {
Wrapper,
SubscriptionsWrapper,
Tabs,
Tab,
ScItem,
ScText,
ScSubscribe,
ScCancelButton,
ScBtnWrap,
ScItemPaymentSum,
ScCard,
ScLoaderWrapper,
} from './styled'
type MatchSubscription = {
@ -24,85 +34,137 @@ type MatchSubscription = {
export type MatchSubscriptions = Array<MatchSubscription>
const data: Record<SportTypes, MatchSubscriptions> = {
[SportTypes.FOOTBALL]: [
{
description: 'Доступ к прямой трансляции, записи и хайлайты матча',
header: 'подписка на матч спартак-динамо',
isActive: true,
price: 999,
subscription_id: 1,
type: SubscriptionType.Month,
},
{
description: 'все матчи спартака в сезоне 2020-2021',
header: 'подписка на матч спартак-динамо',
isActive: true,
price: 999,
subscription_id: 2,
type: SubscriptionType.Month,
},
{
description: 'Доступ к прямой трансляции, записи и хайлайты матча',
header: 'подписка на матч спартак-динамо',
isActive: true,
price: 999,
subscription_id: 3,
type: SubscriptionType.Month,
},
],
[SportTypes.BASKETBALL]: [],
[SportTypes.HANDBALL]: [],
[SportTypes.VOLLEYBALL]: [],
[SportTypes.STREETBALL]: [],
[SportTypes.HOCKEY]: [
{
description: 'все матчи спартака в сезоне 2020-2021',
header: 'подписка на матч спартак-динамо',
isActive: true,
price: 999,
subscription_id: 4,
type: SubscriptionType.Month,
},
{
description: 'Доступ к прямой трансляции, записи и хайлайты матча',
header: 'подписка на матч спартак-динамо',
isActive: true,
price: 999,
subscription_id: 5,
type: SubscriptionType.Month,
},
{
description: 'Доступ к прямой трансляции, записи и хайлайты матча',
header: 'подписка на матч спартак-динамо',
isActive: true,
price: 999,
subscription_id: 6,
type: SubscriptionType.Month,
},
],
}
export const PageSubscriptions = () => {
const {
cancelSub,
changeCardPopupOpen,
error,
handleClose,
isCancelPopupOpen,
isFetching,
isSubCanceled,
selectedSubscribe,
setChangeCardPopupOpen,
setIsCancelPopupOpen,
setSelectedSubscribe,
subscribes,
} = useUserSubscribes()
export const PageSubscriptions = () => (
return (
<>
{isFetching
? (
<ScLoaderWrapper>
<Loader color='#515151' />
</ScLoaderWrapper>
) : (
<Wrapper>
<Tabs>
<Tab active>
<T9n t='subscriptions_active' />
</Tab>
<Tab>
<T9n t='subscriptions_removed' />
</Tab>
</Tabs>
<SubscriptionsWrapper>
{
map(data, (subscriptions, sport: SportTypes) => (
<UserSubscriptionsList
key={sport}
list={subscriptions}
sport={sport}
/>
))
{subscribes?.map((subscribe: Subscribe) => {
const {
access_to,
card,
is_active,
iso,
name,
option_name,
price,
purchase_type,
sub_id,
} = subscribe
const hideCancel = selectedSubscribe.sub_id === sub_id && isSubCanceled
return (
<ScSubscribe key={`${access_to}${name}`}>
<ScItem>
<T9n t='subscription_plan' className='payment_title' />
<ScText className='payment_plan'>
{option_name} {name}
</ScText>
</ScItem>
<ScItemPaymentSum>
<ScItem>
<T9n t='sum' className='payment_title' />
<ScText>
{iso} {price}
</ScText>
</ScItem>
<ScItem>
<T9n
t={
purchase_type === 'subscription'
? 'next_payment'
: 'payment_date'
}
</SubscriptionsWrapper>
className='payment_title'
/>
<ScText>
{format(new Date(access_to), 'd MMM yyyy')}
</ScText>
</ScItem>
</ScItemPaymentSum>
<ScItem>
<T9n t='payment_method' className='payment_title' />
<ScText className='payment_method'>
<ScCard>{card}</ScCard>
{/* <Icon
refIcon='Edit'
color='white'
onClick={() => setChangeCardPopupOpen(true)}
/>
<T9n t='change'
className='change'
onClick={() => setChangeCardPopupOpen(true)}
/> */}
</ScText>
</ScItem>
{is_active
&& purchase_type === 'subscription'
&& !hideCancel ? (
<ScItem>
<ScBtnWrap>
{!error
&& !isSubCanceled
&& selectedSubscribe.sub_id === sub_id
&& isCancelPopupOpen ? null : (
<ScCancelButton
onClick={() => {
setIsCancelPopupOpen(true)
setSelectedSubscribe(subscribe)
}}
>
<T9n t='cancel_sub' />
</ScCancelButton>
)}
</ScBtnWrap>
<ScText className='additional_info' onClick={handleClose}>
<T9n t='will_automatically' />
&nbsp;
{iso} {price}
<T9n t='and_month' />
&nbsp;
<T9n t='using_payment' />
</ScText>
</ScItem>
) : null}
</ScSubscribe>
)
})}
</Wrapper>
)}
<CancelSubPopup
cancelSub={cancelSub}
error={error}
isFetching={isFetching}
isModalOpen={isCancelPopupOpen}
isSubCanceled={isSubCanceled}
handleModalClose={handleClose}
subscribe={selectedSubscribe}
/>
<ChangeCardPopup
changeCardPopupOpen={changeCardPopupOpen}
setChangeCardPopupOpen={setChangeCardPopupOpen}
/>
</>
)
}

@ -3,9 +3,14 @@ import styled, { css } from 'styled-components/macro'
import { isMobileDevice } from 'config/userAgent'
import { popupScrollbarStyles } from 'features/PopupComponents'
import { customScrollbar } from 'features/Common'
export const Wrapper = styled.div`
width: 100%;
max-height: 600px;
overflow-y: auto;
${customScrollbar}
`
export const SubscriptionsWrapper = styled.div`
@ -15,62 +20,163 @@ export const SubscriptionsWrapper = styled.div`
margin-bottom: 28px;
${popupScrollbarStyles}
${isMobileDevice
? css`
margin-bottom: 35px;
`
: ''};
`
export const Tabs = styled.div`
export const ScItem = styled.div`
font-weight: 500;
font-size: 18px;
line-height: 22px;
text-transform: uppercase;
color: rgba(255, 255, 255, 0.6);
display: flex;
margin-bottom: 40px;
flex-direction: row;
margin-bottom: 25px;
.additional_info {
color: rgba(255, 255, 255, 0.3);
font-weight: 500;
font-size: 13px;
line-height: 22px;
text-transform: none;
${isMobileDevice
? css`
margin-top: 15px;
font-size: 10px;
line-height: 15px;
margin-top: 20px;
`
: ''}
: ''};
}
${isMobileDevice
? css`
flex-direction: column;
margin-bottom: 20px;
`
: ''};
.payment_title {
width: 360px;
type TabProps = {
active?: boolean,
${isMobileDevice
? css`
font-size: 10px;
width: 150px;
`
: ''};
}
export const Tab = styled.button<TabProps>`
position: relative;
border: none;
padding: 0;
background-color: transparent;
width: 288px;
font-weight: 600;
font-size: 16px;
line-height: 50px;
.change {
margin-left: 10px;
text-decoration: underline;
text-transform: none;
color: rgba(255, 255, 255, 0.5);
cursor: pointer;
}
${({ active, theme }) => (
active
? css`
color: ${theme.colors.white};
.payment_method {
display: flex;
flex-direction: row;
}
::after {
position: absolute;
bottom: 0;
left: 0;
content: '';
width: 100%;
height: 4px;
background-color: #fff;
.payment_plan {
text-transform: none;
}
`
: '')}
export const ScText = styled.span`
color: #FFFFFF;
max-width: 560px;
${isMobileDevice
? css`
font-size: 14px;
line-height: 14px;
::after {
bottom: -15px;
height: 2px;
}
@media (orientation: landscape){
width: 50%;
line-height: 17px;
align-items: center
`
: ''};
`
export const ScCard = styled.div`
margin-right: 50px;
${isMobileDevice
? css`
margin: 0;
width: 150px;
`
: ''};
`
export const ScBtnWrap = styled.div`
min-width: 360px;
${isMobileDevice
? css`
min-width: 100%;
display: flex;
justify-content: center;
`
: ''};
`
export const ScSubscribe = styled.div`
margin-bottom: 70px;
`
export const ScItemPaymentSum = styled.div`
${isMobileDevice
? css`
display: flex;
flex-direction: row;
`
: ''};
`
export const ScCancelButton = styled.button`
border: none;
outline: none;
padding: 0;
background-color: transparent;
cursor: pointer;
background: #294FC4;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3);
border-radius: 5px;
width: 100%;
max-width: 244px;
height: 50px;
font-weight: 600;
font-size: 20px;
line-height: 50px;
color: #FFFFFF;
:disabled {
opacity: 0.5;
}
${isMobileDevice
? css`
font-size: 16px;
line-height: 16px;
min-width: 100%;
`
: ''}
: ''};
`
export const ScLoaderWrapper = styled.div`
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
`

@ -20,6 +20,14 @@ const Wrapper = styled.div<TWrapper>`
${isMobileDevice
? css`
margin-top: 0;
margin-bottom: 20px;
> * {
&:first-child {
justify-content: flex-start;
}
}
`
: ''}
@ -50,7 +58,7 @@ export const ScoreSwitch = ({ className }: Props) => {
return (
<Wrapper
className={className}
isHidden={isMobileDevice}
// isHidden={isMobileDevice}
>
<Switch
role='switch'

@ -17,7 +17,6 @@ import { PageBankCards } from './components/PageBankCards'
import { PageSubscriptions } from './components/PageSubscriptions'
import { PagePaymentsHistory } from './components/PagePaymentsHistory'
import { ScoreSwitch } from './components/ScoreSwitch'
import { UnsubscribePrompt } from './components/UnsubscribePrompt'
import {
Aside,
Body,
@ -49,10 +48,7 @@ const UserAccount = () => {
>
<T9n t='bank_card' />
</StyledLink>
<StyledLink
disabled={isProduction || client.userAccountLinksDisabled}
to={`${PAGES.useraccount}/subscriptions`}
>
<StyledLink to={`${PAGES.useraccount}/subscriptions`}>
<T9n t='my_subscriptions' />
</StyledLink>
<StyledLink
@ -74,7 +70,6 @@ const UserAccount = () => {
</StyledLink>
<ScoreSwitch />
<UnsubscribePrompt />
</Navigations>
</Aside>
<ContentWrapper>

@ -172,6 +172,7 @@ export const Navigations = styled.nav`
width: 100%;
border: none;
margin-bottom: 0;
border-bottom: 1px solid rgba(255,255,255,0.4);
}
@media ${devices.mobile} {
@ -184,6 +185,7 @@ export const Navigations = styled.nav`
border-right: 1px solid rgba(255, 255, 255, 0.4);
height: 100%;
}
`
: ''};
`

@ -1,5 +1,6 @@
export { Arrow } from './objects/Arrow'
export { Date } from './objects/Date'
export { Edit } from './objects/Edit'
export { Calendar } from './objects/Calendar'
export { Basketball } from './objects/Basketball'
export { Football } from './objects/Football'

@ -0,0 +1,15 @@
export const Edit = (): JSX.Element => (
<svg
xmlns='http://www.w3.org/2000/svg'
width='22'
height='23'
fill='true'
viewBox='0 0 22 23'
>
<path
fill='true'
fillOpacity='0.3'
d='M13.705 5.002L17.27 8.52 5.799 20.147l-4.017.507.452-4.023L13.705 5.002zM16.183 2.49a2.504 2.504 0 013.565 3.516L18.53 7.24l-3.565-3.517 1.217-1.234z'
/>
</svg>
)

@ -0,0 +1,15 @@
import { API_ROOT } from 'config'
import { callApi } from 'helpers'
export const cancelSubscribe = (id: number): Promise<unknown> => {
const config = {
body: {
id,
},
}
return callApi({
config,
url: `${API_ROOT}/account/subscription/cancel`,
})
}

@ -0,0 +1,53 @@
import { DATA_URL, PROCEDURES } from 'config'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_user_subscribes
export type Subscribe = {
access_to: string,
c_payment_service: number,
c_subscription_option: number,
card: string,
currency_id: number,
dt_next_billing: string | null,
is_access: boolean,
is_active: boolean,
iso: string,
name: string,
option_name: string,
option_sys_name: string,
payment_type: string,
price: number,
purchase_type: string,
sub_external_id: number | null,
sub_id: number | null,
sub_info: Array<Team>,
ts_payment: string,
}
type Team = {
id: number,
name_en: string,
name_ru: string,
}
type Subscribes = Array<Subscribe>
export const getUserSubscribes = (
_p_email: string,
)
: Promise<Subscribes> => {
const config = {
body: {
params: {
_p_email,
},
proc,
},
}
return callApi({
config,
url: DATA_URL,
})
}
Loading…
Cancel
Save