@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.
Files changed (132) hide show
  1. package/lib/apex.integration.test.js +435 -0
  2. package/lib/apex.js +37 -1
  3. package/lib/apex.test.js +138 -0
  4. package/lib/components/2FA/PasskeyOption.js +126 -0
  5. package/lib/components/2FA/TwoFactorAuthComponent.js +24 -5
  6. package/lib/components/2FA/TwoFactorAuthComponent.test.js +94 -0
  7. package/lib/components/2FA/TwoFactorAuthContainer.js +139 -27
  8. package/lib/components/2FA/TwoFactorAuthContainer.test.js +627 -0
  9. package/lib/components/AccountsDropdown/AccountsDropdownComponent.css +6 -0
  10. package/lib/components/AccountsDropdown/AccountsDropdownComponent.js +6 -2
  11. package/lib/components/AccountsDropdown/AccountsDropdownComponent.test.js +43 -0
  12. package/lib/components/AccountsDropdown/AccountsDropdownContainer.js +3 -1
  13. package/lib/components/BalancesList/BalancesListContainer.js +4 -1
  14. package/lib/components/ConfirmBlockTradeModal/ConfirmBlockTradeModalContainer.js +34 -6
  15. package/lib/components/ConfirmBlockTradeModal/ConfirmBlockTradeModalContainer.test.js +298 -0
  16. package/lib/components/ConfirmOrderModal/ConfirmOrderModalComponent.js +26 -4
  17. package/lib/components/ConfirmOrderModal/ConfirmOrderModalContainer.js +4 -1
  18. package/lib/components/DigitalAssets/digitalAssetsPriceLabel.test.js +238 -0
  19. package/lib/components/EnableTwoFactorAuth/Disable2FAForm.js +22 -7
  20. package/lib/components/EnableTwoFactorAuth/Disable2FAModal.js +15 -5
  21. package/lib/components/EnableTwoFactorAuth/Disable2FAModal.test.js +460 -0
  22. package/lib/components/EnableTwoFactorAuth/Disable2FAModalContainer.js +108 -16
  23. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +7 -0
  24. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +105 -0
  25. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.js +15 -3
  26. package/lib/components/FusionAuth/UnlinkOAuthIdentityModal.css +13 -0
  27. package/lib/components/FusionAuth/UnlinkOAuthIdentityModal.js +246 -0
  28. package/lib/components/FusionAuth/UnlinkOAuthIdentityModal.test.js +521 -0
  29. package/lib/components/InstrumentPositions/InstrumentPositionsContainer.js +4 -1
  30. package/lib/components/Login/LoginFormComponent.js +1 -1
  31. package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.js +2 -1
  32. package/lib/components/NoAccountBanner/NoAccountBanner.css +9 -0
  33. package/lib/components/NoAccountBanner/NoAccountBanner.js +58 -0
  34. package/lib/components/NoAccountBanner/index.js +16 -0
  35. package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.css +31 -0
  36. package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.js +33 -0
  37. package/lib/components/NoAccountPlaceholder/index.js +9 -0
  38. package/lib/components/OrderEntryComponents/advancedForm/AdvancedOrderFormContainer.js +2 -0
  39. package/lib/components/OrderEntryComponents/common/FormAmountFields.js +5 -0
  40. package/lib/components/OrderEntryComponents/common/TwapScheduleFields.js +98 -0
  41. package/lib/components/OrderEntryComponents/defaultForm/OrderEntryAnchoring.js +86 -39
  42. package/lib/components/OrderEntryComponents/defaultForm/OrderEntryAnchoring.test.js +326 -0
  43. package/lib/components/OrderEntryComponents/defaultForm/OrderEntryContainer.js +10 -2
  44. package/lib/components/OrderHistoryComponents/DepositsStatus/DepositsStatusComponent.js +1 -1
  45. package/lib/components/OrderHistoryComponents/DepositsStatus/DepositsStatusComponent.test.js +99 -0
  46. package/lib/components/OrderHistoryComponents/InactiveOrders/InactiveOrdersComponent.js +1 -1
  47. package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.js +1 -1
  48. package/lib/components/OrderHistoryComponents/WithdrawStatus/WithdrawStatusComponent.js +1 -1
  49. package/lib/components/OrderHistoryComponents/WithdrawStatus/WithdrawStatusComponent.test.js +113 -0
  50. package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/PasskeysSettingsCard.css +108 -0
  51. package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/PasskeysSettingsCard.test.js +983 -0
  52. package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/PasskeysSettingsCardComponent.js +500 -0
  53. package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/index.js +9 -0
  54. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.css +4 -0
  55. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.js +29 -17
  56. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.test.js +135 -0
  57. package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +12 -4
  58. package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +268 -0
  59. package/lib/components/TwoFactorAuthForm/TwoFactorAuthForm.test.js +475 -0
  60. package/lib/components/TwoFactorAuthForm/TwoFactorAuthFormComponent.js +26 -5
  61. package/lib/components/TwoFactorAuthForm/TwoFactorAuthFormContainer.js +50 -32
  62. package/lib/components/common/APAutoTabInput/APAutoTabInput.js +5 -2
  63. package/lib/components/common/APSelect/APSelect.js +3 -1
  64. package/lib/components/common/ErrorBoundary/ErrorBoundary.css +35 -0
  65. package/lib/components/common/ErrorBoundary/ErrorBoundary.js +87 -0
  66. package/lib/config/CONFIG.md +4 -0
  67. package/lib/config/configDefault.json +2 -1
  68. package/lib/constants/sendOrder/orderEntryFormConstants.js +23 -4
  69. package/lib/constants/sendOrder/timeInForceConstants.js +3 -1
  70. package/lib/constants/sendOrder/twapRejectReasons.js +26 -0
  71. package/lib/helpers/errorTextFormatter.js +13 -4
  72. package/lib/helpers/errorTextFormatter.test.js +26 -0
  73. package/lib/helpers/orderHistoryHelper.js +13 -1
  74. package/lib/helpers/orderHistoryHelper.test.js +58 -13
  75. package/lib/helpers/passkeyApi.js +228 -0
  76. package/lib/helpers/passkeyApi.test.js +171 -0
  77. package/lib/helpers/placeOrderHelper.js +76 -61
  78. package/lib/helpers/placeOrderHelper.test.js +169 -10
  79. package/lib/helpers/recalculateOrderHelper.js +4 -1
  80. package/lib/helpers/recalculateOrderHelper.test.js +88 -2
  81. package/lib/helpers/twapOrderHelper.js +265 -0
  82. package/lib/helpers/twapOrderHelper.test.js +467 -0
  83. package/lib/helpers/twoFactorAuthCancellation.js +38 -0
  84. package/lib/helpers/webauthnHelper.js +300 -0
  85. package/lib/helpers/webauthnHelper.test.js +199 -0
  86. package/lib/hocs/forAccount.js +33 -0
  87. package/lib/hocs/forAccount.test.js +50 -0
  88. package/lib/hocs/forVerified.js +16 -2
  89. package/lib/hocs/withAuthentication.js +3 -1
  90. package/lib/hocs/withOneSubmission.js +168 -0
  91. package/lib/index.js +3 -2
  92. package/lib/layouts/HeaderLayout/HeaderLayout.js +2 -1
  93. package/lib/layouts/WalletsLayout/WalletsLayoutContainer.js +3 -1
  94. package/lib/layouts/WalletsLayout/WalletsLayoutContainer.test.js +84 -0
  95. package/lib/redux/actions/apiActions.js +77 -9
  96. package/lib/redux/actions/apiActions.test.js +233 -0
  97. package/lib/redux/actions/authActions.js +514 -198
  98. package/lib/redux/actions/authActions.test.js +627 -47
  99. package/lib/redux/actions/depositActions.js +1 -1
  100. package/lib/redux/actions/depositActions.test.js +100 -30
  101. package/lib/redux/actions/fusionAuthActions.test.js +265 -84
  102. package/lib/redux/actions/interestAccountActions.js +12 -3
  103. package/lib/redux/actions/interestAccountActions.test.js +73 -0
  104. package/lib/redux/actions/modalActions.js +1 -0
  105. package/lib/redux/actions/orderEntryActions.blockTrade.test.js +306 -0
  106. package/lib/redux/actions/orderEntryActions.js +74 -22
  107. package/lib/redux/actions/orderEntryActions.test.js +63 -11
  108. package/lib/redux/actions/orderHistoryActions.js +20 -8
  109. package/lib/redux/actions/orderHistoryActions.test.js +63 -0
  110. package/lib/redux/actions/userActions.js +379 -179
  111. package/lib/redux/actions/userActions.test.js +925 -234
  112. package/lib/redux/actions/withdrawActions.js +62 -29
  113. package/lib/redux/actions/withdrawActions.test.js +246 -73
  114. package/lib/redux/actions/withdrawActions.travelRule.test.js +17 -3
  115. package/lib/redux/margin/actions/marginActions.js +6 -3
  116. package/lib/redux/margin/actions/marginActions.test.js +166 -0
  117. package/lib/redux/middlewares/authMiddleware.js +5 -0
  118. package/lib/redux/middlewares/authMiddleware.test.js +88 -29
  119. package/lib/redux/reducers/authReducer.js +1 -0
  120. package/lib/redux/reducers/authReducer.test.js +38 -0
  121. package/lib/redux/reducers/userReducer.js +10 -0
  122. package/lib/redux/reducers/userReducer.test.js +29 -0
  123. package/lib/redux/selectors/orderEntrySelector.js +19 -8
  124. package/lib/redux/selectors/orderEntrySelector.test.js +209 -0
  125. package/lib/redux/selectors/orderTotalSelector.test.js +40 -1
  126. package/lib/redux/selectors/recentActivitySelector.js +8 -2
  127. package/lib/redux/selectors/recentActivitySelector.v2.test.js +33 -0
  128. package/lib/redux/selectors/userSelectors.js +6 -1
  129. package/lib/redux/selectors/userSelectors.test.js +28 -0
  130. package/lib/services/fms/fms.js +2 -0
  131. package/lib/services/fms/fms.test.js +35 -0
  132. 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 _callee10() {
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 (_context10) {
338
- while (1) switch (_context10.n) {
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
- _context10.n = 1;
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 _context10.a(2);
536
+ return _context17.a(2);
356
537
  }
357
- }, _callee10);
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 _callee11() {
360
- return _regenerator().w(function (_context11) {
361
- while (1) switch (_context11.n) {
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
- _context11.n = 1;
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 _context11.a(2);
554
+ return _context18.a(2);
374
555
  }
375
- }, _callee11);
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 _callee12() {
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 (_context12) {
383
- while (1) switch (_context12.n) {
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
- _context12.n = 1;
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 _context12.a(2);
585
+ return _context19.a(2);
405
586
  }
406
- }, _callee12);
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 _ref13 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(onCallbackParams) {
627
+ var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(onCallbackParams) {
447
628
  var flow, i;
448
- return _regenerator().w(function (_context13) {
449
- while (1) switch (_context13.n) {
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
- _context13.n = 3;
636
+ _context20.n = 3;
456
637
  break;
457
638
  }
458
- _context13.n = 2;
639
+ _context20.n = 2;
459
640
  return Promise.resolve();
460
641
  case 2:
461
642
  i += 1;
462
- _context13.n = 1;
643
+ _context20.n = 1;
463
644
  break;
464
645
  case 3:
465
- return _context13.a(2, {
646
+ return _context20.a(2, {
466
647
  flow: flow
467
648
  });
468
649
  }
469
- }, _callee13);
650
+ }, _callee20);
470
651
  }));
