auth0-lock 14.2.1 → 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.
- package/.github/workflows/snyk.yml +1 -1
- package/.github/workflows/test.yml +2 -2
- package/.version +1 -1
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/lib/__tests__/connection/database/login_pane.js +6 -7
- package/lib/__tests__/connection/database/password_reset_confirmation.js +6 -7
- package/lib/__tests__/connection/database/signed_up_confirmation.js +6 -7
- package/lib/__tests__/connection/enterprise/quick_auth_screen.js +7 -8
- package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +6 -7
- package/lib/__tests__/core/signed_in_confirmation.js +6 -7
- package/lib/__tests__/i18n.js +5 -2
- package/lib/__tests__/ui/box/confirmation_pane.js +6 -7
- package/lib/core/web_api/helper.js +1 -1
- package/lib/i18n.js +1 -1
- package/lib/lock.js +1 -1
- package/lib/passwordless.js +1 -1
- package/lib/ui/box/chrome.js +35 -20
- package/lib/ui/box/container.js +3 -2
- package/lib/ui/box/header.js +11 -7
- package/lib/ui/box/multisize_slide.js +27 -18
- package/lib/ui/input/captcha_input.js +2 -1
- package/lib/ui/input/email_input.js +2 -1
- package/lib/ui/input/mfa_code_input.js +3 -2
- package/lib/ui/input/password_input.js +3 -2
- package/lib/ui/input/phone_number_input.js +4 -3
- package/lib/ui/input/text_input.js +2 -1
- package/lib/ui/input/username_input.js +2 -1
- package/lib/ui/input/vcode_input.js +3 -2
- package/lib/ui/list.js +17 -12
- package/package.json +3 -3
package/lib/__tests__/i18n.js
CHANGED
|
@@ -56,8 +56,11 @@ describe('i18n', function () {
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
var html = i18n.html(m, 'test');
|
|
59
|
-
|
|
60
|
-
expect(
|
|
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)();
|
|
@@ -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
|
|
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__*/
|
|
23
|
-
return
|
|
24
|
-
while (1) switch (_context.
|
|
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
|
-
|
|
29
|
-
return _context.stop();
|
|
28
|
+
return _context.a(2);
|
|
30
29
|
}
|
|
31
30
|
}, _callee);
|
|
32
31
|
})));
|
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.
|
|
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.
|
|
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?
|
package/lib/passwordless.js
CHANGED
|
@@ -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.
|
|
39
|
+
Auth0LockPasswordless.version = "14.2.2";
|
package/lib/ui/box/chrome.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
189
|
+
var _this2;
|
|
184
190
|
_classCallCheck(this, Chrome);
|
|
185
|
-
|
|
186
|
-
|
|
191
|
+
_this2 = _callSuper(this, Chrome, [props]);
|
|
192
|
+
_this2.state = {
|
|
187
193
|
moving: false,
|
|
188
194
|
reverse: false,
|
|
189
195
|
headerHeight: 0
|
|
190
196
|
};
|
|
191
|
-
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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
|
-
|
|
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 =
|
|
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
|
|
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",
|
|
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:
|
|
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
|
|
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
|
-
|
|
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",
|
package/lib/ui/box/container.js
CHANGED
|
@@ -104,6 +104,7 @@ var Container = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
104
104
|
_this.state = {
|
|
105
105
|
isOpen: false
|
|
106
106
|
};
|
|
107
|
+
_this.chromeRef = /*#__PURE__*/_react.default.createRef();
|
|
107
108
|
return _this;
|
|
108
109
|
}
|
|
109
110
|
_inherits(Container, _React$Component);
|
|
@@ -176,7 +177,7 @@ var Container = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
176
177
|
if (submitHandler) {
|
|
177
178
|
setTimeout(function () {
|
|
178
179
|
if (!_this3.props.isSubmitting) {
|
|
179
|
-
_this3.
|
|
180
|
+
_this3.chromeRef.current.focusError();
|
|
180
181
|
}
|
|
181
182
|
}, 17);
|
|
182
183
|
submitHandler();
|
|
@@ -307,7 +308,7 @@ var Container = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
307
308
|
logo: logo,
|
|
308
309
|
screenName: screenName,
|
|
309
310
|
primaryColor: primaryColor,
|
|
310
|
-
ref:
|
|
311
|
+
ref: this.chromeRef,
|
|
311
312
|
showSubmitButton: !!submitHandler,
|
|
312
313
|
submitButtonLabel: submitButtonLabel,
|
|
313
314
|
success: success,
|
package/lib/ui/box/header.js
CHANGED
|
@@ -24,15 +24,18 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
|
|
|
24
24
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
25
25
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
26
26
|
var Header = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
27
|
-
function Header() {
|
|
27
|
+
function Header(props) {
|
|
28
|
+
var _this;
|
|
28
29
|
_classCallCheck(this, Header);
|
|
29
|
-
|
|
30
|
+
_this = _callSuper(this, Header, [props]);
|
|
31
|
+
_this.headerRef = /*#__PURE__*/_react.default.createRef();
|
|
32
|
+
return _this;
|
|
30
33
|
}
|
|
31
34
|
_inherits(Header, _React$Component);
|
|
32
35
|
return _createClass(Header, [{
|
|
33
36
|
key: "getDOMNode",
|
|
34
37
|
value: function getDOMNode() {
|
|
35
|
-
return
|
|
38
|
+
return this.headerRef.current;
|
|
36
39
|
}
|
|
37
40
|
}, {
|
|
38
41
|
key: "render",
|
|
@@ -45,6 +48,7 @@ var Header = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
45
48
|
name = _this$props.name,
|
|
46
49
|
title = _this$props.title;
|
|
47
50
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
51
|
+
ref: this.headerRef,
|
|
48
52
|
className: "auth0-lock-header"
|
|
49
53
|
}, backHandler && /*#__PURE__*/_react.default.createElement(_button.BackButton, {
|
|
50
54
|
onClick: backHandler
|
|
@@ -67,19 +71,19 @@ Header.propTypes = {
|
|
|
67
71
|
};
|
|
68
72
|
var Welcome = /*#__PURE__*/function (_React$Component2) {
|
|
69
73
|
function Welcome() {
|
|
70
|
-
var
|
|
74
|
+
var _this2;
|
|
71
75
|
_classCallCheck(this, Welcome);
|
|
72
76
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
73
77
|
args[_key] = arguments[_key];
|
|
74
78
|
}
|
|
75
|
-
|
|
79
|
+
_this2 = _callSuper(this, Welcome, [].concat(args));
|
|
76
80
|
// Cause a reflow when the image is loaded to fix an issue with the Lock content sometimes
|
|
77
81
|
// not rendering in a popup on first load.
|
|
78
82
|
// https://github.com/auth0/lock/issues/1942
|
|
79
|
-
_defineProperty(
|
|
83
|
+
_defineProperty(_this2, "onImageLoad", function () {
|
|
80
84
|
return document.querySelector('.auth0-lock').style.fontSize = '1rem';
|
|
81
85
|
});
|
|
82
|
-
return
|
|
86
|
+
return _this2;
|
|
83
87
|
}
|
|
84
88
|
_inherits(Welcome, _React$Component2);
|
|
85
89
|
return _createClass(Welcome, [{
|
|
@@ -33,6 +33,7 @@ var Slider = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
33
33
|
current: props.children
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
_this.childRefs = {};
|
|
36
37
|
return _this;
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -73,11 +74,12 @@ var Slider = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
73
74
|
current = _this$state$children.current,
|
|
74
75
|
prev = _this$state$children.prev;
|
|
75
76
|
var reverse = this.props.reverse;
|
|
76
|
-
var currentComponent = this.
|
|
77
|
-
var prevComponent = this.
|
|
77
|
+
var currentComponent = this.childRefs[current.key] && this.childRefs[current.key].current;
|
|
78
|
+
var prevComponent = this.childRefs[prev.key] && this.childRefs[prev.key].current;
|
|
78
79
|
var transition = function transition(component, className, delay) {
|
|
79
|
-
//
|
|
80
|
-
var node =
|
|
80
|
+
// Get the DOM node directly from the component's node property
|
|
81
|
+
var node = component === null || component === void 0 ? void 0 : component.node;
|
|
82
|
+
if (!node) return;
|
|
81
83
|
var activeClassName = "".concat(className, "-active");
|
|
82
84
|
_CSSCore.default.addClass(node, className);
|
|
83
85
|
setTimeout(function () {
|
|
@@ -120,13 +122,18 @@ var Slider = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
120
122
|
}, {
|
|
121
123
|
key: "render",
|
|
122
124
|
value: function render() {
|
|
125
|
+
var _this3 = this;
|
|
123
126
|
var _this$state$children2 = this.state.children,
|
|
124
127
|
current = _this$state$children2.current,
|
|
125
128
|
prev = _this$state$children2.prev;
|
|
126
129
|
var children = prev ? [current, prev] : [current];
|
|
127
130
|
var childrenToRender = children.map(function (child) {
|
|
131
|
+
// Create a ref for this child if it doesn't exist
|
|
132
|
+
if (!_this3.childRefs[child.key]) {
|
|
133
|
+
_this3.childRefs[child.key] = /*#__PURE__*/_react.default.createRef();
|
|
134
|
+
}
|
|
128
135
|
return /*#__PURE__*/_react.default.cloneElement(/*#__PURE__*/_react.default.createElement(Child, {}, child), {
|
|
129
|
-
ref: child.key,
|
|
136
|
+
ref: _this3.childRefs[child.key],
|
|
130
137
|
key: child.key
|
|
131
138
|
});
|
|
132
139
|
});
|
|
@@ -153,21 +160,22 @@ Slider.defaultProps = {
|
|
|
153
160
|
};
|
|
154
161
|
var Child = /*#__PURE__*/function (_React$Component2) {
|
|
155
162
|
function Child(props) {
|
|
156
|
-
var
|
|
163
|
+
var _this4;
|
|
157
164
|
_classCallCheck(this, Child);
|
|
158
|
-
|
|
159
|
-
_defineProperty(
|
|
160
|
-
|
|
165
|
+
_this4 = _callSuper(this, Child, [props]);
|
|
166
|
+
_defineProperty(_this4, "node", void 0);
|
|
167
|
+
_this4.state = {
|
|
161
168
|
height: '',
|
|
162
169
|
originalHeight: '',
|
|
163
170
|
show: true
|
|
164
171
|
};
|
|
165
|
-
return
|
|
172
|
+
return _this4;
|
|
166
173
|
}
|
|
167
174
|
_inherits(Child, _React$Component2);
|
|
168
175
|
return _createClass(Child, [{
|
|
169
176
|
key: "componentWillSlideIn",
|
|
170
177
|
value: function componentWillSlideIn(slide) {
|
|
178
|
+
if (!this.node) return;
|
|
171
179
|
this.setState({
|
|
172
180
|
height: slide.height,
|
|
173
181
|
originalHeight: parseInt(window.getComputedStyle(this.node, null).height, 10),
|
|
@@ -177,7 +185,7 @@ var Child = /*#__PURE__*/function (_React$Component2) {
|
|
|
177
185
|
}, {
|
|
178
186
|
key: "componentDidSlideIn",
|
|
179
187
|
value: function componentDidSlideIn(cb) {
|
|
180
|
-
var
|
|
188
|
+
var _this5 = this;
|
|
181
189
|
var _this$state = this.state,
|
|
182
190
|
height = _this$state.height,
|
|
183
191
|
originalHeight = _this$state.originalHeight;
|
|
@@ -200,20 +208,20 @@ var Child = /*#__PURE__*/function (_React$Component2) {
|
|
|
200
208
|
// TODO: rAF
|
|
201
209
|
this.t = setInterval(function () {
|
|
202
210
|
if (count < frames - 1) {
|
|
203
|
-
|
|
211
|
+
_this5.setState({
|
|
204
212
|
height: current,
|
|
205
213
|
animating: true
|
|
206
214
|
});
|
|
207
215
|
current += dh;
|
|
208
216
|
count++;
|
|
209
217
|
} else {
|
|
210
|
-
clearInterval(
|
|
211
|
-
delete
|
|
212
|
-
|
|
218
|
+
clearInterval(_this5.t);
|
|
219
|
+
delete _this5.t;
|
|
220
|
+
_this5.setState({
|
|
213
221
|
height: '',
|
|
214
222
|
show: true
|
|
215
223
|
});
|
|
216
|
-
|
|
224
|
+
_this5.cb();
|
|
217
225
|
}
|
|
218
226
|
}, 17);
|
|
219
227
|
}
|
|
@@ -221,6 +229,7 @@ var Child = /*#__PURE__*/function (_React$Component2) {
|
|
|
221
229
|
}, {
|
|
222
230
|
key: "componentWillSlideOut",
|
|
223
231
|
value: function componentWillSlideOut(cb) {
|
|
232
|
+
if (!this.node) return;
|
|
224
233
|
var size = window.getComputedStyle(this.node, null).height;
|
|
225
234
|
cb({
|
|
226
235
|
height: parseInt(size, 10),
|
|
@@ -238,14 +247,14 @@ var Child = /*#__PURE__*/function (_React$Component2) {
|
|
|
238
247
|
}, {
|
|
239
248
|
key: "render",
|
|
240
249
|
value: function render() {
|
|
241
|
-
var
|
|
250
|
+
var _this6 = this;
|
|
242
251
|
var children = this.props.children;
|
|
243
252
|
var _this$state2 = this.state,
|
|
244
253
|
height = _this$state2.height,
|
|
245
254
|
show = _this$state2.show;
|
|
246
255
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
247
256
|
ref: function ref(node) {
|
|
248
|
-
return
|
|
257
|
+
return _this6.node = node;
|
|
249
258
|
},
|
|
250
259
|
style: height ? {
|
|
251
260
|
height: height + 'px'
|
|
@@ -96,6 +96,7 @@ var CaptchaInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
98
|
_this.state = {};
|
|
99
|
+
_this.inputRef = /*#__PURE__*/_react.default.createRef();
|
|
99
100
|
return _this;
|
|
100
101
|
}
|
|
101
102
|
_inherits(CaptchaInput, _React$Component);
|
|
@@ -142,7 +143,7 @@ var CaptchaInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
142
143
|
icon: InputIconSvg
|
|
143
144
|
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
144
145
|
id: "".concat(lockId, "-captcha"),
|
|
145
|
-
ref:
|
|
146
|
+
ref: this.inputRef,
|
|
146
147
|
type: "text",
|
|
147
148
|
inputMode: "text",
|
|
148
149
|
name: "captcha",
|
|
@@ -57,6 +57,7 @@ var EmailInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
57
57
|
_classCallCheck(this, EmailInput);
|
|
58
58
|
_this = _callSuper(this, EmailInput, [props]);
|
|
59
59
|
_this.state = {};
|
|
60
|
+
_this.inputRef = /*#__PURE__*/_react.default.createRef();
|
|
60
61
|
return _this;
|
|
61
62
|
}
|
|
62
63
|
_inherits(EmailInput, _React$Component);
|
|
@@ -90,7 +91,7 @@ var EmailInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
90
91
|
icon: SVG
|
|
91
92
|
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
92
93
|
id: "".concat(lockId, "-email"),
|
|
93
|
-
ref:
|
|
94
|
+
ref: this.inputRef,
|
|
94
95
|
type: "email",
|
|
95
96
|
inputMode: "email",
|
|
96
97
|
name: "email",
|
|
@@ -33,13 +33,14 @@ var MFACodeInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
33
33
|
_classCallCheck(this, MFACodeInput);
|
|
34
34
|
_this = _callSuper(this, MFACodeInput, [props]);
|
|
35
35
|
_this.state = {};
|
|
36
|
+
_this.inputRef = /*#__PURE__*/_react.default.createRef();
|
|
36
37
|
return _this;
|
|
37
38
|
}
|
|
38
39
|
_inherits(MFACodeInput, _React$Component);
|
|
39
40
|
return _createClass(MFACodeInput, [{
|
|
40
41
|
key: "focus",
|
|
41
42
|
value: function focus() {
|
|
42
|
-
this.
|
|
43
|
+
this.inputRef.current && this.inputRef.current.focus();
|
|
43
44
|
}
|
|
44
45
|
}, {
|
|
45
46
|
key: "hasFocus",
|
|
@@ -65,7 +66,7 @@ var MFACodeInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
65
66
|
icon: _password_input.IconSvg
|
|
66
67
|
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
67
68
|
id: "".concat(lockId, "-mfa_code"),
|
|
68
|
-
ref:
|
|
69
|
+
ref: this.inputRef,
|
|
69
70
|
type: "text",
|
|
70
71
|
name: "mfa_code",
|
|
71
72
|
className: "auth0-lock-input",
|
|
@@ -56,13 +56,14 @@ var PasswordInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
56
56
|
_classCallCheck(this, PasswordInput);
|
|
57
57
|
_this = _callSuper(this, PasswordInput, [props]);
|
|
58
58
|
_this.state = {};
|
|
59
|
+
_this.inputRef = /*#__PURE__*/_react.default.createRef();
|
|
59
60
|
return _this;
|
|
60
61
|
}
|
|
61
62
|
_inherits(PasswordInput, _React$Component);
|
|
62
63
|
return _createClass(PasswordInput, [{
|
|
63
64
|
key: "focus",
|
|
64
65
|
value: function focus() {
|
|
65
|
-
this.
|
|
66
|
+
this.inputRef.current && this.inputRef.current.focus();
|
|
66
67
|
}
|
|
67
68
|
}, {
|
|
68
69
|
key: "hasFocus",
|
|
@@ -100,7 +101,7 @@ var PasswordInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
100
101
|
name: "password",
|
|
101
102
|
icon: IconSvg
|
|
102
103
|
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
103
|
-
ref:
|
|
104
|
+
ref: this.inputRef,
|
|
104
105
|
type: showPassword ? 'text' : 'password',
|
|
105
106
|
id: "".concat(l.id(lock), "-password"),
|
|
106
107
|
name: "password",
|
|
@@ -57,6 +57,7 @@ var PhoneNumberInput = exports.default = /*#__PURE__*/function (_React$Component
|
|
|
57
57
|
_classCallCheck(this, PhoneNumberInput);
|
|
58
58
|
_this = _callSuper(this, PhoneNumberInput, [props]);
|
|
59
59
|
_this.state = {};
|
|
60
|
+
_this.inputRef = /*#__PURE__*/_react.default.createRef();
|
|
60
61
|
return _this;
|
|
61
62
|
}
|
|
62
63
|
_inherits(PhoneNumberInput, _React$Component);
|
|
@@ -75,7 +76,7 @@ var PhoneNumberInput = exports.default = /*#__PURE__*/function (_React$Component
|
|
|
75
76
|
name: "phone-number",
|
|
76
77
|
icon: IconSvg
|
|
77
78
|
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
78
|
-
ref:
|
|
79
|
+
ref: this.inputRef,
|
|
79
80
|
type: "tel",
|
|
80
81
|
name: "phoneNumber",
|
|
81
82
|
className: "auth0-lock-input auth0-lock-input-number",
|
|
@@ -92,8 +93,8 @@ var PhoneNumberInput = exports.default = /*#__PURE__*/function (_React$Component
|
|
|
92
93
|
}, {
|
|
93
94
|
key: "focus",
|
|
94
95
|
value: function focus() {
|
|
95
|
-
if (!this.
|
|
96
|
-
this.
|
|
96
|
+
if (!this.inputRef.current) return;
|
|
97
|
+
this.inputRef.current.focus();
|
|
97
98
|
this.handleFocus();
|
|
98
99
|
}
|
|
99
100
|
}, {
|
|
@@ -30,6 +30,7 @@ var TextInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
30
30
|
_classCallCheck(this, TextInput);
|
|
31
31
|
_this = _callSuper(this, TextInput, [props]);
|
|
32
32
|
_this.state = {};
|
|
33
|
+
_this.inputRef = /*#__PURE__*/_react.default.createRef();
|
|
33
34
|
return _this;
|
|
34
35
|
}
|
|
35
36
|
_inherits(TextInput, _React$Component);
|
|
@@ -68,7 +69,7 @@ var TextInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
68
69
|
icon: icon
|
|
69
70
|
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
70
71
|
id: "".concat(lockId, "-").concat(name),
|
|
71
|
-
ref:
|
|
72
|
+
ref: this.inputRef,
|
|
72
73
|
type: "text",
|
|
73
74
|
name: name,
|
|
74
75
|
className: "auth0-lock-input",
|