Skip to content

Commit

Permalink
Merge branch 'master' into suisin/DIEL_flow_change
Browse files Browse the repository at this point in the history
  • Loading branch information
suisin-deriv committed Jun 28, 2023
2 parents 283dced + 06343ec commit f911aab
Show file tree
Hide file tree
Showing 26 changed files with 194 additions and 129 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
pull_request:
branches:
- '**'
env:
JEST_MAX_WORKERS: 4
push:
branches:
- master
Expand All @@ -21,7 +23,7 @@ jobs:
npm install
npm run bootstrap
npm run build:all
npm run test:jest 4
npm run test:jest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"start": "f () { lerna exec --scope=@deriv/${1:-'*'} -- npm run start ;}; f",
"test": "f () { bash ./scripts/circleci-config.test.sh && npm run test:stylelint && npm run test:eslint-all && npm run test:jest ;}; f",
"test:stylelint": "stylelint \"./packages/*/src/**/*.s(a|c)ss\"",
"test:jest": "jest --all --maxWorkers=${1:-8}",
"test:jest": "jest --all --maxWorkers=${JEST_MAX_WORKERS:-'45%'}",
"test:e2e": "cd end-to-end-test && npx playwright test",
"test:e2e-dev": "cd end-to-end-test && npx playwright test --trace on && npx playwright show-report",
"test:performance": "cd e2e_tests && jest -c ./jest.config.js --maxWorkers=2 --detectOpenHandles performance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const PoiConfirmWithExampleFormContainer = ({
setFieldTouched={setFieldTouched}
editable_fields={rest_state.changeable_fields}
is_rendered_for_onfido
warning_items={undefined}
/>
<button
type='submit'
Expand Down
18 changes: 18 additions & 0 deletions packages/cashier/src/stores/__tests__/deposit-store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,22 @@ describe('DepositStore', () => {
expect(checkIframeLoaded).not.toHaveBeenCalled();
expect(setLoading).toHaveBeenCalledWith(false);
});
it('should call cashier deposit if the active_container is deposit and not on crypto', async () => {
const { checkIframeLoaded } = deposit_store.root_store.modules.cashier.iframe;

deposit_store.root_store.modules.cashier.iframe.is_session_timeout = true;

await deposit_store.onMountDeposit();
expect(checkIframeLoaded).toHaveBeenCalled();
expect(deposit_store.WS.authorized.cashier).toHaveBeenCalled();
});
it('should not call cashier deposit if the active_container is not deposit and on crypto', async () => {
const { checkIframeLoaded } = deposit_store.root_store.modules.cashier.iframe;
deposit_store.root_store.modules.cashier.general_store.active_container = 'withdraw';
deposit_store.root_store.modules.cashier.iframe.is_session_timeout = true;

await deposit_store.onMountDeposit();
expect(checkIframeLoaded).not.toHaveBeenCalled();
expect(deposit_store.WS.authorized.cashier).not.toHaveBeenCalled();
});
});
2 changes: 1 addition & 1 deletion packages/cashier/src/stores/deposit-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class DepositStore {
return;
}

