Skip to content

Commit

Permalink
Bala/Rupato/update dbot homepage latest master (#6872)
Browse files Browse the repository at this point in the history
* Jim/74386/bot-web-ui-ts-config-fix (#6354)

* refactor: update tsconfigurations for bot-web-ui

* fix: resolve typescript error by disabling ts-check

* Farzin/78410/Replace `connect` method with `useStore` hook for components related to `Deposit` (#6746)

* refactor(cashier): 🔥 replace `connect` method with `useStore` hook in `deposit`

* fix(cashier): ✅ fix failing test due to `StoreProvider` not being provided

* Trigger Build

* fix(components): 💄 fix `Timeline` item alignment issue (#6682)

* refactor: ⬆️ upgraded depenedency that caused build failure (#6656)

* thisyahlen/create new account text align in button (#6684)

* create new account text align in button

* removed classname

* fix(account): ✏️ change `DMT5` to `Deriv MT5` in setting (#6668)

* Amina/cfd_personal_details_component (#6639)

* personal_deatils

* fix

* form validation

* pr review

Co-authored-by: Farrah Mae Ochoa <82315152+farrah-deriv@users.noreply.github.com>
Co-authored-by: Matin shafiei <matin@deriv.com>

* Farzin/77435/add `useSubscription` hook (#6621)

* fix(cashier): 🐛 fix `tsconfig`

* feat(shared): ✨ expose `WS` object from `shared` package via `useWS`

* feat(cashier): ✨ add `useCountdown` hook

* feat(cashier): ✨ add `useWS` hook

* feat(cashier): ✨ add `useStore` hook and `StoreContext`

* feat(cashier): ✨ add `useVerifyEmail` hook

* test(cashier): ✅ add test for `useCountdown` hook

* test(cashier): ✅ add test for `useWS` hook

* fix(cashier): 📝 resolve PR comments

* fix(cashier): 📝 resolve PR comments

* fix(cashier): 📝 resolve PR comments

* fix(cashier): 📝 resolve PR comments

* refactor(cashier): ♻️ improve types for `useWS` hook

* feat(cashier): ✨ add `useSubscription` hook

* test(cashier): ✅ add test for `useSubscription` hook

* feat(cashier): ✨ add `useNeedAuthentication` hook

* feat(cashier): ✨ add `useNeedFinancialAssessment` hook

* feat(cashier): ✨ add `useRealSTPAccount` hook

* feat(cashier): ✨ add `useNeedTNC` hook

* feat(cashier): ✨ add `useDepositLocked` hook

* fix(cashier): 📝 resolve PR comments

* fix(cashier): 📝 resolve PR comments

* Ameerul /Bug 77290 Dialogue box looks small in responsive view (#6633)

* added width to error-modal and removed small prop

* added ic-blocked-advertisers-barred icon

* chore: remove unnecessary appcard, virtualwalletcard and realwalletcard components (#6546)

* error codes cleanup (#6550)

* Ameerul /Bug 76675 Deriv P2P notification disappears when we refresh the page (#6603)

* fixed notifications on refresh in cashier page

* removed old function for getting unseen notifications

* added jsdoc for p2p_unseen_notifications

* Update packages/cashier/src/stores/general-store.js

Co-authored-by: Farrah Mae Ochoa <82315152+farrah-deriv@users.noreply.github.com>

Co-authored-by: Farrah Mae Ochoa <82315152+farrah-deriv@users.noreply.github.com>

* likhith/ preventing over throttling of onfido token fetch API (#6495)

* feat: incorporated Exponential_backoff logic

* perf: ⚡ invokes API and on failure triggers retry

Co-authored-by: System Administrator <root@Likhith-Kolayaris-MacBook-Pro-C02G8AT9MD6M.local>

* remove_horizontal_scroll_of_onmapp_in_firefox (#6715)

* Ameerul /Bug 74362 Give feedback button does nothing when user in existing order page (#6456)

* added new function in notifications store to get order id and show rating modal from p2p side

* fixed spelling

* renamed order_props to p2p_order_props and added toggleNotificationsModal to onClick for give feedback

* fixed give action onClick for give feedback button in general store

* added new function to redirect to order details page, changed logic for handling completed order notifications

* removed text from Give Feedback

* fixed notifications count bell bug when rating order, and refactored logic

* removed setP2POrderConfig from order-details, moved to app.jsx in useEffect

* called setP2POrderProps in order-details when unmounted so the id is set to null

* renamed notification_action to notification_redirect_action

* removed commented out console log

* Added margin spacing between advertiser page header and description (#6420)

* Added margin spacing between advertiser page header and description

* Aligned avatar icon to flex-start

* time to fix merge conflicts

* Ameerul /Bug 69674 Improve floating rate field to handle large rate values (#6286)

* changed the margin-top for mobile view for buy-sell

* merging upstream master

* changed the payment methods list modal and wrapped the text for long bank names

* reverted changes

* changed floating rate field and ad type styling

* removed code from other PR

* changed input field value text

* removed local currency from market rate

* changed floating rate spec file

* changed floating rate msg font size to small

* fixed font size

* fixed decimal point in buy/sell amount (#6645)

* Ameerul /Bug 64212  Order limit is not reflected correctly in the buy sell pop up modal  (#6649)

* fixed order limit issue for available amount user can spend

* implemented comments

* fixed sell order limit

* forced opacity for full page modal quick add (#6681)

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* fixed advertiser buy and sell balance (#6803)

* Niloofar | Mobx 6 (#6371)

* update MobX libraries

* bot migration

* trader migration

* core migration

* cfd migration

* p2p migration

* cashier migration

* regenerate package-lock.json

* fix verification store issue on cashier

* temperately commented failed tests to find a solution

* fix console errors related to mobx

* regenerate package-lock.json

* fix general store issue on p2p

* bug: fix p2p stores bugs

* fix console errors

* fix: Open position blinking while there is active contract going on

* fix: blinking issue

* fix: nitpik

* fix bot issue

* chores: change @deriv/deriv-charts versions

* fix: flags issue

* fix: fixed chart not showing flags when contract begins

* fix: save to local storage issues

* fix: conflicts

* fix: cashier link's blinking issue

* fix: personal-details undefined

* fix: personal details submit button issue

Co-authored-by: iman <iman@firstsource.tech>

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* Fixed issues with newlines not detecting in order details (#6381)

* add test coverage for BuySellFormReceiveAmount component (#6675)

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* fixed advertiser buy and sell balance (#6803)

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* P2p cross border ad feature (#6564)

* farrah/76186/currency selector component (#6512)

* currency dropdown component

* refactor

* fixed bugs

* farrah/76187/Ad filter flow (#6627)

* ad filtering flow

* refactor code

* fixed buy/sell ads in advertiser page

* fixed currency not selected in responsive

* fixed currency selector height in responsive

* fixed currency list update

* fixed styles

* fixed highlighted currency issue

* fixed style issues

* fixed supported payment methods

* fixed supported payment methods

* fixed advertiser payment methods

* fixd advertiser payment method

* fixed loading of payment methods

* fixed floating rate issues

* fixed exchange rate issues

* fixed failing tests

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* bahar|bala/handle_redirection_on_withdrawal_links_for_deriv_go (#6760)

* handle_redirection_on_withdrawal_links_for_deriv_go

* fix_app_id_issue

* fix_login_issue

* add_fix

* revert_last_changes

* Merge branch 'handle_redirection_on_withdrawal_links_for_deriv_go' of https://github.com/Bahar-FS/deriv-app into handle_redirection_on_withdrawal_links_for_deriv_go

* fix_redirect_issue

* fix_issue

* fixed ads exchange rate (#6818)

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* Amina/real_mt5_dashboard_in demo_account_banner fix (#6736)

* demo_accoumt

* demo_accoumt

* demo_accoumt

* switch account message from compare_accounts_modal

* text size and align

Co-authored-by: Matin shafiei <matin@deriv.com>

* Ameerul /Bug 66642  Display the Ewallet name on PaymentMethod tiles (#6671)

* showed payment method type for each pm card instead of the value and moved edit delete functionality into store

* took size out of text as default is s

* fixed method name for delete payment method modal

* wrapped payment-method-card in react.memo to stop flickering

* refactored icon

* added setIsLoading in payment-methods to render loader first

* added prop for sending icon name to payment method card, checking if it works on testlink for my_profile

* reverted pull from master and added changes to icon for payment methods card

* Jim/78604/remove-unused-appsetings-component-and-tempappsettings (#6750)

* chore: remove app-settings component and temp-app-settings

* fix: fix failing tests

* thisyahlen/fix popover bug (#6781)

* fix popover bug

* remove space

* Content changes for market restructures (#6816)

* Akmal / Update mt5 content for eu clients (#6815)

* Update mt5 content for eu clients

* Revert the change since requirements changed

* Change label

* observable (#6825)

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* chore: fix validation setup flow (#6830)

* fix: validation-error undefined (#6835)

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* Suisin/not able to create account when click on account switcher in cashier (#6831)

* change currency-selector scss

* Update Scss to include buy-sell class

* Update currency-selector.jsx

* rigion-should-not-be-shown-in-the-account-selection-dropdown-of-account-transfer (#6828)

* yauheni/74190/ ts migration for account unlink modal (#6374)

* yauheni/74190/ ts migration for account unlink modal

* props listing alphabetically

Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”>

* yauheni/79513/no language redirection from derivapp (#6824)

* yauheni/79513/no language redirection from derivapp

* functions call refactor

Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”>

* Mahdiyeh/Feature: add social unlinking  (#4854)

* add wrong typo part to the sent-email-modal and add live chat

* change Password to Emails and passwords

* add change email component to Emails and passwors

* add email reset modal

* add reset email modal

* add success email modal

* add redirection of social_email_change modal

* fix responsive mode

* fix sendEmailModal

* add verification_code for social_emil_change

* get email from url

* add condition for change email part for social and non-social account

* fix change_email modal when get invalidToken error

* add change_email_actions to ignore list of invalidToken error handling

* add email success modal

* automate email change for non social accounts

* remove unnecessary changes

* fix invalidToken error for change_email

* fix typos and naming and minify the svg

* fix typo

* remove successEmailModal and clean the code

* fix logging out the user, email_modal size on mobile and remove success icon when request fails

* fix redirecting to the trade page

* fix success modal content

* remove email part from personalDetails page

* fix email and passwords name when it is social account

* show email box in personalDetails for social accounts

* sync changes with automation email

* change px to rem

* add <br/> to the success message to the email update modal

* fix typo

* chnage the behaviour for apple id when click on the unlink button

* fix verification_code error

* fix email and passord name for all social and non social emails

* remove UnlinkModal from deriv-password

* update with master

* update branch

* fix apple icon

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* Akmal / Change highlighted market to subgroup (#6810)

* Change highlighted market to subgroup

* Replace icons

Co-authored-by: Matin shafiei <matin@deriv.com>

* chore: update deriv-charts (#6850)

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* Fix: derived and forex account limits structure (#6856)

* Fix: synthetic to derived on welcome modal (#6857)

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

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* fixed cross border ad style (#6844)

* bahar/extract_copy_to_clipboard_to_hook (#6753)

* extract_copy_to_clipboard_to_hook

* add_error_handling

* yauheni/9321/self exclusion validation max balance max open positions for cr clients (#6677)

* yauheni/9321/self exclusion validation max balance max open positions for cr clients

* changed to true/false handling instead of number greater then 0

* added explanation comment for account balance value

Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”>

* Matin/Aizad: Acuity Social Trading (#6798)

* Acuity social trading notification implementation

* Chore: Close notification on download

* task: implement components in mt5 dashboard

* Chore: Make notification disposable and display it only in DTrader

* task: create acuity download modal and update ui store

* fix: remove unnecessary files and update png

* fix: added props to acuity banner

* add dark close button for notification acuity

* task: create notification for acuity on mt5

* Chore: Fix nitpicks

* Chore: Moved Acuity download modal to core and lazyload it

* fix: remove extra padding on demo account

* fix: fix cfd card height

* Chore: Added Acuity for Demo accounts

* Fix: Display Acuity on MT5 dashboard

* Fix: Display notifications on a specific platform

* Fix: small bug

* Chore: updated a test file

* fix: updated download link in modal

* Chore: address code reviews

* Chore: address code reviews

* Fix: typo

* Chore: Display notifications for both Demo and Real accounts

* Chore: small fix

* Chore: Display Acuity banners for all clients including EU

* Chore: To display notification only on MT5 page

* Chore: Added a new link for EU users

Co-authored-by: Aizad Ridzo <aizad@deriv.com>
Co-authored-by: aizad-deriv <103104395+aizad-deriv@users.noreply.github.com>

* farrah/80516/fixed currency dropdown style (#6865)

* fixed currency style

* refactor code

* farrah/80646/fixed buy/sell ad rate (#6867)

* fixed observables

* fixed rate in advertiser page

* updated save modal store

* fixed mobx issue in quickstrategy store

Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>
Co-authored-by: Farzin Mirzaie <72082844+farzin-fs@users.noreply.github.com>
Co-authored-by: Likhith Kolayari <98398322+likhith-deriv@users.noreply.github.com>
Co-authored-by: thisyahlen <104053934+thisyahlen-deriv@users.noreply.github.com>
Co-authored-by: amina-deriv <84661147+amina-deriv@users.noreply.github.com>
Co-authored-by: Farrah Mae Ochoa <82315152+farrah-deriv@users.noreply.github.com>
Co-authored-by: Matin shafiei <matin@deriv.com>
Co-authored-by: ameerul-deriv <103412909+ameerul-deriv@users.noreply.github.com>
Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>
Co-authored-by: System Administrator <root@Likhith-Kolayaris-MacBook-Pro-C02G8AT9MD6M.local>
Co-authored-by: Bahar <bahar@regentmarkets.com>
Co-authored-by: adrienne-deriv <103016120+adrienne-deriv@users.noreply.github.com>
Co-authored-by: Farrah Mae Ochoa <farrah@deriv.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>
Co-authored-by: Niloofar Sadeghi <93518187+niloo-fs@users.noreply.github.com>
Co-authored-by: iman <iman@firstsource.tech>
Co-authored-by: Akmal Djumakhodjaev <akmal@binary.com>
Co-authored-by: balakrishna-binary <56330681+balakrishna-binary@users.noreply.github.com>
Co-authored-by: Sui Sin <103026762+suisin-deriv@users.noreply.github.com>
Co-authored-by: yauheni-kryzhyk-deriv <103182683+yauheni-kryzhyk-deriv@users.noreply.github.com>
Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”>
Co-authored-by: mahdiyeh-fs <82078941+mahdiyeh-fs@users.noreply.github.com>
Co-authored-by: Aizad Ridzo <aizad@deriv.com>
Co-authored-by: aizad-deriv <103104395+aizad-deriv@users.noreply.github.com>
  • Loading branch information
26 people committed Nov 10, 2022
1 parent 69ec2a4 commit 3726d8e
Show file tree
Hide file tree
Showing 369 changed files with 18,851 additions and 16,808 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ module.exports = {
'import/prefer-default-export': 0,
'import/extensions': [0, { jsx: 'always', json: 'always' }],
'no-sequences': ['warn'],
'react/no-unknown-property': 1,
'import/no-unresolved': [2, { ignore: ['@deriv/components', '@deriv/shared'] }],

// react rules
Expand Down
19,483 changes: 10,082 additions & 9,401 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion packages/account/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ module.exports = {
webpack: { config: webpackConfig({}) },
},
},
};
rules: {
'import/no-extraneous-dependencies': ['off', { devDependencies: ['**/*.spec.*'] }],
},
};
1 change: 1 addition & 0 deletions packages/account/build/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const ALIASES = {
Services: path.resolve(__dirname, '../src/Services'),
Stores: path.resolve(__dirname, '../src/Stores'),
Styles: path.resolve(__dirname, '../src/Styles'),
Types: path.resolve(__dirname, '../src/Types'),
};

const rules = (is_test_env = false, is_mocha_only = false) => [
Expand Down
1 change: 1 addition & 0 deletions packages/account/build/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '@binary-com/binary-document-uploader';
5 changes: 3 additions & 2 deletions packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"dependencies": {
"@binary-com/binary-document-uploader": "^2.4.7",
"@deriv/api-types": "^1.0.54",
"@deriv/components": "^1.0.0",
"@deriv/shared": "^1.0.0",
"@deriv/translations": "^1.0.0",
Expand All @@ -36,8 +37,8 @@
"formik": "^2.1.4",
"i18n-iso-countries": "^6.8.0",
"js-cookie": "^2.2.1",
"mobx": "^5.15.7",
"mobx-react": "6.3.1",
"mobx": "^6.6.1",
"mobx-react": "^7.5.1",
"onfido-sdk-ui": "8.1.1",
"prop-types": "^15.7.2",
"qrcode.react": "^1.0.0",
Expand Down
9 changes: 3 additions & 6 deletions packages/account/src/Components/Routes/binary-link.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import { NavLink } from 'react-router-dom';
import { PlatformContext } from '@deriv/shared';
import getRoutesConfig from 'Constants/routes-config';
import { findRouteByPath, normalizePath } from './helpers';
import { connect } from 'Stores/connect';

const BinaryLink = ({ active_class, to, children, is_social_signup, ...props }) => {
const BinaryLink = ({ active_class, to, children, ...props }) => {
const { is_appstore } = React.useContext(PlatformContext);
const path = normalizePath(to);
const route = findRouteByPath(path, getRoutesConfig({ is_appstore }, is_social_signup));
const route = findRouteByPath(path, getRoutesConfig({ is_appstore }));

if (!route) {
throw new Error(`Route not found: ${to}`);
Expand All @@ -31,6 +30,4 @@ BinaryLink.propTypes = {
to: PropTypes.string,
};

export default connect(({ client }) => ({
is_social_signup: client.is_social_signup,
}))(BinaryLink);
export default BinaryLink;
8 changes: 2 additions & 6 deletions packages/account/src/Components/Routes/binary-routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import { Switch } from 'react-router-dom';
import { Localize, PlatformContext } from '@deriv/shared';
import getRoutesConfig from 'Constants/routes-config';
import RouteWithSubRoutes from './route-with-sub-routes.jsx';
import { connect } from 'Stores/connect';

const BinaryRoutes = props => {
const { is_appstore } = React.useContext(PlatformContext);
const { is_social_signup } = props;
return (
<React.Suspense
fallback={() => {
Expand All @@ -19,14 +17,12 @@ const BinaryRoutes = props => {
}}
>
<Switch>
{getRoutesConfig({ is_appstore }, is_social_signup).map((route, idx) => (
{getRoutesConfig({ is_appstore }).map((route, idx) => (
<RouteWithSubRoutes key={idx} {...route} {...props} />
))}
</Switch>
</React.Suspense>
);
};

export default connect(({ client }) => ({
is_social_signup: client.is_social_signup,
}))(BinaryRoutes);
export default BinaryRoutes;
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,4 @@ describe('<AccountLimitsFooterPortal/>', () => {
render(<AccountLimitsFooterPortalComponent />);
expect(screen.getAllByTestId('footer_text').length).toBe(1);
});

it('should render AppSettings.Footer components correctly', () => {
const { container } = render(<AccountLimitsFooterPortalComponent />);
expect(container.getElementsByClassName('dc-app-settings__footer').length).toBe(1);
});
});
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import * as React from 'react';
import { createPortal } from 'react-dom';
import { AppSettings, Text } from '@deriv/components';
import { Text } from '@deriv/components';
import { Localize } from '@deriv/translations';
import AccountLimitsContext from './account-limits-context';

const AccountLimitsFooterPortal = () => {
const { footer_ref, toggleOverlay } = React.useContext(AccountLimitsContext);

return createPortal(
<AppSettings.Footer>
<AppSettings.Footer.Left>
<a className='link link--prominent' onClick={toggleOverlay} data-testid='footer_text'>
<Text size='xxs' line_height='m' weight='bold'>
<Localize i18n_default_text='Learn more about account limits' />
</Text>
</a>
</AppSettings.Footer.Left>
</AppSettings.Footer>,
<a className='link link--prominent' onClick={toggleOverlay} data-testid='footer_text'>
<Text size='xxs' line_height='m' weight='bold'>
<Localize i18n_default_text='Learn more about account limits' />
</Text>
</a>,
footer_ref
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import classNames from 'classnames';
import { Text } from '@deriv/components';

const AccountLimitsTableCell = ({ align, children, is_hint, renderExtraInfo }) => {
const AccountLimitsTableCell = ({ align, children, is_hint, level, renderExtraInfo }) => {
const text_size = is_hint ? 'xxxs' : 'xxs';

return (
Expand All @@ -12,6 +12,7 @@ const AccountLimitsTableCell = ({ align, children, is_hint, renderExtraInfo }) =
className={classNames('da-account-limits__table-cell', {
'da-account-limits__table-cell--left': align !== 'right',
'da-account-limits__table-cell--right': align === 'right',
'da-account-limits__table-cell--submarket': level === 'submarket',
})}
data-testid='account_limit_table_cell'
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const AccountLimitsTurnoverLimitRow = ({ collection, title }) => {

return collection.map(item => (
<tr key={item.name} data-testid='account-limits-turnover-limit-row'>
<AccountLimitsTableCell>
<AccountLimitsTableCell level={item.level}>
{title && `${title} - `}
{item.name}
</AccountLimitsTableCell>
Expand Down
21 changes: 10 additions & 11 deletions packages/account/src/Components/account-limits/account-limits.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,8 @@ const AccountLimits = ({
}

const { commodities, forex, indices, synthetic_index } = { ...market_specific };
const forex_ordered = forex?.slice().sort((a, b) => (a.name < b.name ? 1 : -1));

if (forex_ordered && forex_ordered.push) {
forex_ordered.push(forex_ordered.shift());
}
const forex_ordered = forex?.slice().sort((a, b) => (a.name > b.name ? 1 : b.name > a.name ? -1 : 0));
const derived_ordered = synthetic_index?.slice().sort((b, a) => (a.level < b.level ? 1 : -1));

const context_value = {
currency,
Expand Down Expand Up @@ -159,7 +156,12 @@ const AccountLimits = ({
<Localize i18n_default_text='*Maximum account cash balance' />
</AccountLimitsTableCell>
<AccountLimitsTableCell align='right'>
{formatMoney(currency, account_balance, true)}
{/* null or 0 are expected form BE when max balance limit is not set */}
{account_balance ? (
formatMoney(currency, account_balance, true)
) : (
<Localize i18n_default_text='Not set' />
)}
</AccountLimitsTableCell>
</tr>
<tr>
Expand Down Expand Up @@ -207,12 +209,9 @@ const AccountLimits = ({
</thead>
<tbody>
<AccountLimitsTurnoverLimitRow collection={commodities} />
<AccountLimitsTurnoverLimitRow
collection={forex_ordered}
title={localize('Forex')}
/>
<AccountLimitsTurnoverLimitRow collection={forex_ordered} />
<AccountLimitsTurnoverLimitRow collection={indices} />
<AccountLimitsTurnoverLimitRow collection={synthetic_index} />
<AccountLimitsTurnoverLimitRow collection={derived_ordered} />
</tbody>
</table>
{/* We only show "Withdrawal Limits" on account-wide settings pages. */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
&--right {
text-align: right;
}
&--submarket {
padding-left: 1rem;
}
}

&-wrapper {
Expand Down
1 change: 0 additions & 1 deletion packages/account/src/Components/account-limits/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AccountLimits from './account-limits.jsx';
import './account-limits.scss';

export default AccountLimits;
Original file line number Diff line number Diff line change
Expand Up @@ -306,28 +306,17 @@ describe('<ApiToken/>', () => {

fireEvent.click(copy_btns_1[0]);
expect(screen.queryByText(warning_msg)).not.toBeInTheDocument();
expect(await screen.findByTestId('dt_token_copied_icon')).toBeInTheDocument();

act(() => jest.advanceTimersByTime(2100));
expect(screen.queryByTestId('dt_token_copied_icon')).not.toBeInTheDocument();

fireEvent.click(copy_btns_1[1]);
expect(await screen.findByText(warning_msg)).toBeInTheDocument();

expect(document.execCommand).toHaveBeenCalledTimes(1);

const ok_btn = screen.getByRole('button', { name: /ok/i });
expect(ok_btn).toBeInTheDocument();

fireEvent.click(ok_btn);
expect(await screen.findByTestId('dt_token_copied_icon')).toBeInTheDocument();
const copy_btns_2 = await screen.findAllByTestId('dt_copy_token_icon');
expect(copy_btns_2.length).toBe(1);

act(() => jest.advanceTimersByTime(2100));
expect(screen.queryByTestId('dt_token_copied_icon')).not.toBeInTheDocument();

expect(document.execCommand).toHaveBeenCalledTimes(2);

jest.clearAllMocks();
});
Expand Down
15 changes: 3 additions & 12 deletions packages/account/src/Components/api-token/api-token-clipboard.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useIsMounted } from '@deriv/shared';
import { Button, Icon, Modal, Text, Popover } from '@deriv/components';
import { Button, Icon, Modal, Text, Popover, useCopyToClipboard } from '@deriv/components';
import { localize } from '@deriv/translations';

const WarningNoteBullet = ({ message }) => (
Expand Down Expand Up @@ -29,7 +29,7 @@ const WarningDialogMessage = () => (
);

const ApiTokenClipboard = ({ scopes, text_copy, info_message, success_message, popover_alignment = 'bottom' }) => {
const [is_copied, setIsCopied] = React.useState(false);
const [is_copied, copyToClipboard, setIsCopied] = useCopyToClipboard();
const [is_modal_open, setIsModalOpen] = React.useState(false);
const [is_popover_open, setIsPopoverOpen] = React.useState(false);
const isMounted = useIsMounted();
Expand All @@ -45,27 +45,18 @@ const ApiTokenClipboard = ({ scopes, text_copy, info_message, success_message, p
if (!is_copied) setIsPopoverOpen(false);
};

const copyToClipboard = text => {
const textField = document.createElement('textarea');
textField.innerText = text;
document.body.appendChild(textField);
textField.select();
document.execCommand('copy');
textField.remove();
};

/* two timeouts help to prevent popup window blinking.
without early hiding the popup we will see shortly the description message like during hovering.
this bug appears when popup is handled outside like here
*/
const onClick = () => {
setIsModalOpen(false);
copyToClipboard(text_copy);
setIsCopied(true);
setIsPopoverOpen(true);
timeout_clipboard = setTimeout(() => {
if (isMounted()) {
setIsPopoverOpen(false);
setIsCopied(false);
}
}, 1900);
timeout_clipboard_2 = setTimeout(() => {
Expand Down
16 changes: 6 additions & 10 deletions packages/account/src/Components/api-token/api-token-footer.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import React from 'react';
import { createPortal } from 'react-dom';
import { AppSettings, Text } from '@deriv/components';
import { Text } from '@deriv/components';
import { Localize } from '@deriv/translations';
import ApiTokenContext from './api-token-context';

const ApiTokenFooter = () => {
const { footer_ref, toggleOverlay } = React.useContext(ApiTokenContext);

return createPortal(
<AppSettings.Footer>
<AppSettings.Footer.Left>
<a className='link link--prominent' onClick={toggleOverlay}>
<Text size='xxs' line_height='m' weight='bold'>
<Localize i18n_default_text='Learn more about API token' />
</Text>
</a>
</AppSettings.Footer.Left>
</AppSettings.Footer>,
<a className='link link--prominent' onClick={toggleOverlay}>
<Text size='xxs' line_height='m' weight='bold'>
<Localize i18n_default_text='Learn more about API token' />
</Text>
</a>,
footer_ref
);
};
Expand Down
1 change: 0 additions & 1 deletion packages/account/src/Components/api-token/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ApiToken from './api-token.jsx';
import './api-token.scss';

export default ApiToken;
1 change: 0 additions & 1 deletion packages/account/src/Components/self-exclusion/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import SelfExclusion from './self-exclusion.jsx';
import './self-exclusion.scss';

export default SelfExclusion;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { createPortal } from 'react-dom';
import { useFormikContext } from 'formik';
import { AppSettings, Button, Text } from '@deriv/components';
import { Button, Text } from '@deriv/components';
import { Localize } from '@deriv/translations';
import SelfExclusionContext from './self-exclusion-context';

Expand All @@ -11,27 +11,23 @@ const SelfExclusionFooter = () => {

if (footer_ref) {
return createPortal(
<AppSettings.Footer>
<AppSettings.Footer.Left>
<a className='link link--prominent' onClick={toggleArticle}>
<Text size='xxs' line_height='m' weight='bold'>
<Localize i18n_default_text='Learn more about trading limits' />
</Text>
</a>
</AppSettings.Footer.Left>
<AppSettings.Footer.Right>
<Button
disabled={!dirty || !isValid || isSubmitting}
primary
className='da-self-exclusion__button'
large
onClick={() => goToConfirm(values)}
type='button'
>
<Localize i18n_default_text='Next' />
</Button>
</AppSettings.Footer.Right>
</AppSettings.Footer>,
<>
<a className='link link--prominent' onClick={toggleArticle}>
<Text size='xxs' line_height='m' weight='bold'>
<Localize i18n_default_text='Learn more about trading limits' />
</Text>
</a>
<Button
disabled={!dirty || !isValid || isSubmitting}
primary
className='da-self-exclusion__button'
large
onClick={() => goToConfirm(values)}
type='button'
>
<Localize i18n_default_text='Next' />
</Button>
</>,
footer_ref
);
}
Expand Down
3 changes: 3 additions & 0 deletions packages/account/src/Components/unlink-account-modal/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import UnlinkAccountModal from './unlink-account-modal.jsx';

export default UnlinkAccountModal;
Loading

0 comments on commit 3726d8e

Please sign in to comment.