471
652
  return function armPopupFlow(_x) {
472
- return _ref13.apply(this, arguments);
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 _ref14 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(flow) {
486
- return _regenerator().w(function (_context14) {
487
- while (1) switch (_context14.n) {
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
- _context14.n = 1;
672
+ _context21.n = 1;
492
673
  return flow;
493
674
  case 1:
494
- return _context14.a(2);
675
+ return _context21.a(2);
495
676
  }
496
- }, _callee14);
677
+ }, _callee21);
497
678
  }));
498
679
  return function cancelFlow(_x2) {
499
- return _ref14.apply(this, arguments);
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 _callee15() {
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 (_context15) {
505
- while (1) switch (_context15.n) {
685
+ return _regenerator().w(function (_context22) {
686
+ while (1) switch (_context22.n) {
506
687
  case 0:
507
688
  onCallbackParams = jest.fn();
508
- _context15.n = 1;
689
+ _context22.n = 1;
509
690
  return armPopupFlow(onCallbackParams);
510
691
  case 1:
511
- _yield$armPopupFlow = _context15.v;
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
- _context15.n = 2;
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 _context15.a(2);
707
+ return _context22.a(2);
527
708
  }
528
- }, _callee15);
709
+ }, _callee22);
529
710
  })));
530
- it('ignores a callback message from another origin', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
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 (_context16) {
533
- while (1) switch (_context16.n) {
713
+ return _regenerator().w(function (_context23) {
714
+ while (1) switch (_context23.n) {
534
715
  case 0:
535
716
  onCallbackParams = jest.fn();
536
- _context16.n = 1;
717
+ _context23.n = 1;
537
718
  return armPopupFlow(onCallbackParams);
538
719
  case 1:
539
- _yield$armPopupFlow2 = _context16.v;
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
- _context16.n = 2;
727
+ _context23.n = 2;
547
728
  return Promise.resolve();
548
729
  case 2:
549
730
  expect(onCallbackParams).not.toHaveBeenCalled();
550
- _context16.n = 3;
731
+ _context23.n = 3;
551
732
  return cancelFlow(flow);
552
733
  case 3:
553
- return _context16.a(2);
734
+ return _context23.a(2);
554
735
  }
555
- }, _callee16);
736
+ }, _callee23);
556
737
  })));
