Skip to content

Commit 5971f3d

Browse files
Merge branch 'deriv-com:master' into shontzu/TRAH-5356/fe-implementation-api-group-cleanup
2 parents 9050ea9 + a6c88e6 commit 5971f3d

File tree

26 files changed

+415
-288
lines changed

26 files changed

+415
-288
lines changed

packages/cfd/src/Helpers/constants.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ const getTitle = (market_type: string, is_eu_user: boolean) => {
4242
const { is_staging, is_test_link } = getPlatformFromUrl();
4343

4444
const STRATEGY_PROVIDER_NOTES = [
45-
'When setting up a strategy, you have the option to impose fees.',
46-
'For strategies where you impose fees, you must assign one of your existing accounts to process these fees. The same ‘Account For Fees’ can support multiple fee-based strategies.',
47-
'Free strategies do not require an ‘Account For Fees’.',
48-
'An account designated as a strategy provider is irreversible unless it remains inactive for 30 days.',
49-
'An account cannot simultaneously be a strategy provider and serve as an ‘Account For Fees’.',
45+
localize('When setting up a strategy, you have the option to impose fees.'),
46+
localize(
47+
'For strategies where you impose fees, you must assign one of your existing accounts to process these fees. The same ‘Account For Fees’ can support multiple fee-based strategies.'
48+
),
49+
localize('Free strategies do not require an ‘Account For Fees’.'),
50+
localize('An account designated as a strategy provider is irreversible unless it remains inactive for 30 days.'),
51+
localize('An account cannot simultaneously be a strategy provider and serve as an ‘Account For Fees’.'),
5052
];
5153

5254
const REAL_DXTRADE_URL = 'https://dx.deriv.com';

packages/core/src/Stores/client-store.js

+56-36
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,26 @@ export default class ClientStore extends BaseStore {
18221822
const is_virtual = account.is_virtual;
18231823
const account_type = !is_virtual && currency ? currency : this.account_title;
18241824

1825+
setTimeout(async () => {
1826+
const analytics_config = await this.getAnalyticsConfig();
1827+
if (this.user_id) analytics_config.user_id = this.user_id;
1828+
Analytics.setAttributes(analytics_config);
1829+
}, 4);
1830+
1831+
return {
1832+
loginid,
1833+
is_disabled,
1834+
is_virtual,
1835+
icon: account_type.toLowerCase(), // TODO: display the icon
1836+
title: account_type.toLowerCase() === 'virtual' ? localize('DEMO') : account_type,
1837+
};
1838+
}
1839+
1840+
async getAnalyticsConfig(isLoggedOut = false) {
1841+
const broker = LocalStore?.get('active_loginid')
1842+
?.match(/[a-zA-Z]+/g)
1843+
?.join('');
1844+
18251845
const ppc_campaign_cookies =
18261846
Cookies.getJSON('utm_data') === 'null'
18271847
? {
@@ -1831,11 +1851,9 @@ export default class ClientStore extends BaseStore {
18311851
utm_content: 'no content',
18321852
}
18331853
: Cookies.getJSON('utm_data');
1834-
const broker = LocalStore?.get('active_loginid')
1835-
?.match(/[a-zA-Z]+/g)
1836-
?.join('');
1837-
setTimeout(async () => {
1838-
let residence_country = '';
1854+
1855+
let residence_country = '';
1856+
if (!isLoggedOut) {
18391857
if (this.residence) {
18401858
residence_country = this.residence;
18411859
} else {
@@ -1849,35 +1867,28 @@ export default class ClientStore extends BaseStore {
18491867
console.error('Error getting residence country', error);
18501868
}
18511869
}
1852-
1853-
const analytics_config = {
1854-
loggedIn: this.is_logged_in,
1855-
account_type: broker === 'null' ? 'unlogged' : broker,
1856-
residence_country,
1857-
app_id: String(getAppId()),
1858-
device_type: isMobile() ? 'mobile' : 'desktop',
1859-
language: getLanguage(),
1860-
device_language: navigator?.language || 'en-EN',
1861-
user_language: getLanguage().toLowerCase(),
1862-
country: await CountryUtils.getCountry(),
1863-
utm_source: ppc_campaign_cookies?.utm_source,
1864-
utm_medium: ppc_campaign_cookies?.utm_medium,
1865-
utm_campaign: ppc_campaign_cookies?.utm_campaign,
1866-
utm_content: ppc_campaign_cookies?.utm_content,
1867-
domain: window.location.hostname,
1868-
url: window.location.href,
1869-
};
1870-
1871-
if (this.user_id) analytics_config.user_id = this.user_id;
1872-
Analytics.setAttributes(analytics_config);
1873-
}, 4);
1870+
}
1871+
let login_status = false;
1872+
if (!isLoggedOut && this.is_logged_in) {
1873+
login_status = true;
1874+
}
18741875

18751876
return {
1876-
loginid,
1877-
is_disabled,
1878-
is_virtual,
1879-
icon: account_type.toLowerCase(), // TODO: display the icon
1880-
title: account_type.toLowerCase() === 'virtual' ? localize('DEMO') : account_type,
1877+
loggedIn: login_status,
1878+
account_type: broker === 'null' ? 'unlogged' : broker,
1879+
residence_country,
1880+
app_id: String(getAppId()),
1881+
device_type: isMobile() ? 'mobile' : 'desktop',
1882+
language: getLanguage(),
1883+
device_language: navigator?.language || 'en-EN',
1884+
user_language: getLanguage().toLowerCase(),
1885+
country: await CountryUtils.getCountry(),
1886+
utm_source: ppc_campaign_cookies?.utm_source,
1887+
utm_medium: ppc_campaign_cookies?.utm_medium,
1888+
utm_campaign: ppc_campaign_cookies?.utm_campaign,
1889+
utm_content: ppc_campaign_cookies?.utm_content,
1890+
domain: window.location.hostname,
1891+
url: window.location.href,
18811892
};
18821893
}
18831894

@@ -1914,7 +1925,7 @@ export default class ClientStore extends BaseStore {
19141925
}
19151926

19161927
async switchAccountHandler() {
1917-
if (!this.switched || !this.switched.length || !this.getAccount(this.switched)?.token) {
1928+
if (!this.switched || !this.switched.length) {
19181929
if (this.isUnableToFindLoginId()) {
19191930
this.handleNotFoundLoginId();
19201931
return;
@@ -1932,6 +1943,12 @@ export default class ClientStore extends BaseStore {
19321943
return;
19331944
}
19341945

1946+
const switched_account = this.getAccount(this.switched);
1947+
if (!switched_account?.token) {
1948+
this.handleNotFoundLoginId();
1949+
return;
1950+
}
1951+
19351952
runInAction(() => (this.is_switching = true));
19361953
this.setIsAuthorize(false);
19371954
const from_login_id = this.loginid;
@@ -1948,7 +1965,7 @@ export default class ClientStore extends BaseStore {
19481965
await BinarySocket?.wait('authorize');
19491966
} else {
19501967
await WS.forgetAll('balance');
1951-
await BinarySocket.authorize(this.getToken());
1968+
await BinarySocket.authorize(switched_account.token);
19521969
}
19531970
if (this.root_store.common.has_error) this.root_store.common.setError(false, null);
19541971
sessionStorage.setItem('active_tab', '1');
@@ -2093,7 +2110,7 @@ export default class ClientStore extends BaseStore {
20932110
this.initialized_broadcast = is_initialized;
20942111
}
20952112

2096-
cleanUp() {
2113+
async cleanUp() {
20972114
// delete all notifications keys for this account when logout
20982115
const notification_messages = LocalStore.getObject('notification_messages');
20992116
if (notification_messages && this.loginid) {
@@ -2102,6 +2119,9 @@ export default class ClientStore extends BaseStore {
21022119
...notification_messages,
21032120
});
21042121
}
2122+
// update growthbook
2123+
const analytics_config = await this.getAnalyticsConfig(true);
2124+
Analytics.setAttributes(analytics_config);
21052125

21062126
this.root_store.gtm.pushDataLayer({
21072127
event: 'log_out',
@@ -2135,7 +2155,7 @@ export default class ClientStore extends BaseStore {
21352155
const response = await requestLogout();
21362156

21372157
if (response?.logout === 1) {
2138-
this.cleanUp();
2158+
await this.cleanUp();
21392159

21402160
this.setLogout(true);
21412161
}

packages/core/src/Utils/Analytics/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ export const AnalyticsInitializer = async () => {
1818
.catch(() => FIREBASE_INIT_DATA);
1919
if (process.env.RUDDERSTACK_KEY && flags?.tracking_rudderstack) {
2020
const ppc_campaign_cookies =
21-
Cookies.getJSON('utm_data') === 'null'
21+
JSON.parse(Cookies.get('utm_data') || 'null') === 'null'
2222
? {
2323
utm_source: 'no source',
2424
utm_medium: 'no medium',
2525
utm_campaign: 'no campaign',
2626
utm_content: 'no content',
2727
}
28-
: Cookies.getJSON('utm_data');
28+
: JSON.parse(Cookies.get('utm_data') || 'null');
2929

30-
const client_information = Cookies.getJSON('client_information');
30+
const client_information = JSON.parse(Cookies.get('client_information') || 'null');
3131

3232
const config = {
3333
growthbookKey: flags.marketing_growthbook ? process.env.GROWTHBOOK_CLIENT_KEY : undefined,

packages/trader/src/AppV2/Components/TradeParameters/Duration/day.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ const DayInput = ({
253253
readOnly
254254
textAlignment='center'
255255
name='time'
256-
value={`${(is_24_hours_contract ? end_time : expiry_time_input) || '23:59:59'} GMT`}
256+
value={`${(is_24_hours_contract ? end_time : isSameDate && expiry_time_input) || '23:59:59'} GMT`}
257257
disabled={!is_24_hours_contract}
258258
onClick={() => {
259259
setOpenTimePicker(true);

packages/translations/crowdin/messages.json

+1-1
Large diffs are not rendered by default.

packages/translations/src/translations/ach.json

+5
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,7 @@
15361536
"1453317405": "crwdns1261165:0crwdne1261165:0",
15371537
"1454406889": "crwdns2101811:0crwdne2101811:0",
15381538
"1454648764": "crwdns1261169:0crwdne1261169:0",
1539+
"1455632613": "crwdns6498178:0crwdne6498178:0",
15391540
"1455741083": "crwdns1261173:0crwdne1261173:0",
15401541
"1457341530": "crwdns1261175:0crwdne1261175:0",
15411542
"1457603571": "crwdns1261177:0crwdne1261177:0",
@@ -1953,6 +1954,7 @@
19531954
"1866811212": "crwdns1261809:0crwdne1261809:0",
19541955
"1867217564": "crwdns1261813:0crwdne1261813:0",
19551956
"1867783237": "crwdns1261815:0crwdne1261815:0",
1957+
"1869568572": "crwdns6498180:0crwdne6498180:0",
19561958
"1869787212": "crwdns1261819:0crwdne1261819:0",
19571959
"1870933427": "crwdns1261821:0crwdne1261821:0",
19581960
"1871196637": "crwdns1261823:0crwdne1261823:0",
@@ -2054,6 +2056,7 @@
20542056
"1959678342": "crwdns1261975:0crwdne1261975:0",
20552057
"1960005187": "crwdns6163614:0crwdne6163614:0",
20562058
"1960240336": "crwdns1261977:0crwdne1261977:0",
2059+
"1960645545": "crwdns6498182:0crwdne6498182:0",
20572060
"1964165648": "crwdns1261981:0crwdne1261981:0",
20582061
"1965358881": "crwdns6149702:0crwdne6149702:0",
20592062
"1965916759": "crwdns1261983:0crwdne1261983:0",
@@ -3721,6 +3724,8 @@
37213724
"-1269597956": "crwdns2886885:0crwdne2886885:0",
37223725
"-1302404116": "crwdns170890:0crwdne170890:0",
37233726
"-1647612934": "crwdns2154517:0crwdne2154517:0",
3727+
"-1458325982": "crwdns6498184:0crwdne6498184:0",
3728+
"-1388554597": "crwdns6498186:0crwdne6498186:0",
37243729
"-941636117": "crwdns838746:0crwdne838746:0",
37253730
"-1434036215": "crwdns170790:0crwdne170790:0",
37263731
"-1416247163": "crwdns118046:0crwdne118046:0",

packages/translations/src/translations/ar.json

+5
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,7 @@
15361536
"1453317405": "تمنحك هذه المجموعة رصيد حسابك إما كرقم أو سلسلة نصية.",
15371537
"1454406889": "اختر <0>حتى</0> كخيار التكرار.",
15381538
"1454648764": "الرقم المرجعي للصفقة",
1539+
"1455632613": "الاستراتيجيات المجانية لا تتطلب 'حساب للرسوم'.",
15391540
"1455741083": "قم بتحميل الجزء الخلفي من رخصة القيادة الخاصة بك.",
15401541
"1457341530": "لقد فشل إثبات التحقق من الهوية.",
15411542
"1457603571": "لا توجد إشعارات",
@@ -1953,6 +1954,7 @@
19531954
"1866811212": "قم بالإيداع بعملتك المحلية عبر وكيل دفع معتمد ومستقل في بلدك.",
19541955
"1867217564": "يجب أن يكون الفهرس عددًا صحيحًا موجبًا",
19551956
"1867783237": "High-to-Close",
1957+
"1869568572": "الحساب المخصص كمزود استراتيجيات غير قابل للتغيير ما لم يبق غير نشط لمدة 30 يومًا.",
19561958
"1869787212": "Even",
19571959
"1870933427": "Crypto",
19581960
"1871196637": "صحيح إذا كانت نتيجة الصفقة الأخيرة تتطابق مع الاختيار",
@@ -2054,6 +2056,7 @@
20542056
"1959678342": "Highs & Lows",
20552057
"1960005187": "اتبع هذه الخطوات لنقل استراتيجياتك بسلاسة",
20562058
"1960240336": "الحرف الأول",
2059+
"1960645545": "بالنسبة للاستراتيجيات التي تفرض فيها الرسوم، يجب عليك تعيين أحد حساباتك الحالية لمعالجة هذه الرسوم. يمكن أن يدعم نفس 'حساب للرسوم' استراتيجيات متعددة تعتمد على الرسوم.",
20572060
"1964165648": "تم فقدان الاتصال",
20582061
"1965358881": "الخطوة 2 من 3: تأكيد رقم هاتفك",
20592062
"1965916759": "تستقر الخيارات الآسيوية من خلال مقارنة العلامة الأخيرة مع النقطة المتوسطة خلال الفترة.",
@@ -3721,6 +3724,8 @@
37213724
"-1269597956": "منصة MT5",
37223725
"-1302404116": "الحد الأقصى للرافعة المالية",
37233726
"-1647612934": "فروق أسعار تبدأ من",
3727+
"-1458325982": "عند إعداد استراتيجية، لديك خيار فرض الرسوم.",
3728+
"-1388554597": "لا يمكن أن يكون الحساب مزودًا لاستراتيجية ويعمل في نفس الوقت كـ 'حساب للرسوم'.",
37243729
"-941636117": "تطبيق ميتاتريدر 5 على لينكس",
37253730
"-1434036215": "حساب مالي (Financial) تجريبي",
37263731
"-1416247163": "STP المالية",

packages/translations/src/translations/bn.json

+5
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,7 @@
15361536
"1453317405": "এই ব্লকটি আপনাকে আপনার অ্যাকাউন্টের ব্যালেন্স একটি সংখ্যা বা পাঠ্যের একটি স্ট্রিং হিসাবে দেয়।",
15371537
"1454406889": "পুনরাবৃত্তি বিকল্প হিসাবে <0>যতক্ষণ না</0> চয়ন করুন।",
15381538
"1454648764": "ডিল রেফারেন্স আইডি",
1539+
"1455632613": "মুক্ত কৌশলগুলোর জন্য ‘ফি একাউন্ট’য়ের প্রয়োজন নেই।",
15391540
"1455741083": "আপনার ড্রাইভিং লাইসেন্সের পিছনে আপলোড করুন।",
15401541
"1457341530": "আপনার পরিচয় যাচাইয়ের প্রমাণ ব্যর্থ হয়েছে",
15411542
"1457603571": "কোনো বিজ্ঞপ্তি নেই",
@@ -1953,6 +1954,7 @@
19531954
"1866811212": "আপনার দেশে অনুমোদিত, স্বাধীন পেমেন্ট এজেন্টের মাধ্যমে আপনার স্থানীয় মুদ্রায় ডিপোজিট করুন।",
19541955
"1867217564": "সূচক একটি ধনাত্মক পূর্ণসংখ্যা হতে হবে",
19551956
"1867783237": "উচ্চ-থেকে-বন্ধ",
1957+
"1869568572": "একটি কৌশল প্রদানকারী হিসেবে নির্ধারিত অ্যাকাউন্টটি অপরিবর্তনীয়, যতক্ষণ না এটি 30 দিন নিস্ক্রিয় থাকে।",
19561958
"1869787212": "Even",
19571959
"1870933427": "ক্রিপ্টো",
19581960
"1871196637": "সত্য, যদি শেষ ট্রেডের ফলাফল নির্বাচনের সাথে মেলে",
@@ -2054,6 +2056,7 @@
20542056
"1959678342": "Highs & Lows",
20552057
"1960005187": "আপনার কৌশলগুলি সাবলীলভাবে স্থানান্তর করতে এই পদক্ষেপগুলি অনুসরণ করুন",
20562058
"1960240336": "প্রথম অক্ষর",
2059+
"1960645545": "যেসব কৌশলে আপনি ফি আরোপ করেন, সেক্ষেত্রে আপনাকে আপনার বিদ্যমান অ্যাকাউন্টগুলোর মধ্যে একটি এই ফিগুলোর প্রক্রিয়া করার জন্য বরাদ্দ করতে হবে। একই ‘ফি একাউন্ট’ একাধিক ফি ভিত্তিক কৌশল সমর্থন করতে পারে।",
20572060
"1964165648": "সংযোগ হারিয়ে গেছে",
20582061
"1965358881": "ধাপ 3 এর 2 : আপনার মোবাইল নাম্বার নিশ্চিত করুন",
20592062
"1965916759": "এশিয়ান বিকল্পগুলি সময়ের মধ্যে গড় স্পটের সাথে শেষ টিক তুলনা করে বসতি স্থাপন করে।",
@@ -3721,6 +3724,8 @@
37213724
"-1269597956": "MT5 প্ল্যাটফর্ম",
37223725
"-1302404116": "সর্বাধিক লিভারেজ",
37233726
"-1647612934": "থেকে স্প্রেড",
3727+
"-1458325982": "একটি কৌশল সেট আপ করার সময়, আপনার কাছে ফি আরোপ করার অপশন রয়েছে।",
3728+
"-1388554597": "একটি অ্যাকাউন্ট একই সময়ে কৌশল প্রদানকারী এবং ‘ফি একাউন্ট’ হিসেবে কাজ করতে পারে না।",
37243729
"-941636117": "MetaTrader 5 লিনাক্স অ্যাপ",
37253730
"-1434036215": "আর্থিক ডেমো",
37263731
"-1416247163": "আর্থিক STP",

packages/translations/src/translations/de.json

+5
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,7 @@
15361536
"1453317405": "In diesem Block erhalten Sie den Saldo Ihres Kontos entweder als Zahl oder als Textfolge.",
15371537
"1454406889": "Wählen Sie „<0>Bis</0>“ als Wiederholungsoption.",
15381538
"1454648764": "Referenz-ID des Deals",
1539+
"1455632613": "Kostenlose Strategien erfordern kein ‚Account For Fees‘.",
15391540
"1455741083": "Laden Sie die Rückseite Ihres Führerscheins hoch.",
15401541
"1457341530": "Ihr Identitätsnachweis ist fehlgeschlagen",
15411542
"1457603571": "Keine Benachrichtigungen",
@@ -1953,6 +1954,7 @@
19531954
"1866811212": "Zahlen Sie in Ihrer Landeswährung über eine autorisierte, unabhängige Zahlungsstelle in Ihrem Land ein.",
19541955
"1867217564": "Der Index muss eine positive Ganzzahl sein",
19551956
"1867783237": "High-to-Close",
1957+
"1869568572": "Ein Konto, das als Strategieanbieter bestimmt ist, ist irreversibel, es sei denn, es bleibt 30 Tage inaktiv.",
19561958
"1869787212": "Even",
19571959
"1870933427": "Krypto",
19581960
"1871196637": "Wahr, wenn das Ergebnis des letzten Handels mit der Auswahl übereinstimmt",
@@ -2054,6 +2056,7 @@
20542056
"1959678342": "Highs & Lows",
20552057
"1960005187": "Befolgen Sie diese Schritte, um Ihre Strategien reibungslos zu übertragen",
20562058
"1960240336": "erster Buchstabe",
2059+
"1960645545": "Für Strategien, bei denen Sie Gebühren erheben, müssen Sie eines Ihrer bestehenden Konten zuweisen, um diese Gebühren zu verarbeiten. Das gleiche ‚Account For Fees‘ kann mehrere gebührenbasierte Strategien unterstützen.",
20572060
"1964165648": "Verbindung wurde unterbrochen",
20582061
"1965358881": "Schritt 2 von 3: Bestätigen Sie Ihre Telefonnummer",
20592062
"1965916759": "Asian Optionen rechnen, indem das letzte Tick mit dem Durchschnittswert in diesem Zeitraum verglichen wird.",
@@ -3721,6 +3724,8 @@
37213724
"-1269597956": "MT5-Plattform",
37223725
"-1302404116": "Maximale Hebelwirkung",
37233726
"-1647612934": "Breitet sich aus",
3727+
"-1458325982": "Beim Einrichten einer Strategie haben Sie die Möglichkeit, Gebühren zu erheben.",
3728+
"-1388554597": "Ein Konto kann nicht gleichzeitig Strategieanbieter und ‚Account For Fees‘ sein.",
37243729
"-941636117": "MetaTrader 5 Linux-App",
37253730
"-1434036215": "Demo Finanzwesen",
37263731
"-1416247163": "Finanzielles STP",

0 commit comments

Comments
 (0)