@alphapoint/apex-web 5.5.5 → 5.5.6

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 (357) hide show
  1. package/lib/App.js +30 -18
  2. package/lib/components/DepositSidePaneComponents/DepositFormComponent.js +2 -7
  3. package/lib/components/DigitalAssets/DigitalAssetsOfferingProfilePage.css +6 -3
  4. package/lib/components/DigitalAssets/DigitalAssetsOfferingProfilePage.js +2 -2
  5. package/lib/components/DigitalAssets/DigitalAssetsPage.js +1 -1
  6. package/lib/components/FusionAuth/ConfirmPendingWithdrawModal.js +60 -0
  7. package/lib/components/FusionAuth/FusionAuthCallbackComponent.js +66 -0
  8. package/lib/components/FusionAuth/FusionAuthCallbackContainer.js +24 -0
  9. package/lib/components/FusionAuth/FusionStepUpModal.js +63 -0
  10. package/lib/components/FusionAuth/LinkOAuthIdentityModal.css +6 -0
  11. package/lib/components/FusionAuth/LinkOAuthIdentityModal.js +65 -0
  12. package/lib/components/FuturesOrderBook/FuturesOrderBookContainer.js +6 -0
  13. package/lib/components/KYC/kycLevelsVerificationPropsHelper.test.js +7 -8
  14. package/lib/components/Login/LoginFormComponent.js +15 -4
  15. package/lib/components/Login/LoginFormContainer.js +21 -26
  16. package/lib/components/OrderBookComponents/Level2DataTableComponent.js +4 -0
  17. package/lib/components/OrderBookComponents/OrderBookComponent.css +1 -0
  18. package/lib/components/OrderBookComponents/OrderBookComponent.js +7 -2
  19. package/lib/components/OrderBookComponents/OrderBookContainer.js +3 -1
  20. package/lib/components/OrderEntryComponents/defaultForm/BuySellTabs.js +11 -5
  21. package/lib/components/OrderEntryComponents/defaultForm/OrderEntryAnchoring.js +19 -3
  22. package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.js +1 -1
  23. package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.test.js +97 -73
  24. package/lib/components/PriceChart/TVChartComponent.js +47 -2
  25. package/lib/components/PriceChart/TVChartContainer.js +2 -1
  26. package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositFormComponent.js +2 -6
  27. package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawFormComponent.js +2 -6
  28. package/lib/components/SendReceiveSidePane/ReceiveAddress/ReceiveAddressComponent.js +2 -6
  29. package/lib/components/SendReceiveSidePane/SendAddress/SendAddressComponent.js +2 -7
  30. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/ProfileFormComponent.js +3 -1
  31. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.css +10 -0
  32. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.js +77 -0
  33. package/lib/components/Signup/SignupFormComponent.js +10 -1
  34. package/lib/components/Theme/ThemeToggler/ThemeToggler.js +4 -1
  35. package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormComponent.js +3 -8
  36. package/lib/components/common/APRecaptcha/APRecaptcha.css +33 -0
  37. package/lib/components/common/APRecaptcha/APRecaptcha.js +252 -0
  38. package/lib/components/common/APRecaptcha/index.js +22 -0
  39. package/lib/config/configDefault.json +9 -2
  40. package/lib/helpers/accountProviderHelper.js +28 -0
  41. package/lib/helpers/accountProviderHelper.test.js +67 -0
  42. package/lib/helpers/dateHelper.test.js +11 -5
  43. package/lib/helpers/destinationTagHelper.test.js +14 -5
  44. package/lib/helpers/formValidations.test.js +19 -3
  45. package/lib/helpers/fusionStepUp.js +79 -0
  46. package/lib/helpers/fusionStepUp.test.js +136 -0
  47. package/lib/helpers/homePageLayoutHelper.test.js +16 -2
  48. package/lib/helpers/numberFormatter/numberFormatter.js +3 -1
  49. package/lib/helpers/numberFormatter/numberFormatter.test.js +9 -2
  50. package/lib/helpers/orderHelper.test.js +59 -38
  51. package/lib/helpers/placeOrderHelper.js +9 -2
  52. package/lib/helpers/placeOrderHelper.test.js +43 -16
  53. package/lib/helpers/recalculateOrderHelper.test.js +49 -12
  54. package/lib/helpers/safeSessionStorage.js +36 -0
  55. package/lib/helpers/wsHelper.test.js +16 -7
  56. package/lib/redux/actions/affiliateActions.test.js +22 -27
  57. package/lib/redux/actions/apiKeyActions.test.js +29 -34
  58. package/lib/redux/actions/authActions.js +581 -48
  59. package/lib/redux/actions/authActions.test.js +140 -164
  60. package/lib/redux/actions/confirmWithdrawActions.js +7 -2
  61. package/lib/redux/actions/confirmWithdrawActions.test.js +83 -29
  62. package/lib/redux/actions/depositActions.test.js +267 -249
  63. package/lib/redux/actions/eotcActions.test.js +3 -0
  64. package/lib/redux/actions/eotcSettlementActions.test.js +3 -0
  65. package/lib/redux/actions/eotcWithdrawActions.test.js +3 -0
  66. package/lib/redux/actions/fusionAuthActions.test.js +717 -0
  67. package/lib/redux/actions/instrumentActions.test.js +560 -160
  68. package/lib/redux/actions/kycIdentityMindActions.js +4 -4
  69. package/lib/redux/actions/kycIdentityMindActions.test.js +31 -13
  70. package/lib/redux/actions/kycJumioActions.test.js +16 -6
  71. package/lib/redux/actions/kycManualActions.test.js +16 -9
  72. package/lib/redux/actions/level1Actions.test.js +2 -2
  73. package/lib/redux/actions/level2Actions.test.js +51 -120
  74. package/lib/redux/actions/loyaltyFeeActions.test.js +19 -16
  75. package/lib/redux/actions/marketStateUpdateActions.test.js +2 -2
  76. package/lib/redux/actions/modalActions.js +3 -0
  77. package/lib/redux/actions/orderEntryActions.js +32 -5
  78. package/lib/redux/actions/orderEntryActions.test.js +104 -37
  79. package/lib/redux/actions/orderHistoryActions.test.js +94 -79
  80. package/lib/redux/actions/positionActions.test.js +19 -4
  81. package/lib/redux/actions/productActions.test.js +38 -21
  82. package/lib/redux/actions/recentTradesActions.test.js +2 -2
  83. package/lib/redux/actions/regionFormActions.test.js +25 -33
  84. package/lib/redux/actions/reportActions.test.js +16 -35
  85. package/lib/redux/actions/signupActions.js +18 -4
  86. package/lib/redux/actions/signupActions.test.js +146 -142
  87. package/lib/redux/actions/snackbarActions.test.js +4 -4
  88. package/lib/redux/actions/tickersActions.test.js +10 -4
  89. package/lib/redux/actions/transferActions.test.js +111 -93
  90. package/lib/redux/actions/transferRequestActions.test.js +42 -42
  91. package/lib/redux/actions/userActions.test.js +539 -305
  92. package/lib/redux/actions/verifyEmailActions.test.js +13 -2
  93. package/lib/redux/actions/withdrawActions.js +99 -65
  94. package/lib/redux/actions/withdrawActions.test.js +163 -154
  95. package/lib/redux/actions/wsConnectionActions.js +96 -1
  96. package/lib/redux/actions/wsConnectionActions.test.js +9 -8
  97. package/lib/redux/actions/wsConnectionLifecycle.test.js +207 -0
  98. package/lib/redux/futures/actions/futuresOrderFormActions.js +26 -2
  99. package/lib/redux/margin/actions/marginActions.test.js +163 -75
  100. package/lib/redux/margin/actions/marginHistoryActions.test.js +190 -151
  101. package/lib/redux/margin/reducers/marginHistoryReducer.test.js +146 -135
  102. package/lib/redux/margin/selectors/marginHistorySelectors.test.js +101 -102
  103. package/lib/redux/margin/selectors/marginOrderSelectors.test.js +2 -2
  104. package/lib/redux/middlewares/authMiddleware.test.js +142 -23
  105. package/lib/redux/middlewares/placeOrderMiddleware.test.js +18 -1
  106. package/lib/redux/middlewares/startupMiddleware.test.js +10 -34
  107. package/lib/redux/middlewares/wsConnectionMiddleware.test.js +6 -1
  108. package/lib/redux/reducers/apiProcessingReducer.test.js +4 -2
  109. package/lib/redux/reducers/authReducer.test.js +3 -3
  110. package/lib/redux/reducers/depositReducer.test.js +2 -1
  111. package/lib/redux/reducers/level2Reducer.test.js +2 -2
  112. package/lib/redux/reducers/orderHistoryReducer.js +1 -1
  113. package/lib/redux/reducers/orderHistoryReducer.test.js +63 -75
  114. package/lib/redux/reducers/positionReducer.test.js +1 -2
  115. package/lib/redux/reducers/resetPasswordReducer.test.js +1 -0
  116. package/lib/redux/reducers/snackbarReducer.test.js +12 -39
  117. package/lib/redux/reducers/tickersReducer.test.js +2 -2
  118. package/lib/redux/reducers/userReducer.test.js +7 -1
  119. package/lib/redux/reducers/withdrawReducer.test.js +11 -5
  120. package/lib/redux/selectors/buySellSelectors.test.js +10 -6
  121. package/lib/redux/selectors/depositWithdrawalSelectors.js +6 -12
  122. package/lib/redux/selectors/instrumentPositionSelectors.test.js +58 -18
  123. package/lib/redux/selectors/level2Selectors.test.js +60 -33
  124. package/lib/redux/selectors/loyaltyTokenSelectors.test.js +15 -13
  125. package/lib/redux/selectors/marginHistorySelectors.test.js +11 -5
  126. package/lib/redux/selectors/openOrdersActivitySelector.test.js +4 -4
  127. package/lib/redux/selectors/orderHistorySelectors.test.js +141 -22
  128. package/lib/redux/selectors/orderTotalSelector.test.js +76 -30
  129. package/lib/redux/selectors/productPositionSelectors.test.js +2 -1
  130. package/lib/redux/selectors/recentTradesSelectors.test.js +17 -0
  131. package/lib/redux/selectors/transfersTableSelectors.test.js +7 -1
  132. package/lib/services/subscriptions/accountPositionSubscriptionService.test.js +0 -14
  133. package/lib/services/subscriptions/orderStateSubscriptionService.test.js +0 -14
  134. package/lib/services/subscriptions/orderTradesSuscriptionService.test.js +0 -14
  135. package/lib/services/tradingView/ChartAPI.js +17 -2
  136. package/lib/setupTests.js +1 -10
  137. package/package.json +21 -5
  138. package/lib/components/APSnackbar/APSnackbarContainer.notest.js +0 -58
  139. package/lib/components/ActivityReportingComponents/ActivityReportingButtons/ActivityReportingButtonsComponent.notest.js +0 -27
  140. package/lib/components/ActivityReportingComponents/ActivityReportingButtons/ActivityReportingButtonsContainer.notest.js +0 -42
  141. package/lib/components/AffiliateComponents/AffiliateActiveTagComponent.notest.js +0 -36
  142. package/lib/components/AffiliateComponents/AffiliateActiveTagContainer.notest.js +0 -81
  143. package/lib/components/AffiliateComponents/AffiliateCountContainer.notest.js +0 -37
  144. package/lib/components/AffiliateComponents/AffiliateModal.notest.js +0 -41
  145. package/lib/components/AffiliateComponents/AffiliateModalContainer.notest.js +0 -79
  146. package/lib/components/ApiKeysSidePaneComponents/ApiKeyList/ApiKeyListContainer.notest.js +0 -40
  147. package/lib/components/ApiKeysSidePaneComponents/ApiKeysComponent/ApiKeysComponent.notest.js +0 -32
  148. package/lib/components/ApiKeysSidePaneComponents/ApiKeysForm/ApiKeysFormComponent.notest.js +0 -32
  149. package/lib/components/ApiKeysSidePaneComponents/ApiKeysForm/ApiKeysFormContainer.notest.js +0 -29
  150. package/lib/components/ApiKeysSidePaneComponents/ApiKeysSidePane/ApiKeySidePaneComponent.notest.js +0 -46
  151. package/lib/components/ApiKeysSidePaneComponents/CreateApiKey/CreateApiKeyComponent.notest.js +0 -50
  152. package/lib/components/ApiKeysSidePaneComponents/CreateApiKey/CreateApiKeyContainer.notest.js +0 -70
  153. package/lib/components/ApiKeysSidePaneComponents/NewApiKey/NewApiKeyModalContainer.notest.js +0 -102
  154. package/lib/components/ApiKeysSidePaneComponents/RemoveApiKeyModal/RemoveApiKeyModalContainer.notest.js +0 -53
  155. package/lib/components/BalancesList/BalancesListContainer.notest.js +0 -91
  156. package/lib/components/BalancesMenu/BalanceMenuContainer.notest.js +0 -49
  157. package/lib/components/BalancesMenu/BalancesMenuComponent.notest.js +0 -68
  158. package/lib/components/BalancesMenu/BalancesMenuItemComponent.notest.js +0 -28
  159. package/lib/components/ConfirmBlockTradeModal/ConfirmBlockTradeModalContainer.notest.js +0 -171
  160. package/lib/components/ConfirmLimitOrderModal/ConfirmLimitOrderModalContainer.notest.js +0 -179
  161. package/lib/components/ConfirmWithdraw/ConfirmWithdrawContainer.notest.js +0 -58
  162. package/lib/components/DepositConfirmation/DepositConfirmationModalContainer.notest.js +0 -59
  163. package/lib/components/DepositSidePaneComponents/DepositFormComponent.notest.js +0 -123
  164. package/lib/components/DepositSidePaneComponents/DepositFormContainer.notest.js +0 -174
  165. package/lib/components/DepositSidePaneComponents/DepositTemplateFormComponent.notest.js +0 -79
  166. package/lib/components/DepositSidePaneComponents/DepositTemplateFormContainer.notest.js +0 -66
  167. package/lib/components/DepositSidePaneComponents/DepositWorkflows/CryptoWalletDepositWorkflow/CryptoWalletDepositWorkflowComponent.notest.js +0 -42
  168. package/lib/components/DepositSidePaneComponents/DepositWorkflows/CryptoWalletDepositWorkflow/CryptoWalletDepositWorkflowContainer.notest.js +0 -52
  169. package/lib/components/DepositSidePaneComponents/DepositWorkflows/DepositWorkflowsComponent.notest.js +0 -52
  170. package/lib/components/DepositSidePaneComponents/DepositWorkflows/DepositWorkflowsContainer.notest.js +0 -49
  171. package/lib/components/DepositSidePaneComponents/DepositWorkflows/GenericPaymentWorkflow/GenericPaymentWorkflowComponent.notest.js +0 -96
  172. package/lib/components/DepositSidePaneComponents/DepositWorkflows/GenericPaymentWorkflow/GenericPaymentWorkflowContainer.notest.js +0 -49
  173. package/lib/components/DepositSidePaneComponents/DepositWorkflows/ManualDepositWorkflow/ManualDepositWorkflowComponent.notest.js +0 -68
  174. package/lib/components/DepositSidePaneComponents/DepositWorkflows/ManualDepositWorkflow/ManualDepositWorkflowContainer.notest.js +0 -60
  175. package/lib/components/DepositSidePaneComponents/DepositWorkflows/PaymentProcessors/Hyphen/HyphenDepositWorkflowContainer.notest.js +0 -66
  176. package/lib/components/DepthChart/DepthChartContainer.notest.js +0 -82
  177. package/lib/components/EnableTwoFactorAuth/Disable2FAModalContainer.notest.js +0 -73
  178. package/lib/components/EnableTwoFactorAuth/Enable2FAModalContainer.notest.js +0 -82
  179. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.notest.js +0 -50
  180. package/lib/components/EotcBalancesList/EotcBalancesListContainer.notest.js +0 -53
  181. package/lib/components/EotcProductCard/EotcProductCardContainer.notest.js +0 -87
  182. package/lib/components/EotcProductCard/EotcProductCardListContainer.notest.js +0 -55
  183. package/lib/components/EotcProductCardSimple/EotcProductCardSimpleContainer.notest.js +0 -136
  184. package/lib/components/EotcProductCardSimple/EotcProductCardSimpleListContainer.notest.js +0 -66
  185. package/lib/components/EotcWalletCard/EotcWalletCardContainer.notest.js +0 -148
  186. package/lib/components/EotcWalletCard/EotcWalletCardGridContainer.notest.js +0 -57
  187. package/lib/components/InstrumentPositions/InstrumentPositionsContainer.notest.js +0 -54
  188. package/lib/components/InstrumentPositionsWrapper/InstrumentPositionsWrapperContainer.notest.js +0 -46
  189. package/lib/components/InstrumentSelector/InstrumentSelectorContainer.notest.js +0 -112
  190. package/lib/components/InstrumentTable/InstrumentTableContainer.notest.js +0 -51
  191. package/lib/components/KYC/KYCBaseContainer.notest.js +0 -103
  192. package/lib/components/KYC/KYCLevel/KYCLevelComponent.notest.js +0 -94
  193. package/lib/components/KYCSettings/KYCSettingsContainer.notest.js +0 -49
  194. package/lib/components/KYCStatus/KYCStatusContainer.notest.js +0 -66
  195. package/lib/components/KYC_IM/KYC_IMForm/KYC_IMFormContainer.notest.js +0 -89
  196. package/lib/components/KYC_IM/KYC_IMForm/KYC_IMFormStepContainer.notest.js +0 -37
  197. package/lib/components/KYC_IM/KYC_IMLevelsContainer.notest.js +0 -47
  198. package/lib/components/KYC_IMLegacy/KYC_IMLegacyForm/KYC_IMLegacyFormContainer.notest.js +0 -152
  199. package/lib/components/KYC_IMLegacy/KYC_IMLegacyLevelsContainer.notest.js +0 -47
  200. package/lib/components/KYC_Jumio/KYC_JumioIframe/KYC_JumioIframeComponent.notest.js +0 -63
  201. package/lib/components/KYC_Jumio/KYC_JumioIframe/KYC_JumioIframeContainer.notest.js +0 -70
  202. package/lib/components/KYC_Jumio/KYC_JumioLevelsContainer.notest.js +0 -47
  203. package/lib/components/KYC_Manual/KYC_ManualForm/KYC_ManualFormContainer.notest.js +0 -102
  204. package/lib/components/KYC_Manual/KYC_ManualIframe/KYC_ManualIframeContainer.notest.js +0 -150
  205. package/lib/components/KYC_Manual/KYC_ManualLevelsContainer.notest.js +0 -47
  206. package/lib/components/Login/LoginFormComponent.notest.js +0 -84
  207. package/lib/components/Login/LoginFormContainer.notest.js +0 -111
  208. package/lib/components/LoyaltyToken/LoyaltyTokenContainer.notest.js +0 -57
  209. package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.notest.js +0 -87
  210. package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositWithdrawContainer.notest.js +0 -83
  211. package/lib/components/MarginBalances/MarginOverview/MarginOverviewContainer.notest.js +0 -45
  212. package/lib/components/MarginTransferAssetModal/MarginTransferAssetsFormContainer.notest.js +0 -194
  213. package/lib/components/MarketDataCardsComponent/MarketDataCardsContainer.notest.js +0 -63
  214. package/lib/components/MenuItem/MenuItemComponent.notest.js +0 -39
  215. package/lib/components/OrderBookComponents/BulkCancelButtonsComponent/BulkCancelButtonsComponent.notest.js +0 -54
  216. package/lib/components/OrderBookComponents/Level2DataTableComponent.notest.js +0 -38
  217. package/lib/components/OrderBookComponents/OrderBookComponent.notest.js +0 -38
  218. package/lib/components/OrderBookComponents/OrderBookContainer.notest.js +0 -121
  219. package/lib/components/OrderHistoryComponents/DepositsStatus/DepositsStatusComponent.notest.js +0 -68
  220. package/lib/components/OrderHistoryComponents/FilledOrders/FilledOrdersComponent.notest.js +0 -156
  221. package/lib/components/OrderHistoryComponents/HeaderWithFilter/HeaderWithFilterContainer.notest.js +0 -58
  222. package/lib/components/OrderHistoryComponents/InactiveOrders/InactiveOrdersComponent.notest.js +0 -97
  223. package/lib/components/OrderHistoryComponents/MarginOpenPositions/MarginOpenPositionsComponent.notest.js +0 -93
  224. package/lib/components/OrderHistoryComponents/MarginOrderHistory/MarginOrderHistoryComponent.notest.js +0 -107
  225. package/lib/components/OrderHistoryComponents/MarginOrderHistoryExtended/MarginOrderHistoryExtendedComponent.notest.js +0 -118
  226. package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.notest.js +0 -123
  227. package/lib/components/OrderHistoryComponents/OrderHistoryComponent.notest.js +0 -107
  228. package/lib/components/OrderHistoryComponents/PositionPayments/PositionPaymentsComponent.notest.js +0 -82
  229. package/lib/components/OrderHistoryComponents/TradeReports/TradeReportsComponent.notest.js +0 -124
  230. package/lib/components/OrderHistoryComponents/WithdrawStatus/WithdrawStatusComponent.notest.js +0 -69
  231. package/lib/components/PriceChart/ApexChartComponent.notest.js +0 -48
  232. package/lib/components/PriceChart/ApexChartContainer.notest.js +0 -75
  233. package/lib/components/PriceChart/PriceChartContainer.notest.js +0 -37
  234. package/lib/components/PriceChart/TVChartContainer.notest.js +0 -106
  235. package/lib/components/ProblemLoggingIn/ProblemLoggingInFormContainer.notest.js +0 -81
  236. package/lib/components/ProductPositionDetails/ProductPositionDetailsComponent.notest.js +0 -37
  237. package/lib/components/ProductPositionDetails/ProductPositionDetailsContainer.notest.js +0 -47
  238. package/lib/components/ProfileForm/ProfileFormComponent.notest.js +0 -51
  239. package/lib/components/ProfileForm/ProfileFormContainer.notest.js +0 -68
  240. package/lib/components/RecentActivity/RecentActivityContainer.notest.js +0 -41
  241. package/lib/components/RecentActivity/RecentActivityTable/RecentActivityTableContainer.notest.js +0 -43
  242. package/lib/components/RecentActivityWithFilter/RecentActivityHeaderWithFilter/RecentActivityHeaderForm/RecentActivityHeaderFormContainer.notest.js +0 -128
  243. package/lib/components/RecentActivityWithFilter/RecentActivityTableWithFilter/RecentActivityTableWithFilterContainer.notest.js +0 -64
  244. package/lib/components/RecentActivityWithFilter/RecentActivityWithFilterContainer.notest.js +0 -41
  245. package/lib/components/RecentTrades/RecentTradesComponent.notest.js +0 -78
  246. package/lib/components/RecentTrades/RecentTradesContainer.notest.js +0 -59
  247. package/lib/components/ReportBlockTradeSidePaneComponents/ReportBlockTradeContainer.notest.js +0 -169
  248. package/lib/components/ReportBlockTradeSidePaneComponents/ReportBlockTradeSidePaneContainer.notest.js +0 -107
  249. package/lib/components/ReportSidePaneComponents/ConfirmCyclicalReport/ConfirmCyclicalReportModalContainer.notest.js +0 -39
  250. package/lib/components/ReportSidePaneComponents/ConfirmSingleReport/ConfirmSingleReportModalContainer.notest.js +0 -39
  251. package/lib/components/ReportSidePaneComponents/CreateReportForm/CreateReportFormComponent.notest.js +0 -42
  252. package/lib/components/ReportSidePaneComponents/CreateReportForm/CreateReportFormContainer.notest.js +0 -85
  253. package/lib/components/ReportSidePaneComponents/DownloadReportForm/DownloadReportContainer.notest.js +0 -37
  254. package/lib/components/ReportSidePaneComponents/ReportSidePaneComponent.notest.js +0 -72
  255. package/lib/components/ReportSidePaneComponents/ScheduleReportForm/ScheduleReportFormComponent.notest.js +0 -43
  256. package/lib/components/ReportSidePaneComponents/ScheduleReportForm/ScheduleReportFormContainer.notest.js +0 -80
  257. package/lib/components/ReportSidePaneComponents/ScheduledReportsTable/ScheduledReportsTableComponent.notest.js +0 -34
  258. package/lib/components/ReportSidePaneComponents/ScheduledReportsTable/ScheduledReportsTableContainer.notest.js +0 -48
  259. package/lib/components/ResetPasswordForm/ResetPasswordFormContainer.notest.js +0 -105
  260. package/lib/components/ResetPasswordRequestForm/ResetPasswordRequestFormComponent.notest.js +0 -39
  261. package/lib/components/ResetPasswordRequestForm/ResetPasswordRequestFormContainerFactory.notest.js +0 -47
  262. package/lib/components/Retail/RetailBuySell/BuySell/BuySellContainer.notest.js +0 -105
  263. package/lib/components/Retail/RetailBuySell/BuySell/BuySellCustomRow/BuySellCustomRowContainer.notest.js +0 -145
  264. package/lib/components/Retail/RetailBuySell/BuySell/BuySellInstrumentSelector/BuySellInstrumentSelectorContainer.notest.js +0 -113
  265. package/lib/components/Retail/RetailBuySell/BuySell/BuySellOrderButton/BuySellOrderButtonContainer.notest.js +0 -66
  266. package/lib/components/Retail/RetailBuySell/BuySell/BuySellPresetValuesRows/BuySellPresetValuesRowsContainer.notest.js +0 -125
  267. package/lib/components/Retail/RetailBuySell/BuySell/BuySellTabs/BuySellTabsContainer.notest.js +0 -115
  268. package/lib/components/Retail/RetailBuySell/BuySellBalances/BuySellBalancesContainer.notest.js +0 -126
  269. package/lib/components/Retail/RetailBuySell/BuySellChartIntervalSelector/BuySellChartIntervalSelectorContainer.notest.js +0 -36
  270. package/lib/components/Retail/RetailBuySell/BuySellChartOverview/BuySellChartOverviewContainer.notest.js +0 -43
  271. package/lib/components/Retail/RetailBuySell/BuySellInstrumentSelect/BuySellInstrumentSelectContainer.notest.js +0 -153
  272. package/lib/components/Retail/RetailBuySell/BuySellOrderConfirmationModal/BuySellConfirmationModalContainer.notest.js +0 -262
  273. package/lib/components/Retail/RetailBuySell/BuySellOrderOverview/BuySellOrderOverviewContainer.notest.js +0 -124
  274. package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellContainer.notest.js +0 -125
  275. package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellCustomRow/EotcBuySellCustomRowContainer.notest.js +0 -143
  276. package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellPresetValuesRows/EotcBuySellPresetValuesRowsContainer.notest.js +0 -125
  277. package/lib/components/Retail/RetailBuySell/EotcBuySellChartOverviewContainer/BuySellChartOverviewContainer.notest.js +0 -43
  278. package/lib/components/Retail/RetailBuySell/EotcBuySellOrderConfirmationModal/EotcBuySellConfirmationModalContainer.notest.js +0 -262
  279. package/lib/components/Retail/RetailSidePanes/FiatDeposit/DepositReferenceIdModalContainer.notest.js +0 -45
  280. package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositFormContainer.notest.js +0 -137
  281. package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositModalContainer.notest.js +0 -82
  282. package/lib/components/Retail/RetailSidePanes/FiatFormTabsComponent.notest.js +0 -49
  283. package/lib/components/Retail/RetailSidePanes/FiatSidePaneContainer.notest.js +0 -62
  284. package/lib/components/Retail/RetailSidePanes/FiatWithdraw/BankSelect/BankSelectContainer.notest.js +0 -80
  285. package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawFormContainer.notest.js +0 -124
  286. package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawModalContainer.notest.js +0 -46
  287. package/lib/components/SendReceiveSidePane/Receive/ReceiveContainer.notest.js +0 -69
  288. package/lib/components/SendReceiveSidePane/ReceiveAddress/ReceiveAddressContainer.notest.js +0 -73
  289. package/lib/components/SendReceiveSidePane/ReceiveForm/ReceiveFormContainer.notest.js +0 -54
  290. package/lib/components/SendReceiveSidePane/SendAddress/SendAddressContainer.notest.js +0 -71
  291. package/lib/components/SendReceiveSidePane/SendForm/SendFormContainer.notest.js +0 -72
  292. package/lib/components/SendReceiveSidePane/SendReceiveSidePaneContainer.notest.js +0 -139
  293. package/lib/components/SendReceiveSidePane/SendReceiveTwoFactorAuth/SendReceiveTwoFactorAuthContainer.notest.js +0 -102
  294. package/lib/components/Settings/ApiKeys/ApiKeysSidePaneButton/ApiKeysSidePaneButtonContainer.notest.js +0 -31
  295. package/lib/components/Settings/DemoSettings/DemoSettingsContainer.notest.js +0 -46
  296. package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/ProfileFormContainer.notest.js +0 -69
  297. package/lib/components/Settings/ProfileAndSecurity/RegionSettingsCard/RegionSettings/RegionSettingsContainer.notest.js +0 -86
  298. package/lib/components/Settings/ProfileAndSecurity/ThemeSettingsCard/ThemeForm/ThemeSettingsContainer.notest.js +0 -45
  299. package/lib/components/Settings/TradeSettings/MarginTrading/EnableMarginModal/EnableMarginConfirmationModalComponent.notest.js +0 -47
  300. package/lib/components/Settings/TradeSettings/MarginTrading/EnableMarginModal/EnableMarginConfirmationModalContainer.notest.js +0 -112
  301. package/lib/components/Settings/TradeSettings/MarginTrading/MarginTradingComponent.notest.js +0 -33
  302. package/lib/components/Settings/TradeSettings/MarginTrading/MarginTradingContainer.notest.js +0 -54
  303. package/lib/components/Settings/TransferHistory/TransferHistoryContainer.notest.js +0 -42
  304. package/lib/components/Signup/SignupFormComponent.notest.js +0 -92
  305. package/lib/components/Signup/SignupFormContainer.notest.js +0 -124
  306. package/lib/components/StandaloneKYC/StandaloneKYCContainer.notest.js +0 -75
  307. package/lib/components/StandaloneModal/StandaloneModalComponent.notest.js +0 -69
  308. package/lib/components/Ticker/TickerContainer.notest.js +0 -57
  309. package/lib/components/Transfers/TransfersContainer.notest.js +0 -99
  310. package/lib/components/Transfers/TransfersFilters/TransfersFiltersContainer.notest.js +0 -81
  311. package/lib/components/TwoFactorAuthForm/TwoFactorAuthFormContainer.notest.js +0 -60
  312. package/lib/components/UserBalance/UserBalanceContainer.notest.js +0 -47
  313. package/lib/components/UserSettings/UserSettingsComponent.notest.js +0 -55
  314. package/lib/components/UserSummary/UserSummaryContainer.notest.js +0 -65
  315. package/lib/components/VerificationRequired/VerificationRequiredContainer.notest.js +0 -47
  316. package/lib/components/VerifyEmail/VerifyEmailContainer.notest.js +0 -46
  317. package/lib/components/WalletCards/WalletCardContainer.notest.js +0 -77
  318. package/lib/components/WalletCards/WalletCardGridContainer.notest.js +0 -42
  319. package/lib/components/WalletDetails/WalletDetailsContainer.notest.js +0 -61
  320. package/lib/components/WalletNavItems/CryptoNavItemsContainer.notest.js +0 -46
  321. package/lib/components/WalletNavItems/EotcCryptoNavItemsContainer.notest.js +0 -64
  322. package/lib/components/WalletNavItems/FiatNavItemsComponent.notest.js +0 -59
  323. package/lib/components/WalletNavItems/FiatNavItemsContainer.notest.js +0 -66
  324. package/lib/components/WalletRows/WalletRowContainer.notest.js +0 -76
  325. package/lib/components/WalletRows/WalletRowListContainer.notest.js +0 -43
  326. package/lib/components/WithdrawSidePaneComponents/PaymentProcessors/HyphenWithdrawWorkflowContainer.notest.js +0 -51
  327. package/lib/components/WithdrawSidePaneComponents/PaymentProcessors/TrustpayWithdrawWorkflowContainer.notest.js +0 -36
  328. package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormComponent.notest.js +0 -131
  329. package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormContainer.notest.js +0 -140
  330. package/lib/components/WithdrawSidePaneComponents/WithdrawTemplateForm/WithdrawTemplateFormComponent.notest.js +0 -38
  331. package/lib/components/WithdrawSidePaneComponents/WithdrawTemplateForm/WithdrawTemplateFormContainer.notest.js +0 -95
  332. package/lib/components/WithdrawSidePaneComponents/WithdrawWorkflows/WithdrawWorkflowsContainer.notest.js +0 -42
  333. package/lib/components/common/APDatePicker/APDatePicker.notest.js +0 -194
  334. package/lib/components/common/APLabelWithText/APLabelWithText.notest.js +0 -25
  335. package/lib/components/common/APNumberInput.notest.js +0 -173
  336. package/lib/components/common/APRadioTab/APRadioTab.notest.js +0 -69
  337. package/lib/components/common/APSegmentedButton/APSegmentedButton.notest.js +0 -55
  338. package/lib/components/common/APSnackbar/APSnackbar.notest.js +0 -107
  339. package/lib/components/common/APVerticalScroller/APVerticalScroller.notest.js +0 -172
  340. package/lib/components/common/Modal/Modal.notest.js +0 -55
  341. package/lib/components/common/Pagination/PaginationComponent.notest.js +0 -137
  342. package/lib/components/common/Pagination/PaginationContainer.notest.js +0 -47
  343. package/lib/components/common/Popover/Popover.notest.js +0 -137
  344. package/lib/components/common/ProductIcon/ProductIcon.notest.js +0 -76
  345. package/lib/components/common/ProductIcon/ProductIconContainer.notest.js +0 -38
  346. package/lib/components/common/SidePane/SidePaneComponent.notest.js +0 -48
  347. package/lib/components/common/SidePane/SidePaneContainer.notest.js +0 -54
  348. package/lib/components/common/Snackbar/Snackbar.notest.js +0 -51
  349. package/lib/components/common/Tab/Tab.notest.js +0 -68
  350. package/lib/helpers/formGeneratorHelper.notest.js +0 -203
  351. package/lib/helpers/formTemplateHelper.notest.js +0 -170
  352. package/lib/hocs/modalDecorator.notest.js +0 -74
  353. package/lib/hocs/redirectIfAuthorized.notest.js +0 -80
  354. package/lib/hocs/resize.notest.js +0 -37
  355. package/lib/layouts/HomePageLayout.notest.js +0 -65
  356. package/lib/redux/actions/languageActions.test.js +0 -105
  357. package/lib/redux/selectors/recentActivitySelector.test.js +0 -725