557
- it('ignores a message from this origin that is not a callback message', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
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 (_context17) {
560
- while (1) switch (_context17.n) {
740
+ return _regenerator().w(function (_context24) {
741
+ while (1) switch (_context24.n) {
561
742
  case 0:
562
743
  onCallbackParams = jest.fn();
563
- _context17.n = 1;
744
+ _context24.n = 1;
564
745
  return armPopupFlow(onCallbackParams);
565
746
  case 1:
566
- _yield$armPopupFlow3 = _context17.v;
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
- _context17.n = 2;
754
+ _context24.n = 2;
574
755
  return Promise.resolve();
575
756
  case 2:
576
757
  expect(onCallbackParams).not.toHaveBeenCalled();
577
- _context17.n = 3;
758
+ _context24.n = 3;
578
759
  return cancelFlow(flow);
579
760
  case 3:
580
- return _context17.a(2);
761
+ return _context24.a(2);
581
762
  }
582
- }, _callee17);
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 _callee18() {
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 (_context18) {
590
- while (1) switch (_context18.n) {
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
- _context18.n = 1;
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 _context18.a(2);
786
+ return _context25.a(2);
606
787
  }
607
- }, _callee18);
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 _callee19() {
638
- return _regenerator().w(function (_context19) {
639
- while (1) switch (_context19.n) {
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
- _context19.n = 1;
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 _context19.a(2);
836
+ return _context26.a(2);
656
837
  }
657
- }, _callee19);
838
+ }, _callee26);
658
839
  })));
