auth0-lock 14.2.0 → 14.2.2

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 (38) hide show
  1. package/.github/workflows/codeql.yml +1 -1
  2. package/.github/workflows/npm-release.yml +1 -1
  3. package/.github/workflows/snyk.yml +2 -2
  4. package/.github/workflows/test.yml +3 -3
  5. package/.version +1 -1
  6. package/CHANGELOG.md +12 -0
  7. package/README.md +1 -1
  8. package/customJsdomEnvironment.js +9 -0
  9. package/lib/__tests__/connection/database/login_pane.js +6 -7
  10. package/lib/__tests__/connection/database/password_reset_confirmation.js +6 -7
  11. package/lib/__tests__/connection/database/signed_up_confirmation.js +6 -7
  12. package/lib/__tests__/connection/enterprise/quick_auth_screen.js +7 -8
  13. package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +6 -7
  14. package/lib/__tests__/core/index.js +2 -4
  15. package/lib/__tests__/core/signed_in_confirmation.js +6 -7
  16. package/lib/__tests__/core/web_api.js +10 -31
  17. package/lib/__tests__/i18n.js +5 -2
  18. package/lib/__tests__/testUtils.js +30 -4
  19. package/lib/__tests__/ui/box/confirmation_pane.js +6 -7
  20. package/lib/__tests__/ui/box/container.js +56 -0
  21. package/lib/core/web_api/helper.js +1 -1
  22. package/lib/i18n.js +1 -1
  23. package/lib/lock.js +1 -1
  24. package/lib/passwordless.js +1 -1
  25. package/lib/ui/box/chrome.js +35 -20
  26. package/lib/ui/box/container.js +49 -39
  27. package/lib/ui/box/header.js +11 -7
  28. package/lib/ui/box/multisize_slide.js +27 -18
  29. package/lib/ui/input/captcha_input.js +2 -1
  30. package/lib/ui/input/email_input.js +2 -1
  31. package/lib/ui/input/mfa_code_input.js +3 -2
  32. package/lib/ui/input/password_input.js +3 -2
  33. package/lib/ui/input/phone_number_input.js +4 -3
  34. package/lib/ui/input/text_input.js +2 -1
  35. package/lib/ui/input/username_input.js +2 -1
  36. package/lib/ui/input/vcode_input.js +3 -2
  37. package/lib/ui/list.js +17 -12
  38. package/package.json +8 -9
@@ -1,28 +1,27 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  var _react = _interopRequireDefault(require("react"));
5
4
  var _immutable = _interopRequireDefault(require("immutable"));
6
5
  var _testUtils = require("testUtils");
7
6
  var _signed_in_confirmation = _interopRequireDefault(require("../../core/signed_in_confirmation"));
8
7
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), c(GeneratorFunctionPrototype, u, GeneratorFunction.displayName = "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, catch: function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
8
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
9
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
10
10
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
11
11
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
12
12
  var lock = _immutable.default.fromJS({
13
13
  id: '__lock-id__'
14
14
  });
15
15
  describe('SignedInConfirmation', function () {
16
- it('renders correctly', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17
- return _regeneratorRuntime().wrap(function _callee$(_context) {
18
- while (1) switch (_context.prev = _context.next) {
16
+ it('renders correctly', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
17
+ return _regenerator().w(function (_context) {
18
+ while (1) switch (_context.n) {
19
19
  case 0:
20
20
  (0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_signed_in_confirmation.default, {
21
21
  lock: lock
22
22
  })).toMatchSnapshot();
23
23
  case 1:
24
- case "end":
25
- return _context.stop();
24
+ return _context.a(2);
26
25
  }
27
26
  }, _callee);
28
27
  })));
@@ -1,15 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _web_api = _interopRequireDefault(require("../../core/web_api"));
4
+ var _testUtils = require("../testUtils");
4
5
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
5
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
6
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
10
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
6
  describe('Auth0WebApi', function () {
12
7
  var originalWindow;
8
+ var originalLocation;
13
9
  var LOCK_ID = 'lock-id';
14
10
  var CLIENT_ID = 'client-id';
15
11
  var DEFAULT_DOMAIN = 'test.com';
@@ -18,17 +14,16 @@ describe('Auth0WebApi', function () {
18
14
  };
19
15
  beforeEach(function () {
20
16
  originalWindow = window.window;
17
+ originalLocation = window.location;
21
18
  });
22
19
  afterEach(function () {
23
20
  window.window = originalWindow;
21
+ delete window.location;
22
+ window.location = originalLocation;
24
23
  });
25
24
  describe('setupClient', function () {
26
25
  it('sets the correct options when is on the hosted login page', function () {
27
- delete window.location;
28
- window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
29
- host: DEFAULT_DOMAIN,
30
- search: ''
31
- });
26
+ (0, _testUtils.setURL)("https://".concat(DEFAULT_DOMAIN, "/"));
32
27
  _web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {
33
28
  redirect: true
34
29
  });
@@ -41,40 +36,24 @@ describe('Auth0WebApi', function () {
41
36
  }));
42
37
  });
43
38
  it('sets redirect: true when on the same origin as the specified domain', function () {
44
- delete window.location;
45
- window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
46
- host: DEFAULT_DOMAIN,
47
- search: ''
48
- });
39
+ (0, _testUtils.setURL)("https://".concat(DEFAULT_DOMAIN, "/"));
49
40
  _web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
50
41
  expect(client().authOpt.popup).toBe(false);
51
42
  });
52
43
  it('sets redirect: false when on a different origin as the specified domain', function () {
53
- delete window.location;
54
- window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
55
- host: 'test-other.com',
56
- search: ''
57
- });
44
+ (0, _testUtils.setURL)('https://test-other.com/');
58
45
  _web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
59
46
  expect(client().authOpt.popup).toBe(true);
60
47
  });
