@alphapoint/apex-web 5.5.6 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apex.integration.test.js +435 -0
- package/lib/apex.js +37 -1
- package/lib/apex.test.js +138 -0
- package/lib/components/2FA/PasskeyOption.js +126 -0
- package/lib/components/2FA/TwoFactorAuthComponent.js +24 -5
- package/lib/components/2FA/TwoFactorAuthComponent.test.js +94 -0
- package/lib/components/2FA/TwoFactorAuthContainer.js +139 -27
- package/lib/components/2FA/TwoFactorAuthContainer.test.js +627 -0
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.css +6 -0
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.js +6 -2
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.test.js +43 -0
- package/lib/components/AccountsDropdown/AccountsDropdownContainer.js +3 -1
- package/lib/components/BalancesList/BalancesListContainer.js +4 -1
- package/lib/components/ConfirmBlockTradeModal/ConfirmBlockTradeModalContainer.js +34 -6
- package/lib/components/ConfirmBlockTradeModal/ConfirmBlockTradeModalContainer.test.js +298 -0
- package/lib/components/ConfirmOrderModal/ConfirmOrderModalComponent.js +26 -4
- package/lib/components/ConfirmOrderModal/ConfirmOrderModalContainer.js +4 -1
- package/lib/components/DigitalAssets/digitalAssetsPriceLabel.test.js +238 -0
- package/lib/components/EnableTwoFactorAuth/Disable2FAForm.js +22 -7
- package/lib/components/EnableTwoFactorAuth/Disable2FAModal.js +15 -5
- package/lib/components/EnableTwoFactorAuth/Disable2FAModal.test.js +460 -0
- package/lib/components/EnableTwoFactorAuth/Disable2FAModalContainer.js +108 -16
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +7 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +105 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.js +15 -3
- package/lib/components/FusionAuth/UnlinkOAuthIdentityModal.css +13 -0
- package/lib/components/FusionAuth/UnlinkOAuthIdentityModal.js +246 -0
- package/lib/components/FusionAuth/UnlinkOAuthIdentityModal.test.js +521 -0
- package/lib/components/InstrumentPositions/InstrumentPositionsContainer.js +4 -1
- package/lib/components/Login/LoginFormComponent.js +1 -1
- package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.js +2 -1
- package/lib/components/NoAccountBanner/NoAccountBanner.css +9 -0
- package/lib/components/NoAccountBanner/NoAccountBanner.js +58 -0
- package/lib/components/NoAccountBanner/index.js +16 -0
- package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.css +31 -0
- package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.js +33 -0
- package/lib/components/NoAccountPlaceholder/index.js +9 -0
- package/lib/components/OrderEntryComponents/advancedForm/AdvancedOrderFormContainer.js +2 -0
- package/lib/components/OrderEntryComponents/common/FormAmountFields.js +5 -0
- package/lib/components/OrderEntryComponents/common/TwapScheduleFields.js +98 -0
- package/lib/components/OrderEntryComponents/defaultForm/OrderEntryAnchoring.js +86 -39
- package/lib/components/OrderEntryComponents/defaultForm/OrderEntryAnchoring.test.js +326 -0
- package/lib/components/OrderEntryComponents/defaultForm/OrderEntryContainer.js +10 -2
- package/lib/components/OrderHistoryComponents/DepositsStatus/DepositsStatusComponent.js +1 -1
- package/lib/components/OrderHistoryComponents/DepositsStatus/DepositsStatusComponent.test.js +99 -0
- package/lib/components/OrderHistoryComponents/InactiveOrders/InactiveOrdersComponent.js +1 -1
- package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.js +1 -1
- package/lib/components/OrderHistoryComponents/WithdrawStatus/WithdrawStatusComponent.js +1 -1
- package/lib/components/OrderHistoryComponents/WithdrawStatus/WithdrawStatusComponent.test.js +113 -0
- package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/PasskeysSettingsCard.css +108 -0
- package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/PasskeysSettingsCard.test.js +983 -0
- package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/PasskeysSettingsCardComponent.js +500 -0
- package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/index.js +9 -0
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.css +4 -0
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.js +29 -17
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.test.js +135 -0
- package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +12 -4
- package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +268 -0
- package/lib/components/TwoFactorAuthForm/TwoFactorAuthForm.test.js +475 -0
- package/lib/components/TwoFactorAuthForm/TwoFactorAuthFormComponent.js +26 -5
- package/lib/components/TwoFactorAuthForm/TwoFactorAuthFormContainer.js +50 -32
- package/lib/components/common/APAutoTabInput/APAutoTabInput.js +5 -2
- package/lib/components/common/APSelect/APSelect.js +3 -1
- package/lib/components/common/ErrorBoundary/ErrorBoundary.css +35 -0
- package/lib/components/common/ErrorBoundary/ErrorBoundary.js +87 -0
- package/lib/config/CONFIG.md +4 -0
- package/lib/config/configDefault.json +2 -1
- package/lib/constants/sendOrder/orderEntryFormConstants.js +23 -4
- package/lib/constants/sendOrder/timeInForceConstants.js +3 -1
- package/lib/constants/sendOrder/twapRejectReasons.js +26 -0
- package/lib/helpers/errorTextFormatter.js +13 -4
- package/lib/helpers/errorTextFormatter.test.js +26 -0
- package/lib/helpers/orderHistoryHelper.js +13 -1
- package/lib/helpers/orderHistoryHelper.test.js +58 -13
- package/lib/helpers/passkeyApi.js +228 -0
- package/lib/helpers/passkeyApi.test.js +171 -0
- package/lib/helpers/placeOrderHelper.js +76 -61
- package/lib/helpers/placeOrderHelper.test.js +169 -10
- package/lib/helpers/recalculateOrderHelper.js +4 -1
- package/lib/helpers/recalculateOrderHelper.test.js +88 -2
- package/lib/helpers/twapOrderHelper.js +265 -0
- package/lib/helpers/twapOrderHelper.test.js +467 -0
- package/lib/helpers/twoFactorAuthCancellation.js +38 -0
- package/lib/helpers/webauthnHelper.js +300 -0
- package/lib/helpers/webauthnHelper.test.js +199 -0
- package/lib/hocs/forAccount.js +33 -0
- package/lib/hocs/forAccount.test.js +50 -0
- package/lib/hocs/forVerified.js +16 -2
- package/lib/hocs/withAuthentication.js +3 -1
- package/lib/hocs/withOneSubmission.js +168 -0
- package/lib/index.js +3 -2
- package/lib/layouts/HeaderLayout/HeaderLayout.js +2 -1
- package/lib/layouts/WalletsLayout/WalletsLayoutContainer.js +3 -1
- package/lib/layouts/WalletsLayout/WalletsLayoutContainer.test.js +84 -0
- package/lib/redux/actions/apiActions.js +77 -9
- package/lib/redux/actions/apiActions.test.js +233 -0
- package/lib/redux/actions/authActions.js +514 -198
- package/lib/redux/actions/authActions.test.js +627 -47
- package/lib/redux/actions/depositActions.js +1 -1
- package/lib/redux/actions/depositActions.test.js +100 -30
- package/lib/redux/actions/fusionAuthActions.test.js +265 -84
- package/lib/redux/actions/interestAccountActions.js +12 -3
- package/lib/redux/actions/interestAccountActions.test.js +73 -0
- package/lib/redux/actions/modalActions.js +1 -0
- package/lib/redux/actions/orderEntryActions.blockTrade.test.js +306 -0
- package/lib/redux/actions/orderEntryActions.js +74 -22
- package/lib/redux/actions/orderEntryActions.test.js +63 -11
- package/lib/redux/actions/orderHistoryActions.js +20 -8
- package/lib/redux/actions/orderHistoryActions.test.js +63 -0
- package/lib/redux/actions/userActions.js +379 -179
- package/lib/redux/actions/userActions.test.js +925 -234
- package/lib/redux/actions/withdrawActions.js +62 -29
- package/lib/redux/actions/withdrawActions.test.js +246 -73
- package/lib/redux/actions/withdrawActions.travelRule.test.js +17 -3
- package/lib/redux/margin/actions/marginActions.js +6 -3
- package/lib/redux/margin/actions/marginActions.test.js +166 -0
- package/lib/redux/middlewares/authMiddleware.js +5 -0
- package/lib/redux/middlewares/authMiddleware.test.js +88 -29
- package/lib/redux/reducers/authReducer.js +1 -0
- package/lib/redux/reducers/authReducer.test.js +38 -0
- package/lib/redux/reducers/userReducer.js +10 -0
- package/lib/redux/reducers/userReducer.test.js +29 -0
- package/lib/redux/selectors/orderEntrySelector.js +19 -8
- package/lib/redux/selectors/orderEntrySelector.test.js +209 -0
- package/lib/redux/selectors/orderTotalSelector.test.js +40 -1
- package/lib/redux/selectors/recentActivitySelector.js +8 -2
- package/lib/redux/selectors/recentActivitySelector.v2.test.js +33 -0
- package/lib/redux/selectors/userSelectors.js +6 -1
- package/lib/redux/selectors/userSelectors.test.js +28 -0
- package/lib/services/fms/fms.js +2 -0
- package/lib/services/fms/fms.test.js +35 -0
- package/package.json +4 -4
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _server = require("react-dom/server");
|
|
6
|
+
var _AccountsDropdownComponent = _interopRequireDefault(require("./AccountsDropdownComponent"));
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
4
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
10
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -12,6 +16,22 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
12
16
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
13
17
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
14
18
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20
|
+
jest.mock('react-i18next', function () {
|
|
21
|
+
return {
|
|
22
|
+
withTranslation: function withTranslation() {
|
|
23
|
+
return function (Component) {
|
|
24
|
+
return function (props) {
|
|
25
|
+
return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, props, {
|
|
26
|
+
t: function t(key) {
|
|
27
|
+
return key;
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
});
|
|
15
35
|
describe('AccountsDropdownComponent', function () {
|
|
16
36
|
var sortAccounts = function sortAccounts(accounts) {
|
|
17
37
|
return accounts.sort(function (a, b) {
|
|
@@ -552,4 +572,27 @@ describe('AccountsDropdownComponent', function () {
|
|
|
552
572
|
expect(sortedAccounts).toHaveLength(3);
|
|
553
573
|
});
|
|
554
574
|
});
|
|
575
|
+
});
|
|
576
|
+
describe('AccountsDropdownComponent rendering', function () {
|
|
577
|
+
var render = function render(props) {
|
|
578
|
+
return (0, _server.renderToStaticMarkup)(/*#__PURE__*/_react["default"].createElement(_AccountsDropdownComponent["default"], _extends({
|
|
579
|
+
accounts: [],
|
|
580
|
+
logout: function logout() {},
|
|
581
|
+
customClass: "page-dashboard"
|
|
582
|
+
}, props)));
|
|
583
|
+
};
|
|
584
|
+
it('says there is no account instead of spinning for a user with none', function () {
|
|
585
|
+
var html = render({
|
|
586
|
+
hasNoAccounts: true
|
|
587
|
+
});
|
|
588
|
+
expect(html).toContain('No account');
|
|
589
|
+
expect(html).not.toContain('spinner');
|
|
590
|
+
});
|
|
591
|
+
it('keeps the spinner while the accounts are still loading', function () {
|
|
592
|
+
var html = render({
|
|
593
|
+
hasNoAccounts: false
|
|
594
|
+
});
|
|
595
|
+
expect(html).not.toContain('No account');
|
|
596
|
+
expect(html).toContain('spinner');
|
|
597
|
+
});
|
|
555
598
|
});
|
|
@@ -9,6 +9,7 @@ var _reactRouter = require("react-router");
|
|
|
9
9
|
var _AccountsDropdownComponent = _interopRequireDefault(require("./AccountsDropdownComponent"));
|
|
10
10
|
var _userActions = require("../../redux/actions/userActions");
|
|
11
11
|
var _selectors = require("../../redux/margin/selectors");
|
|
12
|
+
var _userSelectors = require("../../redux/selectors/userSelectors");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
14
|
var mapStateToProps = function mapStateToProps(state) {
|
|
14
15
|
var selectedAccountId = state.user.selectedAccountId;
|
|
@@ -21,7 +22,8 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
21
22
|
}
|
|
22
23
|
return {
|
|
23
24
|
accounts: accounts,
|
|
24
|
-
selectedAccount: selectedAccount
|
|
25
|
+
selectedAccount: selectedAccount,
|
|
26
|
+
hasNoAccounts: (0, _userSelectors.hasNoAccountsSelector)(state)
|
|
25
27
|
};
|
|
26
28
|
};
|
|
27
29
|
var mapDispatchToProps = {
|
|
@@ -7,6 +7,7 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _reactRedux = require("react-redux");
|
|
8
8
|
var _productPositionSelectors = require("../../redux/selectors/productPositionSelectors");
|
|
9
9
|
var _BalancesListComponent = _interopRequireDefault(require("./BalancesListComponent"));
|
|
10
|
+
var _forAccount = _interopRequireDefault(require("../../hocs/forAccount"));
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
12
|
var mapStateToProps = function mapStateToProps(state) {
|
|
12
13
|
return {
|
|
@@ -14,4 +15,6 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
14
15
|
balances: (0, _productPositionSelectors.productPositionAssetsSelector)(state)
|
|
15
16
|
};
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
// Positions are never fetched without an account, so fetching would stay true.
|
|
20
|
+
var _default = exports["default"] = (0, _forAccount["default"])((0, _reactRedux.connect)(mapStateToProps)(_BalancesListComponent["default"]));
|
|
@@ -13,7 +13,9 @@ var _orderEntrySelector = require("../../redux/selectors/orderEntrySelector");
|
|
|
13
13
|
var _snackbarActions = require("../../redux/actions/snackbarActions");
|
|
14
14
|
var _orderFormTypes = require("../../constants/sendOrder/orderFormTypes");
|
|
15
15
|
var _instrumentPositionSelectors = require("../../redux/selectors/instrumentPositionSelectors");
|
|
16
|
+
var _errorTextFormatter = require("../../helpers/errorTextFormatter");
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
17
19
|
var mapStateToProps = function mapStateToProps(state) {
|
|
18
20
|
var form = state.form,
|
|
19
21
|
product = state.apexCore.product;
|
|
@@ -34,6 +36,16 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
34
36
|
orderTotal: orderTotal
|
|
35
37
|
};
|
|
36
38
|
};
|
|
39
|
+
|
|
40
|
+
// t('Your block trade was not reported. Please try again.')
|
|
41
|
+
var GENERIC_FAILURE_TEXT = 'Your block trade was not reported. Please try again.';
|
|
42
|
+
var showBlockTradeFailure = function showBlockTradeFailure(dispatch, text) {
|
|
43
|
+
return dispatch((0, _snackbarActions.showSnack)({
|
|
44
|
+
id: 'confirmBlockTradeFail',
|
|
45
|
+
text: text || GENERIC_FAILURE_TEXT,
|
|
46
|
+
type: 'warning'
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
37
49
|
var mapDispatchToProps = function mapDispatchToProps(dispatch, _ref) {
|
|
38
50
|
var useNewForm = _ref.useNewForm;
|
|
39
51
|
return {
|
|
@@ -41,16 +53,32 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch, _ref) {
|
|
|
41
53
|
return dispatch((0, _orderEntryActions.placeOrder)(_orderFormTypes.orderFormTypes.block, form, {
|
|
42
54
|
useNewForm: useNewForm
|
|
43
55
|
})).then(function (result) {
|
|
56
|
+
// placeOrder already surfaced the failure, so leave the form filled in for a retry.
|
|
57
|
+
if (result === _orderEntryActions.ORDER_SUBMIT_FAILED) return;
|
|
58
|
+
|
|
59
|
+
// SubmitBlockTrade always replies with an object, so anything else means the call
|
|
60
|
+
// settled without a reply and the trade cannot be taken as reported.
|
|
61
|
+
if (!result || _typeof(result) !== 'object') {
|
|
62
|
+
showBlockTradeFailure(dispatch);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
44
65
|
if (result.status === 'Accepted') {
|
|
45
66
|
dispatch((0, _orderEntryActions.clearOrderForm)('reportBlockTrade'));
|
|
46
67
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
|
|
69
|
+
// The gateway rejects a bad request with { result: false, errormsg, errorcode, detail },
|
|
70
|
+
// and an order leg the OMS refuses with { status: 'Rejected', errormsg }.
|
|
71
|
+
if (result.status === 'Rejected' || result.result === false) {
|
|
72
|
+
// Most rejections carry no `detail`, and showSnack drops a snack with empty text, so
|
|
73
|
+
// fall back to the errorcode/errormsg pair, as sendOrder does. Without an errormsg,
|
|
74
|
+
// formatErrorText gives only a bare code or its own generic text, so use ours.
|
|
75
|
+
showBlockTradeFailure(dispatch, result.detail || (result.errormsg ? (0, _errorTextFormatter.formatErrorText)(result) : ''));
|
|
53
76
|
}
|
|
77
|
+
})["catch"](function (e) {
|
|
78
|
+
// Safety net for anything thrown outside the guarded RPC call, so the user is never
|
|
79
|
+
// left without a signal that the block trade went unreported.
|
|
80
|
+
console.error('confirmReport action error', e);
|
|
81
|
+
showBlockTradeFailure(dispatch);
|
|
54
82
|
});
|
|
55
83
|
}
|
|
56
84
|
};
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _reactRedux = require("react-redux");
|
|
4
|
+
var _orderEntryActions = require("../../redux/actions/orderEntryActions");
|
|
5
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
6
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
7
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
8
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
9
|
+
jest.mock('react-redux', function () {
|
|
10
|
+
return {
|
|
11
|
+
connect: jest.fn(function () {
|
|
12
|
+
return function (Component) {
|
|
13
|
+
return Component;
|
|
14
|
+
};
|
|
15
|
+
})
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
jest.mock('./ConfirmBlockTradeModalComponent', function () {
|
|
19
|
+
return 'ConfirmBlockTradeModalComponent';
|
|
20
|
+
});
|
|
21
|
+
jest.mock('../../hocs/modalDecorator', function () {
|
|
22
|
+
return jest.fn(function () {
|
|
23
|
+
return function (Component) {
|
|
24
|
+
return Component;
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
jest.mock('../../redux/actions/modalActions', function () {
|
|
29
|
+
return {
|
|
30
|
+
MODAL_TYPES: {
|
|
31
|
+
CONFIRM_BLOCK_REPORT: 'CONFIRM_BLOCK_REPORT'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
jest.mock('../../redux/actions/orderEntryActions', function () {
|
|
36
|
+
return {
|
|
37
|
+
ORDER_SUBMIT_FAILED: 'ORDER_SUBMIT_FAILED',
|
|
38
|
+
placeOrder: jest.fn(),
|
|
39
|
+
clearOrderForm: jest.fn(function () {
|
|
40
|
+
return {
|
|
41
|
+
type: 'CLEAR_ORDER_FORM'
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
jest.mock('../../redux/actions/snackbarActions', function () {
|
|
47
|
+
return {
|
|
48
|
+
showSnack: jest.fn(function (payload) {
|
|
49
|
+
return {
|
|
50
|
+
type: 'ADD_SNACK',
|
|
51
|
+
payload: payload
|
|
52
|
+
};
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
jest.mock('../../redux/selectors/orderEntrySelector', function () {
|
|
57
|
+
return {
|
|
58
|
+
orderTotalSelector: jest.fn()
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
jest.mock('../../redux/selectors/instrumentPositionSelectors', function () {
|
|
62
|
+
return {
|
|
63
|
+
selectedInstrumentSelector: jest.fn()
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Importing the container registers the connect() call we read mapDispatchToProps back out of.
|
|
68
|
+
require('./ConfirmBlockTradeModalContainer');
|
|
69
|
+
var mapDispatchToProps = _reactRedux.connect.mock.calls[0][1];
|
|
70
|
+
describe('ConfirmBlockTradeModalContainer confirmReport', function () {
|
|
71
|
+
var dispatch;
|
|
72
|
+
var confirmReport;
|
|
73
|
+
beforeEach(function () {
|
|
74
|
+
jest.clearAllMocks();
|
|
75
|
+
jest.spyOn(console, 'error').mockImplementation(function () {});
|
|
76
|
+
dispatch = jest.fn(function (action) {
|
|
77
|
+
return action;
|
|
78
|
+
});
|
|
79
|
+
confirmReport = mapDispatchToProps(dispatch, {
|
|
80
|
+
useNewForm: false
|
|
81
|
+
}).confirmReport;
|
|
82
|
+
});
|
|
83
|
+
afterEach(function () {
|
|
84
|
+
console.error.mockRestore();
|
|
85
|
+
});
|
|
86
|
+
var resolvePlaceOrderWith = function resolvePlaceOrderWith(result) {
|
|
87
|
+
return _orderEntryActions.placeOrder.mockReturnValue(Promise.resolve(result));
|
|
88
|
+
};
|
|
89
|
+
it('clears the form when the block trade is accepted', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
90
|
+
return _regenerator().w(function (_context) {
|
|
91
|
+
while (1) switch (_context.n) {
|
|
92
|
+
case 0:
|
|
93
|
+
resolvePlaceOrderWith({
|
|
94
|
+
status: 'Accepted'
|
|
95
|
+
});
|
|
96
|
+
_context.n = 1;
|
|
97
|
+
return confirmReport({});
|
|
98
|
+
case 1:
|
|
99
|
+
expect(_orderEntryActions.clearOrderForm).toHaveBeenCalledWith('reportBlockTrade');
|
|
100
|
+
case 2:
|
|
101
|
+
return _context.a(2);
|
|
102
|
+
}
|
|
103
|
+
}, _callee);
|
|
104
|
+
})));
|
|
105
|
+
it('shows the rejection detail when the server rejects the block trade', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
106
|
+
return _regenerator().w(function (_context2) {
|
|
107
|
+
while (1) switch (_context2.n) {
|
|
108
|
+
case 0:
|
|
109
|
+
resolvePlaceOrderWith({
|
|
110
|
+
result: false,
|
|
111
|
+
detail: 'Block trade rejected'
|
|
112
|
+
});
|
|
113
|
+
_context2.n = 1;
|
|
114
|
+
return confirmReport({});
|
|
115
|
+
case 1:
|
|
116
|
+
expect(_orderEntryActions.clearOrderForm).not.toHaveBeenCalled();
|
|
117
|
+
expect(dispatch).toHaveBeenCalledWith({
|
|
118
|
+
type: 'ADD_SNACK',
|
|
119
|
+
payload: {
|
|
120
|
+
id: 'confirmBlockTradeFail',
|
|
121
|
+
text: 'Block trade rejected',
|
|
122
|
+
type: 'warning'
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
case 2:
|
|
126
|
+
return _context2.a(2);
|
|
127
|
+
}
|
|
128
|
+
}, _callee2);
|
|
129
|
+
})));
|
|
130
|
+
it('falls back to the errorcode/errormsg pair when a rejection carries no detail', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
131
|
+
return _regenerator().w(function (_context3) {
|
|
132
|
+
while (1) switch (_context3.n) {
|
|
133
|
+
case 0:
|
|
134
|
+
// Most SubmitBlockTrade rejections come back as { result: false, errormsg, errorcode } with
|
|
135
|
+
// no detail, which showSnack would drop as empty text.
|
|
136
|
+
resolvePlaceOrderWith({
|
|
137
|
+
result: false,
|
|
138
|
+
errormsg: 'Quantity was not specified.',
|
|
139
|
+
errorcode: 79,
|
|
140
|
+
detail: null
|
|
141
|
+
});
|
|
142
|
+
_context3.n = 1;
|
|
143
|
+
return confirmReport({});
|
|
144
|
+
case 1:
|
|
145
|
+
expect(_orderEntryActions.clearOrderForm).not.toHaveBeenCalled();
|
|
146
|
+
expect(dispatch).toHaveBeenCalledWith({
|
|
147
|
+
type: 'ADD_SNACK',
|
|
148
|
+
payload: {
|
|
149
|
+
id: 'confirmBlockTradeFail',
|
|
150
|
+
text: '79: Quantity was not specified.',
|
|
151
|
+
type: 'warning'
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
case 2:
|
|
155
|
+
return _context3.a(2);
|
|
156
|
+
}
|
|
157
|
+
}, _callee3);
|
|
158
|
+
})));
|
|
159
|
+
it('shows the errormsg when the OMS rejects an order leg', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
160
|
+
return _regenerator().w(function (_context4) {
|
|
161
|
+
while (1) switch (_context4.n) {
|
|
162
|
+
case 0:
|
|
163
|
+
// A refused order leg comes back as { status: 'Rejected', errormsg } with no `result` field.
|
|
164
|
+
resolvePlaceOrderWith({
|
|
165
|
+
status: 'Rejected',
|
|
166
|
+
errormsg: 'Not_Enough_Funds'
|
|
167
|
+
});
|
|
168
|
+
_context4.n = 1;
|
|
169
|
+
return confirmReport({});
|
|
170
|
+
case 1:
|
|
171
|
+
expect(_orderEntryActions.clearOrderForm).not.toHaveBeenCalled();
|
|
172
|
+
expect(dispatch).toHaveBeenCalledWith({
|
|
173
|
+
type: 'ADD_SNACK',
|
|
174
|
+
payload: {
|
|
175
|
+
id: 'confirmBlockTradeFail',
|
|
176
|
+
text: 'Not_Enough_Funds',
|
|
177
|
+
type: 'warning'
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
case 2:
|
|
181
|
+
return _context4.a(2);
|
|
182
|
+
}
|
|
183
|
+
}, _callee4);
|
|
184
|
+
})));
|
|
185
|
+
it('falls back to a generic message when an OMS rejection carries an empty errormsg', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
186
|
+
return _regenerator().w(function (_context5) {
|
|
187
|
+
while (1) switch (_context5.n) {
|
|
188
|
+
case 0:
|
|
189
|
+
resolvePlaceOrderWith({
|
|
190
|
+
status: 'Rejected',
|
|
191
|
+
errormsg: ''
|
|
192
|
+
});
|
|
193
|
+
_context5.n = 1;
|
|
194
|
+
return confirmReport({});
|
|
195
|
+
case 1:
|
|
196
|
+
expect(_orderEntryActions.clearOrderForm).not.toHaveBeenCalled();
|
|
197
|
+
expect(dispatch).toHaveBeenCalledWith({
|
|
198
|
+
type: 'ADD_SNACK',
|
|
199
|
+
payload: {
|
|
200
|
+
id: 'confirmBlockTradeFail',
|
|
201
|
+
text: 'Your block trade was not reported. Please try again.',
|
|
202
|
+
type: 'warning'
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
case 2:
|
|
206
|
+
return _context5.a(2);
|
|
207
|
+
}
|
|
208
|
+
}, _callee5);
|
|
209
|
+
})));
|
|
210
|
+
it('falls back to a generic message when a rejection carries no detail, errormsg or errorcode', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
211
|
+
return _regenerator().w(function (_context6) {
|
|
212
|
+
while (1) switch (_context6.n) {
|
|
213
|
+
case 0:
|
|
214
|
+
resolvePlaceOrderWith({
|
|
215
|
+
result: false
|
|
216
|
+
});
|
|
217
|
+
_context6.n = 1;
|
|
218
|
+
return confirmReport({});
|
|
219
|
+
case 1:
|
|
220
|
+
expect(dispatch).toHaveBeenCalledWith({
|
|
221
|
+
type: 'ADD_SNACK',
|
|
222
|
+
payload: {
|
|
223
|
+
id: 'confirmBlockTradeFail',
|
|
224
|
+
text: 'Your block trade was not reported. Please try again.',
|
|
225
|
+
type: 'warning'
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
case 2:
|
|
229
|
+
return _context6.a(2);
|
|
230
|
+
}
|
|
231
|
+
}, _callee6);
|
|
232
|
+
})));
|
|
233
|
+
it('leaves the form filled in and adds no second snackbar when the submission threw', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
234
|
+
return _regenerator().w(function (_context7) {
|
|
235
|
+
while (1) switch (_context7.n) {
|
|
236
|
+
case 0:
|
|
237
|
+
resolvePlaceOrderWith(_orderEntryActions.ORDER_SUBMIT_FAILED);
|
|
238
|
+
_context7.n = 1;
|
|
239
|
+
return confirmReport({});
|
|
240
|
+
case 1:
|
|
241
|
+
expect(_orderEntryActions.clearOrderForm).not.toHaveBeenCalled();
|
|
242
|
+
expect(dispatch).not.toHaveBeenCalledWith(expect.objectContaining({
|
|
243
|
+
type: 'ADD_SNACK'
|
|
244
|
+
}));
|
|
245
|
+
case 2:
|
|
246
|
+
return _context7.a(2);
|
|
247
|
+
}
|
|
248
|
+
}, _callee7);
|
|
249
|
+
})));
|
|
250
|
+
it.each([undefined, 0, ''])('shows the generic snackbar and keeps the form when placeOrder resolves with %p', /*#__PURE__*/function () {
|
|
251
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(result) {
|
|
252
|
+
return _regenerator().w(function (_context8) {
|
|
253
|
+
while (1) switch (_context8.n) {
|
|
254
|
+
case 0:
|
|
255
|
+
resolvePlaceOrderWith(result);
|
|
256
|
+
_context8.n = 1;
|
|
257
|
+
return expect(confirmReport({})).resolves.toBeUndefined();
|
|
258
|
+
case 1:
|
|
259
|
+
expect(_orderEntryActions.clearOrderForm).not.toHaveBeenCalled();
|
|
260
|
+
expect(dispatch).toHaveBeenCalledWith({
|
|
261
|
+
type: 'ADD_SNACK',
|
|
262
|
+
payload: {
|
|
263
|
+
id: 'confirmBlockTradeFail',
|
|
264
|
+
text: 'Your block trade was not reported. Please try again.',
|
|
265
|
+
type: 'warning'
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
case 2:
|
|
269
|
+
return _context8.a(2);
|
|
270
|
+
}
|
|
271
|
+
}, _callee8);
|
|
272
|
+
}));
|
|
273
|
+
return function (_x) {
|
|
274
|
+
return _ref8.apply(this, arguments);
|
|
275
|
+
};
|
|
276
|
+
}());
|
|
277
|
+
it('surfaces a snackbar when the submission rejects', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
278
|
+
return _regenerator().w(function (_context9) {
|
|
279
|
+
while (1) switch (_context9.n) {
|
|
280
|
+
case 0:
|
|
281
|
+
_orderEntryActions.placeOrder.mockReturnValue(Promise.reject(new Error('websocket closed')));
|
|
282
|
+
_context9.n = 1;
|
|
283
|
+
return expect(confirmReport({})).resolves.toBeUndefined();
|
|
284
|
+
case 1:
|
|
285
|
+
expect(dispatch).toHaveBeenCalledWith({
|
|
286
|
+
type: 'ADD_SNACK',
|
|
287
|
+
payload: {
|
|
288
|
+
id: 'confirmBlockTradeFail',
|
|
289
|
+
text: 'Your block trade was not reported. Please try again.',
|
|
290
|
+
type: 'warning'
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
case 2:
|
|
294
|
+
return _context9.a(2);
|
|
295
|
+
}
|
|
296
|
+
}, _callee9);
|
|
297
|
+
})));
|
|
298
|
+
});
|
|
@@ -12,12 +12,14 @@ var _cssClassesHelper = require("../../helpers/cssClassesHelper");
|
|
|
12
12
|
var _orderEntryFormConstants = require("../../constants/sendOrder/orderEntryFormConstants");
|
|
13
13
|
var _numberFormatter = require("../../helpers/numberFormatter");
|
|
14
14
|
var _orderHelper = require("../../helpers/orderHelper");
|
|
15
|
+
var _twapOrderHelper = require("../../helpers/twapOrderHelper");
|
|
16
|
+
var _dateHelper = require("../../helpers/dateHelper");
|
|
15
17
|
require("./ConfirmOrderModalComponent.css");
|
|
16
18
|
var _pegPriceTypeConstants = require("../../constants/sendOrder/pegPriceTypeConstants");
|
|
17
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
20
|
var bemClasses = (0, _cssClassesHelper.getBEMClasses)('confirm-order-modal');
|
|
19
21
|
var ConfirmOrderModalComponent = function ConfirmOrderModalComponent(props) {
|
|
20
|
-
var _formObj$values$fee, _formObj$values$fee2;
|
|
22
|
+
var _twapSchedule$slices, _formObj$values$fee, _formObj$values$fee2;
|
|
21
23
|
var _useTranslation = (0, _reactI18next.useTranslation)('order'),
|
|
22
24
|
t = _useTranslation.t;
|
|
23
25
|
var formObj = props.formObj,
|
|
@@ -40,10 +42,15 @@ var ConfirmOrderModalComponent = function ConfirmOrderModalComponent(props) {
|
|
|
40
42
|
valueDP = props.valueDP,
|
|
41
43
|
futuresAmount = props.futuresAmount,
|
|
42
44
|
futuresValue = props.futuresValue,
|
|
43
|
-
futuresOrderCost = props.futuresOrderCost
|
|
45
|
+
futuresOrderCost = props.futuresOrderCost,
|
|
46
|
+
twapSchedule = props.twapSchedule;
|
|
44
47
|
var Product1Symbol = selectedInstrument.Product1Symbol,
|
|
45
48
|
Product2Symbol = selectedInstrument.Product2Symbol;
|
|
46
49
|
var isBuySide = formObj.values.side === _orderEntryFormConstants.buyValue;
|
|
50
|
+
var isTwap = (0, _twapOrderHelper.isTwapOrderType)(formObj.values.orderType);
|
|
51
|
+
var twapEndTime = isTwap ? (0, _twapOrderHelper.getTwapEndTime)(formObj.values.durationMinutes) : null;
|
|
52
|
+
// A TWAP buy without a limit price is sized by its Order Total (Value); its quantity is an estimate.
|
|
53
|
+
var isTwapByValue = isTwap && !!(twapSchedule !== null && twapSchedule !== void 0 && twapSchedule.byValue);
|
|
47
54
|
var isMarketByValue = formObj.values.anchoredField === 'value';
|
|
48
55
|
var _ref = futuresFormValues || {},
|
|
49
56
|
futuresOrderSide = _ref.side,
|
|
@@ -69,13 +76,13 @@ var ConfirmOrderModalComponent = function ConfirmOrderModalComponent(props) {
|
|
|
69
76
|
text: formObj.values.orderType
|
|
70
77
|
}, {
|
|
71
78
|
label: "".concat(t('Quantity'), ":"),
|
|
72
|
-
text: "".concat((0, _numberFormatter.formatNumberToLocale)(formObj.values.quantity, product1DecimalPlaces), " ").concat(Product1Symbol)
|
|
79
|
+
text: "".concat(isTwapByValue ? '≈ ' : '').concat((0, _numberFormatter.formatNumberToLocale)(formObj.values.quantity, product1DecimalPlaces), " ").concat(Product1Symbol)
|
|
73
80
|
}, isTrailing ? {
|
|
74
81
|
label: "".concat(t('Trailing Amount'), ":"),
|
|
75
82
|
text: "".concat((0, _numberFormatter.formatNumberToLocale)(formObj.values.trailingAmount, product2DecimalPlaces), " ").concat(Product2Symbol)
|
|
76
83
|
} : {
|
|
77
84
|
label: formObj.values.orderType === 'Stop Market' || formObj.values.orderType === 'Stop Limit' ? "".concat(t('Stop Price'), ":") : "".concat(t('Price'), ":"),
|
|
78
|
-
text: isMarginActive && formObj.values.orderType === 'Market Order' ? 'Market' : "".concat((0, _numberFormatter.formatNumberToLocale)(price, product2DecimalPlaces), " ").concat(Product2Symbol)
|
|
85
|
+
text: isMarginActive && formObj.values.orderType === 'Market Order' || isTwap && !(twapSchedule !== null && twapSchedule !== void 0 && twapSchedule.isLimit) ? t('Market') : "".concat((0, _numberFormatter.formatNumberToLocale)(price, product2DecimalPlaces), " ").concat(Product2Symbol)
|
|
79
86
|
}, formObj.values.orderType === 'Stop Limit' && {
|
|
80
87
|
label: "".concat(t('Limit Price'), ":"),
|
|
81
88
|
text: isMarginActive && formObj.values.orderType === 'Market Order' ? 'Market' : "".concat((0, _numberFormatter.formatNumberToLocale)(formObj.values.limitPrice, product2DecimalPlaces), " ").concat(Product2Symbol)
|
|
@@ -85,6 +92,21 @@ var ConfirmOrderModalComponent = function ConfirmOrderModalComponent(props) {
|
|
|
85
92
|
}, isTrailing && {
|
|
86
93
|
label: "".concat(t('Peg Price'), ":"),
|
|
87
94
|
text: _pegPriceTypeConstants.pegPriceTypesNames[formObj.values.pegPriceType]
|
|
95
|
+
}, isTwap && {
|
|
96
|
+
label: "".concat(t('Duration'), ":"),
|
|
97
|
+
text: "".concat((0, _numberFormatter.formatNumberToLocale)(formObj.values.durationMinutes, 0), " ").concat(t('min'))
|
|
98
|
+
}, isTwap && {
|
|
99
|
+
label: "".concat(t('Number of Slices'), ":"),
|
|
100
|
+
text: "".concat((_twapSchedule$slices = twapSchedule === null || twapSchedule === void 0 ? void 0 : twapSchedule.slices) !== null && _twapSchedule$slices !== void 0 ? _twapSchedule$slices : '-')
|
|
101
|
+
}, isTwap && {
|
|
102
|
+
label: "".concat(t('Interval'), ":"),
|
|
103
|
+
text: (0, _twapOrderHelper.formatTwapInterval)(twapSchedule === null || twapSchedule === void 0 ? void 0 : twapSchedule.intervalSeconds, t)
|
|
104
|
+
}, isTwap && {
|
|
105
|
+
label: "".concat(t('Est. Slice Size'), ":"),
|
|
106
|
+
text: (twapSchedule === null || twapSchedule === void 0 ? void 0 : twapSchedule.sliceSize) != null ? "".concat((0, _numberFormatter.formatNumberToLocale)(twapSchedule.sliceSize, twapSchedule.sliceDecimalPlaces), " ").concat(twapSchedule.sliceSymbol) : '-'
|
|
107
|
+
}, isTwap && {
|
|
108
|
+
label: "".concat(t('Ends'), ":"),
|
|
109
|
+
text: twapEndTime ? (0, _dateHelper.formatDateTime)(twapEndTime) : '-'
|
|
88
110
|
}, {
|
|
89
111
|
label: "".concat(t('Fee'), ":"),
|
|
90
112
|
text: "".concat((0, _numberFormatter.formatNumberToLocale)((_formObj$values$fee = formObj.values.fee) === null || _formObj$values$fee === void 0 ? void 0 : _formObj$values$fee.OrderFee, feeSymbol), " ").concat(feeSymbol)
|
|
@@ -86,7 +86,10 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
86
86
|
valueDP: valueDP,
|
|
87
87
|
futuresValue: futuresValue,
|
|
88
88
|
futuresValueDecimalPlaces: futuresValueDecimalPlaces,
|
|
89
|
-
futuresOrderCost: futuresOrderCost
|
|
89
|
+
futuresOrderCost: futuresOrderCost,
|
|
90
|
+
twapSchedule: (0, _orderEntrySelector.selectTwapSchedule)(state, {
|
|
91
|
+
formName: ORDER_ENTRY_FORM_ID
|
|
92
|
+
})
|
|
90
93
|
};
|
|
91
94
|
};
|
|
92
95
|
var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) {
|