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.
Files changed (240) hide show
  1. package/.browserslistrc +1 -0
  2. package/.circleci/config.yml +3 -1
  3. package/.shiprc +4 -5
  4. package/CHANGELOG.md +25 -0
  5. package/DEVELOPMENT.md +1 -1
  6. package/README.md +20 -16
  7. package/karma.conf.js +1 -1
  8. package/lib/CSSCore.js +1 -4
  9. package/lib/__tests__/auth_button.js +12 -22
  10. package/lib/__tests__/connection/database/actions.js +48 -49
  11. package/lib/__tests__/connection/database/index.js +22 -28
  12. package/lib/__tests__/connection/database/login_pane.js +24 -47
  13. package/lib/__tests__/connection/database/password_reset_confirmation.js +23 -32
  14. package/lib/__tests__/connection/database/reset_password.js +17 -39
  15. package/lib/__tests__/connection/database/signed_up_confirmation.js +23 -32
  16. package/lib/__tests__/connection/enterprise/actions.js +22 -47
  17. package/lib/__tests__/connection/enterprise/hrd_pane.js +16 -33
  18. package/lib/__tests__/connection/enterprise/hrd_screen.js +26 -40
  19. package/lib/__tests__/connection/enterprise/quick_auth_screen.js +32 -75
  20. package/lib/__tests__/connection/passwordless/ask_vcode.js +29 -51
  21. package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +23 -32
  22. package/lib/__tests__/connection/passwordless/passwordless.js +35 -97
  23. package/lib/__tests__/core/actions.js +23 -46
  24. package/lib/__tests__/core/client/index.js +10 -13
  25. package/lib/__tests__/core/index.js +46 -94
  26. package/lib/__tests__/core/remote_data.js +14 -20
  27. package/lib/__tests__/core/signed_in_confirmation.js +23 -32
  28. package/lib/__tests__/core/sso/last_login_screen.js +27 -50
  29. package/lib/__tests__/core/tenant.js +10 -12
  30. package/lib/__tests__/core/web_api/helper.js +6 -14
  31. package/lib/__tests__/core/web_api/p2_api.js +38 -33
  32. package/lib/__tests__/core/web_api.js +37 -33
  33. package/lib/__tests__/engine/classic/login.js +20 -41
  34. package/lib/__tests__/engine/classic/mfa_login_screen.js +6 -19
  35. package/lib/__tests__/engine/classic/sign_up_pane.js +33 -55
  36. package/lib/__tests__/engine/classic/sign_up_screen.js +18 -45
  37. package/lib/__tests__/engine/classic.js +13 -6
  38. package/lib/__tests__/engine/passwordless/social_or_email_login_screen.js +7 -28
  39. package/lib/__tests__/engine/passwordless/social_or_phone_number_login_screen.js +7 -28
  40. package/lib/__tests__/engine/passwordless.js +2 -5
  41. package/lib/__tests__/field/captcha/recaptcha_enterprise.js +27 -27
  42. package/lib/__tests__/field/captcha/recaptchav2.js +27 -27
  43. package/lib/__tests__/field/captcha.js +39 -51
  44. package/lib/__tests__/field/custom_input.js +23 -47
  45. package/lib/__tests__/field/email.js +2 -3
  46. package/lib/__tests__/field/email_pane.js +25 -48
  47. package/lib/__tests__/field/field.js +9 -13
  48. package/lib/__tests__/field/login_pane.js +30 -34
  49. package/lib/__tests__/field/mfa_code_pane.js +13 -28
  50. package/lib/__tests__/field/option_selection_pane.js +7 -25
  51. package/lib/__tests__/field/password.js +6 -12
  52. package/lib/__tests__/field/password_pane.js +29 -46
  53. package/lib/__tests__/field/phone_number_pane.js +18 -41
  54. package/lib/__tests__/field/social_buttons_pane.js +30 -47
  55. package/lib/__tests__/field/username.js +27 -48
  56. package/lib/__tests__/field/username_pane.js +30 -47
  57. package/lib/__tests__/field/vcode.js +5 -13
  58. package/lib/__tests__/field/vcode_pane.js +20 -44
  59. package/lib/__tests__/i18n.js +28 -53
  60. package/lib/__tests__/quick-auth/actions.js +4 -27
  61. package/lib/__tests__/setup-tests.js +7 -9
  62. package/lib/__tests__/testUtils.js +41 -58
  63. package/lib/__tests__/ui/box/chrome.js +24 -49
  64. package/lib/__tests__/ui/box/confirmation_pane.js +23 -42
  65. package/lib/__tests__/ui/box/container.js +21 -46
  66. package/lib/__tests__/ui/box/global_message.js +60 -37
  67. package/lib/__tests__/ui/input/email_input.js +6 -17
  68. package/lib/__tests__/ui/input/input_wrap.js +6 -19
  69. package/lib/__tests__/ui/input/password/password_strength.js +13 -15
  70. package/lib/__tests__/ui/input/password_input.js +22 -27
  71. package/lib/__tests__/utils/format.js +10 -17
  72. package/lib/__tests__/utils/url_utils.js +2 -5
  73. package/lib/avatar/gravatar_provider.js +13 -28
  74. package/lib/avatar.js +22 -41
  75. package/lib/browser.js +372 -23
  76. package/lib/connection/captcha.js +15 -34
  77. package/lib/connection/database/actions.js +39 -108
  78. package/lib/connection/database/index.js +90 -191
  79. package/lib/connection/database/login_pane.js +107 -147
  80. package/lib/connection/database/login_sign_up_tabs.js +106 -125
  81. package/lib/connection/database/mfa_pane.js +50 -69
  82. package/lib/connection/database/password_reset_confirmation.js +51 -73
  83. package/lib/connection/database/reset_password.js +116 -132
  84. package/lib/connection/database/reset_password_pane.js +45 -56
  85. package/lib/connection/database/sign_up_terms.js +17 -23
  86. package/lib/connection/database/signed_up_confirmation.js +52 -75
  87. package/lib/connection/enterprise/actions.js +23 -52
  88. package/lib/connection/enterprise/hrd_pane.js +60 -76
  89. package/lib/connection/enterprise/hrd_screen.js +60 -75
  90. package/lib/connection/enterprise/kerberos_screen.js +46 -60
  91. package/lib/connection/enterprise/quick_auth_screen.js +46 -64
  92. package/lib/connection/enterprise/single_sign_on_notice.js +14 -26
  93. package/lib/connection/enterprise.js +51 -84
  94. package/lib/connection/passwordless/actions.js +29 -65
  95. package/lib/connection/passwordless/ask_vcode.js +53 -60
  96. package/lib/connection/passwordless/email_sent_confirmation.js +129 -179
  97. package/lib/connection/passwordless/index.js +36 -68
  98. package/lib/connection/social/index.js +12 -15
  99. package/lib/core/actions.js +33 -85
  100. package/lib/core/client/index.js +38 -58
  101. package/lib/core/client/settings.js +12 -20
  102. package/lib/core/error_screen.js +38 -52
  103. package/lib/core/index.js +154 -305
  104. package/lib/core/loading_screen.js +61 -71
  105. package/lib/core/pane_separator.js +10 -10
  106. package/lib/core/remote_data.js +30 -51
  107. package/lib/core/screen.js +85 -79
  108. package/lib/core/signed_in_confirmation.js +51 -73
  109. package/lib/core/sso/data.js +9 -17
  110. package/lib/core/sso/index.js +5 -6
  111. package/lib/core/sso/last_login_screen.js +46 -63
  112. package/lib/core/tenant/index.js +37 -59
  113. package/lib/core/tenant/settings.js +11 -15
  114. package/lib/core/web_api/helper.js +22 -28
  115. package/lib/core/web_api/p2_api.js +162 -171
  116. package/lib/core/web_api.js +106 -94
  117. package/lib/core.js +126 -160
  118. package/lib/engine/classic/login.js +92 -144
  119. package/lib/engine/classic/mfa_login_screen.js +61 -67
  120. package/lib/engine/classic/sign_up_pane.js +89 -123
  121. package/lib/engine/classic/sign_up_screen.js +112 -158
  122. package/lib/engine/classic.js +122 -183
  123. package/lib/engine/passwordless/social_or_email_login_screen.js +80 -116
  124. package/lib/engine/passwordless/social_or_phone_number_login_screen.js +79 -110
  125. package/lib/engine/passwordless.js +75 -104
  126. package/lib/field/actions.js +11 -17
  127. package/lib/field/captcha/captcha_pane.js +83 -103
  128. package/lib/field/captcha/recaptcha.js +140 -145
  129. package/lib/field/captcha.js +7 -10
  130. package/lib/field/custom_input.js +37 -50
  131. package/lib/field/email/email_pane.js +90 -109
  132. package/lib/field/email.js +17 -35
  133. package/lib/field/index.js +50 -87
  134. package/lib/field/mfa-code/mfa_code_pane.js +57 -71
  135. package/lib/field/mfa_code.js +15 -21
  136. package/lib/field/option_selection_pane.js +16 -22
  137. package/lib/field/password/password_pane.js +79 -91
  138. package/lib/field/password.js +8 -14
  139. package/lib/field/phone-number/locations.js +7 -3
  140. package/lib/field/phone-number/phone_number_pane.js +87 -124
  141. package/lib/field/phone_number.js +16 -30
  142. package/lib/field/social/event.js +9 -12
  143. package/lib/field/social/social_buttons_pane.js +93 -121
  144. package/lib/field/username/username_pane.js +105 -123
  145. package/lib/field/username.js +16 -26
  146. package/lib/field/vcode/vcode_pane.js +67 -93
  147. package/lib/field/vcode.js +5 -5
  148. package/lib/i18n/af.js +7 -4
  149. package/lib/i18n/ar.js +7 -4
  150. package/lib/i18n/az.js +7 -4
  151. package/lib/i18n/bg.js +7 -4
  152. package/lib/i18n/ca.js +7 -4
  153. package/lib/i18n/cs.js +7 -4
  154. package/lib/i18n/da.js +7 -4
  155. package/lib/i18n/de.js +7 -3
  156. package/lib/i18n/el.js +7 -4
  157. package/lib/i18n/en.js +9 -4
  158. package/lib/i18n/es.js +7 -3
  159. package/lib/i18n/et.js +7 -4
  160. package/lib/i18n/fa.js +7 -4
  161. package/lib/i18n/fi.js +7 -4
  162. package/lib/i18n/fr.js +7 -4
  163. package/lib/i18n/he.js +7 -4
  164. package/lib/i18n/hr.js +7 -4
  165. package/lib/i18n/hu.js +7 -4
  166. package/lib/i18n/id.js +7 -4
  167. package/lib/i18n/it.js +7 -3
  168. package/lib/i18n/ja.js +7 -4
  169. package/lib/i18n/ko.js +7 -4
  170. package/lib/i18n/lt.js +7 -4
  171. package/lib/i18n/lv.js +7 -4
  172. package/lib/i18n/ms.js +7 -4
  173. package/lib/i18n/nb.js +7 -4
  174. package/lib/i18n/nl.js +7 -4
  175. package/lib/i18n/nn.js +7 -4
  176. package/lib/i18n/no.js +7 -4
  177. package/lib/i18n/pl.js +7 -4
  178. package/lib/i18n/pt-br.js +7 -3
  179. package/lib/i18n/pt.js +7 -4
  180. package/lib/i18n/ro.js +7 -4
  181. package/lib/i18n/ru.js +7 -4
  182. package/lib/i18n/sk.js +7 -4
  183. package/lib/i18n/sl.js +7 -4
  184. package/lib/i18n/sr.js +7 -4
  185. package/lib/i18n/sv.js +7 -4
  186. package/lib/i18n/tr.js +7 -4
  187. package/lib/i18n/ua.js +7 -4
  188. package/lib/i18n/uk.js +7 -4
  189. package/lib/i18n/vi.js +7 -4
  190. package/lib/i18n/zh-tw.js +7 -4
  191. package/lib/i18n/zh.js +7 -4
  192. package/lib/i18n.js +38 -75
  193. package/lib/index.js +14 -17
  194. package/lib/lock.js +29 -32
  195. package/lib/passwordless.js +29 -31
  196. package/lib/quick-auth/actions.js +19 -26
  197. package/lib/quick_auth.js +8 -10
  198. package/lib/sanitizer.js +5 -5
  199. package/lib/store/index.js +22 -42
  200. package/lib/sync.js +21 -42
  201. package/lib/ui/box/button.js +85 -105
  202. package/lib/ui/box/chrome.js +463 -548
  203. package/lib/ui/box/confirmation_pane.js +34 -48
  204. package/lib/ui/box/container.js +305 -339
  205. package/lib/ui/box/global_message.js +51 -60
  206. package/lib/ui/box/header.js +155 -177
  207. package/lib/ui/box/multisize_slide.js +233 -229
  208. package/lib/ui/box/success_pane.js +34 -37
  209. package/lib/ui/box.js +88 -93
  210. package/lib/ui/button/auth_button.js +44 -51
  211. package/lib/ui/input/captcha_input.js +162 -181
  212. package/lib/ui/input/checkbox_input.js +57 -59
  213. package/lib/ui/input/email_input.js +117 -124
  214. package/lib/ui/input/input_wrap.js +65 -80
  215. package/lib/ui/input/location_input.js +130 -150
  216. package/lib/ui/input/mfa_code_input.js +98 -98
  217. package/lib/ui/input/password/password_strength.js +103 -127
  218. package/lib/ui/input/password_input.js +141 -147
  219. package/lib/ui/input/phone_number_input.js +101 -109
  220. package/lib/ui/input/select_input.js +120 -132
  221. package/lib/ui/input/text_input.js +89 -84
  222. package/lib/ui/input/username_input.js +109 -115
  223. package/lib/ui/input/vcode_input.js +110 -118
  224. package/lib/ui/list.js +224 -247
  225. package/lib/ui/pane/quick_auth_pane.js +55 -80
  226. package/lib/utils/atom.js +55 -48
  227. package/lib/utils/cache.js +54 -43
  228. package/lib/utils/cdn_utils.js +17 -31
  229. package/lib/utils/createRef.js +3 -1
  230. package/lib/utils/data_utils.js +10 -16
  231. package/lib/utils/fn_utils.js +5 -4
  232. package/lib/utils/format.js +6 -8
  233. package/lib/utils/id_utils.js +4 -3
  234. package/lib/utils/jsonp_utils.js +20 -17
  235. package/lib/utils/media_utils.js +4 -2
  236. package/lib/utils/preload_utils.js +4 -3
  237. package/lib/utils/string_utils.js +4 -4
  238. package/lib/utils/url_utils.js +4 -3
  239. package/package.json +48 -34
  240. package/webpack.config.js +36 -3
