From ed159807ae854c59284a5726340950b96ec268a1 Mon Sep 17 00:00:00 2001 From: nobody Date: Mon, 23 Sep 2024 06:18:52 +0000 Subject: [PATCH 1/7] JSON Schema Update --- config/v3/landing_company/receive.json | 381 ++++--------------------- config/v3/mt5_login_list/receive.json | 38 +++ 2 files changed, 89 insertions(+), 330 deletions(-) diff --git a/config/v3/landing_company/receive.json b/config/v3/landing_company/receive.json index f87a41e19..a7a69dbd1 100644 --- a/config/v3/landing_company/receive.json +++ b/config/v3/landing_company/receive.json @@ -965,338 +965,12 @@ "additionalProperties": false, "properties": { "financial": { - "description": "Contain details for landing company for financial subtype. The Financial account is suitable for a wide range of traders, both new and experienced. It gives you mid-range leverage and variable spreads that give you a great deal of flexibility for whatever position you wish to take in the market.", - "type": [ - "null", - "object" - ], - "additionalProperties": false, - "properties": { - "address": { - "description": "Landing Company address", - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "changeable_fields": { - "description": "Special conditions for changing sensitive fields", - "type": "object" - }, - "country": { - "description": "Landing Company country of incorporation", - "type": "string" - }, - "currency_config": { - "title": "Currency Config Structure", - "description": "The configuration of each currency.", - "type": "object" - }, - "has_reality_check": { - "description": "Flag to indicate whether reality check is applicable for this Landing Company. `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives a summary of the client's trades and account balances on a regular basis throughout his session, and is a regulatory requirement for certain Landing Companies.", - "type": "integer", - "enum": [ - 0, - 1 - ] - }, - "legal_allowed_contract_categories": { - "description": "Allowed contract types for this Landing Company", - "type": "array", - "items": { - "type": "string" - } - }, - "legal_allowed_currencies": { - "description": "Allowed account currencies for this Landing Company", - "type": "array", - "items": { - "type": "string" - } - }, - "legal_allowed_markets": { - "description": "Allowed markets for this Landing Company", - "type": "array", - "items": { - "type": "string" - } - }, - "legal_default_currency": { - "description": "Default account currency", - "type": "string" - }, - "name": { - "description": "Landing Company legal name", - "type": "string" - }, - "requirements": { - "description": "Legal requirements for the Landing Company", - "type": "object", - "additionalProperties": false, - "properties": { - "after_first_deposit": { - "description": "After first deposit requirements", - "type": "object", - "additionalProperties": false, - "properties": { - "financial_assessment": { - "description": "Financial assessment requirements", - "type": "array", - "items": { - "type": "string", - "examples": [ - "financial_information", - "trading_experience" - ] - } - } - } - }, - "compliance": { - "description": "Compliance requirements", - "type": "object", - "additionalProperties": false, - "properties": { - "mt5": { - "description": "Compliance MT5 requirements", - "type": "array", - "items": { - "type": "string", - "examples": [ - "expiration_check", - "fully_authenticated" - ] - } - }, - "tax_information": { - "description": "Compliance tax information requirements", - "type": "array", - "items": { - "type": "string", - "examples": [ - "tax_identification_number", - "tax_residence" - ] - } - } - } - }, - "signup": { - "description": "Sign up requirements", - "type": "array", - "items": { - "type": "string", - "examples": [ - "first_name", - "residence", - "salutation" - ] - } - }, - "withdrawal": { - "description": "Withdrawal requirements", - "type": "array", - "items": { - "type": "string", - "examples": [ - "address_city", - "address_line_1" - ] - } - } - } - }, - "shortcode": { - "description": "Landing Company short code", - "type": "string" - }, - "support_professional_client": { - "description": "Flag that indicates whether the landing company supports professional accounts or not", - "type": "integer", - "enum": [ - 0, - 1 - ] - }, - "tin_not_mandatory": { - "description": "Flag that indicates whether tax identifier number is not mandatory for the current country and landing company.", - "type": "integer", - "enum": [ - 0, - 1 - ] - } - } + "$ref": "#/$defs/landingCompanyDetails", + "description": "Contain details for landing company for financial subtype. The Financial account is suitable for a wide range of traders, both new and experienced. It gives you mid-range leverage and variable spreads that give you a great deal of flexibility for whatever position you wish to take in the market." }, "financial_stp": { - "description": "Contain details for landing company for Financial STP subtype. The Financial STP account provides you with tight spreads, higher ticket size and offers a variety of FX pairs from majors to exotics. It is a straight through processing (STP) account with direct access to FX liquidity from various providers.", - "type": [ - "null", - "object" - ], - "additionalProperties": false, - "properties": { - "address": { - "description": "Landing Company address", - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "changeable_fields": { - "description": "Special conditions for changing sensitive fields", - "type": "object" - }, - "country": { - "description": "Landing Company country of incorporation", - "type": "string" - }, - "currency_config": { - "title": "Currency Config Structure", - "description": "The configuration of each currency.", - "type": "object" - }, - "has_reality_check": { - "description": "Flag to indicate whether reality check is applicable for this Landing Company. `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives a summary of the client's trades and account balances on a regular basis throughout his session, and is a regulatory requirement for certain Landing Companies.", - "type": "integer", - "enum": [ - 0, - 1 - ] - }, - "legal_allowed_contract_categories": { - "description": "Allowed contract types for this Landing Company", - "type": "array", - "items": { - "type": "string" - } - }, - "legal_allowed_currencies": { - "description": "Allowed account currencies for this Landing Company", - "type": "array", - "items": { - "type": "string" - } - }, - "legal_allowed_markets": { - "description": "Allowed markets for this Landing Company", - "type": "array", - "items": { - "type": "string" - } - }, - "legal_default_currency": { - "description": "Default account currency", - "type": "string" - }, - "name": { - "description": "Landing Company legal name", - "type": "string" - }, - "requirements": { - "description": "Legal requirements for the Landing Company", - "type": "object", - "additionalProperties": false, - "properties": { - "after_first_deposit": { - "description": "After first deposit requirements", - "type": "object", - "additionalProperties": false, - "properties": { - "financial_assessment": { - "description": "Financial assessment requirements", - "type": "array", - "items": { - "type": "string", - "examples": [ - "financial_information", - "trading_experience" - ] - } - } - } - }, - "compliance": { - "description": "Compliance requirements", - "type": "object", - "additionalProperties": false, - "properties": { - "mt5": { - "description": "Compliance MT5 requirements", - "type": "array", - "items": { - "type": "string", - "examples": [ - "expiration_check", - "fully_authenticated" - ] - } - }, - "tax_information": { - "description": "Compliance tax information requirements", - "type": "array", - "items": { - "type": "string", - "examples": [ - "tax_identification_number", - "tax_residence" - ] - } - } - } - }, - "signup": { - "description": "Sign up requirements", - "type": "array", - "items": { - "type": "string", - "examples": [ - "first_name", - "residence", - "salutation" - ] - } - }, - "withdrawal": { - "description": "Withdrawal requirements", - "type": "array", - "items": { - "type": "string", - "examples": [ - "address_city", - "address_line_1" - ] - } - } - } - }, - "shortcode": { - "description": "Landing Company short code", - "type": "string" - }, - "support_professional_client": { - "description": "Flag that indicates whether the landing company supports professional accounts or not", - "type": "integer", - "enum": [ - 0, - 1 - ] - }, - "tin_not_mandatory": { - "description": "Flag that indicates whether tax identifier number is not mandatory for the current country and landing company.", - "type": "integer", - "enum": [ - 0, - 1 - ] - } - } + "$ref": "#/$defs/landingCompanyDetails", + "description": "Contain details for landing company for Financial STP subtype. The Financial STP account provides you with tight spreads, higher ticket size and offers a variety of FX pairs from majors to exotics. It is a straight through processing (STP) account with direct access to FX liquidity from various providers." } } }, @@ -1578,6 +1252,49 @@ } } }, + "clientKycStatusRequirements": { + "description": "[Optional] Pertains to client KYC. Returned only if the client fails to meet the requirements, including proof of identity (POI), validity of the tax identification number (TIN), and proof of address (POA).", + "type": "object", + "additionalProperties": false, + "required": [ + "poa_status", + "poi_status", + "valid_tin" + ], + "properties": { + "poa_status": { + "description": "Status of proof of address (POA).", + "type": "string", + "enum": [ + "none", + "pending", + "expired", + "verified", + "rejected" + ] + }, + "poi_status": { + "description": "Status of proof of identity (POI).", + "type": "string", + "enum": [ + "none", + "pending", + "verified", + "suspected", + "rejected", + "expired" + ] + }, + "valid_tin": { + "description": "Indicates whether the tax identification number (TIN) is valid (1) or not (0).", + "type": "integer", + "enum": [ + 1, + 0 + ] + } + } + }, "complianceRequirements": { "description": "Compliance requirements", "type": "object", @@ -1628,6 +1345,10 @@ "description": "Special conditions for changing sensitive fields", "type": "object" }, + "client_kyc_status": { + "$ref": "#/$defs/clientKycStatusRequirements", + "description": "Client kyc statusequirements" + }, "country": { "description": "Landing Company country of incorporation", "type": "string" diff --git a/config/v3/mt5_login_list/receive.json b/config/v3/mt5_login_list/receive.json index 6cbb08a56..948ab523f 100644 --- a/config/v3/mt5_login_list/receive.json +++ b/config/v3/mt5_login_list/receive.json @@ -29,6 +29,44 @@ "description": "Balance of the MT5 account.", "type": "number" }, + "client_kyc_status": { + "description": "[Optional] Pertains to client KYC. Returned only if the client fails to meet the requirements, including proof of identity (POI), validity of the tax identification number (TIN), and proof of address (POA).", + "type": "object", + "additionalProperties": false, + "properties": { + "poa_status": { + "description": "Status of proof of address (POA).", + "type": "string", + "enum": [ + "none", + "pending", + "expired", + "verified", + "rejected" + ] + }, + "poi_status": { + "description": "Status of proof of identity (POI).", + "type": "string", + "enum": [ + "none", + "pending", + "verified", + "suspected", + "rejected", + "expired" + ] + }, + "valid_tin": { + "description": "Indicates whether the tax identification number (TIN) is valid (1) or not (0).", + "type": "integer", + "enum": [ + 1, + 0 + ] + } + } + }, "country": { "description": "Residence of the MT5 account.", "type": "string" From cba501ac930aa2a06c4717fd14992dd1ce71c2d4 Mon Sep 17 00:00:00 2001 From: nobody Date: Mon, 23 Sep 2024 06:40:13 +0000 Subject: [PATCH 2/7] JSON Schema Update --- config/v3/mt5_login_list/receive.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/v3/mt5_login_list/receive.json b/config/v3/mt5_login_list/receive.json index 948ab523f..0296852b3 100644 --- a/config/v3/mt5_login_list/receive.json +++ b/config/v3/mt5_login_list/receive.json @@ -202,6 +202,10 @@ "description": "Group type of the MT5 account, e.g. `demo\\svg_financial`", "type": "string" }, + "is_main_agent": { + "description": "Indicate if the account is a main agent - an IB account", + "type": "boolean" + }, "landing_company": { "description": "Broker name", "type": "string" From d4897eb90449f619c9469c718ee9a145ffe4670c Mon Sep 17 00:00:00 2001 From: adrienne-deriv <103016120+adrienne-deriv@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:01:30 +0800 Subject: [PATCH 3/7] chore: removed type narrowing for usegrowthbookgetfeaturevalue --- .../useGrowthbookGetFeatureValue/index.tsx | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/src/hooks/useGrowthbookGetFeatureValue/index.tsx b/src/hooks/useGrowthbookGetFeatureValue/index.tsx index bd03b28fb..529e76757 100644 --- a/src/hooks/useGrowthbookGetFeatureValue/index.tsx +++ b/src/hooks/useGrowthbookGetFeatureValue/index.tsx @@ -1,39 +1,41 @@ import { useEffect, useState } from 'react'; import { Analytics } from '@deriv-com/analytics'; -import useIsGrowthbookIsLoaded from '../useIsGrowthbookLoaded'; +import useIsGrowthbookIsLoaded from './useIsGrowthbookLoaded'; -interface UseGrowthbookGetFeatureValueArgs { - defaultValue?: T; - featureFlag: string; +type featureValueTypes = Record | boolean | string | []; + +interface UseGrowthbookGetFeatureValueArgs { + defaultValue?: featureValueTypes; + featureFlag: string; } -const useGrowthbookGetFeatureValue = ({ - defaultValue, - featureFlag, -}: UseGrowthbookGetFeatureValueArgs) => { - const resolvedDefaultValue: T = defaultValue !== undefined ? defaultValue : (false as T); - const [featureFlagValue, setFeatureFlagValue] = useState( - Analytics?.getFeatureValue(featureFlag, resolvedDefaultValue) ?? resolvedDefaultValue, - ); - const isGBLoaded = useIsGrowthbookIsLoaded(); +const useGrowthbookGetFeatureValue = ({ + defaultValue, + featureFlag, +}: UseGrowthbookGetFeatureValueArgs): [T, boolean] => { + const resolvedDefaultValue: featureValueTypes = defaultValue !== undefined ? defaultValue : false; + const [featureFlagValue, setFeatureFlagValue] = useState( + (Analytics?.getFeatureValue(featureFlag, resolvedDefaultValue) ?? resolvedDefaultValue) as T + ); + const isGBLoaded = useIsGrowthbookIsLoaded(); - useEffect(() => { - if (isGBLoaded) { - if (Analytics?.getInstances()?.ab) { - const setFeatureValue = () => { - const value = Analytics?.getFeatureValue(featureFlag, resolvedDefaultValue); - setFeatureFlagValue(value); - }; - setFeatureValue(); - Analytics?.getInstances()?.ab?.GrowthBook?.setRenderer(() => { - // this will be called whenever the feature flag value changes and acts as a event listener - setFeatureValue(); - }); - } - } - }, [isGBLoaded, resolvedDefaultValue, featureFlag]); + useEffect(() => { + if (isGBLoaded) { + if (Analytics?.getInstances()?.ab) { + const setFeatureValue = () => { + const value = Analytics?.getFeatureValue(featureFlag, resolvedDefaultValue) as T; + setFeatureFlagValue(value); + }; + setFeatureValue(); + Analytics?.getInstances()?.ab?.GrowthBook?.setRenderer(() => { + // this will be called whenever the feature flag value changes and acts as a event listener + setFeatureValue(); + }); + } + } + }, [isGBLoaded, resolvedDefaultValue, featureFlag]); - return [featureFlagValue, isGBLoaded]; + return [featureFlagValue as T, isGBLoaded]; }; export default useGrowthbookGetFeatureValue; From 6c552a13eb6609c9a9242f78bffc08ee0c876561 Mon Sep 17 00:00:00 2001 From: Nuzhy-Deriv Date: Tue, 24 Sep 2024 17:00:11 +0800 Subject: [PATCH 4/7] fix: update telegram link --- src/components/Footer/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index 76763e254..2e13e27fe 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -193,7 +193,7 @@ const Footer = () => { variant='outlined' className={styles.PaddedButton} onClick={() => { - window.open('https://t.me/derivdotcomofficial', '_blank'); + window.open('https://t.me/+g6FV5tFY1u9lZGE1', '_blank'); }} > From eee29b5e6286314149ee830e63330f99a57c4e8f Mon Sep 17 00:00:00 2001 From: Nuzhy-Deriv Date: Wed, 25 Sep 2024 11:31:32 +0800 Subject: [PATCH 5/7] fix: update telegram link in test --- src/components/Footer/__tests__/Footer.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Footer/__tests__/Footer.test.tsx b/src/components/Footer/__tests__/Footer.test.tsx index e45285386..9c7aba159 100644 --- a/src/components/Footer/__tests__/Footer.test.tsx +++ b/src/components/Footer/__tests__/Footer.test.tsx @@ -21,13 +21,14 @@ describe('Footer Component', () => { render(