@@ -4,7 +4,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4
4
  var _reduxMockStore = _interopRequireDefault(require("redux-mock-store"));
5
5
  var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
6
6
  var actions = _interopRequireWildcard(require("./marginHistoryActions"));
7
- var _marginPositionStatesSubscriptionService = _interopRequireDefault(require("../../../services/subscriptions/marginPositionStatesSubscriptionService"));
7
+ var _actionTypes = require("../actionTypes");
8
+ var _MarginPositionSubscriptionService = _interopRequireDefault(require("../services/MarginPositionSubscriptionService"));
8
9
  var _apex = _interopRequireDefault(require("../../../apex"));
9
10
  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); }
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
@@ -12,7 +13,7 @@ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present,
12
13
  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); }
13
14
  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); }
14
15
  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); }); }; }
15
- jest.mock('../../apex', function () {
16
+ jest.mock('../../../apex', function () {
16
17
  var returnValue = null;
17
18
  return {
18
19
  connection: {
@@ -25,34 +26,27 @@ jest.mock('../../apex', function () {
25
26
  }
26
27
  };
27
28
  });
28
- jest.mock('../../services/subscriptions/marginPositionStatesSubscriptionService', function () {
29
- var updateData = {};
29
+ jest.mock('../services/MarginPositionSubscriptionService', function () {
30
30
  return {
31
- initSubscribtion: jest.fn().mockImplementation(function () {
32
- return Promise.resolve([]);
33
- }),
34
- subscribe: jest.fn().mockImplementation(function (callback) {
35
- callback(updateData);
36
- }),
37
- setUpdateData: function setUpdateData(data) {
38
- updateData = data;
39
- }
31
+ subscribe: jest.fn()
40
32
  };
41
33
  });
42
- jest.mock('../margin/selectors', function () {
34
+ jest.mock('./marginActions', function () {
43
35
  return {
44
- marginAccountSelector: jest.fn(function () {
36
+ getMaxTransferAmount: jest.fn(function (productId) {
45
37
  return {
46
- AccountId: 1
38
+ type: 'GET_MAX_TRANSFER_AMOUNT',
39
+ payload: productId
47
40
  };
48
41
  })
49
42
  };
50
43
  });
51
- jest.mock('./snackbarActions', function () {
44
+ jest.mock('../../actions/snackbarActions', function () {
52
45
  return {
53
- showSnack: jest.fn().mockImplementation(function () {
46
+ showSnack: jest.fn(function (payload) {
54
47
  return {
55
- type: 'showSnack'
48
+ type: 'ADD_SNACK',
49
+ payload: payload
56
50
  };
57
51
  })
58
52
  };
@@ -60,89 +54,101 @@ jest.mock('./snackbarActions', function () {
60
54
  console.error = jest.fn();
61
55
  var middlewares = [_reduxThunk["default"]];
62
56
  var mockStore = (0, _reduxMockStore["default"])(middlewares);
63
- describe('marginProductActions', function () {
64
- var store = mockStore({
65
- user: {
66
- userInfo: {
67
- OMSId: 1
68
- }
69
- }
70
- });
71
- var successResponse = {
72
- o: JSON.stringify([])
73
- };
74
- var failureResponse = {
75
- o: JSON.stringify({
76
- result: false,
77
- errormsg: 'Server Error'
78
- })
79
- };
80
- _apex["default"].connection.setReturnValue(successResponse);
57
+ describe('marginHistoryActions', function () {
58
+ var store;
81
59
  beforeEach(function () {
82
60
  jest.clearAllMocks();
83
- store.clearActions();
61
+ store = mockStore({
62
+ user: {
63
+ userInfo: {
64
+ OMSId: 1
65
+ }
66
+ },
67
+ api: {
68
+ validate2FARequiredEndpoints: {}
69
+ }
70
+ });
84
71
  });
85
72
  describe('getOpenPositions action', function () {
86
- it("should dispatch ".concat(actions.REQUEST_OPEN_POSITIONS, " action"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
73
+ it("should dispatch ".concat(_actionTypes.REQUEST_OPEN_POSITIONS, " action"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
87
74
  return _regenerator().w(function (_context) {
88
75
  while (1) switch (_context.n) {
89
76
  case 0:
77
+ _apex["default"].connection.setReturnValue({
78
+ o: JSON.stringify([])
79
+ });
90
80
  _context.n = 1;
91
81
  return store.dispatch(actions.getOpenPositions(1, 1));
92
82
  case 1:
93
83
  expect(store.getActions()).toContainEqual({
94
- type: actions.REQUEST_OPEN_POSITIONS
84
+ type: _actionTypes.REQUEST_OPEN_POSITIONS
95
85
  });
96
86
  case 2:
97
87
  return _context.a(2);
98
88
  }
99
89
  }, _callee);
100
90
  })));
101
- it('should call GetMarginPositionStates from apex', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
91
+ it('should call GetMarginPositions from apex', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
102
92
  return _regenerator().w(function (_context2) {
103
93
  while (1) switch (_context2.n) {
104
94
  case 0:
105
- _apex["default"].connection.setReturnValue(successResponse);
95
+ _apex["default"].connection.setReturnValue({
96
+ o: JSON.stringify([])
97
+ });
106
98
  _context2.n = 1;
107
99
  return store.dispatch(actions.getOpenPositions(1, 1));
108
100
  case 1:
109
- expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetMarginPositionStates', {
101
+ expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetMarginPositions', {
110
102
  omsId: 1,
111
- accountId: 1,
112
- status: 0
103
+ accountId: 1
113
104
  });
114
105
  case 2:
115
106
  return _context2.a(2);
116
107
  }
117
108
  }, _callee2);
118
109
  })));
119
- it("should dispatch ".concat(actions.RECEIVE_OPEN_POSITIONS, " action"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
110
+ it("should dispatch ".concat(_actionTypes.RECEIVE_OPEN_POSITIONS, " action on success"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
111
+ var positions;
120
112
  return _regenerator().w(function (_context3) {
121
113
  while (1) switch (_context3.n) {
122
114
  case 0:
115
+ positions = [{
116
+ PositionId: 1
117
+ }];
118
+ _apex["default"].connection.setReturnValue({
119
+ o: JSON.stringify(positions)
120
+ });
123
121
  _context3.n = 1;
124
122
  return store.dispatch(actions.getOpenPositions(1, 1));
125
123
  case 1:
126
124
  expect(store.getActions()).toContainEqual({
127
- payload: [],
128
- type: actions.RECEIVE_OPEN_POSITIONS
125
+ type: _actionTypes.RECEIVE_OPEN_POSITIONS,
126
+ payload: positions
129
127
  });
130
128
  case 2:
131
129
  return _context3.a(2);
132
130
  }
133
131
  }, _callee3);
134
132
  })));
135
- it("should dispatch ".concat(actions.REMOVE_MARGIN_HISTORY_ACTIVE_REQUEST, " action and call error if receive result equal false"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
133
+
134
+ // Known gap: this path never releases the activeRequests counter incremented by
135
+ // requestOpenPositions() above, so it doesn't fully "handle" the error (tracked separately).
136
+ it('should log an error and not dispatch RECEIVE_OPEN_POSITIONS when the response is not an array, without releasing the activeRequests counter', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
136
137
  return _regenerator().w(function (_context4) {
137
138
  while (1) switch (_context4.n) {
138
139
  case 0:
139
- _apex["default"].connection.setReturnValue(failureResponse);
140
+ _apex["default"].connection.setReturnValue({
141
+ o: JSON.stringify({
142
+ result: false,
143
+ errormsg: 'Server Error'
144
+ })
145
+ });
140
146
  _context4.n = 1;
141
147
  return store.dispatch(actions.getOpenPositions(1, 1));
142
148
  case 1:
143
- expect(store.getActions()).toContainEqual({
144
- type: actions.REMOVE_MARGIN_HISTORY_ACTIVE_REQUEST
145
- });
149
+ expect(store.getActions()).not.toContainEqual(expect.objectContaining({
150
+ type: _actionTypes.RECEIVE_OPEN_POSITIONS
151
+ }));
146
152
  expect(console.error).toHaveBeenCalled();
147
153
  case 2:
148
154
  return _context4.a(2);
@@ -151,66 +157,85 @@ describe('marginProductActions', function () {
151
157
  })));
152
158
  });
153
159
  describe('getClosedPositions action', function () {
154
- it("should dispatch ".concat(actions.REQUEST_CLOSED_POSITIONS, " action"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
160
+ it("should dispatch ".concat(_actionTypes.REQUEST_CLOSED_POSITIONS, " action"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
155
161
  return _regenerator().w(function (_context5) {
156
162
  while (1) switch (_context5.n) {
157
163
  case 0:
164
+ _apex["default"].connection.setReturnValue({
165
+ o: JSON.stringify([])
166
+ });
158
167
  _context5.n = 1;
159
168
  return store.dispatch(actions.getClosedPositions(1, 1));
160
169
  case 1:
161
170
  expect(store.getActions()).toContainEqual({
162
- type: actions.REQUEST_CLOSED_POSITIONS
171
+ type: _actionTypes.REQUEST_CLOSED_POSITIONS
163
172
  });
164
173
  case 2:
165
174
  return _context5.a(2);
166
175
  }
167
176
  }, _callee5);
168
177
  })));
169
- it('should call GetMarginPositionStates from apex', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
178
+ it('should call GetMarginPositionHistory from apex', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
170
179
  return _regenerator().w(function (_context6) {
171
180
  while (1) switch (_context6.n) {
172
181
  case 0:
173
- _apex["default"].connection.setReturnValue(successResponse);
182
+ _apex["default"].connection.setReturnValue({
183
+ o: JSON.stringify([])
184
+ });
174
185
  _context6.n = 1;
175
186
  return store.dispatch(actions.getClosedPositions(1, 1));
176
187
  case 1:
177
- expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetMarginPositionStates', {
188
+ expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetMarginPositionHistory', {
178
189
  omsId: 1,
179
- accountId: 1,
180
- status: 1
190
+ accountId: 1
181
191
  });
182
192
  case 2:
183
193
  return _context6.a(2);
184
194
  }
185
195
  }, _callee6);
186
196
  })));
187
- it("should dispatch ".concat(actions.RECEIVE_CLOSED_POSITIONS, " action"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
197
+ it("should dispatch ".concat(_actionTypes.RECEIVE_CLOSED_POSITIONS, " action on success"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
198
+ var positions;
188
199
  return _regenerator().w(function (_context7) {
189
200
  while (1) switch (_context7.n) {
190
201
  case 0:
202
+ positions = [{
203
+ PositionId: 1
204
+ }];
205
+ _apex["default"].connection.setReturnValue({
206
+ o: JSON.stringify(positions)
207
+ });
191
208
  _context7.n = 1;
192
209
  return store.dispatch(actions.getClosedPositions(1, 1));
193
210
  case 1:
194
211
  expect(store.getActions()).toContainEqual({
195
- payload: [],
196
- type: actions.RECEIVE_CLOSED_POSITIONS
212
+ type: _actionTypes.RECEIVE_CLOSED_POSITIONS,
213
+ payload: positions
197
214
  });
198
215
  case 2:
199
216
  return _context7.a(2);
200
217
  }
201
218
  }, _callee7);
202
219
  })));
203
- it("should dispatch ".concat(actions.REMOVE_MARGIN_HISTORY_ACTIVE_REQUEST, " action and call error if receive result equal false"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
220
+
221
+ // Known gap: this path never releases the activeRequests counter incremented by
222
+ // requestClosedPositions() above, so it doesn't fully "handle" the error (tracked separately).
223
+ it('should log an error and not dispatch RECEIVE_CLOSED_POSITIONS when the response is not an array, without releasing the activeRequests counter', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
204
224
  return _regenerator().w(function (_context8) {
205
225
  while (1) switch (_context8.n) {
206
226
  case 0:
207
- _apex["default"].connection.setReturnValue(failureResponse);
227
+ _apex["default"].connection.setReturnValue({
228
+ o: JSON.stringify({
229
+ result: false,
230
+ errormsg: 'Server Error'
231
+ })
232
+ });
208
233
  _context8.n = 1;
209
234
  return store.dispatch(actions.getClosedPositions(1, 1));
210
235
  case 1:
211
- expect(store.getActions()).toContainEqual({
212
- type: actions.REMOVE_MARGIN_HISTORY_ACTIVE_REQUEST
213
- });
236
+ expect(store.getActions()).not.toContainEqual(expect.objectContaining({
237
+ type: _actionTypes.RECEIVE_CLOSED_POSITIONS
238
+ }));
214
239
  expect(console.error).toHaveBeenCalled();
215
240
  case 2:
216
241
  return _context8.a(2);
@@ -219,109 +244,123 @@ describe('marginProductActions', function () {
219
244
  })));
220
245
  });
221
246
  describe('subscribeToMarginPositionEvents', function () {
222
- it('should call initSubscribtion', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
247
+ var subscribedCallback;
248
+ beforeEach(function () {
249
+ _MarginPositionSubscriptionService["default"].subscribe.mockImplementation(function (callback) {
250
+ subscribedCallback = callback;
251
+ });
252
+ });
253
+ it('should subscribe to margin position events', function () {
254
+ store.dispatch(actions.subscribeToMarginPositionEvents(1));
255
+ expect(_MarginPositionSubscriptionService["default"].subscribe).toHaveBeenCalled();
256
+ });
257
+ it("should dispatch ".concat(_actionTypes.UPDATE_POSITION, " for a position belonging to the given account"), function () {
258
+ store.dispatch(actions.subscribeToMarginPositionEvents(1));
259
+ var position = {
260
+ AccountId: 1,
261
+ PositionState: 'Open',
262
+ BaseProductId: 10,
263
+ QuoteProductId: 20
264
+ };
265
+ subscribedCallback(position);
266
+ expect(store.getActions()).toContainEqual({
267
+ type: _actionTypes.UPDATE_POSITION,
268
+ payload: position
269
+ });
270
+ });
271
+ it('should ignore position updates for a different account', function () {
272
+ store.dispatch(actions.subscribeToMarginPositionEvents(1));
273
+ subscribedCallback({
274
+ AccountId: 2,
275
+ PositionState: 'Open'
276
+ });
277
+ expect(store.getActions()).not.toContainEqual(expect.objectContaining({
278
+ type: _actionTypes.UPDATE_POSITION
279
+ }));
280
+ });
281
+ it('should show a warning snack when a position could not be closed due to remaining liability', function () {
282
+ store.dispatch(actions.subscribeToMarginPositionEvents(1));
283
+ subscribedCallback({
284
+ AccountId: 1,
285
+ PositionState: 'Open',
286
+ ChangeReason: 'UnableToClose',
287
+ RemainingLiability: 5
288
+ });
289
+ expect(store.getActions()).toContainEqual(expect.objectContaining({
290
+ type: 'ADD_SNACK',
291
+ payload: expect.objectContaining({
292
+ id: 'unableToClosePositionErrorSnack'
293
+ })
294
+ }));
295
+ });
296
+ it('should show a success snack when a position is closed', function () {
297
+ store.dispatch(actions.subscribeToMarginPositionEvents(1));
298
+ subscribedCallback({
299
+ AccountId: 1,
300
+ PositionState: 'Closed',
301
+ ChangeReason: 'CloseOperation'
302
+ });
303
+ expect(store.getActions()).toContainEqual(expect.objectContaining({
304
+ type: 'ADD_SNACK',
305
+ payload: expect.objectContaining({
306
+ id: 'closePositionSuccessSnack'
307
+ })
308
+ }));
309
+ });
310
+ });
311
+ describe('closeMarginPosition action', function () {
312
+ var position = {
313
+ AccountId: 1,
314
+ PositionId: 1,
315
+ PositionInstrumentId: 1
316
+ };
317
+ it('should call CloseMarginPosition from apex and dispatch nothing extra on success', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
223
318
  return _regenerator().w(function (_context9) {
224
319
  while (1) switch (_context9.n) {
225
320
  case 0:
321
+ _apex["default"].connection.setReturnValue({
322
+ o: JSON.stringify({
323
+ status: 'Accepted'
324
+ })
325
+ });
226
326
  _context9.n = 1;
227
- return store.dispatch(actions.subscribeToMarginPositionEvents(1, 1));
327
+ return store.dispatch(actions.closeMarginPosition(position, []));
228
328
  case 1:
229
- expect(_marginPositionStatesSubscriptionService["default"].initSubscribtion).toHaveBeenCalledWith({
230
- AccountId: 1,
231
- OMSId: 1
329
+ expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('CloseMarginPosition', {
330
+ AccountId: position.AccountId,
331
+ PositionId: position.PositionId,
332
+ PositionInstrumentId: position.PositionInstrumentId,
333
+ RepaymentAssets: []
232
334
  });
335
+ expect(store.getActions()).toEqual([]);
233
336
  case 2:
234
337
  return _context9.a(2);
235
338
  }
236
339
  }, _callee9);
237
340
  })));
238
- it('should call subscribe', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
341
+ it('should show a warning snack when the close request is not accepted', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
239
342
  return _regenerator().w(function (_context0) {
240
343
  while (1) switch (_context0.n) {
241
344
  case 0:
345
+ _apex["default"].connection.setReturnValue({
346
+ o: JSON.stringify({
347
+ status: 'Rejected',
348
+ errormsg: 'Server Error'
349
+ })
350
+ });
242
351
  _context0.n = 1;
243
- return store.dispatch(actions.subscribeToMarginPositionEvents(1, 1));
352
+ return store.dispatch(actions.closeMarginPosition(position, []));
244
353
  case 1:
245
- expect(_marginPositionStatesSubscriptionService["default"].subscribe).toHaveBeenCalled();
354
+ expect(store.getActions()).toContainEqual(expect.objectContaining({
355
+ type: 'ADD_SNACK',
356
+ payload: expect.objectContaining({
357
+ id: 'closeOpenPositionsErrorSnack'
358
+ })
359
+ }));
246
360
  case 2:
247
361
  return _context0.a(2);
248
362
  }
249
363
  }, _callee0);
250
364
  })));
251
- it("should dispatch ".concat(actions.UPDATE_POSITION, " action with update when subscribed if receive status Open"), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
252
- var expectedActions;
253
- return _regenerator().w(function (_context1) {
254
- while (1) switch (_context1.n) {
255
- case 0:
256
- _marginPositionStatesSubscriptionService["default"].setUpdateData({
257
- AccountId: 1,
258
- Status: 'Open'
259
- });
260
- expectedActions = [{
261
- type: 'UPDATE_POSITION',
262
- payload: {
263
- AccountId: 1,
264
- Status: 'Open'
265
- }
266
- }];
267
- _context1.n = 1;
268
- return store.dispatch(actions.subscribeToMarginPositionEvents(1, 1));
269
- case 1:
270
- expect(store.getActions()).toEqual(expectedActions);
271
- case 2:
272
- return _context1.a(2);
273
- }
274
- }, _callee1);
275
- })));
276
- });
277
- describe('closeMarginPosition action', function () {
278
- it('should cancel an position', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
279
- return _regenerator().w(function (_context10) {
280
- while (1) switch (_context10.n) {
281
- case 0:
282
- _apex["default"].connection.setReturnValue(successResponse);
283
- _context10.n = 1;
284
- return store.dispatch(actions.closeMarginPosition([1]));
285
- case 1:
286
- expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('CloseMarginPosition', {
287
- OMSId: 1,
288
- AccountId: 1,
289
- PositionId: 1
290
- });
291
- expect(store.getActions()).toEqual([{
292
- type: actions.REQUEST_OPEN_POSITIONS
293
- }, {
294
- type: actions.RECEIVE_OPEN_POSITIONS,
295
- payload: []
296
- }, {
297
- type: 'showSnack'
298
- }]);
299
- case 2:
300
- return _context10.a(2);
301
- }
302
- }, _callee10);
303
- })));
304
- it('should cancel positions', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
305
- return _regenerator().w(function (_context11) {
306
- while (1) switch (_context11.n) {
307
- case 0:
308
- _apex["default"].connection.setReturnValue(successResponse);
309
- _context11.n = 1;
310
- return store.dispatch(actions.closeMarginPosition([1, 2]));
311
- case 1:
312
- expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledTimes(3);
313
- expect(store.getActions()).toEqual([{
314
- type: actions.REQUEST_OPEN_POSITIONS
315
- }, {
316
- type: actions.RECEIVE_OPEN_POSITIONS,
317
- payload: []
318
- }, {
319
- type: 'showSnack'
320
- }]);
321
- case 2:
322
- return _context11.a(2);
323
- }
324
- }, _callee11);
325
- })));
326
365
  });
327
366
  });