@@ -1,37 +1,37 @@
1
- 'use strict';
2
-
3
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
4
-
5
- var _web_api = require('../../core/web_api');
6
-
7
- var _web_api2 = _interopRequireDefault(_web_api);
1
+ "use strict";
8
2
 
3
+ var _web_api = _interopRequireDefault(require("../../core/web_api"));
9
4
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
5
+ 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); }
6
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
11
  describe('Auth0WebApi', function () {
12
- var originalWindow = void 0;
13
-
12
+ var originalWindow;
14
13
  var LOCK_ID = 'lock-id';
15
14
  var CLIENT_ID = 'client-id';
16
15
  var DEFAULT_DOMAIN = 'test.com';
17
16
  var client = function client() {
18
- return _web_api2.default.clients[LOCK_ID];
17
+ return _web_api.default.clients[LOCK_ID];
19
18
  };
20
-
21
19
  beforeEach(function () {
22
20
  originalWindow = window.window;
23
21
  });
24
-
25
22
  afterEach(function () {
26
23
  window.window = originalWindow;
27
24
  });
28
-
29
25
  describe('setupClient', function () {
30
26
  it('sets the correct options when is on the hosted login page', function () {
31
27
  delete window.location;
32
- window.location = _extends({}, originalWindow.location, { host: DEFAULT_DOMAIN, search: '' });
33
- _web_api2.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, { redirect: true });
34
-
28
+ window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
29
+ host: DEFAULT_DOMAIN,
30
+ search: ''
31
+ });
32
+ _web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {
33
+ redirect: true
34
+ });
35
35
  expect(client()).toEqual(expect.objectContaining({
36
36
  isUniversalLogin: true,
37
37
  domain: DEFAULT_DOMAIN,
@@ -40,39 +40,43 @@ describe('Auth0WebApi', function () {
40
40
  }
41
41
  }));
42
42
  });
43
-
44
43
  it('sets redirect: true when on the same origin as the specified domain', function () {
45
44
  delete window.location;
46
- window.location = _extends({}, originalWindow.location, { host: DEFAULT_DOMAIN, search: '' });
47
-
48
- _web_api2.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
45
+ window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
46
+ host: DEFAULT_DOMAIN,
47
+ search: ''
48
+ });
49
+ _web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
49
50
  expect(client().authOpt.popup).toBe(false);
50
51
  });
