Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

[CRO][Translation] MyAffiliate signup form #5992

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
51dfda1
feat: new affiliate signup page
NikitK-deriv Dec 4, 2023
1f5c39d
fix: urls and phone
NikitK-deriv Dec 4, 2023
a0f7a11
fix: translations
NikitK-deriv Dec 4, 2023
72a1058
fix: getting the language
NikitK-deriv Dec 4, 2023
2e9f96a
fix: phone number issue
NikitK-deriv Dec 4, 2023
3eeeb77
fix: enable capital letter for email input
NikitK-deriv Dec 4, 2023
3713c41
chore: merge with latest master
NikitK-deriv Dec 6, 2023
252b330
fix: phone code send wrong values
NikitK-deriv Dec 6, 2023
7f8454d
auto-pull-translation
NikitK-deriv Dec 6, 2023
962bf99
translation: 📚 sync translations from crowdin feature branch
DerivFE Dec 6, 2023
ceacdcd
fix: a lot of minor issues
NikitK-deriv Dec 6, 2023
6d61d98
chore: fix eslnit issue
NikitK-deriv Dec 6, 2023
324d244
chore: merge with latest master
NikitK-deriv Dec 6, 2023
30b82ff
fix: responsive design for modals and arabic language
NikitK-deriv Dec 7, 2023
99cd06e
fix: terms of use sending to API
NikitK-deriv Dec 7, 2023
95fb281
fix: resolving react minify errors
NikitK-deriv Dec 7, 2023
1ed735b
fix: react minify errors, ab test, validation
NikitK-deriv Dec 7, 2023
a5cb702
chore: merge conflicts
NikitK-deriv Dec 7, 2023
e1448e4
chore: new localise text and wizard size change
NikitK-deriv Dec 7, 2023
0fe98cf
auto-pull-translation
NikitK-deriv Dec 7, 2023
2bd1219
translation: 📚 sync translations from crowdin feature branch
DerivFE Dec 7, 2023
947dc81
fix: datepicker input
NikitK-deriv Dec 8, 2023
9cc67c5
fix: datepicker input and password passing
NikitK-deriv Dec 8, 2023
0876642
chore: resolve merge conflicts
NikitK-deriv Dec 8, 2023
fbd814c
fix: ab testing
NikitK-deriv Dec 8, 2023
9f26e51
fix: add ab test for one more button and fix datapicker input
NikitK-deriv Dec 8, 2023
a31337f
fix: datapicker input
NikitK-deriv Dec 8, 2023
c2da6b7
fix: datepicker, states
NikitK-deriv Dec 8, 2023
bc22de3
refactor: tracking events, some minor changes with keys, brackets and id
NikitK-deriv Dec 11, 2023
29706e7
refactor: handlers and password validation
NikitK-deriv Dec 11, 2023
5b3727b
chore: merge with latest master
NikitK-deriv Dec 11, 2023
10cae08
refactor: make tracking utility and some refactor around
NikitK-deriv Dec 12, 2023
fc618bb
refactor: types, state, images
NikitK-deriv Dec 12, 2023
a792553
refactor: state, local constants movement
NikitK-deriv Dec 12, 2023
91ed788
fix: security, deployment, console logs
NikitK-deriv Dec 12, 2023
ca1ebb7
refactor: validation and state management
NikitK-deriv Dec 12, 2023
0397df3
fix: increase length of phone number
NikitK-deriv Dec 12, 2023
f5d8ee3
refactor: inputs, filter and data fix by individual account
NikitK-deriv Dec 13, 2023
4640b5b
chore: console log
NikitK-deriv Dec 13, 2023
74476f7
fix: issue with incorrect name
NikitK-deriv Dec 13, 2023
974508a
fix: add mandatory fields
NikitK-deriv Dec 13, 2023
1483c93
chore: merge with latest master
NikitK-deriv Dec 13, 2023
07c1092
fix: state empty on try again
NikitK-deriv Dec 13, 2023
45ec97b
refactor: validate feature movement and prepare for debounce
NikitK-deriv Dec 13, 2023
3b0c390
fix: api limitations
NikitK-deriv Dec 13, 2023
90c36b1
fix: deployment issue
NikitK-deriv Dec 13, 2023
367cf5f
chore: resolve merge conflicts
NikitK-deriv Dec 13, 2023
24c09ed
fix: deployment issue
NikitK-deriv Dec 13, 2023
04e7653
refactor: button enabling condition
NikitK-deriv Dec 14, 2023
0ada7c7
chore: merge with lastest master
NikitK-deriv Dec 14, 2023
d947384
refactor: step view and date picker on safari fix
NikitK-deriv Dec 14, 2023
5eea7bd
feat: add new text
NikitK-deriv Dec 15, 2023
2bc1e64
auto-pull-translation
NikitK-deriv Dec 15, 2023
f53b848
chore: empty commit
NikitK-deriv Dec 15, 2023
20e5253
auto-pull-translation
NikitK-deriv Dec 18, 2023
e926260
translation: 📚 sync translations from crowdin feature branch
DerivFE Dec 18, 2023
c5096b2
chore: empty commit
NikitK-deriv Dec 18, 2023
7b06e63
fix: update password validation
NikitK-deriv Dec 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 106 additions & 6 deletions crowdin/messages.json

