Skip to content

Commit

Permalink
Config/redirects from os to deriv app (#17861)
Browse files Browse the repository at this point in the history
* translations: 📚 sync translations with crowdin (#17648)

Co-authored-by: DerivFE <[email protected]>

* chore: remove signup_continued action (#17595)

* fix: trading platform status unit test (#17650)

* chore: mt5 reset password unit test (#17628)

* DTRA-1933 / Kate / Console error fix (#17508)

* chore: remove translation from label

* chore: remove comment

* chore: add brackets

* chore: add key for icon

* feat: enable spanish for wallets (#17570)

* Aswathy/CRO-778/feat: Added the console error tracking for the virtual signup flow (#17497)

* feat: added the console error tracking for the virtual signup flow

* fix: removed the console errors

* feat: added the console trackjs error for the user signup flow

* fix: peer comments

* fix: removed the localized error message

* fix: removed the localize form analytics

* fix: changed the naming of the feature f;ag variable

* fix: added a condition inside the country selection screen for capturing multiple errors

* fix: updated the ref with state of password model

* fix: added the console

* fix: added the feature condition inside trackconsole method

* fix: changed the default value to true

* fix: added the dependency for useeffect

* fix: peer comments

* fix: added the screen name for the signup button

* Agrim/CRO-770/Missing-Userid (#17549)

* fix: testing user id

* chore: add cacheTrackEvents for missing user id

* fix: fix type

* fix: revert isReady change

* fix: failing test cases

* fix: empty commit

* fix: test

* fix: change password success modal (#17608)

* fix: add price info (#17641)

* GRWT-2395 / Kate / [Dtrader -V2] Risk management changes (#17567)

* refactor: reset the stop loss value on trade type change

* feat: create error observer component for trade params error and a helper hook

* refactor: tak

* refactor: add tests for new component

* refactor: hook

* fix: independent tp and sl validation

* refactor: add tests

* chore: remove unused code

* fix: add date start field to the observes

* refactor: rename componnets and params

* chore: trustpilot changes (#17581)

* [UPM1755] Suisin/chore: update utils package to fix state regex issue (#17655)

* chore: update utils package to fix state regex issue

* chore: empty commit

* refactor: update lowcode to highcode redirect handling (#17631)

* fix(wallets): 🚑 account creation (#17623)

* Revert "Agrim/CRO-770/Missing-Userid (#17549)" (#17657)

This reverts commit baf4303.

* fix: Run panel animation result does not match contact result on win/loss (#17627)

* translations: 📚 sync translations with crowdin (#17661)

Co-authored-by: DerivFE <[email protected]>

* [WALL] george / WALL-5135 / Remove the jurisdiction information on compare account table for wallets (#17516)

* fix(wallets): 🚑 remove the jurisdiction information

* refactor(wallets): 🔥 remove unused hardcoded values

* refactor(wallets): ♻️ refactor compare accounts table to use data from the API

* chore: exclude gold MT5 product from compare table

* fix: console error (#17668)

* translations: 📚 sync translations with crowdin (#17671)

Co-authored-by: DerivFE <[email protected]>

* [UPM-1668] Suisin/pnv/implement phone number code dropdown (#17311)

* chore: change from normal input field to dropdown with input field for confirm phone number screen

* chore: update phone number dropdown list and added a hook

* chore: add code dropdown in legacy settings page

* chore: hide sms based on carriers available

* chore: update functionality for phone number in personal details

* chore: fix test case and changes validation based on FF

* chore: make inputmode numeric

* chore: change display mobile number in phone otp verification page and verified modal

* chore: add validation for calling_country_code and fix logics for FF off

* chore: upgrade quill-ui package for Input Phone Number component

* chore: upgrade package to add more flags in country code drop down

* chore: fix changing language logs user out issue

* chore: add loading checks for confirm phone number screen

* chore: fix verified hint message

* chore: fix mobile modal for input phone number dropdown

* chore: hide verify and notification if carriers are empty

* chore: call phone_settings on first initialization

* chore: add condition for displaying sms and whatsapp button

* chore: update logic lo check global carriers

* chore: change select native to include boolean value

* chore: add check to hide or display verify button

* chore: fix test case fail for validation

* chore: update code based on comments

* chore: fix unable to submit profile settings

* chore: update quill-ui package and include search function

* chore: fix console log error and submitting phone number error

* chore: update code based on comments

* chore: update quill-ui package to fix bundle size issue

* chore: remove unused commented code

* chore: switch off autoComplete for browsers

* chore: add + sign at step 3 and verified modal

* chore: sort list based on alphabetical order

* chore: fix undefined error message and test case failing issue

* chore: update quill-ui package to have scroll to value selected

* chore: edit scss for rtl and update package for fix search bar

* chore: update package-lock.json

* chore: make rtl look better in phone and desktop

* chore: fix verify button disable and enable issue

* chore: fix GB console log issue

* chore: edit error message for country code

* chore: make country code dropdown to 40% width

* translations: 📚 sync translations with crowdin (#17677)

Co-authored-by: DerivFE <[email protected]>

* [BOT]/GRWT-2389/Announcement click & action events should be set to English (#17637)

* fix: rudderstack action in english

* fix: change var name

* fix: action language fix

* [WALL] george / WALL-5075 / EU migration banner for existing clients (#17583)

* feat(appstore): ✨ add wallet migration flow for EU clients

* fix(appstore): 🚑 fix demo eu migration flow

* fix(wallets): 🚑 fix modal height in mobile view

* translations: 📚 sync translations with crowdin (#17681)

Co-authored-by: DerivFE <[email protected]>

* GRWT-2668 / Kate / [DTrader-V2] Payout per point display value is not refreshing when changing market type (#17644)

* fix: payout per point component

* fix: add barrier to the array with dependencies

* fix: remove incorrect delay (#17651)

* chore: fix notification and sms to be same as prod (#17682)

* translations: 📚 sync translations with crowdin (#17689)

Co-authored-by: DerivFE <[email protected]>

* translations: 📚 sync translations with crowdin (#17690)

Co-authored-by: DerivFE <[email protected]>

* translations: 📚 sync translations with crowdin (#17692)

Co-authored-by: DerivFE <[email protected]>

* Amina/[TRAH-4455]/remove header on account settings redirection (#17649)

* fix: redirection

* fix: redirection

* fix: redirection

* fix: remove unrelated file

* fix: type

* fix: type

* translations: 📚 sync translations with crowdin (#17694)

Co-authored-by: DerivFE <[email protected]>

* [WALL] Jim/WALL-4855/add poi poa badges for mf account (#17555)

* feat: add poi poa badges for mf account

* ci: fix failing tests

* refactor: use clientverificationbadge instead of walletstatusbadge

* chore: undo walletstatus related changes

* chore: hide badge for demo

* chore: replace is_virtual from activewallet with activelinkedtoaccount

* ci: fix failing test cases

* chore: extract conditional to a variable

* chore: replace displaymoney with walletmoney component and show balance for demo accounts

* ci: fix failing test case

* revert: undo auto-format

* fix: demo create success modal content (#17557)

* translations: 📚 sync translations with crowdin (#17697)

Co-authored-by: DerivFE <[email protected]>

* chore: add caching (#17663)

* Revert "chore: add caching (#17663)" (#17700)

This reverts commit 5aa10ad.

* [BOT-2440]/mayuran/tutorial-video bug (#17669)

* fix: tutorial fix

* fix: bug

* [FEQ] george / FEQ-2702 / Improve Coverall workflow time execution. Part 2. Adding caching npm packages (#17702)

* chore: add caching

* fix: 🚑 cache not reading form base repo

* Revert "[FEQ] george / FEQ-2702 / Improve Coverall workflow time execution. P…" (#17706)

This reverts commit 89a90c7.

* translations: 📚 sync translations with crowdin (#17707)

Co-authored-by: DerivFE <[email protected]>

* [FEQ] george / FEQ-2702 / Improve Coverall workflow time execution. Part 2. Adding caching npm packages (#17708)

* chore: add caching

* fix: 🚑 cache not reading form base repo

* fix: 🚑 add update cache workflow, fix coverall restore cache

* Rename update_cache.yml to update_npm_cache.yml

* fix: add push trigger to master for coverall workflow (#17713)

* [TRAH4525] Suisin/chore: fix cfd not showing to spain users (#17709)

* chore: fix cfd not showing to spain users

* fix: loader blinking issue

* chore: revert types changes for stores

* perf: remove redundant cache key restoration (#17718)

* chore: remove utm_data and gclid from cookie upon logout (#17720)

* Nuzhy/CSIT-1700/intercom integration (#17672)

* chore: added POC for intercom

* chore: keep user anonymous for now

* chore: added livechat condition for intercom

* chore: added user signature

* fix: clear chat on loggout handled

* fix: nitpick

* fix: fetch flag in hook, removed from live-chat

* fix: re-initialize intercom on logout

---------

Co-authored-by: Prince <[email protected]>

* [WALL] Jim/WALL-5129/redirection to os real account sign up flow from mf traders hub on add new wallet section (#17640)

* feat: redirect to tradershub out systems

* chore: pass currency to query params

* test: fix failing tests and add more tests

* test: remove unnecessary attributes from mock objects

* test: remove unnecessary attributes from mock objects

* test: remove unnecessary attributes from mock objects

* chore: update feature flag key

* [CRO-880]/Agrim_Amina/fix binary userid (#17673)

* fix: testing user id

* chore: add cacheTrackEvents for missing user id

* fix: fix type

* fix: revert isReady change

* fix: failing test cases

* fix: empty commit

* fix: test

* fix: userid

* fix: Trigger Build

---------

Co-authored-by: Agrim Jain <[email protected]>

* Akmal / feat: replace dtrader videos (#17564)

* feat: replace dtrader videos

* feat: remove extra variable

* fix: stake value fix on crypto currency change (#17683)

* DTRA-2131 / Kate / Virtual keyboard hook (#17559)

* refactor: add hook for detecting keyboard

* chore: replace logs

* chore: add one more check

* refactor: add scrolling for rm

* refactor: add tests

* refactor: apply suggestions

* translations: 📚 sync translations with crowdin (#17729)

Co-authored-by: DerivFE <[email protected]>

* translations: 📚 sync translations with crowdin (#17731)

Co-authored-by: DerivFE <[email protected]>

* [P2PS] / Ameerul / P2PS-4532 PA client gets logout when login (#17699)

* fix: added is_authroize check from client store before calling p2p_settings

* fix: set mt5_login_list in WS.authorized

* translations: 📚 sync translations with crowdin (#17736)

Co-authored-by: DerivFE <[email protected]>

* fix(wallets): 🚑 remaining amount error (#17680)

* DON't MERGE - [WALL] george / WALL-5147 / Gold MT5 account creation flow on Wallets (#17607)

* feat(wallets): ✨ add Gold MT5 account creation real and demo

* chore: replace company name from API for tnc, add dml shortcode support

* chore: add gold mt5 acc into compare acc table

* feat(wallets): ✨ add mt5 gold into compare accounts table real + demo

* feat(wallets): ✨ add mf mt5 gold support

* feat(wallets): ✨ implement compare accounts table for MFW clients

* fix(wallets): 🔥 remove Boom 300 from compare acc table

* [WALL] Jim/WALL-5218/send all accounts with their tokens to os (#17738)

* chore: send all accounts with their tokens

* chore: change os_auth_token to os_auth_tokens

* ci: fix failing tests

* ci: fix failing tests

* [TRAH]/Hasan/TRAH-4439/Gold MT5 account creation flow (#17565)

* feat: added gold account details to the mt5 account list

* feat: added gold icon

* feat: added new tag to gold card

* feat: added gold success icon

* feat: added multi action to gold

* feat: added gold icon in trade modal

* feat: added gold to transfer page

* feat: added gold title to trade modal

* feat: optimized svg accounts

* fix: bring back cfd_account_display function call

* feat: added mauritius tnc

* feat: added gold title to success message

* feat: added gold demo title to enter password title

* feat: added gold compare accounts

* feat: added gold demo compare accounts

* fix: build issue

* fix: build issue

* fix: removed console

* fix: fixed financial demo title

* fix: fixed financial title

* fix: changed description

* feat: added mt5 gold icon in close account modal

* fix: added shortcode in cfd constant

* fix: added shortcode in cfd constant

* fix: fixed investor password for gold account

* feat: fixed short code generation

* fix: made dml capital

* fix: made dml capital

* fix: removed gold from compare account

* fix: reset password for MF account

* fix: eu trade modal icon

* translations: 📚 sync translations with crowdin (#17755)

Co-authored-by: DerivFE <[email protected]>

* [TRAH4562] Suisin/chore: add condition to check is_eu_user on giving contentFlag (#17742)

* chore: add condition to check is_eu_user on giving contentFlag

* chore: fix mt5 icon not displaying when logged out

* [WALL5207] Suisin/chore: update content for tnc modal (#17733)

* chore: update content for tnc modal

* chore: add livechat link

* [BOT]/mayuran/bot-2180/ improve journal messages (#17666)

* fix: improve journal messages

* fix: change unwanted code

* fix: unwanted code

* fix: improve journal messages

* fix: move helper function

* fix: error message

* fix: added translation

* fix: Search by "all" results are not shown correctly (#17725)

* [DTRA-V2] henry/grwt-1761/dtraderV2-desktop-feature-flag (#17573)

* fix: initial commit

* feat: separate commit

* chore: fix tests

* fix: change feature flag name

* fix: change feature flag name

* fix: resolve comments

* chore: remove commented code

* chore: refactor

* fix: ui for tooltip of onborading guide (#17726)

* translations: 📚 sync translations with crowdin (#17767)

Co-authored-by: DerivFE <[email protected]>

* fix: fix the change of variable name is_dtrader_v2 in trade store (#17769)

* feat: update deriv-charts version (#17774)

* feat: update deriv-charts version

* fix: add deriv chart dependency

* fix: updated platform config to href from link_to (#17773)

* fix: draggable component console css errors (#17781)

* fix: draggable component console css errors

* chore: add try catch

* [BOT]maryia/BOT-2462/fix: Total Payout remains zero for multipliers and accumulator QS (#17703)

* fix: Total Payout remains zero for multipliers and accumulator QS

* refactor: fix the issue with simplier approach

* chore: trigger vercel

* chore: redirect to auth straight after wallet migration (#17361)

* chore: redirect to auth straight after wallet migration

* chore: add oauthlogout to upgrade logout wallet modal

* chore: pass oauthlogout from core

---------

Co-authored-by: Thisyahlen <[email protected]>

* [WALL] Lubega / WALL-4830 / Enable all languages in wallets (#17662)

* feat: enable all languages in wallets

* fix: language settings unit test

* fix: password modal tnc redirection language

* Update types.ts

* fix: remove wallets unsupported languages

* fix: language settings unit test

* fix: removed test case

* [WALL] Lubega / WALL-5219 / CtraderSuccessModal unit test (#17748)

* chore: ctrader success modal unit test

* fix: clean up

* [WALL] Lubega / WALL-5063/ No currency responsive display (#17675)

* fix: no currency responsive

* fix: revert icons.js

* fix: clean up

* translations: 📚 sync translations with crowdin (#17789)

Co-authored-by: DerivFE <[email protected]>

* translations: 📚 sync translations with crowdin (#17790)

Co-authored-by: DerivFE <[email protected]>

* [WALL] Lubega / WALL-5222 / MT5 trade modal dynamic white label links (#17756)

* fix: mt5 trade modal white label links

* fix: modal trade wrapper links

* fix: webtrader url format

* fix: webtrader url format

* fix: download button no link display

* fix: download button no link display

* Akmal / fix: mismatch duration values (#17698)

* fix: mismatch duration values

* fix: duration end date logic

* fix: split component-scoped and global end_time states

* feat: refactor state logic inside duration component

* feat: delete outdated test case

* chore: fixing the 5 min difference

* chore: package

---------

Co-authored-by: ahmadtaimoor-deriv <[email protected]>

* BOT-2443/mayuran/fix: ui bugs (#17743)

* fix: ui bugs

* chore: trigger vercel

* DTRA-1886 / Kate / Trade type updates (#17501)

* feat: add carousel for trade type selection modal

* refactor: add conditions for showing divider

* refactor: add tests and remove todos

* chore: extract common props

* chore: apply suggestions

* fix: tests

* [DTRA-V2]/Ahmad/Adding Loader when switching Demo to Real (#17350)

* chore: loader added for is_switching

* chore: test added

* chore: fix

* chore: fix

* [WALL5212] Suisin/chore: create reacceptance tnc notification (#17753)

* chore: create reacceptance tnc notification

* chore: remove const values and update it to use account_settings values

* chore: remove comma from date

* translations: 📚 sync translations with crowdin (#17801)

Co-authored-by: DerivFE <[email protected]>

* fix(wallets): 🚑 fix ctrader webterminal link (#17778)

* Hirad/TRAH-4545/redirection from os to legacy (#17780)

* chore: updating redirections for OutSystems redirection

* chore: adding poa and poi redirections

* chore: removed smart_trader

* chore: improving the code

* chore: changing variable names

* chore: added trade_type

* chore: added redirection for trade_types

* chore: adding some values to the redirection

* chore: added os settings redirection

* translations: 📚 sync translations with crowdin (#17807)

Co-authored-by: DerivFE <[email protected]>

* [WALL] Jim/WALL-5221/enable real demo switcher for users without real wallets (#17751)

* chore: send all accounts with their tokens

* chore: change os_auth_token to os_auth_tokens

* ci: fix failing tests

* ci: fix failing tests

* chore: enable real tab or button on demo or real switcher

* ci: fix failing tests

* style: update test description to a more meaningful one

* chore: only redirect when the active wallet is demo and switching to real

* test: add more tests

* Rupato/BOT-2436/fix: updated blockly method (#17772)

* fix: updated blockly method

* fix: currency on stop loss and take profit blocks

* fix: added onchange check

* feat(translations): add new wallet migration video translations for multiple languages (#17805)

* henry/grwt-3242/chore: quill-icons package update (#17656)

* chore: package update

* fix: replace icons

* fix: wrong import

* fix: add color

* fix: failing test

* fix: failing test 2

* fix: change to css variable

* chore: package-lock update

* fix: build fail

* fix: build fail

* translations: 📚 sync translations with crowdin (#17817)

Co-authored-by: DerivFE <[email protected]>

* chore: oidc setup login/logout (#17746)

* chore: install latest aiuth-client

* chore: fix tests

* chore: add oidc setup and silent login/logout

* chore: fix test

* chore: empty commit

* chore: change text and localize it

* chore: address comments and add wallet logout and login

* chore: conflicts

---------

Co-authored-by: Thisyahlen <[email protected]>

* translations: 📚 sync translations with crowdin (#17821)

Co-authored-by: DerivFE <[email protected]>

* chore: adding network information to page view event (#17795)

* DTRA-2226 / Kate / Barrier and markers updates (#17461)

* refactor: colors changes for barrier and indicator

* chore: revert change of shade height

* fix: type

* chore: improve classname

* chore: apply suggestions

* fix: loss icon fix

---------

Co-authored-by: vinu-deriv <[email protected]>

* feat: chart version update (#17818)

* [WALL] george / WALL-5235 / Notification Missing on Trader’s Hub Page for Wallet Accounts (#17802)

* feat: enhance RootComponent and App to include notification messages UI

* fix: update notifications display logic in App component

* Thisyahlen/fix: account switching (#17831)

* fix: account switching

* chore: empty commit

---------

Co-authored-by: Thisyahlen <[email protected]>

* [CFDS-4846] Suisin/chore: fix misleading info when creating DXTrader account (#17823)

* chore: fix misleading info when creating DXTrader account

* chore: update code based on comments

* feat: add OSRedirect component and update routes config

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: DerivFE <[email protected]>
Co-authored-by: Agrim Jain <[email protected]>
Co-authored-by: lubega-deriv <[email protected]>
Co-authored-by: kate-deriv <[email protected]>
Co-authored-by: Aswathy-Deriv <[email protected]>
Co-authored-by: utkarsha-deriv <[email protected]>
Co-authored-by: Sui Sin <[email protected]>
Co-authored-by: shontzu <[email protected]>
Co-authored-by: George Usynin <[email protected]>
Co-authored-by: amam-deriv <[email protected]>
Co-authored-by: maryia-matskevich-deriv <[email protected]>
Co-authored-by: mayuran-deriv <[email protected]>
Co-authored-by: amina-deriv <[email protected]>
Co-authored-by: Jim Daniels Wasswa <[email protected]>
Co-authored-by: Shayan Khaleghparast <[email protected]>
Co-authored-by: Nuzhy-Deriv <[email protected]>
Co-authored-by: Prince <[email protected]>
Co-authored-by: Agrim Jain <[email protected]>
Co-authored-by: Akmal Djumakhodjaev <[email protected]>
Co-authored-by: vinu-deriv <[email protected]>
Co-authored-by: Ameerul Hady <[email protected]>
Co-authored-by: Hasan Mobarak <[email protected]>
Co-authored-by: henry-deriv <[email protected]>
Co-authored-by: Farabi <[email protected]>
Co-authored-by: Shafin Al Karim <[email protected]>
Co-authored-by: thisyahlen <[email protected]>
Co-authored-by: Thisyahlen <[email protected]>
Co-authored-by: ahmadtaimoor-deriv <[email protected]>
Co-authored-by: hirad-deriv <[email protected]>
Co-authored-by: rupato-deriv <[email protected]>
Co-authored-by: vinu-deriv <[email protected]>
  • Loading branch information
1 parent 8a1c55d commit 9708e4b
Show file tree
Hide file tree
Showing 424 changed files with 10,888 additions and 6,582 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
on:
name: Reporter

on:
push:
branches:
- master
- master
pull_request:
types: [opened, synchronize, edited]
name: Reporter
types: [opened, synchronize, edited]
jobs:
test:
name: Run tests in parallel
Expand All @@ -18,7 +20,16 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup Node
uses: './.github/actions/setup_node'
- name: Install dependencies
- name: Restore npm cache
uses: actions/cache/restore@v4
id: cache-npm
with:
path: |
node_modules
packages/*/node_modules
key: node_modules-cache-${{ hashFiles('package-lock.json', 'packages/*/package.json') }}
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: Install dependencies
uses: "./.github/actions/npm_install_from_cache"
- name: Build components package
working-directory: packages/components
Expand All @@ -28,7 +39,7 @@ jobs:
- name: Coveralls Parallel
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
flag-name: ${{ matrix.shard}}
flag-name: ${{ matrix.shard }}
parallel: true

finish:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/update_npm_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Update node modules cache

on:
push:
branches:
- master

jobs:
build_cache:
name: Build cache
runs-on: Runner_16cores_Deriv-app
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup Node
uses: './.github/actions/setup_node'
- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
with:
path: |
node_modules
packages/*/node_modules
key: node_modules-cache-${{ hashFiles('package-lock.json', 'packages/*/package.json') }}
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: Install dependencies
uses: "./.github/actions/npm_install_from_cache"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This repository contains the various platforms of the Deriv application.
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
![Sonar Tech Debt](https://img.shields.io/sonar/tech_debt/binary-com_deriv-app?server=https%3A%2F%2Fsonarcloud.io)
![Sonar Violations (short format)](https://img.shields.io/sonar/violations/binary-com_deriv-app?server=https%3A%2F%2Fsonarcloud.io)
[![Coverage Status](https://coveralls.io/repos/github/binary-com/deriv-app/badge.svg?branch=master)](https://coveralls.io/github/binary-com/deriv-app?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/deriv-com/deriv-app/badge.svg?branch=master)](https://coveralls.io/github/deriv-com/deriv-app?branch=master)

**In this document**:

Expand Down
5 changes: 1 addition & 4 deletions __mocks__/translation.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ const useTranslations = () => ({

const localize = mockFn;

const getAllowedLanguages = jest.fn(unsupported_languages => {
if (unsupported_languages.includes('VI')) {
return { EN: 'English' };
}
const getAllowedLanguages = jest.fn(() => {
return { EN: 'English', VI: 'Tiếng Việt' };
});

Expand Down
1,898 changes: 842 additions & 1,056 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"@binary-com/binary-document-uploader": "^2.4.8",
"@deriv-com/analytics": "1.26.2",
"@deriv-com/translations": "1.3.9",
"@deriv-com/utils": "^0.0.36",
"@deriv-com/utils": "^0.0.40",
"@deriv-com/ui": "1.36.4",
"@deriv/api": "^1.0.0",
"@deriv-com/quill-ui": "1.21.0",
"@deriv-com/quill-ui": "1.24.2",
"@deriv/components": "^1.0.0",
"@deriv/hooks": "^1.0.0",
"@deriv/quill-icons": "1.23.3",
"@deriv/quill-icons": "2.2.1",
"@deriv/shared": "^1.0.0",
"@deriv/stores": "^1.0.0",
"@deriv/translations": "^1.0.0",
Expand Down
9 changes: 6 additions & 3 deletions packages/account/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { APIProvider } from '@deriv/api';
import { StoreProvider } from '@deriv/stores';
import { TCoreStores } from '@deriv/stores/types';
import { POIProvider } from '@deriv/shared';
import { BreakpointProvider } from '@deriv-com/quill-ui';

// TODO: add correct types for WS after implementing them
type TAppProps = {
Expand All @@ -24,9 +25,11 @@ const App = ({ passthrough }: TAppProps) => {
<StoreProvider store={root_store}>
<APIProvider>
<POIProvider>
{Notifications && <Notifications />}
<Routes />
<ResetTradingPassword />
<BreakpointProvider>
{Notifications && <Notifications />}
<Routes />
<ResetTradingPassword />
</BreakpointProvider>
</POIProvider>
</APIProvider>
<NetworkStatusToastPopup />
Expand Down
5 changes: 4 additions & 1 deletion packages/account/src/Components/forms/form-select-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useDevice } from '@deriv-com/ui';
type TFormSelectField = TGetField & {
onItemSelection?: (item: TListItem) => void;
list_height?: string;
is_country_code_dropdown?: boolean;
};

type TSetFieldValue = (
Expand All @@ -24,6 +25,7 @@ const FormSelectField: FC<TFormSelectField> = ({
onItemSelection,
placeholder,
list_height,
is_country_code_dropdown = false,
}) => {
const { isDesktop } = useDevice();
const onSelect =
Expand All @@ -47,6 +49,7 @@ const FormSelectField: FC<TFormSelectField> = ({
disabled={disabled}
error={touched ? error : undefined}
use_text
is_country_code_dropdown={is_country_code_dropdown}
data-testid={`dt_${field.name}`}
/>
) : (
Expand All @@ -59,7 +62,7 @@ const FormSelectField: FC<TFormSelectField> = ({
placeholder={placeholder}
required={required}
data-lpignore='true'
autoComplete='off' // prevent chrome autocomplete
autoComplete='new-password' // 'off' sometimes doesn't work, have to use new-password to prevent chrome autocomplete
error={touched ? error : undefined}
// @ts-expect-error This needs to fixed in AutoComplete component
onItemSelection={onItemSelection ?? onSelect(field.name, setFieldValue)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ describe('getPersonalDetailsBaseValidationSchema', () => {
await expect(phone.validate('1234567890'.repeat(4))).rejects.toThrow('You should enter 9-20 numbers.');
});

it('should throw You should enter 5-15 numbers. error if phone number is invalid when isCountryCodeDropdownEnabled is true', async () => {
const isCountryCodeDropdownEnabled = true;
const { phone } = getPersonalDetailsBaseValidationSchema('svg', isCountryCodeDropdownEnabled).fields;

await expect(phone.validate('12345')).resolves.toBe('12345');
await expect(phone.validate('')).rejects.toThrow('Phone is required.');
await expect(phone.validate('1234')).rejects.toThrow('You should enter 5-15 numbers.');
await expect(phone.validate('1234567890'.repeat(4))).rejects.toThrow('You should enter 5-15 numbers.');
});

it('should throw an error if place of birth is invalid', async () => {
const { place_of_birth } = getPersonalDetailsBaseValidationSchema('svg').fields;

Expand Down
23 changes: 18 additions & 5 deletions packages/account/src/Configs/user-profile-validation-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@ type TINDepdendents = {
is_required_for_tax_residence?: boolean;
};

Yup.addMethod(Yup.string, 'validatePhoneNumberLength', function (message) {
Yup.addMethod(Yup.string, 'validatePhoneNumberLength', function (message, isCountryCodeDropdownEnabled) {
return this.test('is-valid-phone-number-length', message || localize('You should enter 9-20 numbers.'), value => {
if (typeof value === 'string') {
// Remove the leading '+' symbol before validation
const phoneNumber = value.startsWith('+') ? value.slice(1) : value;
return /^[0-9]{9,20}$/.test(phoneNumber);
return isCountryCodeDropdownEnabled ? /^[0-9]{5,15}$/.test(phoneNumber) : /^[0-9]{9,20}$/.test(phoneNumber);
}
return false;
});
});

const tempPhoneNumberValidation = /^[0-9]{5,15}$/;

const makeTinOptional = ({
is_mf,
is_real,
Expand Down Expand Up @@ -185,7 +187,7 @@ export const getAddressDetailValidationSchema = (is_svg: boolean) =>
address_state: Yup.string().matches(addressState, localize('State is not in a proper format')),
});

export const getPersonalDetailsBaseValidationSchema = (broker_code?: string) =>
export const getPersonalDetailsBaseValidationSchema = (broker_code?: string, isCountryCodeDropdownEnabled?: boolean) =>
Yup.object({
salutation: Yup.string().when({
is: () => broker_code === 'maltainvest',
Expand All @@ -210,8 +212,19 @@ export const getPersonalDetailsBaseValidationSchema = (broker_code?: string) =>
phone: Yup.string()
.required(localize('Phone is required.'))
// @ts-expect-error yup validation giving type error
.validatePhoneNumberLength(localize('You should enter 9-20 numbers.'))
.matches(phoneNumber, localize('Please enter a valid phone number (e.g. +15417541234).')),
.validatePhoneNumberLength(
isCountryCodeDropdownEnabled
? localize('You should enter 5-15 numbers.')
: localize('You should enter 9-20 numbers.'),
isCountryCodeDropdownEnabled
)
.matches(
isCountryCodeDropdownEnabled ? tempPhoneNumberValidation : phoneNumber,
localize('Please enter a valid phone number (e.g. +15417541234).')
),
...(isCountryCodeDropdownEnabled && {
calling_country_code: Yup.string().required(localize('Code required.')),
}),
place_of_birth: Yup.string().required(localize('Place of birth is required.')),
citizen: broker_code
? Yup.string().when({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import React from 'react';

import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

import TradingHubLogout from '../tradinghub-logout';

jest.mock('@deriv/hooks', () => ({
...jest.requireActual('@deriv/hooks'),
useOauth2: jest.fn(({ handleLogout }) => ({
isOAuth2Enabled: true,
oAuthLogout: jest.fn(() => handleLogout && handleLogout()),
})),
}));
describe('TradingHubLogout', () => {
const mock_props: React.ComponentProps<typeof TradingHubLogout> = {
handleOnLogout: jest.fn(),
Expand All @@ -13,10 +22,10 @@ describe('TradingHubLogout', () => {
expect(screen.getByText('Log out')).toBeInTheDocument();
});

it('should invoke handleOnLogout when logout tab is clicked', () => {
it('should invoke handleOnLogout when logout tab is clicked', async () => {
render(<TradingHubLogout {...mock_props} />);
const el_tab = screen.getByTestId('dt_logout_tab');
userEvent.click(el_tab);
expect(mock_props.handleOnLogout).toBeCalledTimes(1);
await userEvent.click(el_tab);
expect(mock_props.handleOnLogout).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { useHistory } from 'react-router-dom';
import { Analytics } from '@deriv-com/analytics';
import { PageOverlay, VerticalTab } from '@deriv/components';
import { getOSNameWithUAParser, getSelectedRoute, routes as shared_routes } from '@deriv/shared';
import { getOSNameWithUAParser, getSelectedRoute, routes as shared_routes, platforms } from '@deriv/shared';
import { observer, useStore } from '@deriv/stores';
import { Localize } from '@deriv/translations';
import TradingHubLogout from './tradinghub-logout';
Expand Down Expand Up @@ -75,6 +75,7 @@ const PageOverlayWrapper = observer(({ routes, subroutes }: PageOverlayWrapperPr
header={selected_route?.getTitle?.()}
onClickClose={onClickClose}
is_from_app={is_from_derivgo}
is_from_tradershub_os={is_from_tradershub_os}
>
<RouteComponent component_icon={selected_route.icon_component} />
</PageOverlay>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from 'react';
import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

import { routes } from '@deriv/shared';
import LanguageSettings from '../language-settings';
import { mockStore, StoreProvider } from '@deriv/stores';
import { useDevice } from '@deriv-com/ui';
import { useTranslations } from '@deriv-com/translations';
import { useDevice } from '@deriv-com/ui';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

import LanguageSettings from '../language-settings';

jest.mock('@deriv-com/ui', () => ({
...jest.requireActual('@deriv-com/ui'),
Expand Down Expand Up @@ -42,9 +44,6 @@ describe('LanguageSettings', () => {
common: {
current_language: 'lang_1',
},
client: {
has_wallet: false,
},
});
(useTranslations as jest.Mock).mockReturnValue({
currentLang: 'EN',
Expand All @@ -59,7 +58,7 @@ describe('LanguageSettings', () => {
});
};

it('should render LanguageSettings with all allowed languages for non-wallets accounts', () => {
it('should render LanguageSettings with all allowed languages', () => {
renderLanguageSettings();

expect(screen.getByText('Select language')).toBeInTheDocument();
Expand All @@ -73,27 +72,11 @@ describe('LanguageSettings', () => {
expect(lang_2).toBeInTheDocument();
});

it('should render LanguageSettings with only wallets-allowed languages for wallets accounts', () => {
mockRootStore.client.has_wallet = true;

renderLanguageSettings();

expect(screen.getByText('Select language')).toBeInTheDocument();

const lang_1 = screen.getByText('English');
const lang_2 = screen.queryByText('Tiếng Việt');

expect(screen.getByText(/Language 1 Flag/)).toBeInTheDocument();
expect(screen.queryByText(/Language 2 Flag/)).not.toBeInTheDocument();
expect(lang_1).toBeInTheDocument();
expect(lang_2).not.toBeInTheDocument();
});

it('should trigger language change', () => {
it('should trigger language change', async () => {
renderLanguageSettings();

const lang_2 = screen.getByText('Tiếng Việt');
userEvent.click(lang_2);
await userEvent.click(lang_2);

expect(mockRootStore.common.changeSelectedLanguage).toHaveBeenCalled();
});
Expand All @@ -110,17 +93,4 @@ describe('LanguageSettings', () => {
expect(screen.queryByText('Select language')).not.toBeInTheDocument();
expect(screen.getByText('Redirect')).toBeInTheDocument();
});

it('should redirect when the user tries to reach `/account/languages` route having wallet accounts', () => {
mockRootStore.client.has_wallet = true;
Object.defineProperty(window, 'location', {
configurable: true,
value: { pathname: routes.languages },
});

renderLanguageSettings();

expect(screen.queryByText('Select language')).not.toBeInTheDocument();
expect(screen.getByText('Redirect')).toBeInTheDocument();
});
});
Loading

0 comments on commit 9708e4b

Please sign in to comment.