659
- it('falls through to the rejection warning when FusionAuth is disabled', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
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 (_context20) {
662
- while (1) switch (_context20.n) {
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
- _context20.n = 1;
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 _context20.a(2);
862
+ return _context27.a(2);
682
863
  }
683
- }, _callee20);
864
+ }, _callee27);
684
865
  })));
685
- it('does not stash the withdrawal when FusionAuth is disabled', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
686
- return _regenerator().w(function (_context21) {
687
- while (1) switch (_context21.n) {
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
- _context21.n = 1;
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 _context21.a(2);
880
+ return _context28.a(2);
700
881
  }
701
- }, _callee21);
882
+ }, _callee28);
702
883
  })));
703
884
  });
704
885
  describe('step-up stash', function () {
@@ -50,12 +50,21 @@ var getRates = exports.getRates = function getRates() {
50
50
  var getInterestAccountStatus = exports.getInterestAccountStatus = function getInterestAccountStatus() {
51
51
  return /*#__PURE__*/function () {
52
52
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(dispatch, getState) {
53
+ var AccountId;
53
54
  return _regenerator().w(function (_context2) {
54
55
  while (1) switch (_context2.n) {
55
56
  case 0:
56
- _context2.n = 1;
57
+ AccountId = getState().user.selectedAccountId; // A user with no account has no account config. The call would be refused
58
+ // and its error payload has no .find.
59
+ if (!(AccountId === undefined)) {
60
+ _context2.n = 1;
61
+ break;
62
+ }
63
+ return _context2.a(2);
64
+ case 1:
65
+ _context2.n = 2;
57
66
  return dispatch((0, _apiActions.callAPI)('GetAccountConfig', {
58
- AccountId: getState().user.selectedAccountId
67
+ AccountId: AccountId
59
68
  })).then(function (res) {
60
69
  var data = res.find(function (i) {
61
70
  return i.Key === 'IBAOptedIn';
@@ -65,7 +74,7 @@ var getInterestAccountStatus = exports.getInterestAccountStatus = function getIn
65
74
  payload: Boolean(data && data.Value === 'true')
66
75
  });
67
76
  });
68
- case 1:
77
+ case 2:
69
78
  return _context2.a(2, _context2.v);
70
79
  }
71
80
  }, _callee2);