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

Aswathy/DPROD-3448/Deriv Academy new Sign Up flow #7090

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
2cf7ff5
feat: new signup page
aswathy-deriv Feb 16, 2024
1581285
fix: redirection of login page
aswathy-deriv Feb 17, 2024
df55287
feat: academy app id redirection for login
aswathy-deriv Feb 18, 2024
f1d14ae
fix: window error issue
aswathy-deriv Feb 19, 2024
43c9b90
fix: window error
aswathy-deriv Feb 19, 2024
48bc72d
fix: app id connection and login page
aswathy-deriv Feb 19, 2024
99d00ec
fix: changed the url flow for academy signup flow
aswathy-deriv Feb 20, 2024
3f73ee4
fix: passowrd changes
aswathy-deriv Feb 20, 2024
f50bdfe
fix: validation for password
aswathy-deriv Feb 21, 2024
7e830cc
fix: password feature button
aswathy-deriv Feb 21, 2024
352c8be
fix: added the token auth
aswathy-deriv Feb 21, 2024
0645ff9
fix: added authorized token
aswathy-deriv Feb 21, 2024
797409f
fix: background color issue
aswathy-deriv Feb 22, 2024
f7e75de
fix: redirection of url to thinkific
aswathy-deriv Feb 22, 2024
3be632d
fix: authorize the api call
aswathy-deriv Feb 22, 2024
4e0bd54
fix: redirection of language to english only
aswathy-deriv Feb 22, 2024
751d9a0
fix: merge conflicts
aswathy-deriv Feb 22, 2024
90afe3a
fix: for handling the response for the country
aswathy-deriv Feb 26, 2024
1f2316d
fix: flickering logo issue
aswathy-deriv Feb 26, 2024
a3000ef
fix: flickering logo issue with use state
aswathy-deriv Feb 26, 2024
034c0b2
fix: flickering logo
aswathy-deriv Feb 26, 2024
bbc1599
fix: created the academy nav logo
aswathy-deriv Feb 26, 2024
997ec18
fix: logo fix flicker
aswathy-deriv Feb 27, 2024
599e96d
fix: password page
aswathy-deriv Feb 27, 2024
232ab09
fix: country selection and disabling button
aswathy-deriv Feb 27, 2024
6dcfb67
fix: redirection issue
aswathy-deriv Feb 27, 2024
ad2b109
fix: logo issue
aswathy-deriv Feb 28, 2024
4f3725d
fix: translations issue
aswathy-deriv Feb 28, 2024
e1baff6
fix: logo issue
aswathy-deriv Feb 28, 2024
1826933
fix: changed the logo
aswathy-deriv Feb 28, 2024
1b50c27
fix: minimized the logo size
aswathy-deriv Feb 28, 2024
2009c0b
fix: dropdown issues
aswathy-deriv Feb 29, 2024
2f71676
fix: sonar cloud issues
aswathy-deriv Feb 29, 2024
280638d
fix: issues in the design
aswathy-deriv Feb 29, 2024
9fc281a
fix: dropdown is reverted to old one
aswathy-deriv Feb 29, 2024
228b74a
fix: dropdown issues
aswathy-deriv Mar 1, 2024
6fa0c42
fix: removed the button width for residence page
aswathy-deriv Mar 1, 2024
068a99f
fix: focus blur
aswathy-deriv Mar 1, 2024
9527edc
fix: added the dropdown search changes
aswathy-deriv Mar 4, 2024
16026b1
fix: merge conflicts
aswathy-deriv Mar 4, 2024
e2065bc
fix: changed the css file
aswathy-deriv Mar 4, 2024
2fc7081
fix: renamed the css file
aswathy-deriv Mar 4, 2024
10899ac
fix: percy issues
aswathy-deriv Mar 4, 2024
26d7a44
fix: percy run issue
aswathy-deriv Mar 5, 2024
36e7a0c
fix: renamed the password files
aswathy-deriv Mar 5, 2024
b660c11
fix: sonarcloud issues
aswathy-deriv Mar 6, 2024
2e00be4
fix: merge changes
aswathy-deriv Mar 6, 2024
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
68 changes: 19 additions & 49 deletions crowdin/messages.json

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
"use-query-params": "^1.2.3",
"usehooks-ts": "^2.9.1",
"webpack": "^5.89.0",
"yup": "^1.3.2"
"yup": "^1.3.2",
"@zxcvbn-ts/core": "^3.0.4",
"@zxcvbn-ts/language-common": "^3.0.4"
},
"devDependencies": {
"@commitlint/cli": "^16.3.0",
Expand Down
19 changes: 15 additions & 4 deletions src/common/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import Cookies from 'js-cookie'
import { isStorageSupported } from './storage'
import { getCookiesFields, getCookiesObject, getDataLink, getDataObjFromCookies } from './cookies'
import { getAppId } from './websocket/config'
import { redirectToTradingPlatform } from './utility'
import { isBrowser, redirectToTradingPlatform } from './utility'
import { brand_name, deriv_app_id, oauth_url } from 'common/constants'

export type TSocialProvider = 'google' | 'facebook' | 'apple'

const Login = (() => {
const url = isBrowser() && window.location.href
const is_academy = isBrowser() && url.includes('academy')

const redirectToLogin = () => {
if (isStorageSupported(sessionStorage)) {
window.location.href = loginUrl()
Expand All @@ -31,9 +34,17 @@ const Login = (() => {

const sub_url = redirectToTradingPlatform()

return server_url && /qa/.test(server_url)
? `https://${server_url}/oauth2/authorize?app_id=${getAppId()}&l=${language}&brand=${brand_name.toLowerCase()}${affiliate_token_link}${cookies_link}&platform=${sub_url}`
: `${oauth_url}/oauth2/authorize?app_id=${deriv_app_id}&l=${language}&brand=${brand_name.toLowerCase()}${affiliate_token_link}${cookies_link}&platform=${sub_url}`
if (is_academy) {
if (server_url && /qa/.test(server_url)) {
return `https://${server_url}/oauth2/authorize?app_id=37228&l=${language}&brand=${brand_name.toLowerCase()}${affiliate_token_link}${cookies_link}&platform=${sub_url}`
}
return `${oauth_url}/oauth2/authorize?app_id=37228&l=${language}&brand=${brand_name.toLowerCase()}${affiliate_token_link}${cookies_link}&platform=${sub_url}`
} else {
if (server_url && /qa/.test(server_url)) {
return `https://${server_url}/oauth2/authorize?app_id=${getAppId()}&l=${language}&brand=${brand_name.toLowerCase()}${affiliate_token_link}${cookies_link}&platform=${sub_url}`
}
return `${oauth_url}/oauth2/authorize?app_id=${deriv_app_id}&l=${language}&brand=${brand_name.toLowerCase()}${affiliate_token_link}${cookies_link}&platform=${sub_url}`
}
}

const initOneAll = (provider: TSocialProvider, utm_content?: string): void => {
Expand Down
41 changes: 23 additions & 18 deletions src/common/websocket/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ const isStaging = () => isBrowser() && domain_config.staging.hostname === window
const isBeta = () => isBrowser() && domain_config.beta.hostname === window.location.hostname
const isLive = () => isProduction() || isStaging() || isBeta()
const isLocalHost = () => isBrowser() && domain_config.local.hostname === window.location.hostname

const url = isBrowser() && window.location.href
const is_academy = isBrowser() && url.includes('academy')
const getAppId = (): null | number | string => {
let app_id = null
const user_app_id = '' // you can insert Application ID of your registered application here
Expand All @@ -83,24 +84,28 @@ const getAppId = (): null | number | string => {

const config_app_id = window.localStorage.getItem('config.app_id')

if (url_app_id) {
app_id = url_app_id
} else if (config_app_id) {
app_id = config_app_id
} else if (isStaging()) {
window.localStorage.removeItem('config.default_app_id')
app_id = domain_config.staging.app_id
} else if (isBeta()) {
window.localStorage.removeItem('config.default_app_id')
app_id = domain_config.beta.app_id
} else if (user_app_id.length) {
window.localStorage.setItem('config.default_app_id', user_app_id) // it's being used in endpoint chrome extension - please do not remove
app_id = user_app_id
} else if (isLocalHost()) {
app_id = domain_config.local.app_id
if (is_academy) {
app_id = 37228
} else {
window.localStorage.removeItem('config.default_app_id')
app_id = isProduction() ? prod_app_id : domain_config.test.app_id
if (url_app_id) {
app_id = url_app_id
} else if (config_app_id) {
app_id = config_app_id
} else if (isStaging()) {
window.localStorage.removeItem('config.default_app_id')
app_id = domain_config.staging.app_id
} else if (isBeta()) {
window.localStorage.removeItem('config.default_app_id')
app_id = domain_config.beta.app_id
} else if (user_app_id.length) {
window.localStorage.setItem('config.default_app_id', user_app_id) // it's being used in endpoint chrome extension - please do not remove
app_id = user_app_id
} else if (isLocalHost()) {
app_id = domain_config.local.app_id
} else {
window.localStorage.removeItem('config.default_app_id')
app_id = isProduction() ? prod_app_id : domain_config.test.app_id
}
}
}
return app_id
Expand Down
14 changes: 12 additions & 2 deletions src/components/elements/dropdown-search.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect, useRef, useState } from 'react'
import styled, { css } from 'styled-components'
import {
Arrow,
Expand Down Expand Up @@ -41,6 +41,7 @@ const DropdownInput = styled.input<DropdownInputProps>`
display: flex;
align-items: center;
justify-content: flex-start;

${(props) =>
props.has_short_name &&
css`
Expand Down Expand Up @@ -78,12 +79,19 @@ const DropdownSearch = ({
onChange,
selected_item,
is_alternate_style,
onClearInput,
placeholder,
...props
}: DropdownProps) => {
const [input_value, setInputValue] = useState('')
const [dropdown_items, setDropdownItems] = useState([...items])
const [is_open, dropdown_ref, nodes, handleChange, toggleListVisibility, setOpen] =
useDropdown(onChange)
const inputRef = useRef(null)

useEffect(() => {
!is_open && inputRef.current.blur()
}, [is_open])

// Auto select default value
useEffect(() => {
Expand All @@ -99,6 +107,7 @@ const DropdownSearch = ({
const handleInputChange = (e) => {
setInputValue(e.target.value)
toggleListVisibility(e)
onClearInput?.()
}

const handleSelectItem = (option: SelectedType, handled_error: FormikErrorsType) => {
Expand Down Expand Up @@ -139,6 +148,7 @@ const DropdownSearch = ({
</StyledLabel>
<DropdownInput
id="selected_dropdown"
ref={inputRef}
tabIndex={0}
onClick={toggleListVisibility}
onChange={handleInputChange}
Expand All @@ -149,7 +159,7 @@ const DropdownSearch = ({
value={input_value}
is_active={is_open}
is_alternate_style={is_alternate_style}
placeholder={label}
placeholder={placeholder}
/>
<Arrow onClick={toggleListVisibility} expanded={is_open} />
</Flex>
Expand Down
5 changes: 5 additions & 0 deletions src/components/elements/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,20 @@ export const StyledLabel = styled.label<DropdownStyledProps>`
transition: 0.25s ease transform;
transform: translateZ(0);
padding: 0 0.8rem;
margin-top: 3px;

${(props) =>
!props.is_alternate_style &&
css`
@media ${device.tabletL} {
font-size: 1.65rem;
top: 1.4rem;
margin-top: 0px;
}
@media ${device.mobileL} {
font-size: 1.5rem;
top: 1.6rem;
margin-top: 0px;
}
`}

Expand Down Expand Up @@ -439,8 +442,10 @@ export type DropdownProps = {
value?: string
disabled?: boolean
autocomplete?: string
placeholder?: string
mb?: string
is_alternate_style?: boolean
onClearInput?: () => void
} & Pick<ItemsType, 'contractSize'>

const Dropdown = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@use 'features/styles/theme/theme-mixins' as *;

.static_nav_logo {
inline-size: 19.9rem;
block-size: 3.19rem;

@include breakpoints(tablet) {
inline-size: 19.9rem;
block-size: 3.19rem;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import NavTemplate from '../template'
import { static_nav_logo } from './academy-nav.module.scss'
import LogoImage from 'images/common/academy.svg'
import Link from 'features/components/atoms/link'
import Image from 'features/components/atoms/image'

const AcademyNav = () => {
return (
<NavTemplate
has_centered_items
has_centered_logo
renderLogo={() => (
<Link url={{ type: 'internal', to: '/' }}>
<Image src={LogoImage} className={static_nav_logo} />
</Link>
)}
/>
)
}

export default AcademyNav
26 changes: 18 additions & 8 deletions src/features/hooks/use-residence-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,23 @@ const formatResidenceList = ({
}
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,
}
})
.map(
({
text: display_name,
text: name,
value: symbol,
phone_idd: prefix,
disabled: disabled,
}) => {
return {
name,
display_name,
symbol,
prefix,
disabled,
}
},
)
}

export const useResidenceList = ({
Expand All @@ -34,6 +43,7 @@ export const useResidenceList = ({
restricted_countries?: ['Iran', 'North Korea', 'Myanmar (Burma)', 'Syria', 'Cuba']
} = {}) => {
const { send, data } = useWS('residence_list')

useEffect(() => {
send()
}, [send])
Expand Down
26 changes: 26 additions & 0 deletions src/features/pages/academy-complete/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react'
import Layout from 'features/components/templates/layout'
import { nav_logo } from './signup-academy-complete.module.scss'
import PopUpMenu from './pop-up-menu'
import NavTemplate from 'features/components/templates/navigation/template'
import LogoImage from 'images/common/deriv_academy.svg'
import Link from 'features/components/atoms/link'
import Image from 'features/components/atoms/image'

const SignupCompleteAcademy = () => {
return (
<Layout>
<NavTemplate
has_centered_items
has_centered_logo
renderLogo={() => (
<Link url={{ type: 'internal', to: '/' }}>
<Image src={LogoImage} className={nav_logo} />
</Link>
)}
/>
<PopUpMenu />
</Layout>
)
}
export default SignupCompleteAcademy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$inactive_color: #999999;
$success_color: #4bb4b3;
$warning_color: #ffad3a;
$error_field: #ec3f3f;

.deriv-helper-message {
font-size: 12px;
line-height: 1;
font-style: normal;
font-weight: 400;
color: $inactive_color;
&--general {
color: $inactive_color;
}
&--success {
color: $success_color;
}
&--warning {
color: $warning_color;
}
&--error {
color: $error_field;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { ReactNode } from 'react'
import clsx from 'clsx'
import { InputVariants } from '.'
import './HelperMessage.scss'

export interface HelperMessageProps {
error?: boolean
message?: ReactNode
variant?: InputVariants
disabled?: boolean
}
type TMessageVariant = Exclude<InputVariants, 'disabled'>
const MessageVariant: Record<TMessageVariant, string> = {
general: 'deriv-helper-message--general',
success: 'deriv-helper-message--success',
warning: 'deriv-helper-message--warning',
error: 'deriv-helper-message--error',
}

const HelperMessage = ({ error, message, variant = 'general', disabled }: HelperMessageProps) => (
<p
className={clsx('deriv-helper-message', {
[MessageVariant['general']]: disabled,
[MessageVariant[error ? 'error' : (variant as TMessageVariant)]]: !disabled,
})}
>
{message}
</p>
)

export default HelperMessage
Loading
Loading