@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
|
@@ -329,16 +329,197 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
329
329
|
}, _callee1);
|
|
330
330
|
})));
|
|
331
331
|
});
|
|
332
|
+
describe('unlinkOAuthIdentity()', function () {
|
|
333
|
+
var callback = {
|
|
334
|
+
code: 'the-code',
|
|
335
|
+
state: 'the-state'
|
|
336
|
+
};
|
|
337
|
+
it('sends the SSO code, verifier and password, then signs out with a snack on success', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
338
|
+
var result;
|
|
339
|
+
return _regenerator().w(function (_context10) {
|
|
340
|
+
while (1) switch (_context10.n) {
|
|
341
|
+
case 0:
|
|
342
|
+
armSession();
|
|
343
|
+
rpcResolves({
|
|
344
|
+
Unlinked: true,
|
|
345
|
+
SessionsLoggedOff: 2
|
|
346
|
+
});
|
|
347
|
+
_context10.n = 1;
|
|
348
|
+
return store.dispatch((0, _authActions.unlinkOAuthIdentity)(callback, 'hunter2'));
|
|
349
|
+
case 1:
|
|
350
|
+
result = _context10.v;
|
|
351
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('UnlinkOAuthIdentity', {
|
|
352
|
+
AccessCode: 'the-code',
|
|
353
|
+
CodeVerifier: 'the-verifier',
|
|
354
|
+
RedirectUrl: expect.any(String),
|
|
355
|
+
Password: 'hunter2'
|
|
356
|
+
});
|
|
357
|
+
expect(result.Unlinked).toBe(true);
|
|
358
|
+
expect(store.getActions().map(function (a) {
|
|
359
|
+
return a.type;
|
|
360
|
+
})).toContain('AUTH_NONE');
|
|
361
|
+
expect(store.getActions()).toContainEqual({
|
|
362
|
+
type: 'SHOW_SNACK',
|
|
363
|
+
payload: expect.objectContaining({
|
|
364
|
+
text: 'SSO has been disabled for your account. Please sign in with your password.',
|
|
365
|
+
type: 'success'
|
|
366
|
+
})
|
|
367
|
+
});
|
|
368
|
+
case 2:
|
|
369
|
+
return _context10.a(2);
|
|
370
|
+
}
|
|
371
|
+
}, _callee10);
|
|
372
|
+
})));
|
|
373
|
+
it('clears the state and verifier so a refused code cannot be replayed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
374
|
+
return _regenerator().w(function (_context11) {
|
|
375
|
+
while (1) switch (_context11.n) {
|
|
376
|
+
case 0:
|
|
377
|
+
armSession();
|
|
378
|
+
rpcResolves({
|
|
379
|
+
Unlinked: false,
|
|
380
|
+
errormsg: 'Sign in again with your SSO provider to disable SSO.'
|
|
381
|
+
});
|
|
382
|
+
_context11.n = 1;
|
|
383
|
+
return store.dispatch((0, _authActions.unlinkOAuthIdentity)(callback, 'pw'));
|
|
384
|
+
case 1:
|
|
385
|
+
expect(sessionStorage.getItem(STATE_KEY)).toBeNull();
|
|
386
|
+
expect(sessionStorage.getItem(VERIFIER_KEY)).toBeNull();
|
|
387
|
+
case 2:
|
|
388
|
+
return _context11.a(2);
|
|
389
|
+
}
|
|
390
|
+
}, _callee11);
|
|
391
|
+
})));
|
|
392
|
+
it('does not call UnlinkOAuthIdentity when the returned state does not match', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
393
|
+
var result;
|
|
394
|
+
return _regenerator().w(function (_context12) {
|
|
395
|
+
while (1) switch (_context12.n) {
|
|
396
|
+
case 0:
|
|
397
|
+
armSession();
|
|
398
|
+
_context12.n = 1;
|
|
399
|
+
return store.dispatch((0, _authActions.unlinkOAuthIdentity)({
|
|
400
|
+
code: 'the-code',
|
|
401
|
+
state: 'a-different-state'
|
|
402
|
+
}, 'pw'));
|
|
403
|
+
case 1:
|
|
404
|
+
result = _context12.v;
|
|
405
|
+
expect(_apex["default"].connection.RPCPromise).not.toHaveBeenCalled();
|
|
406
|
+
expect(result).toEqual({
|
|
407
|
+
Unlinked: false,
|
|
408
|
+
errormsg: 'Unlinking failed. Please try again.'
|
|
409
|
+
});
|
|
410
|
+
case 2:
|
|
411
|
+
return _context12.a(2);
|
|
412
|
+
}
|
|
413
|
+
}, _callee12);
|
|
414
|
+
})));
|
|
415
|
+
it('treats a provider error as a cancelled confirmation and does not call the gateway', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
416
|
+
var warn, result;
|
|
417
|
+
return _regenerator().w(function (_context13) {
|
|
418
|
+
while (1) switch (_context13.n) {
|
|
419
|
+
case 0:
|
|
420
|
+
armSession();
|
|
421
|
+
warn = jest.spyOn(console, 'warn').mockImplementation(function () {});
|
|
422
|
+
_context13.n = 1;
|
|
423
|
+
return store.dispatch((0, _authActions.unlinkOAuthIdentity)({
|
|
424
|
+
error: 'access_denied',
|
|
425
|
+
errorDescription: 'Call support at 1-555-0100'
|
|
426
|
+
}, 'pw'));
|
|
427
|
+
case 1:
|
|
428
|
+
result = _context13.v;
|
|
429
|
+
expect(_apex["default"].connection.RPCPromise).not.toHaveBeenCalled();
|
|
430
|
+
expect(result).toEqual({
|
|
431
|
+
Unlinked: false,
|
|
432
|
+
cancelled: true
|
|
433
|
+
});
|
|
434
|
+
expect(warn).toHaveBeenCalledWith(expect.any(String), 'access_denied', 'Call support at 1-555-0100');
|
|
435
|
+
case 2:
|
|
436
|
+
return _context13.a(2);
|
|
437
|
+
}
|
|
438
|
+
}, _callee13);
|
|
439
|
+
})));
|
|
440
|
+
|
|
441
|
+
// The dialog renders the gateway's refusal verbatim, so the thunk hands it back untranslated
|
|
442
|
+
// and shows no snack of its own.
|
|
443
|
+
it('returns the gateway refusal verbatim and keeps the session when refused', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
444
|
+
var errormsg, result;
|
|
445
|
+
return _regenerator().w(function (_context14) {
|
|
446
|
+
while (1) switch (_context14.n) {
|
|
447
|
+
case 0:
|
|
448
|
+
armSession();
|
|
449
|
+
errormsg = 'This sign-in does not match the SSO identity linked to this account.';
|
|
450
|
+
rpcResolves({
|
|
451
|
+
Unlinked: false,
|
|
452
|
+
errormsg: errormsg
|
|
453
|
+
});
|
|
454
|
+
_context14.n = 1;
|
|
455
|
+
return store.dispatch((0, _authActions.unlinkOAuthIdentity)(callback, 'pw'));
|
|
456
|
+
case 1:
|
|
457
|
+
result = _context14.v;
|
|
458
|
+
expect(result).toEqual({
|
|
459
|
+
Unlinked: false,
|
|
460
|
+
errormsg: errormsg
|
|
461
|
+
});
|
|
462
|
+
expect(store.getActions()).toEqual([]);
|
|
463
|
+
case 2:
|
|
464
|
+
return _context14.a(2);
|
|
465
|
+
}
|
|
466
|
+
}, _callee14);
|
|
467
|
+
})));
|
|
468
|
+
it('falls back to a generic message when the gateway refuses without text', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
|
|
469
|
+
var result;
|
|
470
|
+
return _regenerator().w(function (_context15) {
|
|
471
|
+
while (1) switch (_context15.n) {
|
|
472
|
+
case 0:
|
|
473
|
+
armSession();
|
|
474
|
+
rpcResolves({
|
|
475
|
+
Unlinked: false
|
|
476
|
+
});
|
|
477
|
+
_context15.n = 1;
|
|
478
|
+
return store.dispatch((0, _authActions.unlinkOAuthIdentity)(callback, 'pw'));
|
|
479
|
+
case 1:
|
|
480
|
+
result = _context15.v;
|
|
481
|
+
expect(result.errormsg).toBe('Unlinking failed. Please try again.');
|
|
482
|
+
case 2:
|
|
483
|
+
return _context15.a(2);
|
|
484
|
+
}
|
|
485
|
+
}, _callee15);
|
|
486
|
+
})));
|
|
487
|
+
it('reports failure rather than signing out when the call throws', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
488
|
+
var error, result;
|
|
489
|
+
return _regenerator().w(function (_context16) {
|
|
490
|
+
while (1) switch (_context16.n) {
|
|
491
|
+
case 0:
|
|
492
|
+
armSession();
|
|
493
|
+
error = jest.spyOn(console, 'error').mockImplementation(function () {});
|
|
494
|
+
_apex["default"].connection.RPCPromise.mockRejectedValueOnce(new Error('socket closed'));
|
|
495
|
+
_context16.n = 1;
|
|
496
|
+
return store.dispatch((0, _authActions.unlinkOAuthIdentity)(callback, 'pw'));
|
|
497
|
+
case 1:
|
|
498
|
+
result = _context16.v;
|
|
499
|
+
expect(result).toEqual({
|
|
500
|
+
Unlinked: false,
|
|
501
|
+
errormsg: 'Unlinking failed. Please try again.'
|
|
502
|
+
});
|
|
503
|
+
expect(store.getActions().map(function (a) {
|
|
504
|
+
return a.type;
|
|
505
|
+
})).not.toContain('AUTH_NONE');
|
|
506
|
+
expect(error).toHaveBeenCalled();
|
|
507
|
+
case 2:
|
|
508
|
+
return _context16.a(2);
|
|
509
|
+
}
|
|
510
|
+
}, _callee16);
|
|
511
|
+
})));
|
|
512
|
+
});
|
|
332
513
|
describe('completeFusionAuthCallback()', function () {
|
|
333
514
|
// Anyone can hand a user a /fusionauth/callback link carrying arbitrary error_description
|
|
334
515
|
// copy, which would then render as this site's own message.
|
|
335
|
-
it('shows its own message rather than the provider’s error_description', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
516
|
+
it('shows its own message rather than the provider’s error_description', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
|
|
336
517
|
var warn;
|
|
337
|
-
return _regenerator().w(function (
|
|
338
|
-
while (1) switch (
|
|
518
|
+
return _regenerator().w(function (_context17) {
|
|
519
|
+
while (1) switch (_context17.n) {
|
|
339
520
|
case 0:
|
|
340
521
|
warn = jest.spyOn(console, 'warn').mockImplementation(function () {});
|
|
341
|
-
|
|
522
|
+
_context17.n = 1;
|
|
342
523
|
return store.dispatch((0, _authActions.completeFusionAuthCallback)({
|
|
343
524
|
error: 'access_denied',
|
|
344
525
|
errorDescription: 'Your account is locked. Call support at 1-555-0100'
|
|
@@ -352,17 +533,17 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
352
533
|
});
|
|
353
534
|
expect(warn).toHaveBeenCalledWith(expect.any(String), 'access_denied', 'Your account is locked. Call support at 1-555-0100');
|
|
354
535
|
case 2:
|
|
355
|
-
return
|
|
536
|
+
return _context17.a(2);
|
|
356
537
|
}
|
|
357
|
-
},
|
|
538
|
+
}, _callee17);
|
|
358
539
|
})));
|
|
359
|
-
it('clears the PKCE keys on the error path, so they cannot be reused', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
360
|
-
return _regenerator().w(function (
|
|
361
|
-
while (1) switch (
|
|
540
|
+
it('clears the PKCE keys on the error path, so they cannot be reused', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
541
|
+
return _regenerator().w(function (_context18) {
|
|
542
|
+
while (1) switch (_context18.n) {
|
|
362
543
|
case 0:
|
|
363
544
|
jest.spyOn(console, 'warn').mockImplementation(function () {});
|
|
364
545
|
armSession();
|
|
365
|
-
|
|
546
|
+
_context18.n = 1;
|
|
366
547
|
return store.dispatch((0, _authActions.completeFusionAuthCallback)({
|
|
367
548
|
error: 'access_denied'
|
|
368
549
|
}));
|
|
@@ -370,17 +551,17 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
370
551
|
expect(sessionStorage.getItem(STATE_KEY)).toBeNull();
|
|
371
552
|
expect(sessionStorage.getItem(VERIFIER_KEY)).toBeNull();
|
|
372
553
|
case 2:
|
|
373
|
-
return
|
|
554
|
+
return _context18.a(2);
|
|
374
555
|
}
|
|
375
|
-
},
|
|
556
|
+
}, _callee18);
|
|
376
557
|
})));
|
|
377
558
|
|
|
378
559
|
// A gateway that never comes up left the callback page on 'Signing you in...' indefinitely:
|
|
379
560
|
// connectAndAuthenticate's promise never settled, so nothing dispatched an error for it.
|
|
380
|
-
it('reports a gateway it could not reach instead of spinning forever', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
561
|
+
it('reports a gateway it could not reach instead of spinning forever', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
|
|
381
562
|
var closeSocket, pending;
|
|
382
|
-
return _regenerator().w(function (
|
|
383
|
-
while (1) switch (
|
|
563
|
+
return _regenerator().w(function (_context19) {
|
|
564
|
+
while (1) switch (_context19.n) {
|
|
384
565
|
case 0:
|
|
385
566
|
_apex.initApex.mockImplementation(function (_onopen, onclose) {
|
|
386
567
|
closeSocket = onclose;
|
|
@@ -391,7 +572,7 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
391
572
|
state: 'the-state'
|
|
392
573
|
}));
|
|
393
574
|
closeSocket();
|
|
394
|
-
|
|
575
|
+
_context19.n = 1;
|
|
395
576
|
return pending;
|
|
396
577
|
case 1:
|
|
397
578
|
expect(store.getActions()).toContainEqual(expect.objectContaining({
|
|
@@ -401,9 +582,9 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
401
582
|
})
|
|
402
583
|
}));
|
|
403
584
|
case 2:
|
|
404
|
-
return
|
|
585
|
+
return _context19.a(2);
|
|
405
586
|
}
|
|
406
|
-
},
|
|
587
|
+
}, _callee19);
|
|
407
588
|
})));
|
|
408
589
|
});
|
|
409
590
|
|
|
@@ -443,33 +624,33 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
443
624
|
// Resolves once the flow has navigated the popup and armed its message listener; the
|
|
444
625
|
// flow's own promise settles only when the popup reports back or closes.
|
|
445
626
|
var armPopupFlow = /*#__PURE__*/function () {
|
|
446
|
-
var
|
|
627
|
+
var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(onCallbackParams) {
|
|
447
628
|
var flow, i;
|
|
448
|
-
return _regenerator().w(function (
|
|
449
|
-
while (1) switch (
|
|
629
|
+
return _regenerator().w(function (_context20) {
|
|
630
|
+
while (1) switch (_context20.n) {
|
|
450
631
|
case 0:
|
|
451
632
|
flow = store.dispatch((0, _authActions.startFusionAuthPopupStepUp)(onCallbackParams));
|
|
452
633
|
i = 0;
|
|
453
634
|
case 1:
|
|
454
635
|
if (!(i < 20 && !popup.location.replace.mock.calls.length)) {
|
|
455
|
-
|
|
636
|
+
_context20.n = 3;
|
|
456
637
|
break;
|
|
457
638
|
}
|
|
458
|
-
|
|
639
|
+
_context20.n = 2;
|
|
459
640
|
return Promise.resolve();
|
|
460
641
|
case 2:
|
|
461
642
|
i += 1;
|
|
462
|
-
|
|
643
|
+
_context20.n = 1;
|
|
463
644
|
break;
|
|
464
645
|
case 3:
|
|
465
|
-
return
|
|
646
|
+
return _context20.a(2, {
|
|
466
647
|
flow: flow
|
|
467
648
|
});
|
|
468
649
|
}
|
|
469
|
-
},
|
|
650
|
+
}, _callee20);
|
|
470
651
|
}));
|
|
471
652
|
return function armPopupFlow(_x) {
|
|
472
|
-
return
|
|
653
|
+
return _ref20.apply(this, arguments);
|
|
473
654
|
};
|
|
474
655
|
}();
|
|
475
656
|
var post = function post(data) {
|
|
@@ -482,40 +663,40 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
482
663
|
|
|
483
664
|
// Settles the flow's promise the way a user closing the hosted login would.
|
|
484
665
|
var cancelFlow = /*#__PURE__*/function () {
|
|
485
|
-
var
|
|
486
|
-
return _regenerator().w(function (
|
|
487
|
-
while (1) switch (
|
|
666
|
+
var _ref21 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(flow) {
|
|
667
|
+
return _regenerator().w(function (_context21) {
|
|
668
|
+
while (1) switch (_context21.n) {
|
|
488
669
|
case 0:
|
|
489
670
|
popup.closed = true;
|
|
490
671
|
jest.advanceTimersByTime(500);
|
|
491
|
-
|
|
672
|
+
_context21.n = 1;
|
|
492
673
|
return flow;
|
|
493
674
|
case 1:
|
|
494
|
-
return
|
|
675
|
+
return _context21.a(2);
|
|
495
676
|
}
|
|
496
|
-
},
|
|
677
|
+
}, _callee21);
|
|
497
678
|
}));
|
|
498
679
|
return function cancelFlow(_x2) {
|
|
499
|
-
return
|
|
680
|
+
return _ref21.apply(this, arguments);
|
|
500
681
|
};
|
|
501
682
|
}();
|
|
502
|
-
it('completes on a callback message from this origin', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
683
|
+
it('completes on a callback message from this origin', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
|
|
503
684
|
var onCallbackParams, _yield$armPopupFlow, flow;
|
|
504
|
-
return _regenerator().w(function (
|
|
505
|
-
while (1) switch (
|
|
685
|
+
return _regenerator().w(function (_context22) {
|
|
686
|
+
while (1) switch (_context22.n) {
|
|
506
687
|
case 0:
|
|
507
688
|
onCallbackParams = jest.fn();
|
|
508
|
-
|
|
689
|
+
_context22.n = 1;
|
|
509
690
|
return armPopupFlow(onCallbackParams);
|
|
510
691
|
case 1:
|
|
511
|
-
_yield$armPopupFlow =
|
|
692
|
+
_yield$armPopupFlow = _context22.v;
|
|
512
693
|
flow = _yield$armPopupFlow.flow;
|
|
513
694
|
post({
|
|
514
695
|
type: _authActions.FUSIONAUTH_POPUP_MESSAGE,
|
|
515
696
|
code: 'the-code',
|
|
516
697
|
state: 'the-state'
|
|
517
698
|
});
|
|
518
|
-
|
|
699
|
+
_context22.n = 2;
|
|
519
700
|
return flow;
|
|
520
701
|
case 2:
|
|
521
702
|
expect(onCallbackParams).toHaveBeenCalledWith(expect.objectContaining({
|
|
@@ -523,77 +704,77 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
523
704
|
state: 'the-state'
|
|
524
705
|
}));
|
|
525
706
|
case 3:
|
|
526
|
-
return
|
|
707
|
+
return _context22.a(2);
|
|
527
708
|
}
|
|
528
|
-
},
|
|
709
|
+
}, _callee22);
|
|
529
710
|
})));
|
|
530
|
-
it('ignores a callback message from another origin', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
711
|
+
it('ignores a callback message from another origin', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23() {
|
|
531
712
|
var onCallbackParams, _yield$armPopupFlow2, flow;
|
|
532
|
-
return _regenerator().w(function (
|
|
533
|
-
while (1) switch (
|
|
713
|
+
return _regenerator().w(function (_context23) {
|
|
714
|
+
while (1) switch (_context23.n) {
|
|
534
715
|
case 0:
|
|
535
716
|
onCallbackParams = jest.fn();
|
|
536
|
-
|
|
717
|
+
_context23.n = 1;
|
|
537
718
|
return armPopupFlow(onCallbackParams);
|
|
538
719
|
case 1:
|
|
539
|
-
_yield$armPopupFlow2 =
|
|
720
|
+
_yield$armPopupFlow2 = _context23.v;
|
|
540
721
|
flow = _yield$armPopupFlow2.flow;
|
|
541
722
|
post({
|
|
542
723
|
type: _authActions.FUSIONAUTH_POPUP_MESSAGE,
|
|
543
724
|
code: 'attacker-code',
|
|
544
725
|
state: 'the-state'
|
|
545
726
|
}, 'https://evil.example');
|
|
546
|
-
|
|
727
|
+
_context23.n = 2;
|
|
547
728
|
return Promise.resolve();
|
|
548
729
|
case 2:
|
|
549
730
|
expect(onCallbackParams).not.toHaveBeenCalled();
|
|
550
|
-
|
|
731
|
+
_context23.n = 3;
|
|
551
732
|
return cancelFlow(flow);
|
|
552
733
|
case 3:
|
|
553
|
-
return
|
|
734
|
+
return _context23.a(2);
|
|
554
735
|
}
|
|
555
|
-
},
|
|
736
|
+
}, _callee23);
|
|
556
737
|
})));
|
|
557
|
-
it('ignores a message from this origin that is not a callback message', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
738
|
+
it('ignores a message from this origin that is not a callback message', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24() {
|
|
558
739
|
var onCallbackParams, _yield$armPopupFlow3, flow;
|
|
559
|
-
return _regenerator().w(function (
|
|
560
|
-
while (1) switch (
|
|
740
|
+
return _regenerator().w(function (_context24) {
|
|
741
|
+
while (1) switch (_context24.n) {
|
|
561
742
|
case 0:
|
|
562
743
|
onCallbackParams = jest.fn();
|
|
563
|
-
|
|
744
|
+
_context24.n = 1;
|
|
564
745
|
return armPopupFlow(onCallbackParams);
|
|
565
746
|
case 1:
|
|
566
|
-
_yield$armPopupFlow3 =
|
|
747
|
+
_yield$armPopupFlow3 = _context24.v;
|
|
567
748
|
flow = _yield$armPopupFlow3.flow;
|
|
568
749
|
post({
|
|
569
750
|
type: 'something-else',
|
|
570
751
|
code: 'the-code'
|
|
571
752
|
});
|
|
572
753
|
post('not an object');
|
|
573
|
-
|
|
754
|
+
_context24.n = 2;
|
|
574
755
|
return Promise.resolve();
|
|
575
756
|
case 2:
|
|
576
757
|
expect(onCallbackParams).not.toHaveBeenCalled();
|
|
577
|
-
|
|
758
|
+
_context24.n = 3;
|
|
578
759
|
return cancelFlow(flow);
|
|
579
760
|
case 3:
|
|
580
|
-
return
|
|
761
|
+
return _context24.a(2);
|
|
581
762
|
}
|
|
582
|
-
},
|
|
763
|
+
}, _callee24);
|
|
583
764
|
})));
|
|
584
765
|
|
|
585
766
|
// A denied storage policy throws on the accessor itself; the flow must stop before the
|
|
586
767
|
// hosted page rather than send the user off to fail on the way back.
|
|
587
|
-
it('closes the popup and does not navigate when the PKCE keys cannot be stored', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
768
|
+
it('closes the popup and does not navigate when the PKCE keys cannot be stored', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25() {
|
|
588
769
|
var onCallbackParams;
|
|
589
|
-
return _regenerator().w(function (
|
|
590
|
-
while (1) switch (
|
|
770
|
+
return _regenerator().w(function (_context25) {
|
|
771
|
+
while (1) switch (_context25.n) {
|
|
591
772
|
case 0:
|
|
592
773
|
jest.spyOn(window.sessionStorage.__proto__, 'setItem').mockImplementation(function () {
|
|
593
774
|
throw new DOMException('Access is denied', 'SecurityError');
|
|
594
775
|
});
|
|
595
776
|
onCallbackParams = jest.fn();
|
|
596
|
-
|
|
777
|
+
_context25.n = 1;
|
|
597
778
|
return store.dispatch((0, _authActions.startFusionAuthPopupStepUp)(onCallbackParams));
|
|
598
779
|
case 1:
|
|
599
780
|
expect(popup.location.replace).not.toHaveBeenCalled();
|
|
@@ -602,9 +783,9 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
602
783
|
type: _authActions.AUTH_ERROR
|
|
603
784
|
});
|
|
604
785
|
case 2:
|
|
605
|
-
return
|
|
786
|
+
return _context25.a(2);
|
|
606
787
|
}
|
|
607
|
-
},
|
|
788
|
+
}, _callee25);
|
|
608
789
|
})));
|
|
609
790
|
});
|
|
610
791
|
|
|
@@ -634,16 +815,16 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
634
815
|
afterEach(function () {
|
|
635
816
|
_config["default"].FusionAuth.enabled = false;
|
|
636
817
|
});
|
|
637
|
-
it('opens the step-up modal on Authorized:false when FusionAuth is enabled', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
638
|
-
return _regenerator().w(function (
|
|
639
|
-
while (1) switch (
|
|
818
|
+
it('opens the step-up modal on Authorized:false when FusionAuth is enabled', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26() {
|
|
819
|
+
return _regenerator().w(function (_context26) {
|
|
820
|
+
while (1) switch (_context26.n) {
|
|
640
821
|
case 0:
|
|
641
822
|
_config["default"].FusionAuth.enabled = true;
|
|
642
823
|
mockWithdrawReply = {
|
|
643
824
|
result: false,
|
|
644
825
|
Authorized: false
|
|
645
826
|
};
|
|
646
|
-
|
|
827
|
+
_context26.n = 1;
|
|
647
828
|
return store.dispatch((0, _withdrawActions.submitWithdrawTicket)(payload));
|
|
648
829
|
case 1:
|
|
649
830
|
expect(store.getActions()).toContainEqual(expect.objectContaining({
|
|
@@ -652,14 +833,14 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
652
833
|
})
|
|
653
834
|
}));
|
|
654
835
|
case 2:
|
|
655
|
-
return
|
|
836
|
+
return _context26.a(2);
|
|
656
837
|
}
|
|
657
|
-
},
|
|
838
|
+
}, _callee26);
|
|
658
839
|
})));
|
|
659
|
-
it('falls through to the rejection warning when FusionAuth is disabled', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
840
|
+
it('falls through to the rejection warning when FusionAuth is disabled', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27() {
|
|
660
841
|
var names;
|
|
661
|
-
return _regenerator().w(function (
|
|
662
|
-
while (1) switch (
|
|
842
|
+
return _regenerator().w(function (_context27) {
|
|
843
|
+
while (1) switch (_context27.n) {
|
|
663
844
|
case 0:
|
|
664
845
|
_config["default"].FusionAuth.enabled = false;
|
|
665
846
|
mockWithdrawReply = {
|
|
@@ -667,7 +848,7 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
667
848
|
Authorized: false,
|
|
668
849
|
errormsg: 'Not authorized'
|
|
669
850
|
};
|
|
670
|
-
|
|
851
|
+
_context27.n = 1;
|
|
671
852
|
return store.dispatch((0, _withdrawActions.submitWithdrawTicket)(payload));
|
|
672
853
|
case 1:
|
|
673
854
|
names = store.getActions().map(function (a) {
|
|
@@ -678,27 +859,27 @@ describe('FusionAuth SSO actions (DEV-7541)', function () {
|
|
|
678
859
|
type: 'SHOW_SNACK'
|
|
679
860
|
}));
|
|
680
861
|
case 2:
|
|
681
|
-
return
|
|
862
|
+
return _context27.a(2);
|
|
682
863
|
}
|
|
683
|
-
},
|
|
864
|
+
}, _callee27);
|
|
684
865
|
})));
|
|
685
|
-
it('does not stash the withdrawal when FusionAuth is disabled', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
686
|
-
return _regenerator().w(function (
|
|
687
|
-
while (1) switch (
|
|
866
|
+
it('does not stash the withdrawal when FusionAuth is disabled', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28() {
|
|
867
|
+
return _regenerator().w(function (_context28) {
|
|
868
|
+
while (1) switch (_context28.n) {
|
|
688
869
|
case 0:
|
|
689
870
|
_config["default"].FusionAuth.enabled = false;
|
|
690
871
|
mockWithdrawReply = {
|
|
691
872
|
result: false,
|
|
692
873
|
Authorized: false
|
|
693
874
|
};
|
|
694
|
-
|
|
875
|
+
_context28.n = 1;
|
|
695
876
|
return store.dispatch((0, _withdrawActions.submitWithdrawTicket)(payload));
|
|
696
877
|
case 1:
|
|
697
878
|
expect(sessionStorage.getItem('fusionAuthPendingAction')).toBeNull();
|
|
698
879
|
case 2:
|
|
699
|
-
return
|
|
880
|
+
return _context28.a(2);
|
|
700
881
|
}
|
|
701
|
-
},
|
|
882
|
+
}, _callee28);
|
|
702
883
|
})));
|
|
703
884
|
});
|
|
704
885
|
describe('step-up stash', function () {
|
|
@@ -45,6 +45,7 @@ var MODAL_TYPES = exports.MODAL_TYPES = {
|
|
|
45
45
|
FUSION_STEP_UP: 'FUSION_STEP_UP',
|
|
46
46
|
CONFIRM_PENDING_WITHDRAW: 'CONFIRM_PENDING_WITHDRAW',
|
|
47
47
|
LINK_OAUTH_IDENTITY: 'LINK_OAUTH_IDENTITY',
|
|
48
|
+
UNLINK_OAUTH_IDENTITY: 'UNLINK_OAUTH_IDENTITY',
|
|
48
49
|
SUBMIT_LIMIT_ORDER: 'SUBMIT_LIMIT_ORDER',
|
|
49
50
|
MARGIN_DEPOSIT: 'MARGIN_DEPOSIT',
|
|
50
51
|
MARGIN_WITHDRAW: 'MARGIN_WITHDRAW',
|