auth0-lock 11.34.2 → 12.0.0-beta.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 (241) hide show
  1. package/.browserslistrc +1 -0
  2. package/.circleci/config.yml +4 -2
  3. package/.eslintrc.json +5 -5
  4. package/.github/workflows/codeql.yml +41 -0
  5. package/.shiprc +4 -5
  6. package/CHANGELOG.md +26 -0
  7. package/EXAMPLES.md +626 -0
  8. package/README.md +77 -649
  9. package/karma.conf.js +1 -1
  10. package/lib/CSSCore.js +1 -4
  11. package/lib/__tests__/auth_button.js +12 -22
  12. package/lib/__tests__/connection/database/actions.js +48 -49
  13. package/lib/__tests__/connection/database/index.js +22 -28
  14. package/lib/__tests__/connection/database/login_pane.js +20 -41
  15. package/lib/__tests__/connection/database/password_reset_confirmation.js +19 -26
  16. package/lib/__tests__/connection/database/reset_password.js +17 -39
  17. package/lib/__tests__/connection/database/signed_up_confirmation.js +19 -26
  18. package/lib/__tests__/connection/enterprise/actions.js +22 -47
  19. package/lib/__tests__/connection/enterprise/hrd_pane.js +16 -33
  20. package/lib/__tests__/connection/enterprise/hrd_screen.js +26 -40
  21. package/lib/__tests__/connection/enterprise/quick_auth_screen.js +27 -68
  22. package/lib/__tests__/connection/passwordless/ask_vcode.js +29 -51
  23. package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +19 -26
  24. package/lib/__tests__/connection/passwordless/passwordless.js +35 -97
  25. package/lib/__tests__/core/actions.js +23 -46
  26. package/lib/__tests__/core/client/index.js +10 -13
  27. package/lib/__tests__/core/index.js +46 -94
  28. package/lib/__tests__/core/remote_data.js +14 -20
  29. package/lib/__tests__/core/signed_in_confirmation.js +19 -26
  30. package/lib/__tests__/core/sso/last_login_screen.js +27 -50
  31. package/lib/__tests__/core/tenant.js +10 -12
  32. package/lib/__tests__/core/web_api/helper.js +6 -14
  33. package/lib/__tests__/core/web_api/p2_api.js +38 -33
  34. package/lib/__tests__/core/web_api.js +37 -33
  35. package/lib/__tests__/engine/classic/login.js +20 -41
  36. package/lib/__tests__/engine/classic/mfa_login_screen.js +6 -19
  37. package/lib/__tests__/engine/classic/sign_up_pane.js +33 -55
  38. package/lib/__tests__/engine/classic/sign_up_screen.js +18 -45
  39. package/lib/__tests__/engine/classic.js +13 -6
  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 +19 -36
  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 +14 -32
  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 -62
  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 +152 -301
  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 +28 -48
  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 +24 -30
  115. package/lib/core/web_api/p2_api.js +156 -165
  116. package/lib/core/web_api.js +101 -90
  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 +71 -106
  124. package/lib/engine/passwordless/social_or_phone_number_login_screen.js +70 -100
  125. package/lib/engine/passwordless.js +75 -104
  126. package/lib/field/actions.js +11 -17
  127. package/lib/field/captcha/captcha_pane.js +82 -102
  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 +51 -88
  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/opslevel.yml +6 -0
  240. package/package.json +53 -38
  241. package/webpack.config.js +36 -3
@@ -1,15 +1,9 @@
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('engine/classic/sign_up_pane', function () {
14
8
  return (0, _testUtils.mockComponent)('sign_up_pane');
15
9
  });
