@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
|
@@ -13,6 +13,7 @@ var _APInput = _interopRequireDefault(require("../common/APInput/APInput"));
|
|
|
13
13
|
var _path = _interopRequireDefault(require("../../helpers/path"));
|
|
14
14
|
var _cssClassesHelper = require("../../helpers/cssClassesHelper");
|
|
15
15
|
var _formValidations = require("../../helpers/formValidations");
|
|
16
|
+
var _PasskeyOption = require("../2FA/PasskeyOption");
|
|
16
17
|
var _reactRouterDom = require("react-router-dom");
|
|
17
18
|
require("../../styles/components/common/StandaloneForm.css");
|
|
18
19
|
require("./TwoFactorAuthFormComponent.css");
|
|
@@ -33,10 +34,16 @@ var TwoFactorAuthFormComponent = function TwoFactorAuthFormComponent(props) {
|
|
|
33
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
34
35
|
isUsingYubikey = _useState2[0],
|
|
35
36
|
setIsUsingYubikey = _useState2[1];
|
|
37
|
+
|
|
38
|
+
// a code or a passkey answer is on its way: neither can be sent again until the gateway replies
|
|
36
39
|
var handleSubmit = props.handleSubmit,
|
|
37
40
|
is2FARequired = props.is2FARequired,
|
|
38
|
-
error = props.error
|
|
39
|
-
|
|
41
|
+
error = props.error,
|
|
42
|
+
onPasskey = props.onPasskey,
|
|
43
|
+
twoFAType = props.twoFAType;
|
|
44
|
+
var answering = !!props.answering || !!props.submitting;
|
|
45
|
+
var passkeyOnly = (0, _PasskeyOption.isPasskeyOnlyFor)(twoFAType, props.passkeyOnly);
|
|
46
|
+
if (!isUsingYubikey && !passkeyOnly && props.Code.length >= 6 && !props.error && !answering) {
|
|
40
47
|
props.handleSubmit();
|
|
41
48
|
}
|
|
42
49
|
if (!is2FARequired) return /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Redirect, {
|
|
@@ -48,7 +55,11 @@ var TwoFactorAuthFormComponent = function TwoFactorAuthFormComponent(props) {
|
|
|
48
55
|
className: "".concat(baseClasses('header'), " ").concat(twoFactorAuthFormClasses('header'))
|
|
49
56
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
50
57
|
className: "".concat(baseClasses('header-text'), " ").concat(twoFactorAuthFormClasses('header-text'))
|
|
51
|
-
}, t("Two-Factor Authentication"))),
|
|
58
|
+
}, t("Two-Factor Authentication"))), passkeyOnly ? /*#__PURE__*/_react["default"].createElement(_PasskeyOption.PasskeyOnlyStep, {
|
|
59
|
+
onPasskey: onPasskey,
|
|
60
|
+
disabled: answering,
|
|
61
|
+
dataTest: "two-factor-passkey"
|
|
62
|
+
}) : isUsingYubikey ? /*#__PURE__*/_react["default"].createElement("form", {
|
|
52
63
|
onSubmit: handleSubmit,
|
|
53
64
|
className: "".concat(baseClasses('form'), " ").concat(twoFactorAuthFormClasses('form'))
|
|
54
65
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -59,6 +70,7 @@ var TwoFactorAuthFormComponent = function TwoFactorAuthFormComponent(props) {
|
|
|
59
70
|
autoFocus: true,
|
|
60
71
|
name: "code",
|
|
61
72
|
type: "password",
|
|
73
|
+
disabled: answering,
|
|
62
74
|
validate: [_formValidations.required],
|
|
63
75
|
customClass: twoFactorAuthFormClasses('input')
|
|
64
76
|
}), error && /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -82,6 +94,7 @@ var TwoFactorAuthFormComponent = function TwoFactorAuthFormComponent(props) {
|
|
|
82
94
|
name: "code",
|
|
83
95
|
type: "number",
|
|
84
96
|
numberOfInputs: 6,
|
|
97
|
+
disabled: answering,
|
|
85
98
|
validate: [_formValidations.required],
|
|
86
99
|
customClass: twoFactorAuthFormClasses('input')
|
|
87
100
|
}), error && /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -94,10 +107,18 @@ var TwoFactorAuthFormComponent = function TwoFactorAuthFormComponent(props) {
|
|
|
94
107
|
return setIsUsingYubikey(true);
|
|
95
108
|
},
|
|
96
109
|
className: "link --small-font"
|
|
97
|
-
}, t("Click here to use a Yubikey instead.")))
|
|
110
|
+
}, t("Click here to use a Yubikey instead."))), /*#__PURE__*/_react["default"].createElement(_PasskeyOption.PasskeyOption, {
|
|
111
|
+
onPasskey: onPasskey,
|
|
112
|
+
disabled: answering,
|
|
113
|
+
dataTest: "two-factor-passkey"
|
|
114
|
+
}))));
|
|
98
115
|
};
|
|
99
116
|
TwoFactorAuthFormComponent.propTypes = {
|
|
100
117
|
handleSubmit: _propTypes["default"].func.isRequired,
|
|
101
|
-
submitting: _propTypes["default"].bool.isRequired
|
|
118
|
+
submitting: _propTypes["default"].bool.isRequired,
|
|
119
|
+
onPasskey: _propTypes["default"].func,
|
|
120
|
+
twoFAType: _propTypes["default"].string,
|
|
121
|
+
passkeyOnly: _propTypes["default"].bool,
|
|
122
|
+
answering: _propTypes["default"].bool
|
|
102
123
|
};
|
|
103
124
|
var _default = exports["default"] = TwoFactorAuthFormComponent;
|
|
@@ -1,53 +1,71 @@
|
|
|
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
+
exports.onSubmit = exports.mapDispatchToProps = exports["default"] = void 0;
|
|
7
8
|
var _reduxForm = require("redux-form");
|
|
8
9
|
var _reactRedux = require("react-redux");
|
|
9
10
|
var _TwoFactorAuthFormComponent = _interopRequireDefault(require("./TwoFactorAuthFormComponent"));
|
|
10
11
|
var _authActions = require("../../redux/actions/authActions");
|
|
12
|
+
var _withOneSubmission = _interopRequireWildcard(require("../../hocs/withOneSubmission"));
|
|
11
13
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
14
|
+
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); }
|
|
12
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
|
-
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 }; })(); }
|
|
14
|
-
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); }
|
|
15
|
-
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); }
|
|
16
|
-
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); }); }; }
|
|
17
16
|
var mapStateToProps = function mapStateToProps(state) {
|
|
18
17
|
return {
|
|
19
18
|
is2FARequired: state.auth.is2FARequired,
|
|
19
|
+
twoFAType: state.auth.twoFAType,
|
|
20
|
+
passkeyOnly: !!state.auth.passkeyOnly,
|
|
20
21
|
Code: (0, _get["default"])(state, 'form.twoFactorAuth.values.code', ''),
|
|
21
22
|
error: (0, _get["default"])(state, 'form.twoFactorAuth.error', false)
|
|
22
23
|
};
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
25
|
+
|
|
26
|
+
// Resolves once the passkey signed the user in; rejects with the message to show otherwise. Holds the shared
|
|
27
|
+
// submission from the click (browser prompt included) until the gateway replies, so a code sends nothing meanwhile.
|
|
28
|
+
var mapDispatchToProps = exports.mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
29
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
30
|
+
_ref$submission = _ref.submission,
|
|
31
|
+
submission = _ref$submission === void 0 ? {} : _ref$submission;
|
|
32
|
+
return {
|
|
33
|
+
onPasskey: function onPasskey() {
|
|
34
|
+
return (0, _withOneSubmission.answerOnce)(submission, function () {
|
|
35
|
+
return dispatch((0, _authActions.sendTwoFactorPasskey)()).then(function (item) {
|
|
36
|
+
if (item.type === _authActions.AUTH_ERROR) {
|
|
37
|
+
throw new _reduxForm.SubmissionError({
|
|
38
|
+
_error: item.payload.errorMsg || 'Passkey sign-in failed. Please try again.'
|
|
41
39
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, _callee);
|
|
46
|
-
}));
|
|
47
|
-
function onSubmit(_x, _x2) {
|
|
48
|
-
return _onSubmit.apply(this, arguments);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
49
43
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// A code submitted while a passkey answer holds the submission sends nothing: that answer is the one sent.
|
|
48
|
+
var onSubmit = exports.onSubmit = function onSubmit(payload, dispatch) {
|
|
49
|
+
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
50
|
+
_ref2$submission = _ref2.submission,
|
|
51
|
+
submission = _ref2$submission === void 0 ? {} : _ref2$submission;
|
|
52
|
+
return (0, _withOneSubmission.answerOnce)(submission, function () {
|
|
53
|
+
return dispatch((0, _authActions.sendTwoFactorAuthCode)(payload.code)).then(function (item) {
|
|
54
|
+
if (item.type === _authActions.AUTH_ERROR) {
|
|
55
|
+
throw new _reduxForm.SubmissionError({
|
|
56
|
+
_error: 'Invalid Auth Code. Please try again.'
|
|
57
|
+
//t('Invalid Auth Code. Please try again.')
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var TwoFactorAuthFormContainer = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_TwoFactorAuthFormComponent["default"]);
|
|
65
|
+
|
|
66
|
+
// Above the form, so that its onSubmit and the passkey answer share one submission.
|
|
67
|
+
var TwoFactorAuthFormContainerForm = (0, _withOneSubmission["default"])((0, _reduxForm.reduxForm)({
|
|
68
|
+
form: 'twoFactorAuth',
|
|
69
|
+
onSubmit: onSubmit
|
|
70
|
+
})(TwoFactorAuthFormContainer));
|
|
53
71
|
var _default = exports["default"] = TwoFactorAuthFormContainerForm;
|
|
@@ -112,7 +112,8 @@ var InnerInput = /*#__PURE__*/function (_React$Component) {
|
|
|
112
112
|
info = _this$props2.info,
|
|
113
113
|
meta = _this$props2.meta,
|
|
114
114
|
label = _this$props2.label,
|
|
115
|
-
customClass = _this$props2.customClass
|
|
115
|
+
customClass = _this$props2.customClass,
|
|
116
|
+
disabled = _this$props2.disabled;
|
|
116
117
|
var bemClasses = (0, _cssClassesHelper.getBEMClasses)(baseClass, customClass);
|
|
117
118
|
var inputs = this.state.values.map(function (value, index) {
|
|
118
119
|
return /*#__PURE__*/_react["default"].createElement("input", {
|
|
@@ -126,6 +127,7 @@ var InnerInput = /*#__PURE__*/function (_React$Component) {
|
|
|
126
127
|
},
|
|
127
128
|
value: _this3.state.values[index],
|
|
128
129
|
autoFocus: !index,
|
|
130
|
+
disabled: disabled,
|
|
129
131
|
onPaste: _this3.handlePaste
|
|
130
132
|
});
|
|
131
133
|
});
|
|
@@ -156,6 +158,7 @@ APAutoTabInput.propTypes = {
|
|
|
156
158
|
type: _propTypes["default"].string,
|
|
157
159
|
customClass: _propTypes["default"].string,
|
|
158
160
|
numberOfInputs: _propTypes["default"].number.isRequired,
|
|
159
|
-
maxLength: _propTypes["default"].number
|
|
161
|
+
maxLength: _propTypes["default"].number,
|
|
162
|
+
disabled: _propTypes["default"].bool
|
|
160
163
|
};
|
|
161
164
|
var _default = exports["default"] = APAutoTabInput;
|
|
@@ -48,7 +48,9 @@ var InnerSelect = exports.InnerSelect = function InnerSelect(props) {
|
|
|
48
48
|
key: "".concat(idx, "-").concat(i.value),
|
|
49
49
|
value: i.value,
|
|
50
50
|
disabled: i.disabled,
|
|
51
|
-
selected: i.selected
|
|
51
|
+
selected: i.selected,
|
|
52
|
+
title: i.title,
|
|
53
|
+
"data-test": i.dataTest
|
|
52
54
|
}, i.label);
|
|
53
55
|
})), /*#__PURE__*/_react["default"].createElement("small", {
|
|
54
56
|
className: "form-text-muted ".concat(baseClasses('select-info'))
|
package/lib/config/CONFIG.md
CHANGED
|
@@ -16,6 +16,10 @@ Time display format based on the [date-fns format tokens](https://date-fns.org/v
|
|
|
16
16
|
|
|
17
17
|
A combination of the above, e.g. `MM/DD/YYYY HH:mm`.
|
|
18
18
|
|
|
19
|
+
## authTimeout: _integer_
|
|
20
|
+
|
|
21
|
+
Milliseconds to wait for WebAuthenticateUser when restoring a session from a stored token before the token is dropped and the page reloads. `0` (default) waits indefinitely.
|
|
22
|
+
|
|
19
23
|
# KYC
|
|
20
24
|
|
|
21
25
|
## MinimumVerificationLevel: _integer_
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.submitButtonTextOptions = exports.sellValue = exports.orderTypes = exports.futuresOrderTypes = exports.futuresOrderFormTypes = exports.buyValue = exports.advancedOrderFormTypes = void 0;
|
|
6
|
+
exports.submitButtonTextOptions = exports.sellValue = exports.orderTypes = exports.futuresOrderTypes = exports.futuresOrderFormTypes = exports.defaultOrderFormTypes = exports.configurableOrderFormTypes = exports.buyValue = exports.advancedOrderFormTypes = void 0;
|
|
7
7
|
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); }
|
|
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; }
|
|
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; }
|
|
8
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; }
|
|
9
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
10
12
|
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); }
|
|
@@ -61,6 +63,14 @@ var orderTypes = exports.orderTypes = {
|
|
|
61
63
|
orderType: '2',
|
|
62
64
|
displayName: 'Reserve Order'
|
|
63
65
|
},
|
|
66
|
+
// Time-weighted average price: a matching-engine order type (13) built like a reserve order. The
|
|
67
|
+
// form takes a duration and a number of slices; placeOrderHelper turns them into the GTD
|
|
68
|
+
// ExpireTime and the DisplayQuantity slice the engine releases on. See helpers/twapOrderHelper.js.
|
|
69
|
+
//t('TWAP')
|
|
70
|
+
twap: {
|
|
71
|
+
orderType: '13',
|
|
72
|
+
displayName: 'TWAP'
|
|
73
|
+
},
|
|
64
74
|
//t('Spot')
|
|
65
75
|
spot: {
|
|
66
76
|
orderType: '2',
|
|
@@ -94,17 +104,26 @@ var futuresOrderTypes = exports.futuresOrderTypes = {
|
|
|
94
104
|
displayName: 'Conditional'
|
|
95
105
|
}
|
|
96
106
|
};
|
|
97
|
-
|
|
107
|
+
|
|
108
|
+
// The Order Entry panel always lists these: the form starts on Limit Order and the order-book
|
|
109
|
+
// handlers set Market or Limit Order, so they must never be filtered out.
|
|
110
|
+
var defaultOrderFormTypes = exports.defaultOrderFormTypes = {
|
|
98
111
|
market: orderTypes.market,
|
|
99
112
|
limit: orderTypes.limit,
|
|
100
113
|
stopMarket: orderTypes.stopMarket,
|
|
101
|
-
stopLimit: orderTypes.stopLimit
|
|
114
|
+
stopLimit: orderTypes.stopLimit
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// The Order Entry panel lists these only when Spot/MarginAllowedOrderTypes allow them.
|
|
118
|
+
var configurableOrderFormTypes = exports.configurableOrderFormTypes = {
|
|
102
119
|
trailingStopMarket: orderTypes.trailingStopMarket,
|
|
103
120
|
trailingStopLimit: orderTypes.trailingStopLimit,
|
|
104
121
|
fillOrKill: orderTypes.fillOrKill,
|
|
105
122
|
immediateOrCancel: orderTypes.immediateOrCancel,
|
|
106
|
-
reserveOrder: orderTypes.reserveOrder
|
|
123
|
+
reserveOrder: orderTypes.reserveOrder,
|
|
124
|
+
twap: orderTypes.twap
|
|
107
125
|
};
|
|
126
|
+
var advancedOrderFormTypes = exports.advancedOrderFormTypes = _objectSpread(_objectSpread({}, defaultOrderFormTypes), configurableOrderFormTypes);
|
|
108
127
|
var futuresOrderFormTypes = exports.futuresOrderFormTypes = {
|
|
109
128
|
market: futuresOrderTypes.market,
|
|
110
129
|
limit: futuresOrderTypes.limit,
|
|
@@ -8,5 +8,7 @@ var timeInForceForOrderType = exports.timeInForceForOrderType = {
|
|
|
8
8
|
'Reserve Order': 0,
|
|
9
9
|
'Good till Cancel': 1,
|
|
10
10
|
'Immediate or Cancel': 3,
|
|
11
|
-
'Fill Or Kill': 4
|
|
11
|
+
'Fill Or Kill': 4,
|
|
12
|
+
// A TWAP is always Good till Date (6): its ExpireTime is the end of the slice schedule.
|
|
13
|
+
TWAP: 6
|
|
12
14
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.twapRejectReasonText = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Reject reasons the gateway, OMS and matching engine return for a TWAP (apex
|
|
9
|
+
* OMSMessages/RejectHelper.cs 10534-10539), mapped to text the trader can act on. SendOrder returns
|
|
10
|
+
* them as `errormsg` with status Rejected. Anything not listed here falls through to the generic
|
|
11
|
+
* "Your order was rejected" snackbar.
|
|
12
|
+
*/
|
|
13
|
+
var twapRejectReasonText = exports.twapRejectReasonText = {
|
|
14
|
+
// t('The TWAP duration must end in the future')
|
|
15
|
+
Twap_Invalid_Expiration: 'The TWAP duration must end in the future',
|
|
16
|
+
// t('The TWAP slice must be greater than zero and not more than the order amount')
|
|
17
|
+
Twap_Invalid_Slice_Quantity: 'The TWAP slice must be greater than zero and not more than the order amount',
|
|
18
|
+
// t("The TWAP slice is below the instrument's minimum quantity. Increase the amount or use fewer slices")
|
|
19
|
+
Twap_Slice_Below_Minimum: "The TWAP slice is below the instrument's minimum quantity. Increase the amount or use fewer slices",
|
|
20
|
+
// t('TWAP orders must be Good till Date')
|
|
21
|
+
Twap_Invalid_Time_In_Force: 'TWAP orders must be Good till Date',
|
|
22
|
+
// t('A TWAP buy needs a Limit Price or an Order Total')
|
|
23
|
+
Twap_Buy_Needs_Price_Or_Value: 'A TWAP buy needs a Limit Price or an Order Total',
|
|
24
|
+
// t('TWAP orders are not available for this account')
|
|
25
|
+
Twap_Not_Allowed_For_Account: 'TWAP orders are not available for this account'
|
|
26
|
+
};
|
|
@@ -5,8 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getOrderPriceToDisplay = exports.getFuturesOrderPriceToDisplay = void 0;
|
|
7
7
|
var _numberFormatter = require("./numberFormatter");
|
|
8
|
+
/** A market-form TWAP (no limit price) is reported with a Price of 0: each slice takes the market. */
|
|
9
|
+
var isMarketTwap = function isMarketTwap(order) {
|
|
10
|
+
return order.OrderType === 'TWAP' && Number(order.Price) === 0;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The Price column of the order tables. `t` translates the "Market" placeholder a priceless order
|
|
15
|
+
* shows; the identity default keeps callers that only ever have a price unchanged.
|
|
16
|
+
*/
|
|
8
17
|
var getOrderPriceToDisplay = exports.getOrderPriceToDisplay = function getOrderPriceToDisplay(order, decimalPlaces) {
|
|
9
|
-
|
|
18
|
+
var t = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (s) {
|
|
19
|
+
return s;
|
|
20
|
+
};
|
|
21
|
+
return order.trailingPrice ? order.trailingPrice : isMarketTwap(order) ? t('Market') : order.Price ? (0, _numberFormatter.formatNumberToLocale)(order.Price, decimalPlaces || order.Price.symbol) : '';
|
|
10
22
|
};
|
|
11
23
|
var getFuturesOrderPriceToDisplay = exports.getFuturesOrderPriceToDisplay = function getFuturesOrderPriceToDisplay(order, decimalPlaces) {
|
|
12
24
|
return order.trailingPrice ? order.trailingPrice : order.Price != null ? (0, _numberFormatter.formatNumberToLocale)(order.Price, decimalPlaces || order.Price.symbol) : '';
|
|
@@ -41,11 +41,56 @@ describe('orderHistoryHelper', function () {
|
|
|
41
41
|
var result = getOrderPriceToDisplay(order, 2);
|
|
42
42
|
expect(result).toBe('');
|
|
43
43
|
});
|
|
44
|
+
it('shows a market-form TWAP (price 0) as Market, translated', function () {
|
|
45
|
+
var _require5 = require('./orderHistoryHelper'),
|
|
46
|
+
getOrderPriceToDisplay = _require5.getOrderPriceToDisplay;
|
|
47
|
+
var BigNumber = require('bignumber.js');
|
|
48
|
+
var t = function t(key) {
|
|
49
|
+
return "t:".concat(key);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// The open-orders selector wraps Price in a currency BigNumber, which is truthy even at 0.
|
|
53
|
+
var order = {
|
|
54
|
+
OrderType: 'TWAP',
|
|
55
|
+
Price: new BigNumber(0)
|
|
56
|
+
};
|
|
57
|
+
order.Price.symbol = 'USD';
|
|
58
|
+
expect(getOrderPriceToDisplay(order, 2, t)).toBe('t:Market');
|
|
59
|
+
expect(getOrderPriceToDisplay({
|
|
60
|
+
OrderType: 'TWAP',
|
|
61
|
+
Price: 0
|
|
62
|
+
}, 2, t)).toBe('t:Market');
|
|
63
|
+
expect(getOrderPriceToDisplay({
|
|
64
|
+
OrderType: 'TWAP',
|
|
65
|
+
Price: 0
|
|
66
|
+
}, 2)).toBe('Market');
|
|
67
|
+
});
|
|
68
|
+
it('shows a limit-form TWAP at its price', function () {
|
|
69
|
+
var _require6 = require('./orderHistoryHelper'),
|
|
70
|
+
getOrderPriceToDisplay = _require6.getOrderPriceToDisplay;
|
|
71
|
+
var BigNumber = require('bignumber.js');
|
|
72
|
+
var order = {
|
|
73
|
+
OrderType: 'TWAP',
|
|
74
|
+
Price: new BigNumber('100.1234')
|
|
75
|
+
};
|
|
76
|
+
order.Price.symbol = 'USD';
|
|
77
|
+
expect(getOrderPriceToDisplay(order, 2)).toBe('100.12');
|
|
78
|
+
});
|
|
79
|
+
it('keeps a zero price of another order type blank', function () {
|
|
80
|
+
var _require7 = require('./orderHistoryHelper'),
|
|
81
|
+
getOrderPriceToDisplay = _require7.getOrderPriceToDisplay;
|
|
82
|
+
expect(getOrderPriceToDisplay({
|
|
83
|
+
OrderType: 'Limit',
|
|
84
|
+
Price: 0
|
|
85
|
+
}, 2, function (key) {
|
|
86
|
+
return key;
|
|
87
|
+
})).toBe('');
|
|
88
|
+
});
|
|
44
89
|
});
|
|
45
90
|
describe('getFuturesOrderPriceToDisplay', function () {
|
|
46
91
|
it('returns trailingPrice if such field exists in the order', function () {
|
|
47
|
-
var
|
|
48
|
-
getFuturesOrderPriceToDisplay =
|
|
92
|
+
var _require8 = require('./orderHistoryHelper'),
|
|
93
|
+
getFuturesOrderPriceToDisplay = _require8.getFuturesOrderPriceToDisplay;
|
|
49
94
|
var BigNumber = require('bignumber.js');
|
|
50
95
|
var order = {
|
|
51
96
|
Price: new BigNumber('100'),
|
|
@@ -56,8 +101,8 @@ describe('orderHistoryHelper', function () {
|
|
|
56
101
|
expect(result).toEqual('TRL');
|
|
57
102
|
});
|
|
58
103
|
it('returns formatted Price if there is no trailingPrice', function () {
|
|
59
|
-
var
|
|
60
|
-
getFuturesOrderPriceToDisplay =
|
|
104
|
+
var _require9 = require('./orderHistoryHelper'),
|
|
105
|
+
getFuturesOrderPriceToDisplay = _require9.getFuturesOrderPriceToDisplay;
|
|
61
106
|
var BigNumber = require('bignumber.js');
|
|
62
107
|
var order = {
|
|
63
108
|
Price: new BigNumber('100.1234')
|
|
@@ -67,8 +112,8 @@ describe('orderHistoryHelper', function () {
|
|
|
67
112
|
expect(result).toEqual('100.12');
|
|
68
113
|
});
|
|
69
114
|
it('returns formatted Price when Price is 0 (not null/undefined)', function () {
|
|
70
|
-
var
|
|
71
|
-
getFuturesOrderPriceToDisplay =
|
|
115
|
+
var _require0 = require('./orderHistoryHelper'),
|
|
116
|
+
getFuturesOrderPriceToDisplay = _require0.getFuturesOrderPriceToDisplay;
|
|
72
117
|
var order = {
|
|
73
118
|
Price: 0
|
|
74
119
|
};
|
|
@@ -76,8 +121,8 @@ describe('orderHistoryHelper', function () {
|
|
|
76
121
|
expect(result).toEqual('0.00');
|
|
77
122
|
});
|
|
78
123
|
it('returns empty string if Price is null', function () {
|
|
79
|
-
var
|
|
80
|
-
getFuturesOrderPriceToDisplay =
|
|
124
|
+
var _require1 = require('./orderHistoryHelper'),
|
|
125
|
+
getFuturesOrderPriceToDisplay = _require1.getFuturesOrderPriceToDisplay;
|
|
81
126
|
var order = {
|
|
82
127
|
Price: null
|
|
83
128
|
};
|
|
@@ -85,8 +130,8 @@ describe('orderHistoryHelper', function () {
|
|
|
85
130
|
expect(result).toBe('');
|
|
86
131
|
});
|
|
87
132
|
it('returns empty string if Price is undefined', function () {
|
|
88
|
-
var
|
|
89
|
-
getFuturesOrderPriceToDisplay =
|
|
133
|
+
var _require10 = require('./orderHistoryHelper'),
|
|
134
|
+
getFuturesOrderPriceToDisplay = _require10.getFuturesOrderPriceToDisplay;
|
|
90
135
|
var order = {};
|
|
91
136
|
var result = getFuturesOrderPriceToDisplay(order, 2);
|
|
92
137
|
expect(result).toBe('');
|
|
@@ -94,9 +139,9 @@ describe('orderHistoryHelper', function () {
|
|
|
94
139
|
});
|
|
95
140
|
describe('getOrderPriceToDisplay vs getFuturesOrderPriceToDisplay', function () {
|
|
96
141
|
it('handles Price: 0 differently between the two functions', function () {
|
|
97
|
-
var
|
|
98
|
-
getOrderPriceToDisplay =
|
|
99
|
-
getFuturesOrderPriceToDisplay =
|
|
142
|
+
var _require11 = require('./orderHistoryHelper'),
|
|
143
|
+
getOrderPriceToDisplay = _require11.getOrderPriceToDisplay,
|
|
144
|
+
getFuturesOrderPriceToDisplay = _require11.getFuturesOrderPriceToDisplay;
|
|
100
145
|
var order = {
|
|
101
146
|
Price: 0
|
|
102
147
|
};
|