auth0-lock 14.2.5 → 15.0.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.
- package/.github/workflows/release.yml +4 -1
- package/.github/workflows/test.yml +1 -1
- package/.husky/pre-commit +4 -0
- package/.version +1 -1
- package/CHANGELOG.md +37 -0
- package/README.md +1 -1
- package/babel.config.js +15 -0
- package/lib/__tests__/connection/enterprise/matchConnection.js +37 -5
- package/lib/avatar/gravatar_provider.js +1 -2
- package/lib/connection/database/index.js +1 -2
- package/lib/connection/enterprise.js +2 -2
- package/lib/connection/social/index.js +0 -3
- package/lib/core/index.js +1 -2
- package/lib/core/web_api/helper.js +1 -1
- package/lib/core/web_api/p2_api.js +5 -2
- package/lib/core.js +1 -1
- package/lib/field/email.js +1 -2
- package/lib/field/index.js +4 -5
- package/lib/field/mfa_code.js +1 -3
- package/lib/field/username.js +2 -4
- package/lib/i18n.js +1 -1
- package/lib/lock.js +1 -1
- package/lib/passwordless.js +1 -1
- package/package.json +13 -8
- package/types/auth0-lock-tests.ts +178 -0
- package/types/index.d.ts +282 -0
- package/types/tsconfig.json +21 -0
- package/webpack.config.js +21 -1
package/lib/field/email.js
CHANGED
|
@@ -9,7 +9,6 @@ exports.emailLocalPart = emailLocalPart;
|
|
|
9
9
|
exports.isEmail = isEmail;
|
|
10
10
|
exports.setEmail = setEmail;
|
|
11
11
|
exports.validateEmail = validateEmail;
|
|
12
|
-
var _trim = _interopRequireDefault(require("trim"));
|
|
13
12
|
var _isEmail2 = _interopRequireDefault(require("validator/lib/isEmail"));
|
|
14
13
|
var _index = require("./index");
|
|
15
14
|
var _enterprise = require("../connection/enterprise");
|
|
@@ -25,7 +24,7 @@ function isEmail(str) {
|
|
|
25
24
|
if (typeof str !== 'string') {
|
|
26
25
|
return false;
|
|
27
26
|
}
|
|
28
|
-
var trimmed =
|
|
27
|
+
var trimmed = str.trim();
|
|
29
28
|
return strictValidation ? (0, _isEmail2.default)(str) : trimmed.indexOf('@') >= 0 && trimmed.indexOf('.') >= 0 && trimmed.indexOf(' ') === -1;
|
|
30
29
|
}
|
|
31
30
|
function setEmail(m, str) {
|
package/lib/field/index.js
CHANGED
|
@@ -26,7 +26,6 @@ exports.username = username;
|
|
|
26
26
|
exports.vcode = vcode;
|
|
27
27
|
var _react = _interopRequireDefault(require("react"));
|
|
28
28
|
var _immutable = require("immutable");
|
|
29
|
-
var _trim = _interopRequireDefault(require("trim"));
|
|
30
29
|
var _option_selection_pane = _interopRequireDefault(require("./option_selection_pane"));
|
|
31
30
|
var l = _interopRequireWildcard(require("../core/index"));
|
|
32
31
|
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); }
|
|
@@ -40,19 +39,19 @@ var getDefaultValidator = function getDefaultValidator(field) {
|
|
|
40
39
|
case 'family_name':
|
|
41
40
|
case 'given_name':
|
|
42
41
|
return function (str) {
|
|
43
|
-
return minMax(
|
|
42
|
+
return minMax(str.trim(), 1, 150);
|
|
44
43
|
};
|
|
45
44
|
case 'name':
|
|
46
45
|
return function (str) {
|
|
47
|
-
return minMax(
|
|
46
|
+
return minMax(str.trim(), 1, 300);
|
|
48
47
|
};
|
|
49
48
|
case 'nickname':
|
|
50
49
|
return function (str) {
|
|
51
|
-
return minMax(
|
|
50
|
+
return minMax(str.trim(), 1, 300);
|
|
52
51
|
};
|
|
53
52
|
default:
|
|
54
53
|
return function (str) {
|
|
55
|
-
return
|
|
54
|
+
return str.trim().length > 0;
|
|
56
55
|
};
|
|
57
56
|
}
|
|
58
57
|
};
|
package/lib/field/mfa_code.js
CHANGED
|
@@ -8,8 +8,6 @@ exports.setMFACode = setMFACode;
|
|
|
8
8
|
var _index = require("./index");
|
|
9
9
|
var _email = require("./email");
|
|
10
10
|
var _database = require("../connection/database");
|
|
11
|
-
var _trim = _interopRequireDefault(require("trim"));
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
11
|
var DEFAULT_VALIDATION = {
|
|
14
12
|
mfa_code: {
|
|
15
13
|
length: 6
|
|
@@ -18,7 +16,7 @@ var DEFAULT_VALIDATION = {
|
|
|
18
16
|
var regExp = /^[0-9]+$/;
|
|
19
17
|
function validateMFACode(str) {
|
|
20
18
|
var settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_VALIDATION.mfa_code;
|
|
21
|
-
var value =
|
|
19
|
+
var value = str.trim();
|
|
22
20
|
|
|
23
21
|
// check min value matched
|
|
24
22
|
if (value.length < settings.length) {
|
package/lib/field/username.js
CHANGED
|
@@ -9,8 +9,6 @@ exports.usernameLooksLikeEmail = usernameLooksLikeEmail;
|
|
|
9
9
|
var _index = require("./index");
|
|
10
10
|
var _email = require("./email");
|
|
11
11
|
var _database = require("../connection/database");
|
|
12
|
-
var _trim = _interopRequireDefault(require("trim"));
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
12
|
var DEFAULT_CONNECTION_VALIDATION = {
|
|
15
13
|
username: {
|
|
16
14
|
min: 1,
|
|
@@ -24,9 +22,9 @@ function validateUsername(str, validateFormat) {
|
|
|
24
22
|
// If the connection does not have validation settings, it should only check if the field is empty.
|
|
25
23
|
// validateFormat overrides this logic to disable validation on login (login should never validate format)
|
|
26
24
|
if (!validateFormat || settings == null) {
|
|
27
|
-
return
|
|
25
|
+
return str.trim().length > 0;
|
|
28
26
|
}
|
|
29
|
-
var lowercased =
|
|
27
|
+
var lowercased = str.toLowerCase().trim();
|
|
30
28
|
|
|
31
29
|
// check min value matched
|
|
32
30
|
if (lowercased.length < settings.min) {
|
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("
|
|
93
|
+
url: "".concat(l.languageBaseUrl(m), "/js/lock/").concat("15.0.0", "/").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 = "
|
|
39
|
+
Auth0Lock.version = "15.0.0";
|
|
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 = "
|
|
39
|
+
Auth0LockPasswordless.version = "15.0.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth0-lock",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"description": "Auth0 Lock",
|
|
5
5
|
"author": "Auth0 <support@auth0.com> (http://auth0.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"url": "git://github.com/auth0/lock"
|
|
20
20
|
},
|
|
21
21
|
"main": "lib/index.js",
|
|
22
|
+
"types": "types/index.d.ts",
|
|
22
23
|
"scripts": {
|
|
23
24
|
"start": "grunt dev",
|
|
24
25
|
"prebuild": "grunt dist",
|
|
@@ -37,10 +38,11 @@
|
|
|
37
38
|
"publish:cdn": "ccu --trace",
|
|
38
39
|
"i18n:translate": "grunt dist && node scripts/complete-translations.js && npm run i18n:prettier && npm run build",
|
|
39
40
|
"i18n:prettier": "prettier --write src/i18n/*",
|
|
40
|
-
"i18n:validate": "node scripts/lang-audit.mjs"
|
|
41
|
+
"i18n:validate": "node scripts/lang-audit.mjs",
|
|
42
|
+
"prepare": "husky install"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
|
-
"@auth0/component-cdn-uploader": "^
|
|
45
|
+
"@auth0/component-cdn-uploader": "^3.0.2",
|
|
44
46
|
"@babel/core": "^7.0.0",
|
|
45
47
|
"@babel/eslint-parser": "^7.22.9",
|
|
46
48
|
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
|
@@ -63,6 +65,7 @@
|
|
|
63
65
|
"@babel/preset-react": "^7.0.0",
|
|
64
66
|
"@cfaester/enzyme-adapter-react-18": "^0.8.0",
|
|
65
67
|
"@google-cloud/translate": "^9.1.0",
|
|
68
|
+
"@types/auth0-js": "^9.21.6",
|
|
66
69
|
"babel-jest": "^29.3.1",
|
|
67
70
|
"babel-loader": "8.4.1",
|
|
68
71
|
"babel-plugin-stylus-compiler": "^1.4.0",
|
|
@@ -115,24 +118,23 @@
|
|
|
115
118
|
"watchify": "^4.0.0",
|
|
116
119
|
"webpack": "^5.75.0",
|
|
117
120
|
"webpack-cli": "^5.0.0",
|
|
118
|
-
"webpack-dev-server": "^
|
|
121
|
+
"webpack-dev-server": "^5.2.1"
|
|
119
122
|
},
|
|
120
123
|
"dependencies": {
|
|
121
|
-
"auth0-js": "^
|
|
122
|
-
"auth0-password-policies": "^1.0
|
|
124
|
+
"auth0-js": "^10.0.0",
|
|
125
|
+
"auth0-password-policies": "^3.1.0",
|
|
123
126
|
"blueimp-md5": "^2.19.0",
|
|
124
127
|
"classnames": "^2.3.2",
|
|
125
128
|
"dompurify": "^3.2.5",
|
|
126
129
|
"events": "^3.3.0",
|
|
127
130
|
"immutable": "^3.7.6",
|
|
128
131
|
"jsonp": "^0.2.1",
|
|
129
|
-
"password-sheriff": "^
|
|
132
|
+
"password-sheriff": "^2.0.0",
|
|
130
133
|
"prop-types": "^15.8.0",
|
|
131
134
|
"qs": "^6.14.1",
|
|
132
135
|
"react": "^18.2.0",
|
|
133
136
|
"react-dom": "^18.2.0",
|
|
134
137
|
"react-transition-group": "^4.4.5",
|
|
135
|
-
"trim": "^1.0.1",
|
|
136
138
|
"url-join": "^1.1.0",
|
|
137
139
|
"validator": "^13.15.22"
|
|
138
140
|
},
|
|
@@ -185,6 +187,9 @@
|
|
|
185
187
|
],
|
|
186
188
|
"*.{js,jsx,json}": [
|
|
187
189
|
"prettier --write"
|
|
190
|
+
],
|
|
191
|
+
"package-lock.json": [
|
|
192
|
+
"node scripts/strip-lock-resolved.js"
|
|
188
193
|
]
|
|
189
194
|
},
|
|
190
195
|
"optionalDependencies": {
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as auth0 from "auth0-js";
|
|
2
|
+
import Auth0Lock, { Auth0LockPasswordless } from "auth0-lock";
|
|
3
|
+
|
|
4
|
+
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
|
|
5
|
+
const DOMAIN = "YOUR_DOMAIN_AT.auth0.com";
|
|
6
|
+
|
|
7
|
+
// Basic instantiation
|
|
8
|
+
const lock: Auth0LockStatic = new Auth0Lock(CLIENT_ID, DOMAIN);
|
|
9
|
+
|
|
10
|
+
lock.show();
|
|
11
|
+
lock.hide();
|
|
12
|
+
lock.logout(() => {});
|
|
13
|
+
|
|
14
|
+
// checkSession
|
|
15
|
+
lock.checkSession({}, function (error: auth0.Auth0Error, authResult: AuthResult | undefined): void {
|
|
16
|
+
if (error || !authResult) {
|
|
17
|
+
lock.show();
|
|
18
|
+
} else {
|
|
19
|
+
lock.getUserInfo(authResult.accessToken, function (error, profile) {
|
|
20
|
+
console.log(error, profile);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// show with options
|
|
26
|
+
const showOptions: Auth0LockShowOptions = {
|
|
27
|
+
allowedConnections: ["twitter", "facebook"],
|
|
28
|
+
allowAutocomplete: true,
|
|
29
|
+
allowPasswordAutocomplete: false,
|
|
30
|
+
allowShowPassword: true,
|
|
31
|
+
allowSignUp: true,
|
|
32
|
+
allowForgotPassword: false,
|
|
33
|
+
auth: {
|
|
34
|
+
autoParseHash: true,
|
|
35
|
+
params: { state: "foo" },
|
|
36
|
+
redirect: true,
|
|
37
|
+
redirectUrl: "some url",
|
|
38
|
+
responseType: "token",
|
|
39
|
+
sso: true,
|
|
40
|
+
},
|
|
41
|
+
initialScreen: "login",
|
|
42
|
+
flashMessage: {
|
|
43
|
+
type: "error",
|
|
44
|
+
text: "an error has occurred",
|
|
45
|
+
},
|
|
46
|
+
language: "en",
|
|
47
|
+
languageDictionary: { title: "test" },
|
|
48
|
+
rememberLastLogin: false,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
lock.show(showOptions);
|
|
52
|
+
|
|
53
|
+
// on / off events
|
|
54
|
+
lock.on("authenticated", function (authResult: AuthResult) {
|
|
55
|
+
lock.getUserInfo(authResult.accessToken, function (error, profile) {
|
|
56
|
+
console.log(error, profile);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
lock.off("authenticated", (authResult) => {});
|
|
61
|
+
|
|
62
|
+
// Theme options
|
|
63
|
+
new Auth0Lock(CLIENT_ID, DOMAIN, {
|
|
64
|
+
theme: {
|
|
65
|
+
authButtons: {
|
|
66
|
+
fooProvider: { displayName: "foo" },
|
|
67
|
+
},
|
|
68
|
+
hideMainScreenTitle: false,
|
|
69
|
+
labeledSubmitButton: false,
|
|
70
|
+
logo: "https://example.com/assets/logo.png",
|
|
71
|
+
primaryColor: "green",
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Auth options
|
|
76
|
+
new Auth0Lock(CLIENT_ID, DOMAIN, {
|
|
77
|
+
auth: {
|
|
78
|
+
autoParseHash: true,
|
|
79
|
+
params: { state: "foo" },
|
|
80
|
+
redirect: true,
|
|
81
|
+
redirectUrl: "some url",
|
|
82
|
+
responseType: "token",
|
|
83
|
+
sso: true,
|
|
84
|
+
audience: "https://api.example.com",
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Previously missing options — these are the options added in this release
|
|
89
|
+
new Auth0Lock(CLIENT_ID, DOMAIN, {
|
|
90
|
+
forceAutoHeight: true,
|
|
91
|
+
mobile: true,
|
|
92
|
+
disableWarnings: true,
|
|
93
|
+
preferConnectionDisplayName: true,
|
|
94
|
+
useCustomPasswordlessConnection: true,
|
|
95
|
+
emailFirst: true,
|
|
96
|
+
connectionResolver: (userInput, context, callback) => {
|
|
97
|
+
callback({ name: "my-connection" });
|
|
98
|
+
},
|
|
99
|
+
hooks: {
|
|
100
|
+
loggingIn: (context, cb) => {
|
|
101
|
+
cb();
|
|
102
|
+
},
|
|
103
|
+
signingUp: (context, cb) => {
|
|
104
|
+
cb();
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// All constructor options
|
|
110
|
+
const allOptions: Auth0LockConstructorOptions = {
|
|
111
|
+
additionalSignUpFields: [{ name: "address", placeholder: "enter your address" }],
|
|
112
|
+
allowedConnections: ["Username-Password-Authentication"],
|
|
113
|
+
allowAutocomplete: true,
|
|
114
|
+
allowForgotPassword: true,
|
|
115
|
+
allowLogin: true,
|
|
116
|
+
allowPasswordAutocomplete: false,
|
|
117
|
+
allowSignUp: true,
|
|
118
|
+
allowShowPassword: true,
|
|
119
|
+
assetsUrl: "https://example.com/assets",
|
|
120
|
+
autoclose: true,
|
|
121
|
+
autofocus: false,
|
|
122
|
+
avatar: null,
|
|
123
|
+
clientBaseUrl: "http://www.example.com",
|
|
124
|
+
closable: true,
|
|
125
|
+
configurationBaseUrl: "https://cdn.auth0.com",
|
|
126
|
+
connectionResolver: (userInput, context, callback) => { callback({ name: "my-connection" }); },
|
|
127
|
+
container: "myContainer",
|
|
128
|
+
defaultADUsernameFromEmailPrefix: false,
|
|
129
|
+
defaultDatabaseConnection: "Username-Password-Authentication",
|
|
130
|
+
defaultEnterpriseConnection: "my-enterprise",
|
|
131
|
+
disableWarnings: false,
|
|
132
|
+
emailFirst: false,
|
|
133
|
+
flashMessage: { type: "success", text: "Logged in!" },
|
|
134
|
+
forceAutoHeight: false,
|
|
135
|
+
forgotPasswordLink: "https://example.com/forgot",
|
|
136
|
+
hashCleanup: true,
|
|
137
|
+
hooks: {
|
|
138
|
+
loggingIn: (context, cb) => { cb(); },
|
|
139
|
+
signingUp: (context, cb) => { cb(); },
|
|
140
|
+
},
|
|
141
|
+
initialScreen: "login",
|
|
142
|
+
language: "en",
|
|
143
|
+
languageBaseUrl: "http://www.example.com",
|
|
144
|
+
languageDictionary: { title: "My App" },
|
|
145
|
+
leeway: 30,
|
|
146
|
+
legacySameSiteCookie: false,
|
|
147
|
+
loginAfterSignUp: true,
|
|
148
|
+
mobile: false,
|
|
149
|
+
mustAcceptTerms: false,
|
|
150
|
+
popupOptions: { width: 500, height: 600, left: 100, top: 100 },
|
|
151
|
+
preferConnectionDisplayName: false,
|
|
152
|
+
prefill: { email: "user@example.com" },
|
|
153
|
+
rememberLastLogin: true,
|
|
154
|
+
scrollGlobalMessagesIntoView: true,
|
|
155
|
+
showTerms: true,
|
|
156
|
+
signUpFieldsStrictValidation: true,
|
|
157
|
+
signUpHideUsernameField: false,
|
|
158
|
+
signUpLink: "https://example.com/signup",
|
|
159
|
+
socialButtonStyle: "big",
|
|
160
|
+
theme: { primaryColor: "#ea5323" },
|
|
161
|
+
useCustomPasswordlessConnection: false,
|
|
162
|
+
usernameStyle: "username",
|
|
163
|
+
_enableImpersonation: false,
|
|
164
|
+
_enableIdPInitiatedLogin: false,
|
|
165
|
+
_sendTelemetry: true,
|
|
166
|
+
_telemetryInfo: { name: "my-sdk", version: "1.0.0", env: { "auth0.js": "9.0.0" } },
|
|
167
|
+
__useTenantInfo: false,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
new Auth0Lock(CLIENT_ID, DOMAIN, allOptions);
|
|
171
|
+
|
|
172
|
+
// Passwordless
|
|
173
|
+
new Auth0LockPasswordless(CLIENT_ID, DOMAIN);
|
|
174
|
+
|
|
175
|
+
new Auth0LockPasswordless(CLIENT_ID, DOMAIN, {
|
|
176
|
+
passwordlessMethod: "code",
|
|
177
|
+
forceAutoHeight: true,
|
|
178
|
+
});
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/// <reference types="auth0-js" />
|
|
2
|
+
|
|
3
|
+
interface Auth0LockAdditionalSignUpFieldOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type Auth0LockAdditionalSignUpFieldOptionsCallback = (
|
|
9
|
+
error: auth0.Auth0Error,
|
|
10
|
+
options: Auth0LockAdditionalSignUpFieldOption[],
|
|
11
|
+
) => void;
|
|
12
|
+
|
|
13
|
+
type Auth0LockAdditionalSignUpFieldOptionsFunction = (callback: Auth0LockAdditionalSignUpFieldOptionsCallback) => void;
|
|
14
|
+
|
|
15
|
+
type Auth0LockAdditionalSignUpFieldPrefillCallback = (error: auth0.Auth0Error, prefill: string) => void;
|
|
16
|
+
|
|
17
|
+
type Auth0LockAdditionalSignUpFieldPrefillFunction = (callback: Auth0LockAdditionalSignUpFieldPrefillCallback) => void;
|
|
18
|
+
|
|
19
|
+
interface Auth0LockAdditionalTextSignUpField {
|
|
20
|
+
type?: "text" | undefined;
|
|
21
|
+
icon?: string | undefined;
|
|
22
|
+
name: string;
|
|
23
|
+
options?: Auth0LockAdditionalSignUpFieldOption[] | Auth0LockAdditionalSignUpFieldOptionsFunction | undefined;
|
|
24
|
+
placeholder: string;
|
|
25
|
+
prefill?: string | Auth0LockAdditionalSignUpFieldPrefillFunction | undefined;
|
|
26
|
+
validator?: ((input: string) => { valid: boolean; hint?: string | undefined }) | undefined;
|
|
27
|
+
storage?: "root" | undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface Auth0LockAdditionalSelectSignUpField {
|
|
31
|
+
type?: "select" | undefined;
|
|
32
|
+
icon?: string | undefined;
|
|
33
|
+
name: string;
|
|
34
|
+
options?: Auth0LockAdditionalSignUpFieldOption[] | Auth0LockAdditionalSignUpFieldOptionsFunction | undefined;
|
|
35
|
+
placeholder: string;
|
|
36
|
+
prefill?: string | Auth0LockAdditionalSignUpFieldPrefillFunction | undefined;
|
|
37
|
+
validator?: ((input: string) => { valid: boolean; hint?: string | undefined }) | undefined;
|
|
38
|
+
storage?: "root" | undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface Auth0LockAdditionalCheckboxSignUpField {
|
|
42
|
+
type?: "checkbox" | undefined;
|
|
43
|
+
icon?: string | undefined;
|
|
44
|
+
name: string;
|
|
45
|
+
placeholder: string;
|
|
46
|
+
prefill: "true" | "false";
|
|
47
|
+
validator?: ((input: string) => { valid: boolean; hint?: string | undefined }) | undefined;
|
|
48
|
+
storage?: "root" | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface Auth0LockAdditionalHiddenSignUpField {
|
|
52
|
+
type?: "hidden" | undefined;
|
|
53
|
+
name: string;
|
|
54
|
+
value: string;
|
|
55
|
+
storage?: "root" | undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type Auth0LockAdditionalSignUpField =
|
|
59
|
+
| Auth0LockAdditionalSelectSignUpField
|
|
60
|
+
| Auth0LockAdditionalTextSignUpField
|
|
61
|
+
| Auth0LockAdditionalCheckboxSignUpField
|
|
62
|
+
| Auth0LockAdditionalHiddenSignUpField;
|
|
63
|
+
|
|
64
|
+
type Auth0LockAvatarUrlCallback = (error: auth0.Auth0Error, url: string) => void;
|
|
65
|
+
type Auth0LockAvatarDisplayNameCallback = (error: auth0.Auth0Error, displayName: string) => void;
|
|
66
|
+
|
|
67
|
+
interface Auth0LockAvatarOptions {
|
|
68
|
+
url: (email: string, callback: Auth0LockAvatarUrlCallback) => void;
|
|
69
|
+
displayName: (email: string, callback: Auth0LockAvatarDisplayNameCallback) => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface Auth0LockThemeButton {
|
|
73
|
+
displayName: string;
|
|
74
|
+
primaryColor?: string | undefined;
|
|
75
|
+
foregroundColor?: string | undefined;
|
|
76
|
+
icon?: string | undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface Auth0LockThemeButtonOptions {
|
|
80
|
+
[provider: string]: Auth0LockThemeButton;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface Auth0LockThemeOptions {
|
|
84
|
+
authButtons?: Auth0LockThemeButtonOptions | undefined;
|
|
85
|
+
hideMainScreenTitle?: boolean | undefined;
|
|
86
|
+
labeledSubmitButton?: boolean | undefined;
|
|
87
|
+
logo?: string | undefined;
|
|
88
|
+
primaryColor?: string | undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// https://auth0.com/docs/libraries/lock/v10/sending-authentication-parameters
|
|
92
|
+
interface Auth0LockAuthParamsOptions {
|
|
93
|
+
access_token?: any;
|
|
94
|
+
connection_scope?: any;
|
|
95
|
+
device?: any;
|
|
96
|
+
nonce?: any;
|
|
97
|
+
protocol?: any;
|
|
98
|
+
request_id?: any;
|
|
99
|
+
scope?: string | undefined;
|
|
100
|
+
state?: string | undefined;
|
|
101
|
+
[key: string]: any; // Auth0 rules can use custom params.
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface Auth0LockAuthOptions {
|
|
105
|
+
autoParseHash?: boolean | undefined;
|
|
106
|
+
params?: Auth0LockAuthParamsOptions | undefined;
|
|
107
|
+
redirect?: boolean | undefined;
|
|
108
|
+
redirectUrl?: string | undefined;
|
|
109
|
+
responseMode?: string | undefined;
|
|
110
|
+
responseType?: string | undefined;
|
|
111
|
+
sso?: boolean | undefined;
|
|
112
|
+
audience?: string | undefined;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface Auth0LockPopupOptions {
|
|
116
|
+
width: number;
|
|
117
|
+
height: number;
|
|
118
|
+
left: number;
|
|
119
|
+
top: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Hooks that can be used to integrate into various procedures within Lock.
|
|
123
|
+
// Both hooks receive a context (currently always null) and a callback that
|
|
124
|
+
// must be called when the hook is finished. Execution is blocked until cb() is called.
|
|
125
|
+
interface Auth0LockHooks {
|
|
126
|
+
loggingIn?: ((context: null, cb: () => void) => void) | undefined;
|
|
127
|
+
signingUp?: ((context: null, cb: () => void) => void) | undefined;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface Auth0LockConstructorOptions {
|
|
131
|
+
additionalSignUpFields?: Auth0LockAdditionalSignUpField[] | undefined;
|
|
132
|
+
allowedConnections?: string[] | undefined;
|
|
133
|
+
allowAutocomplete?: boolean | undefined;
|
|
134
|
+
allowForgotPassword?: boolean | undefined;
|
|
135
|
+
allowLogin?: boolean | undefined;
|
|
136
|
+
allowPasswordAutocomplete?: boolean | undefined;
|
|
137
|
+
allowSignUp?: boolean | undefined;
|
|
138
|
+
allowShowPassword?: boolean | undefined;
|
|
139
|
+
assetsUrl?: string | undefined;
|
|
140
|
+
auth?: Auth0LockAuthOptions | undefined;
|
|
141
|
+
autoclose?: boolean | undefined;
|
|
142
|
+
autofocus?: boolean | undefined;
|
|
143
|
+
avatar?: Auth0LockAvatarOptions | null | undefined;
|
|
144
|
+
clientBaseUrl?: string | undefined;
|
|
145
|
+
closable?: boolean | undefined;
|
|
146
|
+
configurationBaseUrl?: string | undefined;
|
|
147
|
+
connectionResolver?: ((userInput: string, context: any, callback: (connection: any) => void) => void) | undefined;
|
|
148
|
+
container?: string | undefined;
|
|
149
|
+
defaultADUsernameFromEmailPrefix?: boolean | undefined;
|
|
150
|
+
defaultDatabaseConnection?: string | undefined;
|
|
151
|
+
defaultEnterpriseConnection?: string | undefined;
|
|
152
|
+
disableWarnings?: boolean | undefined;
|
|
153
|
+
emailFirst?: boolean | undefined;
|
|
154
|
+
flashMessage?: Auth0LockFlashMessageOptions | undefined;
|
|
155
|
+
forceAutoHeight?: boolean | undefined;
|
|
156
|
+
forgotPasswordLink?: string | undefined;
|
|
157
|
+
hashCleanup?: boolean | undefined;
|
|
158
|
+
hooks?: Auth0LockHooks | undefined;
|
|
159
|
+
initialScreen?: "login" | "signUp" | "forgotPassword" | undefined;
|
|
160
|
+
language?: string | undefined;
|
|
161
|
+
languageBaseUrl?: string | undefined;
|
|
162
|
+
languageDictionary?: any;
|
|
163
|
+
leeway?: number | undefined;
|
|
164
|
+
legacySameSiteCookie?: boolean | undefined;
|
|
165
|
+
loginAfterSignUp?: boolean | undefined;
|
|
166
|
+
mobile?: boolean | undefined;
|
|
167
|
+
mustAcceptTerms?: boolean | undefined;
|
|
168
|
+
popupOptions?: Auth0LockPopupOptions | undefined;
|
|
169
|
+
preferConnectionDisplayName?: boolean | undefined;
|
|
170
|
+
prefill?: { email?: string | undefined; username?: string | undefined } | undefined;
|
|
171
|
+
rememberLastLogin?: boolean | undefined;
|
|
172
|
+
scrollGlobalMessagesIntoView?: boolean | undefined;
|
|
173
|
+
showTerms?: boolean | undefined;
|
|
174
|
+
signUpFieldsStrictValidation?: boolean | undefined;
|
|
175
|
+
signUpHideUsernameField?: boolean | undefined;
|
|
176
|
+
signUpLink?: string | undefined;
|
|
177
|
+
socialButtonStyle?: "big" | "small" | undefined;
|
|
178
|
+
theme?: Auth0LockThemeOptions | undefined;
|
|
179
|
+
useCustomPasswordlessConnection?: boolean | undefined;
|
|
180
|
+
usernameStyle?: "email" | "username" | undefined;
|
|
181
|
+
_enableImpersonation?: boolean | undefined;
|
|
182
|
+
_enableIdPInitiatedLogin?: boolean | undefined;
|
|
183
|
+
_sendTelemetry?: boolean | undefined;
|
|
184
|
+
_telemetryInfo?: { name?: string | undefined; version?: string | undefined; env?: Record<string, string> | undefined } | undefined;
|
|
185
|
+
__useTenantInfo?: boolean | undefined;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
interface Auth0LockFlashMessageOptions {
|
|
189
|
+
type: "success" | "error" | "info";
|
|
190
|
+
text: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface Auth0LockShowOptions {
|
|
194
|
+
allowedConnections?: string[] | undefined;
|
|
195
|
+
allowAutocomplete?: boolean | undefined;
|
|
196
|
+
allowForgotPassword?: boolean | undefined;
|
|
197
|
+
allowLogin?: boolean | undefined;
|
|
198
|
+
allowPasswordAutocomplete?: boolean | undefined;
|
|
199
|
+
allowShowPassword?: boolean | undefined;
|
|
200
|
+
allowSignUp?: boolean | undefined;
|
|
201
|
+
auth?: Auth0LockAuthOptions | undefined;
|
|
202
|
+
initialScreen?: "login" | "signUp" | "forgotPassword" | undefined;
|
|
203
|
+
flashMessage?: Auth0LockFlashMessageOptions | undefined;
|
|
204
|
+
language?: string | undefined;
|
|
205
|
+
languageDictionary?: any;
|
|
206
|
+
rememberLastLogin?: boolean | undefined;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
interface Auth0IdTokenPayload {
|
|
210
|
+
name?: string | undefined;
|
|
211
|
+
nickname?: string | undefined;
|
|
212
|
+
picture?: string | undefined;
|
|
213
|
+
email?: string | undefined;
|
|
214
|
+
email_verified?: boolean | undefined;
|
|
215
|
+
aud: string;
|
|
216
|
+
exp: number;
|
|
217
|
+
iat: number;
|
|
218
|
+
iss: string;
|
|
219
|
+
sub: string;
|
|
220
|
+
acr?: string | undefined;
|
|
221
|
+
amr?: string[] | undefined;
|
|
222
|
+
[key: string]: any;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
interface AuthResult {
|
|
226
|
+
accessToken: string;
|
|
227
|
+
appState?: any;
|
|
228
|
+
expiresIn: number;
|
|
229
|
+
idToken: string;
|
|
230
|
+
idTokenPayload: Auth0IdTokenPayload;
|
|
231
|
+
refreshToken?: string | undefined;
|
|
232
|
+
scope?: string | undefined;
|
|
233
|
+
state: string;
|
|
234
|
+
tokenType: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface Auth0LockCore {
|
|
238
|
+
// deprecated
|
|
239
|
+
getProfile(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void;
|
|
240
|
+
getUserInfo(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void;
|
|
241
|
+
checkSession(
|
|
242
|
+
options: Auth0LockAuthParamsOptions,
|
|
243
|
+
callback: (error: auth0.Auth0Error, authResult: AuthResult | undefined) => void,
|
|
244
|
+
): void;
|
|
245
|
+
resumeAuth(hash: string, callback: (error: auth0.Auth0Error, authResult: AuthResult) => void): void;
|
|
246
|
+
show(options?: Auth0LockShowOptions): void;
|
|
247
|
+
hide(): void;
|
|
248
|
+
logout(query: any): void;
|
|
249
|
+
|
|
250
|
+
on(event: "show" | "hide", callback: () => void): void;
|
|
251
|
+
on(event: "unrecoverable_error" | "authorization_error", callback: (error: auth0.Auth0Error) => void): void;
|
|
252
|
+
on(event: "authenticated", callback: (authResult: AuthResult) => void): void;
|
|
253
|
+
on(event: string, callback: (...args: any[]) => void): void;
|
|
254
|
+
|
|
255
|
+
off(event: "show" | "hide", callback: () => void): void;
|
|
256
|
+
off(event: "unrecoverable_error" | "authorization_error", callback: (error: auth0.Auth0Error) => void): void;
|
|
257
|
+
off(event: "authenticated", callback: (authResult: AuthResult) => void): void;
|
|
258
|
+
off(event: string, callback: (...args: any[]) => void): void;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
interface Auth0LockStatic extends Auth0LockCore {
|
|
262
|
+
new(clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// additional options for passwordless mode
|
|
266
|
+
interface Auth0LockPasswordlessConstructorOptions extends Auth0LockConstructorOptions {
|
|
267
|
+
passwordlessMethod?: "code" | "link" | undefined;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface Auth0LockPasswordlessStatic extends Auth0LockCore {
|
|
271
|
+
new(
|
|
272
|
+
clientId: string,
|
|
273
|
+
domain: string,
|
|
274
|
+
options?: Auth0LockPasswordlessConstructorOptions,
|
|
275
|
+
): Auth0LockPasswordlessStatic;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare module "auth0-lock" {
|
|
279
|
+
export default Auth0Lock;
|
|
280
|
+
export const Auth0Lock: Auth0LockStatic;
|
|
281
|
+
export const Auth0LockPasswordless: Auth0LockPasswordlessStatic;
|
|
282
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": ["es6", "dom"],
|
|
5
|
+
"noImplicitAny": true,
|
|
6
|
+
"noImplicitThis": true,
|
|
7
|
+
"strictNullChecks": true,
|
|
8
|
+
"strictFunctionTypes": true,
|
|
9
|
+
"strictBindCallApply": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"baseUrl": "..",
|
|
13
|
+
"paths": {
|
|
14
|
+
"auth0-lock": ["types/index.d.ts"]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"index.d.ts",
|
|
19
|
+
"auth0-lock-tests.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|