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.
- package/.github/workflows/codeql.yml +1 -1
- package/.github/workflows/npm-release.yml +1 -1
- package/.github/workflows/snyk.yml +2 -2
- package/.github/workflows/test.yml +3 -3
- package/.version +1 -1
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/customJsdomEnvironment.js +9 -0
- 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/index.js +2 -4
- package/lib/__tests__/core/signed_in_confirmation.js +6 -7
- package/lib/__tests__/core/web_api.js +10 -31
- package/lib/__tests__/i18n.js +5 -2
- package/lib/__tests__/testUtils.js +30 -4
- package/lib/__tests__/ui/box/confirmation_pane.js +6 -7
- package/lib/__tests__/ui/box/container.js +56 -0
- 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 +49 -39
- 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 +8 -9
package/lib/ui/box/container.js
CHANGED
|
@@ -11,6 +11,7 @@ var _button = require("./button");
|
|
|
11
11
|
var l = _interopRequireWildcard(require("../../core/index"));
|
|
12
12
|
var c = _interopRequireWildcard(require("../../field/index"));
|
|
13
13
|
var _index3 = require("../../store/index");
|
|
14
|
+
var _index4 = require("../../connection/database/index");
|
|
14
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
17
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -103,13 +104,16 @@ var Container = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
103
104
|
_this.state = {
|
|
104
105
|
isOpen: false
|
|
105
106
|
};
|
|
107
|
+
_this.chromeRef = /*#__PURE__*/_react.default.createRef();
|
|
106
108
|
return _this;
|
|
107
109
|
}
|
|
108
110
|
_inherits(Container, _React$Component);
|
|
109
111
|
return _createClass(Container, [{
|
|
110
112
|
key: "checkConnectionResolver",
|
|
111
113
|
value: function checkConnectionResolver(done) {
|
|
112
|
-
var
|
|
114
|
+
var _this$props = this.props,
|
|
115
|
+
contentProps = _this$props.contentProps,
|
|
116
|
+
screenName = _this$props.screenName;
|
|
113
117
|
var lock = contentProps.model;
|
|
114
118
|
var connectionResolver = l.connectionResolver(lock);
|
|
115
119
|
if (!connectionResolver) {
|
|
@@ -122,7 +126,13 @@ var Container = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
122
126
|
connections: connections,
|
|
123
127
|
id: id
|
|
124
128
|
};
|
|
125
|
-
|
|
129
|
+
|
|
130
|
+
// On signUp screen, use emailFirst option to prioritize email over username
|
|
131
|
+
// On login screen, use default behavior (username first)
|
|
132
|
+
var isSignUpScreen = screenName === 'main.signUp';
|
|
133
|
+
var userInputValue = (0, _index4.databaseUsernameValue)(lock, isSignUpScreen ? {
|
|
134
|
+
emailFirst: true
|
|
135
|
+
} : {});
|
|
126
136
|
connectionResolver(userInputValue, context, function (resolvedConnection) {
|
|
127
137
|
(0, _index3.swap)(_index3.updateEntity, 'lock', l.id(lock), function (m) {
|
|
128
138
|
return l.setResolvedConnection(m, resolvedConnection);
|
|
@@ -167,7 +177,7 @@ var Container = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
167
177
|
if (submitHandler) {
|
|
168
178
|
setTimeout(function () {
|
|
169
179
|
if (!_this3.props.isSubmitting) {
|
|
170
|
-
_this3.
|
|
180
|
+
_this3.chromeRef.current.focusError();
|
|
171
181
|
}
|
|
172
182
|
}, 17);
|
|
173
183
|
submitHandler();
|
|
@@ -177,9 +187,9 @@ var Container = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
177
187
|
}, {
|
|
178
188
|
key: "handleClose",
|
|
179
189
|
value: function handleClose() {
|
|
180
|
-
var _this$
|
|
181
|
-
closeHandler = _this$
|
|
182
|
-
isSubmitting = _this$
|
|
190
|
+
var _this$props2 = this.props,
|
|
191
|
+
closeHandler = _this$props2.closeHandler,
|
|
192
|
+
isSubmitting = _this$props2.isSubmitting;
|
|
183
193
|
if (!isSubmitting) {
|
|
184
194
|
closeHandler();
|
|
185
195
|
}
|
|
@@ -187,9 +197,9 @@ var Container = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
187
197
|
}, {
|
|
188
198
|
key: "handleEsc",
|
|
189
199
|
value: function handleEsc() {
|
|
190
|
-
var _this$
|
|
191
|
-
closeHandler = _this$
|
|
192
|
-
escHandler = _this$
|
|
200
|
+
var _this$props3 = this.props,
|
|
201
|
+
closeHandler = _this$props3.closeHandler,
|
|
202
|
+
escHandler = _this$props3.escHandler;
|
|
193
203
|
escHandler ? escHandler() : this.handleClose();
|
|
194
204
|
}
|
|
195
205
|
}, {
|
|
@@ -202,35 +212,35 @@ var Container = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
202
212
|
}, {
|
|
203
213
|
key: "render",
|
|
204
214
|
value: function render() {
|
|
205
|
-
var _this$
|
|
206
|
-
autofocus = _this$
|
|
207
|
-
avatar = _this$
|
|
208
|
-
auxiliaryPane = _this$
|
|
209
|
-
backHandler = _this$
|
|
210
|
-
badgeLink = _this$
|
|
211
|
-
closeHandler = _this$
|
|
212
|
-
contentComponent = _this$
|
|
213
|
-
contentProps = _this$
|
|
214
|
-
disableSubmitButton = _this$
|
|
215
|
-
disallowClose = _this$
|
|
216
|
-
error = _this$
|
|
217
|
-
info = _this$
|
|
218
|
-
isMobile = _this$
|
|
219
|
-
isModal = _this$
|
|
220
|
-
isSubmitting = _this$
|
|
221
|
-
logo = _this$
|
|
222
|
-
primaryColor = _this$
|
|
223
|
-
screenName = _this$
|
|
224
|
-
showBadge = _this$
|
|
225
|
-
submitButtonLabel = _this$
|
|
226
|
-
submitHandler = _this$
|
|
227
|
-
success = _this$
|
|
228
|
-
tabs = _this$
|
|
229
|
-
terms = _this$
|
|
230
|
-
title = _this$
|
|
231
|
-
classNames = _this$
|
|
232
|
-
scrollGlobalMessagesIntoView = _this$
|
|
233
|
-
suppressSubmitOverlay = _this$
|
|
215
|
+
var _this$props4 = this.props,
|
|
216
|
+
autofocus = _this$props4.autofocus,
|
|
217
|
+
avatar = _this$props4.avatar,
|
|
218
|
+
auxiliaryPane = _this$props4.auxiliaryPane,
|
|
219
|
+
backHandler = _this$props4.backHandler,
|
|
220
|
+
badgeLink = _this$props4.badgeLink,
|
|
221
|
+
closeHandler = _this$props4.closeHandler,
|
|
222
|
+
contentComponent = _this$props4.contentComponent,
|
|
223
|
+
contentProps = _this$props4.contentProps,
|
|
224
|
+
disableSubmitButton = _this$props4.disableSubmitButton,
|
|
225
|
+
disallowClose = _this$props4.disallowClose,
|
|
226
|
+
error = _this$props4.error,
|
|
227
|
+
info = _this$props4.info,
|
|
228
|
+
isMobile = _this$props4.isMobile,
|
|
229
|
+
isModal = _this$props4.isModal,
|
|
230
|
+
isSubmitting = _this$props4.isSubmitting,
|
|
231
|
+
logo = _this$props4.logo,
|
|
232
|
+
primaryColor = _this$props4.primaryColor,
|
|
233
|
+
screenName = _this$props4.screenName,
|
|
234
|
+
showBadge = _this$props4.showBadge,
|
|
235
|
+
submitButtonLabel = _this$props4.submitButtonLabel,
|
|
236
|
+
submitHandler = _this$props4.submitHandler,
|
|
237
|
+
success = _this$props4.success,
|
|
238
|
+
tabs = _this$props4.tabs,
|
|
239
|
+
terms = _this$props4.terms,
|
|
240
|
+
title = _this$props4.title,
|
|
241
|
+
classNames = _this$props4.classNames,
|
|
242
|
+
scrollGlobalMessagesIntoView = _this$props4.scrollGlobalMessagesIntoView,
|
|
243
|
+
suppressSubmitOverlay = _this$props4.suppressSubmitOverlay;
|
|
234
244
|
var badge = showBadge ? /*#__PURE__*/_react.default.createElement(BottomBadge, {
|
|
235
245
|
link: badgeLink
|
|
236
246
|
}) : null;
|
|
@@ -298,7 +308,7 @@ var Container = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
298
308
|
logo: logo,
|
|
299
309
|
screenName: screenName,
|
|
300
310
|
primaryColor: primaryColor,
|
|
301
|
-
ref:
|
|
311
|
+
ref: this.chromeRef,
|
|
302
312
|
showSubmitButton: !!submitHandler,
|
|
303
313
|
submitButtonLabel: submitButtonLabel,
|
|
304
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",
|
|
@@ -51,6 +51,7 @@ var UsernameInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
51
51
|
_classCallCheck(this, UsernameInput);
|
|
52
52
|
_this = _callSuper(this, UsernameInput, [props]);
|
|
53
53
|
_this.state = {};
|
|
54
|
+
_this.inputRef = /*#__PURE__*/_react.default.createRef();
|
|
54
55
|
return _this;
|
|
55
56
|
}
|
|
56
57
|
_inherits(UsernameInput, _React$Component);
|
|
@@ -83,7 +84,7 @@ var UsernameInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
83
84
|
name: "username",
|
|
84
85
|
icon: IconSvg
|
|
85
86
|
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
86
|
-
ref:
|
|
87
|
+
ref: this.inputRef,
|
|
87
88
|
type: "text",
|
|
88
89
|
name: "username",
|
|
89
90
|
className: "auth0-lock-input",
|
|
@@ -57,6 +57,7 @@ var VcodeInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
57
57
|
_classCallCheck(this, VcodeInput);
|
|
58
58
|
_this = _callSuper(this, VcodeInput, [props]);
|
|
59
59
|
_this.state = {};
|
|
60
|
+
_this.inputRef = /*#__PURE__*/_react.default.createRef();
|
|
60
61
|
return _this;
|
|
61
62
|
}
|
|
62
63
|
_inherits(VcodeInput, _React$Component);
|
|
@@ -69,7 +70,7 @@ var VcodeInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
69
70
|
// the input to be visible. Use a more robust solution (Placeholder should
|
|
70
71
|
// notify it children when they are being shown).
|
|
71
72
|
setTimeout(function () {
|
|
72
|
-
return _this2.
|
|
73
|
+
return _this2.inputRef.current && _this2.inputRef.current.focus();
|
|
73
74
|
}, 1200);
|
|
74
75
|
}
|
|
75
76
|
}
|
|
@@ -88,7 +89,7 @@ var VcodeInput = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
88
89
|
icon: IconSvg
|
|
89
90
|
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
90
91
|
id: "".concat(lockId, "-vcode"),
|
|
91
|
-
ref:
|
|
92
|
+
ref: this.inputRef,
|
|
92
93
|
type: "tel",
|
|
93
94
|
name: "vcode",
|
|
94
95
|
className: "auth0-lock-input auth0-lock-input-code",
|
package/lib/ui/list.js
CHANGED
|
@@ -136,24 +136,28 @@ var FiltrableList = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
136
136
|
}]);
|
|
137
137
|
}(_react.default.Component);
|
|
138
138
|
var List = /*#__PURE__*/function (_React$Component2) {
|
|
139
|
-
function List() {
|
|
139
|
+
function List(props) {
|
|
140
|
+
var _this3;
|
|
140
141
|
_classCallCheck(this, List);
|
|
141
|
-
|
|
142
|
+
_this3 = _callSuper(this, List, [props]);
|
|
143
|
+
_this3.highlightedRef = /*#__PURE__*/_react.default.createRef();
|
|
144
|
+
_this3.listRef = /*#__PURE__*/_react.default.createRef();
|
|
145
|
+
return _this3;
|
|
142
146
|
}
|
|
143
147
|
_inherits(List, _React$Component2);
|
|
144
148
|
return _createClass(List, [{
|
|
145
149
|
key: "componentDidUpdate",
|
|
146
150
|
value: function componentDidUpdate() {
|
|
147
|
-
var
|
|
151
|
+
var _this4 = this;
|
|
148
152
|
// Ensure that highlighted item is entirely visible
|
|
149
153
|
|
|
150
154
|
// NOTE: I've spent very little time on this. It works, but it
|
|
151
155
|
// surely can be more clearly.
|
|
152
156
|
|
|
153
|
-
var highlighted = this.
|
|
157
|
+
var highlighted = this.highlightedRef.current;
|
|
154
158
|
if (highlighted) {
|
|
155
|
-
var scrollableNode =
|
|
156
|
-
var highlightedNode =
|
|
159
|
+
var scrollableNode = this.listRef.current;
|
|
160
|
+
var highlightedNode = highlighted;
|
|
157
161
|
var relativeOffsetTop = highlightedNode.offsetTop - scrollableNode.scrollTop;
|
|
158
162
|
var scrollTopDelta = 0;
|
|
159
163
|
if (relativeOffsetTop + highlightedNode.offsetHeight > scrollableNode.clientHeight) {
|
|
@@ -166,7 +170,7 @@ var List = /*#__PURE__*/function (_React$Component2) {
|
|
|
166
170
|
scrollableNode.scrollTop += scrollTopDelta;
|
|
167
171
|
if (this.timeout) clearTimeout(this.timeout);
|
|
168
172
|
this.timeout = setTimeout(function () {
|
|
169
|
-
return
|
|
173
|
+
return _this4.preventHighlight = false;
|
|
170
174
|
}, 100);
|
|
171
175
|
}
|
|
172
176
|
}
|
|
@@ -187,25 +191,26 @@ var List = /*#__PURE__*/function (_React$Component2) {
|
|
|
187
191
|
}, {
|
|
188
192
|
key: "render",
|
|
189
193
|
value: function render() {
|
|
190
|
-
var
|
|
194
|
+
var _this5 = this;
|
|
191
195
|
var items = this.props.items.map(function (x) {
|
|
192
|
-
var highlighted = x ===
|
|
196
|
+
var highlighted = x === _this5.props.highlighted;
|
|
193
197
|
var props = {
|
|
194
198
|
highlighted: highlighted,
|
|
195
199
|
label: x.get('label'),
|
|
196
200
|
onClick: function onClick() {
|
|
197
|
-
return
|
|
201
|
+
return _this5.props.onClick(x);
|
|
198
202
|
},
|
|
199
203
|
onMouseMove: function onMouseMove() {
|
|
200
|
-
return
|
|
204
|
+
return _this5.mouseMoveHandler(x);
|
|
201
205
|
}
|
|
202
206
|
};
|
|
203
|
-
if (highlighted) props.ref =
|
|
207
|
+
if (highlighted) props.ref = _this5.highlightedRef;
|
|
204
208
|
return /*#__PURE__*/_react.default.createElement(Item, _extends({
|
|
205
209
|
key: x.get('label')
|
|
206
210
|
}, props));
|
|
207
211
|
});
|
|
208
212
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
213
|
+
ref: this.listRef,
|
|
209
214
|
className: "auth0-lock-list-code",
|
|
210
215
|
onMouseLeave: this.mouseLeaveHandler.bind(this)
|
|
211
216
|
}, /*#__PURE__*/_react.default.createElement("ul", null, items));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth0-lock",
|
|
3
|
-
"version": "14.2.
|
|
3
|
+
"version": "14.2.2",
|
|
4
4
|
"description": "Auth0 Lock",
|
|
5
5
|
"author": "Auth0 <support@auth0.com> (http://auth0.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"i18n:validate": "node -r esm scripts/lang-audit.js"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@auth0/component-cdn-uploader": "^2.
|
|
43
|
+
"@auth0/component-cdn-uploader": "^2.4.2",
|
|
44
44
|
"@babel/core": "^7.0.0",
|
|
45
45
|
"@babel/eslint-parser": "^7.22.9",
|
|
46
46
|
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"chalk": "^4.1.2",
|
|
74
74
|
"core-js": "^3.26.1",
|
|
75
75
|
"cross-env": "^7.0.3",
|
|
76
|
-
"css-loader": "^
|
|
76
|
+
"css-loader": "^7.1.2",
|
|
77
77
|
"emojic": "^1.1.17",
|
|
78
78
|
"enzyme": "^3.1.1",
|
|
79
79
|
"es-check": "^6.0.0",
|
|
@@ -94,8 +94,7 @@
|
|
|
94
94
|
"grunt-webpack": "^5.0.0",
|
|
95
95
|
"husky": "^7.0.2",
|
|
96
96
|
"jest": "^29.3.1",
|
|
97
|
-
"jest-environment-jsdom": "^
|
|
98
|
-
"jest-environment-jsdom-global": "^4.0.0",
|
|
97
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
99
98
|
"karma": "^6.4.1",
|
|
100
99
|
"karma-babel-preprocessor": "^8.0.2",
|
|
101
100
|
"karma-browserify": "^8.1.0",
|
|
@@ -119,7 +118,7 @@
|
|
|
119
118
|
"webpack-dev-server": "^4.11.1"
|
|
120
119
|
},
|
|
121
120
|
"dependencies": {
|
|
122
|
-
"auth0-js": "^9.
|
|
121
|
+
"auth0-js": "^9.29.0",
|
|
123
122
|
"auth0-password-policies": "^1.0.2",
|
|
124
123
|
"blueimp-md5": "^2.19.0",
|
|
125
124
|
"classnames": "^2.3.2",
|
|
@@ -132,10 +131,10 @@
|
|
|
132
131
|
"qs": "^6.10.3",
|
|
133
132
|
"react": "^18.2.0",
|
|
134
133
|
"react-dom": "^18.2.0",
|
|
135
|
-
"react-transition-group": "^
|
|
134
|
+
"react-transition-group": "^4.4.5",
|
|
136
135
|
"trim": "^1.0.1",
|
|
137
136
|
"url-join": "^1.1.0",
|
|
138
|
-
"validator": "^13.
|
|
137
|
+
"validator": "^13.15.22"
|
|
139
138
|
},
|
|
140
139
|
"ccu": {
|
|
141
140
|
"name": "lock",
|
|
@@ -178,7 +177,7 @@
|
|
|
178
177
|
"lcov",
|
|
179
178
|
"text-summary"
|
|
180
179
|
],
|
|
181
|
-
"testEnvironment": "
|
|
180
|
+
"testEnvironment": "<rootDir>/customJsdomEnvironment.js"
|
|
182
181
|
},
|
|
183
182
|
"lint-staged": {
|
|
184
183
|
"*.{js,jsx}": [
|