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

Jia/QUILL-1794/Redirect Partners to DW based on their IP #7828

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,43 @@ import { getLocationPathname } from 'common/utility'
import { Localize, LocalizedLink } from 'components/localization'
import useAffiliateSignupLink from 'features/hooks/ab-testing/use-partners-signup-link'
import useBuildVariant from 'features/hooks/use-build-variant'
import useWebsiteStatus from 'components/hooks/use-website-status'

const AffiliateButtons = () => {
const { affiliate_signup_link } = useAffiliateSignupLink()
const { website_status } = useWebsiteStatus()

const user_ip_country = website_status?.clients_country || ''
const is_gh = user_ip_country === 'gh'

return (
<>
<Button
variant="secondary"
colorStyle="black"
size="lg"
onClick={() => window.open('https://login.deriv.com/signin.php?lang=0', '_blank')}
onClick={() =>
window.open(
is_gh
? 'https://dynamicworks-dev.deriv.services/login?brd=1'
: 'https://login.deriv.com/signin.php?lang=0',
'_blank',
)
}
>
<Localize translate_text="_t_Log in_t_" />
</Button>
<Button
className="hidden lg:block"
size="lg"
onClick={() => window.open(affiliate_signup_link, '_blank')}
onClick={() =>
window.open(
is_gh
? 'https://dynamicworks-dev.deriv.services/live_signup?brd=1'
: affiliate_signup_link,
'_blank',
)
}
>
<Localize translate_text="_t_Sign up_t_" />
</Button>
Expand Down Expand Up @@ -60,7 +80,7 @@ const PartnersNavButtons = () => {
}, [path_name])

useEffect(() => {
setShowPaymentBtns(path_name.includes('payment-agent') && region !== "eu")
setShowPaymentBtns(path_name.includes('payment-agent') && region !== 'eu')
}, [region, path_name])

return (
Expand Down
4 changes: 2 additions & 2 deletions themes/gatsby-theme-deriv/src/pages/why-choose-us/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ const ResponsiveHeader = styled(StyledHeader)`
}
`

const WhyChooseUs = ({pageContext}: TGatsbyHead) => {
const {region} = pageContext
const WhyChooseUs = ({ pageContext }: TGatsbyHead) => {
const { region } = pageContext
const { is_latam, is_africa } = useRegion()
const handleSignup = useHandleSignup()

Expand Down
Loading