@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
@@ -0,0 +1,238 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ var _react = _interopRequireDefault(require("react"));
5
+ var _server = require("react-dom/server");
6
+ var _i18next = _interopRequireDefault(require("i18next"));
7
+ var _reactI18next = require("react-i18next");
8
+ var _DigitalAssetsOfferingProfilePage = _interopRequireDefault(require("./DigitalAssetsOfferingProfilePage"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
11
+ 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); }
12
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ 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); }
16
+ 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); }); }; } // Regression cover for the `Price:` label on the Digital Assets offering page.
17
+ //
18
+ // i18next treats `:` as the namespace separator. It only keeps a key whole when
19
+ // the key also contains one of ' ', ',', '?', '!' or ';' (its `looksLikeObjectPath`
20
+ // heuristic), so `Number of tokens for sale:` survives but `Price:` is parsed as
21
+ // namespace `Price` with an empty key and resolves to ''. The catalogs are fine;
22
+ // the loss happens at lookup, which is why the catalog-indexing suites under
23
+ // template/ and okx-web/ passed while the label rendered empty in the browser.
24
+ //
25
+ // The fix sets `nsSeparator: false` in both i18n.js files, so every such key is
26
+ // kept whole. These tests therefore drive the real i18next rather than indexing
27
+ // a catalog.
28
+ jest.mock('./TotalTokensCount', function () {
29
+ return {
30
+ ConnectedTotalTokens: function ConnectedTotalTokens() {
31
+ return /*#__PURE__*/_react["default"].createElement("span", null, "0.11587");
32
+ }
33
+ };
34
+ });
35
+ jest.mock('../common/APIFrame/APIFrame', function () {
36
+ return function () {
37
+ return /*#__PURE__*/_react["default"].createElement("div", null);
38
+ };
39
+ });
40
+ jest.mock('../common/APIconButton/APIconButton', function () {
41
+ return function (_ref) {
42
+ var label = _ref.label;
43
+ return /*#__PURE__*/_react["default"].createElement("button", null, label);
44
+ };
45
+ });
46
+ var CATALOGS = {
47
+ en: {
48
+ 'Price:': 'Price:',
49
+ 'Asset Details': 'Asset Details',
50
+ 'Number of tokens for sale:': 'Number of tokens for sale:',
51
+ Buy: 'Buy',
52
+ Sell: 'Sell'
53
+ },
54
+ es: {
55
+ 'Price:': 'Precio:',
56
+ 'Asset Details': 'Detalles del activo',
57
+ 'Number of tokens for sale:': 'Número de tokens en venta:',
58
+ Buy: 'Comprar',
59
+ Sell: 'Vender'
60
+ }
61
+ };
62
+
63
+ // The single-word `Foo:` keys that i18next drops by default, drawn from the
64
+ // shipped core/user/interest/margin catalogs.
65
+ var COLON_KEYS = Object.fromEntries(['Price:', 'Balance:', 'Fee:', 'Total:', 'Received:', 'Frequency:', 'Product:', 'Borrowed:', 'Trade:'].map(function (key) {
66
+ return [key, "traducido ".concat(key)];
67
+ }));
68
+
69
+ // Mirrors the template/okx-web i18n.js init, including the `nsSeparator: false`
70
+ // that the fix adds, so lookups behave exactly as in the deployed bundle.
71
+ var createInstance = /*#__PURE__*/function () {
72
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(language) {
73
+ var instance;
74
+ return _regenerator().w(function (_context) {
75
+ while (1) switch (_context.n) {
76
+ case 0:
77
+ // eslint-disable-next-line import/no-named-as-default-member
78
+ instance = _i18next["default"].createInstance();
79
+ _context.n = 1;
80
+ return instance.init({
81
+ lng: language,
82
+ fallbackLng: 'en',
83
+ fallbackNS: ['core', 'translation'],
84
+ nsSeparator: false,
85
+ initImmediate: false,
86
+ interpolation: {
87
+ escapeValue: false
88
+ },
89
+ resources: _defineProperty({}, language, {
90
+ user: CATALOGS[language],
91
+ colonKeys: COLON_KEYS
92
+ })
93
+ });
94
+ case 1:
95
+ return _context.a(2, instance);
96
+ }
97
+ }, _callee);
98
+ }));
99
+ return function createInstance(_x) {
100
+ return _ref2.apply(this, arguments);
101
+ };
102
+ }();
103
+ var renderPage = function renderPage(instance) {
104
+ return (0, _server.renderToStaticMarkup)(/*#__PURE__*/_react["default"].createElement(_reactI18next.I18nextProvider, {
105
+ i18n: instance
106
+ }, /*#__PURE__*/_react["default"].createElement(_DigitalAssetsOfferingProfilePage["default"], {
107
+ ProductId: 1,
108
+ OfferingProfileURL: "http://offering.example",
109
+ price: "82873.99561",
110
+ digitalAsset: {
111
+ Product: 'BTC',
112
+ ProductFullName: 'Bitcoin'
113
+ },
114
+ isWithdrawDisabled: false,
115
+ openSendReceiveSidePane: function openSendReceiveSidePane() {},
116
+ selectInstrument: function selectInstrument() {},
117
+ selectedInstrumentId: 1,
118
+ getProductAttributes: function getProductAttributes() {}
119
+ })));
120
+ };
121
+ describe('Digital Assets price label', function () {
122
+ it.each([['en', 'Price: $82873.99561'], ['es', 'Precio: $82873.99561']])('renders the price label and amount in %s', /*#__PURE__*/function () {
123
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(language, expected) {
124
+ var html, _t;
125
+ return _regenerator().w(function (_context2) {
126
+ while (1) switch (_context2.n) {
127
+ case 0:
128
+ _t = renderPage;
129
+ _context2.n = 1;
130
+ return createInstance(language);
131
+ case 1:
132
+ html = _t(_context2.v);
133
+ expect(html).toContain(expected);
134
+ case 2:
135
+ return _context2.a(2);
136
+ }
137
+ }, _callee2);
138
+ }));
139
+ return function (_x2, _x3) {
140
+ return _ref3.apply(this, arguments);
141
+ };
142
+ }());
143
+ it.each([['en', 'Number of tokens for sale:'], ['es', 'Número de tokens en venta:']])('leaves the neighbouring tokens-for-sale label untouched in %s', /*#__PURE__*/function () {
144
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(language, expected) {
145
+ var html, _t2;
146
+ return _regenerator().w(function (_context3) {
147
+ while (1) switch (_context3.n) {
148
+ case 0:
149
+ _t2 = renderPage;
150
+ _context3.n = 1;
151
+ return createInstance(language);
152
+ case 1:
153
+ html = _t2(_context3.v);
154
+ expect(html).toContain(expected);
155
+ case 2:
156
+ return _context3.a(2);
157
+ }
158
+ }, _callee3);
159
+ }));
160
+ return function (_x4, _x5) {
161
+ return _ref4.apply(this, arguments);
162
+ };
163
+ }());
164
+
165
+ // The reported failure: the label vanished and the amount was left with a leading
166
+ // space (` $82873.99561`). Guards the symptom itself, not just the key lookup.
167
+ it.each(['en', 'es'])('does not leave the amount unlabelled in %s', /*#__PURE__*/function () {
168
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(language) {
169
+ var html, _t3;
170
+ return _regenerator().w(function (_context4) {
171
+ while (1) switch (_context4.n) {
172
+ case 0:
173
+ _t3 = renderPage;
174
+ _context4.n = 1;
175
+ return createInstance(language);
176
+ case 1:
177
+ html = _t3(_context4.v);
178
+ expect(html).not.toContain('<div class="offering-profile__right"> $82873.99561');
179
+ case 2:
180
+ return _context4.a(2);
181
+ }
182
+ }, _callee4);
183
+ }));
184
+ return function (_x6) {
185
+ return _ref5.apply(this, arguments);
186
+ };
187
+ }());
188
+
189
+ // The same parsing drops every single-word key ending in ':'. These are the
190
+ // keys present in the shipped catalogs; they resolve only with nsSeparator off.
191
+ it.each(['Price:', 'Balance:', 'Fee:', 'Total:', 'Received:', 'Frequency:', 'Product:', 'Borrowed:', 'Trade:'])('keeps %s whole instead of splitting it on the namespace separator', /*#__PURE__*/function () {
192
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(key) {
193
+ var instance;
194
+ return _regenerator().w(function (_context5) {
195
+ while (1) switch (_context5.n) {
196
+ case 0:
197
+ _context5.n = 1;
198
+ return createInstance('es');
199
+ case 1:
200
+ instance = _context5.v;
201
+ expect(instance.getFixedT('es', 'colonKeys')(key)).toBe("traducido ".concat(key));
202
+ case 2:
203
+ return _context5.a(2);
204
+ }
205
+ }, _callee5);
206
+ }));
207
+ return function (_x7) {
208
+ return _ref6.apply(this, arguments);
209
+ };
210
+ }());
211
+
212
+ // Pins the cause, so the guard above cannot silently pass for the wrong reason.
213
+ it('drops the bare key when nsSeparator is left at the i18next default', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
214
+ var instance;
215
+ return _regenerator().w(function (_context6) {
216
+ while (1) switch (_context6.n) {
217
+ case 0:
218
+ // eslint-disable-next-line import/no-named-as-default-member
219
+ instance = _i18next["default"].createInstance();
220
+ _context6.n = 1;
221
+ return instance.init({
222
+ lng: 'es',
223
+ fallbackLng: 'en',
224
+ initImmediate: false,
225
+ resources: {
226
+ es: {
227
+ user: CATALOGS.es
228
+ }
229
+ }
230
+ });
231
+ case 1:
232
+ expect(instance.getFixedT('es', 'user')('Price:')).toBe('');
233
+ case 2:
234
+ return _context6.a(2);
235
+ }
236
+ }, _callee6);
237
+ })));
238
+ });
@@ -12,6 +12,7 @@ var _cssClassesHelper = require("../../helpers/cssClassesHelper");
12
12
  var _APAutoTabInput = _interopRequireDefault(require("../common/APAutoTabInput/APAutoTabInput"));