51
-
52
52
  it('sets redirect: false when on a different origin as the specified domain', function () {
53
53
  delete window.location;
54
- window.location = _extends({}, originalWindow.location, { host: 'test-other.com', search: '' });
55
-
56
- _web_api2.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
54
+ window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
55
+ host: 'test-other.com',
56
+ search: ''
57
+ });
58
+ _web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
57
59
  expect(client().authOpt.popup).toBe(true);
58
60
  });
59
-
60
61
  it('forces popup and sso mode for cordova, only when not running in the hosted environment', function () {
61
62
  delete window.location;
62
- window.location = _extends({}, originalWindow.location, { host: DEFAULT_DOMAIN, search: '' });
63
+ window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
64
+ host: DEFAULT_DOMAIN,
65
+ search: ''
66
+ });
63
67
  window.cordova = true;
64
-
65
- _web_api2.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
68
+ _web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
66
69
  expect(client().authOpt.popup).toBe(false);
67
70
  expect(client().authOpt.sso).toBeUndefined();
68
71
  });
69
-
70
72
  it('forces popup and sso mode for electron, only when not running in the hosted environment', function () {
71
73
  delete window.location;
72
- window.location = _extends({}, originalWindow.location, { host: DEFAULT_DOMAIN, search: '' });
74
+ window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
75
+ host: DEFAULT_DOMAIN,
76
+ search: ''
77
+ });
73
78
  window.electron = true;