Large diffs are not rendered by default.

221 changes: 208 additions & 13 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"prompt-sync": "^4.2.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-date-picker": "8.4.0",
"react-device-detect": "^2.2.2",
"react-dom": "^18.2.0",
"react-hook-form": "^7.43.9",
Expand Down
4 changes: 2 additions & 2 deletions src/components/custom/signup.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState } from 'react'
import { graphql, useStaticQuery, navigate } from 'gatsby'
import { graphql, navigate, useStaticQuery } from 'gatsby'
import styled from 'styled-components'
import Cookies from 'js-cookie'
import { getLanguage } from '../../common/utility'
import { getCookiesObject, getCookiesFields, getDataObjFromCookies } from 'common/cookies'
import { getCookiesFields, getCookiesObject, getDataObjFromCookies } from 'common/cookies'
import { Flex } from 'components/containers'
import Login, { TSocialProvider } from 'common/login'
import validation from 'common/validation'
Expand Down
4 changes: 4 additions & 0 deletions src/components/elements/dropdown-search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ const DropdownSearch = ({
}
}, [selected_item])

useEffect(() => {
setDropdownItems([...items])
}, [items])

const handleInputChange = (e) => {
setInputValue(e.target.value)
toggleListVisibility(e)
Expand Down
3 changes: 1 addition & 2 deletions src/components/elements/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ const UnorderedList = styled.ul<DropdownStyledProps>`
position: absolute;
left: 0;
top: 0.8rem;
border-radius: 4px;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.16);
transition: opacity 0.1s cubic-bezier(0, 0, 0.38, 0.9),
max-height 0.25s cubic-bezier(0, 0, 0.38, 0.9);
Expand Down Expand Up @@ -313,7 +312,7 @@ export const StyledLabel = styled.label<DropdownStyledProps>`
color: var(--color-green);
transform: translate(-0.6rem, -2.2rem) scale(0.7);
@media ${device.tabletL} {
top: 9px;
top: 15px;
}
`
}}
Expand Down
20 changes: 10 additions & 10 deletions src/components/form/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface ReactInput extends React.ComponentPropsWithoutRef<'input'> {
) => void
}

type InputProps = ReactInput & InputWrapperProps & StyledInputProps & StyledLabelProps
export type InputProps = ReactInput & InputWrapperProps & StyledInputProps & StyledLabelProps

type InputWrapperProps = {
border?: string
Expand Down Expand Up @@ -53,10 +53,10 @@ type StyledLabelProps = {
htmlFor?: string
}

const RelativeWrapper = styled.div`
export const RelativeWrapper = styled.div`
position: relative;
`
const InputWrapper = styled.div<InputWrapperProps>`
export const InputWrapper = styled.div<InputWrapperProps>`
/* prettier-ignore */
width: 100%;
border: ${(props) => props.border || '1px solid var(--color-grey-2)'};
Expand Down Expand Up @@ -96,7 +96,7 @@ const InputWrapper = styled.div<InputWrapperProps>`
`}
`

const StyledError = styled.img`
export const StyledError = styled.img`
position: absolute;
right: 0.8rem;
top: 1.2rem;
Expand All @@ -112,7 +112,7 @@ const StyledError = styled.img`
}
`

const StyledInput = styled.input<StyledInputProps>`
export const StyledInput = styled.input<StyledInputProps>`
color: ${({ inputColor }) =>
inputColor ? `var(--color-${inputColor})` : 'var(--color-black)'};
font-size: var(--text-size-s);
Expand All @@ -130,7 +130,7 @@ const StyledInput = styled.input<StyledInputProps>`

