auth0-lock 12.0.2 → 12.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.eslintrc.json +1 -1
  2. package/.github/ISSUE_TEMPLATE/Bug Report.yml +79 -0
  3. package/.github/ISSUE_TEMPLATE/config.yml +2 -2
  4. package/.github/dependabot.yml +2 -5
  5. package/.github/workflows/codeql.yml +25 -12
  6. package/.github/workflows/publish.yml +74 -0
  7. package/.github/workflows/semgrep.yml +33 -9
  8. package/.github/workflows/snyk.yml +47 -0
  9. package/.github/workflows/test.yml +66 -0
  10. package/.semgrepignore +8 -0
  11. package/.shiprc +1 -1
  12. package/CHANGELOG.md +15 -0
  13. package/DEVELOPMENT.md +9 -10
  14. package/EXAMPLES.md +18 -5
  15. package/README.md +2 -3
  16. package/lib/__tests__/connection/database/login_pane.js +1 -1
  17. package/lib/__tests__/connection/database/password_reset_confirmation.js +1 -1
  18. package/lib/__tests__/connection/database/signed_up_confirmation.js +1 -1
  19. package/lib/__tests__/connection/enterprise/actions.js +2 -2
  20. package/lib/__tests__/connection/enterprise/quick_auth_screen.js +1 -1
  21. package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +1 -1
  22. package/lib/__tests__/core/signed_in_confirmation.js +1 -1
  23. package/lib/__tests__/field/captcha/friendlyCaptcha.js +58 -0
  24. package/lib/__tests__/field/captcha/hcaptcha.js +58 -0
  25. package/lib/__tests__/field/captcha/recaptcha_enterprise.js +3 -3
  26. package/lib/__tests__/field/captcha/recaptchav2.js +3 -3
  27. package/lib/__tests__/field/captcha.js +51 -7
  28. package/lib/__tests__/field/custom_input.js +21 -0
  29. package/lib/__tests__/testUtils.js +1 -1
  30. package/lib/__tests__/ui/box/confirmation_pane.js +1 -1
  31. package/lib/browser.js +9 -0
  32. package/lib/connection/captcha.js +1 -1
  33. package/lib/connection/enterprise/actions.js +6 -1
  34. package/lib/connection/passwordless/actions.js +1 -1
  35. package/lib/core/client/index.js +1 -1
  36. package/lib/core/index.js +1 -1
  37. package/lib/core/web_api/helper.js +1 -1
  38. package/lib/core.js +1 -1
  39. package/lib/field/captcha/captcha_pane.js +4 -4
  40. package/lib/field/captcha/{recaptcha.js → third_party_captcha.js} +74 -33
  41. package/lib/field/custom_input.js +1 -0
  42. package/lib/field/phone-number/phone_number_pane.js +1 -1
  43. package/lib/i18n.js +1 -1
  44. package/lib/lock.js +1 -1
  45. package/lib/passwordless.js +1 -1
  46. package/lib/ui/box/header.js +6 -1
  47. package/lib/ui/input/checkbox_input.js +15 -4
  48. package/lib/ui/input/input_wrap.js +5 -1
  49. package/package.json +10 -14
  50. package/.circleci/config.yml +0 -92
  51. package/.github/ISSUE_TEMPLATE/report_a_bug.md +0 -57
  52. package/.snyk +0 -19
  53. package/Makefile +0 -22
@@ -12,7 +12,7 @@ var l = _interopRequireWildcard(require("../../core/index"));
12
12
  var _index2 = require("../../store/index");
13
13
  var captchaField = _interopRequireWildcard(require("../captcha"));
14
14
  var _index3 = require("../index");
