auth0-lock 11.35.0 → 12.0.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/.browserslistrc +1 -0
- package/.circleci/config.yml +3 -1
- package/.shiprc +4 -5
- package/CHANGELOG.md +25 -0
- package/DEVELOPMENT.md +1 -1
- package/README.md +20 -16
- package/karma.conf.js +1 -1
- package/lib/CSSCore.js +1 -4
- package/lib/__tests__/auth_button.js +12 -22
- package/lib/__tests__/connection/database/actions.js +48 -49
- package/lib/__tests__/connection/database/index.js +22 -28
- package/lib/__tests__/connection/database/login_pane.js +24 -47
- package/lib/__tests__/connection/database/password_reset_confirmation.js +23 -32
- package/lib/__tests__/connection/database/reset_password.js +17 -39
- package/lib/__tests__/connection/database/signed_up_confirmation.js +23 -32
- package/lib/__tests__/connection/enterprise/actions.js +22 -47
- package/lib/__tests__/connection/enterprise/hrd_pane.js +16 -33
- package/lib/__tests__/connection/enterprise/hrd_screen.js +26 -40
- package/lib/__tests__/connection/enterprise/quick_auth_screen.js +32 -75
- package/lib/__tests__/connection/passwordless/ask_vcode.js +29 -51
- package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +23 -32
- package/lib/__tests__/connection/passwordless/passwordless.js +35 -97
- package/lib/__tests__/core/actions.js +23 -46
- package/lib/__tests__/core/client/index.js +10 -13
- package/lib/__tests__/core/index.js +46 -94
- package/lib/__tests__/core/remote_data.js +14 -20
- package/lib/__tests__/core/signed_in_confirmation.js +23 -32
- package/lib/__tests__/core/sso/last_login_screen.js +27 -50
- package/lib/__tests__/core/tenant.js +10 -12
- package/lib/__tests__/core/web_api/helper.js +6 -14
- package/lib/__tests__/core/web_api/p2_api.js +38 -33
- package/lib/__tests__/core/web_api.js +37 -33
- package/lib/__tests__/engine/classic/login.js +20 -41
- package/lib/__tests__/engine/classic/mfa_login_screen.js +6 -19
- package/lib/__tests__/engine/classic/sign_up_pane.js +33 -55
- package/lib/__tests__/engine/classic/sign_up_screen.js +18 -45
- package/lib/__tests__/engine/classic.js +13 -6
- package/lib/__tests__/engine/passwordless/social_or_email_login_screen.js +7 -28
- package/lib/__tests__/engine/passwordless/social_or_phone_number_login_screen.js +7 -28
- package/lib/__tests__/engine/passwordless.js +2 -5
- package/lib/__tests__/field/captcha/recaptcha_enterprise.js +27 -27
- package/lib/__tests__/field/captcha/recaptchav2.js +27 -27
- package/lib/__tests__/field/captcha.js +39 -51
- package/lib/__tests__/field/custom_input.js +23 -47
- package/lib/__tests__/field/email.js +2 -3
- package/lib/__tests__/field/email_pane.js +25 -48
- package/lib/__tests__/field/field.js +9 -13
- package/lib/__tests__/field/login_pane.js +30 -34
- package/lib/__tests__/field/mfa_code_pane.js +13 -28
- package/lib/__tests__/field/option_selection_pane.js +7 -25
- package/lib/__tests__/field/password.js +6 -12
- package/lib/__tests__/field/password_pane.js +29 -46
- package/lib/__tests__/field/phone_number_pane.js +18 -41
- package/lib/__tests__/field/social_buttons_pane.js +30 -47
- package/lib/__tests__/field/username.js +27 -48
- package/lib/__tests__/field/username_pane.js +30 -47
- package/lib/__tests__/field/vcode.js +5 -13
- package/lib/__tests__/field/vcode_pane.js +20 -44
- package/lib/__tests__/i18n.js +28 -53
- package/lib/__tests__/quick-auth/actions.js +4 -27
- package/lib/__tests__/setup-tests.js +7 -9
- package/lib/__tests__/testUtils.js +41 -58
- package/lib/__tests__/ui/box/chrome.js +24 -49
- package/lib/__tests__/ui/box/confirmation_pane.js +23 -42
- package/lib/__tests__/ui/box/container.js +21 -46
- package/lib/__tests__/ui/box/global_message.js +60 -37
- package/lib/__tests__/ui/input/email_input.js +6 -17
- package/lib/__tests__/ui/input/input_wrap.js +6 -19
- package/lib/__tests__/ui/input/password/password_strength.js +13 -15
- package/lib/__tests__/ui/input/password_input.js +22 -27
- package/lib/__tests__/utils/format.js +10 -17
- package/lib/__tests__/utils/url_utils.js +2 -5
- package/lib/avatar/gravatar_provider.js +13 -28
- package/lib/avatar.js +22 -41
- package/lib/browser.js +372 -23
- package/lib/connection/captcha.js +15 -34
- package/lib/connection/database/actions.js +39 -108
- package/lib/connection/database/index.js +90 -191
- package/lib/connection/database/login_pane.js +107 -147
- package/lib/connection/database/login_sign_up_tabs.js +106 -125
- package/lib/connection/database/mfa_pane.js +50 -69
- package/lib/connection/database/password_reset_confirmation.js +51 -73
- package/lib/connection/database/reset_password.js +116 -132
- package/lib/connection/database/reset_password_pane.js +45 -56
- package/lib/connection/database/sign_up_terms.js +17 -23
- package/lib/connection/database/signed_up_confirmation.js +52 -75
- package/lib/connection/enterprise/actions.js +23 -52
- package/lib/connection/enterprise/hrd_pane.js +60 -76
- package/lib/connection/enterprise/hrd_screen.js +60 -75
- package/lib/connection/enterprise/kerberos_screen.js +46 -60
- package/lib/connection/enterprise/quick_auth_screen.js +46 -64
- package/lib/connection/enterprise/single_sign_on_notice.js +14 -26
- package/lib/connection/enterprise.js +51 -84
- package/lib/connection/passwordless/actions.js +29 -65
- package/lib/connection/passwordless/ask_vcode.js +53 -60
- package/lib/connection/passwordless/email_sent_confirmation.js +129 -179
- package/lib/connection/passwordless/index.js +36 -68
- package/lib/connection/social/index.js +12 -15
- package/lib/core/actions.js +33 -85
- package/lib/core/client/index.js +38 -58
- package/lib/core/client/settings.js +12 -20
- package/lib/core/error_screen.js +38 -52
- package/lib/core/index.js +154 -305
- package/lib/core/loading_screen.js +61 -71
- package/lib/core/pane_separator.js +10 -10
- package/lib/core/remote_data.js +30 -51
- package/lib/core/screen.js +85 -79
- package/lib/core/signed_in_confirmation.js +51 -73
- package/lib/core/sso/data.js +9 -17
- package/lib/core/sso/index.js +5 -6
- package/lib/core/sso/last_login_screen.js +46 -63
- package/lib/core/tenant/index.js +37 -59
- package/lib/core/tenant/settings.js +11 -15
- package/lib/core/web_api/helper.js +22 -28
- package/lib/core/web_api/p2_api.js +162 -171
- package/lib/core/web_api.js +106 -94
- package/lib/core.js +126 -160
- package/lib/engine/classic/login.js +92 -144
- package/lib/engine/classic/mfa_login_screen.js +61 -67
- package/lib/engine/classic/sign_up_pane.js +89 -123
- package/lib/engine/classic/sign_up_screen.js +112 -158
- package/lib/engine/classic.js +122 -183
- package/lib/engine/passwordless/social_or_email_login_screen.js +80 -116
- package/lib/engine/passwordless/social_or_phone_number_login_screen.js +79 -110
- package/lib/engine/passwordless.js +75 -104
- package/lib/field/actions.js +11 -17
- package/lib/field/captcha/captcha_pane.js +83 -103
- package/lib/field/captcha/recaptcha.js +140 -145
- package/lib/field/captcha.js +7 -10
- package/lib/field/custom_input.js +37 -50
- package/lib/field/email/email_pane.js +90 -109
- package/lib/field/email.js +17 -35
- package/lib/field/index.js +50 -87
- package/lib/field/mfa-code/mfa_code_pane.js +57 -71
- package/lib/field/mfa_code.js +15 -21
- package/lib/field/option_selection_pane.js +16 -22
- package/lib/field/password/password_pane.js +79 -91
- package/lib/field/password.js +8 -14
- package/lib/field/phone-number/locations.js +7 -3
- package/lib/field/phone-number/phone_number_pane.js +87 -124
- package/lib/field/phone_number.js +16 -30
- package/lib/field/social/event.js +9 -12
- package/lib/field/social/social_buttons_pane.js +93 -121
- package/lib/field/username/username_pane.js +105 -123
- package/lib/field/username.js +16 -26
- package/lib/field/vcode/vcode_pane.js +67 -93
- package/lib/field/vcode.js +5 -5
- package/lib/i18n/af.js +7 -4
- package/lib/i18n/ar.js +7 -4
- package/lib/i18n/az.js +7 -4
- package/lib/i18n/bg.js +7 -4
- package/lib/i18n/ca.js +7 -4
- package/lib/i18n/cs.js +7 -4
- package/lib/i18n/da.js +7 -4
- package/lib/i18n/de.js +7 -3
- package/lib/i18n/el.js +7 -4
- package/lib/i18n/en.js +9 -4
- package/lib/i18n/es.js +7 -3
- package/lib/i18n/et.js +7 -4
- package/lib/i18n/fa.js +7 -4
- package/lib/i18n/fi.js +7 -4
- package/lib/i18n/fr.js +7 -4
- package/lib/i18n/he.js +7 -4
- package/lib/i18n/hr.js +7 -4
- package/lib/i18n/hu.js +7 -4
- package/lib/i18n/id.js +7 -4
- package/lib/i18n/it.js +7 -3
- package/lib/i18n/ja.js +7 -4
- package/lib/i18n/ko.js +7 -4
- package/lib/i18n/lt.js +7 -4
- package/lib/i18n/lv.js +7 -4
- package/lib/i18n/ms.js +7 -4
- package/lib/i18n/nb.js +7 -4
- package/lib/i18n/nl.js +7 -4
- package/lib/i18n/nn.js +7 -4
- package/lib/i18n/no.js +7 -4
- package/lib/i18n/pl.js +7 -4
- package/lib/i18n/pt-br.js +7 -3
- package/lib/i18n/pt.js +7 -4
- package/lib/i18n/ro.js +7 -4
- package/lib/i18n/ru.js +7 -4
- package/lib/i18n/sk.js +7 -4
- package/lib/i18n/sl.js +7 -4
- package/lib/i18n/sr.js +7 -4
- package/lib/i18n/sv.js +7 -4
- package/lib/i18n/tr.js +7 -4
- package/lib/i18n/ua.js +7 -4
- package/lib/i18n/uk.js +7 -4
- package/lib/i18n/vi.js +7 -4
- package/lib/i18n/zh-tw.js +7 -4
- package/lib/i18n/zh.js +7 -4
- package/lib/i18n.js +38 -75
- package/lib/index.js +14 -17
- package/lib/lock.js +29 -32
- package/lib/passwordless.js +29 -31
- package/lib/quick-auth/actions.js +19 -26
- package/lib/quick_auth.js +8 -10
- package/lib/sanitizer.js +5 -5
- package/lib/store/index.js +22 -42
- package/lib/sync.js +21 -42
- package/lib/ui/box/button.js +85 -105
- package/lib/ui/box/chrome.js +463 -548
- package/lib/ui/box/confirmation_pane.js +34 -48
- package/lib/ui/box/container.js +305 -339
- package/lib/ui/box/global_message.js +51 -60
- package/lib/ui/box/header.js +155 -177
- package/lib/ui/box/multisize_slide.js +233 -229
- package/lib/ui/box/success_pane.js +34 -37
- package/lib/ui/box.js +88 -93
- package/lib/ui/button/auth_button.js +44 -51
- package/lib/ui/input/captcha_input.js +162 -181
- package/lib/ui/input/checkbox_input.js +57 -59
- package/lib/ui/input/email_input.js +117 -124
- package/lib/ui/input/input_wrap.js +65 -80
- package/lib/ui/input/location_input.js +130 -150
- package/lib/ui/input/mfa_code_input.js +98 -98
- package/lib/ui/input/password/password_strength.js +103 -127
- package/lib/ui/input/password_input.js +141 -147
- package/lib/ui/input/phone_number_input.js +101 -109
- package/lib/ui/input/select_input.js +120 -132
- package/lib/ui/input/text_input.js +89 -84
- package/lib/ui/input/username_input.js +109 -115
- package/lib/ui/input/vcode_input.js +110 -118
- package/lib/ui/list.js +224 -247
- package/lib/ui/pane/quick_auth_pane.js +55 -80
- package/lib/utils/atom.js +55 -48
- package/lib/utils/cache.js +54 -43
- package/lib/utils/cdn_utils.js +17 -31
- package/lib/utils/createRef.js +3 -1
- package/lib/utils/data_utils.js +10 -16
- package/lib/utils/fn_utils.js +5 -4
- package/lib/utils/format.js +6 -8
- package/lib/utils/id_utils.js +4 -3
- package/lib/utils/jsonp_utils.js +20 -17
- package/lib/utils/media_utils.js +4 -2
- package/lib/utils/preload_utils.js +4 -3
- package/lib/utils/string_utils.js +4 -4
- package/lib/utils/url_utils.js +4 -3
- package/package.json +48 -34
- package/webpack.config.js +36 -3
|
@@ -1,55 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var _immutable2 = _interopRequireDefault(_immutable);
|
|
12
|
-
|
|
13
|
-
var _i18n = require('../../../i18n');
|
|
14
|
-
|
|
15
|
-
var i18n = _interopRequireWildcard(_i18n);
|
|
16
|
-
|
|
17
|
-
var _hrd_pane = require('../../../connection/enterprise/hrd_pane');
|
|
18
|
-
|
|
19
|
-
var _hrd_pane2 = _interopRequireDefault(_hrd_pane);
|
|
20
|
-
|
|
21
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
22
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
6
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
7
|
+
var i18n = _interopRequireWildcard(require("../../../i18n"));
|
|
8
|
+
var _hrd_pane = _interopRequireDefault(require("../../../connection/enterprise/hrd_pane"));
|
|
9
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
var lock = _immutable.default.fromJS({
|
|
13
|
+
id: '__lock-id__'
|
|
14
|
+
});
|
|
27
15
|
jest.mock('core/index');
|
|
28
|
-
|
|
29
16
|
describe('HRDPane', function () {
|
|
30
17
|
var defaultProps = {
|
|
31
18
|
model: lock,
|
|
32
|
-
header:
|
|
19
|
+
header: /*#__PURE__*/_react.default.createElement("header", null),
|
|
33
20
|
i18n: i18n,
|
|
34
21
|
passwordInputPlaceholder: 'password',
|
|
35
22
|
usernameInputPlaceholder: 'username'
|
|
36
23
|
};
|
|
37
|
-
|
|
38
24
|
beforeEach(function () {
|
|
39
25
|
jest.resetAllMocks();
|
|
40
26
|
});
|
|
41
|
-
|
|
42
27
|
it('renders correctly', function () {
|
|
43
|
-
(0, _testUtils.expectShallowComponent)(
|
|
28
|
+
(0, _testUtils.expectShallowComponent)( /*#__PURE__*/_react.default.createElement(_hrd_pane.default, defaultProps)).toMatchSnapshot();
|
|
44
29
|
});
|
|
45
|
-
|
|
46
30
|
it('renders the captcha if required', function () {
|
|
47
31
|
require('core/index').captcha.mockReturnValue({
|
|
48
32
|
get: function get() {
|
|
49
33
|
return true;
|
|
50
34
|
}
|
|
51
35
|
});
|
|
52
|
-
|
|
53
|
-
(0, _testUtils.expectShallowComponent)(_react2.default.createElement(_hrd_pane2.default, defaultProps)).toMatchSnapshot();
|
|
36
|
+
(0, _testUtils.expectShallowComponent)( /*#__PURE__*/_react.default.createElement(_hrd_pane.default, defaultProps)).toMatchSnapshot();
|
|
54
37
|
});
|
|
55
38
|
});
|
|
@@ -1,28 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var _immutable2 = _interopRequireDefault(_immutable);
|
|
12
|
-
|
|
13
|
-
var _data_utils = require('../../../utils/data_utils');
|
|
14
|
-
|
|
15
|
-
var _i18n = require('../../../i18n');
|
|
16
|
-
|
|
17
|
-
var i18n = _interopRequireWildcard(_i18n);
|
|
18
|
-
|
|
19
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
20
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
6
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
7
|
+
var _data_utils = require("../../../utils/data_utils");
|
|
8
|
+
var i18n = _interopRequireWildcard(require("../../../i18n"));
|
|
9
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
|
|
23
12
|
var _dataFns = (0, _data_utils.dataFns)(['i18n']),
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
set = _dataFns.set;
|
|
26
14
|
jest.mock('engine/classic');
|
|
27
15
|
jest.mock('connection/enterprise/hrd_pane', function () {
|
|
28
16
|
return (0, _testUtils.mockComponent)('hrd_pane');
|
|
@@ -34,50 +22,48 @@ jest.mock('connection/enterprise', function () {
|
|
|
34
22
|
})
|
|
35
23
|
};
|
|
36
24
|
});
|
|
37
|
-
|
|
38
25
|
var getComponent = function getComponent() {
|
|
39
26
|
var HRDScreen = require('connection/enterprise/hrd_screen').default;
|
|
40
27
|
var screen = new HRDScreen();
|
|
41
28
|
return screen.render();
|
|
42
29
|
};
|
|
43
|
-
|
|
44
30
|
describe('HRDScreen Component', function () {
|
|
45
|
-
var i18nProp
|
|
46
|
-
var lock
|
|
47
|
-
|
|
31
|
+
var i18nProp;
|
|
32
|
+
var lock;
|
|
48
33
|
beforeEach(function () {
|
|
49
|
-
lock =
|
|
50
|
-
|
|
34
|
+
lock = _immutable.default.fromJS({
|
|
35
|
+
id: '__lock-id__'
|
|
36
|
+
});
|
|
51
37
|
jest.resetModules();
|
|
52
|
-
|
|
53
|
-
var lang = _immutable2.default.fromJS({
|
|
38
|
+
var lang = _immutable.default.fromJS({
|
|
54
39
|
enterpriseLoginIntructions: 'Login with your corporate credentials.',
|
|
55
40
|
enterpriseActiveLoginInstructions: 'Please enter your corporate credentials at %s.'
|
|
56
41
|
});
|
|
57
|
-
|
|
58
42
|
lock = set(lock, 'strings', lang);
|
|
59
|
-
|
|
60
43
|
i18nProp = {
|
|
61
44
|
str: function str(keypath) {
|
|
62
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
45
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
63
46
|
args[_key - 1] = arguments[_key];
|
|
64
47
|
}
|
|
65
|
-
|
|
66
48
|
return i18n.str(lock, keypath, args);
|
|
67
49
|
}
|
|
68
50
|
};
|
|
69
51
|
});
|
|
70
|
-
|
|
71
52
|
it('renders correctly when there is an enterprise domain', function () {
|
|
72
53
|
var Component = getComponent();
|
|
73
|
-
(0, _testUtils.expectComponent)(
|
|
54
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, {
|
|
55
|
+
model: lock,
|
|
56
|
+
i18n: i18nProp
|
|
57
|
+
})).toMatchSnapshot();
|
|
74
58
|
});
|
|
75
|
-
|
|
76
59
|
it('renders correctly when there is no enterprise domain', function () {
|
|
77
60
|
require('connection/enterprise').enterpriseDomain.mockImplementation(function () {
|
|
78
61
|
return null;
|
|
79
62
|
});
|
|
80
63
|
var Component = getComponent();
|
|
81
|
-
(0, _testUtils.expectComponent)(
|
|
64
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, {
|
|
65
|
+
model: lock,
|
|
66
|
+
i18n: i18nProp
|
|
67
|
+
})).toMatchSnapshot();
|
|
82
68
|
});
|
|
83
69
|
});
|
|
@@ -1,49 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _immutable = require('immutable');
|
|
8
|
-
|
|
9
|
-
var _immutable2 = _interopRequireDefault(_immutable);
|
|
10
|
-
|
|
11
|
-
var _testUtils = require('testUtils');
|
|
1
|
+
"use strict";
|
|
12
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
6
|
+
var _testUtils = require("testUtils");
|
|
13
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
8
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
9
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
17
11
|
jest.mock('engine/classic');
|
|
18
|
-
|
|
19
12
|
var getComponent = function getComponent() {
|
|
20
13
|
var MFALoginScreen = require('connection/enterprise/quick_auth_screen').default;
|
|
21
14
|
var screen = new MFALoginScreen();
|
|
22
15
|
return screen.render();
|
|
23
16
|
};
|
|
24
|
-
|
|
25
17
|
describe('The quick auth screen', function () {
|
|
26
18
|
var defaultProps = {
|
|
27
19
|
i18n: {
|
|
28
20
|
str: function str() {
|
|
29
|
-
for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
|
+
for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
22
|
keys[_key] = arguments[_key];
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
return keys.join(',');
|
|
34
25
|
},
|
|
35
26
|
html: jest.fn()
|
|
36
27
|
}
|
|
37
28
|
};
|
|
38
|
-
|
|
39
29
|
beforeEach(function () {
|
|
40
30
|
jest.resetModules();
|
|
41
|
-
|
|
42
|
-
var mockConnection = _immutable2.default.fromJS({
|
|
31
|
+
var mockConnection = _immutable.default.fromJS({
|
|
43
32
|
name: 'Test',
|
|
44
33
|
domains: ['test.com']
|
|
45
34
|
});
|
|
46
|
-
|
|
47
35
|
jest.mock('connection/social/index', function () {
|
|
48
36
|
return {
|
|
49
37
|
hasScreen: false,
|
|
@@ -54,7 +42,6 @@ describe('The quick auth screen', function () {
|
|
|
54
42
|
})
|
|
55
43
|
};
|
|
56
44
|
});
|
|
57
|
-
|
|
58
45
|
jest.mock('connection/enterprise', function () {
|
|
59
46
|
return {
|
|
60
47
|
quickAuthConnection: jest.fn(function () {
|
|
@@ -62,7 +49,6 @@ describe('The quick auth screen', function () {
|
|
|
62
49
|
})
|
|
63
50
|
};
|
|
64
51
|
});
|
|
65
|
-
|
|
66
52
|
jest.mock('core/index', function () {
|
|
67
53
|
return {
|
|
68
54
|
ui: {
|
|
@@ -73,96 +59,67 @@ describe('The quick auth screen', function () {
|
|
|
73
59
|
};
|
|
74
60
|
});
|
|
75
61
|
});
|
|
76
|
-
|
|
77
|
-
it('renders the connection using the domain', _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
62
|
+
it('renders the connection using the domain', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
78
63
|
var Component;
|
|
79
|
-
return
|
|
80
|
-
while (1) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
case 2:
|
|
89
|
-
case 'end':
|
|
90
|
-
return _context.stop();
|
|
91
|
-
}
|
|
64
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
65
|
+
while (1) switch (_context.prev = _context.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
Component = getComponent();
|
|
68
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
69
|
+
case 2:
|
|
70
|
+
case "end":
|
|
71
|
+
return _context.stop();
|
|
92
72
|
}
|
|
93
|
-
}, _callee
|
|
73
|
+
}, _callee);
|
|
94
74
|
})));
|
|
95
|
-
|
|
96
75
|
it('renders the connection using the display name when preferConnectionDisplayName is true', function () {
|
|
97
|
-
var mockConnection =
|
|
76
|
+
var mockConnection = _immutable.default.fromJS({
|
|
98
77
|
name: 'Test',
|
|
99
78
|
domains: ['test.com'],
|
|
100
79
|
displayName: 'My Connection'
|
|
101
80
|
});
|
|
102
|
-
|
|
103
81
|
var _require = require('connection/enterprise'),
|
|
104
|
-
|
|
105
|
-
|
|
82
|
+
quickAuthConnection = _require.quickAuthConnection;
|
|
106
83
|
quickAuthConnection.mockReturnValue(mockConnection);
|
|
107
|
-
|
|
108
84
|
var l = require('core/index');
|
|
109
85
|
l.ui.preferConnectionDisplayName.mockReturnValue(true);
|
|
110
|
-
|
|
111
86
|
var Component = getComponent();
|
|
112
|
-
|
|
113
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
87
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
114
88
|
});
|
|
115
|
-
|
|
116
89
|
it('renders the connection using the connection domain when preferConnectionDisplayName is true, but no display name available', function () {
|
|
117
|
-
var mockConnection =
|
|
90
|
+
var mockConnection = _immutable.default.fromJS({
|
|
118
91
|
name: 'Test',
|
|
119
92
|
domains: ['test.com']
|
|
120
93
|
});
|
|
121
|
-
|
|
122
94
|
var _require2 = require('connection/enterprise'),
|
|
123
|
-
|
|
124
|
-
|
|
95
|
+
quickAuthConnection = _require2.quickAuthConnection;
|
|
125
96
|
quickAuthConnection.mockReturnValue(mockConnection);
|
|
126
|
-
|
|
127
97
|
var l = require('core/index');
|
|
128
98
|
l.ui.preferConnectionDisplayName.mockReturnValue(true);
|
|
129
|
-
|
|
130
99
|
var Component = getComponent();
|
|
131
|
-
|
|
132
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
100
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
133
101
|
});
|
|
134
|
-
|
|
135
102
|
it('renders the connection using the connection display name when preferConnectionDisplayName is true and there are no IdP domains configured', function () {
|
|
136
|
-
var mockConnection =
|
|
103
|
+
var mockConnection = _immutable.default.fromJS({
|
|
137
104
|
name: 'Test',
|
|
138
105
|
displayName: 'My Connection'
|
|
139
106
|
});
|
|
140
|
-
|
|
141
107
|
var _require3 = require('connection/enterprise'),
|
|
142
|
-
|
|
143
|
-
|
|
108
|
+
quickAuthConnection = _require3.quickAuthConnection;
|
|
144
109
|
quickAuthConnection.mockReturnValue(mockConnection);
|
|
145
|
-
|
|
146
110
|
var l = require('core/index');
|
|
147
111
|
l.ui.preferConnectionDisplayName.mockReturnValue(true);
|
|
148
|
-
|
|
149
112
|
var Component = getComponent();
|
|
150
|
-
|
|
151
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
113
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
152
114
|
});
|
|
153
|
-
|
|
154
115
|
it('renders the connection using the connection name when there is no domain available', function () {
|
|
155
|
-
var mockConnection =
|
|
116
|
+
var mockConnection = _immutable.default.fromJS({
|
|
156
117
|
name: 'Test'
|
|
157
118
|
});
|
|
158
|
-
|
|
159
119
|
var _require4 = require('connection/enterprise'),
|
|
160
|
-
|
|
161
|
-
|
|
120
|
+
quickAuthConnection = _require4.quickAuthConnection;
|
|
162
121
|
quickAuthConnection.mockReturnValue(mockConnection);
|
|
163
|
-
|
|
164
122
|
var Component = getComponent();
|
|
165
|
-
|
|
166
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
123
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
167
124
|
});
|
|
168
125
|
});
|
|
@@ -1,34 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
var _i18n = require('../../../i18n');
|
|
16
|
-
|
|
17
|
-
var i18n = _interopRequireWildcard(_i18n);
|
|
18
|
-
|
|
19
|
-
var _testUtils2 = require('../../testUtils');
|
|
20
|
-
|
|
21
|
-
var _data_utils = require('../../../utils/data_utils');
|
|
22
|
-
|
|
23
|
-
var _phone_number = require('../../../field/phone_number');
|
|
24
|
-
|
|
25
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
26
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
6
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
7
|
+
var _field = require("../../../field");
|
|
8
|
+
var i18n = _interopRequireWildcard(require("../../../i18n"));
|
|
9
|
+
var _testUtils2 = require("../../testUtils");
|
|
10
|
+
var _data_utils = require("../../../utils/data_utils");
|
|
11
|
+
var _phone_number = require("../../../field/phone_number");
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
|
-
|
|
29
15
|
var _dataFns = (0, _data_utils.dataFns)(['i18n']),
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
set = _dataFns.set;
|
|
32
17
|
jest.mock('engine/classic');
|
|
33
18
|
jest.mock('field/vcode/vcode_pane', function () {
|
|
34
19
|
return (0, _testUtils.mockComponent)('vcode_pane');
|
|
@@ -39,66 +24,59 @@ jest.mock('field/phone-number/locations', function () {
|
|
|
39
24
|
default: [['United Kingdom', 'UK', '+44']]
|
|
40
25
|
};
|
|
41
26
|
});
|
|
42
|
-
|
|
43
27
|
jest.mock('connection/passwordless/index', function () {
|
|
44
28
|
return {
|
|
45
29
|
isEmail: jest.fn()
|
|
46
30
|
};
|
|
47
31
|
});
|
|
48
|
-
|
|
49
32
|
var getComponent = function getComponent() {
|
|
50
33
|
var VCodeScreen = require('connection/passwordless/ask_vcode').default;
|
|
51
34
|
var screen = new VCodeScreen();
|
|
52
35
|
return screen.render();
|
|
53
36
|
};
|
|
54
|
-
|
|
55
37
|
describe('AskVCode', function () {
|
|
56
|
-
var lock
|
|
57
|
-
var i18nProp
|
|
58
|
-
|
|
38
|
+
var lock;
|
|
39
|
+
var i18nProp;
|
|
59
40
|
beforeEach(function () {
|
|
60
|
-
lock =
|
|
61
|
-
|
|
41
|
+
lock = _immutable.default.fromJS({
|
|
42
|
+
id: '__lock-id__'
|
|
43
|
+
});
|
|
62
44
|
jest.resetModules();
|
|
63
|
-
|
|
64
|
-
var lang = _immutable2.default.fromJS({
|
|
45
|
+
var lang = _immutable.default.fromJS({
|
|
65
46
|
passwordlessEmailCodeInstructions: 'An email with the code has been sent to %s.',
|
|
66
47
|
passwordlessSMSCodeInstructions: 'An SMS with the code has been sent to %s.'
|
|
67
48
|
});
|
|
68
|
-
|
|
69
49
|
lock = set(lock, 'strings', lang);
|
|
70
|
-
|
|
71
50
|
i18nProp = {
|
|
72
51
|
str: function str(keypath) {
|
|
73
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
52
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
74
53
|
args[_key - 1] = arguments[_key];
|
|
75
54
|
}
|
|
76
|
-
|
|
77
55
|
return i18n.str(lock, keypath, args);
|
|
78
56
|
}
|
|
79
57
|
};
|
|
80
58
|
});
|
|
81
|
-
|
|
82
59
|
it('renders correctly when logging in with email', function () {
|
|
83
60
|
require('connection/passwordless/index').isEmail.mockImplementation(function () {
|
|
84
61
|
return true;
|
|
85
62
|
});
|
|
86
|
-
|
|
87
63
|
var Component = getComponent();
|
|
88
64
|
var l = (0, _field.setField)(lock, 'email', 'test@user.com');
|
|
89
|
-
|
|
90
|
-
|
|
65
|
+
(0, _testUtils2.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, {
|
|
66
|
+
model: l,
|
|
67
|
+
i18n: i18nProp
|
|
68
|
+
})).toMatchSnapshot();
|
|
91
69
|
});
|
|
92
|
-
|
|
93
70
|
it('renders correctly when logging in with a phone number', function () {
|
|
94
71
|
require('connection/passwordless/index').isEmail.mockImplementation(function () {
|
|
95
72
|
return false;
|
|
96
73
|
});
|
|
97
|
-
|
|
98
74
|
var Component = getComponent();
|
|
99
75
|
var l = (0, _phone_number.setPhoneNumber)(lock, '456 789');
|
|
100
76
|
l = (0, _phone_number.initLocation)(l, 'UK');
|
|
101
|
-
|
|
102
|
-
|
|
77
|
+
(0, _testUtils2.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, {
|
|
78
|
+
model: l,
|
|
79
|
+
i18n: i18nProp
|
|
80
|
+
})).toMatchSnapshot();
|
|
103
81
|
});
|
|
104
82
|
});
|
|
@@ -1,38 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _immutable = require('immutable');
|
|
8
|
-
|
|
9
|
-
var _immutable2 = _interopRequireDefault(_immutable);
|
|
10
|
-
|
|
11
|
-
var _testUtils = require('testUtils');
|
|
12
|
-
|
|
13
|
-
var _email_sent_confirmation = require('../../../connection/passwordless/email_sent_confirmation');
|
|
14
|
-
|
|
15
|
-
var _email_sent_confirmation2 = _interopRequireDefault(_email_sent_confirmation);
|
|
1
|
+
"use strict";
|
|
16
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
6
|
+
var _testUtils = require("testUtils");
|
|
7
|
+
var _email_sent_confirmation = _interopRequireDefault(require("../../../connection/passwordless/email_sent_confirmation"));
|
|
17
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
var lock =
|
|
22
|
-
|
|
9
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
10
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
+
var lock = _immutable.default.fromJS({
|
|
13
|
+
id: '__lock-id__'
|
|
14
|
+
});
|
|
23
15
|
describe('EmailSentConfirmation', function () {
|
|
24
|
-
it('renders correctly', _asyncToGenerator( /*#__PURE__*/
|
|
25
|
-
return
|
|
26
|
-
while (1) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
16
|
+
it('renders correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
17
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
18
|
+
while (1) switch (_context.prev = _context.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(_email_sent_confirmation.default, {
|
|
21
|
+
lock: lock
|
|
22
|
+
})).toMatchSnapshot();
|
|
23
|
+
case 1:
|
|
24
|
+
case "end":
|
|
25
|
+
return _context.stop();
|
|
35
26
|
}
|
|
36
|
-
}, _callee
|
|
27
|
+
}, _callee);
|
|
37
28
|
})));
|
|
38
29
|
});
|