-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CFDS][WALL] shontzu/CFDS-3913/API-updates-for-maintenance-and-unavai…
…lable-flag-for-TH-Cashier-Wallets (#16064) * feat: created server maintenance modal and account unavailable modal * feat: added server_maintenance and unavailable to status badge config * refactor: make server-maintenance-modal generic * chore: rename status from server_maintenance to under_maintenance following BE * refactor: separate mt5_login_list status from trading_platform_status * feat: incorporated response from trading_platform_status * Apply suggestions from code review chore: code review batch 1 Co-authored-by: Farrah Mae Ochoa <[email protected]> * refactor: replace WS call with /hooks useTradingPlatformStatus * feat: status badge and hint message in prod cashier * refactor: unavailable status badge and hint message refac * feat: server-maintenance and account-unavailable modals in wallets * chore: useTradingPlatformStatus hook in api-v2 for wallets * feat: status badge in MT5AccountsList * refactor: moved status badge to correct place * chore: TradingPlatformStatus type * feat: hint message in wallets account-transfer * fix: status badge text * fix: accidentally removed smtg * fix: api-types * fix: remove usePhoneNumberVerificationSetTimer * style: bold serverMaintenance time * Apply suggestions from code review Co-authored-by: Aizad Ridzo <[email protected]> * chore: duplicated type in TSocketEndpoints and TPrivateSocketEndpoints * chore: apply code review suggestions * refactor: type in TPrivateSocketEndpoints instead of TSocketEndpoints * refactor: replace switch case with object keys * refactor: tradingPlatformStatusData type and hook docs * style: css improvements * chore: Missed the typing here * refactor: remove hardcoding pt1 * chore: delete dead directory * style: status badge icon height issue * style: using WalletText component for status badge text * chore: useTradingPlatformStatus.spec.tsx * chore: empty commit * fix: indentation in api types * fix: mockUseQuery * refactor: move handling logic to hook * fix: fallback val * fix: tests * chore: capitalisation * chore: disabling transfer button check * chore: why is this not being committed * fix: failing test * chore: fix complains * fix: useTransferMessages.ts should not return undefined * chore: OCDing * refactor: small nit * refactor: type from trading_platform_accounts * chore: update server maintenance modal content * chore: update server maintenance modal content * Apply suggestions from code review Co-authored-by: thisyahlen <[email protected]> * Update packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.tsx Co-authored-by: thisyahlen <[email protected]> * chore: format formatt * refactor: non-cfd platform not falling back to cfd active status * chore: remove unused variable * refactor: consolidated serverMaintenance and accountUnavailable modals * refactor: remove redundant code * refactor: status badge component * chore: translations * chore: empty commit * fix: cashier bundle size * fix: use WS from deriv/shared instead of useQuery from deriv/api * fix: useTradingPlatformStatus proptypes * chore: server maintenance modal content update * fix: mock mockUseMT5SVGEligibleToMigrate * fix: localize text * fix: subtasks (balance field, text alignment, multiple status badges) * fix: wallets multiple status showing multiple badges * fix: test * fix: broken server maintenance badge * chore: wallets code review (translations and components from deriv-com/ui) Co-authored-by: lubega-deriv <[email protected]> Co-authored-by: aizad-deriv <[email protected]> * fix: add under_maintenance check for isMaintenance flag * fix: mobile view in wallets --------- Co-authored-by: Farrah Mae Ochoa <[email protected]> Co-authored-by: Aizad Ridzo <[email protected]> Co-authored-by: thisyahlen <[email protected]> Co-authored-by: lubega-deriv <[email protected]> Co-authored-by: aizad-deriv <[email protected]>
- Loading branch information
1 parent
d237e2e
commit 2bd466f
Showing
55 changed files
with
1,545 additions
and
635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { CFD_PLATFORMS } from '@deriv/shared'; | ||
import useAuthorizedQuery from '../useAuthorizedQuery'; | ||
import useQuery from '../useQuery'; | ||
|
||
type TPlatformStatus = Exclude< | ||
NonNullable<ReturnType<typeof useQuery<'trading_platform_status'>>['data']>['trading_platform_status'][0], | ||
undefined | ||
>; | ||
|
||
/** A custom hook that gets the list of statuses of ctrader dxtrade mt5 platform. */ | ||
const useTradingPlatformStatus = () => { | ||
const { data, ...rest } = useAuthorizedQuery( | ||
'trading_platform_status', | ||
{}, | ||
{ | ||
refetchInterval: 120000, | ||
} | ||
); | ||
|
||
const tradingPlatformStatusData = data?.trading_platform_status; | ||
|
||
/** | ||
* Retrieves the status of a specified trading platform. | ||
* @param platform The platform identifier (e.g., 'ctrader', 'dxtrade', 'mt5'). | ||
* @returns The status of the identified platform ('active', 'maintenance', 'unavailable'). | ||
*/ | ||
const getPlatformStatus = (platform: string) => { | ||
const platformStatus = | ||
platform === CFD_PLATFORMS.MT5 || platform === CFD_PLATFORMS.DXTRADE || platform === CFD_PLATFORMS.CTRADER | ||
? tradingPlatformStatusData?.find((status: TPlatformStatus) => status.platform === platform)?.status | ||
: undefined; // cashier may pass non-cfd platform (i.e. doughflow, p2p, paymentagent, etc) which doesn't have status property | ||
|
||
return platformStatus; | ||
}; | ||
|
||
return { | ||
...rest, | ||
data: tradingPlatformStatusData, | ||
getPlatformStatus, | ||
}; | ||
}; | ||
|
||
export default useTradingPlatformStatus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.