@alphapoint/apex-web 5.5.6 → 5.7.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/components/2FA/TwoFactorAuthContainer.js +58 -24
- package/lib/components/2FA/TwoFactorAuthContainer.test.js +215 -0
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.css +6 -0
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.js +6 -2
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.test.js +43 -0
- package/lib/components/AccountsDropdown/AccountsDropdownContainer.js +3 -1
- package/lib/components/BalancesList/BalancesListContainer.js +4 -1
- package/lib/components/DigitalAssets/digitalAssetsPriceLabel.test.js +238 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +7 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +105 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.js +12 -1
- package/lib/components/InstrumentPositions/InstrumentPositionsContainer.js +4 -1
- package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.js +2 -1
- package/lib/components/NoAccountBanner/NoAccountBanner.css +9 -0
- package/lib/components/NoAccountBanner/NoAccountBanner.js +58 -0
- package/lib/components/NoAccountBanner/index.js +16 -0
- package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.css +31 -0
- package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.js +33 -0
- package/lib/components/NoAccountPlaceholder/index.js +9 -0
- package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +12 -4
- package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +246 -0
- package/lib/components/common/ErrorBoundary/ErrorBoundary.css +35 -0
- package/lib/components/common/ErrorBoundary/ErrorBoundary.js +87 -0
- package/lib/helpers/errorTextFormatter.js +13 -4
- package/lib/helpers/errorTextFormatter.test.js +26 -0
- package/lib/helpers/twoFactorAuthCancellation.js +38 -0
- package/lib/hocs/forAccount.js +33 -0
- package/lib/hocs/forAccount.test.js +50 -0
- package/lib/hocs/forVerified.js +16 -2
- package/lib/hocs/withAuthentication.js +3 -1
- package/lib/index.js +3 -2
- package/lib/layouts/HeaderLayout/HeaderLayout.js +2 -1
- package/lib/layouts/WalletsLayout/WalletsLayoutContainer.js +3 -1
- package/lib/layouts/WalletsLayout/WalletsLayoutContainer.test.js +84 -0
- package/lib/redux/actions/apiActions.js +25 -8
- package/lib/redux/actions/apiActions.test.js +98 -0
- package/lib/redux/actions/interestAccountActions.js +12 -3
- package/lib/redux/actions/interestAccountActions.test.js +73 -0
- package/lib/redux/actions/orderHistoryActions.js +11 -4
- package/lib/redux/actions/userActions.js +97 -34
- package/lib/redux/actions/userActions.test.js +303 -188
- package/lib/redux/actions/withdrawActions.js +62 -29
- package/lib/redux/actions/withdrawActions.test.js +246 -73
- package/lib/redux/actions/withdrawActions.travelRule.test.js +17 -3
- package/lib/redux/reducers/userReducer.js +10 -0
- package/lib/redux/reducers/userReducer.test.js +29 -0
- package/lib/redux/selectors/recentActivitySelector.js +8 -2
- package/lib/redux/selectors/recentActivitySelector.v2.test.js +33 -0
- package/lib/redux/selectors/userSelectors.js +6 -1
- package/lib/redux/selectors/userSelectors.test.js +28 -0
- package/package.json +4 -4
|
@@ -28,8 +28,14 @@ var newRecentActivitySelector = exports.newRecentActivitySelector = (0, _reselec
|
|
|
28
28
|
var manifest = _ref.productManifest.manifest;
|
|
29
29
|
return manifest;
|
|
30
30
|
}], function (recentActivity, interestAccruals, products, manifest) {
|
|
31
|
+
// callAPI hands back a refused call's { result: false } payload as is, so
|
|
32
|
+
// either list can be an error object instead of an array.
|
|
33
|
+
var toList = function toList(value) {
|
|
34
|
+
return Array.isArray(value) ? value : [];
|
|
35
|
+
};
|
|
36
|
+
|
|
31
37
|
// Transform recent activity transactions
|
|
32
|
-
var transactions = recentActivity.map(function (el) {
|
|
38
|
+
var transactions = toList(recentActivity).map(function (el) {
|
|
33
39
|
var product = products.find(function (i) {
|
|
34
40
|
return i.ProductId === el.ProductId;
|
|
35
41
|
}) || {};
|
|
@@ -50,7 +56,7 @@ var newRecentActivitySelector = exports.newRecentActivitySelector = (0, _reselec
|
|
|
50
56
|
});
|
|
51
57
|
|
|
52
58
|
// Transform interest accruals to match transaction format
|
|
53
|
-
var interestAccrualsTransformed = (interestAccruals
|
|
59
|
+
var interestAccrualsTransformed = toList(interestAccruals).map(function (el) {
|
|
54
60
|
var product = products.find(function (i) {
|
|
55
61
|
return i.ProductId === el.BorrowedProductId;
|
|
56
62
|
}) || {};
|
|
@@ -164,4 +164,37 @@ describe('newRecentActivitySelector - margin hardening features', function () {
|
|
|
164
164
|
expect(result[1].TransactionType).toBe('LiquidationFee');
|
|
165
165
|
expect(result[1].TimeStamp).toBe('2025-12-02T10:00:00.000Z');
|
|
166
166
|
});
|
|
167
|
+
it('should return an empty list when the calls came back as error payloads', function () {
|
|
168
|
+
var refused = {
|
|
169
|
+
result: false,
|
|
170
|
+
errormsg: 'Not Authorized',
|
|
171
|
+
errorcode: 20,
|
|
172
|
+
detail: null
|
|
173
|
+
};
|
|
174
|
+
var testState = {
|
|
175
|
+
user: {
|
|
176
|
+
selectedAccountId: 125
|
|
177
|
+
},
|
|
178
|
+
apexCore: {
|
|
179
|
+
orderHistory: {
|
|
180
|
+
recentActivity: refused,
|
|
181
|
+
interestAccruals: refused
|
|
182
|
+
},
|
|
183
|
+
product: {
|
|
184
|
+
products: [{
|
|
185
|
+
ProductId: 1,
|
|
186
|
+
ProductSymbol: 'BTC',
|
|
187
|
+
Product: 'BTC'
|
|
188
|
+
}]
|
|
189
|
+
},
|
|
190
|
+
position: {
|
|
191
|
+
positions: {}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
productManifest: {
|
|
195
|
+
manifest: {}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
expect((0, _recentActivitySelector.newRecentActivitySelector)(testState)).toEqual([]);
|
|
199
|
+
});
|
|
167
200
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.selectUserInfo = exports.selectUserConfig = exports.isSuperUser = exports.isStatusLevelIncreased = exports.isProfileSectionEditingDisabled = exports.isBrokerUser = exports.isBlockTradingEnabledForUser = void 0;
|
|
6
|
+
exports.selectUserInfo = exports.selectUserConfig = exports.isSuperUser = exports.isStatusLevelIncreased = exports.isProfileSectionEditingDisabled = exports.isBrokerUser = exports.isBlockTradingEnabledForUser = exports.hasNoAccountsSelector = void 0;
|
|
7
7
|
var _reselect = require("reselect");
|
|
8
8
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
9
9
|
var _userPermissionsContants = require("../../constants/userPermissionsContants");
|
|
@@ -43,6 +43,11 @@ var isBrokerUser = exports.isBrokerUser = (0, _reselect.createSelector)(selectUs
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
var isProfileSectionEditingDisabled = exports.isProfileSectionEditingDisabled = isStatusLevelIncreased;
|
|
46
|
+
|
|
47
|
+
// True once the account fetch has settled and found no accounts. False while it is still running.
|
|
48
|
+
var hasNoAccountsSelector = exports.hasNoAccountsSelector = (0, _reselect.createSelector)(getUserState, function (user) {
|
|
49
|
+
return user.accountsLoaded && !user.accounts.length;
|
|
50
|
+
});
|
|
46
51
|
var isBlockTradingEnabledForUser = exports.isBlockTradingEnabledForUser = (0, _reselect.createSelector)(function (state) {
|
|
47
52
|
return (0, _get["default"])(getUserState(state), 'permissions', emptyArray);
|
|
48
53
|
}, function (permissions) {
|
|
@@ -53,4 +53,32 @@ describe('userSelectors', function () {
|
|
|
53
53
|
};
|
|
54
54
|
expect((0, _userSelectors.isStatusLevelIncreased)(state)).toBe(undefined);
|
|
55
55
|
});
|
|
56
|
+
});
|
|
57
|
+
describe('hasNoAccountsSelector', function () {
|
|
58
|
+
it('is false while the accounts are still loading', function () {
|
|
59
|
+
expect((0, _userSelectors.hasNoAccountsSelector)({
|
|
60
|
+
user: {
|
|
61
|
+
accountsLoaded: false,
|
|
62
|
+
accounts: []
|
|
63
|
+
}
|
|
64
|
+
})).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
it('is true once the accounts have loaded with none', function () {
|
|
67
|
+
expect((0, _userSelectors.hasNoAccountsSelector)({
|
|
68
|
+
user: {
|
|
69
|
+
accountsLoaded: true,
|
|
70
|
+
accounts: []
|
|
71
|
+
}
|
|
72
|
+
})).toBe(true);
|
|
73
|
+
});
|
|
74
|
+
it('is false for a user with an account', function () {
|
|
75
|
+
expect((0, _userSelectors.hasNoAccountsSelector)({
|
|
76
|
+
user: {
|
|
77
|
+
accountsLoaded: true,
|
|
78
|
+
accounts: [{
|
|
79
|
+
AccountId: 15
|
|
80
|
+
}]
|
|
81
|
+
}
|
|
82
|
+
})).toBe(false);
|
|
83
|
+
});
|
|
56
84
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alphapoint/apex-web",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"node": ">=18.0.0"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@alphapoint/apex-chart-react": "^5.
|
|
12
|
+
"@alphapoint/apex-chart-react": "^5.7.0",
|
|
13
13
|
"@dnd-kit/core": "^6.1.0",
|
|
14
14
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
15
15
|
"@dnd-kit/sortable": "^8.0.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@babel/runtime": "^7.23.4",
|
|
72
72
|
"babel-jest": "^27.5.1",
|
|
73
73
|
"cross-env": "^7.0.3",
|
|
74
|
-
"eslint-config-apex": "^5.
|
|
74
|
+
"eslint-config-apex": "^5.7.0",
|
|
75
75
|
"fs-extra": "^11.1.1",
|
|
76
76
|
"identity-obj-proxy": "^3.0.0",
|
|
77
77
|
"jest": "^27.5.1",
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
"files": [
|
|
134
134
|
"lib"
|
|
135
135
|
],
|
|
136
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "9bda12ad92a6d35c088434deb29b112dbce07bde"
|
|
137
137
|
}
|