61
48
  it('forces popup and sso mode for cordova, only when not running in the hosted environment', function () {
62
- delete window.location;
63
- window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
64
- host: DEFAULT_DOMAIN,
65
- search: ''
66
- });
49
+ (0, _testUtils.setURL)("https://".concat(DEFAULT_DOMAIN, "/"));
67
50
  window.cordova = true;
68
51
  _web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
69
52
  expect(client().authOpt.popup).toBe(false);
70
53
  expect(client().authOpt.sso).toBeUndefined();
71
54
  });
72
55
  it('forces popup and sso mode for electron, only when not running in the hosted environment', function () {
73
- delete window.location;
74
- window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
75
- host: DEFAULT_DOMAIN,
76
- search: ''
77
- });
56
+ (0, _testUtils.setURL)("https://".concat(DEFAULT_DOMAIN, "/"));
78
57
  window.electron = true;
79
58
  _web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
80
59
  expect(client().authOpt.popup).toBe(false);
@@ -56,8 +56,11 @@ describe('i18n', function () {
56
56
  }
57
57
  });
58
58
  var html = i18n.html(m, 'test');
59
- expect(html.props.dangerouslySetInnerHTML.__html).not.toMatch(/javascript:alert/);
60
- expect(html.props.dangerouslySetInnerHTML.__html).toEqual('<img href="1" src="1">');
59
+ var sanitized = html.props.dangerouslySetInnerHTML.__html;
60
+ expect(sanitized).not.toMatch(/javascript:alert/);
61
+ expect(sanitized).toMatch(/src="1"/);
62
+ expect(sanitized).toMatch(/href="1"/);
63
+ expect(sanitized).toMatch(/<img[^>]*>/);
61
64
  });
