auth0-lock 11.35.0 → 12.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/.browserslistrc +1 -0
- package/.circleci/config.yml +3 -1
- package/.shiprc +4 -5
- package/CHANGELOG.md +25 -0
- package/DEVELOPMENT.md +1 -1
- package/README.md +20 -16
- package/karma.conf.js +1 -1
- package/lib/CSSCore.js +1 -4
- package/lib/__tests__/auth_button.js +12 -22
- package/lib/__tests__/connection/database/actions.js +48 -49
- package/lib/__tests__/connection/database/index.js +22 -28
- package/lib/__tests__/connection/database/login_pane.js +24 -47
- package/lib/__tests__/connection/database/password_reset_confirmation.js +23 -32
- package/lib/__tests__/connection/database/reset_password.js +17 -39
- package/lib/__tests__/connection/database/signed_up_confirmation.js +23 -32
- package/lib/__tests__/connection/enterprise/actions.js +22 -47
- package/lib/__tests__/connection/enterprise/hrd_pane.js +16 -33
- package/lib/__tests__/connection/enterprise/hrd_screen.js +26 -40
- package/lib/__tests__/connection/enterprise/quick_auth_screen.js +32 -75
- package/lib/__tests__/connection/passwordless/ask_vcode.js +29 -51
- package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +23 -32
- package/lib/__tests__/connection/passwordless/passwordless.js +35 -97
- package/lib/__tests__/core/actions.js +23 -46
- package/lib/__tests__/core/client/index.js +10 -13
- package/lib/__tests__/core/index.js +46 -94
- package/lib/__tests__/core/remote_data.js +14 -20
- package/lib/__tests__/core/signed_in_confirmation.js +23 -32
- package/lib/__tests__/core/sso/last_login_screen.js +27 -50
- package/lib/__tests__/core/tenant.js +10 -12
- package/lib/__tests__/core/web_api/helper.js +6 -14
- package/lib/__tests__/core/web_api/p2_api.js +38 -33
- package/lib/__tests__/core/web_api.js +37 -33
- package/lib/__tests__/engine/classic/login.js +20 -41
- package/lib/__tests__/engine/classic/mfa_login_screen.js +6 -19
- package/lib/__tests__/engine/classic/sign_up_pane.js +33 -55
- package/lib/__tests__/engine/classic/sign_up_screen.js +18 -45
- package/lib/__tests__/engine/classic.js +13 -6
- package/lib/__tests__/engine/passwordless/social_or_email_login_screen.js +7 -28
- package/lib/__tests__/engine/passwordless/social_or_phone_number_login_screen.js +7 -28
- package/lib/__tests__/engine/passwordless.js +2 -5
- package/lib/__tests__/field/captcha/recaptcha_enterprise.js +27 -27
- package/lib/__tests__/field/captcha/recaptchav2.js +27 -27
- package/lib/__tests__/field/captcha.js +39 -51
- package/lib/__tests__/field/custom_input.js +23 -47
- package/lib/__tests__/field/email.js +2 -3
- package/lib/__tests__/field/email_pane.js +25 -48
- package/lib/__tests__/field/field.js +9 -13
- package/lib/__tests__/field/login_pane.js +30 -34
- package/lib/__tests__/field/mfa_code_pane.js +13 -28
- package/lib/__tests__/field/option_selection_pane.js +7 -25
- package/lib/__tests__/field/password.js +6 -12
- package/lib/__tests__/field/password_pane.js +29 -46
- package/lib/__tests__/field/phone_number_pane.js +18 -41
- package/lib/__tests__/field/social_buttons_pane.js +30 -47
- package/lib/__tests__/field/username.js +27 -48
- package/lib/__tests__/field/username_pane.js +30 -47
- package/lib/__tests__/field/vcode.js +5 -13
- package/lib/__tests__/field/vcode_pane.js +20 -44
- package/lib/__tests__/i18n.js +28 -53
- package/lib/__tests__/quick-auth/actions.js +4 -27
- package/lib/__tests__/setup-tests.js +7 -9
- package/lib/__tests__/testUtils.js +41 -58
- package/lib/__tests__/ui/box/chrome.js +24 -49
- package/lib/__tests__/ui/box/confirmation_pane.js +23 -42
- package/lib/__tests__/ui/box/container.js +21 -46
- package/lib/__tests__/ui/box/global_message.js +60 -37
- package/lib/__tests__/ui/input/email_input.js +6 -17
- package/lib/__tests__/ui/input/input_wrap.js +6 -19
- package/lib/__tests__/ui/input/password/password_strength.js +13 -15
- package/lib/__tests__/ui/input/password_input.js +22 -27
- package/lib/__tests__/utils/format.js +10 -17
- package/lib/__tests__/utils/url_utils.js +2 -5
- package/lib/avatar/gravatar_provider.js +13 -28
- package/lib/avatar.js +22 -41
- package/lib/browser.js +372 -23
- package/lib/connection/captcha.js +15 -34
- package/lib/connection/database/actions.js +39 -108
- package/lib/connection/database/index.js +90 -191
- package/lib/connection/database/login_pane.js +107 -147
- package/lib/connection/database/login_sign_up_tabs.js +106 -125
- package/lib/connection/database/mfa_pane.js +50 -69
- package/lib/connection/database/password_reset_confirmation.js +51 -73
- package/lib/connection/database/reset_password.js +116 -132
- package/lib/connection/database/reset_password_pane.js +45 -56
- package/lib/connection/database/sign_up_terms.js +17 -23
- package/lib/connection/database/signed_up_confirmation.js +52 -75
- package/lib/connection/enterprise/actions.js +23 -52
- package/lib/connection/enterprise/hrd_pane.js +60 -76
- package/lib/connection/enterprise/hrd_screen.js +60 -75
- package/lib/connection/enterprise/kerberos_screen.js +46 -60
- package/lib/connection/enterprise/quick_auth_screen.js +46 -64
- package/lib/connection/enterprise/single_sign_on_notice.js +14 -26
- package/lib/connection/enterprise.js +51 -84
- package/lib/connection/passwordless/actions.js +29 -65
- package/lib/connection/passwordless/ask_vcode.js +53 -60
- package/lib/connection/passwordless/email_sent_confirmation.js +129 -179
- package/lib/connection/passwordless/index.js +36 -68
- package/lib/connection/social/index.js +12 -15
- package/lib/core/actions.js +33 -85
- package/lib/core/client/index.js +38 -58
- package/lib/core/client/settings.js +12 -20
- package/lib/core/error_screen.js +38 -52
- package/lib/core/index.js +154 -305
- package/lib/core/loading_screen.js +61 -71
- package/lib/core/pane_separator.js +10 -10
- package/lib/core/remote_data.js +30 -51
- package/lib/core/screen.js +85 -79
- package/lib/core/signed_in_confirmation.js +51 -73
- package/lib/core/sso/data.js +9 -17
- package/lib/core/sso/index.js +5 -6
- package/lib/core/sso/last_login_screen.js +46 -63
- package/lib/core/tenant/index.js +37 -59
- package/lib/core/tenant/settings.js +11 -15
- package/lib/core/web_api/helper.js +22 -28
- package/lib/core/web_api/p2_api.js +162 -171
- package/lib/core/web_api.js +106 -94
- package/lib/core.js +126 -160
- package/lib/engine/classic/login.js +92 -144
- package/lib/engine/classic/mfa_login_screen.js +61 -67
- package/lib/engine/classic/sign_up_pane.js +89 -123
- package/lib/engine/classic/sign_up_screen.js +112 -158
- package/lib/engine/classic.js +122 -183
- package/lib/engine/passwordless/social_or_email_login_screen.js +80 -116
- package/lib/engine/passwordless/social_or_phone_number_login_screen.js +79 -110
- package/lib/engine/passwordless.js +75 -104
- package/lib/field/actions.js +11 -17
- package/lib/field/captcha/captcha_pane.js +83 -103
- package/lib/field/captcha/recaptcha.js +140 -145
- package/lib/field/captcha.js +7 -10
- package/lib/field/custom_input.js +37 -50
- package/lib/field/email/email_pane.js +90 -109
- package/lib/field/email.js +17 -35
- package/lib/field/index.js +50 -87
- package/lib/field/mfa-code/mfa_code_pane.js +57 -71
- package/lib/field/mfa_code.js +15 -21
- package/lib/field/option_selection_pane.js +16 -22
- package/lib/field/password/password_pane.js +79 -91
- package/lib/field/password.js +8 -14
- package/lib/field/phone-number/locations.js +7 -3
- package/lib/field/phone-number/phone_number_pane.js +87 -124
- package/lib/field/phone_number.js +16 -30
- package/lib/field/social/event.js +9 -12
- package/lib/field/social/social_buttons_pane.js +93 -121
- package/lib/field/username/username_pane.js +105 -123
- package/lib/field/username.js +16 -26
- package/lib/field/vcode/vcode_pane.js +67 -93
- package/lib/field/vcode.js +5 -5
- package/lib/i18n/af.js +7 -4
- package/lib/i18n/ar.js +7 -4
- package/lib/i18n/az.js +7 -4
- package/lib/i18n/bg.js +7 -4
- package/lib/i18n/ca.js +7 -4
- package/lib/i18n/cs.js +7 -4
- package/lib/i18n/da.js +7 -4
- package/lib/i18n/de.js +7 -3
- package/lib/i18n/el.js +7 -4
- package/lib/i18n/en.js +9 -4
- package/lib/i18n/es.js +7 -3
- package/lib/i18n/et.js +7 -4
- package/lib/i18n/fa.js +7 -4
- package/lib/i18n/fi.js +7 -4
- package/lib/i18n/fr.js +7 -4
- package/lib/i18n/he.js +7 -4
- package/lib/i18n/hr.js +7 -4
- package/lib/i18n/hu.js +7 -4
- package/lib/i18n/id.js +7 -4
- package/lib/i18n/it.js +7 -3
- package/lib/i18n/ja.js +7 -4
- package/lib/i18n/ko.js +7 -4
- package/lib/i18n/lt.js +7 -4
- package/lib/i18n/lv.js +7 -4
- package/lib/i18n/ms.js +7 -4
- package/lib/i18n/nb.js +7 -4
- package/lib/i18n/nl.js +7 -4
- package/lib/i18n/nn.js +7 -4
- package/lib/i18n/no.js +7 -4
- package/lib/i18n/pl.js +7 -4
- package/lib/i18n/pt-br.js +7 -3
- package/lib/i18n/pt.js +7 -4
- package/lib/i18n/ro.js +7 -4
- package/lib/i18n/ru.js +7 -4
- package/lib/i18n/sk.js +7 -4
- package/lib/i18n/sl.js +7 -4
- package/lib/i18n/sr.js +7 -4
- package/lib/i18n/sv.js +7 -4
- package/lib/i18n/tr.js +7 -4
- package/lib/i18n/ua.js +7 -4
- package/lib/i18n/uk.js +7 -4
- package/lib/i18n/vi.js +7 -4
- package/lib/i18n/zh-tw.js +7 -4
- package/lib/i18n/zh.js +7 -4
- package/lib/i18n.js +38 -75
- package/lib/index.js +14 -17
- package/lib/lock.js +29 -32
- package/lib/passwordless.js +29 -31
- package/lib/quick-auth/actions.js +19 -26
- package/lib/quick_auth.js +8 -10
- package/lib/sanitizer.js +5 -5
- package/lib/store/index.js +22 -42
- package/lib/sync.js +21 -42
- package/lib/ui/box/button.js +85 -105
- package/lib/ui/box/chrome.js +463 -548
- package/lib/ui/box/confirmation_pane.js +34 -48
- package/lib/ui/box/container.js +305 -339
- package/lib/ui/box/global_message.js +51 -60
- package/lib/ui/box/header.js +155 -177
- package/lib/ui/box/multisize_slide.js +233 -229
- package/lib/ui/box/success_pane.js +34 -37
- package/lib/ui/box.js +88 -93
- package/lib/ui/button/auth_button.js +44 -51
- package/lib/ui/input/captcha_input.js +162 -181
- package/lib/ui/input/checkbox_input.js +57 -59
- package/lib/ui/input/email_input.js +117 -124
- package/lib/ui/input/input_wrap.js +65 -80
- package/lib/ui/input/location_input.js +130 -150
- package/lib/ui/input/mfa_code_input.js +98 -98
- package/lib/ui/input/password/password_strength.js +103 -127
- package/lib/ui/input/password_input.js +141 -147
- package/lib/ui/input/phone_number_input.js +101 -109
- package/lib/ui/input/select_input.js +120 -132
- package/lib/ui/input/text_input.js +89 -84
- package/lib/ui/input/username_input.js +109 -115
- package/lib/ui/input/vcode_input.js +110 -118
- package/lib/ui/list.js +224 -247
- package/lib/ui/pane/quick_auth_pane.js +55 -80
- package/lib/utils/atom.js +55 -48
- package/lib/utils/cache.js +54 -43
- package/lib/utils/cdn_utils.js +17 -31
- package/lib/utils/createRef.js +3 -1
- package/lib/utils/data_utils.js +10 -16
- package/lib/utils/fn_utils.js +5 -4
- package/lib/utils/format.js +6 -8
- package/lib/utils/id_utils.js +4 -3
- package/lib/utils/jsonp_utils.js +20 -17
- package/lib/utils/media_utils.js +4 -2
- package/lib/utils/preload_utils.js +4 -3
- package/lib/utils/string_utils.js +4 -4
- package/lib/utils/url_utils.js +4 -3
- package/package.json +48 -34
- package/webpack.config.js +36 -3
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getVersion = getVersion;
|
|
5
7
|
exports.loginCallback = loginCallback;
|
|
6
8
|
exports.normalizeAuthParams = normalizeAuthParams;
|
|
7
|
-
exports.
|
|
9
|
+
exports.normalizeError = normalizeError;
|
|
8
10
|
exports.trimAuthParams = trimAuthParams;
|
|
9
|
-
exports.
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
11
|
+
exports.webAuthOverrides = webAuthOverrides;
|
|
12
|
+
var _excluded = ["popup"];
|
|
13
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
14
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
20
|
function normalizeError(error, domain) {
|
|
14
21
|
if (!error) {
|
|
15
22
|
return error;
|
|
@@ -40,7 +47,6 @@ function normalizeError(error, domain) {
|
|
|
40
47
|
description: 'Popup window closed.'
|
|
41
48
|
};
|
|
42
49
|
}
|
|
43
|
-
|
|
44
50
|
if (error.code === 'unauthorized') {
|
|
45
51
|
// Custom rule error
|
|
46
52
|
//
|
|
@@ -113,15 +119,12 @@ function normalizeError(error, domain) {
|
|
|
113
119
|
description: error.description
|
|
114
120
|
};
|
|
115
121
|
}
|
|
116
|
-
|
|
117
122
|
if (error.code === 'invalid_captcha') {
|
|
118
123
|
var _ref;
|
|
119
|
-
|
|
120
124
|
return _ref = {
|
|
121
125
|
code: 'invalid_captcha'
|
|
122
|
-
}, _ref
|
|
126
|
+
}, _defineProperty(_ref, "code", 'invalid_captcha'), _defineProperty(_ref, "description", error.description), _ref;
|
|
123
127
|
}
|
|
124
|
-
|
|
125
128
|
var result = {
|
|
126
129
|
error: error.code ? error.code : error.statusCode || error.error,
|
|
127
130
|
description: error.description || error.code
|
|
@@ -130,7 +133,6 @@ function normalizeError(error, domain) {
|
|
|
130
133
|
// result is used for passwordless and error for database.
|
|
131
134
|
return result.error === undefined && result.description === undefined ? error : result;
|
|
132
135
|
}
|
|
133
|
-
|
|
134
136
|
function loginCallback(redirect, domain, cb) {
|
|
135
137
|
return redirect ? function (error) {
|
|
136
138
|
return cb(normalizeError(error, domain));
|
|
@@ -138,20 +140,16 @@ function loginCallback(redirect, domain, cb) {
|
|
|
138
140
|
return cb(normalizeError(error, domain), result);
|
|
139
141
|
};
|
|
140
142
|
}
|
|
141
|
-
|
|
142
143
|
function normalizeAuthParams(_ref2) {
|
|
143
144
|
var popup = _ref2.popup,
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
authParams = _objectWithoutProperties(_ref2, _excluded);
|
|
146
146
|
return authParams;
|
|
147
147
|
}
|
|
148
|
-
|
|
149
148
|
function webAuthOverrides() {
|
|
150
149
|
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
__tenant = _ref3.__tenant,
|
|
151
|
+
__token_issuer = _ref3.__token_issuer,
|
|
152
|
+
__jwks_uri = _ref3.__jwks_uri;
|
|
155
153
|
if (__tenant || __token_issuer || __jwks_uri) {
|
|
156
154
|
return {
|
|
157
155
|
__tenant: __tenant,
|
|
@@ -161,12 +159,9 @@ function webAuthOverrides() {
|
|
|
161
159
|
}
|
|
162
160
|
return null;
|
|
163
161
|
}
|
|
164
|
-
|
|
165
162
|
function trimAuthParams() {
|
|
166
163
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
167
|
-
|
|
168
|
-
var p = _objectWithoutProperties(params, []);
|
|
169
|
-
|
|
164
|
+
var p = Object.assign({}, (_objectDestructuringEmpty(params), params));
|
|
170
165
|
['username', 'email', 'phoneNumber', 'mfa_code'].forEach(function (k) {
|
|
171
166
|
if (typeof p[k] === 'string') {
|
|
172
167
|
p[k] = p[k].trim();
|
|
@@ -174,7 +169,6 @@ function trimAuthParams() {
|
|
|
174
169
|
});
|
|
175
170
|
return p;
|
|
176
171
|
}
|
|
177
|
-
|
|
178
172
|
function getVersion() {
|
|
179
|
-
return
|
|
173
|
+
return "12.0.0";
|
|
180
174
|
}
|
|
@@ -1,31 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _auth0Js = require(
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var _qs = require('qs');
|
|
12
|
-
|
|
13
|
-
var _qs2 = _interopRequireDefault(_qs);
|
|
14
|
-
|
|
15
|
-
var _cordovaAuth0PluginMin = require('auth0-js/dist/cordova-auth0-plugin.min.js');
|
|
16
|
-
|
|
17
|
-
var _cordovaAuth0PluginMin2 = _interopRequireDefault(_cordovaAuth0PluginMin);
|
|
18
|
-
|
|
19
|
-
var _helper = require('./helper');
|
|
20
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _auth0Js = _interopRequireDefault(require("auth0-js"));
|
|
8
|
+
var _qs = _interopRequireDefault(require("qs"));
|
|
9
|
+
var _cordovaAuth0PluginMin = _interopRequireDefault(require("auth0-js/dist/cordova-auth0-plugin.min.js"));
|
|
10
|
+
var _helper = require("./helper");
|
|
21
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
|
|
12
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
16
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
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); } }
|
|
18
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
20
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
21
|
+
var Auth0APIClient = /*#__PURE__*/function () {
|
|
26
22
|
function Auth0APIClient(lockID, clientID, domain, opts) {
|
|
27
23
|
_classCallCheck(this, Auth0APIClient);
|
|
28
|
-
|
|
29
24
|
this.lockID = lockID;
|
|
30
25
|
this.client = null;
|
|
31
26
|
this.authOpt = null;
|
|
@@ -33,20 +28,16 @@ var Auth0APIClient = function () {
|
|
|
33
28
|
this.isUniversalLogin = window.location.host === domain;
|
|
34
29
|
this._enableIdPInitiatedLogin = !!(opts._enableIdPInitiatedLogin || opts._enableImpersonation);
|
|
35
30
|
var telemetry = this.getTelemetryInfo(opts._telemetryInfo);
|
|
36
|
-
|
|
37
31
|
var state = opts.state;
|
|
38
32
|
if (opts.params && opts.params.state) {
|
|
39
33
|
state = opts.params.state;
|
|
40
34
|
}
|
|
41
|
-
|
|
42
35
|
var nonce = opts.nonce;
|
|
43
36
|
if (opts.params && opts.params.nonce) {
|
|
44
37
|
nonce = opts.params.nonce;
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
var scope = opts.params && opts.params.scope;
|
|
48
|
-
|
|
49
|
-
this.client = new _auth0Js2.default.WebAuth({
|
|
40
|
+
this.client = new _auth0Js.default.WebAuth({
|
|
50
41
|
clientID: clientID,
|
|
51
42
|
domain: domain,
|
|
52
43
|
audience: opts.audience,
|
|
@@ -54,7 +45,7 @@ var Auth0APIClient = function () {
|
|
|
54
45
|
responseMode: opts.responseMode,
|
|
55
46
|
responseType: opts.responseType,
|
|
56
47
|
leeway: opts.leeway || 60,
|
|
57
|
-
plugins: opts.plugins || [new
|
|
48
|
+
plugins: opts.plugins || [new _cordovaAuth0PluginMin.default()],
|
|
58
49
|
overrides: (0, _helper.webAuthOverrides)(opts.overrides),
|
|
59
50
|
_sendTelemetry: opts._sendTelemetry === false ? false : true,
|
|
60
51
|
_telemetryInfo: telemetry,
|
|
@@ -63,7 +54,6 @@ var Auth0APIClient = function () {
|
|
|
63
54
|
scope: scope,
|
|
64
55
|
legacySameSiteCookie: opts.legacySameSiteCookie
|
|
65
56
|
});
|
|
66
|
-
|
|
67
57
|
this.authOpt = {
|
|
68
58
|
popup: !opts.redirect,
|
|
69
59
|
popupOptions: opts.popupOptions,
|
|
@@ -75,152 +65,153 @@ var Auth0APIClient = function () {
|
|
|
75
65
|
this.authOpt.sso = opts.sso;
|
|
76
66
|
}
|
|
77
67
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
_createClass(Auth0APIClient, [{
|
|
69
|
+
key: "getTelemetryInfo",
|
|
70
|
+
value: function getTelemetryInfo(telemetryOverride) {
|
|
71
|
+
var telemetry;
|
|
72
|
+
var _qs$parse = _qs.default.parse(window.location.search.substr(1)),
|
|
83
73
|
auth0Client = _qs$parse.auth0Client;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
74
|
+
var ulpTelemetry = auth0Client && JSON.parse(atob(auth0Client));
|
|
75
|
+
if (this.isUniversalLogin && ulpTelemetry) {
|
|
76
|
+
var _objectSpread2;
|
|
77
|
+
telemetry = _objectSpread(_objectSpread({}, ulpTelemetry), {}, {
|
|
78
|
+
env: _objectSpread(_objectSpread({}, ulpTelemetry.env), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, 'lock.js-ulp', (0, _helper.getVersion)()), _defineProperty(_objectSpread2, 'auth0.js-ulp', _auth0Js.default.version.raw), _objectSpread2))
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (this.isUniversalLogin && !ulpTelemetry) {
|
|
82
|
+
telemetry = {
|
|
83
|
+
name: 'lock.js-ulp',
|
|
84
|
+
version: (0, _helper.getVersion)(),
|
|
85
|
+
env: _defineProperty({}, 'auth0.js-ulp', _auth0Js.default.version.raw)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (!this.isUniversalLogin && telemetryOverride) {
|
|
89
|
+
var _objectSpread3;
|
|
90
|
+
telemetry = _objectSpread(_objectSpread({}, telemetryOverride), {}, {
|
|
91
|
+
env: _objectSpread(_objectSpread({}, telemetryOverride.env), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, 'lock.js', (0, _helper.getVersion)()), _defineProperty(_objectSpread3, 'auth0.js', _auth0Js.default.version.raw), _objectSpread3))
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (!telemetry) {
|
|
95
|
+
telemetry = {
|
|
96
|
+
name: 'lock.js',
|
|
97
|
+
version: (0, _helper.getVersion)(),
|
|
98
|
+
env: _defineProperty({}, 'auth0.js', _auth0Js.default.version.raw)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return telemetry;
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "logIn",
|
|
105
|
+
value: function logIn(options, authParams, cb) {
|
|
106
|
+
// TODO: for passwordless only, try to clean in auth0.js
|
|
107
|
+
// client._shouldRedirect = redirect || responseType === "code" || !!redirectUrl;
|
|
108
|
+
var f = (0, _helper.loginCallback)(false, this.domain, cb);
|
|
109
|
+
var loginOptions = (0, _helper.trimAuthParams)((0, _helper.normalizeAuthParams)(_objectSpread(_objectSpread(_objectSpread({}, options), this.authOpt), authParams)));
|
|
110
|
+
if (options.login_hint) {
|
|
111
|
+
loginOptions.login_hint = options.login_hint;
|
|
112
|
+
}
|
|
113
|
+
if (!options.username && !options.email) {
|
|
114
|
+
if (this.authOpt.popup) {
|
|
115
|
+
this.client.popup.authorize(_objectSpread(_objectSpread({}, loginOptions), {}, {
|
|
116
|
+
owp: true
|
|
117
|
+
}), f);
|
|
118
|
+
} else {
|
|
119
|
+
this.client.authorize(loginOptions, f);
|
|
120
|
+
}
|
|
121
|
+
} else if (this.authOpt.popup) {
|
|
122
|
+
this.client.popup.loginWithCredentials(loginOptions, f);
|
|
123
|
+
} else {
|
|
124
|
+
loginOptions.realm = options.connection;
|
|
125
|
+
this.client.login(loginOptions, f);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "logout",
|
|
130
|
+
value: function logout(query) {
|
|
131
|
+
this.client.logout(query);
|
|
132
|
+
}
|
|
133
|
+
}, {
|
|
134
|
+
key: "signUp",
|
|
135
|
+
value: function signUp(options, cb) {
|
|
136
|
+
delete options.autoLogin;
|
|
137
|
+
this.client.signup((0, _helper.trimAuthParams)(options), function (err, result) {
|
|
138
|
+
return cb(err, result);
|
|
91
139
|
});
|
|
92
140
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var _extends3;
|
|
104
|
-
|
|
105
|
-
telemetry = _extends({}, telemetryOverride, {
|
|
106
|
-
env: _extends({}, telemetryOverride.env, (_extends3 = {}, _extends3['lock.js'] = (0, _helper.getVersion)(), _extends3['auth0.js'] = _auth0Js2.default.version.raw, _extends3))
|
|
141
|
+
}, {
|
|
142
|
+
key: "resetPassword",
|
|
143
|
+
value: function resetPassword(options, cb) {
|
|
144
|
+
this.client.changePassword((0, _helper.trimAuthParams)(options), cb);
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "passwordlessStart",
|
|
148
|
+
value: function passwordlessStart(options, cb) {
|
|
149
|
+
this.client.passwordlessStart((0, _helper.trimAuthParams)(options), function (err) {
|
|
150
|
+
return cb((0, _helper.normalizeError)(err));
|
|
107
151
|
});
|
|
108
152
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return telemetry;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
Auth0APIClient.prototype.logIn = function logIn(options, authParams, cb) {
|
|
122
|
-
// TODO: for passwordless only, try to clean in auth0.js
|
|
123
|
-
// client._shouldRedirect = redirect || responseType === "code" || !!redirectUrl;
|
|
124
|
-
var f = (0, _helper.loginCallback)(false, this.domain, cb);
|
|
125
|
-
var loginOptions = (0, _helper.trimAuthParams)((0, _helper.normalizeAuthParams)(_extends({}, options, this.authOpt, authParams)));
|
|
126
|
-
|
|
127
|
-
if (options.login_hint) {
|
|
128
|
-
loginOptions.login_hint = options.login_hint;
|
|
153
|
+
}, {
|
|
154
|
+
key: "passwordlessVerify",
|
|
155
|
+
value: function passwordlessVerify(options, cb) {
|
|
156
|
+
var verifyOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
157
|
+
popup: this.authOpt.popup
|
|
158
|
+
});
|
|
159
|
+
this.client.passwordlessLogin(verifyOptions, function (err, result) {
|
|
160
|
+
return cb((0, _helper.normalizeError)(err), result);
|
|
161
|
+
});
|
|
129
162
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
} else {
|
|
142
|
-
loginOptions.realm = options.connection;
|
|
143
|
-
this.client.login(loginOptions, f);
|
|
163
|
+
}, {
|
|
164
|
+
key: "parseHash",
|
|
165
|
+
value: function parseHash() {
|
|
166
|
+
var hash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
167
|
+
var cb = arguments.length > 1 ? arguments[1] : undefined;
|
|
168
|
+
return this.client.parseHash({
|
|
169
|
+
__enableIdPInitiatedLogin: this._enableIdPInitiatedLogin,
|
|
170
|
+
hash: hash,
|
|
171
|
+
nonce: this.authOpt.nonce,
|
|
172
|
+
state: this.authOpt.state
|
|
173
|
+
}, cb);
|
|
144
174
|
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
nonce: this.authOpt.nonce,
|
|
185
|
-
state: this.authOpt.state
|
|
186
|
-
}, cb);
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
Auth0APIClient.prototype.getUserInfo = function getUserInfo(token, callback) {
|
|
190
|
-
return this.client.client.userInfo(token, callback);
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
Auth0APIClient.prototype.getProfile = function getProfile(token, callback) {
|
|
194
|
-
this.getUserInfo(token, callback);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
Auth0APIClient.prototype.getSSOData = function getSSOData() {
|
|
198
|
-
var _client$client;
|
|
199
|
-
|
|
200
|
-
return (_client$client = this.client.client).getSSOData.apply(_client$client, arguments);
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
Auth0APIClient.prototype.getChallenge = function getChallenge() {
|
|
204
|
-
var _client$client2;
|
|
205
|
-
|
|
206
|
-
return (_client$client2 = this.client.client).getChallenge.apply(_client$client2, arguments);
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
Auth0APIClient.prototype.getPasswordlessChallenge = function getPasswordlessChallenge() {
|
|
210
|
-
var _client$client$passwo;
|
|
211
|
-
|
|
212
|
-
return (_client$client$passwo = this.client.client.passwordless).getChallenge.apply(_client$client$passwo, arguments);
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
Auth0APIClient.prototype.getUserCountry = function getUserCountry(cb) {
|
|
216
|
-
return this.client.client.getUserCountry(cb);
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
Auth0APIClient.prototype.checkSession = function checkSession(options, cb) {
|
|
220
|
-
return this.client.checkSession(options, cb);
|
|
221
|
-
};
|
|
222
|
-
|
|
175
|
+
}, {
|
|
176
|
+
key: "getUserInfo",
|
|
177
|
+
value: function getUserInfo(token, callback) {
|
|
178
|
+
return this.client.client.userInfo(token, callback);
|
|
179
|
+
}
|
|
180
|
+
}, {
|
|
181
|
+
key: "getProfile",
|
|
182
|
+
value: function getProfile(token, callback) {
|
|
183
|
+
this.getUserInfo(token, callback);
|
|
184
|
+
}
|
|
185
|
+
}, {
|
|
186
|
+
key: "getSSOData",
|
|
187
|
+
value: function getSSOData() {
|
|
188
|
+
var _this$client$client;
|
|
189
|
+
return (_this$client$client = this.client.client).getSSOData.apply(_this$client$client, arguments);
|
|
190
|
+
}
|
|
191
|
+
}, {
|
|
192
|
+
key: "getChallenge",
|
|
193
|
+
value: function getChallenge() {
|
|
194
|
+
var _this$client$client2;
|
|
195
|
+
return (_this$client$client2 = this.client.client).getChallenge.apply(_this$client$client2, arguments);
|
|
196
|
+
}
|
|
197
|
+
}, {
|
|
198
|
+
key: "getPasswordlessChallenge",
|
|
199
|
+
value: function getPasswordlessChallenge() {
|
|
200
|
+
var _this$client$client$p;
|
|
201
|
+
return (_this$client$client$p = this.client.client.passwordless).getChallenge.apply(_this$client$client$p, arguments);
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
key: "getUserCountry",
|
|
205
|
+
value: function getUserCountry(cb) {
|
|
206
|
+
return this.client.client.getUserCountry(cb);
|
|
207
|
+
}
|
|
208
|
+
}, {
|
|
209
|
+
key: "checkSession",
|
|
210
|
+
value: function checkSession(options, cb) {
|
|
211
|
+
return this.client.checkSession(options, cb);
|
|
212
|
+
}
|
|
213
|
+
}]);
|
|
223
214
|
return Auth0APIClient;
|
|
224
215
|
}();
|
|
225
|
-
|
|
226
|
-
exports.default =
|
|
216
|
+
var _default = Auth0APIClient;
|
|
217
|
+
exports.default = _default;
|