auth0-lock
Advanced tools
Comparing version 11.30.6 to 11.31.0
@@ -7,6 +7,16 @@ 'use strict'; | ||
var _enzyme = require('enzyme'); | ||
var _testUtils = require('testUtils'); | ||
var _immutable = require('immutable'); | ||
var _immutable2 = _interopRequireDefault(_immutable); | ||
var _field = require('../../../field'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
jest.mock('connection/database/reset_password_pane', function () { | ||
return (0, _testUtils.mockComponent)('reset_password_pane'); | ||
}); | ||
var getScreen = function getScreen() { | ||
@@ -17,2 +27,7 @@ var ResetPasswordScreen = require('connection/database/reset_password').default; | ||
var getComponent = function getComponent() { | ||
var screen = getScreen(); | ||
return screen.render(); | ||
}; | ||
describe('ResetPasswordScreen', function () { | ||
@@ -40,5 +55,7 @@ beforeEach(function () { | ||
jest.mock('i18n', function () { | ||
return { str: function str(_, keys) { | ||
return { | ||
str: function str(_, keys) { | ||
return keys.join(','); | ||
} }; | ||
} | ||
}; | ||
}); | ||
@@ -52,3 +69,12 @@ | ||
setGlobalError: 'setGlobalError', | ||
clearGlobalError: 'clearGlobalError' | ||
clearGlobalError: 'clearGlobalError', | ||
connectionResolver: jest.fn().mockReturnValue(undefined), | ||
ui: { | ||
allowAutocomplete: function allowAutocomplete() { | ||
return false; | ||
} | ||
}, | ||
submitting: function submitting() { | ||
return false; | ||
} | ||
}; | ||
@@ -64,2 +90,3 @@ }); | ||
}); | ||
it('isSubmitDisabled returns true when `isEnterpriseDomain` is true', function () { | ||
@@ -75,2 +102,3 @@ jest.useFakeTimers(); | ||
}); | ||
it('isSubmitDisabled returns false when `isEnterpriseDomain` is false', function () { | ||
@@ -84,2 +112,52 @@ require('connection/enterprise').isEnterpriseDomain = function () { | ||
}); | ||
describe('a custom connection resolver is being used', function () { | ||
var lock = void 0; | ||
var i18n = void 0; | ||
beforeEach(function () { | ||
lock = _immutable2.default.fromJS({ | ||
id: '__lock-id__' | ||
}); | ||
i18n = { | ||
html: jest.fn(), | ||
str: jest.fn() | ||
}; | ||
}); | ||
it('copies the username to the email field if an email address was entered', function () { | ||
require('core/index').connectionResolver.mockReturnValue(function () { | ||
return function () { | ||
return true; | ||
}; | ||
}); | ||
var store = require('store/index'); | ||
var Component = getComponent(); | ||
// Set a field on Lock to set the username field, then check it was set as the email | ||
var l = (0, _field.setField)(lock, 'username', 'test@test.com'); | ||
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, { i18n: i18n, model: l })).toMatchSnapshot(); | ||
expect(store.swap).toHaveBeenCalledWith('updateEntity', 'lock', 'id', expect.anything(), 'test@test.com', false); | ||
}); | ||
it('sets the email field to a blank value if username is not an email address', function () { | ||
require('core/index').connectionResolver.mockReturnValue(function () { | ||
return function () { | ||
return true; | ||
}; | ||
}); | ||
var store = require('store/index'); | ||
var Component = getComponent(); | ||
// Set a field on Lock to set the username field, then check it was set as the email | ||
var l = (0, _field.setField)(lock, 'username', 'some-username'); | ||
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, { i18n: i18n, model: l })).toMatchSnapshot(); | ||
expect(store.swap).toHaveBeenCalledWith('updateEntity', 'lock', 'id', expect.anything(), '', false); | ||
}); | ||
}); | ||
}); |
@@ -13,4 +13,2 @@ 'use strict'; | ||
var _reactTestRenderer = require('react-test-renderer'); | ||
var _testUtils = require('testUtils'); | ||
@@ -48,3 +46,6 @@ | ||
mockEventRegister[event] = fn; | ||
}) | ||
}), | ||
ui: { | ||
forceAutoHeight: jest.fn().mockReturnValue(false) | ||
} | ||
}; | ||
@@ -118,2 +119,14 @@ }); | ||
}); | ||
it('adds the auto-height class when forceAutoHeight UI prop is true', function () { | ||
require('core/index').ui.forceAutoHeight.mockReturnValue(true); | ||
var props = _extends({}, defaultProps, { | ||
info: 'This is an information message', | ||
success: 'This is a success message', | ||
error: 'There is an error' | ||
}); | ||
(0, _testUtils.expectComponent)(_react2.default.createElement(Chrome, props)).toMatchSnapshot(); | ||
}); | ||
}); |
@@ -37,2 +37,6 @@ 'use strict'; | ||
var _email = require('../../field/email'); | ||
var _field = require('../../field'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -58,3 +62,14 @@ | ||
); | ||
var connectionResolver = l.connectionResolver(model); | ||
// When using a custom connection resolver, `usernameStyle` is always 'username' (as opposed to 'email'). | ||
// If the user has entered an email address as the username, and a custom resolver is being used, copy the | ||
// value from the 'username' field to the 'email' field so that `EmailPane` can render it. | ||
if (connectionResolver) { | ||
var field = (0, _field.getField)(model, 'username'); | ||
var value = field.get('value', ''); | ||
(0, _index4.swap)(_index4.updateEntity, 'lock', l.id(model), _email.setEmail, (0, _email.isEmail)(value, false) ? value : '', false); | ||
} | ||
return _react2.default.createElement(_reset_password_pane2.default, { | ||
@@ -61,0 +76,0 @@ emailInputPlaceholder: i18n.str('emailInputPlaceholder'), |
@@ -307,3 +307,4 @@ 'use strict'; | ||
allowPasswordAutocomplete: !!options.allowPasswordAutocomplete, | ||
scrollGlobalMessagesIntoView: undefined === options.scrollGlobalMessagesIntoView ? true : !!options.scrollGlobalMessagesIntoView | ||
scrollGlobalMessagesIntoView: undefined === options.scrollGlobalMessagesIntoView ? true : !!options.scrollGlobalMessagesIntoView, | ||
forceAutoHeight: !!options.forceAutoHeight | ||
}); | ||
@@ -405,2 +406,5 @@ } | ||
return tget(m, 'allowPasswordAutocomplete', getUIAttribute(m, 'allowPasswordAutocomplete')); | ||
}, | ||
forceAutoHeight: function forceAutoHeight(m) { | ||
return tget(m, 'forceAutoHeight', getUIAttribute(m, 'forceAutoHeight')); | ||
} | ||
@@ -407,0 +411,0 @@ }; |
@@ -179,3 +179,3 @@ 'use strict'; | ||
function getVersion() { | ||
return '11.30.6'; | ||
return '11.31.0'; | ||
} |
@@ -128,3 +128,3 @@ 'use strict'; | ||
method: 'registerLanguageDictionary', | ||
url: l.languageBaseUrl(m) + '/js/lock/' + '11.30.6' + '/' + language + '.js', | ||
url: l.languageBaseUrl(m) + '/js/lock/' + '11.31.0' + '/' + language + '.js', | ||
check: function check(str) { | ||
@@ -131,0 +131,0 @@ return str && str === language; |
@@ -45,3 +45,3 @@ 'use strict'; | ||
exports.default = Auth0Lock; | ||
Auth0Lock.version = '11.30.6'; | ||
Auth0Lock.version = '11.31.0'; | ||
@@ -48,0 +48,0 @@ // TODO: should we have different telemetry for classic/passwordless? |
@@ -44,2 +44,2 @@ 'use strict'; | ||
Auth0LockPasswordless.version = '11.30.6'; | ||
Auth0LockPasswordless.version = '11.31.0'; |
@@ -39,2 +39,6 @@ 'use strict'; | ||
var _classnames = require('classnames'); | ||
var _classnames2 = _interopRequireDefault(_classnames); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -378,2 +382,3 @@ | ||
scrollGlobalMessagesIntoView = _props5.scrollGlobalMessagesIntoView; | ||
var model = contentProps.model; | ||
var _state = this.state, | ||
@@ -423,7 +428,13 @@ delayingShowSubmitButton = _state.delayingShowSubmitButton, | ||
var Content = contentComponent; | ||
var className = 'auth0-lock-cred-pane'; | ||
var isQuiet = !moving && !delayingShowSubmitButton; | ||
className += isQuiet ? ' auth0-lock-quiet' : ' auth0-lock-moving'; | ||
var className = (0, _classnames2.default)('auth0-lock-cred-pane', { | ||
'auth0-lock-quiet': isQuiet, | ||
'auth0-lock-moving': !isQuiet | ||
}); | ||
var internalWrapperClass = (0, _classnames2.default)('auth0-lock-cred-pane-internal-wrapper', { | ||
'auto-height': l.ui.forceAutoHeight(model) | ||
}); | ||
return _react2.default.createElement( | ||
@@ -434,3 +445,3 @@ 'div', | ||
'div', | ||
{ className: 'auth0-lock-cred-pane-internal-wrapper' }, | ||
{ className: internalWrapperClass }, | ||
_react2.default.createElement( | ||
@@ -437,0 +448,0 @@ 'div', |
{ | ||
"name": "auth0-lock", | ||
"version": "11.30.6", | ||
"version": "11.31.0", | ||
"description": "Auth0 Lock", | ||
@@ -28,3 +28,3 @@ "author": "Auth0 <support@auth0.com> (http://auth0.com)", | ||
"prepublish": "cross-env BABEL_ENV=npm grunt dist", | ||
"precommit": "yarn test:es-check && lint-staged", | ||
"precommit": "yarn lint-staged", | ||
"lint": "eslint --ext .jsx,.js src/", | ||
@@ -112,2 +112,3 @@ "test:e2e": "cross-env BABEL_ENV=test karma start --browsers ChromeHeadless", | ||
"blueimp-md5": "^2.18.0", | ||
"classnames": "^2.3.1", | ||
"dompurify": "^2.2.8", | ||
@@ -114,0 +115,0 @@ "immutable": "^3.7.3", |
@@ -28,3 +28,3 @@ [![NPM version][npm-image]][npm-url] | ||
<!-- Latest patch release (recommended for production) --> | ||
<script src="https://cdn.auth0.com/js/lock/11.30.6/lock.min.js"></script> | ||
<script src="https://cdn.auth0.com/js/lock/11.31.0/lock.min.js"></script> | ||
``` | ||
@@ -276,2 +276,3 @@ | ||
- **preferConnectionDisplayName {Boolean}**: If true, Lock will try to use the connection display name as configured in the manage dashboard, if available. | ||
- **forceAutoHeight {Boolean}**: If true, Lock will use the `height: auto!important` style on the wrapping div, which may be useful in some circumstances where `height: 100vh` is undesirable (see [\#1963](https://github.com/auth0/lock/issues/1963)). Defaults to `false`. | ||
@@ -278,0 +279,0 @@ #### Theming options |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1460576
24106
705
0
17
+ Addedclassnames@^2.3.1
+ Addedclassnames@2.5.1(transitive)