if (!is_crypto) {
if (!is_crypto && active_container === 'deposit') {
const response_cashier = await this.WS.authorized.cashier(active_container, {
verification_code: 'undefined',
});
Expand Down
57 changes: 33 additions & 24 deletions packages/cfd/src/Containers/cfd-password-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import RootStore from '../Stores/index';
import {
getDxCompanies,
getMtCompanies,
getDerivezCompanies,
getFormattedJurisdictionCode,
TMtCompanies,
TDxCompanies,
TDerivezCompanies,
} from '../Stores/Modules/CFD/Helpers/cfd-config';
import {
FormSubmitButton,
Expand Down Expand Up @@ -839,15 +841,33 @@ const CFDPasswordModal = ({
if (!category && !type) return '';

const category_label = category === 'real' ? localize('real') : localize('demo');
const type_label =
getMtCompanies(show_eu_related_content)[category as keyof TMtCompanies][
type as keyof TMtCompanies['demo' | 'real']
].short_title;
const deriv_x_type_label =
getDxCompanies()[category as keyof TDxCompanies][type as keyof TDxCompanies['demo' | 'real']].short_title;
let type_label = '';
switch (platform) {
case CFD_PLATFORMS.MT5:
type_label =
getMtCompanies(show_eu_related_content)[category as keyof TMtCompanies][
type as keyof TMtCompanies['demo' | 'real']
].short_title;
break;
case CFD_PLATFORMS.DXTRADE:
type_label =
getDxCompanies()[category as keyof TDxCompanies][type as keyof TDxCompanies['demo' | 'real']]
.short_title;
break;
case CFD_PLATFORMS.DERIVEZ:
type_label =
getDerivezCompanies()[category as keyof TDerivezCompanies][
type as keyof TDerivezCompanies['demo' | 'real']
].short_title;
break;
default:
type_label = '';
break;
}

const jurisdiction_label =
jurisdiction_selected_shortcode && getFormattedJurisdictionCode(jurisdiction_selected_shortcode);
const mt5_platform_label = jurisdiction_selected_shortcode !== Jurisdiction.MALTA_INVEST ? 'MT5' : '';
const mt5_platform_label = jurisdiction_selected_shortcode !== Jurisdiction.MALTA_INVEST ? 'Deriv MT5' : '';

if (category === 'real') {
let platformName = '';
Expand All @@ -868,19 +888,14 @@ const CFDPasswordModal = ({
<Localize
i18n_default_text='Congratulations, you have successfully created your {{category}} <0>{{platform}}</0> <1>{{type}} {{jurisdiction_selected_shortcode}}</1> account. '
values={{
type:
platform === CFD_PLATFORMS.DERIVEZ
? 'CFDs'
: platform === CFD_PLATFORMS.DXTRADE
? deriv_x_type_label
: type_label,
type: type_label,
platform:
platform === CFD_PLATFORMS.MT5 ? mt5_platform_label : getCFDPlatformLabel(platform),
category: category_label,
jurisdiction_selected_shortcode:
platform === CFD_PLATFORMS.MT5 && !show_eu_related_content ? jurisdiction_label : '',
}}
components={[<span key={0} />, <strong key={1} className='cfd-account__platform' />]}
components={[<span key={0} className='cfd-account__platform' />, <strong key={1} />]}
/>
{platform === CFD_PLATFORMS.DXTRADE ? (
<Localize i18n_default_text='To start trading, transfer funds from your Deriv account into this account.' />
Expand All @@ -897,19 +912,13 @@ const CFDPasswordModal = ({

return (
<Localize
i18n_default_text='Congratulations, you have successfully created your {{category}} {{deriv_keyword}} <0>{{platform}}</0> <1>{{type}}</1> account.'
i18n_default_text='Congratulations, you have successfully created your {{category}} <0>{{platform}}</0> <1>{{type}}</1> account. '
values={{
deriv_keyword: platform === CFD_PLATFORMS.MT5 ? 'Deriv' : '',
type:
platform === CFD_PLATFORMS.DERIVEZ
? 'CFDs'
: platform === CFD_PLATFORMS.DXTRADE
? deriv_x_type_label
: type_label,
platform: platform === CFD_PLATFORMS.MT5 ? 'MT5' : getCFDPlatformLabel(platform),
type: type_label,
platform: getCFDPlatformLabel(platform),
category: category_label,
}}
components={[<span key={0} />, <strong key={1} className='cfd-account__platform' />]}
components={[<span key={0} className='cfd-account__platform' />, <strong key={1} />]}
/>
);
};
Expand Down
7 changes: 3 additions & 4 deletions packages/cfd/src/Stores/Modules/CFD/Helpers/cfd-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const getMtCompanies = (is_eu: boolean) => {
const all_config = {
account_type: '',
leverage: 100,
short_title: localize('Demo'),
short_title: localize('Swap-Free'),
};
const synthetic_config = {
account_type: '',
Expand All @@ -93,7 +93,6 @@ export const getMtCompanies = (is_eu: boolean) => {
leverage: 100,
short_title: localize('Financial STP'),
};

return {
demo: {
all: {
Expand All @@ -106,7 +105,7 @@ export const getMtCompanies = (is_eu: boolean) => {
mt5_account_type: all_config.account_type,
leverage: all_config.leverage,
title: localize('Demo Swap-Free SVG'),
short_title: all_config.short_title,
short_title: localize('Swap-Free SVG'),
},
derivez: {
mt5_account_type: all_config.account_type,
Expand Down Expand Up @@ -137,7 +136,7 @@ export const getMtCompanies = (is_eu: boolean) => {
mt5_account_type: financial_config.account_type,
leverage: financial_config.leverage,
title: is_eu ? localize('Demo CFDs') : localize('Demo Financial SVG'),
short_title: financial_config.short_title,
short_title: is_eu ? localize('CFDs') : localize('Financial SVG'),
},
financial_stp: {
mt5_account_type: financial_stp_config.account_type,
Expand Down
2 changes: 1 addition & 1 deletion packages/translations/crowdin/messages.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion packages/translations/src/translations/ach.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"196998347": "crwdns1259209:0crwdne1259209:0",
"197190401": "crwdns1259211:0crwdne1259211:0",
"201091938": "crwdns1259213:0crwdne1259213:0",
"203108063": "crwdns2359583:0{{category}}crwdnd2359583:0{{platform}}crwdnd2359583:0{{type}}crwdne2359583:0",
"203179929": "crwdns1259215:0crwdne1259215:0",
"203271702": "crwdns1259217:0crwdne1259217:0",
"203297887": "crwdns2101731:0crwdne2101731:0",
Expand Down Expand Up @@ -827,7 +828,6 @@
"955352264": "crwdns1260373:0{{platform_name_dxtrade}}crwdne1260373:0",
"956448295": "crwdns1260375:0crwdne1260375:0",
"957182756": "crwdns1260377:0crwdne1260377:0",
"957956227": "crwdns2080545:0{{category}}crwdnd2080545:0{{deriv_keyword}}crwdnd2080545:0{{platform}}crwdnd2080545:0{{type}}crwdne2080545:0",
"958430760": "crwdns1260379:0crwdne1260379:0",
"959031082": "crwdns1260381:0{{ variable }}crwdnd1260381:0{{ dropdown }}crwdnd1260381:0{{ dummy }}crwdne1260381:0",
"960201789": "crwdns1260383:0crwdne1260383:0",
Expand Down Expand Up @@ -1199,6 +1199,7 @@
"1353958640": "crwdns2101807:0crwdne2101807:0",
"1354288636": "crwdns1335137:0crwdne1335137:0",
"1355250245": "crwdns1261001:0{{ calculation }}crwdnd1261001:0{{ input_list }}crwdne1261001:0",
"1356373528": "crwdns2359579:0crwdne2359579:0",
"1356574493": "crwdns1261003:0crwdne1261003:0",
"1356607862": "crwdns1261005:0crwdne1261005:0",
"1357129681": "crwdns1261007:0{{num_day}}crwdnd1261007:0{{num_hour}}crwdnd1261007:0{{num_minute}}crwdne1261007:0",
Expand Down Expand Up @@ -3413,6 +3414,7 @@
"-235472388": "crwdns2352003:0{{platform}}crwdnd2352003:0{{is_demo}}crwdne2352003:0",
"-525896186": "crwdns2352005:0crwdne2352005:0",
"-346502452": "crwdns2352007:0crwdne2352007:0",
"-1396757256": "crwdns2359581:0crwdne2359581:0",
"-648956272": "crwdns170916:0crwdne170916:0",
"-1814308691": "crwdns170920:0{{platform}}crwdne170920:0",
"-601303096": "crwdns2352009:0{{ platform }}crwdne2352009:0",
Expand Down
4 changes: 3 additions & 1 deletion packages/translations/src/translations/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"196998347": "نحتفظ بأموال العملاء في حسابات مصرفية منفصلة عن حساباتنا التشغيلية والتي لن تشكل، في حالة الإفلاس، جزءًا من أصول الشركة. هذا يلبي متطلبات <0>لجنة المقامرة</0> لفصل أموال العملاء على المستوى: <1>حماية متوسطة</1>.",
"197190401": "تاريخ انتهاء الصلاحية",
"201091938": "30 يومًا",
"203108063": "تهانينا، لقد قمت بإنشاء حساب {{category}} <0>{{platform}}</0> <1>{{type}}</1> الخاص بك بنجاح. ",
"203179929": "<0>يمكنك فتح هذا الحساب بمجرد التحقق من المستندات المقدمة.</0>",
"203271702": "حاول مرة أخرى",
"203297887": "سيتم تحميل الإستراتيجية السريعة التي أنشأتها للتو إلى مساحة العمل.",
Expand Down Expand Up @@ -827,7 +828,6 @@
"955352264": "تداول على {{platform_name_dxtrade}}",
"956448295": "تم اكتشاف صورة مقطوعة",
"957182756": "الدوال المثلثية",
"957956227": "تهانينا، لقد نجحت في إنشاء حساب {{category}} {{deriv_keyword}} <0>{{platform}}</0> <1>{{type}}</1> الخاص بك.",
"958430760": "في الداخل/ في الخارج",
"959031082": "اضبط {{ variable }} على مصفوفة MACD {{ dropdown }} {{ dummy }}",
"960201789": "3. شروط البيع",
Expand Down Expand Up @@ -1199,6 +1199,7 @@
"1353958640": "يمكنك أيضًا استخدام هذه الاختصارات لاستيراد البوت الخاص بك أو إنشائه.",
"1354288636": "استنادًا إلى إجاباتك، يبدو أنك لا تملك المعرفة والخبرة الكافية في تداول العقود مقابل الفروقات. يعد تداول CFD محفوفًا بالمخاطر وقد تفقد كل رأس مالك.<0/><0/>",
"1355250245": "{{ calculation }} من القائمة {{ input_list }}",
"1356373528": "قم بتشغيل Deriv EZ على متصفحك",
"1356574493": "تقوم بإرجاع جزء محدد من سلسلة نصية معينة.",
"1356607862": "كلمة المرور ل ديريف",
"1357129681": "{{num_day}} يوم {{num_hour}} ساعة {{num_minute}} دقيقة",
Expand Down Expand Up @@ -3413,6 +3414,7 @@
"-235472388": "Deriv {{platform}} {{is_demo}}",
"-525896186": "قم بتنزيل Deriv GO على هاتفك للتداول باستخدام حساب Deriv EZ",
"-346502452": "قم بتنزيل Deriv cTrader على هاتفك للتداول باستخدام حساب Deriv cTrader",
"-1396757256": "قم بتشغيل Deriv cTrader على متصفحك",
"-648956272": "استخدم كلمة المرور هذه لتسجيل الدخول إلى حسابات Deriv X الخاصة بك على الويب وتطبيقات الهاتف المحمول.",
"-1814308691": "يرجى النقر فوق الارتباط الموجود في البريد الإلكتروني لتغيير كلمة المرور {{platform}} الخاصة بك.",
"-601303096": "امسح رمز QR لتنزيل Deriv {{ platform }}.",
Expand Down
4 changes: 3 additions & 1 deletion packages/translations/src/translations/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"196998347": "আমরা আমাদের অপারেশনাল অ্যাকাউন্ট থেকে পৃথক ব্যাংক অ্যাকাউন্টে গ্রাহক তহবিল ধরে থাকি, যা দেউলিয়াতা ঘটলে, কোম্পানির সম্পদের অংশ গঠন করবে না। এটি স্তরের গ্রাহক তহবিলের পৃথকীকরণের জন্য <0>জুয়া কমিশনের</0> প্রয়োজনীয়তাগুলি পূরণ করে: <1>মাঝারি সুরক্ষা</1>।",
"197190401": "মেয়াদ শেষের তারিখ",
"201091938": "৩০ দিন",
"203108063": "অভিনন্দন, আপনি সফলভাবে আপনার {{category}} <0>{{platform}}</0> <1>{{type}}</1> অ্যাকাউন্ট তৈরি করেছেন। ",
"203179929": "<0>আপনার জমা দেওয়া ডকুমেন্টগুলি যাচাই হয়ে গেলে আপনি এই অ্যাকাউন্টটি খুলতে পারেন।</0>",
"203271702": "পুনরায় চেষ্টা করুন",
"203297887": "আপনি তৈরি দ্রুত কৌশল কর্মক্ষেত্রে লোড করা হবে।",
Expand Down Expand Up @@ -827,7 +828,6 @@
"955352264": "{{platform_name_dxtrade}}তে ট্রেড করুন",
"956448295": "কাট-অফ ছবি সনাক্ত করা হয়েছে",
"957182756": "ত্রিকোণমিতিক ফাংশন",
"957956227": "অভিনন্দন, আপনি সফলভাবে আপনার {{category}} {{deriv_keyword}} <0>{{platform}}</0> <1>{{type}}</1> অ্যাকাউন্ট তৈরি করেছেন।",
"958430760": "ইন/আউট",
"959031082": "এমএসিডি অ্যারে {{ dropdown }} {{ dummy }}এ {{ variable }} সেট করুন",
"960201789": "3। বিক্রয় শর্তাবলী",
Expand Down Expand Up @@ -1199,6 +1199,7 @@
"1353958640": "আপনি আপনার বট আমদানি বা তৈরি করতে এই শর্টকাটগুলি ব্যবহার করতে পারেন।",
"1354288636": "আপনার উত্তরগুলির উপর ভিত্তি করে, মনে হচ্ছে আপনার CFD ট্রেডিং সম্পর্কে অপর্যাপ্ত জ্ঞান এবং অভিজ্ঞতা আছে। CFD ট্রেডিং ঝুঁকিপূর্ণ এবং আপনি সম্ভাব্য আপনার সমস্ত মূলধন হারাতে পারেন।<0/><0/>",
"1355250245": "তালিকার {{ input_list }}এর {{ calculation }}",
"1356373528": "আপনার ব্রাউজারে Deriv EZ চালান",
"1356574493": "পাঠ্যের একটি প্রদত্ত স্ট্রিং এর একটি নির্দিষ্ট অংশ প্রদান করে।",
"1356607862": "পাসওয়ার্ড নেওয়া হবে",
"1357129681": "{{num_day}} দিন {{num_hour}} ঘন্টা {{num_minute}} মিনিট",
Expand Down Expand Up @@ -3413,6 +3414,7 @@
"-235472388": "Deriv {{platform}} {{is_demo}}",
"-525896186": "Deriv EZ অ্যাকাউন্টের সাথে ট্রেড করার জন্য আপনার ফোনে Deriv GO ডাউনলোড করুন",
"-346502452": "Deriv cTrader অ্যাকাউন্টের সাথে ট্রেড করতে আপনার ফোনে Deriv cTrader ডাউনলোড করুন",
"-1396757256": "আপনার ব্রাউজারে Deriv cTrader চালান",
"-648956272": "ওয়েব এবং মোবাইল অ্যাপ্লিকেশানগুলিতে আপনার Deriv X অ্যাকাউন্টে লগ ইন করতে এই পাসওয়ার্ডটি ব্যবহার করুন।",
"-1814308691": "আপনার {{platform}} পাসওয়ার্ড পরিবর্তন করতে ইমেলের লিঙ্কে ক্লিক করুন।",
"-601303096": "Deriv {{ platform }}ডাউনলোড করতে QR কোড স্ক্যান করুন।",
Expand Down
Loading

0 comments on commit f911aab

Please sign in to comment.