& ~ label {
font-size: 1.75rem;
top: 1.95rem;
top: 15px;
}
}
@media ${device.mobileL} {
Expand All @@ -154,7 +154,7 @@ const StyledInput = styled.input<StyledInputProps>`
background-color: ${({ background }) =>
background ? `var(--color-${background})` : 'var(--color-grey-1)'};

@media ${device.mobileL} {
@media ${device.tablet} {
transform: translate(-0.6rem, -20px) scale(0.7);
}
}
Expand All @@ -179,21 +179,21 @@ const StyledInput = styled.input<StyledInputProps>`
background ? `var(--color-${background})` : 'var(--color-grey-1)'};

@media ${device.tabletL} {
top: 9px;
top: 15px;
}
}
`}
}
`

const ErrorMessages = styled(Text)`
export const ErrorMessages = styled(Text)`
padding: 6px;
font-size: 1.2rem;
min-height: 16px;
color: var(--color-red-1);
`

const StyledLabel = styled.label<StyledLabelProps>`
export const StyledLabel = styled.label<StyledLabelProps>`
color: ${({ label_color }) =>
label_color ? `var(--color-${label_color})` : 'var(--color-grey)'};
font-size: var(--text-size-xs);
Expand Down
2 changes: 2 additions & 0 deletions src/components/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import BugBountyNav from 'features/components/templates/navigation/bug-bounty-na
import CareerNav from 'features/components/templates/navigation/career-nav'
import MarketNav from 'features/components/templates/navigation/market-nav'
import PpcProvider from 'features/contexts/ppc-campaign/ppc.provider'
import AffiliateNav from 'features/components/templates/navigation/affiliates-nav'
import BannerAlert from 'components/custom/_banner-alert'
import { bannerTypes } from 'common/constants'

Expand Down Expand Up @@ -80,6 +81,7 @@ const Navs = {
careers: <CareerNav />,

'payment-methods': <MainNav />,
affiliates: <AffiliateNav />,
}

const Layout = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react'
import Link from 'features/components/atoms/link'
import Image from 'features/components/atoms/image'
import NavTemplate from 'features/components/templates/navigation/template'
import LanguageSwitcher from 'features/components/molecules/language-switcher'
import { partners_nav_logo } from 'features/components/templates/navigation/payment-agent-nav/payment-agent-nav.module.scss'
import PartnerNavLogo from 'images/svg/partner-nav-logo.svg'

const AffiliateNav = () => {
return (
<NavTemplate
renderLogo={() => (
<Link url={{ type: 'internal', to: '/partners/' }}>
<Image
src={PartnerNavLogo}
alt={'nav affiliates'}
NikitK-deriv marked this conversation as resolved.
Show resolved Hide resolved
className={partners_nav_logo}
aria-label="deriv logo link"
/>
</Link>
)}
>
<LanguageSwitcher />
</NavTemplate>
)
}

export default AffiliateNav
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useMemo } from 'react'
import NavTemplate from '../template'
import affiliateNavItems from './data'
import { partners_nav_logo, partners_buttons } from './payment-agent-nav.module.scss'
import { partners_buttons, partners_nav_logo } from './payment-agent-nav.module.scss'
import PrimeLogo from 'images/svg/deriv-prime/deriv-prime-logo.svg'
import PartnerNavLogo from 'images/svg/partner-nav-logo.svg'
import Image from 'features/components/atoms/image'
Expand All @@ -12,6 +12,7 @@ import Link from 'features/components/atoms/link'
import Flex from 'features/components/atoms/flex-box'
import { getLocationPathname } from 'common/utility'
import useScrollToElement from 'features/hooks/use-scroll-to-element'
import useAffiliateSignupLink from 'features/hooks/ab-testing/use-partners-signup-link'
import useRegion from 'components/hooks/use-region'
import { TString } from 'types/generics'
import { localize } from 'components/localization'
Expand All @@ -25,6 +26,8 @@ const PaymentAgentAffiliateNav = ({ is_prime_page = false }: { is_prime_page?: b
const clickToScrollHandler = useScrollToElement('getintouch')

const { is_eu } = useRegion()
const { affiliate_signup_link } = useAffiliateSignupLink()

const texts: contentType = is_eu
? {
login: '_t_Affiliate log in_t_',
Expand Down Expand Up @@ -67,15 +70,15 @@ const PaymentAgentAffiliateNav = ({ is_prime_page = false }: { is_prime_page?: b
</Button.Primary>
<Button.Primary
id="dm-nav-affiliate-signup-button"
onClick={() => window.open('https://login.deriv.com/signup.php', '_blank')}
onClick={() => window.open(affiliate_signup_link, '_blank')}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can avoid creating lambda on each render.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked, here is static page so doesn't have sense. but I fixed most of lambdas in the form

visible={'larger-than-tablet'}
className={partners_buttons}
>
<Localize translate_text={texts.sign_up} />
</Button.Primary>
</>
)
}, [path_name])
}, [path_name, affiliate_signup_link])

return (
<NavTemplate
Expand Down
29 changes: 29 additions & 0 deletions src/features/hooks/ab-testing/use-partners-signup-link/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useEffect, useState } from 'react'
import { Analytics } from '@deriv/analytics'
import { getLanguage } from 'common/utility'
import { affiliate_signup_url } from 'common/constants'

const useAffiliateSignupLink = () => {
const [affiliate_signup_link, setAffiliateSignupLink] = useState('')

useEffect(() => {
const partners_signup_ab_test = Analytics?.getFeatureValue(
'partners_signup_ab_test',
'fallback',
)
const language = getLanguage()

const calculated_link =
partners_signup_ab_test === true
? `${window.location.origin}${
language !== 'en' ? '/' + language : ''
}/signup-affiliates`
: affiliate_signup_url

setAffiliateSignupLink(calculated_link)
}, [])

return { affiliate_signup_link }
}

export default useAffiliateSignupLink
37 changes: 27 additions & 10 deletions src/features/hooks/use-residence-list/index.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
import { useEffect, useMemo } from 'react'
import useWS from '../../../components/hooks/useWS'
import useWS from 'components/hooks/useWS'

export type ResidenceType = {
text: string
value: string
}

const formatResidenceList = (residences) => {
const formatResidenceList = ({
residences,
restricted,
}: {
residences: any[]
restricted: ['Iran', 'North Korea', 'Myanmar (Burma)', 'Syria', 'Cuba']
}) => {
NikitK-deriv marked this conversation as resolved.
Show resolved Hide resolved
if (!residences.length) {
return []
}
return residences?.map(({ text: display_name, text: name, value: symbol }) => ({
name,
display_name,
symbol,
}))
return residences
.filter(({ text: name }) => !restricted.includes(name))
.map(({ text: display_name, text: name, value: symbol, phone_idd: prefix }) => {
return {
name,
display_name,
symbol,
prefix,
}
})
}

export const useResidenceList = () => {
export const useResidenceList = ({
restricted_countries,
}: {
restricted_countries?: ['Iran', 'North Korea', 'Myanmar (Burma)', 'Syria', 'Cuba']
} = {}) => {
const { send, data } = useWS('residence_list')

useEffect(() => {
send()
}, [send])

const residence_list = useMemo(() => formatResidenceList(data || []), [data])
const residence_list = useMemo(
() => formatResidenceList({ residences: data || [], restricted: restricted_countries }),
[data],
)
return [residence_list]
}
32 changes: 32 additions & 0 deletions src/features/hooks/use-states-list/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { useEffect, useMemo } from 'react'
import useWS from '../../../components/hooks/useWS'

export type ResidenceType = {
text: string
value: string
}

const formatStatesList = (states) => {
if (!states.length) {
return []
}

return states?.map(
({ text }) =>
typeof text !== undefined && {
name: text,
display_name: text,
},
)
NikitK-deriv marked this conversation as resolved.
Show resolved Hide resolved
}

export const useStatesList = (country_code) => {
const { send, data } = useWS('states_list')

useEffect(() => {
send({ states_list: country_code })
}, [country_code])

const states_list = useMemo(() => formatStatesList(data || []), [data])
return [states_list]
}
Binary file added src/images/common/affiliate/map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/images/svg/signup-affiliates/calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/images/svg/signup-affiliates/closed-eye.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/images/svg/signup-affiliates/company.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/images/svg/signup-affiliates/cpa.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/images/svg/signup-affiliates/failed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/images/svg/signup-affiliates/individual.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/images/svg/signup-affiliates/opened-eye.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading