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,67 +1,49 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- exports.__esModule = true;
4
-
5
- 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; };
6
-
7
- exports.setupLock = setupLock;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.checkSession = checkSession;
7
+ exports.closeLock = closeLock;
8
8
  exports.handleAuthCallback = handleAuthCallback;
9
- exports.resumeAuth = resumeAuth;
9
+ exports.logIn = logIn;
10
+ exports.logInSuccess = logInSuccess;
10
11
  exports.openLock = openLock;
11
- exports.closeLock = closeLock;
12
- exports.removeLock = removeLock;
13
- exports.updateLock = updateLock;
14
12
  exports.pinLoadingPane = pinLoadingPane;
13
+ exports.removeLock = removeLock;
14
+ exports.resumeAuth = resumeAuth;
15
+ exports.setupLock = setupLock;
15
16
  exports.unpinLoadingPane = unpinLoadingPane;
17
+ exports.updateLock = updateLock;
16
18
  exports.validateAndSubmit = validateAndSubmit;
17
- exports.logIn = logIn;
18
- exports.checkSession = checkSession;
19
- exports.logInSuccess = logInSuccess;
20
-
21
- var _immutable = require('immutable');
22
-
23
- var _immutable2 = _interopRequireDefault(_immutable);
24
-
25
- var _web_api = require('./web_api');
26
-
27
- var _web_api2 = _interopRequireDefault(_web_api);
28
-
29
- var _index = require('../store/index');
30
-
31
- var _remote_data = require('./remote_data');
32
-
33
- var _index2 = require('./index');
34
-
35
- var l = _interopRequireWildcard(_index2);
36
-
37
- var _preload_utils = require('../utils/preload_utils');
38
-
39
- var _container = require('../ui/box/container');
40
-
41
- var _index3 = require('../field/index');
42
-
43
- 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; } }
44
-
19
+ var _immutable = _interopRequireWildcard(require("immutable"));
20
+ var _web_api = _interopRequireDefault(require("./web_api"));
21
+ var _index = require("../store/index");
22
+ var _remote_data = require("./remote_data");
23
+ var l = _interopRequireWildcard(require("./index"));
24
+ var _preload_utils = require("../utils/preload_utils");
25
+ var _container = require("../ui/box/container");
26
+ var _index3 = require("../field/index");
45
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
46
-
28
+ 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); }
29
+ 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; }
30
+ 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); }
31
+ 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; }
32
+ 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; }
33
+ 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; }
34
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
35
+ 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); }
47
36
  function setupLock(id, clientID, domain, options, hookRunner, emitEventFn, handleEventFn) {
48
37
  var m = l.setup(id, clientID, domain, options, hookRunner, emitEventFn, handleEventFn);
49
-
50
38
  m = (0, _remote_data.syncRemoteData)(m);
51
-
52
39
  (0, _preload_utils.img)(l.ui.logo(m) || _container.defaultProps.logo);
53
-
54
- _web_api2.default.setupClient(id, clientID, domain, l.withAuthOptions(m, _extends({}, options, {
40
+ _web_api.default.setupClient(id, clientID, domain, l.withAuthOptions(m, _objectSpread(_objectSpread({}, options), {}, {
55
41
  popupOptions: l.ui.popupOptions(m)
56
42
  })));
57
-
58
43
  m = l.runHook(m, 'didInitialize', options);
59
-
60
44
  (0, _index.swap)(_index.setEntity, 'lock', id, m);
61
-
62
45
  return m;
63
46
  }
64
-
65
47
  function handleAuthCallback() {
66
48
  var ms = (0, _index.read)(_index.getCollection, 'lock');
67
49
  var keepHash = ms.filter(function (m) {
@@ -76,22 +58,19 @@ function handleAuthCallback() {
76
58
  };
77
59
  resumeAuth(window.location.hash, callback);
78
60
  }
79
-
80
61
  function resumeAuth(hash, callback) {
81
62
  var ms = (0, _index.read)(_index.getCollection, 'lock');
82
63
  ms.forEach(function (m) {
83
64
  return l.auth.redirect(m) && parseHash(m, hash, callback);
84
65
  });
85
66
  }
86
-
87
67
  function parseHash(m, hash, cb) {
88
- _web_api2.default.parseHash(l.id(m), hash, function (error, authResult) {
68
+ _web_api.default.parseHash(l.id(m), hash, function (error, authResult) {
89
69
  if (error) {
90
70
  l.emitHashParsedEvent(m, error);
91
71
  } else {
92
72
  l.emitHashParsedEvent(m, authResult);
93
73
  }
94
-
95
74
  if (error) {
96
75
  l.emitAuthorizationErrorEvent(m, error);
97
76
  } else if (authResult) {
@@ -100,17 +79,14 @@ function parseHash(m, hash, cb) {
100
79
  cb(error, authResult);
101
80
  });
102
81
  }
103
-
104
82
  function openLock(id, opts) {
105
83
  var m = (0, _index.read)(_index.getEntity, 'lock', id);
106
84
  if (!m) {
107
85
  throw new Error("The Lock can't be opened again after it has been destroyed");
108
86
  }
109
-
110
87
  if (l.rendering(m)) {
111
88
  return false;
112
89
  }
113
-
114
90
  if (opts.flashMessage) {
115
91
  var supportedTypes = ['error', 'success', 'info'];
116
92
  if (!opts.flashMessage.type || supportedTypes.indexOf(opts.flashMessage.type) === -1) {
@@ -120,36 +96,29 @@ function openLock(id, opts) {
120
96
  return l.emitUnrecoverableErrorEvent(m, "'flashMessage' must provide a text");
121
97
  }
122
98
  }
123
-
124
99
  l.emitEvent(m, 'show');
125
-
126
100
  (0, _index.swap)(_index.updateEntity, 'lock', id, function (m) {
127
101
  m = l.overrideOptions(m, opts);
128
102
  m = l.filterConnections(m);
129
103
  m = l.runHook(m, 'willShow', opts);
130
104
  return l.render(m);
131
105
  });
132
-
133
106
  return true;
134
107
  }
135
-
136
108
  function closeLock(id) {
137
109
  var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
138
110
  var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
139
-
140
111
  // Do nothing when the Lock can't be closed, unless closing is forced.
141
112
  var m = (0, _index.read)(_index.getEntity, 'lock', id);
142
113
  if (!l.ui.closable(m) && !force || !l.rendering(m)) {
143
114
  return;
144
115
  }
145
-
146
116
  l.emitEvent(m, 'hide');
147
117
 
148
118
  // If it is a modal, stop rendering an reset after a second,
149
119
  // otherwise just reset.
150
120
  if (l.ui.appendContainer(m)) {
151
121
  (0, _index.swap)(_index.updateEntity, 'lock', id, l.stopRendering);
152
-
153
122
  setTimeout(function () {
154
123
  (0, _index.swap)(_index.updateEntity, 'lock', id, function (m) {
155
124
  m = (0, _index3.hideInvalidFields)(m);
@@ -170,16 +139,13 @@ function closeLock(id) {
170
139
  callback(m);
171
140
  }
172
141
  }
173
-
174
142
  function removeLock(id) {
175
143
  (0, _index.swap)(_index.updateEntity, 'lock', id, l.stopRendering);
176
144
  (0, _index.swap)(_index.removeEntity, 'lock', id);
177
145
  }
178
-
179
146
  function updateLock(id, f) {
180
147
  return (0, _index.swap)(_index.updateEntity, 'lock', id, f);
181
148
  }
182
-
183
149
  function pinLoadingPane(id) {
184
150
  var lock = (0, _index.read)(_index.getEntity, 'lock', id);
185
151
  if (!lock.get('isLoadingPanePinned')) {
@@ -188,17 +154,14 @@ function pinLoadingPane(id) {
188
154
  });
189
155
  }
190
156
  }
191
-
192
157
  function unpinLoadingPane(id) {
193
158
  (0, _index.swap)(_index.updateEntity, 'lock', id, function (m) {
194
159
  return m.set('isLoadingPanePinned', false);
195
160
  });
196
161
  }
197
-
198
162
  function validateAndSubmit(id) {
199
163
  var fields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
200
- var f = arguments[2];
201
-
164
+ var f = arguments.length > 2 ? arguments[2] : undefined;
202
165
  (0, _index.swap)(_index.updateEntity, 'lock', id, function (m) {
203
166
  var allFieldsValid = fields.reduce(function (r, x) {
204
167
  return r && (0, _index3.isFieldValid)(m, x);
@@ -208,26 +171,22 @@ function validateAndSubmit(id) {
208
171
  }, m);
209
172
  });
210
173
  var m = (0, _index.read)(_index.getEntity, 'lock', id);
211
-
212
174
  if (l.submitting(m)) {
213
175
  f(m);
214
176
  }
215
177
  }
216
-
217
178
  function logIn(id, fields) {
218
179
  var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
219
180
  var logInErrorHandler = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (_id, error, _fields, next) {
220
181
  return next();
221
182
  };
222
-
223
183
  validateAndSubmit(id, fields, function (m) {
224
184
  try {
225
185
  // For now, always pass 'null' for the context as we don't need it yet.
226
186
  // If we need it later, it'll save a breaking change in hooks already in use.
227
187
  var context = null;
228
-
229
188
  l.runHook(m, 'loggingIn', context, function () {
230
- _web_api2.default.logIn(id, params, l.auth.params(m).toJS(), function (error, result) {
189
+ _web_api.default.logIn(id, params, l.auth.params(m).toJS(), function (error, result) {
231
190
  if (error) {
232
191
  setTimeout(function () {
233
192
  return logInError(id, fields, error, logInErrorHandler);
@@ -244,25 +203,21 @@ function logIn(id, fields) {
244
203
  }
245
204
  });
246
205
  }
247
-
248
206
  function checkSession(id) {
249
207
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
250
-
251
208
  var m = (0, _index.read)(_index.getEntity, 'lock', id);
252
209
  (0, _index.swap)(_index.updateEntity, 'lock', id, function (m) {
253
210
  return l.setSubmitting(m, true);
254
211
  });
255
- _web_api2.default.checkSession(id, params, function (err, result) {
212
+ _web_api.default.checkSession(id, params, function (err, result) {
256
213
  if (err) {
257
214
  return logInError(id, [], err);
258
215
  }
259
216
  return logInSuccess(id, result);
260
217
  });
261
218
  }
262
-
263
219
  function logInSuccess(id, result) {
264
220
  var m = (0, _index.read)(_index.getEntity, 'lock', id);
265
-
266
221
  if (!l.ui.autoclose(m)) {
267
222
  (0, _index.swap)(_index.updateEntity, 'lock', id, function (m) {
268
223
  m = l.setSubmitting(m, false);
@@ -275,31 +230,24 @@ function logInSuccess(id, result) {
275
230
  });
276
231
  }
277
232
  }
278
-
279
233
  function logInError(id, fields, error) {
280
234
  var localHandler = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (_id, _error, _fields, next) {
281
235
  return next();
282
236
  };
283
-
284
237
  var errorCode = error.error || error.code;
285
-
286
238
  localHandler(id, error, fields, function () {
287
239
  return setTimeout(function () {
288
240
  var m = (0, _index.read)(_index.getEntity, 'lock', id);
289
241
  var errorMessage = l.loginErrorMessage(m, error, loginType(fields));
290
242
  var errorCodesThatEmitAuthorizationErrorEvent = ['blocked_user', 'rule_error', 'lock.unauthorized', 'invalid_user_password', 'login_required'];
291
-
292
243
  if (errorCodesThatEmitAuthorizationErrorEvent.indexOf(errorCode) > -1) {
293
244
  l.emitAuthorizationErrorEvent(m, error);
294
245
  }
295
-
296
246
  (0, _index.swap)(_index.updateEntity, 'lock', id, l.setSubmitting, false, errorMessage);
297
247
  }, 0);
298
248
  });
299
-
300
249
  (0, _index.swap)(_index.updateEntity, 'lock', id, l.setSubmitting, false);
301
250
  }
302
-
303
251
  function loginType(fields) {
304
252
  if (!fields) return;
305
253
  if (~fields.indexOf('vcode')) return 'code';
@@ -1,61 +1,60 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- exports.__esModule = true;
4
-
5
- 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; };
6
- // TODO: this module should depend from social stuff
7
-
8
-
9
- exports.hasFreeSubscription = hasFreeSubscription;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clientConnections = clientConnections;
10
7
  exports.connection = connection;
8
+ exports.hasFreeSubscription = hasFreeSubscription;
11
9
  exports.initClient = initClient;
12
- exports.clientConnections = clientConnections;
13
-
14
- var _immutable = require('immutable');
15
-
16
- var _immutable2 = _interopRequireDefault(_immutable);
17
-
18
- var _auth0PasswordPolicies = require('auth0-password-policies');
19
-
20
- var _auth0PasswordPolicies2 = _interopRequireDefault(_auth0PasswordPolicies);
21
-
22
- var _data_utils = require('../../utils/data_utils');
23
-
24
- var _index = require('../../connection/social/index');
25
-
26
- var _enterprise = require('../../connection/enterprise');
27
-
10
+ var _immutable = _interopRequireWildcard(require("immutable"));
11
+ var _auth0PasswordPolicies = _interopRequireDefault(require("auth0-password-policies"));
12
+ var _data_utils = require("../../utils/data_utils");
13
+ var _index = require("../../connection/social/index");
14
+ var _enterprise = require("../../connection/enterprise");
28
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
16
+ 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); }
17
+ 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; }
18
+ 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); }
19
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
20
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
23
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
24
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
25
+ 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; }
26
+ 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; }
27
+ 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; }
28
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
29
+ 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); }
30
30
  var _dataFns = (0, _data_utils.dataFns)(['client']),
31
- initNS = _dataFns.initNS,
32
- get = _dataFns.get;
33
-
34
- var DEFAULT_CONNECTION_VALIDATION = { username: { min: 1, max: 15 } };
35
-
31
+ initNS = _dataFns.initNS,
32
+ get = _dataFns.get;
33
+ var DEFAULT_CONNECTION_VALIDATION = {
34
+ username: {
35
+ min: 1,
36
+ max: 15
37
+ }
38
+ };
36
39
  function hasFreeSubscription(m) {
37
40
  return ['free', 'dev'].indexOf(get(m, ['tenant', 'subscription'])) > -1;
38
41
  }
39
-
40
42
  function connection(m, strategyName, name) {
41
43
  // TODO: this function should take a client, not a map with a client
42
44
  // key.
43
45
  var connections = strategy(m, strategyName).get('connections', (0, _immutable.List)());
44
46
  return connections.find(withName(name)) || (0, _immutable.Map)();
45
47
  }
46
-
47
48
  function strategy(m, name) {
48
49
  // TODO: this function should take a client, not a map with a client
49
50
  // key.
50
51
  return m.getIn(['client', 'strategies'], (0, _immutable.List)()).find(withName(name)) || (0, _immutable.Map)();
51
52
  }
52
-
53
53
  function withName(name) {
54
54
  return function (x) {
55
55
  return x.get('name') === name;
56
56
  };
57
57
  }
58
-
59
58
  function strategyNameToConnectionType(str) {
60
59
  if (str === 'auth0') {
61
60
  return 'database';
@@ -71,30 +70,23 @@ function strategyNameToConnectionType(str) {
71
70
  return 'unknown';
72
71
  }
73
72
  }
74
-
75
73
  function formatConnectionValidation() {
76
74
  var connectionValidation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
77
-
78
75
  if (connectionValidation.username == null) {
79
76
  return null;
80
77
  }
81
-
82
- var validation = _extends({}, DEFAULT_CONNECTION_VALIDATION, connectionValidation);
78
+ var validation = _objectSpread(_objectSpread({}, DEFAULT_CONNECTION_VALIDATION), connectionValidation);
83
79
  var defaultMin = DEFAULT_CONNECTION_VALIDATION.username.min;
84
80
  var defaultMax = DEFAULT_CONNECTION_VALIDATION.username.max;
85
-
86
81
  validation.username.min = parseInt(validation.username.min, 10) || defaultMin;
87
82
  validation.username.max = parseInt(validation.username.max, 10) || defaultMax;
88
-
89
83
  if (validation.username.min > validation.username.max) {
90
84
  validation.username.min = defaultMin;
91
85
  validation.username.max = defaultMax;
92
86
  }
93
-
94
87
  return validation;
95
88
  }
96
-
97
- var emptyConnections = _immutable2.default.fromJS({
89
+ var emptyConnections = _immutable.default.fromJS({
98
90
  database: [],
99
91
  enterprise: [],
100
92
  passwordless: [],
@@ -105,9 +97,8 @@ var emptyConnections = _immutable2.default.fromJS({
105
97
  function initClient(m, client) {
106
98
  return initNS(m, formatClient(client));
107
99
  }
108
-
109
100
  function formatClient(o) {
110
- return new _immutable2.default.fromJS({
101
+ return new _immutable.default.fromJS({
111
102
  id: o.id,
112
103
  tenant: {
113
104
  name: o.tenant,
@@ -116,29 +107,22 @@ function formatClient(o) {
116
107
  connections: formatClientConnections(o)
117
108
  });
118
109
  }
119
-
120
110
  function formatClientConnections(o) {
121
111
  var result = emptyConnections.toJS();
122
-
123
112
  var _loop = function _loop() {
124
113
  var _result$connectionTyp;
125
-
126
114
  var strategy = o.strategies[i];
127
115
  var connectionType = strategyNameToConnectionType(strategy.name);
128
-
129
116
  var connections = strategy.connections.map(function (connection) {
130
117
  return formatClientConnection(connectionType, strategy.name, connection);
131
118
  });
132
- (_result$connectionTyp = result[connectionType]).push.apply(_result$connectionTyp, connections);
119
+ (_result$connectionTyp = result[connectionType]).push.apply(_result$connectionTyp, _toConsumableArray(connections));
133
120
  };
134
-
135
121
  for (var i = 0; i < (o.strategies || []).length; i++) {
136
122
  _loop();
137
123
  }
138
-
139
124
  return result;
140
125
  }
141
-
142
126
  function formatClientConnection(connectionType, strategyName, connection) {
143
127
  var result = {
144
128
  name: connection.name,
@@ -146,9 +130,8 @@ function formatClientConnection(connectionType, strategyName, connection) {
146
130
  type: connectionType,
147
131
  displayName: connection.display_name
148
132
  };
149
-
150
133
  if (connectionType === 'database') {
151
- result.passwordPolicy = _auth0PasswordPolicies2.default[connection.passwordPolicy || 'none'];
134
+ result.passwordPolicy = _auth0PasswordPolicies.default[connection.passwordPolicy || 'none'];
152
135
  if (connection.password_complexity_options && connection.password_complexity_options.min_length) {
153
136
  result.passwordPolicy.length.minLength = connection.password_complexity_options.min_length;
154
137
  }
@@ -157,7 +140,6 @@ function formatClientConnection(connectionType, strategyName, connection) {
157
140
  result.requireUsername = typeof connection.requires_username === 'boolean' ? connection.requires_username : false;
158
141
  result.validation = formatConnectionValidation(connection.validation);
159
142
  }
160
-
161
143
  if (connectionType === 'enterprise') {
162
144
  var domains = connection.domain_aliases || [];
163
145
  if (connection.domain) {
@@ -165,10 +147,8 @@ function formatClientConnection(connectionType, strategyName, connection) {
165
147
  }
166
148
  result.domains = domains;
167
149
  }
168
-
169
150
  return result;
170
151
  }
171
-
172
152
  function clientConnections(m) {
173
153
  return get(m, 'connections', emptyConnections);
174
154
  }
@@ -1,36 +1,28 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- exports.__esModule = true;
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
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
4
7
  exports.fetchClientSettings = fetchClientSettings;
5
8
  exports.syncClientSettingsSuccess = syncClientSettingsSuccess;
6
-
7
- var _urlJoin = require('url-join');
8
-
9
- var _urlJoin2 = _interopRequireDefault(_urlJoin);
10
-
11
- var _cdn_utils = require('../../utils/cdn_utils');
12
-
13
- var _index = require('../index');
14
-
15
- var l = _interopRequireWildcard(_index);
16
-
17
- var _index2 = require('./index');
18
-
19
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
20
-
9
+ var _urlJoin = _interopRequireDefault(require("url-join"));
10
+ var _cdn_utils = require("../../utils/cdn_utils");
11
+ var l = _interopRequireWildcard(require("../index"));
12
+ var _index2 = require("./index");
13
+ 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); }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
-
23
16
  function fetchClientSettings(clientID, clientBaseUrl, cb) {
24
17
  (0, _cdn_utils.load)({
25
18
  method: 'setClient',
26
- url: (0, _urlJoin2.default)(clientBaseUrl, 'client', clientID + '.js?t' + +new Date()),
19
+ url: (0, _urlJoin.default)(clientBaseUrl, 'client', "".concat(clientID, ".js?t").concat(+new Date())),
27
20
  check: function check(o) {
28
21
  return o && o.id === clientID;
29
22
  },
30
23
  cb: cb
31
24
  });
32
25
  }
33
-
34
26
  function syncClientSettingsSuccess(m, result) {
35
27
  m = (0, _index2.initClient)(m, result);
36
28
  m = l.filterConnections(m);