@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
|
@@ -5,6 +5,7 @@ var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
|
|
|
5
5
|
var _reduxForm = require("redux-form");
|
|
6
6
|
var actions = _interopRequireWildcard(require("./orderEntryActions"));
|
|
7
7
|
var apiActions = _interopRequireWildcard(require("./apiActions"));
|
|
8
|
+
var _snackbarActions = require("./snackbarActions");
|
|
8
9
|
var placeOrderHelper = _interopRequireWildcard(require("../../helpers/placeOrderHelper"));
|
|
9
10
|
var _level2Selectors = require("../selectors/level2Selectors");
|
|
10
11
|
var _orderEntryFormConstants = require("../../constants/sendOrder/orderEntryFormConstants");
|
|
@@ -38,6 +39,15 @@ jest.mock('./apiActions', function () {
|
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
});
|
|
42
|
+
jest.mock('./snackbarActions', function () {
|
|
43
|
+
return {
|
|
44
|
+
showSnack: jest.fn(function () {
|
|
45
|
+
return {
|
|
46
|
+
type: 'showSnack'
|
|
47
|
+
};
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
});
|
|
41
51
|
jest.mock('../../redux/actions/modalActions', function () {
|
|
42
52
|
return {
|
|
43
53
|
openModal: jest.fn(function () {
|
|
@@ -411,41 +421,83 @@ describe('orderEntryActions', function () {
|
|
|
411
421
|
}, _callee7);
|
|
412
422
|
})));
|
|
413
423
|
describe('response status is not `Accepted`', function () {
|
|
414
|
-
it('should
|
|
415
|
-
var sendOrderResponse;
|
|
424
|
+
it('should show the TWAP reject reason in words when SendOrder rejects the schedule', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
416
425
|
return _regenerator().w(function (_context8) {
|
|
417
426
|
while (1) switch (_context8.n) {
|
|
427
|
+
case 0:
|
|
428
|
+
apiActions.setSendOrderResponse({
|
|
429
|
+
status: 'Rejected',
|
|
430
|
+
errormsg: 'Twap_Invalid_Expiration'
|
|
431
|
+
});
|
|
432
|
+
_context8.n = 1;
|
|
433
|
+
return store.dispatch(actions.placeOrder(_orderFormTypes.orderFormTypes.advanced, {}));
|
|
434
|
+
case 1:
|
|
435
|
+
expect(_snackbarActions.showSnack).toHaveBeenCalledWith({
|
|
436
|
+
id: 'sendOrderRejectSnackbar',
|
|
437
|
+
text: 'The TWAP duration must end in the future',
|
|
438
|
+
type: 'warning'
|
|
439
|
+
});
|
|
440
|
+
expect(_reduxForm.change).not.toHaveBeenCalled();
|
|
441
|
+
case 2:
|
|
442
|
+
return _context8.a(2);
|
|
443
|
+
}
|
|
444
|
+
}, _callee8);
|
|
445
|
+
})));
|
|
446
|
+
it('should show the TWAP reject reason when the gateway returns `result: false`', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
447
|
+
return _regenerator().w(function (_context9) {
|
|
448
|
+
while (1) switch (_context9.n) {
|
|
449
|
+
case 0:
|
|
450
|
+
apiActions.setSendOrderResponse({
|
|
451
|
+
result: false,
|
|
452
|
+
errormsg: 'Twap_Buy_Needs_Price_Or_Value'
|
|
453
|
+
});
|
|
454
|
+
_context9.n = 1;
|
|
455
|
+
return store.dispatch(actions.placeOrder(_orderFormTypes.orderFormTypes.advanced, {}));
|
|
456
|
+
case 1:
|
|
457
|
+
expect(_snackbarActions.showSnack).toHaveBeenCalledWith(expect.objectContaining({
|
|
458
|
+
text: 'A TWAP buy needs a Limit Price or an Order Total',
|
|
459
|
+
type: 'warning'
|
|
460
|
+
}));
|
|
461
|
+
case 2:
|
|
462
|
+
return _context9.a(2);
|
|
463
|
+
}
|
|
464
|
+
}, _callee9);
|
|
465
|
+
})));
|
|
466
|
+
it('should not clear default order entry form', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
467
|
+
var sendOrderResponse;
|
|
468
|
+
return _regenerator().w(function (_context0) {
|
|
469
|
+
while (1) switch (_context0.n) {
|
|
418
470
|
case 0:
|
|
419
471
|
sendOrderResponse = {
|
|
420
472
|
status: 'Rejected'
|
|
421
473
|
};
|
|
422
474
|
apiActions.setSendOrderResponse(sendOrderResponse);
|
|
423
|
-
|
|
475
|
+
_context0.n = 1;
|
|
424
476
|
return store.dispatch(actions.placeOrder(_orderFormTypes.orderFormTypes["default"]), {});
|
|
425
477
|
case 1:
|
|
426
478
|
expect(_reduxForm.change).not.toHaveBeenCalled();
|
|
427
479
|
case 2:
|
|
428
|
-
return
|
|
480
|
+
return _context0.a(2);
|
|
429
481
|
}
|
|
430
|
-
},
|
|
482
|
+
}, _callee0);
|
|
431
483
|
})));
|
|
432
|
-
it('should not clear advanced order entry form if placing order failed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
484
|
+
it('should not clear advanced order entry form if placing order failed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
433
485
|
var sendOrderResponse;
|
|
434
|
-
return _regenerator().w(function (
|
|
435
|
-
while (1) switch (
|
|
486
|
+
return _regenerator().w(function (_context1) {
|
|
487
|
+
while (1) switch (_context1.n) {
|
|
436
488
|
case 0:
|
|
437
489
|
sendOrderResponse = {
|
|
438
490
|
status: 'Rejected'
|
|
439
491
|
};
|
|
440
492
|
apiActions.setSendOrderResponse(sendOrderResponse);
|
|
441
|
-
|
|
493
|
+
_context1.n = 1;
|
|
442
494
|
return store.dispatch(actions.placeOrder(_orderFormTypes.orderFormTypes.advanced, {}));
|
|
443
495
|
case 1:
|
|
444
496
|
expect(_reduxForm.change).not.toHaveBeenCalled();
|
|
445
497
|
case 2:
|
|
446
|
-
return
|
|
498
|
+
return _context1.a(2);
|
|
447
499
|
}
|
|
448
|
-
},
|
|
500
|
+
}, _callee1);
|
|
449
501
|
})));
|
|
450
502
|
});
|
|
451
503
|
});
|
|
@@ -115,11 +115,16 @@ var subscribeToOrderHistory = exports.subscribeToOrderHistory = function subscri
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
|
|
119
|
+
// A TWAP release (the engine exposing the next slice) is a Working update, not a new order.
|
|
120
|
+
var silentChangeReasons = ['SystemCanceled_Liquidation', 'UserModified', 'SystemModified_TwapRelease'];
|
|
121
|
+
if (!silentChangeReasons.includes(x.CancelReason)) {
|
|
119
122
|
var snackBar = (0, _placeOrderHelper.getOrderEventSnackbar)(x);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
if (snackBar.text) {
|
|
124
|
+
dispatch((0, _snackbarActions.showSnack)(_objectSpread(_objectSpread({}, snackBar), {}, {
|
|
125
|
+
id: snackBar.id || 'OrderStateEventSnackbar'
|
|
126
|
+
})));
|
|
127
|
+
}
|
|
123
128
|
}
|
|
124
129
|
});
|
|
125
130
|
_orderTradesSuscriptionService["default"].subscribe(function (x) {
|
|
@@ -312,22 +317,29 @@ var getRecentActivity = exports.getRecentActivity = function getRecentActivity()
|
|
|
312
317
|
var FetchAccountTradesForOrderId = exports.FetchAccountTradesForOrderId = function FetchAccountTradesForOrderId(OrderId) {
|
|
313
318
|
return /*#__PURE__*/function () {
|
|
314
319
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(dispatch, getState) {
|
|
320
|
+
var _user$accounts$;
|
|
315
321
|
var _getState, user, AccountId, trades;
|
|
316
322
|
return _regenerator().w(function (_context4) {
|
|
317
323
|
while (1) switch (_context4.n) {
|
|
318
324
|
case 0:
|
|
319
325
|
_getState = getState(), user = _getState.user;
|
|
320
|
-
AccountId = user.accounts[0]
|
|
321
|
-
|
|
326
|
+
AccountId = (_user$accounts$ = user.accounts[0]) === null || _user$accounts$ === void 0 ? void 0 : _user$accounts$.AccountId;
|
|
327
|
+
if (!(AccountId === undefined)) {
|
|
328
|
+
_context4.n = 1;
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
return _context4.a(2);
|
|
332
|
+
case 1:
|
|
333
|
+
_context4.n = 2;
|
|
322
334
|
return dispatch((0, _apiActions.callAPI)('GetAccountTrades', {
|
|
323
335
|
AccountId: AccountId,
|
|
324
336
|
OrderId: OrderId,
|
|
325
337
|
OMSID: 1
|
|
326
338
|
}));
|
|
327
|
-
case
|
|
339
|
+
case 2:
|
|
328
340
|
trades = _context4.v;
|
|
329
341
|
dispatch(receiveAccountTradesForOrderId(trades));
|
|
330
|
-
case
|
|
342
|
+
case 3:
|
|
331
343
|
return _context4.a(2);
|
|
332
344
|
}
|
|
333
345
|
}, _callee4);
|
|
@@ -8,6 +8,7 @@ var apiActions = _interopRequireWildcard(require("./apiActions"));
|
|
|
8
8
|
var _orderStateSubscriptionService = _interopRequireDefault(require("../../services/subscriptions/orderStateSubscriptionService"));
|
|
9
9
|
var _orderTradesSuscriptionService = _interopRequireDefault(require("../../services/subscriptions/orderTradesSuscriptionService"));
|
|
10
10
|
var _orderEntryActions = require("./orderEntryActions");
|
|
11
|
+
var _snackbarActions = require("./snackbarActions");
|
|
11
12
|
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
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
14
|
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 }; })(); }
|
|
@@ -209,6 +210,68 @@ describe('order history actions', function () {
|
|
|
209
210
|
store.dispatch(actions.subscribeToOrderHistory());
|
|
210
211
|
expect(_orderEntryActions.showBuySellFailMessage).toHaveBeenCalled();
|
|
211
212
|
});
|
|
213
|
+
it('should announce a TWAP being accepted', function () {
|
|
214
|
+
_orderStateSubscriptionService["default"].setUpdateValue({
|
|
215
|
+
OrderType: 'TWAP',
|
|
216
|
+
OrderState: 'Working',
|
|
217
|
+
CancelReason: 'NewInputAccepted'
|
|
218
|
+
});
|
|
219
|
+
store.dispatch(actions.subscribeToOrderHistory());
|
|
220
|
+
expect(_snackbarActions.showSnack).toHaveBeenCalledWith(expect.objectContaining({
|
|
221
|
+
text: 'Your order has been successfully added',
|
|
222
|
+
id: 'OrderStateEventSnackbar'
|
|
223
|
+
}));
|
|
224
|
+
});
|
|
225
|
+
it('should stay silent when the engine releases the next TWAP slice', function () {
|
|
226
|
+
_orderStateSubscriptionService["default"].setUpdateValue({
|
|
227
|
+
OrderType: 'TWAP',
|
|
228
|
+
OrderState: 'Working',
|
|
229
|
+
CancelReason: 'SystemModified_TwapRelease'
|
|
230
|
+
});
|
|
231
|
+
store.dispatch(actions.subscribeToOrderHistory());
|
|
232
|
+
expect(store.getActions().find(function (a) {
|
|
233
|
+
return a.type === actions.ADD_OPEN_ORDER;
|
|
234
|
+
})).toBeDefined();
|
|
235
|
+
expect(_snackbarActions.showSnack).not.toHaveBeenCalled();
|
|
236
|
+
});
|
|
237
|
+
it('should stay silent when a TWAP slice fills', function () {
|
|
238
|
+
_orderStateSubscriptionService["default"].setUpdateValue({
|
|
239
|
+
OrderType: 'TWAP',
|
|
240
|
+
OrderState: 'Working',
|
|
241
|
+
CancelReason: 'Trade'
|
|
242
|
+
});
|
|
243
|
+
store.dispatch(actions.subscribeToOrderHistory());
|
|
244
|
+
expect(store.getActions().find(function (a) {
|
|
245
|
+
return a.type === actions.ADD_OPEN_ORDER;
|
|
246
|
+
})).toBeDefined();
|
|
247
|
+
expect(_snackbarActions.showSnack).not.toHaveBeenCalled();
|
|
248
|
+
});
|
|
249
|
+
it('should say a TWAP has fully executed when its last slice fills', function () {
|
|
250
|
+
_orderStateSubscriptionService["default"].setUpdateValue({
|
|
251
|
+
OrderType: 'TWAP',
|
|
252
|
+
OrderState: 'FullyExecuted',
|
|
253
|
+
CancelReason: 'Trade'
|
|
254
|
+
});
|
|
255
|
+
store.dispatch(actions.subscribeToOrderHistory());
|
|
256
|
+
expect(store.getActions().find(function (a) {
|
|
257
|
+
return a.type === actions.ADD_INACTIVE_ORDER;
|
|
258
|
+
})).toBeDefined();
|
|
259
|
+
expect(_snackbarActions.showSnack).toHaveBeenCalledWith(expect.objectContaining({
|
|
260
|
+
text: 'Your TWAP order has fully executed'
|
|
261
|
+
}));
|
|
262
|
+
});
|
|
263
|
+
it('should translate a TWAP reject the engine reports asynchronously', function () {
|
|
264
|
+
_orderStateSubscriptionService["default"].setUpdateValue({
|
|
265
|
+
OrderType: 'TWAP',
|
|
266
|
+
OrderState: 'Rejected',
|
|
267
|
+
RejectReason: 'Twap_Slice_Below_Minimum'
|
|
268
|
+
});
|
|
269
|
+
store.dispatch(actions.subscribeToOrderHistory());
|
|
270
|
+
expect(_snackbarActions.showSnack).toHaveBeenCalledWith(expect.objectContaining({
|
|
271
|
+
type: 'warning',
|
|
272
|
+
text: "The TWAP slice is below the instrument's minimum quantity. Increase the amount or use fewer slices"
|
|
273
|
+
}));
|
|
274
|
+
});
|
|
212
275
|
it('should subscribe to order trades updates', function () {
|
|
213
276
|
store.dispatch(actions.subscribeToOrderHistory());
|
|
214
277
|
expect(_orderTradesSuscriptionService["default"].subscribe).toHaveBeenCalled();
|