@@ -28,20 +22,16 @@ jest.mock('connection/database/login_sign_up_tabs', function () {
28
22
  jest.mock('connection/enterprise/single_sign_on_notice', function () {
29
23
  return (0, _testUtils.mockComponent)('single_sign_on_notice');
30
24
  });
31
-
32
25
  var getScreen = function getScreen() {
33
26
  var SignUpScreen = require('engine/classic/sign_up_screen').default;
34
27
  return new SignUpScreen();
35
28
  };
36
-
37
29
  var getComponent = function getComponent() {
38
30
  return getScreen().render();
39
31
  };
40
-
41
32
  describe('SignUpScreen', function () {
42
33
  beforeEach(function () {
43
34
  jest.resetModules();
44
-
45
35
  jest.mock('connection/database/index', function () {
46
36
  return {
47
37
  databaseUsernameValue: function databaseUsernameValue(model, options) {
@@ -62,7 +52,6 @@ describe('SignUpScreen', function () {
62
52
  }
63
53
  };
64
54
  });
65
-
66
55
  jest.mock('connection/database/actions', function () {
67
56
  return {
68
57
  signUp: jest.fn(),
@@ -90,7 +79,6 @@ describe('SignUpScreen', function () {
90
79
  renderSignedUpConfirmation: jest.fn()
91
80
  };
92
81
  });
93
-
94
82
  jest.mock('field/index', function () {
95
83
  return {
96
84
  renderOptionSelection: function renderOptionSelection() {
@@ -98,7 +86,6 @@ describe('SignUpScreen', function () {
98
86
  }
99
87
  };
100
88
  });
101
-
102
89
  jest.mock('connection/enterprise', function () {
103
90
  return {
104
91
  isHRDDomain: function isHRDDomain() {
@@ -106,19 +93,18 @@ describe('SignUpScreen', function () {
106
93
  }
107
94
  };
108
95
  });
109
-
110
96
  jest.mock('connection/enterprise/actions', function () {
111
97
  return {
112
98
  logIn: jest.fn()
113
99
  };
114
100
  });
115
-
116
101
  jest.mock('i18n', function () {
117
- return { str: function str(_, keys) {
102
+ return {
103
+ str: function str(_, keys) {
118
104
  return keys.join(',');
119
- } };
105
+ }
106
+ };
120
107
  });
121
-
122
108
  jest.mock('core/index', function () {
123
109
  return {
124
110
  hasSomeConnections: function hasSomeConnections() {
@@ -133,24 +119,21 @@ describe('SignUpScreen', function () {
133
119
  var defaultProps = {
134
120
  i18n: {
135
121
  str: function str() {
136
- for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
122
+ for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
137
123
  keys[_key] = arguments[_key];
138
124
  }
139
-
140
125
  return keys.join(',');
141
126
  },
142
127
  group: function group() {
143
- for (var _len2 = arguments.length, keys = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
128
+ for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
144
129
  keys[_key2] = arguments[_key2];
145
130
  }
146
-
147
131
  return keys.join(',');
148
132
  },
149
133
  html: function html() {
150
- for (var _len3 = arguments.length, keys = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
134
+ for (var _len3 = arguments.length, keys = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
151
135
  keys[_key3] = arguments[_key3];
152
136
  }
153
-
154
137
  return keys.join(',');
155
138
  }
156
139
  },
@@ -158,16 +141,14 @@ describe('SignUpScreen', function () {
158
141
  };
159
142
  it('renders empty div by default', function () {
160
143
  var Component = getComponent();
161
-
162
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
144
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
163
145
  });
164
146
  it('renders SocialButtonsPane when has social connections', function () {
165
147
  require('core/index').hasSomeConnections = function (m, connection) {
166
148
  return connection === 'social';
167
149
  };
168
150
  var Component = getComponent();
169
-
170
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
151
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
171
152
  });
172
153
  it('disables SocialButtonsPane when terms were not accepted', function () {
173
154
  require('core/index').hasSomeConnections = function (m, connection) {
@@ -177,8 +158,7 @@ describe('SignUpScreen', function () {
177
158
  return false;
178
159
  };
179
160
  var Component = getComponent();
180
-
181
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
161
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
182
162
  });
183
163
  it('renders SingleSignOnNotice when SSO is enabled and has screen login', function () {
184
164
  require('engine/classic').isSSOEnabled = function () {
@@ -187,18 +167,15 @@ describe('SignUpScreen', function () {
187
167
  require('connection/database/index').hasScreen = function (m, screenName) {
188
168
  return screenName === 'login';
189
169
  };
190
-
191
170
  var Component = getComponent();
192
-
193
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
171
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
194
172
  });
195
173
  it('renders LoginSignUpTabs SSO is disabled and has screen login', function () {
196
174
  require('connection/database/index').hasScreen = function (m, screenName) {
197
175
  return screenName === 'login';
198
176
  };
199
177
  var Component = getComponent();
200
-
201
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
178
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
202
179
  });
203
180
  describe('renders SignUpPane', function () {
204
181
  it('when has database connection', function () {
@@ -206,25 +183,21 @@ describe('SignUpScreen', function () {
206
183
  return connection === 'database';
207
184
  };
208
185
  var Component = getComponent();
209
-
210
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
186
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
211
187
  });
212
188
  it('when has enterprise connection', function () {
213
189
  require('core/index').hasSomeConnections = function (m, connection) {
214
190
  return connection === 'enterprise';
215
191
  };
216
192
  var Component = getComponent();
217
-
218
- (0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
193
+ (0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
219
194
  });
220
195
  });
221
196
  describe('on Submit, uses `options.emailFirst=true` and', function () {
222
197
  it('calls signup', function () {
223
198
  var screen = getScreen();
224
199
  screen.submitHandler()();
225
-
226
200
  var mock = require('connection/database/actions').signUp.mock;
227
-
228
201
  expect(mock.calls.length).toBe(1);
229
202
  });
230
203
  });
@@ -1,20 +1,27 @@
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; };
1
+ "use strict";
4
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
+ 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; }
5
+ 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; }
6
+ 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; }
7
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
+ 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); }
5
9
  var getClassic = function getClassic() {
6
10
  return require('engine/classic').default;
7
11
  };
8
-
9
12
  describe('Classic Engine', function () {
10
13
  beforeEach(function () {
11
14
  jest.mock('connection/database/index', function () {
12
15
  return {
13
16
  resolveAdditionalSignUpFields: function resolveAdditionalSignUpFields(m) {
14
- return _extends({}, m, { resolveAdditionalSignUpFields: true });
17
+ return _objectSpread(_objectSpread({}, m), {}, {
18
+ resolveAdditionalSignUpFields: true
19
+ });
15
20
  },
16
21
  overrideDatabaseOptions: function overrideDatabaseOptions(m) {
17
- return _extends({}, m, { overrideDatabaseOptions: true });
22
+ return _objectSpread(_objectSpread({}, m), {}, {
23
+ overrideDatabaseOptions: true
24
+ });
18
25
  }
19
26
  };
20
27
  });
@@ -1,11 +1,9 @@
1
- 'use strict';
2
-
3
- var _testUtils = require('testUtils');
1
+ "use strict";
4
2
 
3
+ var _testUtils = require("testUtils");
5
4
  var getEngine = function getEngine() {
6
5
  return require('engine/passwordless').default;
7
6
  };
8
-
9
7
  jest.mock('core/error_screen', function () {
10
8
  return (0, _testUtils.mockComponent)('error_screen');
11
9
  });
@@ -24,7 +22,6 @@ jest.mock('connection/passwordless/ask_vcode', function () {
24
22
  jest.mock('core/sso/last_login_screen', function () {
25
23
  return (0, _testUtils.mockComponent)('last_login_screen');
26
24
  });
27
-
28
25
  describe('Passwordless Engine', function () {
29
26
  describe('didReceiveClientSettings calls setPrefill', function () {
30
27
  beforeEach(function () {
@@ -1,30 +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 _immutable = require('immutable');
10
-
11
- var _immutable2 = _interopRequireDefault(_immutable);
12
-
13
- var _recaptcha = require('../../../field/captcha/recaptcha');
1
+ "use strict";
14
2
 
3
+ var _react = _interopRequireDefault(require("react"));
4
+ var _enzyme = require("enzyme");
5
+ var _immutable = _interopRequireDefault(require("immutable"));
6
+ var _recaptcha = require("../../../field/captcha/recaptcha");
15
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
-
17
8
  var createLockMock = function createLockMock() {
18
9
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
19
- _ref$provider = _ref.provider,
20
- provider = _ref$provider === undefined ? 'none' : _ref$provider,
21
- _ref$sitekey = _ref.sitekey,
22
- sitekey = _ref$sitekey === undefined ? '' : _ref$sitekey;
23
-
24
- return _immutable2.default.fromJS({
10
+ _ref$provider = _ref.provider,
11
+ provider = _ref$provider === void 0 ? 'none' : _ref$provider,
12
+ _ref$sitekey = _ref.sitekey,
13
+ sitekey = _ref$sitekey === void 0 ? '' : _ref$sitekey;
14
+ return _immutable.default.fromJS({
25
15
  id: '__lock-id__',
26
16
  core: {
27
- captcha: { provider: provider, sitekey: sitekey },
17
+ captcha: {
18
+ provider: provider,
19
+ sitekey: sitekey
20
+ },
28
21
  transient: {
29
22
  ui: {
30
23
  language: 'en-US'
@@ -33,15 +26,19 @@ var createLockMock = function createLockMock() {
33
26
  }
34
27
  });
35
28
  };
36
-
37
29
  describe('Recaptcha Enterprise', function () {
38
30
  it('should match the snapshot', function () {
39
- var mockLock = createLockMock({ provider: 'recaptcha_enterprise', sitekey: 'mySiteKey' });
40
- var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(_recaptcha.ReCAPTCHA, { provider: 'recaptcha_enterprise', lock: mockLock, sitekey: 'mySiteKey' }));
41
-
31
+ var mockLock = createLockMock({
32
+ provider: 'recaptcha_enterprise',
33
+ sitekey: 'mySiteKey'
34
+ });
35
+ var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_recaptcha.ReCAPTCHA, {
36
+ provider: 'recaptcha_enterprise',
37
+ lock: mockLock,
38
+ sitekey: 'mySiteKey'
39
+ }));
42
40
  expect(wrapper).toMatchSnapshot();
43
41
  });
44
-
45
42
  describe('render', function () {
46
43
  beforeAll(function () {
47
44
  document.body.innerHTML = "<div id='renderTest'></div>";
@@ -50,7 +47,10 @@ describe('Recaptcha Enterprise', function () {
50
47
  document.getElementById('renderTest').remove();
51
48
  });
52
49
  it('injects the script', function () {
53
- _recaptcha.ReCAPTCHA.loadScript({ hl: 'en-US', provider: 'recaptcha_enterprise' }, document.body);
50
+ _recaptcha.ReCAPTCHA.loadScript({
51
+ hl: 'en-US',
52
+ provider: 'recaptcha_enterprise'
53
+ }, document.body);
54
54
  expect(document.body.innerHTML).toContain('<div id="renderTest">');
55
55
  expect(document.body.innerHTML).toContain('<script src="https://www.recaptcha.net/recaptcha/enterprise.js?render=explicit');
56
56
  });
@@ -1,30 +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 _immutable = require('immutable');
10
-
11
- var _immutable2 = _interopRequireDefault(_immutable);
12
-
13
- var _recaptcha = require('../../../field/captcha/recaptcha');
1
+ "use strict";
14
2
 
3
+ var _react = _interopRequireDefault(require("react"));
4
+ var _enzyme = require("enzyme");
5
+ var _immutable = _interopRequireDefault(require("immutable"));
6
+ var _recaptcha = require("../../../field/captcha/recaptcha");
15
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
-
17
8
  var createLockMock = function createLockMock() {
18
9
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
19
- _ref$provider = _ref.provider,
20
- provider = _ref$provider === undefined ? 'none' : _ref$provider,
21
- _ref$sitekey = _ref.sitekey,
22
- sitekey = _ref$sitekey === undefined ? '' : _ref$sitekey;
23
-
24
- return _immutable2.default.fromJS({
10
+ _ref$provider = _ref.provider,
11
+ provider = _ref$provider === void 0 ? 'none' : _ref$provider,
12
+ _ref$sitekey = _ref.sitekey,
13
+ sitekey = _ref$sitekey === void 0 ? '' : _ref$sitekey;
14
+ return _immutable.default.fromJS({
25
15
  id: '__lock-id__',
26
16
  core: {
27
- captcha: { provider: provider, sitekey: sitekey },
17
+ captcha: {
18
+ provider: provider,
19
+ sitekey: sitekey
20
+ },
28
21
  transient: {
29
22
  ui: {
30
23
  language: 'en-US'
@@ -33,15 +26,19 @@ var createLockMock = function createLockMock() {
33
26
  }
34
27
  });
35
28
  };
36
-
37
29
  describe('Recaptcha v2', function () {
38
30
  it('should match the snapshot', function () {
39
- var mockLock = createLockMock({ provider: 'recaptcha_v2', sitekey: 'mySiteKey' });
40
- var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(_recaptcha.ReCAPTCHA, { provider: 'recaptcha_v2', lock: mockLock, sitekey: 'mySiteKey' }));
41
-
31
+ var mockLock = createLockMock({
32
+ provider: 'recaptcha_v2',
33
+ sitekey: 'mySiteKey'
34
+ });
35
+ var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_recaptcha.ReCAPTCHA, {
36
+ provider: 'recaptcha_v2',
37
+ lock: mockLock,
38
+ sitekey: 'mySiteKey'
39
+ }));
42
40
  expect(wrapper).toMatchSnapshot();
43
41
  });
44
-
45
42
  describe('render', function () {
46
43
  beforeAll(function () {
47
44
  document.body.innerHTML = "<div id='renderTest'></div>";
@@ -50,7 +47,10 @@ describe('Recaptcha v2', function () {
50
47
  document.getElementById('renderTest').remove();
51
48
  });
52
49
  it('injects the script', function () {
53
- _recaptcha.ReCAPTCHA.loadScript({ hl: 'en-US', provider: 'recaptcha_v2' }, document.body);
50
+ _recaptcha.ReCAPTCHA.loadScript({
51
+ hl: 'en-US',
52
+ provider: 'recaptcha_v2'
53
+ }, document.body);
54
54
  expect(document.body.innerHTML).toContain('<div id="renderTest">');
55
55
  expect(document.body.innerHTML).toContain('<script src="https://www.recaptcha.net/recaptcha/api.js?hl=en-US');
56
56
  });
@@ -1,68 +1,55 @@
1
- 'use strict';
2
-
3
- var _react = require('react');
4
-
5
- var _react2 = _interopRequireDefault(_react);
6
-
7
- var _enzyme = require('enzyme');
8
-
9
- var _immutable = require('immutable');
10
-
11
- var _immutable2 = _interopRequireDefault(_immutable);
12
-
13
- var _captcha_pane = require('../../field/captcha/captcha_pane');
14
-
15
- var _captcha_pane2 = _interopRequireDefault(_captcha_pane);
16
-
17
- var _recaptcha = require('../../field/captcha/recaptcha');
18
-
19
- var _captcha_input = require('../../ui/input/captcha_input');
20
-
21
- var _captcha_input2 = _interopRequireDefault(_captcha_input);
22
-
1
+ "use strict";
2
+
3
+ var _react = _interopRequireDefault(require("react"));
4
+ var _enzyme = require("enzyme");
5
+ var _immutable = _interopRequireDefault(require("immutable"));
6
+ var _captcha_pane = _interopRequireDefault(require("../../field/captcha/captcha_pane"));
7
+ var _recaptcha = require("../../field/captcha/recaptcha");
8
+ var _captcha_input = _interopRequireDefault(require("../../ui/input/captcha_input"));
23
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
-
25
10
  var createLockMock = function createLockMock() {
26
11
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
27
- _ref$provider = _ref.provider,
28
- provider = _ref$provider === undefined ? 'auth0' : _ref$provider,
29
- _ref$required = _ref.required,
30
- required = _ref$required === undefined ? true : _ref$required,
31
- _ref$siteKey = _ref.siteKey,
32
- siteKey = _ref$siteKey === undefined ? '' : _ref$siteKey;
33
-
34
- return _immutable2.default.fromJS({
12
+ _ref$provider = _ref.provider,
13
+ provider = _ref$provider === void 0 ? 'auth0' : _ref$provider,
14
+ _ref$required = _ref.required,
15
+ required = _ref$required === void 0 ? true : _ref$required,
16
+ _ref$siteKey = _ref.siteKey,
17
+ siteKey = _ref$siteKey === void 0 ? '' : _ref$siteKey;
18
+ return _immutable.default.fromJS({
35
19
  id: '__lock-id__',
36
20
  core: {
37
- captcha: { provider: provider, siteKey: siteKey, required: required }
21
+ captcha: {
22
+ provider: provider,
23
+ siteKey: siteKey,
24
+ required: required
25
+ }
38
26
  }
39
27
  });
40
28
  };
41
-
42
29
  var createI18nMock = function createI18nMock() {
43
30
  return {
44
31
  str: jest.fn().mockReturnValue('My i18N Compliant Language')
45
32
  };
46
33
  };
47
-
48
34
  describe('CaptchaPane', function () {
49
35
  describe('CaptchaInput', function () {
50
- var wrapper = void 0;
36
+ var wrapper;
51
37
  beforeAll(function () {
52
38
  var lockMock = createLockMock();
53
39
  var i8nMock = createI18nMock();
54
40
  var onReloadMock = jest.fn();
55
-
56
- wrapper = (0, _enzyme.mount)(_react2.default.createElement(_captcha_pane2.default, { lock: lockMock, onReload: onReloadMock, i18n: i8nMock }));
41
+ wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
42
+ lock: lockMock,
43
+ onReload: onReloadMock,
44
+ i18n: i8nMock
45
+ }));
57
46
  });
58
-
59
47
  it('should render CaptchaInput if no provider is specified', function () {
60
- expect(wrapper.find(_captcha_input2.default)).toHaveLength(1);
48
+ expect(wrapper.find(_captcha_input.default)).toHaveLength(1);
61
49
  });
62
50
  });
63
-
64
51
  describe('recaptchav2', function () {
65
- var wrapper = void 0;
52
+ var wrapper;
66
53
  beforeAll(function () {
67
54
  var lockMock = createLockMock({
68
55
  provider: 'recaptcha_v2',
@@ -70,21 +57,21 @@ describe('CaptchaPane', function () {
70
57
  });
71
58
  var i8nMock = createI18nMock();
72
59
  var onReloadMock = jest.fn();
73
-
74
- wrapper = (0, _enzyme.mount)(_react2.default.createElement(_captcha_pane2.default, { lock: lockMock, onReload: onReloadMock, i18n: i8nMock }));
60
+ wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
61
+ lock: lockMock,
62
+ onReload: onReloadMock,
63
+ i18n: i8nMock
64
+ }));
75
65
  });
76
-
77
66
  it('should render reCaptcha if provider is recaptchav2', function () {
78
67
  expect(wrapper.find(_recaptcha.ReCAPTCHA)).toHaveLength(1);
79
68
  });
80
-
81
69
  it('should pass the sitekey', function () {
82
70
  expect(wrapper.find(_recaptcha.ReCAPTCHA).props().sitekey).toBe('mySiteKey');
83
71
  });
84
72
  });
85
-
86
73
  describe('recaptcha enterprise', function () {
87
- var wrapper = void 0;
74
+ var wrapper;
88
75
  beforeAll(function () {
89
76
  var lockMock = createLockMock({
90
77
  provider: 'recaptcha_enterprise',
@@ -92,14 +79,15 @@ describe('CaptchaPane', function () {
92
79
  });
93
80
  var i8nMock = createI18nMock();
94
81
  var onReloadMock = jest.fn();
95
-
96
- wrapper = (0, _enzyme.mount)(_react2.default.createElement(_captcha_pane2.default, { lock: lockMock, onReload: onReloadMock, i18n: i8nMock }));
82
+ wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
83
+ lock: lockMock,
84
+ onReload: onReloadMock,
85
+ i18n: i8nMock
86
+ }));
97
87
  });
98
-
99
88
  it('should render reCaptcha if provider is recaptcha_enterprise', function () {
100
89
  expect(wrapper.find(_recaptcha.ReCAPTCHA)).toHaveLength(1);
101
90
  });
102
-
103
91
  it('should pass the sitekey', function () {
104
92
  expect(wrapper.find(_recaptcha.ReCAPTCHA).props().sitekey).toBe('mySiteKey');
105
93
  });