-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'binary-com:master' into WALL-3284-Blank-Page-with-Inval…
…id-token-when-accessing-wallets-in-desktop-(for-wallets-created-using-a-different-device/browser)
- Loading branch information
Showing
218 changed files
with
4,574 additions
and
3,670 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/account/src/hooks/__test__/useKycAuthStatus.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import { renderHook } from '@testing-library/react-hooks'; | ||
import { useKycAuthStatus } from '../useKycAuthStatus'; | ||
import { useQuery } from '@deriv/api'; | ||
import { StoreProvider, mockStore } from '@deriv/stores'; | ||
|
||
jest.mock('@deriv/api', () => ({ | ||
...jest.requireActual('@deriv/api'), | ||
useQuery: jest.fn(), | ||
})); | ||
|
||
describe('useKycAuthStatus', () => { | ||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('should return kyc_auth_status', () => { | ||
const mock_response = { | ||
data: { | ||
kyc_auth_status: { | ||
identity: { | ||
status: 'none', | ||
}, | ||
document: { | ||
status: 'none', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const mock = mockStore({ | ||
client: { | ||
is_authorize: true, | ||
}, | ||
}); | ||
|
||
(useQuery as jest.Mock).mockReturnValue(mock_response); | ||
|
||
const wrapper = ({ children }: { children: JSX.Element }) => ( | ||
<StoreProvider store={mock}>{children}</StoreProvider> | ||
); | ||
|
||
const { result } = renderHook(() => useKycAuthStatus({ country: 'in' }), { wrapper }); | ||
expect(result.current.kyc_auth_status).toEqual(mock_response.data.kyc_auth_status); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { useKycAuthStatus } from './useKycAuthStatus'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useQuery } from '@deriv/api'; | ||
import { TSocketRequestPayload } from '@deriv/api/types'; | ||
import { useStore } from '@deriv/stores'; | ||
|
||
type TKycAuthStatusPayload = TSocketRequestPayload<'kyc_auth_status'>['payload']; | ||
|
||
/** Custom hook that returns Proof of Identity (POI) and Proof of Address (POA) authentication status details. */ | ||
export const useKycAuthStatus = (payload?: TKycAuthStatusPayload) => { | ||
const { client } = useStore(); | ||
|
||
const { is_authorize } = client; | ||
const { data, ...kyc_auth_status_rest } = useQuery('kyc_auth_status', { | ||
payload, | ||
options: { enabled: is_authorize }, | ||
}); | ||
return { | ||
/** The KYC auth status */ | ||
kyc_auth_status: data?.kyc_auth_status, | ||
...kyc_auth_status_rest, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"cs_chat_livechat":true,"cs_chat_whatsapp":true,"marketing_growthbook":true,"tracking_GTM":true,"tracking_datadog":true,"tracking_hotjar":true,"tracking_rudderstack": true} | ||
{"cs_chat_livechat":true,"cs_chat_whatsapp":true,"marketing_growthbook":true,"passkeys":true,"tracking_GTM":true,"tracking_datadog":true,"tracking_hotjar":true,"tracking_rudderstack":true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
packages/appstore/src/components/banners/book-banner/banner-template.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import React from 'react'; | ||
import { useStore } from '@deriv/stores'; | ||
import { Analytics } from '@deriv-com/analytics'; | ||
import { SessionStore } from '@deriv/shared'; | ||
import { getAllowedLanguages, Localize } from '@deriv/translations'; | ||
import { LabelPairedCircleChevronDownXlBoldIcon, LabelPairedXmarkLgBoldIcon } from '@deriv/quill-icons'; | ||
import { TEbooksUrl } from 'Components/banners/book-banner/book-banner'; | ||
|
||
type TBookBannerTemplate = { | ||
e_book_show_way: string; | ||
e_books_url: TEbooksUrl; | ||
e_book_from_landing: keyof TEbooksUrl; | ||
lang: ReturnType<typeof getAllowedLanguages>; | ||
}; | ||
|
||
const BookBannerTemplate = ({ e_book_show_way, e_books_url, e_book_from_landing, lang }: TBookBannerTemplate) => { | ||
const [is_banner_shows, setIsBannerShows] = React.useState(true); | ||
const { traders_hub, ui } = useStore(); | ||
const { selected_account_type } = traders_hub; | ||
const analytics_data: Parameters<typeof Analytics.trackEvent>[1] = { | ||
banner_name: e_book_from_landing, | ||
account_mode: selected_account_type, | ||
}; | ||
|
||
React.useEffect(() => { | ||
Analytics.trackEvent('ce_tradershub_banner', { | ||
action: 'open', | ||
...analytics_data, | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<React.Fragment> | ||
{is_banner_shows ? ( | ||
<div id='e-book-banner' className='book-banner-template'> | ||
<div className='book-banner-template__left'> | ||
<LabelPairedCircleChevronDownXlBoldIcon width='24' height='24' fill='#00822A' /> | ||
{e_book_show_way === 'banner-with-link' ? ( | ||
<div className='book-banner-template__content'> | ||
<label> | ||
<Localize i18n_default_text='We’ve sent your e-book to your email. You can also download it here.' /> | ||
</label> | ||
<a | ||
href={e_books_url[e_book_from_landing][lang] || e_books_url[e_book_from_landing].EN} | ||
target='_blank' | ||
rel='noopener noreferrer' | ||
onClick={() => { | ||
Analytics.trackEvent('ce_tradershub_banner', { | ||
action: 'click download', | ||
...analytics_data, | ||
}); | ||
}} | ||
> | ||
<Localize i18n_default_text='Download e-book' /> | ||
</a> | ||
</div> | ||
) : ( | ||
<div className='book-banner-template__content'> | ||
<label> | ||
<Localize i18n_default_text='We’ve sent your e-book. Check your email to download it.' /> | ||
</label> | ||
</div> | ||
)} | ||
</div> | ||
<LabelPairedXmarkLgBoldIcon | ||
className='book-banner-template__cancel' | ||
width='24' | ||
height='24' | ||
fill='var(--text-prominent)' | ||
onClick={() => { | ||
Analytics.trackEvent('ce_tradershub_banner', { | ||
action: 'close', | ||
...analytics_data, | ||
}); | ||
SessionStore.remove('show_book'); | ||
setIsBannerShows(false); | ||
}} | ||
/> | ||
</div> | ||
) : null} | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
export default BookBannerTemplate; |
Oops, something went wrong.