diff --git a/_data/v3.yml b/_data/v3.yml deleted file mode 100644 index 99e61345d..000000000 --- a/_data/v3.yml +++ /dev/null @@ -1,257 +0,0 @@ -groups: - - label: All Calls - methods: - - name: account_list - title: Account List - - name: active_symbols - title: Active Symbols - - name: api_token - title: API Token - - name: app_delete - title: 'Application: Delete' - - name: app_get - title: 'Application: Get Details' - - name: app_list - title: 'Application: List' - - name: app_markup_details - title: 'Application: Markup Details' - - name: app_markup_statistics - title: 'Application: Markup Statistics' - - name: app_register - title: 'Application: Register' - - name: app_update - title: 'Application: Update' - - name: asset_index - title: Asset Index - - name: authorize - title: Authorize - - name: balance - title: Balance - - name: buy - title: Buy Contract - - name: buy_contract_for_multiple_accounts - title: Buy Contract for Multiple Accounts - - name: cancel - title: Cancel a Contract - - name: cashier - title: Cashier Information - - name: confirm_email - title: Confirm Email Through Verification Code - - name: contract_update - title: Update Contract - - name: contract_update_history - title: Update Contract History - - name: contracts_for - title: Contracts For Symbol - - name: contracts_for_company - title: Contracts For Company - - name: copy_start - title: 'Copy Trading: Start' - - name: copy_stop - title: 'Copy Trading: Stop' - - name: copytrading_list - title: 'Copy Trading: List' - - name: copytrading_statistics - title: 'Copy Trading: Statistics' - - name: crypto_config - title: Cryptocurrency configurations - - name: crypto_estimations - title: Cryptocurrency Estimations - - name: document_upload - title: Document Upload - - name: economic_calendar - title: Economic Calendar - - name: exchange_rates - title: Exchange Rates - - name: forget - title: Forget - - name: forget_all - title: Forget All - - name: get_account_status - title: Account Status - - name: get_financial_assessment - title: Get Financial Assessment - - name: get_limits - title: Account Limits - - name: get_self_exclusion - title: Get Self-Exclusion - - name: get_settings - title: Get Account Settings - - name: identity_verification_document_add - title: Identity Verification Add Document - - name: kyc_auth_status - title: KYC Authentication Status - - name: landing_company - title: Landing Company - - name: landing_company_details - title: Landing Company Details - - name: login_history - title: Login History - - name: logout - title: Log Out - - name: mt5_deposit - title: 'MT5: Deposit' - - name: mt5_get_settings - title: 'MT5: Get Setting' - - name: mt5_login_list - title: 'MT5: Accounts List' - - name: mt5_new_account - title: 'MT5: New Account' - - name: mt5_password_change - title: 'MT5: Password Change' - - name: mt5_password_check - title: 'MT5: Password Check' - - name: mt5_password_reset - title: 'MT5: Password Reset' - - name: mt5_withdrawal - title: 'MT5: Withdrawal' - - name: new_account_maltainvest - title: 'New Real-Money Account: Deriv Investment (Europe) Ltd' - - name: new_account_real - title: 'New Real-Money Account: Default Landing Company' - - name: new_account_virtual - title: New Virtual-Money Account - - name: new_partner_account - title: 'New Real-Partner Account: Default Landing Company' - - name: oauth_apps - title: OAuth Applications - - name: p2p_advert_create - title: P2P Advert Create - - name: p2p_advert_info - title: P2P Advert Information - - name: p2p_advert_list - title: P2P Advert List - - name: p2p_advert_update - title: P2P Advert Update - - name: p2p_advertiser_adverts - title: P2P Advertiser Adverts - - name: p2p_advertiser_create - title: P2P Advertiser Create - - name: p2p_advertiser_info - title: P2P Advertiser Information - - name: p2p_advertiser_list - title: P2P Advertiser List - - name: p2p_advertiser_payment_methods - title: P2P Advertiser Payment Methods - - name: p2p_advertiser_relations - title: P2P Advertiser Relations - - name: p2p_advertiser_update - title: P2P Advertiser Update - - name: p2p_chat_create - title: P2P Chat Create - - name: p2p_country_list - title: P2P Country List - - name: p2p_order_cancel - title: P2P Order Cancel - - name: p2p_order_confirm - title: P2P Order Confirm - - name: p2p_order_create - title: P2P Order Create - - name: p2p_order_dispute - title: P2P Order Dispute - - name: p2p_order_info - title: P2P Order Information - - name: p2p_order_list - title: P2P Order List - - name: p2p_order_review - title: P2P Order Review - - name: p2p_payment_methods - title: P2P Payment Methods - - name: p2p_ping - title: P2P Ping - - name: p2p_settings - title: P2P Settings - - name: partner_accounts - title: Get Partner Account Details - - name: partner_settings - title: Get Partner-Specific Account Settings - - name: partner_settings_update - title: Set Partner Account Settings - - name: payment_methods - title: Payment Methods - - name: paymentagent_create - title: Payment agent create - - name: paymentagent_details - title: Payment agent details - - name: paymentagent_list - title: 'Payment Agent: List' - - name: paymentagent_transfer - title: 'Payment Agent: Transfer' - - name: paymentagent_withdraw - title: 'Payment Agent: Withdraw' - - name: paymentagent_withdraw_justification - title: 'Payment Agent: Withdraw justification' - - name: payout_currencies - title: Payout Currencies - - name: ping - title: Ping - - name: portfolio - title: Portfolio - - name: profit_table - title: Profit Table - - name: proposal - title: Price Proposal - - name: proposal_open_contract - title: 'Price Proposal: Open Contracts' - - name: reality_check - title: Reality Check - - name: residence_list - title: Countries List - - name: revoke_oauth_app - title: Revoke Oauth Application - - name: sell - title: Sell Contract - - name: sell_contract_for_multiple_accounts - title: 'Sell Contracts: Multiple Accounts' - - name: sell_expired - title: Sell Expired Contracts - - name: set_account_currency - title: Set Account Currency - - name: set_financial_assessment - title: Set Financial Assessment - - name: set_self_exclusion - title: Set Self-Exclusion - - name: set_settings - title: Set Account Settings - - name: statement - title: Statement - - name: states_list - title: States List - - name: ticks - title: Ticks Stream - - name: ticks_batch - title: Ticks Batch Stream - - name: ticks_history - title: Ticks History - - name: time - title: Server Time - - name: tin_validations - title: Tax Identification Number Validations - - name: tnc_approval - title: Terms and Conditions Approval - - name: topup_virtual - title: Top Up Virtual-Money Account - - name: trading_durations - title: Trading Durations - - name: trading_platform_investor_password_reset - title: 'Trading Platform: Investor Password Reset' - - name: trading_platform_password_reset - title: 'Trading Platform: Password Reset' - - name: trading_platform_status - title: Trading Platform Status - - name: trading_servers - title: Server list - - name: trading_times - title: Trading Times - - name: transaction - title: Transactions Stream - - name: transfer_between_accounts - title: Transfer Between Accounts - - name: unsubscribe_email - title: Unsubscribe Email - - name: verify_email - title: Verify Email - - name: website_config - title: Server Config - - name: website_status - title: Server Status diff --git a/config/v3/buy/send.json b/config/v3/buy/send.json index c0fc94ef9..9a0456fb0 100644 --- a/config/v3/buy/send.json +++ b/config/v3/buy/send.json @@ -73,44 +73,46 @@ "description": "A valid contract-type", "type": "string", "enum": [ - "MULTUP", - "MULTDOWN", - "UPORDOWN", - "EXPIRYRANGE", - "ONETOUCH", - "CALLE", - "LBHIGHLOW", + "ACCU", "ASIAND", - "EXPIRYRANGEE", + "ASIANU", + "CALL", + "CALLE", + "CALLSPREAD", "DIGITDIFF", + "DIGITEVEN", "DIGITMATCH", + "DIGITODD", "DIGITOVER", - "PUTE", "DIGITUNDER", - "NOTOUCH", - "CALL", - "RANGE", + "EXPIRYMISS", + "EXPIRYMISSE", + "EXPIRYRANGE", + "EXPIRYRANGEE", + "LBFLOATCALL", "LBFLOATPUT", - "DIGITODD", + "LBHIGHLOW", + "MULTDOWN", + "MULTUP", + "NOTOUCH", + "ONETOUCH", "PUT", - "ASIANU", - "LBFLOATCALL", - "EXPIRYMISSE", - "EXPIRYMISS", - "DIGITEVEN", - "TICKHIGH", - "TICKLOW", + "PUTE", + "PUTSPREAD", + "RANGE", "RESETCALL", "RESETPUT", - "CALLSPREAD", - "PUTSPREAD", "RUNHIGH", "RUNLOW", - "ACCU", - "VANILLALONGCALL", - "VANILLALONGPUT", + "SNOWDOWN", + "SNOWUP", + "TICKHIGH", + "TICKLOW", "TURBOSLONG", - "TURBOSSHORT" + "TURBOSSHORT", + "UPORDOWN", + "VANILLALONGCALL", + "VANILLALONGPUT" ] }, "currency": { @@ -192,6 +194,15 @@ "type": "string", "pattern": "^\\w{2,30}$" }, + "trade_risk_profile": { + "description": "[For Snowball only] The trade risk profile for Snowball trade types.", + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, "trading_period_start": { "description": "[Optional] An epoch value of a predefined trading period start time", "type": "integer", diff --git a/config/v3/contracts_for/receive.json b/config/v3/contracts_for/receive.json index c3fbd7ddf..509ed18f8 100644 --- a/config/v3/contracts_for/receive.json +++ b/config/v3/contracts_for/receive.json @@ -124,6 +124,19 @@ 2 ] }, + "duration_choices": { + "description": "[Only for Snowball] Available contract durations in seconds.", + "type": "array", + "items": { + "type": "integer", + "examples": [ + 300, + 600, + 1200 + ] + }, + "minItems": 1 + }, "exchange_name": { "description": "Name of exchange", "type": "string", @@ -271,6 +284,19 @@ "random_index" ] }, + "trade_risk_profile_choices": { + "description": "[Only for Snowball] Available risk profile options.", + "type": "array", + "items": { + "type": "string", + "examples": [ + "low", + "medium", + "high" + ] + }, + "minItems": 1 + }, "trading_period": { "description": "A hash of predefined trading period", "type": "object" diff --git a/config/v3/get_settings/receive.json b/config/v3/get_settings/receive.json index b32e7f99a..6fbe23c2b 100644 --- a/config/v3/get_settings/receive.json +++ b/config/v3/get_settings/receive.json @@ -49,6 +49,14 @@ 1 ] }, + "calling_country_code": { + "description": "The phone's calling country code.", + "type": [ + "null", + "string" + ], + "sensitive": 1 + }, "citizen": { "description": "Country of legal citizenship, 2-letter country code.", "type": "string" @@ -185,7 +193,7 @@ ] }, "phone": { - "description": "Telephone (note: Only available for users who have at least one real account)", + "description": "The phone's national format phone.", "type": [ "null", "string" diff --git a/config/v3/landing_company/receive.json b/config/v3/landing_company/receive.json index 93099c61a..3158b69cf 100644 --- a/config/v3/landing_company/receive.json +++ b/config/v3/landing_company/receive.json @@ -179,6 +179,18 @@ } } }, + "partner": { + "description": "Sign up requirements for partners", + "type": "array", + "items": { + "type": "string", + "examples": [ + "first_name", + "residence", + "salutation" + ] + } + }, "signup": { "description": "Sign up requirements", "type": "array", @@ -692,6 +704,18 @@ } } }, + "partner": { + "description": "Sign up requirements for partners", + "type": "array", + "items": { + "type": "string", + "examples": [ + "first_name", + "residence", + "salutation" + ] + } + }, "signup": { "description": "Sign up requirements", "type": "array", @@ -863,6 +887,18 @@ } } }, + "partner": { + "description": "Sign up requirements for partners", + "type": "array", + "items": { + "type": "string", + "examples": [ + "first_name", + "residence", + "salutation" + ] + } + }, "signup": { "description": "Sign up requirements", "type": "array", @@ -1106,6 +1142,18 @@ } } }, + "partner": { + "description": "Sign up requirements for partners", + "type": "array", + "items": { + "type": "string", + "examples": [ + "first_name", + "residence", + "salutation" + ] + } + }, "signup": { "description": "Sign up requirements", "type": "array", @@ -1438,6 +1486,10 @@ "$ref": "#/$defs/complianceRequirements", "description": "Compliance requirements" }, + "partner": { + "$ref": "#/$defs/signUpRequirements", + "description": "Sign up requirements" + }, "signup": { "$ref": "#/$defs/signUpRequirements", "description": "Sign up requirements" diff --git a/config/v3/landing_company_details/receive.json b/config/v3/landing_company_details/receive.json index 7feb4bbde..56f04c804 100644 --- a/config/v3/landing_company_details/receive.json +++ b/config/v3/landing_company_details/receive.json @@ -180,6 +180,18 @@ } } }, + "partner": { + "description": "Sign up requirements for partners", + "type": "array", + "items": { + "type": "string", + "examples": [ + "first_name", + "residence", + "salutation" + ] + } + }, "signup": { "description": "Sign up requirements", "type": "array", diff --git a/config/v3/login_history/receive.json b/config/v3/login_history/receive.json index 59845fea7..28bc348b1 100644 --- a/config/v3/login_history/receive.json +++ b/config/v3/login_history/receive.json @@ -18,9 +18,17 @@ "additionalProperties": false, "required": [ "action", + "browser", + "country", + "datetime", + "device", "environment", + "ip", + "language", + "os", "status", - "time" + "time", + "version" ], "properties": { "action": { @@ -31,10 +39,38 @@ "logout" ] }, + "browser": { + "description": "Browser used", + "type": "string" + }, + "country": { + "description": "Country the login originated (IP Based))", + "type": "string" + }, + "datetime": { + "description": "ISO6801 timestame of the activity", + "type": "string" + }, + "device": { + "description": "Client device", + "type": "string" + }, "environment": { "description": "Provides details about browser, device used during login or logout", "type": "string" }, + "ip": { + "description": "IP Address the login was from", + "type": "string" + }, + "language": { + "description": "Browser language", + "type": "string" + }, + "os": { + "description": "Operating system", + "type": "string" + }, "status": { "description": "Status of activity: 1 - success, 0 - failure", "type": "integer", @@ -46,6 +82,10 @@ "time": { "description": "Epoch time of the activity", "type": "integer" + }, + "version": { + "description": "Version of the browser", + "type": "string" } } } diff --git a/config/v3/new_account_maltainvest/example.json b/config/v3/new_account_maltainvest/example.json index 4c2e387f3..47cce2b56 100644 --- a/config/v3/new_account_maltainvest/example.json +++ b/config/v3/new_account_maltainvest/example.json @@ -8,6 +8,7 @@ "address_line_2": "East Melbourne VIC", "address_postcode": "3002", "address_state": "berlin", + "calling_country_code": "61", "cfd_experience": "Less than a year", "cfd_frequency": "1 - 5 transactions in the past 12 months", "cfd_trading_definition": "Speculate on the price movement.", @@ -26,7 +27,7 @@ "net_income": "$25,000 - $50,000", "non_pep_declaration": 1, "occupation": "Managers", - "phone": "+6123456789", + "phone": "23456789", "place_of_birth": "nl", "required_initial_margin": "When opening a Leveraged CFD trade.", "residence": "de", diff --git a/config/v3/new_account_maltainvest/send.json b/config/v3/new_account_maltainvest/send.json index 8c19a0aaf..b8153bc2d 100644 --- a/config/v3/new_account_maltainvest/send.json +++ b/config/v3/new_account_maltainvest/send.json @@ -42,7 +42,9 @@ "enum": [ "Speculative", "Income Earning", - "Hedging" + "Hedging", + "Additional revenue", + "Savings" ] }, "account_turnover": { @@ -86,6 +88,15 @@ "type": "string", "pattern": "^[\\w-]{0,32}$" }, + "calling_country_code": { + "description": "[Optional] The phone's calling country code. Don't include the `+` sign. Up to 4 digits.", + "type": [ + "null", + "string" + ], + "pattern": "^\\d{1,4}$", + "sensitive": 1 + }, "cfd_experience": { "description": "How much experience do you have in CFD trading?", "type": "string", @@ -282,7 +293,7 @@ ] }, "phone": { - "description": "[Optional] Starting with `+` followed by 9-35 digits, hyphens or space.", + "description": "[Optional] The phone's national format, don't include the `+` sign nor the calling country code. Up to 15 digits are allowed.", "type": [ "null", "string" diff --git a/config/v3/new_account_real/example.json b/config/v3/new_account_real/example.json index 729e75e91..a2a72f59b 100644 --- a/config/v3/new_account_real/example.json +++ b/config/v3/new_account_real/example.json @@ -7,12 +7,13 @@ "address_line_2": "East Melbourne VIC", "address_postcode": "3002", "address_state": "Victoria", + "calling_country_code": "61", "date_of_birth": "1980-01-31", "fatca_declaration": 1, "first_name": "Peter", "last_name": "Pan", "non_pep_declaration": 1, - "phone": "+6123456789", + "phone": "23456789", "place_of_birth": "id", "residence": "au", "salutation": "Mr", diff --git a/config/v3/new_account_real/send.json b/config/v3/new_account_real/send.json index 525df6a00..d60fb47e1 100644 --- a/config/v3/new_account_real/send.json +++ b/config/v3/new_account_real/send.json @@ -26,7 +26,9 @@ "Speculative", "Income Earning", "Hedging", - "Peer-to-peer exchange" + "Peer-to-peer exchange", + "Additional revenue", + "Savings" ] }, "account_turnover": { @@ -70,6 +72,15 @@ "type": "string", "pattern": "^[\\w-]{0,32}$" }, + "calling_country_code": { + "description": "[Optional] The phone's calling country code. Don't include the `+` sign. Up to 4 digits.", + "type": [ + "null", + "string" + ], + "pattern": "^\\d{1,4}$", + "sensitive": 1 + }, "citizen": { "description": "[Optional] Country of legal citizenship, 2-letter country code.", "type": [ @@ -135,7 +146,7 @@ "minimum": 0 }, "phone": { - "description": "[Optional] Starting with `+` followed by 9-35 digits, hyphens or space.", + "description": "[Optional] The phone's national format, don't include the `+` sign nor the calling country code. Up to 15 digits are allowed.", "type": [ "null", "string" diff --git a/config/v3/new_account_virtual/receive.json b/config/v3/new_account_virtual/receive.json index 8c04a5aeb..02762dab5 100644 --- a/config/v3/new_account_virtual/receive.json +++ b/config/v3/new_account_virtual/receive.json @@ -41,6 +41,10 @@ "description": "Email of the new virtual-money account", "type": "string" }, + "login_code": { + "description": "[Optional] One-time code for passwordless login, valid for 1 minute", + "type": "string" + }, "oauth_token": { "description": "Oauth token for the client's login session (so that the user may be logged in immediately)", "type": "string" diff --git a/config/v3/new_partner_account/example.json b/config/v3/new_partner_account/example.json index 63496cf58..75675c8fe 100644 --- a/config/v3/new_partner_account/example.json +++ b/config/v3/new_partner_account/example.json @@ -11,7 +11,7 @@ "last_name": "Pan", "partner_type": "individual", "phone": "+10023456789", - "provider": "dynamicworks", + "provider": "myaffiliate", "residence": "au", "salutation": "Mr", "secret_answer": "Jones", diff --git a/config/v3/partner_settings_update/example.json b/config/v3/partner_settings_update/example.json index f1afadeb2..8d4434653 100644 --- a/config/v3/partner_settings_update/example.json +++ b/config/v3/partner_settings_update/example.json @@ -3,5 +3,6 @@ "company_name": "XYZ New Corp", "company_registration_no": "ABC322", "partner_type": "company", + "provider": "dynamicworks", "website": "www.newxyz.com" } diff --git a/config/v3/partner_settings_update/send.json b/config/v3/partner_settings_update/send.json index f8e57d45b..667a613c5 100644 --- a/config/v3/partner_settings_update/send.json +++ b/config/v3/partner_settings_update/send.json @@ -9,7 +9,8 @@ ], "additionalProperties": false, "required": [ - "partner_settings_update" + "partner_settings_update", + "provider" ], "properties": { "partner_settings_update": { @@ -38,6 +39,14 @@ "company" ] }, + "provider": { + "description": "Name of the provider platform.", + "type": "string", + "enum": [ + "myaffiliate", + "dynamicworks" + ] + }, "website": { "description": "Partner's Website URI/Promotional Platform", "type": "string", diff --git a/config/v3/proposal/receive.json b/config/v3/proposal/receive.json index c38afc530..24fe16051 100644 --- a/config/v3/proposal/receive.json +++ b/config/v3/proposal/receive.json @@ -86,6 +86,22 @@ 2.123 ] }, + "caution_price": { + "description": "The caution price for the Snowball contract. Breaching this price will reset the coupons accrued to 0.", + "type": "string", + "pattern": "^[+-]?[0-9]+\\.?[0-9]*$", + "examples": [ + "10001.2" + ] + }, + "coupon_rate": { + "description": "The coupon rate for the Snowball contract at which the stake will grow for each coupon accrued.", + "type": "string", + "pattern": "^[+-]?[0-9]+\\.?[0-9]*$", + "examples": [ + "0.0132" + ] + }, "high_barrier": { "description": "High barrier calculated based on current spot", "type": "string", @@ -134,6 +150,21 @@ "1.00" ] }, + "num_of_coupons": { + "description": "The maximum number of coupons available for the Snowball contract.", + "type": "integer", + "examples": [ + 5 + ] + }, + "profit_price": { + "description": "The profit price for the Snowball contract. Breaching this price will close the contract immediately.", + "type": "string", + "pattern": "^[+-]?[0-9]+\\.?[0-9]*$", + "examples": [ + "10005.2" + ] + }, "tick_size_barrier": { "description": "Tick size barrier for Accumulator contracts", "type": "number", @@ -157,6 +188,15 @@ 50 ] } + }, + "trade_risk_profile": { + "description": "The trade risk profile for the Snowball contract.", + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] } } }, diff --git a/config/v3/proposal/send.json b/config/v3/proposal/send.json index de61459b9..6c0753078 100644 --- a/config/v3/proposal/send.json +++ b/config/v3/proposal/send.json @@ -89,6 +89,8 @@ "TICKLOW", "RESETCALL", "RESETPUT", + "SNOWDOWN", + "SNOWUP", "CALLSPREAD", "PUTSPREAD", "RUNHIGH", @@ -187,6 +189,15 @@ "type": "string", "pattern": "^\\w{2,30}$" }, + "trade_risk_profile": { + "description": "[Only for Snowball] The trade risk profile for the Snowball contract. Higher risk profile offers higher coupon rate at the expense of higher probability of breaching caution price", + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, "trading_period_start": { "description": "[Optional] Required only for multi-barrier trading. Defines the epoch value of the trading period start time.", "type": "integer" diff --git a/config/v3/proposal_open_contract/receive.json b/config/v3/proposal_open_contract/receive.json index 433955ede..e94907b19 100644 --- a/config/v3/proposal_open_contract/receive.json +++ b/config/v3/proposal_open_contract/receive.json @@ -211,6 +211,14 @@ } } }, + "caution_price": { + "description": "The caution price for the Snowball contract. Breaching this price will reset the coupons accrued to 0.", + "type": "string", + "pattern": "^[+-]?[0-9]+\\.?[0-9]*$", + "examples": [ + "10001.2" + ] + }, "commision": { "description": "Commission in payout currency amount.", "type": [ @@ -237,6 +245,21 @@ "PUT" ] }, + "coupon_collection_epochs": { + "description": "The epoch times at which the coupons will be accrued for the Snowball contract.", + "type": "array", + "items": { + "type": "integer" + } + }, + "coupon_rate": { + "description": "The coupon rate for the Snowball contract at which the stake will grow for each coupon accrued.", + "type": "string", + "pattern": "^[+-]?[0-9]+\\.?[0-9]*$", + "examples": [ + "0.0132" + ] + }, "currency": { "description": "The currency code of the contract.", "type": "string", @@ -631,6 +654,13 @@ "description": "[Only for lookback trades] Multiplier applies when calculating the final payoff for each type of lookback. e.g. (Exit spot - Lowest historical price) * multiplier = Payout", "type": "number" }, + "num_of_coupons": { + "description": "The maximum number of coupons available for the Snowball contract.", + "type": "integer", + "examples": [ + 5 + ] + }, "payout": { "description": "Payout value of the contract.", "type": "number", @@ -646,6 +676,14 @@ "description": "Profit in percentage.", "type": "number" }, + "profit_price": { + "description": "The profit price for the Snowball contract. Breaching this price will close the contract immediately.", + "type": "string", + "pattern": "^[+-]?[0-9]+\\.?[0-9]*$", + "examples": [ + "10005.2" + ] + }, "purchase_time": { "description": "Epoch of purchase time, will be same as `date_start` for all contracts except forward starting contracts.", "type": "integer" @@ -775,6 +813,15 @@ } } }, + "trade_risk_profile": { + "description": "The trade risk profile for the Snowball contract.", + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, "transaction_ids": { "title": "Transaction ids for contract", "description": "Every contract has buy and sell transaction ids, i.e. when you purchase a contract we associate it with buy transaction id, and if contract is already sold we associate that with sell transaction id.", diff --git a/config/v3/set_settings/example.json b/config/v3/set_settings/example.json index 322c0c1b7..2ceea06f7 100644 --- a/config/v3/set_settings/example.json +++ b/config/v3/set_settings/example.json @@ -6,9 +6,10 @@ "address_line_2": "Test Address Line 2", "address_postcode": "123456", "allow_copiers": 1, + "calling_country_code": "154", "email_consent": 0, "employment_status": "Employed", - "phone": "+15417543010", + "phone": "17543010", "place_of_birth": "ar", "preferred_language": "EN", "request_professional_status": 1, diff --git a/config/v3/set_settings/send.json b/config/v3/set_settings/send.json index 56d7424db..18556daff 100644 --- a/config/v3/set_settings/send.json +++ b/config/v3/set_settings/send.json @@ -26,7 +26,9 @@ "Speculative", "Income Earning", "Hedging", - "Peer-to-peer exchange" + "Peer-to-peer exchange", + "Additional revenue", + "Savings" ] }, "address_city": { @@ -65,6 +67,15 @@ 1 ] }, + "calling_country_code": { + "description": "[Optional] The phone's calling country code. Don't include the `+` sign. Up to 4 digits.", + "type": [ + "null", + "string" + ], + "pattern": "^\\d{1,4}$", + "sensitive": 1 + }, "citizen": { "description": "[Optional] Country of legal citizenship, 2-letter country code.", "type": [ @@ -140,7 +151,7 @@ ] }, "phone": { - "description": "[Optional] Note: not applicable for virtual account. Starting with `+` followed by 9-35 digits, hyphens or space.", + "description": "[Optional] The phone's national format, don't include the `+` sign nor the calling country code. Up to 15 digits are allowed.", "type": [ "null", "string" diff --git a/config/v3/transfer_between_accounts/receive.json b/config/v3/transfer_between_accounts/receive.json index dc29cfeed..b6463272e 100644 --- a/config/v3/transfer_between_accounts/receive.json +++ b/config/v3/transfer_between_accounts/receive.json @@ -46,7 +46,8 @@ "paymentagent", "paymentagent_client", "standard", - "virtual" + "virtual", + "partner" ] }, "balance": { diff --git a/i18n/en/code.json b/i18n/en/code.json index 1787c4a1a..f57ee69d9 100644 --- a/i18n/en/code.json +++ b/i18n/en/code.json @@ -1115,5 +1115,14 @@ }, "Clear response": { "message": "Clear response" + }, + "The server is currently unable to handle the request due to a temporary overload or maintenance of the server. Please try again later.": { + "message": "The server is currently unable to handle the request due to a temporary overload or maintenance of the server. Please try again later." + }, + "and General Business Partners": { + "message": "and General Business Partners" + }, + "Copied": { + "message": "Copied" } } diff --git a/i18n/fr/code.json b/i18n/fr/code.json index 4675dfbbe..c5fc3bd9f 100644 --- a/i18n/fr/code.json +++ b/i18n/fr/code.json @@ -403,10 +403,10 @@ "message": "Vous avez créé le nombre maximum de jetons." }, "By registering your application, you acknowledge that you‘ve read and accepted the Deriv API": { - "message": "En enregistrant votre demande, vous reconnaissez avoir lu et accepté" + "message": "En enregistrant votre demande, vous reconnaissez avoir lu et accepté l'API Deriv" }, "terms and conditions": { - "message": "les conditions générales de l'API de Deriv" + "message": "termes et conditions" }, "Enter your app's name": { "message": "Entrez le nom de votre application" @@ -1115,5 +1115,14 @@ }, "Clear response": { "message": "Effacer la réponse" + }, + "The server is currently unable to handle the request due to a temporary overload or maintenance of the server. Please try again later.": { + "message": "Le serveur est actuellement incapable de traiter la requête en raison d'une surcharge temporaire ou d'une maintenance du serveur. Veuillez réessayer plus tard." + }, + "and General Business Partners": { + "message": "et partenaires commerciaux généraux" + }, + "Copied": { + "message": "Copié" } } diff --git a/jest.setup.ts b/jest.setup.ts index af522b631..40b982f35 100644 --- a/jest.setup.ts +++ b/jest.setup.ts @@ -43,3 +43,37 @@ console.warn = (...args) => { originalConsoleWarn(...args); } }; + +const mockYamlContent = ` +groups: + - label: All Calls + methods: + - name: account_list + title: Account List + - name: active_symbols + title: Active Symbols + - name: app_get + title: Application: Get Details +`; + +jest.mock('yaml', () => ({ + parse: jest.fn(() => ({ + groups: [ + { + label: 'All Calls', + methods: [ + { name: 'account_list', title: 'Account List' }, + { name: 'active_symbols', title: 'Active Symbols' }, + { name: 'app_get', title: 'Application: Get Details' }, + ], + }, + ], + })), +})); + +global.fetch = jest.fn(() => + Promise.resolve({ + text: () => Promise.resolve(mockYamlContent), + }), +) as jest.Mock; + diff --git a/package-lock.json b/package-lock.json index a8d18c22e..cca7c7244 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,7 @@ "ts-jest": "^29.0.3", "typescript": "^5.4.5", "usehooks-ts": "^2.9.1", + "yaml": "^2.6.1", "yup": "^0.32.11" }, "devDependencies": { @@ -6475,19 +6476,6 @@ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.28.1.tgz", - "integrity": "sha512-fzgeABz7rrAlKYB0y2kSEiURrI0691CSL0+KXwKwhxvj92VULEDQLpBYLHpF49MSiPG4sq5CK3qHMnb9tlCjBw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, "node_modules/@rudderstack/analytics-js": { "version": "3.7.13", "resolved": "https://registry.npmjs.org/@rudderstack/analytics-js/-/analytics-js-3.7.13.tgz", @@ -9653,6 +9641,16 @@ "node": ">=10" } }, + "node_modules/babel-plugin-macros/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "license": "ISC", + "peer": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.4.11", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.11.tgz", @@ -14288,6 +14286,15 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "node_modules/fork-ts-checker-webpack-plugin/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -33413,11 +33420,15 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.0.tgz", + "integrity": "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==", + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, "engines": { - "node": ">= 6" + "node": ">= 14" } }, "node_modules/yargs": { diff --git a/package.json b/package.json index 893ca190b..e1baadd53 100644 --- a/package.json +++ b/package.json @@ -26,12 +26,10 @@ "format": "prettier --write 'src/**/*.{js,jsx,ts,tsx,md,json}' --config ./.prettierrc" }, "dependencies": { - "@deriv-com/quill-ui": "^1.16.21", "@deriv-com/analytics": "^1.22.1", "@deriv-com/auth-client": "^1.3.4", + "@deriv-com/quill-ui": "^1.16.21", "@deriv/deriv-api": "^1.0.11", - "@radix-ui/react-tooltip": "^1.0.7", - "@react-spring/web": "^9.7.3", "@deriv/ui": "^0.8.0", "@docusaurus/core": "^3.3.2", "@docusaurus/plugin-client-redirects": "^3.3.2", @@ -43,6 +41,8 @@ "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-dropdown-menu": "^2.0.2", "@radix-ui/react-tabs": "^1.0.2", + "@radix-ui/react-tooltip": "^1.0.7", + "@react-spring/web": "^9.7.3", "@textea/json-viewer": "^3.4.1", "@use-gesture/react": "^10.3.0", "babel-plugin-jsx-remove-data-test-id": "^3.0.0", @@ -63,6 +63,7 @@ "ts-jest": "^29.0.3", "typescript": "^5.4.5", "usehooks-ts": "^2.9.1", + "yaml": "^2.6.1", "yup": "^0.32.11" }, "devDependencies": { diff --git a/src/components/CustomTooltip/custom-tooltip.scss b/src/components/CustomTooltip/custom-tooltip.scss index 7bdfb58ad..21e13a7ad 100644 --- a/src/components/CustomTooltip/custom-tooltip.scss +++ b/src/components/CustomTooltip/custom-tooltip.scss @@ -1,6 +1,6 @@ .tooltip_content { border-radius: 4px; - padding: 8px 4px; + padding: 12px; font-size: 12px; line-height: 14px; color: var(--ifm-color-emphasis-100); @@ -10,10 +10,14 @@ animation-duration: 400ms; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); will-change: transform, opacity; - max-width: 96px; + max-width: 200px; text-align: center; } .tooltip_arrow { fill: var(--ifm-color-emphasis-700); } + +div[data-radix-popper-content-wrapper] { + z-index: 9999 !important; +} \ No newline at end of file diff --git a/src/components/UserNavbarItem/__tests__/item.desktop.test.tsx b/src/components/UserNavbarItem/__tests__/item.desktop.test.tsx index 10dd5b275..c5a241c2a 100644 --- a/src/components/UserNavbarItem/__tests__/item.desktop.test.tsx +++ b/src/components/UserNavbarItem/__tests__/item.desktop.test.tsx @@ -10,6 +10,7 @@ const mockUseAuthContext = useAuthContext as jest.MockedFunction<() => Partial ({ is_logged_in: true, + siteActive: true, })); describe('User Navbar Desktop Item', () => { diff --git a/src/components/UserNavbarItem/item.desktop.tsx b/src/components/UserNavbarItem/item.desktop.tsx index c0475816d..a5d48ca1d 100644 --- a/src/components/UserNavbarItem/item.desktop.tsx +++ b/src/components/UserNavbarItem/item.desktop.tsx @@ -1,6 +1,6 @@ import React from 'react'; import clsx from 'clsx'; -import Translate from '@docusaurus/Translate'; +import Translate, { translate } from '@docusaurus/Translate'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import { Button } from '@deriv-com/quill-ui'; import { @@ -14,13 +14,21 @@ import { IUserNavbarItemProps } from './item.types'; import styles from './UserNavbarItem.module.scss'; import Cookies from 'js-cookie'; import { useHandleLogin } from '@site/src/hooks/useHandleLogin'; +import useAuthContext from '@site/src/hooks/useAuthContext'; +import CustomTooltip from '../CustomTooltip'; interface IActionProps { handleClick: () => void; isDesktop: boolean; + siteActive: boolean; } -const DashboardActions: React.FC = ({ handleClick, isDesktop }) => { +const siteDownErrMsg = translate({ + message: + 'The server is currently unable to handle the request due to a temporary overload or maintenance of the server. Please try again later.', +}); + +const DashboardActions: React.FC = ({ handleClick, isDesktop, siteActive }) => { const { i18n: { currentLocale }, } = useDocusaurusContext(); @@ -31,72 +39,105 @@ const DashboardActions: React.FC = ({ handleClick, isDesktop }) => location.assign(pathInfo); }; - return ( - - - {isDesktop && ( + const renderDashboardBtn = () => { + return ( + + {isDesktop && ( + + )} + + ); + }; + + return ( + + {siteActive ? ( + renderDashboardBtn() + ) : ( + + {renderDashboardBtn()} + )} ); }; -const SignedInActions: React.FC = ({ handleClick, isDesktop }) => { +const SignedInActions: React.FC = ({ handleClick, isDesktop, siteActive }) => { const signedInButtonClasses = clsx('navbar__item', styles.UserNavbarItem, styles.SignedInButton); const { handleLogin } = useHandleLogin({ onClickLogin: handleClick, }); - return ( - + ); }; const UserNavbarDesktopItem = ({ authUrl, is_logged_in }: IUserNavbarItemProps) => { const { deviceType } = useDeviceType(); const isDesktop = deviceType === 'desktop'; - + const { siteActive } = useAuthContext(); + const handleClick = () => { location.assign(authUrl); }; @@ -130,9 +171,9 @@ const UserNavbarDesktopItem = ({ authUrl, is_logged_in }: IUserNavbarItemProps) }, [isOAuth2Enabled, loggedState, logout, handleLogin, isLoginAccountsPopulated]); return is_logged_in ? ( - + ) : ( - + ); }; diff --git a/src/contexts/auth/auth.context.tsx b/src/contexts/auth/auth.context.tsx index 342eed908..fd0c5d8c6 100644 --- a/src/contexts/auth/auth.context.tsx +++ b/src/contexts/auth/auth.context.tsx @@ -19,6 +19,7 @@ export interface IAuthContext { updateCurrentLoginAccount: (userAccount: IUserLoginAccount, isValidateAccount?: boolean) => void; userAccounts: IUserAccounts; user: IUser; + siteActive: boolean; } export const AuthContext = React.createContext(null); diff --git a/src/contexts/auth/auth.provider.tsx b/src/contexts/auth/auth.provider.tsx index 271ca30a8..6c3ba7486 100644 --- a/src/contexts/auth/auth.provider.tsx +++ b/src/contexts/auth/auth.provider.tsx @@ -10,6 +10,7 @@ import { USER_SESSION_STORAGE_KEY, } from '@site/src/utils/constants'; import { findVirtualAccount, getIsBrowser } from '@site/src/utils'; +import useServerInfo from '@site/src/hooks/useServerInfo'; type TAuthProviderProps = { children: ReactNode; @@ -24,6 +25,7 @@ const AuthProvider = ({ children }: TAuthProviderProps) => { const [is_authorized, setIsAuthorized] = useState(false); const [is_switching_account, setisSwitchingAccount] = useState(false); const [is_connected, setIsConnected] = useState(true); + const { siteActive } = useServerInfo(); const [loginAccounts, setLoginAccounts] = useSessionStorage( LOGIN_ACCOUNTS_SESSION_STORAGE_KEY, @@ -67,7 +69,6 @@ const AuthProvider = ({ children }: TAuthProviderProps) => { const updateLoginAccounts = useCallback( (loginAccounts: IUserLoginAccount[], updateCurrentAccount = true) => { - setLoginAccounts(loginAccounts); if (!updateCurrentAccount) return; @@ -113,6 +114,7 @@ const AuthProvider = ({ children }: TAuthProviderProps) => { updateCurrentLoginAccount, userAccounts, user, + siteActive, }; }, [ currentLoginAccount, @@ -124,6 +126,7 @@ const AuthProvider = ({ children }: TAuthProviderProps) => { updateLoginAccounts, userAccounts, user, + siteActive, ]); return {children}; diff --git a/src/features/Apiexplorer/Dropdown/DropdownList/index.tsx b/src/features/Apiexplorer/Dropdown/DropdownList/index.tsx index 383ab3f9b..de62a39f8 100644 --- a/src/features/Apiexplorer/Dropdown/DropdownList/index.tsx +++ b/src/features/Apiexplorer/Dropdown/DropdownList/index.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { playground_requests } from '@site/src/utils/playground_requests'; import clsx from 'clsx'; import styles from './DropdownList.module.scss'; import Translate from '@docusaurus/Translate'; import { TextField } from '@deriv-com/quill-ui'; +import useEndpoints from '@site/src/hooks/useEndpoints'; type TOption = { name: string; @@ -23,11 +23,12 @@ type TDropdownList = { const filterOptions = (options: Record, query: string) => { query = query.toLowerCase(); + return Object.values(options).filter((option: TOption) => { const title = option.title.toLowerCase(); - const firstKey = Object.keys(option.body)[0]; + const name = option.name.toLowerCase(); - if (title.includes(query) || (firstKey && firstKey.toLowerCase().includes(query))) { + if (title.includes(query) || name.includes(query)) { return true; } return false; @@ -42,7 +43,8 @@ const DropdownList: React.FC = ({ setSearchResults, selected_value, }) => { - const filteredOptions = filterOptions(playground_requests, searchResults); + const { playground_request } = useEndpoints(); + const filteredOptions = filterOptions(playground_request, searchResults); return (
diff --git a/src/features/Apiexplorer/Dropdown/__tests__/Dropdown.test.tsx b/src/features/Apiexplorer/Dropdown/__tests__/Dropdown.test.tsx index 16d14f243..6737f1d47 100644 --- a/src/features/Apiexplorer/Dropdown/__tests__/Dropdown.test.tsx +++ b/src/features/Apiexplorer/Dropdown/__tests__/Dropdown.test.tsx @@ -11,10 +11,6 @@ const mockProps: TDropdown = { selected_value: 'Select API Call - Version 3', }; -jest.mock('@site/src/utils/playground_requests', () => ({ - ...jest.requireActual('@site/src/utils/playground_requests'), -})); - describe('Dropdown', () => { afterEach(() => { cleanup(); diff --git a/src/features/Apiexplorer/RequestJSONBox/__tests__/RequestJsonBox.test.tsx b/src/features/Apiexplorer/RequestJSONBox/__tests__/RequestJsonBox.test.tsx index c11aa6271..80660ff27 100644 --- a/src/features/Apiexplorer/RequestJSONBox/__tests__/RequestJsonBox.test.tsx +++ b/src/features/Apiexplorer/RequestJSONBox/__tests__/RequestJsonBox.test.tsx @@ -19,6 +19,7 @@ const fakeHookObject = { tick: 1, echo_req: { tick: 1 }, }, + disableApiNameOnRequest: jest.fn(), }; jest.mock('@site/src/hooks/useAuthContext'); diff --git a/src/features/Apiexplorer/RequestResponseRenderer/__test__/RequestResponseRenderer.test.tsx b/src/features/Apiexplorer/RequestResponseRenderer/__test__/RequestResponseRenderer.test.tsx index a4e103e67..887291b76 100644 --- a/src/features/Apiexplorer/RequestResponseRenderer/__test__/RequestResponseRenderer.test.tsx +++ b/src/features/Apiexplorer/RequestResponseRenderer/__test__/RequestResponseRenderer.test.tsx @@ -48,6 +48,7 @@ mockUseWS.mockImplementation(() => ({ ping: 'pong', req_id: 1, }, + disableApiNameOnRequest: jest.fn(), })); describe('RequestResponseRenderer', () => { diff --git a/src/features/Apiexplorer/RequestResponseRenderer/index.tsx b/src/features/Apiexplorer/RequestResponseRenderer/index.tsx index 9f0ca1b2a..b40df632c 100644 --- a/src/features/Apiexplorer/RequestResponseRenderer/index.tsx +++ b/src/features/Apiexplorer/RequestResponseRenderer/index.tsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback } from 'react'; +import React, { useState, useCallback, useEffect } from 'react'; import { TSocketEndpointNames, TSocketRequestProps } from '@site/src/configs/websocket/types'; import useWS from '@site/src/hooks/useWs'; import useAuthContext from '@site/src/hooks/useAuthContext'; @@ -24,11 +24,15 @@ function RequestResponseRenderer({ const AUTH_ENABLED = 1; const { is_logged_in } = useAuthContext(); const { disableSendRequest } = useDisableSendRequest(); - const { full_response, is_loading, send, clear, error } = useWS(name); + const { full_response, is_loading, send, clear, error, disableApiNameOnRequest } = useWS(name); const [toggle_modal, setToggleModal] = useState(false); const [response_state, setResponseState] = useState(false); const [is_not_valid, setIsNotValid] = useState(false); + useEffect(() => { + disableApiNameOnRequest(); + }, []); + const parseRequestJSON = () => { let request_data: TSocketRequestProps extends never ? undefined : TSocketRequestProps; @@ -43,11 +47,14 @@ function RequestResponseRenderer({ }; const handleClick = useCallback(() => { - if (auth === AUTH_ENABLED) setToggleModal(true); + if (!is_logged_in && auth == AUTH_ENABLED) { + setToggleModal(true); + return; + } clear(); send(parseRequestJSON()); setResponseState(true); - }, [reqData, send, clear, auth]); + }, [reqData, send, clear, auth, is_logged_in]); const handleClear = () => { clear(); @@ -76,7 +83,7 @@ function RequestResponseRenderer({ />
{!is_not_valid ? ( - !is_logged_in && toggle_modal ? ( + toggle_modal ? ( ) : ( { const empty_highlight = render(); expect(empty_highlight.container.firstChild).toBe(null); }); - - it('should render page of the selected api call name in the description', async () => { - render(); - const api_call_name = screen.getByText(/residence_list/i); - - await userEvent.click(api_call_name); - - expect(api_call_name.closest('a')).toHaveAttribute('href', '#residence_list'); - }); }); diff --git a/src/features/Apiexplorer/Schema/HighlightCode/index.tsx b/src/features/Apiexplorer/Schema/HighlightCode/index.tsx index cb93af282..92278af9d 100644 --- a/src/features/Apiexplorer/Schema/HighlightCode/index.tsx +++ b/src/features/Apiexplorer/Schema/HighlightCode/index.tsx @@ -1,15 +1,17 @@ import React from 'react'; import clsx from 'clsx'; -import { playground_requests } from '@site/src/utils/playground_requests'; import { SchemaDescriptionTypes } from '../RecursiveContent/SchemaDescription'; import styles from './HighlightCode.module.scss'; +import useEndpoints from '@site/src/hooks/useEndpoints'; export const HighlightCode = ({ description }: SchemaDescriptionTypes) => { + const { playground_request } = useEndpoints(); + if (!description) return null; const [first, code, ...rest] = description.split('`'); - const has_api_call = playground_requests.some((el) => el.name === code); + const has_api_call = playground_request.some((el) => el.name === code); return ( diff --git a/src/features/Apiexplorer/Schema/Schema.module.scss b/src/features/Apiexplorer/Schema/Schema.module.scss index 43a3302d4..9e0e8b582 100644 --- a/src/features/Apiexplorer/Schema/Schema.module.scss +++ b/src/features/Apiexplorer/Schema/Schema.module.scss @@ -1,4 +1,5 @@ @use 'src/styles/utility' as *; +@use 'src/styles/mixins' as *; .schemaHeader { padding: rem(2.4); @@ -227,6 +228,10 @@ gap: rem(0.8); width: 100%; + @include mobile-sm { + flex-wrap: wrap; + } + strong { font-size: rem(1.6); } diff --git a/src/features/Apiexplorer/__tests__/ApiExplorer.test.tsx b/src/features/Apiexplorer/__tests__/ApiExplorer.test.tsx index dcbfa85df..eb14c4d00 100644 --- a/src/features/Apiexplorer/__tests__/ApiExplorer.test.tsx +++ b/src/features/Apiexplorer/__tests__/ApiExplorer.test.tsx @@ -1,6 +1,6 @@ import React, { act } from 'react'; import '@testing-library/jest-dom'; -import ApiExplorerFeatures from '..'; +import ApiExplorerFeatures from '../explorer'; import userEvent from '@testing-library/user-event'; import useWS from '@site/src/hooks/useWs'; import useAuthContext from '@site/src/hooks/useAuthContext'; @@ -58,6 +58,7 @@ mockuseWS.mockImplementation(() => ({ tick: 1, echo_req: { tick: 1 }, }, + disableApiNameOnRequest: jest.fn(), })); jest.mock('@site/src/hooks/useDynamicImportJSON'); diff --git a/src/features/Apiexplorer/explorer.tsx b/src/features/Apiexplorer/explorer.tsx new file mode 100644 index 000000000..a3bd23fbd --- /dev/null +++ b/src/features/Apiexplorer/explorer.tsx @@ -0,0 +1,107 @@ +import React from 'react'; +import { Breadcrumbs, Heading } from '@deriv-com/quill-ui'; +import Translate, { translate } from '@docusaurus/Translate'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import useDynamicImportJSON from '@site/src/hooks/useDynamicImportJSON'; +import Footer from '@site/src/components/Footer'; +import { Dropdown } from './Dropdown/Dropdown'; +import SchemaWrapper from './Schema/SchemaWrapper'; +import RequestJSONBox from './RequestJSONBox'; +import styles from './styles.module.scss'; +import AccountSwitcher from '@site/src/components/AccountSwitcher'; +import useAuthContext from '@site/src/hooks/useAuthContext'; + +export default function ApiExplorerFeatures() { + const { + text_data, + selected, + setSelected, + handleSelectChange, + request_info, + response_info, + handleTextAreaInput, + } = useDynamicImportJSON(); + const has_info = Object.keys(request_info).length === 0; + const { + i18n: { currentLocale }, + } = useDocusaurusContext(); + const { is_logged_in } = useAuthContext(); + + const locale_Links = React.useMemo(() => { + const is_en = currentLocale === 'en'; + const get_url = (path: string) => { + const pathInfo = `${!is_en ? `/${currentLocale}` : ''}/${path}`; + return pathInfo; + }; + return { + root: get_url(''), + }; + }, [currentLocale]); + + return ( + <> +
+
+ +
+
+ + API Explorer + +
+
+
+
+
+ + {is_logged_in && } +
+ +
+ {!has_info && ( +
+
+ +
+
+ +
+
+ )} +
+
+
+
+
+