diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a6eb383d977e..9d714fef2f9f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,34 +1,7 @@ ## Changes: -Please include a summary of the change and which issue is fixed below: -- ... +Please provide a summary of the change. -## When you need to add unit test +### Screenshots: -- [ ] If this change disrupt current flow -- [ ] If this change is adding new flow - -## When you need to add integration test - -- [ ] If components from external libraries are being used to define the flow, e.g. @deriv/components -- [ ] If it relies on a very specific set of props with no default behavior for the current component. - -## Test coverage checklist (for reviewer) - -- [ ] Ensure utility / function has a test case -- [ ] Ensure all the tests are passing - -## Type of change - -- [ ] Bug fix -- [ ] New feature -- [ ] Update feature -- [ ] Refactor code -- [ ] Translation to code -- [ ] Translation to crowdin -- [ ] Script configuration -- [ ] Improve performance -- [ ] Style only -- [ ] Dependency update -- [ ] Documentation update -- [ ] Release +Please provide some screenshots of the change. diff --git a/package-lock.json b/package-lock.json index 62f5aa533227..203e8a589dbd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@datadog/browser-rum": "^4.37.0", "@deriv/api-types": "^1.0.94", "@deriv/deriv-api": "^1.0.11", - "@deriv/deriv-charts": "1.1.9", + "@deriv/deriv-charts": "1.2.1", "@deriv/js-interpreter": "^3.0.0", "@deriv/ui": "^0.6.0", "@livechat/customer-sdk": "^2.0.4", @@ -2843,9 +2843,9 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@deriv/deriv-charts": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@deriv/deriv-charts/-/deriv-charts-1.1.9.tgz", - "integrity": "sha512-8XfzNX1Ukoq90cf9PQcHu+cb0O+5i82RvjKgqDQt/U9buMlgFea79CPjxa9z+EG/i69mOvUYgMS48di2eNZX+w==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@deriv/deriv-charts/-/deriv-charts-1.2.1.tgz", + "integrity": "sha512-Yi3TavQbSviC8uGy7uuGnwKr8+zfiZFzdHvwOdwSWWMoRb/fQELA+S902g8MmhosRmXVxAOSfgRP+1fljxc4mg==", "dependencies": { "@welldone-software/why-did-you-render": "^3.3.8", "classnames": "^2.3.1", @@ -49737,9 +49737,9 @@ } }, "@deriv/deriv-charts": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@deriv/deriv-charts/-/deriv-charts-1.1.9.tgz", - "integrity": "sha512-8XfzNX1Ukoq90cf9PQcHu+cb0O+5i82RvjKgqDQt/U9buMlgFea79CPjxa9z+EG/i69mOvUYgMS48di2eNZX+w==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@deriv/deriv-charts/-/deriv-charts-1.2.1.tgz", + "integrity": "sha512-Yi3TavQbSviC8uGy7uuGnwKr8+zfiZFzdHvwOdwSWWMoRb/fQELA+S902g8MmhosRmXVxAOSfgRP+1fljxc4mg==", "requires": { "@welldone-software/why-did-you-render": "^3.3.8", "classnames": "^2.3.1", diff --git a/packages/bot-web-ui/package.json b/packages/bot-web-ui/package.json index c7a3016a595b..32c8f11c7b0a 100644 --- a/packages/bot-web-ui/package.json +++ b/packages/bot-web-ui/package.json @@ -66,7 +66,7 @@ "dependencies": { "@deriv/bot-skeleton": "^1.0.0", "@deriv/components": "^1.0.0", - "@deriv/deriv-charts": "1.1.9", + "@deriv/deriv-charts": "1.2.1", "@deriv/shared": "^1.0.0", "@deriv/translations": "^1.0.0", "classnames": "^2.2.6", diff --git a/packages/core/package.json b/packages/core/package.json index 7b5b662592f4..c955b17c0cf6 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -95,7 +95,7 @@ "@deriv/cfd": "^1.0.0", "@deriv/components": "^1.0.0", "@deriv/deriv-api": "^1.0.11", - "@deriv/deriv-charts": "1.1.9", + "@deriv/deriv-charts": "1.2.1", "@deriv/hooks": "^1.0.0", "@deriv/p2p": "^0.7.3", "@deriv/reports": "^1.0.0", diff --git a/packages/core/src/App/Containers/CitizenshipModal/set-citizenship-form.jsx b/packages/core/src/App/Containers/CitizenshipModal/set-citizenship-form.jsx index 60cc06c9e1af..77be8d46d244 100644 --- a/packages/core/src/App/Containers/CitizenshipModal/set-citizenship-form.jsx +++ b/packages/core/src/App/Containers/CitizenshipModal/set-citizenship-form.jsx @@ -1,44 +1,26 @@ import { Field } from 'formik'; import PropTypes from 'prop-types'; import React from 'react'; -import { Autocomplete, DesktopWrapper, MobileWrapper, SelectNative, Text } from '@deriv/components'; +import { Autocomplete, Text } from '@deriv/components'; import { Localize, localize } from '@deriv/translations'; -const SetCitizenshipForm = ({ class_prefix, errors, touched, setFieldTouched, setFieldValue, citizenship_list }) => ( +const SetCitizenshipForm = ({ class_prefix, errors, touched, setFieldValue, citizenship_list }) => (
{({ field }) => ( - - setFieldValue('citizenship', value ? text : '', true)} - /> - - - { - setFieldTouched('citizenship', true); - setFieldValue('citizenship', e.target.value, true); - }} - should_hide_disabled_options={false} - /> - + setFieldValue('citizenship', value ? text : '', true)} + /> )} diff --git a/packages/core/src/App/Containers/Modals/ready-to-deposit-modal/ready-to-deposit-modal.tsx b/packages/core/src/App/Containers/Modals/ready-to-deposit-modal/ready-to-deposit-modal.tsx index a9a3c66a6dcd..4484f8517a5b 100644 --- a/packages/core/src/App/Containers/Modals/ready-to-deposit-modal/ready-to-deposit-modal.tsx +++ b/packages/core/src/App/Containers/Modals/ready-to-deposit-modal/ready-to-deposit-modal.tsx @@ -5,7 +5,7 @@ import { useStore, observer } from '@deriv/stores'; import './ready-to-deposit-modal.scss'; const ReadyToDepositModal = observer(() => { - const { ui, traders_hub } = useStore(); + const { ui, traders_hub, client } = useStore(); const { is_eu_user } = traders_hub; const { is_ready_to_deposit_modal_visible: is_open, @@ -13,11 +13,18 @@ const ReadyToDepositModal = observer(() => { disableApp, enableApp, openRealAccountSignup, + setShouldShowCooldownModal, } = ui; + const { real_account_creation_unlock_date } = client; const createAccount = () => { onClose(); - return is_eu_user ? openRealAccountSignup('maltainvest') : openRealAccountSignup(); + if (real_account_creation_unlock_date) { + return setShouldShowCooldownModal(true); + } else if (is_eu_user) { + return openRealAccountSignup('maltainvest'); + } + return openRealAccountSignup(); }; return ( diff --git a/packages/core/src/App/Containers/SetResidenceModal/set-residence-form.jsx b/packages/core/src/App/Containers/SetResidenceModal/set-residence-form.jsx index d0418cab274f..e9c52dd1ff81 100644 --- a/packages/core/src/App/Containers/SetResidenceModal/set-residence-form.jsx +++ b/packages/core/src/App/Containers/SetResidenceModal/set-residence-form.jsx @@ -1,7 +1,7 @@ import { Field } from 'formik'; import PropTypes from 'prop-types'; import React from 'react'; -import { Autocomplete, DesktopWrapper, MobileWrapper, SelectNative, Text } from '@deriv/components'; +import { Autocomplete, Text } from '@deriv/components'; import { localize } from '@deriv/translations'; const SetResidenceForm = ({ @@ -26,38 +26,19 @@ const SetResidenceForm = ({ {({ field }) => ( - - - setFieldValue('residence', value ? text : '', true) - } - /> - - - { - setFieldTouched('residence', true); - setFieldValue('residence', e.target.value, true); - }} - /> - + setFieldValue('residence', value ? text : '', true)} + /> )} diff --git a/packages/core/src/Services/ws-methods.js b/packages/core/src/Services/ws-methods.js index 80ceab624bb7..6765de4ca3fc 100644 --- a/packages/core/src/Services/ws-methods.js +++ b/packages/core/src/Services/ws-methods.js @@ -1,6 +1,5 @@ import BinarySocket from '_common/base/socket_base'; -import { trackJSNetworkMonitor } from '@deriv/shared'; const WS = BinarySocket; -export default trackJSNetworkMonitor(WS); +export default WS; diff --git a/packages/p2p/src/components/modal-manager/modals/email-link-verified-modal/email-link-verified-modal.jsx b/packages/p2p/src/components/modal-manager/modals/email-link-verified-modal/email-link-verified-modal.jsx index dc42a2076d57..f55530f72a20 100644 --- a/packages/p2p/src/components/modal-manager/modals/email-link-verified-modal/email-link-verified-modal.jsx +++ b/packages/p2p/src/components/modal-manager/modals/email-link-verified-modal/email-link-verified-modal.jsx @@ -33,7 +33,7 @@ const EmailLinkVerifiedModal = () => { large primary onClick={() => { - hideModal(); + hideModal({ should_hide_all_modals: true }); order_store.confirmOrder(is_buy_order_for_user); }} > diff --git a/packages/shared/src/services/index.ts b/packages/shared/src/services/index.ts index 33c0e02743b6..20f6ca4ceb72 100644 --- a/packages/shared/src/services/index.ts +++ b/packages/shared/src/services/index.ts @@ -1,2 +1 @@ export * from './ws-methods'; -export { trackJSNetworkMonitor } from './trackjs'; diff --git a/packages/shared/src/services/trackjs.ts b/packages/shared/src/services/trackjs.ts deleted file mode 100644 index 6a67bed13523..000000000000 --- a/packages/shared/src/services/trackjs.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* - Responses that should be ignored upon receiving errors. - We still log them, but having an error inside of these - will not break the queue and send them to trackjs. - This will look for predefined `ignored_responses_in_trackjs` from GTM, if - there is none, then it just does not filter out any response. -*/ -declare global { - interface Window { - ignored_responses_in_trackjs: []; - TrackJS: { console: { log: (arg0: unknown[]) => void }; track: (arg0: object) => void }; - } -} - -const getIgnoredResponseKeywords = () => { - return window.ignored_responses_in_trackjs || []; -}; - -class ResponseQueue { - list: unknown[]; - size: number; - constructor() { - this.list = []; - this.size = 3; - } - - add(response: unknown) { - this.list.unshift(response); - } - - remove() { - this.list.pop(); - } - - push(response: unknown) { - if (this.list.length >= this.size) { - this.remove(); - } - this.add(response); - } - - fresh() { - this.list = []; - } -} - -const queue = new ResponseQueue(); - -/** - * Listen on method calls and inspect the response to see if error is thrown. - * Handling the response status is NOT this function's responsibility - */ -export const ApiCallProxyHandler = { - get(target: object, prop_key: PropertyKey, receiver: string) { - try { - const target_value = Reflect.get(target, prop_key, receiver); - if (typeof target_value === 'function') { - return (...args: string[]) => { - const result = target_value.apply(this, args); - if (result instanceof Promise) { - return new Promise(resolve => { - result - .then(response => { - if (response.error) { - queue.push(response); - if (window.TrackJS) window.TrackJS.console.log(queue.list); - queue.fresh(); - if ( - window.TrackJS && - !getIgnoredResponseKeywords().some( - (item: string) => item === response.error.code - ) - ) { - window.TrackJS.track(response.error.code); - } - } - queue.push(response); - resolve(response); - }) - .catch(error => { - if (window.TrackJS) { - window.TrackJS.console.log(queue.list); - window.TrackJS.track(error.getMessage()); - } - }); - }); - } - return result; - }; - } - return target_value; - } catch (error: unknown) { - if (error instanceof Error) { - throw new Error(error.message); - } - } - return null; - }, -}; - -export const trackJSNetworkMonitor = (obj: Record) => new Proxy(obj, ApiCallProxyHandler); diff --git a/packages/stores/src/mockStore.ts b/packages/stores/src/mockStore.ts index 1e66b0ccb439..89ec006cf13b 100644 --- a/packages/stores/src/mockStore.ts +++ b/packages/stores/src/mockStore.ts @@ -198,6 +198,7 @@ const mock = (): TStores => { setTwoFAStatus: jest.fn(), has_changed_two_fa: false, setTwoFAChangedStatus: jest.fn(), + real_account_creation_unlock_date: 0, }, common: { error: { @@ -253,6 +254,7 @@ const mock = (): TStores => { is_ready_to_deposit_modal_visible: false, is_need_real_account_for_cashier_modal_visible: false, toggleNeedRealAccountForCashierModal: jest.fn(), + setShouldShowCooldownModal: jest.fn(), }, traders_hub: { closeModal: jest.fn(), diff --git a/packages/stores/types.ts b/packages/stores/types.ts index e114d70cce3c..3211e4dac9da 100644 --- a/packages/stores/types.ts +++ b/packages/stores/types.ts @@ -191,6 +191,7 @@ type TClientStore = { setTwoFAStatus: (status: boolean) => void; has_changed_two_fa: boolean; setTwoFAChangedStatus: (status: boolean) => void; + real_account_creation_unlock_date: number; }; type TCommonStoreError = { @@ -248,6 +249,7 @@ type TUiStore = { is_ready_to_deposit_modal_visible: boolean; is_need_real_account_for_cashier_modal_visible: boolean; toggleNeedRealAccountForCashierModal: () => void; + setShouldShowCooldownModal: (value: boolean) => void; }; type TMenuStore = { diff --git a/packages/trader/package.json b/packages/trader/package.json index 612df0c6b790..9a4c7e1114d9 100644 --- a/packages/trader/package.json +++ b/packages/trader/package.json @@ -82,7 +82,7 @@ "@deriv/api-types": "^1.0.94", "@deriv/components": "^1.0.0", "@deriv/deriv-api": "^1.0.11", - "@deriv/deriv-charts": "1.1.9", + "@deriv/deriv-charts": "1.2.1", "@deriv/reports": "^1.0.0", "@deriv/shared": "^1.0.0", "@deriv/stores": "^1.0.0", diff --git a/packages/trader/src/Modules/SmartChart/Components/toolbar-widgets.jsx b/packages/trader/src/Modules/SmartChart/Components/toolbar-widgets.jsx index db799d507ccb..f98fa5684f6d 100644 --- a/packages/trader/src/Modules/SmartChart/Components/toolbar-widgets.jsx +++ b/packages/trader/src/Modules/SmartChart/Components/toolbar-widgets.jsx @@ -2,13 +2,10 @@ import PropTypes from 'prop-types'; import React from 'react'; import { isDesktop, isMobile } from '@deriv/shared'; import { ChartMode, DrawTools, Share, StudyLegend, Views, ToolbarWidget } from 'Modules/SmartChart'; -import { connect } from 'Stores/connect'; -const ToolbarWidgets = ({ is_accumulator, position, updateChartType, updateGranularity }) => ( +const ToolbarWidgets = ({ position, updateChartType, updateGranularity }) => ( - {!is_accumulator && ( - - )} + {isDesktop() && } {isDesktop() && } {isDesktop() && } @@ -20,11 +17,6 @@ ToolbarWidgets.propTypes = { position: PropTypes.string, updateChartType: PropTypes.func, updateGranularity: PropTypes.func, - is_accumulator: PropTypes.func, }; -export default React.memo( - connect(({ modules }) => ({ - is_accumulator: modules.trade.is_accumulator, - }))(ToolbarWidgets) -); +export default React.memo(ToolbarWidgets); diff --git a/packages/trader/src/Modules/Trading/Containers/trade.jsx b/packages/trader/src/Modules/Trading/Containers/trade.jsx index ee477cd765fe..61950b4261a7 100644 --- a/packages/trader/src/Modules/Trading/Containers/trade.jsx +++ b/packages/trader/src/Modules/Trading/Containers/trade.jsx @@ -4,7 +4,6 @@ import classNames from 'classnames'; import { DesktopWrapper, Div100vhContainer, MobileWrapper, SwipeableWrapper } from '@deriv/components'; import { isDesktop, isMobile } from '@deriv/shared'; import ChartLoader from 'App/Components/Elements/chart-loader.jsx'; -import { isDigitTradeType } from 'Modules/Trading/Helpers/digits'; import { connect } from 'Stores/connect'; import PositionsDrawer from 'App/Components/Elements/PositionsDrawer'; import MarketIsClosedOverlay from 'App/Components/Elements/market-is-closed-overlay.jsx'; @@ -31,7 +30,6 @@ const BottomWidgetsMobile = ({ tick, digits, setTick, setDigits }) => { }; const Trade = ({ - contract_type, form_components, getFirstOpenMarket, should_show_active_symbols_loading, @@ -182,13 +180,7 @@ const Trade = ({
- + { id='trade' isMobile={isMobile()} maxTick={isMobile() ? max_ticks : undefined} - granularity={granularity} + granularity={show_digits_stats || is_accumulator ? 0 : granularity} requestAPI={wsSendRequest} requestForget={wsForget} requestForgetStream={wsForgetStream} requestSubscribe={wsSubscribe} settings={settings} should_show_eu_content={should_show_eu_content} + allowTickChartTypeOnly={show_digits_stats || is_accumulator} stateChangeListener={chartStateChange} symbol={symbol} topWidgets={is_trade_enabled ? topWidgets : null} @@ -481,6 +474,7 @@ const ChartTrade = connect(({ client, modules, ui, common, contract_trade, portf is_digit_contract: contract_trade.last_contract.is_digit_contract, is_ended: contract_trade.last_contract.is_ended, }, + is_accumulator: modules.trade.is_accumulator, is_trade_enabled: modules.trade.is_trade_enabled, main_barrier: modules.trade.main_barrier_flattened, extra_barriers: modules.trade.barriers_flattened, diff --git a/types/global.d.ts b/types/global.d.ts index 51f0e7548ac4..f31168fb51a7 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -9,6 +9,7 @@ declare global { on_chat_ended: VoidFunction; open_chat_window: VoidFunction; }; + TrackJS: { console: { log: (arg0: unknown[]) => void }; track: (arg0: object) => void }; } }