@alphapoint/apex-web 5.7.0 → 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 +94 -16
- package/lib/components/2FA/TwoFactorAuthContainer.test.js +412 -0
- 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/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/EnableTwoFactorAuthContainerFactory.js +3 -2
- 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/Login/LoginFormComponent.js +1 -1
- 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.test.js +23 -1
- 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/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/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/webauthnHelper.js +300 -0
- package/lib/helpers/webauthnHelper.test.js +199 -0
- package/lib/hocs/withOneSubmission.js +168 -0
- package/lib/redux/actions/apiActions.js +52 -1
- package/lib/redux/actions/apiActions.test.js +135 -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/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 +9 -4
- package/lib/redux/actions/orderHistoryActions.test.js +63 -0
- package/lib/redux/actions/userActions.js +314 -177
- package/lib/redux/actions/userActions.test.js +844 -268
- 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/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/services/fms/fms.js +2 -0
- package/lib/services/fms/fms.test.js +35 -0
- package/package.json +4 -4
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports["default"] = void 0;
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _reactI18next = require("react-i18next");
|
|
9
|
+
var _reactRedux = require("react-redux");
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _config = _interopRequireDefault(require("../../../config"));
|
|
12
13
|
var _orderEntryFormConstants = require("../../../constants/sendOrder/orderEntryFormConstants.js");
|
|
13
14
|
var _cssClassesHelper = require("../../../helpers/cssClassesHelper.js");
|
|
14
15
|
var _orderHelper = require("../../../helpers/orderHelper.js");
|
|
15
16
|
var _commonComponent = require("../../../propTypes/commonComponent.js");
|
|
17
|
+
var _orderEntrySelector = require("../../../redux/selectors/orderEntrySelector.js");
|
|
16
18
|
var _OrderWarningModalComponent = _interopRequireDefault(require("../../ConfirmOrderModal/OrderWarningModalComponent.js"));
|
|
17
19
|
var _index = _interopRequireDefault(require("../../ConfirmOrderModal/index.js"));
|
|
18
20
|
var _APButton = _interopRequireDefault(require("../../common/APButton.js"));
|
|
19
|
-
var
|
|
21
|
+
var _APSelect = _interopRequireDefault(require("../../common/APSelect"));
|
|
20
22
|
var _VerificationRequiredContainer = _interopRequireDefault(require("../../VerificationRequired/VerificationRequiredContainer.js"));
|
|
21
23
|
var _OrderEntryEstimates = require("../common/OrderEntryEstimates.js");
|
|
22
24
|
var _BuySellTabs = _interopRequireDefault(require("./BuySellTabs"));
|
|
@@ -25,14 +27,25 @@ require("../../../styles/components/TradeComponent.css");
|
|
|
25
27
|
require("./OrderEntry.css");
|
|
26
28
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
27
29
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
30
|
+
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); }
|
|
31
|
+
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; }
|
|
32
|
+
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; }
|
|
33
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
34
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
35
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
36
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
37
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
38
|
+
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; }
|
|
39
|
+
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; }
|
|
40
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
41
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
28
42
|
var baseClass = 'order-entry';
|
|
29
43
|
var baseClasses = (0, _cssClassesHelper.getBEMClasses)(baseClass);
|
|
30
44
|
var tradeComponentClasses = (0, _cssClassesHelper.getBEMClasses)('trade-component');
|
|
31
45
|
var OrderEntryAnchoringComponent = function OrderEntryAnchoringComponent(props) {
|
|
32
46
|
var _useTranslation = (0, _reactI18next.useTranslation)('order'),
|
|
33
47
|
t = _useTranslation.t;
|
|
34
|
-
var
|
|
35
|
-
openReportBlockTradeSidePane = props.openReportBlockTradeSidePane,
|
|
48
|
+
var openReportBlockTradeSidePane = props.openReportBlockTradeSidePane,
|
|
36
49
|
side = props.side,
|
|
37
50
|
isBuy = props.isBuy,
|
|
38
51
|
handleSubmit = props.handleSubmit,
|
|
@@ -43,16 +56,26 @@ var OrderEntryAnchoringComponent = function OrderEntryAnchoringComponent(props)
|
|
|
43
56
|
title = props.title,
|
|
44
57
|
allowBlockTrading = props.allowBlockTrading,
|
|
45
58
|
reduxFormChange = props.reduxFormChange,
|
|
59
|
+
reduxFormUntouch = props.reduxFormUntouch,
|
|
46
60
|
maxQuantity = props.maxQuantity,
|
|
47
61
|
form = props.form,
|
|
48
62
|
_props$hasCredit = props.hasCredit,
|
|
49
63
|
hasCredit = _props$hasCredit === void 0 ? false : _props$hasCredit;
|
|
64
|
+
var orderType = (0, _reactRedux.useSelector)(function (state) {
|
|
65
|
+
return (0, _orderEntrySelector.selectOrderFormValues)(state, {
|
|
66
|
+
formName: form
|
|
67
|
+
}).orderType;
|
|
68
|
+
});
|
|
50
69
|
var resetState = (0, _react.useCallback)(function () {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
70
|
+
var fields = ['limitPrice', 'stopPrice', 'value', 'quantity', 'trailingAmount', 'limitOffset', 'displayQuantity', 'durationMinutes', 'slices'];
|
|
71
|
+
fields.forEach(function (field) {
|
|
72
|
+
return reduxFormChange(field, '');
|
|
73
|
+
});
|
|
74
|
+
// A cleared field fails "required", and the inputs show errors for touched fields, so a field
|
|
75
|
+
// the trader had already visited showed an error the moment the type changed. Untouched, the
|
|
76
|
+
// fresh form reads as fresh.
|
|
77
|
+
reduxFormUntouch.apply(void 0, fields);
|
|
78
|
+
}, [reduxFormChange, reduxFormUntouch]);
|
|
56
79
|
|
|
57
80
|
// The tab handler fires for whichever tab was clicked, including the selected one, so
|
|
58
81
|
// only reset when the click actually changes side.
|
|
@@ -71,6 +94,52 @@ var OrderEntryAnchoringComponent = function OrderEntryAnchoringComponent(props)
|
|
|
71
94
|
// isBuy-keyed effect, which is safe only because it owns a separate redux-form
|
|
72
95
|
// ('advancedOrderEntry') that the order-book handlers never dispatch into.
|
|
73
96
|
(0, _react.useEffect)(resetState, [isMarginActive, resetState]);
|
|
97
|
+
|
|
98
|
+
// The tooltip and data-test hook each type had as a segmented button, so suites that look up
|
|
99
|
+
// `[data-test='Market Order Type']` and the like still find the type.
|
|
100
|
+
var orderTypeHints = (0, _react.useMemo)(function () {
|
|
101
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, _orderEntryFormConstants.orderTypes.market.displayName, {
|
|
102
|
+
dataTest: 'Market Order Type',
|
|
103
|
+
title: t('Buy or sell at the best available price')
|
|
104
|
+
}), _orderEntryFormConstants.orderTypes.limit.displayName, {
|
|
105
|
+
dataTest: 'Limit Order Type',
|
|
106
|
+
title: t('Buy or sell at the specified price or better')
|
|
107
|
+
}), _orderEntryFormConstants.orderTypes.stopMarket.displayName, {
|
|
108
|
+
dataTest: 'Stop Order Type',
|
|
109
|
+
title: t('Buy or sell once the price reaches a specified Stop Price')
|
|
110
|
+
}), _orderEntryFormConstants.orderTypes.stopLimit.displayName, {
|
|
111
|
+
dataTest: 'Stop Limit Order Type',
|
|
112
|
+
title: t('Buy or sell at the specified price or better once the price reaches a specified Stop Price')
|
|
113
|
+
});
|
|
114
|
+
}, [t]);
|
|
115
|
+
|
|
116
|
+
// The four default types are always listed, since the form starts on Limit Order and the order-book
|
|
117
|
+
// handlers set Market or Limit Order. The rest follow Spot/MarginAllowedOrderTypes, as they did in
|
|
118
|
+
// the Advanced Orders pane.
|
|
119
|
+
var orderTypeOptions = (0, _react.useMemo)(function () {
|
|
120
|
+
var allowedOrderTypes = isMarginActive ? _config["default"].Trading.MarginAllowedOrderTypes : _config["default"].Trading.SpotAllowedOrderTypes;
|
|
121
|
+
return [].concat(_toConsumableArray(Object.values(_orderEntryFormConstants.defaultOrderFormTypes)), _toConsumableArray(Object.values(_orderEntryFormConstants.configurableOrderFormTypes).filter(function (_ref2) {
|
|
122
|
+
var displayName = _ref2.displayName;
|
|
123
|
+
return allowedOrderTypes.includes(displayName);
|
|
124
|
+
}))).map(function (_ref3) {
|
|
125
|
+
var displayName = _ref3.displayName;
|
|
126
|
+
return _objectSpread({
|
|
127
|
+
label: t(displayName),
|
|
128
|
+
value: displayName
|
|
129
|
+
}, orderTypeHints[displayName]);
|
|
130
|
+
});
|
|
131
|
+
}, [isMarginActive, orderTypeHints, t]);
|
|
132
|
+
|
|
133
|
+
// Spot and margin allow different types, so a type picked in one mode can be missing from the other's
|
|
134
|
+
// list. Fall back to Limit Order rather than show one type while the form submits another.
|
|
135
|
+
(0, _react.useEffect)(function () {
|
|
136
|
+
if (orderType && !orderTypeOptions.some(function (_ref4) {
|
|
137
|
+
var value = _ref4.value;
|
|
138
|
+
return value === orderType;
|
|
139
|
+
})) {
|
|
140
|
+
reduxFormChange('orderType', _orderEntryFormConstants.orderTypes.limit.displayName);
|
|
141
|
+
}
|
|
142
|
+
}, [orderType, orderTypeOptions, reduxFormChange]);
|
|
74
143
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
75
144
|
className: (0, _classnames["default"])(baseClasses())
|
|
76
145
|
}, title || null, /*#__PURE__*/_react["default"].createElement("form", {
|
|
@@ -84,30 +153,13 @@ var OrderEntryAnchoringComponent = function OrderEntryAnchoringComponent(props)
|
|
|
84
153
|
className: baseClasses('body')
|
|
85
154
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
86
155
|
className: baseClasses('order-type-wrapper')
|
|
87
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
156
|
+
}, /*#__PURE__*/_react["default"].createElement(_APSelect["default"], {
|
|
88
157
|
name: "orderType",
|
|
89
158
|
label: t('Order Type'),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
title: t('Buy or sell at the best available price'),
|
|
95
|
-
onClick: resetState
|
|
96
|
-
}, {
|
|
97
|
-
value: _orderEntryFormConstants.orderTypes.limit.displayName,
|
|
98
|
-
text: t('Limit'),
|
|
99
|
-
dataTest: 'Limit Order Type',
|
|
100
|
-
title: t('Buy or sell at the specified price or better'),
|
|
101
|
-
onClick: resetState
|
|
102
|
-
}, {
|
|
103
|
-
value: _orderEntryFormConstants.orderTypes.stopMarket.displayName,
|
|
104
|
-
text: t('Stop'),
|
|
105
|
-
dataTest: 'Stop Order Type',
|
|
106
|
-
title: t('Buy or sell once the price reaches a specified Stop Price'),
|
|
107
|
-
onClick: resetState
|
|
108
|
-
}],
|
|
109
|
-
customClass: baseClass,
|
|
110
|
-
styleName: isBuy ? _commonComponent.styleNames.additive : _commonComponent.styleNames.subtractive
|
|
159
|
+
options: orderTypeOptions,
|
|
160
|
+
onSelect: resetState,
|
|
161
|
+
showTriangles: true,
|
|
162
|
+
customClass: baseClass
|
|
111
163
|
})), /*#__PURE__*/_react["default"].createElement(_FormAmountFields.FormAmountFields, {
|
|
112
164
|
baseClass: baseClass,
|
|
113
165
|
formName: form,
|
|
@@ -126,12 +178,7 @@ var OrderEntryAnchoringComponent = function OrderEntryAnchoringComponent(props)
|
|
|
126
178
|
disabled: submitting || invalid || disableTrading || !hasCredit && !maxQuantity,
|
|
127
179
|
customClass: baseClass,
|
|
128
180
|
styleName: isBuy ? _commonComponent.styleNames.additive : _commonComponent.styleNames.subtractive
|
|
129
|
-
}, submitting ? t('Processing...') : t((0, _orderHelper.getSubmitButtonText)(side))), /*#__PURE__*/_react["default"].createElement(_VerificationRequiredContainer["default"], null)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
130
|
-
className: tradeComponentClasses('section')
|
|
131
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
132
|
-
className: (0, _classnames["default"])(baseClasses('item-button')),
|
|
133
|
-
onClick: openAdvancedOrderSidePane
|
|
134
|
-
}, "\xAB ".concat(t('Advanced Orders')))), allowBlockTrading && /*#__PURE__*/_react["default"].createElement("div", {
|
|
181
|
+
}, submitting ? t('Processing...') : t((0, _orderHelper.getSubmitButtonText)(side))), /*#__PURE__*/_react["default"].createElement(_VerificationRequiredContainer["default"], null)), allowBlockTrading && /*#__PURE__*/_react["default"].createElement("div", {
|
|
135
182
|
className: tradeComponentClasses('section')
|
|
136
183
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
137
184
|
className: (0, _classnames["default"])(baseClasses('item-button')),
|
|
@@ -146,7 +193,6 @@ OrderEntryAnchoringComponent.defaultProps = {
|
|
|
146
193
|
OrderEntryAnchoringComponent.propTypes = {
|
|
147
194
|
handleSubmit: _propTypes["default"].func.isRequired,
|
|
148
195
|
allowBlockTrading: _propTypes["default"].bool,
|
|
149
|
-
openAdvancedOrderSidePane: _propTypes["default"].func.isRequired,
|
|
150
196
|
openReportBlockTradeSidePane: _propTypes["default"].func.isRequired,
|
|
151
197
|
orderEntryForm: _propTypes["default"].object.isRequired,
|
|
152
198
|
submitting: _propTypes["default"].bool,
|
|
@@ -156,6 +202,7 @@ OrderEntryAnchoringComponent.propTypes = {
|
|
|
156
202
|
side: _propTypes["default"].string.isRequired,
|
|
157
203
|
isBuy: _propTypes["default"].bool.isRequired,
|
|
158
204
|
isMarginActive: _propTypes["default"].bool.isRequired,
|
|
159
|
-
maxQuantity: _propTypes["default"].number.isRequired
|
|
205
|
+
maxQuantity: _propTypes["default"].number.isRequired,
|
|
206
|
+
reduxFormUntouch: _propTypes["default"].func.isRequired
|
|
160
207
|
};
|
|
161
208
|
var _default = exports["default"] = OrderEntryAnchoringComponent;
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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 = _interopRequireWildcard(require("react"));
|
|
5
|
+
var _client = require("react-dom/client");
|
|
6
|
+
var _reactRedux = require("react-redux");
|
|
7
|
+
var _redux = require("redux");
|
|
8
|
+
var _reduxForm = require("redux-form");
|
|
9
|
+
var _config = _interopRequireDefault(require("../../../config"));
|
|
10
|
+
var _orderEntryFormConstants = require("../../../constants/sendOrder/orderEntryFormConstants");
|
|
11
|
+
var _OrderEntryAnchoring = _interopRequireDefault(require("./OrderEntryAnchoring"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
15
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
18
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
19
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
21
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
22
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
23
|
+
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; }
|
|
24
|
+
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); }
|
|
25
|
+
jest.mock('react-i18next', function () {
|
|
26
|
+
return {
|
|
27
|
+
useTranslation: function useTranslation() {
|
|
28
|
+
return {
|
|
29
|
+
t: function t(key) {
|
|
30
|
+
return "t(".concat(key, ")");
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// The form's other sections have their own store dependencies and are not what these specs cover.
|
|
38
|
+
jest.mock('./BuySellTabs', function () {
|
|
39
|
+
return function () {
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
jest.mock('../common/FormAmountFields.js', function () {
|
|
44
|
+
return {
|
|
45
|
+
FormAmountFields: function FormAmountFields() {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
jest.mock('../common/OrderEntryEstimates.js', function () {
|
|
51
|
+
return {
|
|
52
|
+
OrderEntryEstimates: function OrderEntryEstimates() {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
jest.mock('../../ConfirmOrderModal/index.js', function () {
|
|
58
|
+
return function () {
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
jest.mock('../../ConfirmOrderModal/OrderWarningModalComponent.js', function () {
|
|
63
|
+
return function () {
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
jest.mock('../../VerificationRequired/VerificationRequiredContainer.js', function () {
|
|
68
|
+
return function () {
|
|
69
|
+
return null;
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
global.IS_REACT_ACT_ENVIRONMENT = true;
|
|
73
|
+
var FORM_NAME = 'orderEntry';
|
|
74
|
+
var OrderEntryForm = (0, _reduxForm.reduxForm)({
|
|
75
|
+
form: FORM_NAME
|
|
76
|
+
})(_OrderEntryAnchoring["default"]);
|
|
77
|
+
var ORDER_TYPES = ['Market Order', 'Limit Order', 'Stop Market', 'Stop Limit'];
|
|
78
|
+
// configDefault.json allows Trailing Stop, Reserve and TWAP on spot, and only Reserve on margin.
|
|
79
|
+
var SPOT_ORDER_TYPES = [].concat(ORDER_TYPES, ['Trailing Stop Market', 'Trailing Stop Limit', 'Reserve Order', 'TWAP']);
|
|
80
|
+
var MARGIN_ORDER_TYPES = [].concat(ORDER_TYPES, ['Reserve Order']);
|
|
81
|
+
var mountedRoots = [];
|
|
82
|
+
var render = function render() {
|
|
83
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
84
|
+
_ref$isMarginActive = _ref.isMarginActive,
|
|
85
|
+
isMarginActive = _ref$isMarginActive === void 0 ? false : _ref$isMarginActive;
|
|
86
|
+
var store = (0, _redux.createStore)((0, _redux.combineReducers)({
|
|
87
|
+
form: _reduxForm.reducer
|
|
88
|
+
}));
|
|
89
|
+
var container = document.createElement('div');
|
|
90
|
+
document.body.appendChild(container);
|
|
91
|
+
var root = (0, _client.createRoot)(container);
|
|
92
|
+
mountedRoots.push(root);
|
|
93
|
+
var renderForm = function renderForm(props) {
|
|
94
|
+
return (0, _react.act)(function () {
|
|
95
|
+
return root.render(/*#__PURE__*/_react["default"].createElement(_reactRedux.Provider, {
|
|
96
|
+
store: store
|
|
97
|
+
}, /*#__PURE__*/_react["default"].createElement(OrderEntryForm, _extends({
|
|
98
|
+
initialValues: {
|
|
99
|
+
side: _orderEntryFormConstants.buyValue,
|
|
100
|
+
orderType: 'Limit Order'
|
|
101
|
+
},
|
|
102
|
+
reduxFormChange: function reduxFormChange(key, value) {
|
|
103
|
+
return store.dispatch((0, _reduxForm.change)(FORM_NAME, key, value));
|
|
104
|
+
},
|
|
105
|
+
reduxFormUntouch: function reduxFormUntouch() {
|
|
106
|
+
for (var _len = arguments.length, fields = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
107
|
+
fields[_key] = arguments[_key];
|
|
108
|
+
}
|
|
109
|
+
return store.dispatch(_reduxForm.untouch.apply(void 0, [FORM_NAME].concat(fields)));
|
|
110
|
+
},
|
|
111
|
+
openReportBlockTradeSidePane: function openReportBlockTradeSidePane() {},
|
|
112
|
+
side: _orderEntryFormConstants.buyValue,
|
|
113
|
+
isBuy: true,
|
|
114
|
+
disableTrading: false,
|
|
115
|
+
maxQuantity: 10
|
|
116
|
+
}, props))));
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
renderForm({
|
|
120
|
+
isMarginActive: isMarginActive
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
store: store,
|
|
124
|
+
container: container,
|
|
125
|
+
select: container.querySelector('select[name="orderType"]'),
|
|
126
|
+
values: function values() {
|
|
127
|
+
return store.getState().form[FORM_NAME].values;
|
|
128
|
+
},
|
|
129
|
+
setMarginActive: function setMarginActive(active) {
|
|
130
|
+
return renderForm({
|
|
131
|
+
isMarginActive: active
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
var optionValues = function optionValues(select) {
|
|
137
|
+
return _toConsumableArray(select.options).map(function (option) {
|
|
138
|
+
return option.value;
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
describe('OrderEntryAnchoring - Order Type dropdown', function () {
|
|
142
|
+
afterEach(function () {
|
|
143
|
+
(0, _react.act)(function () {
|
|
144
|
+
return mountedRoots.splice(0).forEach(function (root) {
|
|
145
|
+
return root.unmount();
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
document.body.innerHTML = '';
|
|
149
|
+
});
|
|
150
|
+
it('offers the four default types plus the advanced types the spot config allows', function () {
|
|
151
|
+
expect(optionValues(render().select)).toEqual(SPOT_ORDER_TYPES);
|
|
152
|
+
});
|
|
153
|
+
it('offers the four default types plus the advanced types the margin config allows', function () {
|
|
154
|
+
expect(optionValues(render({
|
|
155
|
+
isMarginActive: true
|
|
156
|
+
}).select)).toEqual(MARGIN_ORDER_TYPES);
|
|
157
|
+
});
|
|
158
|
+
it('offers Fill Or Kill and Immediate or Cancel when the config allows them', function () {
|
|
159
|
+
var SpotAllowedOrderTypes = _config["default"].Trading.SpotAllowedOrderTypes;
|
|
160
|
+
_config["default"].Trading.SpotAllowedOrderTypes = [].concat(_toConsumableArray(SpotAllowedOrderTypes), ['Fill Or Kill', 'Immediate or Cancel']);
|
|
161
|
+
try {
|
|
162
|
+
expect(optionValues(render().select)).toEqual([].concat(ORDER_TYPES, ['Trailing Stop Market', 'Trailing Stop Limit', 'Fill Or Kill', 'Immediate or Cancel', 'Reserve Order', 'TWAP']));
|
|
163
|
+
} finally {
|
|
164
|
+
_config["default"].Trading.SpotAllowedOrderTypes = SpotAllowedOrderTypes;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
it('falls back to Limit Order when margin turns on and the margin config leaves out the selected type', function () {
|
|
168
|
+
var _render = render(),
|
|
169
|
+
select = _render.select,
|
|
170
|
+
values = _render.values,
|
|
171
|
+
setMarginActive = _render.setMarginActive;
|
|
172
|
+
(0, _react.act)(function () {
|
|
173
|
+
select.value = 'Trailing Stop Market';
|
|
174
|
+
select.dispatchEvent(new Event('change', {
|
|
175
|
+
bubbles: true
|
|
176
|
+
}));
|
|
177
|
+
});
|
|
178
|
+
expect(values().orderType).toEqual('Trailing Stop Market');
|
|
179
|
+
setMarginActive(true);
|
|
180
|
+
expect(values().orderType).toEqual('Limit Order');
|
|
181
|
+
expect(select.value).toEqual('Limit Order');
|
|
182
|
+
});
|
|
183
|
+
it('keeps the selected type when margin turns on and the margin config allows it', function () {
|
|
184
|
+
var _render2 = render(),
|
|
185
|
+
select = _render2.select,
|
|
186
|
+
values = _render2.values,
|
|
187
|
+
setMarginActive = _render2.setMarginActive;
|
|
188
|
+
(0, _react.act)(function () {
|
|
189
|
+
select.value = 'Reserve Order';
|
|
190
|
+
select.dispatchEvent(new Event('change', {
|
|
191
|
+
bubbles: true
|
|
192
|
+
}));
|
|
193
|
+
});
|
|
194
|
+
setMarginActive(true);
|
|
195
|
+
expect(values().orderType).toEqual('Reserve Order');
|
|
196
|
+
expect(select.value).toEqual('Reserve Order');
|
|
197
|
+
});
|
|
198
|
+
it('has no Advanced Orders link, since every type is in the dropdown', function () {
|
|
199
|
+
expect(render().container.textContent).not.toContain('Advanced Orders');
|
|
200
|
+
});
|
|
201
|
+
it('offers all four types and shows the type the form submits, although the config leaves out Limit Order', function () {
|
|
202
|
+
var _config$Trading = _config["default"].Trading,
|
|
203
|
+
SpotAllowedOrderTypes = _config$Trading.SpotAllowedOrderTypes,
|
|
204
|
+
MarginAllowedOrderTypes = _config$Trading.MarginAllowedOrderTypes;
|
|
205
|
+
_config["default"].Trading.SpotAllowedOrderTypes = ['Market Order', 'Stop Market', 'Stop Limit'];
|
|
206
|
+
_config["default"].Trading.MarginAllowedOrderTypes = ['Market Order', 'Stop Market', 'Stop Limit'];
|
|
207
|
+
try {
|
|
208
|
+
var _render3 = render(),
|
|
209
|
+
store = _render3.store,
|
|
210
|
+
select = _render3.select,
|
|
211
|
+
values = _render3.values;
|
|
212
|
+
expect(optionValues(select)).toEqual(ORDER_TYPES);
|
|
213
|
+
expect(values().orderType).toEqual('Limit Order');
|
|
214
|
+
expect(select.value).toEqual('Limit Order');
|
|
215
|
+
|
|
216
|
+
// The order-book handlers set the type programmatically, without a change event.
|
|
217
|
+
(0, _react.act)(function () {
|
|
218
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'orderType', 'Market Order'));
|
|
219
|
+
});
|
|
220
|
+
expect(select.value).toEqual('Market Order');
|
|
221
|
+
} finally {
|
|
222
|
+
_config["default"].Trading.SpotAllowedOrderTypes = SpotAllowedOrderTypes;
|
|
223
|
+
_config["default"].Trading.MarginAllowedOrderTypes = MarginAllowedOrderTypes;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
it('translates the option labels but keeps the untranslated order type as the value', function () {
|
|
227
|
+
var _render4 = render(),
|
|
228
|
+
select = _render4.select;
|
|
229
|
+
expect(_toConsumableArray(select.options).map(function (option) {
|
|
230
|
+
return option.textContent;
|
|
231
|
+
})).toEqual(SPOT_ORDER_TYPES.map(function (orderType) {
|
|
232
|
+
return "t(".concat(orderType, ")");
|
|
233
|
+
}));
|
|
234
|
+
expect(optionValues(select)).toEqual(SPOT_ORDER_TYPES);
|
|
235
|
+
});
|
|
236
|
+
it("keeps each type's tooltip and data-test hook from the segmented button", function () {
|
|
237
|
+
var _render5 = render(),
|
|
238
|
+
select = _render5.select;
|
|
239
|
+
expect(_toConsumableArray(select.options).slice(0, 4).map(function (option) {
|
|
240
|
+
return [option.dataset.test, option.title];
|
|
241
|
+
})).toEqual([['Market Order Type', 't(Buy or sell at the best available price)'], ['Limit Order Type', 't(Buy or sell at the specified price or better)'], ['Stop Order Type', 't(Buy or sell once the price reaches a specified Stop Price)'], ['Stop Limit Order Type', 't(Buy or sell at the specified price or better once the price reaches a specified Stop Price)']]);
|
|
242
|
+
});
|
|
243
|
+
it('renders the select without unknown DOM props', function () {
|
|
244
|
+
var consoleError = jest.spyOn(console, 'error').mockImplementation(function () {});
|
|
245
|
+
try {
|
|
246
|
+
var _render6 = render(),
|
|
247
|
+
select = _render6.select;
|
|
248
|
+
expect(select.hasAttribute('stylename')).toBe(false);
|
|
249
|
+
expect(consoleError.mock.calls.filter(function (_ref2) {
|
|
250
|
+
var _ref3 = _slicedToArray(_ref2, 1),
|
|
251
|
+
message = _ref3[0];
|
|
252
|
+
return String(message).includes('React does not recognize');
|
|
253
|
+
})).toEqual([]);
|
|
254
|
+
} finally {
|
|
255
|
+
consoleError.mockRestore();
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
it('shows the form value as the selected order type', function () {
|
|
259
|
+
expect(render().select.value).toEqual('Limit Order');
|
|
260
|
+
});
|
|
261
|
+
it('switches the form order type and clears the prices and amounts when a type is picked', function () {
|
|
262
|
+
var _render7 = render(),
|
|
263
|
+
store = _render7.store,
|
|
264
|
+
select = _render7.select,
|
|
265
|
+
values = _render7.values;
|
|
266
|
+
(0, _react.act)(function () {
|
|
267
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'limitPrice', '100'));
|
|
268
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'stopPrice', '90'));
|
|
269
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'quantity', '2'));
|
|
270
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'value', '200'));
|
|
271
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'trailingAmount', '5'));
|
|
272
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'limitOffset', '1'));
|
|
273
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'displayQuantity', '0.5'));
|
|
274
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'durationMinutes', '30'));
|
|
275
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'slices', '6'));
|
|
276
|
+
});
|
|
277
|
+
expect(values()).toEqual(expect.objectContaining({
|
|
278
|
+
limitPrice: '100',
|
|
279
|
+
stopPrice: '90',
|
|
280
|
+
quantity: '2',
|
|
281
|
+
value: '200',
|
|
282
|
+
trailingAmount: '5',
|
|
283
|
+
limitOffset: '1',
|
|
284
|
+
displayQuantity: '0.5',
|
|
285
|
+
durationMinutes: '30',
|
|
286
|
+
slices: '6'
|
|
287
|
+
}));
|
|
288
|
+
(0, _react.act)(function () {
|
|
289
|
+
select.value = 'Stop Limit';
|
|
290
|
+
select.dispatchEvent(new Event('change', {
|
|
291
|
+
bubbles: true
|
|
292
|
+
}));
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// redux-form drops a field changed to '' from `values`, so only side and the new type remain.
|
|
296
|
+
expect(values()).toEqual({
|
|
297
|
+
side: _orderEntryFormConstants.buyValue,
|
|
298
|
+
orderType: 'Stop Limit'
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
it('leaves the cleared fields untouched, so they do not show "required" errors after a type change', function () {
|
|
302
|
+
var _render8 = render(),
|
|
303
|
+
store = _render8.store,
|
|
304
|
+
select = _render8.select;
|
|
305
|
+
var touchedFields = function touchedFields() {
|
|
306
|
+
var _store$getState$form$ = store.getState().form[FORM_NAME].fields,
|
|
307
|
+
fields = _store$getState$form$ === void 0 ? {} : _store$getState$form$;
|
|
308
|
+
return ['limitPrice', 'stopPrice', 'value', 'quantity'].filter(function (field) {
|
|
309
|
+
return fields[field] && fields[field].touched;
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
(0, _react.act)(function () {
|
|
313
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'limitPrice', '100'));
|
|
314
|
+
store.dispatch((0, _reduxForm.change)(FORM_NAME, 'quantity', '2'));
|
|
315
|
+
store.dispatch((0, _reduxForm.touch)(FORM_NAME, 'limitPrice', 'quantity'));
|
|
316
|
+
});
|
|
317
|
+
expect(touchedFields()).toEqual(['limitPrice', 'quantity']);
|
|
318
|
+
(0, _react.act)(function () {
|
|
319
|
+
select.value = 'Stop Limit';
|
|
320
|
+
select.dispatchEvent(new Event('change', {
|
|
321
|
+
bubbles: true
|
|
322
|
+
}));
|
|
323
|
+
});
|
|
324
|
+
expect(touchedFields()).toEqual([]);
|
|
325
|
+
});
|
|
326
|
+
});
|
|
@@ -36,6 +36,11 @@ var initialValues = {
|
|
|
36
36
|
value: '',
|
|
37
37
|
limitPrice: '',
|
|
38
38
|
stopPrice: '',
|
|
39
|
+
trailingAmount: '',
|
|
40
|
+
limitOffset: '',
|
|
41
|
+
pegPriceType: '1',
|
|
42
|
+
durationMinutes: '',
|
|
43
|
+
slices: '',
|
|
39
44
|
fee: '0',
|
|
40
45
|
totalAmount: '0',
|
|
41
46
|
timeInForce: '1',
|
|
@@ -58,8 +63,11 @@ var mapDispatchToProps = {
|
|
|
58
63
|
reduxFormChange: function reduxFormChange(key, val) {
|
|
59
64
|
return (0, _reduxForm.change)(ORDER_FORM_NAME, key, val);
|
|
60
65
|
},
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
reduxFormUntouch: function reduxFormUntouch() {
|
|
67
|
+
for (var _len = arguments.length, fields = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
68
|
+
fields[_key] = arguments[_key];
|
|
69
|
+
}
|
|
70
|
+
return _reduxForm.untouch.apply(void 0, [ORDER_FORM_NAME].concat(fields));
|
|
63
71
|
},
|
|
64
72
|
openReportBlockTradeSidePane: function openReportBlockTradeSidePane() {
|
|
65
73
|
return (0, _sidePaneActions.openSidePane)(_sidePanesConstants.SIDE_PANES.REPORT_BLOCK_TRADE);
|
|
@@ -63,7 +63,7 @@ var DepositsStatusComponent = function DepositsStatusComponent(props) {
|
|
|
63
63
|
},
|
|
64
64
|
cell: function cell(_ref3) {
|
|
65
65
|
var row = _ref3.row;
|
|
66
|
-
return t(row.original.Status);
|
|
66
|
+
return row.original.Status === 'AddressBlacklisted' ? t('Under Review') : t(row.original.Status);
|
|
67
67
|
}
|
|
68
68
|
}, {
|
|
69
69
|
header: t('Transaction Id'),
|