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,25 +1,15 @@
1
- 'use strict';
2
-
3
- var _immutable = require('immutable');
4
-
5
- var _immutable2 = _interopRequireDefault(_immutable);
6
-
7
- var _actions = require('connection/passwordless/actions');
8
-
9
- var _actions2 = _interopRequireDefault(_actions);
10
-
11
- var _testUtils = require('testUtils');
1
+ "use strict";
12
2
 
3
+ var _immutable = _interopRequireDefault(require("immutable"));
4
+ var _actions = _interopRequireDefault(require("connection/passwordless/actions"));
5
+ var _testUtils = require("testUtils");
13
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
-
15
7
  jest.useFakeTimers();
16
-
17
8
  describe('passwordless actions', function () {
18
- var mockFns = void 0;
19
- var actions = void 0;
9
+ var mockFns;
10
+ var actions;
20
11
  beforeEach(function () {
21
12
  jest.resetModules();
22
-
23
13
  jest.mock('connection/passwordless/index', function () {
24
14
  return {
25
15
  isEmail: jest.fn(),
@@ -65,9 +55,11 @@ describe('passwordless actions', function () {
65
55
  };
66
56
  });
67
57
  jest.mock('i18n', function () {
68
- return { html: function html(_, keys) {
58
+ return {
59
+ html: function html(_, keys) {
69
60
  return keys.join(',');
70
- } };
61
+ }
62
+ };
71
63
  });
72
64
  jest.mock('core/index', function () {
73
65
  return {
@@ -106,11 +98,9 @@ describe('passwordless actions', function () {
106
98
  updateEntity: 'updateEntity'
107
99
  };
108
100
  });
109
-
110
101
  actions = require('connection/passwordless/actions');
111
-
112
102
  require('core/index').connections.mockImplementation(function () {
113
- return _immutable2.default.fromJS([]);
103
+ return _immutable.default.fromJS([]);
114
104
  });
115
105
  });
116
106
  describe('requestPasswordlessEmail()', function () {
@@ -125,31 +115,24 @@ describe('passwordless actions', function () {
125
115
  });
126
116
  it('calls startPasswordless with a custom email connection name', function () {
127
117
  actions.requestPasswordlessEmail('id');
128
-
129
118
  require('core/index').connections.mockImplementation(function () {
130
- return _immutable2.default.fromJS([{
119
+ return _immutable.default.fromJS([{
131
120
  name: 'custom-connection',
132
121
  strategy: 'email',
133
122
  type: 'passwordless'
134
123
  }]);
135
124
  });
136
-
137
125
  require('core/index').useCustomPasswordlessConnection.mockReturnValue(true);
138
-
139
126
  require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
140
127
  (0, _testUtils.expectMockToMatch)(require('core/web_api').startPasswordless, 1);
141
128
  });
142
129
  it('calls setPasswordlessStarted() on success', function () {
143
130
  actions.requestPasswordlessEmail('id');
144
131
  require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
145
-
146
132
  require('core/web_api').startPasswordless.mock.calls[0][2](null);
147
-
148
133
  var _require = require('store/index'),
149
- swap = _require.swap;
150
-
134
+ swap = _require.swap;
151
135
  (0, _testUtils.expectMockToMatch)(swap, 1);
152
-
153
136
  swap.mock.calls[0][3]('model');
154
137
  (0, _testUtils.expectMockToMatch)(require('core/index').setSubmitting, 1);
155
138
  (0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').setPasswordlessStarted, 1);
@@ -161,13 +144,10 @@ describe('passwordless actions', function () {
161
144
  var error = new Error('foobar');
162
145
  error.error = 'some_error_code';
163
146
  require('core/web_api').startPasswordless.mock.calls[0][2](error);
164
-
165
147
  jest.runAllTimers();
166
-
167
148
  var _require2 = require('store/index'),
168
- read = _require2.read,
169
- swap = _require2.swap;
170
-
149
+ read = _require2.read,
150
+ swap = _require2.swap;
171
151
  (0, _testUtils.expectMockToMatch)(read, 1);
172
152
  (0, _testUtils.expectMockToMatch)(swap, 1);
173
153
  });
@@ -178,13 +158,10 @@ describe('passwordless actions', function () {
178
158
  error.error = 'sms_provider_error';
179
159
  error.description = 'something (Code: 21211)';
180
160
  require('core/web_api').startPasswordless.mock.calls[0][2](error);
181
-
182
161
  jest.runAllTimers();
183
-
184
162
  var _require3 = require('store/index'),
185
- read = _require3.read,
186
- swap = _require3.swap;
187
-
163
+ read = _require3.read,
164
+ swap = _require3.swap;
188
165
  (0, _testUtils.expectMockToMatch)(swap, 1);
189
166
  });
190
167
  });
@@ -192,29 +169,22 @@ describe('passwordless actions', function () {
192
169
  describe('resendEmail()', function () {
193
170
  it('calls setResendSuccess() on success', function () {
194
171
  actions.resendEmail('id');
195
-
196
172
  var _require4 = require('store/index'),
197
- read = _require4.read,
198
- swap = _require4.swap;
199
-
173
+ read = _require4.read,
174
+ swap = _require4.swap;
200
175
  (0, _testUtils.expectMockToMatch)(read, 1);
201
176
  (0, _testUtils.expectMockToMatch)(swap, 1);
202
-
203
177
  require('core/web_api').startPasswordless.mock.calls[0][2](null);
204
-
205
178
  swap.mock.calls[1][3]('model');
206
179
  (0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').setResendSuccess, 1);
207
180
  });
208
181
  it('calls setResendFailed on error', function () {
209
182
  actions.resendEmail('id');
210
-
211
183
  var _require5 = require('store/index'),
212
- read = _require5.read,
213
- swap = _require5.swap;
214
-
184
+ read = _require5.read,
185
+ swap = _require5.swap;
215
186
  (0, _testUtils.expectMockToMatch)(read, 1);
216
187
  (0, _testUtils.expectMockToMatch)(swap, 1);
217
-
218
188
  require('core/web_api').startPasswordless.mock.calls[0][2](new Error('foobar'));
219
189
  jest.runAllTimers();
220
190
  swap.mock.calls[1][3]('model');
@@ -233,31 +203,24 @@ describe('passwordless actions', function () {
233
203
  });
234
204
  it('calls startPasswordless with a custom SMS connection', function () {
235
205
  actions.sendSMS('id');
236
-
237
206
  require('core/index').connections.mockImplementation(function () {
238
- return _immutable2.default.fromJS([{
207
+ return _immutable.default.fromJS([{
239
208
  name: 'custom-connection',
240
209
  strategy: 'sms',
241
210
  type: 'passwordless'
242
211
  }]);
243
212
  });
244
-
245
213
  require('core/index').useCustomPasswordlessConnection.mockReturnValue(true);
246
214
  require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
247
-
248
215
  (0, _testUtils.expectMockToMatch)(require('core/web_api').startPasswordless, 1);
249
216
  });
250
217
  it('calls setPasswordlessStarted() on success', function () {
251
218
  actions.sendSMS('id');
252
219
  require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
253
-
254
220
  require('core/web_api').startPasswordless.mock.calls[0][2](null);
255
-
256
221
  var _require6 = require('store/index'),
257
- swap = _require6.swap;
258
-
222
+ swap = _require6.swap;
259
223
  (0, _testUtils.expectMockToMatch)(swap, 1);
260
-
261
224
  swap.mock.calls[0][3]('model');
262
225
  (0, _testUtils.expectMockToMatch)(require('core/index').setSubmitting, 1);
263
226
  (0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').setPasswordlessStarted, 1);
@@ -269,13 +232,10 @@ describe('passwordless actions', function () {
269
232
  var error = new Error('foobar');
270
233
  error.error = 'some_error_code';
271
234
  require('core/web_api').startPasswordless.mock.calls[0][2](error);
272
-
273
235
  jest.runAllTimers();
274
-
275
236
  var _require7 = require('store/index'),
276
- read = _require7.read,
277
- swap = _require7.swap;
278
-
237
+ read = _require7.read,
238
+ swap = _require7.swap;
279
239
  (0, _testUtils.expectMockToMatch)(read, 1);
280
240
  (0, _testUtils.expectMockToMatch)(swap, 1);
281
241
  });
@@ -286,13 +246,10 @@ describe('passwordless actions', function () {
286
246
  error.error = 'sms_provider_error';
287
247
  error.description = 'something (Code: 21211)';
288
248
  require('core/web_api').startPasswordless.mock.calls[0][2](error);
289
-
290
249
  jest.runAllTimers();
291
-
292
250
  var _require8 = require('store/index'),
293
- read = _require8.read,
294
- swap = _require8.swap;
295
-
251
+ read = _require8.read,
252
+ swap = _require8.swap;
296
253
  (0, _testUtils.expectMockToMatch)(swap, 1);
297
254
  });
298
255
  it('emits the "authorization_error" event', function () {
@@ -301,9 +258,7 @@ describe('passwordless actions', function () {
301
258
  var error = new Error('foobar');
302
259
  error.error = 'some_error_code';
303
260
  require('core/web_api').startPasswordless.mock.calls[0][2](error);
304
-
305
261
  jest.runAllTimers();
306
-
307
262
  (0, _testUtils.expectMockToMatch)(require('core/index').emitAuthorizationErrorEvent, 1);
308
263
  });
309
264
  });
@@ -311,20 +266,16 @@ describe('passwordless actions', function () {
311
266
  describe('login()', function () {
312
267
  it('sets setSubmitting to true', function () {
313
268
  actions.logIn('id');
314
-
315
269
  var _require9 = require('store/index'),
316
- read = _require9.read,
317
- swap = _require9.swap;
318
-
270
+ read = _require9.read,
271
+ swap = _require9.swap;
319
272
  (0, _testUtils.expectMockToMatch)(read, 1);
320
273
  (0, _testUtils.expectMockToMatch)(swap, 1);
321
274
  });
322
-
323
275
  it('calls webApi.passwordlessVerify() with sms options', function () {
324
276
  actions.logIn('id');
325
277
  (0, _testUtils.expectMockToMatch)(require('core/web_api').passwordlessVerify, 1);
326
278
  });
327
-
328
279
  it('calls webApi.passwordlessVerify() with email options', function () {
329
280
  require('connection/passwordless/index').isEmail = function () {
330
281
  return true;
@@ -332,37 +283,30 @@ describe('passwordless actions', function () {
332
283
  actions.logIn('id');
333
284
  (0, _testUtils.expectMockToMatch)(require('core/web_api').passwordlessVerify, 1);
334
285
  });
335
-
336
286
  describe('on webApi.passwordlessVerify() callback', function () {
337
287
  describe('when there is an error', function () {
338
288
  it('formats the error', function () {
339
289
  actions.logIn('id');
340
-
341
290
  var error = new Error('foobar');
342
291
  error.error = 'some_error_code';
343
292
  require('core/web_api').passwordlessVerify.mock.calls[0][2](error);
344
-
345
293
  var _require10 = require('store/index'),
346
- swap = _require10.swap;
347
-
294
+ swap = _require10.swap;
348
295
  (0, _testUtils.expectMockToMatch)(swap, 2);
349
296
  });
350
-
351
297
  it('emits the "authorization_error" event', function () {
352
298
  actions.logIn('id');
353
-
354
299
  var error = new Error('foobar');
355
300
  error.error = 'some_error_code';
356
301
  require('core/web_api').passwordlessVerify.mock.calls[0][2](error);
357
-
358
302
  (0, _testUtils.expectMockToMatch)(require('core/index').emitAuthorizationErrorEvent, 1);
359
303
  });
360
304
  });
361
-
362
305
  it('calls logInSuccess on success', function () {
363
306
  actions.logIn('id');
364
- require('core/web_api').passwordlessVerify.mock.calls[0][2](null, { result: true });
365
-
307
+ require('core/web_api').passwordlessVerify.mock.calls[0][2](null, {
308
+ result: true
309
+ });
366
310
  (0, _testUtils.expectMockToMatch)(require('core/actions').logInSuccess, 1);
367
311
  });
368
312
  });
@@ -370,23 +314,17 @@ describe('passwordless actions', function () {
370
314
  describe('toggleTermsAcceptance()', function () {
371
315
  it('calls internalToggleTermsAcceptance()', function () {
372
316
  actions.toggleTermsAcceptance('id');
373
-
374
317
  var _require11 = require('store/index'),
375
- swap = _require11.swap;
376
-
318
+ swap = _require11.swap;
377
319
  (0, _testUtils.expectMockToMatch)(swap, 1);
378
-
379
320
  swap.mock.calls[0][3]('model');
380
-
381
321
  (0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').toggleTermsAcceptance, 1);
382
322
  });
383
323
  });
384
324
  it('restart calls restartPasswordless', function () {
385
325
  actions.restart('id');
386
-
387
326
  var _require12 = require('store/index'),
388
- swap = _require12.swap;
389
-
327
+ swap = _require12.swap;
390
328
  (0, _testUtils.expectMockToMatch)(swap, 1);
391
329
  });
392
330
  });
@@ -1,25 +1,18 @@
1
- 'use strict';
2
-
3
- var _actions = require('../../core/actions');
4
-
5
- var _testUtils = require('testUtils');
6
-
7
- var _index = require('core/index');
8
-
9
- var l = _interopRequireWildcard(_index);
10
-
11
- var _index2 = require('store/index');
12
-
13
- var _web_api = require('../../core/web_api');
14
-
15
- var _web_api2 = _interopRequireDefault(_web_api);
16
-
17
- var _immutable = require('immutable');
18
-
1
+ "use strict";
2
+
3
+ var _actions = require("../../core/actions");
4
+ var _testUtils = require("testUtils");
5
+ var l = _interopRequireWildcard(require("core/index"));
6
+ var _index2 = require("store/index");
7
+ var _web_api = _interopRequireDefault(require("../../core/web_api"));
8
+ var _immutable = require("immutable");
19
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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
-
10
+ 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); }
11
+ 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; }
12
+ 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); }
13
+ 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; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
+ 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); }
23
16
  jest.mock('../../core/web_api', function () {
24
17
  return {
25
18
  __esModule: true,
@@ -29,86 +22,70 @@ jest.mock('../../core/web_api', function () {
29
22
  }
30
23
  };
31
24
  });
32
-
33
25
  jest.mock('store/index', function () {
34
- var _ref;
35
-
36
- return _ref = {
26
+ return _defineProperty({
37
27
  read: jest.fn(function () {
38
28
  return 'model';
39
29
  }),
40
30
  getEntity: 'getEntity',
41
31
  swap: jest.fn(),
42
32
  updateEntity: 'updateEntity'
43
- }, _ref['read'] = jest.fn(), _ref;
33
+ }, "read", jest.fn());
44
34
  });
45
-
46
35
  jest.mock('core/index');
47
-
48
36
  describe('core.actions', function () {
49
37
  beforeEach(function () {
50
38
  jest.resetAllMocks();
51
-
52
39
  l.submitting.mockReturnValue(true);
53
40
  l.id.mockReturnValue('id');
54
41
  l.auth.params.mockReturnValue((0, _immutable.fromJS)({}));
55
42
  });
56
-
57
43
  describe('checkSession', function () {
58
44
  it('should set submitting on start', function () {
59
45
  (0, _actions.checkSession)('id', 'params', 'cb');
60
-
61
46
  var _require = require('store/index'),
62
- read = _require.read,
63
- swap = _require.swap;
64
-
47
+ read = _require.read,
48
+ swap = _require.swap;
65
49
  (0, _testUtils.expectMockToMatch)(read, 1);
66
50
  (0, _testUtils.expectMockToMatch)(swap, 1);
67
51
  swap.mock.calls[0][3]('model');
68
52
  (0, _testUtils.expectMockToMatch)(require('core/index').setSubmitting, 1);
69
53
  });
70
54
  });
71
-
72
55
  describe('logIn', function () {
73
56
  it('run the loggingIn hook', function (done) {
74
57
  var m = {};
75
58
  _index2.read.mockReturnValue(m);
76
-
77
- _web_api2.default.logIn.mockImplementation(function (id, params, authParams, cb) {
59
+ _web_api.default.logIn.mockImplementation(function (id, params, authParams, cb) {
78
60
  cb(null, {});
79
61
  done();
80
62
  });
81
-
82
63
  l.runHook.mockImplementation(function (m, hook, context, fn) {
83
64
  expect(hook).toEqual('loggingIn');
84
65
  fn();
85
66
  });
86
-
87
67
  (0, _actions.logIn)();
88
68
  });
89
-
90
69
  it('should display an error if one was thrown from the hook', function (done) {
91
70
  var m = {};
92
71
  _index2.read.mockReturnValue(m);
93
-
94
72
  var store = require('store/index');
95
-
96
73
  store.swap.mockImplementation(function (entity, n, id, fn, value, error) {
97
74
  if (error) {
98
75
  expect(error).toEqual('This is a hook error');
99
76
  done();
100
77
  }
101
78
  });
102
-
103
79
  l.loginErrorMessage.mockImplementation(function (m, error) {
104
80
  return error.description;
105
81
  });
106
-
107
82
  l.runHook.mockImplementation(function (m, hook, fn) {
108
83
  expect(hook).toEqual('loggingIn');
109
- throw { code: 'hook_error', description: 'This is a hook error' };
84
+ throw {
85
+ code: 'hook_error',
86
+ description: 'This is a hook error'
87
+ };
110
88
  });
111
-
112
89
  (0, _actions.logIn)();
113
90
  });
114
91
  });
@@ -1,17 +1,12 @@
1
- 'use strict';
2
-
3
- var _immutable = require('immutable');
4
-
5
- var _immutable2 = _interopRequireDefault(_immutable);
6
-
7
- var _client = require('../../../core/client');
1
+ "use strict";
8
2
 
3
+ var _immutable = _interopRequireDefault(require("immutable"));
4
+ var _client = require("../../../core/client");
9
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
6
  describe('core/client/index', function () {
12
7
  describe('initClient', function () {
13
8
  ['none', 'low', 'fair', 'good', 'excellent'].forEach(function (policy) {
14
- it('loads password policy \'' + policy + '\' correctly without a password_complexity_options option', function () {
9
+ it("loads password policy '".concat(policy, "' correctly without a password_complexity_options option"), function () {
15
10
  var client = {
16
11
  strategies: [{
17
12
  name: 'auth0',
@@ -21,21 +16,23 @@ describe('core/client/index', function () {
21
16
  }]
22
17
  }]
23
18
  };
24
- var result = (0, _client.initClient)(_immutable2.default.fromJS({}), client).toJS();
19
+ var result = (0, _client.initClient)(_immutable.default.fromJS({}), client).toJS();
25
20
  expect(result.client.connections.database[0].passwordPolicy.length).toMatchSnapshot();
26
21
  });
27
- it('loads password policy \'' + policy + '\' correctly with a password_complexity_options option', function () {
22
+ it("loads password policy '".concat(policy, "' correctly with a password_complexity_options option"), function () {
28
23
  var client = {
29
24
  strategies: [{
30
25
  name: 'auth0',
31
26
  connections: [{
32
27
  name: 'Username-Password-Authentication',
33
28
  passwordPolicy: policy,
34
- password_complexity_options: { min_length: 4 }
29
+ password_complexity_options: {
30
+ min_length: 4
31
+ }
35
32
  }]
36
33
  }]
37
34
  };
38
- var result = (0, _client.initClient)(_immutable2.default.fromJS({}), client).toJS();
35
+ var result = (0, _client.initClient)(_immutable.default.fromJS({}), client).toJS();
39
36
  expect(result.client.connections.database[0].passwordPolicy.length).toMatchSnapshot();
40
37
  });
41
38
  });