15
- var _recaptcha = require("./recaptcha");
15
+ var _third_party_captcha = require("./third_party_captcha");
16
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
17
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -27,7 +27,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
27
27
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
28
28
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
29
29
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
30
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
30
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /* eslint-disable no-nested-ternary */
31
31
  var CaptchaPane = /*#__PURE__*/function (_React$Component) {
32
32
  _inherits(CaptchaPane, _React$Component);
33
33
  var _super = _createSuper(CaptchaPane);
@@ -48,14 +48,14 @@ var CaptchaPane = /*#__PURE__*/function (_React$Component) {
48
48
  var value = (0, _index3.getFieldValue)(lock, 'captcha');
49
49
  var isValid = !(0, _index3.isFieldVisiblyInvalid)(lock, 'captcha');
50
50
  var provider = captcha.get('provider');
51
- if ((0, _recaptcha.isRecaptcha)(provider)) {
51
+ if ((0, _third_party_captcha.isThirdPartyCaptcha)(provider)) {
52
52
  function handleChange(value) {
53
53
  (0, _index2.swap)(_index2.updateEntity, 'lock', lockId, captchaField.set, value);
54
54
  }
55
55
  function reset() {
56
56
  handleChange();
57
57
  }
58
- return /*#__PURE__*/_react.default.createElement(_recaptcha.ReCAPTCHA, {
58
+ return /*#__PURE__*/_react.default.createElement(_third_party_captcha.ThirdPartyCaptcha, {
59
59
  provider: provider,
60
60
  sitekey: captcha.get('siteKey'),
61
61
  onChange: handleChange,
@@ -4,7 +4,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.isRecaptcha = exports.ReCAPTCHA = void 0;
7
+ exports.isThirdPartyCaptcha = exports.ThirdPartyCaptcha = void 0;
8
8
  var _createRef = require("../../utils/createRef");
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -24,16 +24,22 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
24
24
  var noop = function noop() {};
25
25
  var RECAPTCHA_V2_PROVIDER = 'recaptcha_v2';
26
26
  var RECAPTCHA_ENTERPRISE_PROVIDER = 'recaptcha_enterprise';
27
- var isRecaptcha = function isRecaptcha(provider) {
28
- return provider === RECAPTCHA_ENTERPRISE_PROVIDER || provider === RECAPTCHA_V2_PROVIDER;
27
+ var HCAPTCHA_PROVIDER = 'hcaptcha';
28
+ var FRIENDLY_CAPTCHA_PROVIDER = 'friendly_captcha';
29
+ var isThirdPartyCaptcha = function isThirdPartyCaptcha(provider) {
30
+ return provider === RECAPTCHA_ENTERPRISE_PROVIDER || provider === RECAPTCHA_V2_PROVIDER || provider === HCAPTCHA_PROVIDER || provider === FRIENDLY_CAPTCHA_PROVIDER;
29
31
  };
30
- exports.isRecaptcha = isRecaptcha;
31
- var getRecaptchaProvider = function getRecaptchaProvider(provider) {
32
+ exports.isThirdPartyCaptcha = isThirdPartyCaptcha;
33
+ var getCaptchaProvider = function getCaptchaProvider(provider) {
32
34
  switch (provider) {
33
35
  case RECAPTCHA_V2_PROVIDER:
34
36
  return window.grecaptcha;
35
37
  case RECAPTCHA_ENTERPRISE_PROVIDER:
36
38
  return window.grecaptcha.enterprise;
39
+ case HCAPTCHA_PROVIDER:
40
+ return window.hcaptcha;
41
+ case FRIENDLY_CAPTCHA_PROVIDER:
42
+ return window.friendlyChallenge;
37
43
  }
38
44
  };
39
45
  var scriptForProvider = function scriptForProvider(provider, lang, callback) {
@@ -42,14 +48,30 @@ var scriptForProvider = function scriptForProvider(provider, lang, callback) {
42
48
  return "https://www.recaptcha.net/recaptcha/api.js?hl=".concat(lang, "&onload=").concat(callback);
43
49
  case RECAPTCHA_ENTERPRISE_PROVIDER:
44
50
  return "https://www.recaptcha.net/recaptcha/enterprise.js?render=explicit&hl=".concat(lang, "&onload=").concat(callback);
51
+ case HCAPTCHA_PROVIDER:
52
+ return "https://js.hcaptcha.com/1/api.js?hl=".concat(lang, "&onload=").concat(callback);
53
+ case FRIENDLY_CAPTCHA_PROVIDER:
54
+ return 'https://cdn.jsdelivr.net/npm/friendly-challenge@0.9.12/widget.min.js';
45
55
  }
46
56
  };
47
- var ReCAPTCHA = /*#__PURE__*/function (_React$Component) {
48
- _inherits(ReCAPTCHA, _React$Component);
49
- var _super = _createSuper(ReCAPTCHA);
50
- function ReCAPTCHA(props) {
57
+ var providerDomPrefix = function providerDomPrefix(provider) {
58
+ switch (provider) {
59
+ case RECAPTCHA_V2_PROVIDER:
60
+ return 'recaptcha';
61
+ case RECAPTCHA_ENTERPRISE_PROVIDER:
62
+ return 'recaptcha';
63
+ case HCAPTCHA_PROVIDER:
64
+ return 'hcaptcha';
65
+ case FRIENDLY_CAPTCHA_PROVIDER:
66
+ return 'friendly-captcha';
67
+ }
68
+ };
69
+ var ThirdPartyCaptcha = /*#__PURE__*/function (_React$Component) {
70
+ _inherits(ThirdPartyCaptcha, _React$Component);
71
+ var _super = _createSuper(ThirdPartyCaptcha);
72
+ function ThirdPartyCaptcha(props) {
51
73
  var _this;
52
- _classCallCheck(this, ReCAPTCHA);
74
+ _classCallCheck(this, ThirdPartyCaptcha);
53
75
  _this = _super.call(this, props);
54
76
  _this.state = {};
55
77
  //this version of react doesn't have React.createRef
@@ -81,7 +103,7 @@ var ReCAPTCHA = /*#__PURE__*/function (_React$Component) {
81
103
  };
82
104
  return _this;
83
105
  }
84
- _createClass(ReCAPTCHA, [{
106
+ _createClass(ThirdPartyCaptcha, [{
85
107
  key: "componentWillUnmount",
86
108
  value: function componentWillUnmount() {
87
109
  if (!this.scriptNode) {
@@ -93,28 +115,43 @@ var ReCAPTCHA = /*#__PURE__*/function (_React$Component) {
93
115
  key: "componentDidMount",
94
116
  value: function componentDidMount() {
95
117
  var _this2 = this;
96
- ReCAPTCHA.loadScript(this.props, document.body, function (err, scriptNode) {
118
+ ThirdPartyCaptcha.loadScript(this.props, document.body, function (err, scriptNode) {
97
119
  _this2.scriptNode = scriptNode;
98
- var provider = getRecaptchaProvider(_this2.props.provider);
99
-
100
- // if this is enterprise then we change this to window.grecaptcha.enterprise.render
101
- _this2.widgetId = provider.render(_this2.ref.current, {
102
- callback: _this2.changeHandler,
103
- 'expired-callback': _this2.expiredHandler,
104
- 'error-callback': _this2.erroredHandler,
105
- sitekey: _this2.props.sitekey
106
- });
120
+ var provider = getCaptchaProvider(_this2.props.provider);
121
+ if (_this2.props.provider === FRIENDLY_CAPTCHA_PROVIDER) {
122
+ _this2.widgetInstance = new provider.WidgetInstance(_this2.ref.current, {
123
+ sitekey: _this2.props.sitekey,
124
+ language: _this2.props.hl,
125
+ doneCallback: _this2.changeHandler,
126
+ errorCallback: _this2.erroredHandler
127
+ });
128
+ } else {
129
+ // if this is enterprise then we change this to window.grecaptcha.enterprise.render
130
+ _this2.widgetId = provider.render(_this2.ref.current, {
131
+ callback: _this2.changeHandler,
132
+ 'expired-callback': _this2.expiredHandler,
133
+ 'error-callback': _this2.erroredHandler,
134
+ sitekey: _this2.props.sitekey
135
+ });
136
+ }
107
137
  });
108
138
  }
109
139
  }, {
110
140
  key: "reset",
111
141
  value: function reset() {
112
- var provider = getRecaptchaProvider(this.props.provider);
113
- provider.reset(this.widgetId);
142
+ var provider = getCaptchaProvider(this.props.provider);
143
+ if (this.props.provider === FRIENDLY_CAPTCHA_PROVIDER) {
144
+ if (this.widgetInstance) {
145
+ this.widgetInstance.reset();
146
+ }
147
+ } else {
148
+ provider.reset(this.widgetId);
149
+ }
114
150
  }
115
151
  }, {
116
152
  key: "render",
117
153
  value: function render() {
154
+ var _this3 = this;
118
155
  /*
119
156
  This is an override for the following conflicting css-rule:
120
157
  @media screen and (max-width: 480px)
@@ -123,7 +160,7 @@ var ReCAPTCHA = /*#__PURE__*/function (_React$Component) {
123
160
  }
124
161
  */
125
162
  var fixInterval = setInterval(function () {
126
- var iframes = Array.from(document.querySelectorAll("iframe[src*=\"recaptcha\"]"));
163
+ var iframes = Array.from(document.querySelectorAll("iframe[src*=\"".concat(providerDomPrefix(_this3.props.provider), "\"]")));
127
164
  var containers = iframes.map(function (iframe) {
128
165
  return iframe.parentNode.parentNode;
129
166
  }).filter(function (container) {
@@ -138,9 +175,9 @@ var ReCAPTCHA = /*#__PURE__*/function (_React$Component) {
138
175
  clearInterval(fixInterval);
139
176
  }, 300);
140
177
  return /*#__PURE__*/_react.default.createElement("div", {
141
- className: this.props.isValid ? 'auth0-lock-recaptcha-block' : 'auth0-lock-recaptcha-block auth0-lock-recaptcha-block-error'
178
+ className: this.props.isValid ? "auth0-lock-".concat(providerDomPrefix(this.props.provider), "-block") : "auth0-lock-".concat(providerDomPrefix(this.props.provider), "-block auth0-lock-").concat(providerDomPrefix(this.props.provider), "-block-error")
142
179
  }, /*#__PURE__*/_react.default.createElement("div", {
143
- className: "auth0-lock-recaptchav2",
180
+ className: "auth0-lock-".concat(providerDomPrefix(this.props.provider) === 'recaptcha' ? 'recaptchav2' : providerDomPrefix(this.props.provider)),
144
181
  ref: this.ref
145
182
  }));
146
183
  }
@@ -156,7 +193,7 @@ var ReCAPTCHA = /*#__PURE__*/function (_React$Component) {
156
193
  value: function loadScript(props) {
157
194
  var element = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.body;
158
195
  var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
159
- var callbackName = "recatpchaCallback_".concat(Math.floor(Math.random() * 1000001));
196
+ var callbackName = "".concat(providerDomPrefix(props.provider), "Callback_").concat(Math.floor(Math.random() * 1000001));
160
197
  var scriptUrl = scriptForProvider(props.provider, props.hl, callbackName);
161
198
  var script = document.createElement('script');
162
199
  window[callbackName] = function () {
@@ -165,6 +202,10 @@ var ReCAPTCHA = /*#__PURE__*/function (_React$Component) {
165
202
  };
166
203
  script.src = scriptUrl;
167
204
  script.async = true;
205
+ script.defer = true;
206
+ if (props.provider === FRIENDLY_CAPTCHA_PROVIDER) {
207
+ script.onload = window[callbackName];
208
+ }
168
209
  element.appendChild(script);
169
210
  }
170
211
  }, {
@@ -179,11 +220,11 @@ var ReCAPTCHA = /*#__PURE__*/function (_React$Component) {
179
220
  }
180
221
  }
181
222
  }]);
182
- return ReCAPTCHA;
183
- }(_react.default.Component);
184
- exports.ReCAPTCHA = ReCAPTCHA;
185
- ReCAPTCHA.displayName = 'ReCAPTCHA';
186
- ReCAPTCHA.propTypes = {
223
+ return ThirdPartyCaptcha;
224
+ }(_react.default.Component); // TO DO: Confirm this change will not introduce unintended behavior for customers
225
+ exports.ThirdPartyCaptcha = ThirdPartyCaptcha;
226
+ ThirdPartyCaptcha.displayName = 'ThirdPartyCaptcha';
227
+ ThirdPartyCaptcha.propTypes = {
187
228
  provider: _propTypes.default.string.isRequired,
188
229
  sitekey: _propTypes.default.string.isRequired,
189
230
  onChange: _propTypes.default.func,
@@ -193,7 +234,7 @@ ReCAPTCHA.propTypes = {
193
234
  value: _propTypes.default.string,
194
235
  isValid: _propTypes.default.bool
195
236
  };
196
- ReCAPTCHA.defaultProps = {
237
+ ThirdPartyCaptcha.defaultProps = {
197
238
  onChange: noop,
198
239
  onExpired: noop,
199
240
  onErrored: noop
@@ -45,6 +45,7 @@ var CustomInput = function CustomInput(_ref) {
45
45
  case 'checkbox':
46
46
  return /*#__PURE__*/_react.default.createElement(_checkbox_input.default, _extends({
47
47
  lockId: l.id(model),
48
+ invalidHint: (0, _index.getFieldInvalidHint)(model, name),
48
49
  onChange: function onChange(e) {
49
50
  return (0, _actions.changeField)(l.id(model), name, "".concat(e.target.checked), validator);
50
51
  },
@@ -28,7 +28,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
28
28
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
29
29
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
30
30
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
31
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
31
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } // import LocationInput from '../../ui/input/location_input';
32
32
  var IconSvg = /*#__PURE__*/_react.default.createElement("svg", {
33
33
  focusable: "false",
34
34
  width: "14px",
package/lib/i18n.js CHANGED
@@ -91,7 +91,7 @@ function assertLanguage(m, language, base) {
91
91
  function syncLang(m, language, _cb) {
92
92
  (0, _cdn_utils.load)({
93
93
  method: 'registerLanguageDictionary',
94
- url: "".concat(l.languageBaseUrl(m), "/js/lock/").concat("12.0.2", "/").concat(language, ".js"),
94
+ url: "".concat(l.languageBaseUrl(m), "/js/lock/").concat("12.2.0", "/").concat(language, ".js"),
95
95
  check: function check(str) {
96
96
  return str && str === language;
97
97
  },
package/lib/lock.js CHANGED
@@ -39,7 +39,7 @@ var Auth0Lock = /*#__PURE__*/function (_Core) {
39
39
  return _createClass(Auth0Lock);
40
40
  }(_core.default); // telemetry
41
41
  exports.default = Auth0Lock;
42
- Auth0Lock.version = "12.0.2";
42
+ Auth0Lock.version = "12.2.0";
43
43
 
44
44
  // TODO: should we have different telemetry for classic/passwordless?
45
45
  // TODO: should we set telemetry info before each request?
@@ -39,4 +39,4 @@ var Auth0LockPasswordless = /*#__PURE__*/function (_Core) {
39
39
  return _createClass(Auth0LockPasswordless);
40
40
  }(_core.default);
41
41
  exports.default = Auth0LockPasswordless;
42
- Auth0LockPasswordless.version = "12.0.2";
42
+ Auth0LockPasswordless.version = "12.2.0";
@@ -78,6 +78,9 @@ var Welcome = /*#__PURE__*/function (_React$Component2) {
78
78
  args[_key] = arguments[_key];
79
79
  }
80
80
  _this = _super2.call.apply(_super2, [this].concat(args));
81
+ // Cause a reflow when the image is loaded to fix an issue with the Lock content sometimes
82
+ // not rendering in a popup on first load.
83
+ // https://github.com/auth0/lock/issues/1942
81
84
  _defineProperty(_assertThisInitialized(_this), "onImageLoad", function () {
82
85
  return document.querySelector('.auth0-lock').style.fontSize = '1rem';
83
86
  });
@@ -135,7 +138,9 @@ var WelcomeMessage = /*#__PURE__*/function (_React$Component3) {
135
138
  }
136
139
  return /*#__PURE__*/_react.default.createElement("div", {
137
140
  className: className,
138
- title: message
141
+ title: message,
142
+ role: "heading",
143
+ "aria-level": "1"
139
144
  }, message);
140
145
  }
141
146
  }]);
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
+ var _input_wrap = _interopRequireDefault(require("./input_wrap"));
9
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
12
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
@@ -35,8 +36,14 @@ var CheckboxInput = /*#__PURE__*/function (_React$Component) {
35
36
  ariaLabel = _this$props.ariaLabel,
36
37
  placeholder = _this$props.placeholder,
37
38
  checked = _this$props.checked,
38
- placeholderHTML = _this$props.placeholderHTML;
39
- return /*#__PURE__*/_react.default.createElement("div", {
39
+ placeholderHTML = _this$props.placeholderHTML,
40
+ isValid = _this$props.isValid,
41
+ invalidHint = _this$props.invalidHint;
42
+ var spanClass = invalidHint ? '' : 'no-hint';
43
+ return /*#__PURE__*/_react.default.createElement(_input_wrap.default, {
44
+ invalidHint: invalidHint,
45
+ isValid: isValid,
46
+ name: name,
40
47
  className: "auth0-lock-input-checkbox"
41
48
  }, /*#__PURE__*/_react.default.createElement("label", null, /*#__PURE__*/_react.default.createElement("input", {
42
49
  id: "".concat(lockId, "-").concat(name),
@@ -44,16 +51,20 @@ var CheckboxInput = /*#__PURE__*/function (_React$Component) {
44
51
  checked: checked === 'true',
45
52
  onChange: this.handleOnChange.bind(this),
46
53
  name: name,
47
- "aria-label": ariaLabel || name
54
+ "aria-label": ariaLabel || name,
55
+ "aria-invalid": !isValid
48
56
  }), placeholderHTML ?
49
57
  /*#__PURE__*/
50
58
  // placeholderHTML allows raw HTML
51
59
  // eslint-disable-next-line react/no-danger
52
60
  _react.default.createElement("span", {
61
+ className: spanClass,
53
62
  dangerouslySetInnerHTML: {
54
63
  __html: placeholderHTML
55
64
  }
56
- }) : /*#__PURE__*/_react.default.createElement("span", null, placeholder)));
65
+ }) : /*#__PURE__*/_react.default.createElement("span", {
66
+ className: spanClass
67
+ }, placeholder)));
57
68
  }
58
69
  }, {
59
70
  key: "handleOnChange",
@@ -36,11 +36,15 @@ var InputWrap = /*#__PURE__*/function (_React$Component) {
36
36
  invalidHint = _this$props.invalidHint,
37
37
  isValid = _this$props.isValid,
38
38
  name = _this$props.name,
39
- icon = _this$props.icon;
39
+ icon = _this$props.icon,
40
+ className = _this$props.className;
40
41
  var blockClassName = "auth0-lock-input-block auth0-lock-input-".concat(name);
41
42
  if (!isValid) {
42
43
  blockClassName += ' auth0-lock-error';
43
44
  }
45
+ if (className) {
46
+ blockClassName += " ".concat(className);
47
+ }
44
48
  var wrapClassName = 'auth0-lock-input-wrap';
45
49
  if (focused && isValid) {
46
50
  wrapClassName += ' auth0-lock-focused';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0-lock",
3
- "version": "12.0.2",
3
+ "version": "12.2.0",
4
4
  "description": "Auth0 Lock",
5
5
  "author": "Auth0 <support@auth0.com> (http://auth0.com)",
6
6
  "license": "MIT",
@@ -26,7 +26,6 @@
26
26
  "dev": "grunt dev",
27
27
  "dist": "grunt dist",
28
28
  "prepublish": "cross-env BABEL_ENV=npm grunt dist",
29
- "precommit": "yarn lint-staged",
30
29
  "lint": "eslint --ext .jsx,.js src/",
31
30
  "test:e2e": "cross-env BABEL_ENV=test karma start --browsers ChromeHeadless",
32
31
  "test:e2e:watch": "cross-env BABEL_ENV=test karma start --browsers Chrome --single-run=false",
@@ -42,6 +41,7 @@
42
41
  "devDependencies": {
43
42
  "@auth0/component-cdn-uploader": "^2.2.2",
44
43
  "@babel/core": "^7.0.0",
44
+ "@babel/eslint-parser": "^7.22.9",
45
45
  "@babel/plugin-proposal-class-properties": "^7.0.0",
46
46
  "@babel/plugin-proposal-decorators": "^7.0.0",
47
47
  "@babel/plugin-proposal-do-expressions": "^7.0.0",
@@ -60,9 +60,8 @@
60
60
  "@babel/plugin-syntax-import-meta": "^7.0.0",
61
61
  "@babel/preset-env": "^7.0.0",
62
62
  "@babel/preset-react": "^7.0.0",
63
- "@cfaester/enzyme-adapter-react-18": "^0.6.0",
63
+ "@cfaester/enzyme-adapter-react-18": "^0.7.0",
64
64
  "@google-cloud/translate": "^6.0.2",
65
- "babel-eslint": "^9.0.0",
66
65
  "babel-jest": "^29.3.1",
67
66
  "babel-loader": "8.3.0",
68
67
  "babel-plugin-stylus-compiler": "^1.4.0",
@@ -70,7 +69,6 @@
70
69
  "babel-plugin-version-inline": "^1.0.0",
71
70
  "babelify": "^10.0.0",
72
71
  "browserify": "^17.0.0",
73
- "bump-version": "^0.5.0",
74
72
  "chalk": "^4.1.2",
75
73
  "core-js": "^3.26.1",
76
74
  "cross-env": "^7.0.3",
@@ -78,10 +76,11 @@
78
76
  "emojic": "^1.1.17",
79
77
  "enzyme": "^3.1.1",
80
78
  "es-check": "^6.0.0",
81
- "eslint": "^7.32.0",
82
- "eslint-config-prettier": "^8.3.0",
83
- "eslint-plugin-react": "^7.4.0",
79
+ "eslint": "^8.45.0",
80
+ "eslint-config-prettier": "^8.8.0",
81
+ "eslint-plugin-react": "^7.32.2",
84
82
  "esm": "^3.2.25",
83
+ "events": "^3.3.0",
85
84
  "expect.js": "^0.3.1",
86
85
  "flat": "^5.0.2",
87
86
  "glob": "^7.1.7",
@@ -97,7 +96,6 @@
97
96
  "jest": "^29.3.1",
98
97
  "jest-environment-jsdom": "^29.3.1",
99
98
  "jest-environment-jsdom-global": "^4.0.0",
100
- "json-beautify": "^1.0.1",
101
99
  "karma": "^6.4.1",
102
100
  "karma-babel-preprocessor": "^8.0.2",
103
101
  "karma-browserify": "^8.1.0",
@@ -105,7 +103,7 @@
105
103
  "karma-chrome-launcher": "^3.1.1",
106
104
  "karma-mocha": "^2.0.1",
107
105
  "karma-mocha-reporter": "^2.2.5",
108
- "lint-staged": "^11.1.4",
106
+ "lint-staged": "^13.2.3",
109
107
  "mocha": "^9.1.4",
110
108
  "node-es-module-loader": "^0.3.8",
111
109
  "prettier": "^2.4.1",
@@ -113,18 +111,16 @@
113
111
  "react-test-renderer": "^18.2.0",
114
112
  "sinon": "^1.15.4",
115
113
  "stylus": "^0.59.0",
116
- "stylus-loader": "^2.3.1",
114
+ "stylus-loader": "^3.0.2",
117
115
  "tmp": "^0.2.1",
118
- "uglify-js": "^2.7.4",
119
116
  "unminified-webpack-plugin": "^3.0.0",
120
- "unreleased": "^0.1.0",
121
117
  "watchify": "^4.0.0",
122
118
  "webpack": "^5.75.0",
123
119
  "webpack-cli": "^5.0.0",
124
120
  "webpack-dev-server": "^4.11.1"
125
121
  },
126
122
  "dependencies": {
127
- "auth0-js": "^9.20.0",
123
+ "auth0-js": "^9.22.0",
128
124
  "auth0-password-policies": "^1.0.2",
129
125
  "blueimp-md5": "^2.19.0",
130
126
  "classnames": "^2.3.2",
@@ -1,92 +0,0 @@
1
- version: 2.1
2
- orbs:
3
- ship: auth0/ship@0
4
- executors:
5
- docker-executor:
6
- docker:
7
- - image: cimg/node:lts-browsers
8
- jobs:
9
- build-and-test:
10
- executor: docker-executor
11
- environment:
12
- LANG: en_US.UTF-8
13
- steps:
14
- - checkout
15
- - run:
16
- name: Update Yarn
17
- command: 'npm update -g yarn'
18
- - restore_cache:
19
- name: Restore Yarn Package Cache
20
- key: yarn-packages-{{ checksum "yarn.lock" }}
21
- - run:
22
- name: Install Dependencies
23
- command: yarn install
24
- - save_cache:
25
- name: Save Yarn Package Cache
26
- key: yarn-packages-{{ checksum "yarn.lock" }}
27
- paths:
28
- - ~/.cache/yarn
29
- - run:
30
- name: Build
31
- command: yarn build
32
- - run:
33
- name: ES5 compatibility check
34
- command: yarn test:es-check
35
- - run:
36
- name: Validate language files
37
- command: yarn i18n:validate
38
- - run:
39
- name: Unit Tests
40
- command: yarn test
41
- - store_artifacts:
42
- path: build
43
-
44
- browserstack:
45
- executor: docker-executor
46
- environment:
47
- LANG: en_US.UTF-8
48
- steps:
49
- - checkout
50
- - run:
51
- name: Update Yarn
52
- command: 'npm update -g yarn'
53
- - restore_cache:
54
- name: Restore Yarn Package Cache
55
- key: yarn-packages-{{ checksum "yarn.lock" }}
56
- - run:
57
- name: Install Dependencies
58
- command: yarn install
59
- - save_cache:
60
- name: Save Yarn Package Cache
61
- key: yarn-packages-{{ checksum "yarn.lock" }}
62
- paths:
63
- - ~/.cache/yarn
64
- - run:
65
- name: Build
66
- command: yarn build
67
- - run:
68
- name: Browser Tests
69
- command: yarn test:e2e:browserstack
70
-
71
- workflows:
72
- build-test-report:
73
- jobs:
74
- - build-and-test
75
- - browserstack:
76
- requires:
77
- - build-and-test
78
- context:
79
- - browserstack-env
80
- - ship/node-publish:
81
- requires:
82
- - build-and-test
83
- pkg-manager: yarn
84
- node-version: 18.12.1
85
- context:
86
- - publish-npm
87
- - publish-gh
88
- filters:
89
- branches:
90
- only:
91
- - master
92
- - beta
@@ -1,57 +0,0 @@
1
- ---
2
- name: Report a bug
3
- about: Have you found a bug or issue? Create a bug report for this SDK
4
- title: ''
5
- labels: bug report
6
- assignees: ''
7
- ---
8
-
9
- <!--
10
- **Please do not report security vulnerabilities here**. The Responsible Disclosure Program (https://auth0.com/whitehat) details the procedure for disclosing security issues.
11
-
12
- Thank you in advance for helping us to improve this library! Please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible. For general support or usage questions, use the Auth0 Community (https://community.auth0.com/) or Auth0 Support (https://support.auth0.com/). Finally, to avoid duplicates, please search existing Issues before submitting one here.
13
-
14
- By submitting an Issue to this repository, you agree to the terms within the Auth0 Code of Conduct (https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md).
15
- -->
16
-
17
- :warning: **Note:** We are no longer supporting requests for new features. Only requests for bug fixes or security patches will be considered.
18
-
19
- ### Describe the problem
20
-
21
- <!--
22
- > Provide a clear and concise description of the issue
23
- -->
24
-
25
- ### What was the expected behavior?
26
-
27
- <!--
28
- > Tell us about the behavior you expected to see
29
- -->
30
-
31
- ### Reproduction
32
- <!--
33
- > Detail the steps taken to reproduce this error, and whether this issue can be reproduced consistently or if it is intermittent.
34
- > **Note**: If clear, reproducable steps or the smallest sample app demonstrating misbehavior cannot be provided, we may not be able to follow up on this bug report.
35
-
36
- > Where possible, please include:
37
- >
38
- > - The smallest possible sample app that reproduces the undesirable behavior
39
- > - Log files (redact/remove sensitive information)
40
- > - Application settings (redact/remove sensitive information)
41
- > - Screenshots
42
- -->
43
-
44
- - Step 1..
45
- - Step 2..
46
- - ...
47
-
48
- ### Environment
49
-
50
- <!--
51
- > Please provide the following:
52
- -->
53
-
54
- - **Version of this library used:**
55
- - **Which framework are you using, if applicable:**
56
- - **Other modules/plugins/libraries that might be involved:**
57
- - **Any other relevant information you think would be useful:**
package/.snyk DELETED
@@ -1,19 +0,0 @@
1
- # Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
2
- version: v1.13.3
3
- # ignores vulnerabilities until expiry date; change duration by modifying expiry date
4
- ignore:
5
- 'npm:debug:20170905':
6
- - debug:
7
- reason: no vector attack
8
- expires: '2019-04-19T17:53:14.464Z'
9
- - jsonp > debug:
10
- reason: no vector attack
11
- expires: '2019-04-19T17:53:14.464Z'
12
- 'npm:ms:20170412':
13
- - debug > ms:
14
- reason: no vector attack
15
- expires: '2019-04-19T17:53:14.464Z'
16
- - jsonp > debug > ms:
17
- reason: no vector attack
18
- expires: '2019-04-19T17:53:14.464Z'
19
- patch: {}
package/Makefile DELETED
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env make
2
-
3
- #SHELL := /bin/bash
4
- #.SHELLFLAGS = -ec
5
-
6
- .PHONY: install lint test build cdn-publish
7
-
8
- install:
9
- @echo "Running install..."
10
- yarn install
11
-
12
- test:
13
- @echo "Running test..."
14
- yarn test
15
-
16
- build:
17
- @echo "Running build..."
18
- rm -rf dist && rm -rf build && yarn dist build
19
-
20
- publish:
21
- @echo "Running cdn-publish..."
22
- yarn publish:cdn