74
-
75
- _web_api2.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
79
+ _web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
76
80
  expect(client().authOpt.popup).toBe(false);
77
81
  expect(client().authOpt.sso).toBeUndefined();
78
82
  });
@@ -1,13 +1,8 @@
1
- 'use strict';
2
-
3
- var _react = require('react');
4
-
5
- var _react2 = _interopRequireDefault(_react);
6
-
7
- var _testUtils = require('testUtils');
1
+ "use strict";
8
2
 
3
+ var _react = _interopRequireDefault(require("react"));
4
+ var _testUtils = require("testUtils");
9
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
6
  jest.mock('core/pane_separator', function () {
12
7
  return (0, _testUtils.mockComponent)('pane_separator');
13
8
  });
@@ -23,17 +18,14 @@ jest.mock('connection/database/login_sign_up_tabs', function () {
23
18
  jest.mock('connection/enterprise/single_sign_on_notice', function () {
24
19
  return (0, _testUtils.mockComponent)('single_sign_on_notice');
25
20
  });
26
-
27
21
  var getComponent = function getComponent() {
28
22
  var LoginScreen = require('engine/classic/login').default;
29
23
  var screen = new LoginScreen();
30
24
  return screen.render();
31
25
  };
32
-
33
26
  describe('LoginScreen', function () {
34
27
  beforeEach(function () {
35
28
  jest.resetModules();
36
-
37
29
  jest.mock('connection/database/index', function () {
38
30
  return {
39
31
  databaseConnection: function databaseConnection() {
@@ -59,11 +51,11 @@ describe('LoginScreen', function () {
59
51
  }
60
52
  };
61
53
  });
62
-
63
54
  jest.mock('connection/database/actions', function () {
64
- return { logIn: jest.fn() };
55
+ return {
56
+ logIn: jest.fn()
57
+ };
65
58
  });
66
-
67
59
  jest.mock('connection/enterprise', function () {
68
60
  return {
69
61
  defaultEnterpriseConnection: function defaultEnterpriseConnection() {
@@ -77,20 +69,17 @@ describe('LoginScreen', function () {
77
69
  }
78
70
  };
79
71
  });
80
-
81
72
  jest.mock('connection/enterprise/actions', function () {
82
73
  return {
83
74
  logIn: jest.fn(),
84
75
  startHRD: jest.fn()
85
76
  };
86
77
  });
87
-
88
78
  jest.mock('core/signed_in_confirmation', function () {
89
79
  return {
90
80
  renderSignedInConfirmation: jest.fn()
91
81
  };
92
82
  });
93
-
94
83
  jest.mock('engine/classic', function () {
95
84
  return {
96
85
  hasOnlyClassicConnections: function hasOnlyClassicConnections() {
@@ -101,13 +90,13 @@ describe('LoginScreen', function () {
101
90
  }
102
91
  };
103
92
  });
104
-
105
93
  jest.mock('i18n', function () {
106
- return { str: function str(_, keys) {
94
+ return {
95
+ str: function str(_, keys) {
107
96
  return keys.join(',');
108
- } };
97
+ }
98
+ };
109
99
  });
110
-
111
100
  jest.mock('core/index', function () {
112
101
  return {
113
102
  hasSomeConnections: function hasSomeConnections() {
@@ -122,17 +111,15 @@ describe('LoginScreen', function () {
122
111
  var defaultProps = {
123
112
  i18n: {
124
113
  str: function str() {
125
- for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
114
+ for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
126
115
  keys[_key] = arguments[_key];
127
116
  }
128
-
129
117
  return keys.join(',');
130
118
  },
131
119
  html: function html() {
132
- for (var _len2 = arguments.length, keys = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
120
+ for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
133
121
  keys[_key2] = arguments[_key2];
134
122
  }
135
-
136
123
  return keys.join(',');
137
124
  }
138
125
  },
@@ -140,24 +127,21 @@ describe('LoginScreen', function () {
140
127
  };
141
128
  it('renders empty div by default', function () {
142
129
  var Component = getComponent();
143
-
144
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
130
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
145
131
  });
146
132
  it('renders SocialButtonsPane when has social connections', function () {
147
133
  require('core/index').hasSomeConnections = function (m, connection) {
148
134
  return connection === 'social';
149
135
  };
150
136
  var Component = getComponent();
151
-
152
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
137
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
153
138
  });
154
139
  it('renders SingleSignOnNotice when SSO is enabled', function () {
155
140
  require('engine/classic').isSSOEnabled = function () {
156
141
  return true;
157
142
  };
158
143
  var Component = getComponent();
159
-
160
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
144
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
161
145
  });
162
146
  describe('renders LoginSignUpTabs', function () {
163
147
  it('when database connection is enabled and has screen signUp', function () {
@@ -168,8 +152,7 @@ describe('LoginScreen', function () {
168
152
  return screenName === 'signUp';
169
153
  };
170
154
  var Component = getComponent();
171
-
172
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
155
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
173
156
  });
174
157
  it('when social connection is enabled and has initial screen signUp and has screen signUp', function () {
175
158
  require('core/index').hasSomeConnections = function (m, connection) {
@@ -179,8 +162,7 @@ describe('LoginScreen', function () {
179
162
  return screenName === 'signUp';
180
163
  };
181
164
  var Component = getComponent();
182
-
183
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
165
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
184
166
  });
185
167
  });
186
168
  describe('renders LoginPane', function () {
@@ -189,24 +171,21 @@ describe('LoginScreen', function () {
189
171
  return true;
190
172
  };
191
173
  var Component = getComponent();
192
-
193
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
174
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
194
175
  });
195
176
  it('when has database connection', function () {
196
177
  require('core/index').hasSomeConnections = function (m, connection) {
197
178
  return connection === 'database';
198
179
  };
199
180
  var Component = getComponent();
200
-
201
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
181
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
202
182
  });
203
183
  it('when has enterprise connection', function () {
204
184
  require('core/index').hasSomeConnections = function (m, connection) {
205
185
  return connection === 'enterprise';
206
186
  };
207
187
  var Component = getComponent();
208
-
209
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
188
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
210
189
  });
211
190
  });
212
191
  });
@@ -1,32 +1,23 @@
1
- 'use strict';
2
-
3
- var _react = require('react');
4
-
5
- var _react2 = _interopRequireDefault(_react);
6
-
7
- var _enzyme = require('enzyme');
8
-
9
- var _testUtils = require('testUtils');
1
+ "use strict";
10
2
 
3
+ var _react = _interopRequireDefault(require("react"));
4
+ var _enzyme = require("enzyme");
5
+ var _testUtils = require("testUtils");
11
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
7
  jest.mock('connection/database/mfa_pane', function () {
14
8
  return (0, _testUtils.mockComponent)('mfa_pane');
15
9
  });
16
10
 
17
11
  //there's a circular dependency with this module, so we need to mock it
18
12
  jest.mock('engine/classic');
19
-
20
13
  var getComponent = function getComponent() {
21
14
  var MFALoginScreen = require('engine/classic/mfa_login_screen').default;
22
15
  var screen = new MFALoginScreen();
23
16
  return screen.render();
24
17
  };
25
-
26
18
  describe('MFALoginScreen', function () {
27
19
  beforeEach(function () {
28
20
  jest.resetModules();
29
-
30
21
  jest.mock('connection/database/index', function () {
31
22
  return {
32
23
  hasScreen: function hasScreen() {
@@ -34,14 +25,12 @@ describe('MFALoginScreen', function () {
34
25
  }
35
26
  };
36
27
  });
37
-
38
28
  jest.mock('connection/database/actions', function () {
39
29
  return {
40
30
  cancelMFALogin: jest.fn(),
41
31
  logIn: jest.fn()
42
32
  };
43
33
  });
44
-
45
34
  jest.mock('core/signed_in_confirmation', function () {
46
35
  return {
47
36
  renderSignedInConfirmation: jest.fn()
@@ -51,10 +40,9 @@ describe('MFALoginScreen', function () {
51
40
  var defaultProps = {
52
41
  i18n: {
53
42
  str: function str() {
54
- for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
43
+ for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
55
44
  keys[_key] = arguments[_key];
56
45
  }
57
-
58
46
  return keys.join(',');
59
47
  }
60
48
  },
@@ -62,7 +50,6 @@ describe('MFALoginScreen', function () {
62
50
  };
63
51
  it('renders correctly', function () {
64
52
  var Component = getComponent();
65
-
66
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
53
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
67
54
  });
68
55
  });
@@ -1,17 +1,10 @@
1
- 'use strict';
2
-
3
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
4
-
5
- var _react = require('react');
6
-
7
- var _react2 = _interopRequireDefault(_react);
8
-
9
- var _testUtils = require('testUtils');
10
-
11
- var _testUtils2 = require('../../testUtils');
1
+ "use strict";
12
2
 
3
+ var _react = _interopRequireDefault(require("react"));
4
+ var _testUtils = require("testUtils");
5
+ var _testUtils2 = require("../../testUtils");
13
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
-
7
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
8
  jest.mock('field/email/email_pane', function () {
16
9
  return (0, _testUtils.mockComponent)('email_pane');
17
10
  });
@@ -24,33 +17,27 @@ jest.mock('field/username/username_pane', function () {
24
17
  jest.mock('field/custom_input', function () {
25
18
  return (0, _testUtils.mockComponent)('custom_input');
26
19
  });
27
-
28
20
  jest.mock('core/index', function () {
29
21
  return {
30
22
  captcha: jest.fn()
31
23
  };
32
24
  });
33
-
34
25
  jest.mock('engine/classic', function () {
35
26
  return {
36
27
  isSSOEnabled: jest.fn()
37
28
  };
38
29
  });
39
-
40
30
  jest.mock('connection/enterprise', function () {
41
31
  return {
42
32
  isHRDDomain: jest.fn()
43
33
  };
44
34
  });
45
-
46
35
  var getComponent = function getComponent() {
47
36
  return require('engine/classic/sign_up_pane').default;
48
37
  };
49
-
50
38
  describe('SignUpPane', function () {
51
39
  beforeEach(function () {
52
40
  jest.resetModules();
53
-
54
41
  jest.mock('connection/database/index', function () {
55
42
  return {
56
43
  additionalSignUpFields: function additionalSignUpFields() {
@@ -74,17 +61,15 @@ describe('SignUpPane', function () {
74
61
  var defaultProps = {
75
62
  i18n: {
76
63
  str: function str() {
77
- for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
64
+ for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
78
65
  keys[_key] = arguments[_key];
79
66
  }
80
-
81
67
  return keys.join(',');
82
68
  },
83
69
  html: function html() {
84
- for (var _len2 = arguments.length, keys = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
70
+ for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
85
71
  keys[_key2] = arguments[_key2];
86
72
  }
87
-
88
73
  return keys.join(',');
89
74
  }
90
75
  },
@@ -98,75 +83,68 @@ describe('SignUpPane', function () {
98
83
  };
99
84
  it('renders only email by default', function () {
100
85
  var Component = getComponent();
101
-
102
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
86
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
103
87
  });
104
88
  it('shows header when instructions are available', function () {
105
89
  var Component = getComponent();
106
-
107
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, _extends({}, defaultProps, { instructions: 'instructions' }))).toMatchSnapshot();
90
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, _extends({}, defaultProps, {
91
+ instructions: "instructions"
92
+ }))).toMatchSnapshot();
108
93
  });
109
-
110
94
  it('shows the Captcha pane', function () {
111
95
  require('core/index').captcha.mockReturnValue({
112
96
  get: function get() {
113
97
  return true;
114
98
  }
115
99
  });
116
-
117
100
  require('engine/classic').isSSOEnabled.mockReturnValue(false);
118
-
119
101
  var Component = getComponent();
120
-
121
- (0, _testUtils2.expectShallowComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
102
+ (0, _testUtils2.expectShallowComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
122
103
  });
123
-
124
104
  it('hides the Captcha pane for SSO connections', function () {
125
105
  require('core/index').captcha.mockReturnValue({
126
106
  get: function get() {
127
107
  return true;
128
108
  }
129
109
  });
130
-
131
110
  require('engine/classic').isSSOEnabled.mockReturnValue(true);
132
-
133
111
  var Component = getComponent();
134
-
135
- (0, _testUtils2.expectShallowComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
112
+ (0, _testUtils2.expectShallowComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
136
113
  });
137
-
138
114
  it('shows the Captcha pane for SSO (ADFS) connections', function () {
139
115
  require('core/index').captcha.mockReturnValue({
140
116
  get: function get() {
141
117
  return true;
142
118
  }
143
119
  });
144
-
145
120
  require('engine/classic').isSSOEnabled.mockReturnValue(true);
146
121
  require('connection/enterprise').isHRDDomain.mockReturnValue(true);
147
-
148
122
  var Component = getComponent();
149
-
150
- (0, _testUtils2.expectShallowComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
123
+ (0, _testUtils2.expectShallowComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
151
124
  });
152
-
153
125
  describe('onlyEmail is false', function () {
154
126
  it('shows PasswordPane', function () {
155
127
  var Component = getComponent();
156
-
157
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, _extends({}, defaultProps, { onlyEmail: false }))).toMatchSnapshot();
128
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, _extends({}, defaultProps, {
129
+ onlyEmail: false
130
+ }))).toMatchSnapshot();
158
131
  });
159
132
  it('shows custom fields when additionalSignUpFields returns additional fields', function () {
160
133
  require('connection/database/index').additionalSignUpFields = function () {
161
- return [{ get: function get(key) {
162
- return key + '1';
163
- } }, { get: function get(key) {
164
- return key + '2';
165
- } }];
134
+ return [{
135
+ get: function get(key) {
136
+ return "".concat(key, "1");
137
+ }
138
+ }, {
139
+ get: function get(key) {
140
+ return "".concat(key, "2");
141
+ }
142
+ }];
166
143
  };
167
144
  var Component = getComponent();
168
-
169
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, _extends({}, defaultProps, { onlyEmail: false }))).toMatchSnapshot();
145
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, _extends({}, defaultProps, {
146
+ onlyEmail: false
147
+ }))).toMatchSnapshot();
170
148
  });
171
149
  it('shows UsernamePane when databaseConnectionRequiresUsername is true and signUpHideUsernameField is false', function () {
172
150
  require('connection/database/index').databaseConnectionRequiresUsername = function () {
@@ -176,8 +154,9 @@ describe('SignUpPane', function () {
176
154
  return false;
177
155
  };
178
156
  var Component = getComponent();
179
-
180
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, _extends({}, defaultProps, { onlyEmail: false }))).toMatchSnapshot();
157
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, _extends({}, defaultProps, {
158
+ onlyEmail: false
159
+ }))).toMatchSnapshot();
181
160
  });
182
161
  it('hide UsernamePane when databaseConnectionRequiresUsername is true and signUpHideUsernameField is true', function () {
183
162
  require('connection/database/index').databaseConnectionRequiresUsername = function () {
@@ -187,8 +166,7 @@ describe('SignUpPane', function () {
187
166
  return true;
188
167
  };
189
168
  var Component = getComponent();
190
-
191
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
169
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
192
170
  });
193
171
  });
194
172
  });