62
65
  it('should allow target=_blank with noopener noreferrer attributes', function () {
63
66
  (0, _sanitizer.initSanitizer)();
@@ -61,11 +61,37 @@ var extractPropsFromWrapper = exports.extractPropsFromWrapper = function extract
61
61
  };
62
62
 
63
63
  // Newer (> Jest v22) versions don't allow modification of location.href
64
- // but can use `jsdom.reconfigure` when `jsdom` is exposed globally.
65
- // https://www.npmjs.com/package/jest-environment-jsdom-global
64
+ // Try jsdom.reconfigure() first (via custom environment), then fall back to property mocking
66
65
  var setURL = exports.setURL = function setURL(url) {
67
- jsdom.reconfigure({
68
- url: url
66
+ // Approach 1: Use jsdom.reconfigure() if available (cleanest)
67
+ if (global.jsdom && typeof global.jsdom.reconfigure === 'function') {
68
+ global.jsdom.reconfigure({
69
+ url: url
70
+ });
71
+ return;
72
+ }
73
+
74
+ // Approach 2: Fallback - Mock location properties with Object.defineProperty
75
+ var parsedUrl = new URL(url);
76
+ delete window.location;
77
+ Object.defineProperty(window, 'location', {
78
+ value: {
79
+ href: parsedUrl.href,
80
+ origin: parsedUrl.origin,
81
+ protocol: parsedUrl.protocol,
82
+ host: parsedUrl.host,
83
+ hostname: parsedUrl.hostname,
84
+ port: parsedUrl.port,
85
+ pathname: parsedUrl.pathname,
86
+ search: parsedUrl.search,
87
+ hash: parsedUrl.hash,
88
+ // Add toString for debugging
89
+ toString: function toString() {
90
+ return parsedUrl.href;
91
+ }
92
+ },
93
+ writable: true,
94
+ configurable: true
69
95
  });
70
96
  };
71
97
  var expectMockToMatch = exports.expectMockToMatch = function expectMockToMatch(_ref2, numberOfCalls) {
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  var _react = _interopRequireDefault(require("react"));
5
4
  var _immutable = _interopRequireDefault(require("immutable"));
6
5
  var _testUtils = require("testUtils");
7
6
  var _confirmation_pane = _interopRequireDefault(require("../../../ui/box/confirmation_pane"));
8
7
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), c(GeneratorFunctionPrototype, u, GeneratorFunction.displayName = "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, catch: function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
8
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
9
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
10
10
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
11
11
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
12
12
  var defaultProps = {
@@ -19,14 +19,13 @@ var defaultProps = {
19
19
  svg: /*#__PURE__*/_react.default.createElement("svg", null, "svg")
20
20
  };
21
21
  describe('ConfirmationPane', function () {
22
- it('renders correctly', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
23
- return _regeneratorRuntime().wrap(function _callee$(_context) {
24
- while (1) switch (_context.prev = _context.next) {
22
+ it('renders correctly', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
23
+ return _regenerator().w(function (_context) {
24
+ while (1) switch (_context.n) {
25
25
  case 0:
26
26
  (0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_confirmation_pane.default, defaultProps)).toMatchSnapshot();
27
27
  case 1:
28
- case "end":
29
- return _context.stop();
28
+ return _context.a(2);
30
29
  }
31
30
  }, _callee);
32
31
  })));
@@ -13,6 +13,11 @@ jest.mock('store/index', function () {
13
13
  jest.mock('ui/box/chrome', function () {
14
14
  return (0, _testUtils.mockComponent)('chrome');
15
15
  });
16
+ jest.mock('connection/database/index', function () {
17
+ return {
18
+ databaseUsernameValue: jest.fn()
19
+ };
20
+ });
16
21
  var mockEvent = {
17
22
  preventDefault: function preventDefault() {}
18
23
  };
@@ -77,14 +82,23 @@ describe('Container', function () {
77
82
  describe('with a custom `connectionResolver`', function () {
78
83
  var connectionResolverMock;
79
84
  var setResolvedConnectionMock;
85
+ var databaseUsernameValueMock;
80
86
  beforeEach(function () {
81
87
  connectionResolverMock = jest.fn();
82
88
  setResolvedConnectionMock = jest.fn();
89
+ databaseUsernameValueMock = require('connection/database/index').databaseUsernameValue;
90
+
91
+ // Set default return value for databaseUsernameValue mock
92
+ databaseUsernameValueMock.mockReturnValue('peter_picked@pickledpepper.com');
83
93
  require('core/index').connectionResolver = function () {
84
94
  return connectionResolverMock;
85
95
  };
86
96
  require('core/index').setResolvedConnection = setResolvedConnectionMock;
87
97
  });
98
+ afterEach(function () {
99
+ // Reset mock between tests and restore default return value
100
+ databaseUsernameValueMock.mockReset().mockReturnValue('peter_picked@pickledpepper.com');
101
+ });
88
102
  it('calls `connectionResolver` onSubmit', function () {
89
103
  var c = getContainer();
90
104
  c.handleSubmit(mockEvent);
@@ -111,6 +125,48 @@ describe('Container', function () {
111
125
  expect(mock.calls.length).toBe(1);
112
126
  expect(mock.calls[0]).toMatchSnapshot();
113
127
  });
128
+ it('prioritizes email over username on signUp screen', function () {
129
+ databaseUsernameValueMock.mockReturnValue('test@example.com');
130
+ var c = getContainer({
131
+ screenName: 'main.signUp'
132
+ });
133
+ c.handleSubmit(mockEvent);
134
+
135
+ // Should call databaseUsernameValue with emailFirst: true
136
+ expect(databaseUsernameValueMock).toHaveBeenCalledWith(expect.anything(), {
137
+ emailFirst: true
138
+ });
139
+
140
+ // connectionResolver should receive the email value
141
+ var _connectionResolverMo2 = connectionResolverMock,
142
+ mock = _connectionResolverMo2.mock;
143
+ expect(mock.calls[0][0]).toBe('test@example.com');
144
+ });
145
+ it('prioritizes username over email on login screen', function () {
146
+ databaseUsernameValueMock.mockReturnValue('testuser');
147
+ var c = getContainer({
148
+ screenName: 'main.login'
149
+ });
150
+ c.handleSubmit(mockEvent);
151
+
152
+ // Should call databaseUsernameValue with empty options (default behavior)
153
+ expect(databaseUsernameValueMock).toHaveBeenCalledWith(expect.anything(), {});
154
+
155
+ // connectionResolver should receive the username value
156
+ var _connectionResolverMo3 = connectionResolverMock,
157
+ mock = _connectionResolverMo3.mock;
158
+ expect(mock.calls[0][0]).toBe('testuser');
159
+ });
160
+ it('uses default behavior when screenName is not main.signUp', function () {
161
+ databaseUsernameValueMock.mockReturnValue('defaultvalue');
162
+ var c = getContainer({
163
+ screenName: 'forgotPassword'
164
+ });
165
+ c.handleSubmit(mockEvent);
166
+
167
+ // Should call databaseUsernameValue with empty options (default behavior)
168
+ expect(databaseUsernameValueMock).toHaveBeenCalledWith(expect.anything(), {});
169
+ });
114
170
  });
115
171
  describe('when suppressSubmitOverlay is true', function () {
116
172
  it('it does not display the overlay when submitting', function () {
@@ -169,5 +169,5 @@ function trimAuthParams() {
169
169
  return p;
170
170
  }
171
171
  function getVersion() {
172
- return "14.2.0";
172
+ return "14.2.2";
173
173
  }
package/lib/i18n.js CHANGED
@@ -90,7 +90,7 @@ function assertLanguage(m, language, base) {
90
90
  function syncLang(m, language, _cb) {
91
91
  (0, _cdn_utils.load)({
92
92
  method: 'registerLanguageDictionary',
93
- url: "".concat(l.languageBaseUrl(m), "/js/lock/").concat("14.2.0", "/").concat(language, ".js"),
93
+ url: "".concat(l.languageBaseUrl(m), "/js/lock/").concat("14.2.2", "/").concat(language, ".js"),
94
94
  check: function check(str) {
95
95
  return str && str === language;
96
96
  },
package/lib/lock.js CHANGED
@@ -36,7 +36,7 @@ var Auth0Lock = exports.default = /*#__PURE__*/function (_Core) {
36
36
  _inherits(Auth0Lock, _Core);
37
37
  return _createClass(Auth0Lock);
38
38
  }(_core.default); // telemetry
39
- Auth0Lock.version = "14.2.0";
39
+ Auth0Lock.version = "14.2.2";
40
40
 
41
41
  // TODO: should we have different telemetry for classic/passwordless?
42
42
  // TODO: should we set telemetry info before each request?
@@ -36,4 +36,4 @@ var Auth0LockPasswordless = exports.default = /*#__PURE__*/function (_Core) {
36
36
  _inherits(Auth0LockPasswordless, _Core);
37
37
  return _createClass(Auth0LockPasswordless);
38
38
  }(_core.default);
39
- Auth0LockPasswordless.version = "14.2.0";
39
+ Auth0LockPasswordless.version = "14.2.2";
@@ -101,9 +101,12 @@ var SubmitTextSvg = function SubmitTextSvg() {
101
101
  }))));
102
102
  };
103
103
  var SubmitButton = /*#__PURE__*/function (_React$Component) {
104
- function SubmitButton() {
104
+ function SubmitButton(props) {
105
+ var _this;
105
106
  _classCallCheck(this, SubmitButton);
106
- return _callSuper(this, SubmitButton, arguments);
107
+ _this = _callSuper(this, SubmitButton, [props]);
108
+ _this.buttonRef = /*#__PURE__*/_react.default.createRef();
109
+ return _this;
107
110
  }
108
111
  _inherits(SubmitButton, _React$Component);
109
112
  return _createClass(SubmitButton, [{
@@ -132,7 +135,9 @@ var SubmitButton = /*#__PURE__*/function (_React$Component) {
132
135
  }, {
133
136
  key: "focus",
134
137
  value: function focus() {
135
- _reactDom.default.findDOMNode(this).focus();
138
+ if (this.buttonRef.current) {
139
+ this.buttonRef.current.focus();
140
+ }
136
141
  }
137
142
  }, {
138
143
  key: "render",
@@ -148,6 +153,7 @@ var SubmitButton = /*#__PURE__*/function (_React$Component) {
148
153
  className: "auth0-label-submit"
149
154
  }, label, /*#__PURE__*/_react.default.createElement(SubmitTextSvg, null)) : /*#__PURE__*/_react.default.createElement(SubmitSvg, null);
150
155
  return /*#__PURE__*/_react.default.createElement("button", {
156
+ ref: this.buttonRef,
151
157
  id: "".concat(l.id(model), "-submit"),
152
158
  className: "auth0-lock-submit",
153
159
  disabled: disabled,
@@ -180,15 +186,18 @@ var MESSAGE_ANIMATION_DURATION = 250;
180
186
  var AUXILIARY_ANIMATION_DURATION = 350;
181
187
  var Chrome = exports.default = /*#__PURE__*/function (_React$Component2) {
182
188
  function Chrome(props) {
183
- var _this;
189
+ var _this2;
184
190
  _classCallCheck(this, Chrome);
185
- _this = _callSuper(this, Chrome, [props]);
186
- _this.state = {
191
+ _this2 = _callSuper(this, Chrome, [props]);
192
+ _this2.state = {
187
193
  moving: false,
188
194
  reverse: false,
189
195
  headerHeight: 0
190
196
  };
191
- return _this;
197
+ _this2.screenRef = /*#__PURE__*/_react.default.createRef();
198
+ _this2.globalMessageRef = /*#__PURE__*/_react.default.createRef();
199
+ _this2.auxiliaryPaneRef = /*#__PURE__*/_react.default.createRef();
200
+ return _this2;
192
201
  }
193
202
 
194
203
  // eslint-disable-next-line react/no-deprecated
@@ -196,7 +205,7 @@ var Chrome = exports.default = /*#__PURE__*/function (_React$Component2) {
196
205
  return _createClass(Chrome, [{
197
206
  key: "UNSAFE_componentWillReceiveProps",
198
207
  value: function UNSAFE_componentWillReceiveProps(nextProps) {
199
- var _this2 = this;
208
+ var _this3 = this;
200
209
  var _this$props3 = this.props,
201
210
  auxiliaryPane = _this$props3.auxiliaryPane,
202
211
  showSubmitButton = _this$props3.showSubmitButton;
@@ -215,7 +224,7 @@ var Chrome = exports.default = /*#__PURE__*/function (_React$Component2) {
215
224
  if (auxiliaryPane && !nextProps.auxiliaryPane) {
216
225
  // TODO clear timeout
217
226
  setTimeout(function () {
218
- return _this2.setState({
227
+ return _this3.setState({
219
228
  moving: false
220
229
  });
221
230
  }, AUXILIARY_ANIMATION_DURATION + 50);
@@ -224,7 +233,7 @@ var Chrome = exports.default = /*#__PURE__*/function (_React$Component2) {
224
233
  }, {
225
234
  key: "componentDidUpdate",
226
235
  value: function componentDidUpdate(prevProps) {
227
- var _this3 = this;
236
+ var _this4 = this;
228
237
  var _this$props4 = this.props,
229
238
  autofocus = _this$props4.autofocus,
230
239
  auxiliaryPane = _this$props4.auxiliaryPane,
@@ -232,7 +241,7 @@ var Chrome = exports.default = /*#__PURE__*/function (_React$Component2) {
232
241
  screenName = _this$props4.screenName;
233
242
  if (!autofocus) return;
234
243
  if (auxiliaryPane && !prevProps.auxiliaryPane) {
235
- var input = this.findAutofocusInput(this.refs.auxiliary);
244
+ var input = this.findAutofocusInput(this.auxiliaryPaneRef.current);
236
245
  if (input) {
237
246
  // TODO clear timeout
238
247
  setTimeout(function () {
@@ -245,7 +254,7 @@ var Chrome = exports.default = /*#__PURE__*/function (_React$Component2) {
245
254
  if (this.auxiliaryPaneTriggerInput) {
246
255
  // TODO clear timeout
247
256
  setTimeout(function () {
248
- return _this3.auxiliaryPaneTriggerInput.focus();
257
+ return _this4.auxiliaryPaneTriggerInput.focus();
249
258
  }, AUXILIARY_ANIMATION_DURATION);
250
259
  }
251
260
  return;
@@ -304,12 +313,13 @@ var Chrome = exports.default = /*#__PURE__*/function (_React$Component2) {
304
313
  }, {
305
314
  key: "findAutofocusInput",
306
315
  value: function findAutofocusInput(ref) {
307
- return _reactDom.default.findDOMNode(ref || this.refs.screen).querySelector('input');
316
+ var node = ref || this.screenRef.current;
317
+ return node.querySelector('input');
308
318
  }
309
319
  }, {
310
320
  key: "focusError",
311
321
  value: function focusError() {
312
- var node = _reactDom.default.findDOMNode(this.refs.screen);
322
+ var node = this.screenRef.current;
313
323
  // TODO: make the error input selector configurable via props.
314
324
  var error = node.querySelector('.auth0-lock-error input');
315
325
  if (error) {
@@ -319,7 +329,7 @@ var Chrome = exports.default = /*#__PURE__*/function (_React$Component2) {
319
329
  }, {
320
330
  key: "render",
321
331
  value: function render() {
322
- var _this4 = this;
332
+ var _this5 = this;
323
333
  var _this$props5 = this.props,
324
334
  avatar = _this$props5.avatar,
325
335
  auxiliaryPane = _this$props5.auxiliaryPane,
@@ -411,13 +421,16 @@ var Chrome = exports.default = /*#__PURE__*/function (_React$Component2) {
411
421
  marginTop: this.state.headerHeight
412
422
  }
413
423
  }, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.TransitionGroup, null, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
424
+ nodeRef: this.globalMessageRef,
414
425
  classNames: "global-message",
415
426
  timeout: MESSAGE_ANIMATION_DURATION
416
- }, /*#__PURE__*/_react.default.createElement("div", null, globalSuccess, globalError, globalInfo))), /*#__PURE__*/_react.default.createElement("div", {
427
+ }, /*#__PURE__*/_react.default.createElement("div", {
428
+ ref: this.globalMessageRef
429
+ }, globalSuccess, globalError, globalInfo))), /*#__PURE__*/_react.default.createElement("div", {
417
430
  style: {
418
431
  position: 'relative'
419
432
  },
420
- ref: "screen"
433
+ ref: this.screenRef
421
434
  }, /*#__PURE__*/_react.default.createElement(_multisize_slide.default, {
422
435
  delay: 550,
423
436
  onDidAppear: this.onDidAppear.bind(this),
@@ -449,14 +462,16 @@ var Chrome = exports.default = /*#__PURE__*/function (_React$Component2) {
449
462
  contentProps: contentProps,
450
463
  label: submitButtonLabel,
451
464
  ref: function ref(el) {
452
- return _this4.submitButton = el;
465
+ return _this5.submitButton = el;
453
466
  },
454
467
  display: shouldShowSubmitButton ? 'block' : 'none'
455
468
  }), auxiliaryPane && /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.TransitionGroup, null, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
456
- ref: "auxiliary",
469
+ nodeRef: this.auxiliaryPaneRef,
457
470
  classNames: "slide",
458
471
  timeout: AUXILIARY_ANIMATION_DURATION
459
- }, auxiliaryPane))));
472
+ }, /*#__PURE__*/_react.default.cloneElement(auxiliaryPane, {
473
+ ref: this.auxiliaryPaneRef
474
+ })))));
460
475
  }
461
476
  }, {
462
477
  key: "focusSubmit",