13
13
  var _APInput = _interopRequireDefault(require("../common/APInput/APInput"));
14
14
  var _formValidations = require("../../helpers/formValidations");
15
+ var _PasskeyOption = require("../2FA/PasskeyOption");
15
16
  require("./Disable2FAModal.css");
16
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
17
18
  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); }
@@ -23,19 +24,26 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
23
24
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
24
25
  var baseClasses = (0, _cssClassesHelper.getBEMClasses)('disable-2fa-modal');
25
26
  var Disable2FAForm = function Disable2FAForm(props) {
26
- var _useTranslation = (0, _reactI18next.useTranslation)("auth"),
27
+ var _useTranslation = (0, _reactI18next.useTranslation)('auth'),
27
28
  t = _useTranslation.t;
28
29
  var _useState = (0, _react.useState)(false),
29
30
  _useState2 = _slicedToArray(_useState, 2),
30
31
  isUsingYubikey = _useState2[0],
31
32
  setIsUsingYubikey = _useState2[1];
32
- var handleSubmit = props.handleSubmit;
33
+ var handleSubmit = props.handleSubmit,
34
+ onPasskey = props.onPasskey,
35
+ passkeyOnly = props.passkeyOnly,
36
+ answering = props.answering;
33
37
  return /*#__PURE__*/_react["default"].createElement("form", {
34
38
  onSubmit: handleSubmit,
35
39
  className: baseClasses()
36
40
  }, /*#__PURE__*/_react["default"].createElement("div", {
37
41
  className: baseClasses('text-item')
38
- }, t("Do you want to turn off Two-Factor Authentication for this account?")), isUsingYubikey ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_APInput["default"], {
42
+ }, t('Do you want to turn off Two-Factor Authentication for this account?')), passkeyOnly ? /*#__PURE__*/_react["default"].createElement(_PasskeyOption.PasskeyOnlyStep, {
43
+ onPasskey: onPasskey,
44
+ disabled: answering,
45
+ dataTest: "disable-2fa-passkey"
46
+ }) : isUsingYubikey ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_APInput["default"], {
39
47
  name: "otp",
40
48
  autoFocus: true,
41
49
  validate: [_formValidations.required],
@@ -48,8 +56,8 @@ var Disable2FAForm = function Disable2FAForm(props) {
48
56
  return setIsUsingYubikey(false);
49
57
  },
50
58
  className: "link --small-font"
51
- }, t("Click here to switch back.")))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_APAutoTabInput["default"], {
52
- label: t("Type Authentication Code Here"),
59
+ }, t('Click here to switch back.')))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_APAutoTabInput["default"], {
60
+ label: t('Type Authentication Code Here'),
53
61
  name: "code",
54
62
  type: "number",
55
63
  numberOfInputs: 6,
@@ -62,13 +70,20 @@ var Disable2FAForm = function Disable2FAForm(props) {
62
70
  return setIsUsingYubikey(true);
63
71
  },
64
72
  className: "link --small-font"
65
- }, t("Click here to use a Yubikey instead.")))));
73
+ }, t('Click here to use a Yubikey instead.'))), /*#__PURE__*/_react["default"].createElement(_PasskeyOption.PasskeyOption, {
74
+ onPasskey: onPasskey,
75
+ disabled: answering,
76
+ dataTest: "disable-2fa-passkey"
77
+ })));
66
78
  };
67
79
  Disable2FAForm.defaultProps = {
68
80
  handleSubmit: function handleSubmit() {},
69
81
  submitting: false
70
82
  };
71
83
  Disable2FAForm.propTypes = {
72
- handleSubmit: _propTypes["default"].func
84
+ handleSubmit: _propTypes["default"].func,
85
+ onPasskey: _propTypes["default"].func,
86
+ passkeyOnly: _propTypes["default"].bool,
87
+ answering: _propTypes["default"].bool
73
88
  };
74
89
  var _default = exports["default"] = Disable2FAForm;
@@ -11,16 +11,19 @@ var _Modal = _interopRequireDefault(require("../common/Modal/Modal"));
11
11
  var _Disable2FAForm = _interopRequireDefault(require("./Disable2FAForm"));
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
13
13
  var Disable2FAModal = function Disable2FAModal(props) {
14
- var _useTranslation = (0, _reactI18next.useTranslation)("auth"),
14
+ var _useTranslation = (0, _reactI18next.useTranslation)('auth'),
15
15
  t = _useTranslation.t;
16
16
  var handleSubmit = props.handleSubmit,
17
17
  submitting = props.submitting,
18
18
  isOpen = props.isOpen,
19
19
  close = props.close,
20
- changeFieldValue = props.changeFieldValue;
20
+ changeFieldValue = props.changeFieldValue,
21
+ onPasskey = props.onPasskey,
22
+ passkeyOnly = props.passkeyOnly,
23
+ answering = props.answering;
21
24
  return /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
22
25
  isOpen: isOpen,
23
- title: t("Disable Two-Factor Authentication"),
26
+ title: t('Disable Two-Factor Authentication'),
24
27
  onCancel: function onCancel() {
25
28
  close();
26
29
  changeFieldValue('enableTwoFactorAuth', 'use2FA', true);
@@ -28,7 +31,10 @@ var Disable2FAModal = function Disable2FAModal(props) {
28
31
  close: close
29
32
  }, /*#__PURE__*/_react["default"].createElement(_Disable2FAForm["default"], {
30
33
  handleSubmit: handleSubmit,
31
- submitting: submitting
34
+ submitting: submitting,
35
+ onPasskey: onPasskey,
36
+ passkeyOnly: passkeyOnly,
37
+ answering: answering
32
38
  }));
33
39
  };
34
40
  Disable2FAModal.defaultProps = {
@@ -37,6 +43,10 @@ Disable2FAModal.defaultProps = {
37
43
  };
38
44
  Disable2FAModal.propTypes = {
39
45
  close: _propTypes["default"].func.isRequired,
40
- handleSubmit: _propTypes["default"].func
46
+ handleSubmit: _propTypes["default"].func,
47
+ onPasskey: _propTypes["default"].func,
48
+ passkeyOnly: _propTypes["default"].bool,
49
+ // an answer (a code or a passkey) is on its way
50
+ answering: _propTypes["default"].bool
41
51
  };
42
52
  var _default = exports["default"] = Disable2FAModal;