auth0-lock 11.34.1 → 12.0.0-beta.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 +4 -2
- package/.eslintrc.json +5 -5
- package/.github/workflows/codeql.yml +41 -0
- package/.shiprc +4 -5
- package/CHANGELOG.md +32 -0
- package/EXAMPLES.md +626 -0
- package/README.md +77 -649
- 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 +20 -41
- package/lib/__tests__/connection/database/password_reset_confirmation.js +19 -26
- package/lib/__tests__/connection/database/reset_password.js +17 -39
- package/lib/__tests__/connection/database/signed_up_confirmation.js +19 -26
- 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 +27 -68
- package/lib/__tests__/connection/passwordless/ask_vcode.js +29 -51
- package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +19 -26
- 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 +19 -26
- 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.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 +19 -36
- 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 +14 -32
- 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 -62
- 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 +152 -301
- package/lib/core/loading_screen.js +61 -71
- package/lib/core/pane_separator.js +10 -10
- package/lib/core/remote_data.js +28 -48
- 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 +24 -30
- package/lib/core/web_api/p2_api.js +156 -165
- package/lib/core/web_api.js +101 -90
- 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 +71 -106
- package/lib/engine/passwordless/social_or_phone_number_login_screen.js +70 -100
- package/lib/engine/passwordless.js +75 -104
- package/lib/field/actions.js +11 -17
- package/lib/field/captcha/captcha_pane.js +82 -102
- 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 +51 -88
- 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/opslevel.yml +6 -0
- package/package.json +53 -38
- package/webpack.config.js +36 -3
package/lib/core/index.js
CHANGED
|
@@ -1,125 +1,106 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.
|
|
9
|
-
exports.id = id;
|
|
10
|
-
exports.clientID = clientID;
|
|
11
|
-
exports.domain = domain;
|
|
12
|
-
exports.clientBaseUrl = clientBaseUrl;
|
|
13
|
-
exports.tenantBaseUrl = tenantBaseUrl;
|
|
14
|
-
exports.useTenantInfo = useTenantInfo;
|
|
15
|
-
exports.connectionResolver = connectionResolver;
|
|
16
|
-
exports.setResolvedConnection = setResolvedConnection;
|
|
17
|
-
exports.resolvedConnection = resolvedConnection;
|
|
18
|
-
exports.languageBaseUrl = languageBaseUrl;
|
|
19
|
-
exports.setSubmitting = setSubmitting;
|
|
20
|
-
exports.submitting = submitting;
|
|
21
|
-
exports.setGlobalError = setGlobalError;
|
|
22
|
-
exports.globalError = globalError;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.allowedConnections = allowedConnections;
|
|
7
|
+
exports.auth = void 0;
|
|
8
|
+
exports.captcha = captcha;
|
|
23
9
|
exports.clearGlobalError = clearGlobalError;
|
|
24
|
-
exports.setGlobalSuccess = setGlobalSuccess;
|
|
25
|
-
exports.globalSuccess = globalSuccess;
|
|
26
|
-
exports.clearGlobalSuccess = clearGlobalSuccess;
|
|
27
|
-
exports.setGlobalInfo = setGlobalInfo;
|
|
28
|
-
exports.globalInfo = globalInfo;
|
|
29
10
|
exports.clearGlobalInfo = clearGlobalInfo;
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.render = render;
|
|
38
|
-
exports.setLoggedIn = setLoggedIn;
|
|
39
|
-
exports.loggedIn = loggedIn;
|
|
11
|
+
exports.clearGlobalSuccess = clearGlobalSuccess;
|
|
12
|
+
exports.clientBaseUrl = clientBaseUrl;
|
|
13
|
+
exports.clientID = clientID;
|
|
14
|
+
exports.connection = connection;
|
|
15
|
+
exports.connectionResolver = connectionResolver;
|
|
16
|
+
exports.connections = connections;
|
|
17
|
+
exports.countConnections = countConnections;
|
|
40
18
|
exports.defaultADUsernameFromEmailPrefix = defaultADUsernameFromEmailPrefix;
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
19
|
+
exports.domain = domain;
|
|
20
|
+
exports.emitAuthenticatedEvent = emitAuthenticatedEvent;
|
|
21
|
+
exports.emitAuthorizationErrorEvent = emitAuthorizationErrorEvent;
|
|
22
|
+
exports.emitEvent = emitEvent;
|
|
23
|
+
exports.emitHashParsedEvent = emitHashParsedEvent;
|
|
24
|
+
exports.emitUnrecoverableErrorEvent = emitUnrecoverableErrorEvent;
|
|
45
25
|
exports.error = error;
|
|
46
|
-
exports.
|
|
47
|
-
exports.
|
|
48
|
-
exports.
|
|
26
|
+
exports.extractTenantBaseUrlOption = extractTenantBaseUrlOption;
|
|
27
|
+
exports.filterConnections = filterConnections;
|
|
28
|
+
exports.findConnection = findConnection;
|
|
29
|
+
exports.globalError = globalError;
|
|
30
|
+
exports.globalInfo = globalInfo;
|
|
31
|
+
exports.globalSuccess = globalSuccess;
|
|
32
|
+
exports.handleEvent = handleEvent;
|
|
33
|
+
exports.hasConnection = hasConnection;
|
|
49
34
|
exports.hasOneConnection = hasOneConnection;
|
|
50
35
|
exports.hasOnlyConnections = hasOnlyConnections;
|
|
51
36
|
exports.hasSomeConnections = hasSomeConnections;
|
|
52
|
-
exports.countConnections = countConnections;
|
|
53
|
-
exports.findConnection = findConnection;
|
|
54
|
-
exports.hasConnection = hasConnection;
|
|
55
|
-
exports.filterConnections = filterConnections;
|
|
56
|
-
exports.useCustomPasswordlessConnection = useCustomPasswordlessConnection;
|
|
57
|
-
exports.runHook = runHook;
|
|
58
|
-
exports.emitEvent = emitEvent;
|
|
59
|
-
exports.handleEvent = handleEvent;
|
|
60
|
-
exports.loginErrorMessage = loginErrorMessage;
|
|
61
|
-
exports.stop = stop;
|
|
62
37
|
exports.hasStopped = hasStopped;
|
|
63
38
|
exports.hashCleanup = hashCleanup;
|
|
64
|
-
exports.
|
|
65
|
-
exports.
|
|
66
|
-
exports.
|
|
67
|
-
exports.
|
|
68
|
-
exports.
|
|
39
|
+
exports.hooks = hooks;
|
|
40
|
+
exports.id = id;
|
|
41
|
+
exports.languageBaseUrl = languageBaseUrl;
|
|
42
|
+
exports.loggedIn = loggedIn;
|
|
43
|
+
exports.loginErrorMessage = loginErrorMessage;
|
|
69
44
|
exports.overrideOptions = overrideOptions;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
45
|
+
exports.prefill = prefill;
|
|
46
|
+
exports.render = render;
|
|
47
|
+
exports.rendering = rendering;
|
|
48
|
+
exports.reset = void 0;
|
|
49
|
+
exports.resolvedConnection = resolvedConnection;
|
|
50
|
+
exports.runHook = runHook;
|
|
51
|
+
exports.setCaptcha = setCaptcha;
|
|
52
|
+
exports.setGlobalError = setGlobalError;
|
|
53
|
+
exports.setGlobalInfo = setGlobalInfo;
|
|
54
|
+
exports.setGlobalSuccess = setGlobalSuccess;
|
|
55
|
+
exports.setLoggedIn = setLoggedIn;
|
|
56
|
+
exports.setResolvedConnection = setResolvedConnection;
|
|
57
|
+
exports.setSubmitting = setSubmitting;
|
|
58
|
+
exports.setSupressSubmitOverlay = setSupressSubmitOverlay;
|
|
59
|
+
exports.setup = setup;
|
|
60
|
+
exports.showBadge = showBadge;
|
|
61
|
+
exports.stop = stop;
|
|
62
|
+
exports.stopRendering = stopRendering;
|
|
63
|
+
exports.submitting = submitting;
|
|
64
|
+
exports.suppressSubmitOverlay = suppressSubmitOverlay;
|
|
65
|
+
exports.tenantBaseUrl = tenantBaseUrl;
|
|
66
|
+
exports.ui = void 0;
|
|
67
|
+
exports.useCustomPasswordlessConnection = useCustomPasswordlessConnection;
|
|
68
|
+
exports.useTenantInfo = useTenantInfo;
|
|
69
|
+
exports.validPublicHooks = void 0;
|
|
70
|
+
exports.warn = warn;
|
|
71
|
+
exports.withAuthOptions = withAuthOptions;
|
|
72
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
73
|
+
var _immutable = _interopRequireWildcard(require("immutable"));
|
|
74
|
+
var _media_utils = require("../utils/media_utils");
|
|
75
|
+
var _string_utils = require("../utils/string_utils");
|
|
76
|
+
var _url_utils = require("../utils/url_utils");
|
|
77
|
+
var i18n = _interopRequireWildcard(require("../i18n"));
|
|
78
|
+
var _trim = _interopRequireDefault(require("trim"));
|
|
79
|
+
var gp = _interopRequireWildcard(require("../avatar/gravatar_provider"));
|
|
80
|
+
var _data_utils = require("../utils/data_utils");
|
|
81
|
+
var _index = require("./client/index");
|
|
82
|
+
var captchaField = _interopRequireWildcard(require("../field/captcha"));
|
|
83
|
+
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); }
|
|
84
|
+
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; }
|
|
107
85
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
108
|
-
|
|
86
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
87
|
+
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; } }
|
|
88
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
89
|
+
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); }
|
|
109
90
|
var _dataFns = (0, _data_utils.dataFns)(['core']),
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var validPublicHooks =
|
|
120
|
-
|
|
91
|
+
get = _dataFns.get,
|
|
92
|
+
init = _dataFns.init,
|
|
93
|
+
remove = _dataFns.remove,
|
|
94
|
+
reset = _dataFns.reset,
|
|
95
|
+
set = _dataFns.set,
|
|
96
|
+
tget = _dataFns.tget,
|
|
97
|
+
tset = _dataFns.tset,
|
|
98
|
+
tremove = _dataFns.tremove;
|
|
99
|
+
exports.reset = reset;
|
|
100
|
+
var validPublicHooks = ['loggingIn', 'signingUp'];
|
|
101
|
+
exports.validPublicHooks = validPublicHooks;
|
|
121
102
|
function setup(id, clientID, domain, options, hookRunner, emitEventFn, handleEventFn) {
|
|
122
|
-
var m = init(id,
|
|
103
|
+
var m = init(id, _immutable.default.fromJS({
|
|
123
104
|
clientBaseUrl: extractClientBaseUrlOption(options, domain),
|
|
124
105
|
tenantBaseUrl: extractTenantBaseUrlOption(options, domain),
|
|
125
106
|
languageBaseUrl: extractLanguageBaseUrlOption(options, domain),
|
|
@@ -130,7 +111,7 @@ function setup(id, clientID, domain, options, hookRunner, emitEventFn, handleEve
|
|
|
130
111
|
hookRunner: hookRunner,
|
|
131
112
|
useTenantInfo: options.__useTenantInfo || false,
|
|
132
113
|
hashCleanup: options.hashCleanup === false ? false : true,
|
|
133
|
-
allowedConnections:
|
|
114
|
+
allowedConnections: _immutable.default.fromJS(options.allowedConnections || []),
|
|
134
115
|
useCustomPasswordlessConnection: options.useCustomPasswordlessConnection === true ? true : false,
|
|
135
116
|
ui: extractUIOptions(id, options),
|
|
136
117
|
defaultADUsernameFromEmailPrefix: options.defaultADUsernameFromEmailPrefix === false ? false : true,
|
|
@@ -139,40 +120,30 @@ function setup(id, clientID, domain, options, hookRunner, emitEventFn, handleEve
|
|
|
139
120
|
handleEventFn: handleEventFn,
|
|
140
121
|
hooks: extractHookOptions(options)
|
|
141
122
|
}));
|
|
142
|
-
|
|
143
123
|
m = i18n.initI18n(m);
|
|
144
|
-
|
|
145
124
|
return m;
|
|
146
125
|
}
|
|
147
|
-
|
|
148
126
|
function id(m) {
|
|
149
127
|
return m.get('id');
|
|
150
128
|
}
|
|
151
|
-
|
|
152
129
|
function clientID(m) {
|
|
153
130
|
return get(m, 'clientID');
|
|
154
131
|
}
|
|
155
|
-
|
|
156
132
|
function domain(m) {
|
|
157
133
|
return get(m, 'domain');
|
|
158
134
|
}
|
|
159
|
-
|
|
160
135
|
function clientBaseUrl(m) {
|
|
161
136
|
return get(m, 'clientBaseUrl');
|
|
162
137
|
}
|
|
163
|
-
|
|
164
138
|
function tenantBaseUrl(m) {
|
|
165
139
|
return get(m, 'tenantBaseUrl');
|
|
166
140
|
}
|
|
167
|
-
|
|
168
141
|
function useTenantInfo(m) {
|
|
169
142
|
return get(m, 'useTenantInfo');
|
|
170
143
|
}
|
|
171
|
-
|
|
172
144
|
function connectionResolver(m) {
|
|
173
145
|
return get(m, 'connectionResolver');
|
|
174
146
|
}
|
|
175
|
-
|
|
176
147
|
function setResolvedConnection(m, resolvedConnection) {
|
|
177
148
|
if (!resolvedConnection) {
|
|
178
149
|
return set(m, 'resolvedConnection', undefined);
|
|
@@ -183,9 +154,8 @@ function setResolvedConnection(m, resolvedConnection) {
|
|
|
183
154
|
if (resolvedConnection.type !== 'database') {
|
|
184
155
|
throw new Error('Invalid connection type. Only database connections can be resolved with a custom resolver.');
|
|
185
156
|
}
|
|
186
|
-
return set(m, 'resolvedConnection',
|
|
157
|
+
return set(m, 'resolvedConnection', _immutable.default.fromJS(resolvedConnection));
|
|
187
158
|
}
|
|
188
|
-
|
|
189
159
|
function resolvedConnection(m) {
|
|
190
160
|
var resolvedConnection = get(m, 'resolvedConnection');
|
|
191
161
|
if (!resolvedConnection) {
|
|
@@ -193,96 +163,74 @@ function resolvedConnection(m) {
|
|
|
193
163
|
}
|
|
194
164
|
return findConnection(m, resolvedConnection.get('name'));
|
|
195
165
|
}
|
|
196
|
-
|
|
197
166
|
function languageBaseUrl(m) {
|
|
198
167
|
return get(m, 'languageBaseUrl');
|
|
199
168
|
}
|
|
200
|
-
|
|
201
169
|
function setSubmitting(m, value) {
|
|
202
170
|
var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
203
|
-
|
|
204
171
|
m = tset(m, 'submitting', value);
|
|
205
172
|
m = clearGlobalSuccess(m);
|
|
206
173
|
m = error && !value ? setGlobalError(m, error) : clearGlobalError(m);
|
|
207
174
|
return m;
|
|
208
175
|
}
|
|
209
|
-
|
|
210
176
|
function submitting(m) {
|
|
211
177
|
return tget(m, 'submitting', false);
|
|
212
178
|
}
|
|
213
|
-
|
|
214
179
|
function setGlobalError(m, str) {
|
|
215
180
|
return tset(m, 'globalError', str);
|
|
216
181
|
}
|
|
217
|
-
|
|
218
182
|
function globalError(m) {
|
|
219
183
|
return tget(m, 'globalError', '');
|
|
220
184
|
}
|
|
221
|
-
|
|
222
185
|
function clearGlobalError(m) {
|
|
223
186
|
return tremove(m, 'globalError');
|
|
224
187
|
}
|
|
225
|
-
|
|
226
188
|
function setGlobalSuccess(m, str) {
|
|
227
189
|
return tset(m, 'globalSuccess', str);
|
|
228
190
|
}
|
|
229
|
-
|
|
230
191
|
function globalSuccess(m) {
|
|
231
192
|
return tget(m, 'globalSuccess', '');
|
|
232
193
|
}
|
|
233
|
-
|
|
234
194
|
function clearGlobalSuccess(m) {
|
|
235
195
|
return tremove(m, 'globalSuccess');
|
|
236
196
|
}
|
|
237
|
-
|
|
238
197
|
function setGlobalInfo(m, str) {
|
|
239
198
|
return tset(m, 'globalInfo', str);
|
|
240
199
|
}
|
|
241
|
-
|
|
242
200
|
function globalInfo(m) {
|
|
243
201
|
return tget(m, 'globalInfo', '');
|
|
244
202
|
}
|
|
245
|
-
|
|
246
203
|
function clearGlobalInfo(m) {
|
|
247
204
|
return tremove(m, 'globalInfo');
|
|
248
205
|
}
|
|
249
|
-
|
|
250
206
|
function rendering(m) {
|
|
251
207
|
return tget(m, 'render', false);
|
|
252
208
|
}
|
|
253
|
-
|
|
254
209
|
function stopRendering(m) {
|
|
255
210
|
return tremove(m, 'render');
|
|
256
211
|
}
|
|
257
|
-
|
|
258
212
|
function setSupressSubmitOverlay(m, b) {
|
|
259
213
|
return set(m, 'suppressSubmitOverlay', b);
|
|
260
214
|
}
|
|
261
|
-
|
|
262
215
|
function suppressSubmitOverlay(m) {
|
|
263
216
|
return get(m, 'suppressSubmitOverlay');
|
|
264
217
|
}
|
|
265
|
-
|
|
266
218
|
function hooks(m) {
|
|
267
219
|
return get(m, 'hooks');
|
|
268
220
|
}
|
|
269
|
-
|
|
270
221
|
function extractUIOptions(id, options) {
|
|
271
222
|
var closable = options.container ? false : undefined === options.closable ? true : !!options.closable;
|
|
272
223
|
var theme = options.theme || {};
|
|
273
224
|
var labeledSubmitButton = theme.labeledSubmitButton,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
225
|
+
hideMainScreenTitle = theme.hideMainScreenTitle,
|
|
226
|
+
logo = theme.logo,
|
|
227
|
+
primaryColor = theme.primaryColor,
|
|
228
|
+
authButtons = theme.authButtons;
|
|
280
229
|
var avatar = options.avatar !== null;
|
|
281
230
|
var customAvatarProvider = options.avatar && typeof options.avatar.url === 'function' && typeof options.avatar.displayName === 'function' && options.avatar;
|
|
282
231
|
var avatarProvider = customAvatarProvider || gp;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
containerID: options.container || 'auth0-lock-container-' + id,
|
|
232
|
+
return new _immutable.default.fromJS({
|
|
233
|
+
containerID: options.container || "auth0-lock-container-".concat(id),
|
|
286
234
|
appendContainer: !options.container,
|
|
287
235
|
autoclose: undefined === options.autoclose ? false : closable && options.autoclose,
|
|
288
236
|
autofocus: undefined === options.autofocus ? !(options.container || (0, _media_utils.isSmallScreen)()) : !!options.autofocus,
|
|
@@ -292,7 +240,7 @@ function extractUIOptions(id, options) {
|
|
|
292
240
|
closable: closable,
|
|
293
241
|
hideMainScreenTitle: !!hideMainScreenTitle,
|
|
294
242
|
labeledSubmitButton: undefined === labeledSubmitButton ? true : !!labeledSubmitButton,
|
|
295
|
-
language: undefined === options.language ? 'en' : (0,
|
|
243
|
+
language: undefined === options.language ? 'en' : (0, _trim.default)(options.language || '').toLowerCase(),
|
|
296
244
|
dict: _typeof(options.languageDictionary) === 'object' ? options.languageDictionary : {},
|
|
297
245
|
disableWarnings: options.disableWarnings === undefined ? false : !!options.disableWarnings,
|
|
298
246
|
mobile: undefined === options.mobile ? false : !!options.mobile,
|
|
@@ -301,39 +249,32 @@ function extractUIOptions(id, options) {
|
|
|
301
249
|
rememberLastLogin: undefined === options.rememberLastLogin ? true : !!options.rememberLastLogin,
|
|
302
250
|
allowAutocomplete: !!options.allowAutocomplete,
|
|
303
251
|
preferConnectionDisplayName: !!options.preferConnectionDisplayName,
|
|
304
|
-
authButtonsTheme:
|
|
252
|
+
authButtonsTheme: _typeof(authButtons) === 'object' ? authButtons : {},
|
|
305
253
|
allowShowPassword: !!options.allowShowPassword,
|
|
306
254
|
allowPasswordAutocomplete: !!options.allowPasswordAutocomplete,
|
|
307
255
|
scrollGlobalMessagesIntoView: undefined === options.scrollGlobalMessagesIntoView ? true : !!options.scrollGlobalMessagesIntoView,
|
|
308
256
|
forceAutoHeight: !!options.forceAutoHeight
|
|
309
257
|
});
|
|
310
258
|
}
|
|
311
|
-
|
|
312
259
|
function extractHookOptions(options) {
|
|
313
260
|
var hooks = {};
|
|
314
|
-
|
|
315
261
|
validPublicHooks.forEach(function (hookName) {
|
|
316
262
|
if (options.hooks && typeof options.hooks[hookName] === 'function') {
|
|
317
263
|
hooks[hookName] = options.hooks[hookName];
|
|
318
264
|
}
|
|
319
265
|
});
|
|
320
|
-
|
|
321
|
-
return new _immutable2.default.fromJS(hooks);
|
|
266
|
+
return new _immutable.default.fromJS(hooks);
|
|
322
267
|
}
|
|
323
|
-
|
|
324
268
|
var _dataFns2 = (0, _data_utils.dataFns)(['core', 'ui']),
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
269
|
+
getUI = _dataFns2.get,
|
|
270
|
+
setUI = _dataFns2.set;
|
|
328
271
|
var _dataFns3 = (0, _data_utils.dataFns)(['core', 'transient', 'ui']),
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
272
|
+
tgetUI = _dataFns3.get,
|
|
273
|
+
tsetUI = _dataFns3.set;
|
|
332
274
|
var getUIAttribute = function getUIAttribute(m, attribute) {
|
|
333
275
|
return tgetUI(m, attribute) || getUI(m, attribute);
|
|
334
276
|
};
|
|
335
|
-
|
|
336
|
-
var ui = exports.ui = {
|
|
277
|
+
var ui = {
|
|
337
278
|
containerID: function containerID(lock) {
|
|
338
279
|
return getUIAttribute(lock, 'containerID');
|
|
339
280
|
},
|
|
@@ -407,11 +348,10 @@ var ui = exports.ui = {
|
|
|
407
348
|
return tget(m, 'forceAutoHeight', getUIAttribute(m, 'forceAutoHeight'));
|
|
408
349
|
}
|
|
409
350
|
};
|
|
410
|
-
|
|
351
|
+
exports.ui = ui;
|
|
411
352
|
var _dataFns4 = (0, _data_utils.dataFns)(['core', 'auth']),
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
var auth = exports.auth = {
|
|
353
|
+
getAuthAttribute = _dataFns4.get;
|
|
354
|
+
var auth = {
|
|
415
355
|
connectionScopes: function connectionScopes(m) {
|
|
416
356
|
return getAuthAttribute(m, 'connectionScopes');
|
|
417
357
|
},
|
|
@@ -434,28 +374,26 @@ var auth = exports.auth = {
|
|
|
434
374
|
return getAuthAttribute(lock, 'sso');
|
|
435
375
|
}
|
|
436
376
|
};
|
|
437
|
-
|
|
377
|
+
exports.auth = auth;
|
|
438
378
|
function extractAuthOptions(options) {
|
|
439
379
|
var _ref = options.auth || {},
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
380
|
+
audience = _ref.audience,
|
|
381
|
+
connectionScopes = _ref.connectionScopes,
|
|
382
|
+
params = _ref.params,
|
|
383
|
+
autoParseHash = _ref.autoParseHash,
|
|
384
|
+
redirect = _ref.redirect,
|
|
385
|
+
redirectUrl = _ref.redirectUrl,
|
|
386
|
+
responseMode = _ref.responseMode,
|
|
387
|
+
responseType = _ref.responseType,
|
|
388
|
+
sso = _ref.sso,
|
|
389
|
+
state = _ref.state,
|
|
390
|
+
nonce = _ref.nonce;
|
|
452
391
|
if (options.auth && options.auth.redirectUri) {
|
|
453
392
|
console.warn("You're sending an `auth` option named `redirectUri`. This option will be ignored. Use `redirectUrl` instead.");
|
|
454
393
|
}
|
|
455
|
-
|
|
456
394
|
audience = typeof audience === 'string' ? audience : undefined;
|
|
457
|
-
connectionScopes =
|
|
458
|
-
params =
|
|
395
|
+
connectionScopes = _typeof(connectionScopes) === 'object' ? connectionScopes : {};
|
|
396
|
+
params = _typeof(params) === 'object' ? params : {};
|
|
459
397
|
// by default is null because we need to know if it was set when we curate the responseType
|
|
460
398
|
redirectUrl = typeof redirectUrl === 'string' && redirectUrl ? redirectUrl : null;
|
|
461
399
|
autoParseHash = typeof autoParseHash === 'boolean' ? autoParseHash : true;
|
|
@@ -466,15 +404,12 @@ function extractAuthOptions(options) {
|
|
|
466
404
|
// if responseType was not set and there is a redirectUrl, it defaults to code. Otherwise token.
|
|
467
405
|
responseType = typeof responseType === 'string' ? responseType : redirectUrl ? 'code' : 'token';
|
|
468
406
|
// now we set the default because we already did the validation
|
|
469
|
-
redirectUrl = redirectUrl ||
|
|
470
|
-
|
|
407
|
+
redirectUrl = redirectUrl || "".concat((0, _url_utils.getOriginFromUrl)(window.location.href)).concat(window.location.pathname);
|
|
471
408
|
sso = typeof sso === 'boolean' ? sso : true;
|
|
472
|
-
|
|
473
409
|
if (!params.scope) {
|
|
474
410
|
params.scope = 'openid profile email';
|
|
475
411
|
}
|
|
476
|
-
|
|
477
|
-
return _immutable2.default.fromJS({
|
|
412
|
+
return _immutable.default.fromJS({
|
|
478
413
|
audience: audience,
|
|
479
414
|
connectionScopes: connectionScopes,
|
|
480
415
|
params: params,
|
|
@@ -488,40 +423,32 @@ function extractAuthOptions(options) {
|
|
|
488
423
|
nonce: nonce
|
|
489
424
|
});
|
|
490
425
|
}
|
|
491
|
-
|
|
492
426
|
function withAuthOptions(m, opts) {
|
|
493
|
-
return
|
|
427
|
+
return _immutable.default.fromJS(opts).merge(get(m, 'auth')).toJS();
|
|
494
428
|
}
|
|
495
|
-
|
|
496
429
|
function extractClientBaseUrlOption(opts, domain) {
|
|
497
430
|
if (opts.clientBaseUrl && typeof opts.clientBaseUrl === 'string') {
|
|
498
431
|
return opts.clientBaseUrl;
|
|
499
432
|
}
|
|
500
|
-
|
|
501
433
|
if (opts.configurationBaseUrl && typeof opts.configurationBaseUrl === 'string') {
|
|
502
434
|
return opts.configurationBaseUrl;
|
|
503
435
|
}
|
|
504
|
-
|
|
505
436
|
if (opts.assetsUrl && typeof opts.assetsUrl === 'string') {
|
|
506
437
|
return opts.assetsUrl;
|
|
507
438
|
}
|
|
508
|
-
|
|
509
|
-
return 'https://' + domain;
|
|
439
|
+
return "https://".concat(domain);
|
|
510
440
|
}
|
|
511
|
-
|
|
512
441
|
function extractTenantBaseUrlOption(opts, domain) {
|
|
513
442
|
if (opts.configurationBaseUrl && typeof opts.configurationBaseUrl === 'string') {
|
|
514
443
|
if (opts.overrides && opts.overrides.__tenant) {
|
|
515
444
|
// When using a custom domain and a configuration URL hosted in auth0's cdn
|
|
516
|
-
return (0,
|
|
445
|
+
return (0, _urlJoin.default)(opts.configurationBaseUrl, 'tenants', 'v1', "".concat(opts.overrides.__tenant, ".js"));
|
|
517
446
|
}
|
|
518
|
-
return (0,
|
|
447
|
+
return (0, _urlJoin.default)(opts.configurationBaseUrl, 'info-v1.js');
|
|
519
448
|
}
|
|
520
|
-
|
|
521
449
|
if (opts.assetsUrl && typeof opts.assetsUrl === 'string') {
|
|
522
450
|
return opts.assetsUrl;
|
|
523
451
|
}
|
|
524
|
-
|
|
525
452
|
var domainUrl = 'https://' + domain;
|
|
526
453
|
var hostname = (0, _url_utils.getLocationFromUrl)(domainUrl).hostname;
|
|
527
454
|
var DOT_AUTH0_DOT_COM = '.auth0.com';
|
|
@@ -531,168 +458,127 @@ function extractTenantBaseUrlOption(opts, domain) {
|
|
|
531
458
|
// lgtm [js/incomplete-url-substring-sanitization]
|
|
532
459
|
var parts = hostname.split('.');
|
|
533
460
|
var tenant_name = parts[0];
|
|
534
|
-
|
|
535
|
-
return (0, _urlJoin2.default)(domainUrl, 'tenants', 'v1', tenant_name + '.js');
|
|
461
|
+
return (0, _urlJoin.default)(domainUrl, 'tenants', 'v1', "".concat(tenant_name, ".js"));
|
|
536
462
|
} else {
|
|
537
|
-
return (0,
|
|
463
|
+
return (0, _urlJoin.default)(domainUrl, 'info-v1.js');
|
|
538
464
|
}
|
|
539
465
|
}
|
|
540
|
-
|
|
541
466
|
function extractLanguageBaseUrlOption(opts, domain) {
|
|
542
467
|
if (opts.languageBaseUrl && typeof opts.languageBaseUrl === 'string') {
|
|
543
468
|
return opts.languageBaseUrl;
|
|
544
469
|
}
|
|
545
|
-
|
|
546
470
|
if (opts.assetsUrl && typeof opts.assetsUrl === 'string') {
|
|
547
471
|
return opts.assetsUrl;
|
|
548
472
|
}
|
|
549
|
-
|
|
550
473
|
return 'https://cdn.auth0.com';
|
|
551
474
|
}
|
|
552
|
-
|
|
553
475
|
function render(m) {
|
|
554
476
|
return tset(m, 'render', true);
|
|
555
477
|
}
|
|
556
|
-
|
|
557
|
-
exports.reset = reset;
|
|
558
478
|
function setLoggedIn(m, value) {
|
|
559
479
|
return tset(m, 'loggedIn', value);
|
|
560
480
|
}
|
|
561
|
-
|
|
562
481
|
function loggedIn(m) {
|
|
563
482
|
return tget(m, 'loggedIn', false);
|
|
564
483
|
}
|
|
565
|
-
|
|
566
484
|
function defaultADUsernameFromEmailPrefix(m) {
|
|
567
485
|
return get(m, 'defaultADUsernameFromEmailPrefix', true);
|
|
568
486
|
}
|
|
569
|
-
|
|
570
487
|
function setCaptcha(m, value, wasInvalid) {
|
|
571
488
|
m = captchaField.reset(m, wasInvalid);
|
|
572
|
-
return set(m, 'captcha',
|
|
489
|
+
return set(m, 'captcha', _immutable.default.fromJS(value));
|
|
573
490
|
}
|
|
574
|
-
|
|
575
491
|
function captcha(m) {
|
|
576
492
|
//some tests send an string as model.
|
|
577
493
|
// https://github.com/auth0/lock/blob/82f56187698528699478bd429858cf91e387763c/src/__tests__/engine/classic/sign_up_pane.test.jsx#L28
|
|
578
|
-
if (
|
|
494
|
+
if (_typeof(m) !== 'object') {
|
|
579
495
|
return;
|
|
580
496
|
}
|
|
581
497
|
return get(m, 'captcha');
|
|
582
498
|
}
|
|
583
|
-
|
|
584
499
|
function prefill(m) {
|
|
585
500
|
return get(m, 'prefill', {});
|
|
586
501
|
}
|
|
587
|
-
|
|
588
502
|
function warn(x, str) {
|
|
589
503
|
var shouldOutput = _immutable.Map.isMap(x) ? !ui.disableWarnings(x) : !x.disableWarnings;
|
|
590
|
-
|
|
591
504
|
if (shouldOutput && console && console.warn) {
|
|
592
505
|
console.warn(str);
|
|
593
506
|
}
|
|
594
507
|
}
|
|
595
|
-
|
|
596
508
|
function error(x, str) {
|
|
597
509
|
var shouldOutput = _immutable.Map.isMap(x) ? !ui.disableWarnings(x) : !x.disableWarnings;
|
|
598
|
-
|
|
599
510
|
if (shouldOutput && console && console.error) {
|
|
600
511
|
console.error(str);
|
|
601
512
|
}
|
|
602
513
|
}
|
|
603
|
-
|
|
604
514
|
function allowedConnections(m) {
|
|
605
515
|
return tget(m, 'allowedConnections') || get(m, 'allowedConnections');
|
|
606
516
|
}
|
|
607
|
-
|
|
608
517
|
function connections(m) {
|
|
609
|
-
|
|
518
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
519
|
+
for (var _len = arguments.length, strategies = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
610
520
|
strategies[_key - 2] = arguments[_key];
|
|
611
521
|
}
|
|
612
|
-
|
|
613
|
-
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
614
|
-
|
|
615
522
|
if (arguments.length === 1) {
|
|
616
523
|
return tget(m, 'connections', (0, _immutable.Map)()).filter(function (v, k) {
|
|
617
524
|
return k !== 'unknown';
|
|
618
525
|
}).valueSeq().flatten(true);
|
|
619
526
|
}
|
|
620
|
-
|
|
621
527
|
var xs = tget(m, ['connections', type], (0, _immutable.List)());
|
|
622
528
|
return strategies.length > 0 ? xs.filter(function (x) {
|
|
623
529
|
return ~strategies.indexOf(x.get('strategy'));
|
|
624
530
|
}) : xs;
|
|
625
531
|
}
|
|
626
|
-
|
|
627
532
|
function connection(m) {
|
|
628
533
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
629
|
-
|
|
630
|
-
for (var _len2 = arguments.length, strategies = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
534
|
+
for (var _len2 = arguments.length, strategies = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
631
535
|
strategies[_key2 - 2] = arguments[_key2];
|
|
632
536
|
}
|
|
633
|
-
|
|
634
|
-
return connections.apply(undefined, [m, type].concat(strategies)).get(0);
|
|
537
|
+
return connections.apply(void 0, [m, type].concat(strategies)).get(0);
|
|
635
538
|
}
|
|
636
|
-
|
|
637
539
|
function hasOneConnection(m) {
|
|
638
540
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
639
|
-
|
|
640
541
|
var xs = connections(m);
|
|
641
542
|
return xs.count() === 1 && (!type || xs.getIn([0, 'type']) === type);
|
|
642
543
|
}
|
|
643
|
-
|
|
644
544
|
function hasOnlyConnections(m) {
|
|
645
545
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
646
|
-
|
|
647
546
|
var all = connections(m).count();
|
|
648
|
-
|
|
649
|
-
for (var _len3 = arguments.length, strategies = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
547
|
+
for (var _len3 = arguments.length, strategies = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
650
548
|
strategies[_key3 - 2] = arguments[_key3];
|
|
651
549
|
}
|
|
652
|
-
|
|
653
|
-
var filtered = connections.apply(undefined, [m, type].concat(strategies)).count();
|
|
550
|
+
var filtered = connections.apply(void 0, [m, type].concat(strategies)).count();
|
|
654
551
|
return all > 0 && all === filtered;
|
|
655
552
|
}
|
|
656
|
-
|
|
657
553
|
function hasSomeConnections(m) {
|
|
658
554
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
659
|
-
|
|
660
|
-
for (var _len4 = arguments.length, strategies = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
|
|
555
|
+
for (var _len4 = arguments.length, strategies = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
|
|
661
556
|
strategies[_key4 - 2] = arguments[_key4];
|
|
662
557
|
}
|
|
663
|
-
|
|
664
|
-
return countConnections.apply(undefined, [m, type].concat(strategies)) > 0;
|
|
558
|
+
return countConnections.apply(void 0, [m, type].concat(strategies)) > 0;
|
|
665
559
|
}
|
|
666
|
-
|
|
667
560
|
function countConnections(m) {
|
|
668
561
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
669
|
-
|
|
670
|
-
for (var _len5 = arguments.length, strategies = Array(_len5 > 2 ? _len5 - 2 : 0), _key5 = 2; _key5 < _len5; _key5++) {
|
|
562
|
+
for (var _len5 = arguments.length, strategies = new Array(_len5 > 2 ? _len5 - 2 : 0), _key5 = 2; _key5 < _len5; _key5++) {
|
|
671
563
|
strategies[_key5 - 2] = arguments[_key5];
|
|
672
564
|
}
|
|
673
|
-
|
|
674
|
-
return connections.apply(undefined, [m, type].concat(strategies)).count();
|
|
565
|
+
return connections.apply(void 0, [m, type].concat(strategies)).count();
|
|
675
566
|
}
|
|
676
|
-
|
|
677
567
|
function findConnection(m, name) {
|
|
678
568
|
return connections(m).find(function (m1) {
|
|
679
569
|
return m1.get('name') === name;
|
|
680
570
|
});
|
|
681
571
|
}
|
|
682
|
-
|
|
683
572
|
function hasConnection(m, name) {
|
|
684
573
|
return !!findConnection(m, name);
|
|
685
574
|
}
|
|
686
|
-
|
|
687
575
|
function filterConnections(m) {
|
|
688
576
|
var allowed = allowedConnections(m);
|
|
689
|
-
|
|
690
577
|
var order = allowed.count() === 0 ? function (_) {
|
|
691
578
|
return 0;
|
|
692
579
|
} : function (c) {
|
|
693
580
|
return allowed.indexOf(c.get('name'));
|
|
694
581
|
};
|
|
695
|
-
|
|
696
582
|
return tset(m, 'connections', (0, _index.clientConnections)(m).map(function (cs) {
|
|
697
583
|
return cs.filter(function (c) {
|
|
698
584
|
return order(c) >= 0;
|
|
@@ -701,44 +587,35 @@ function filterConnections(m) {
|
|
|
701
587
|
});
|
|
702
588
|
}));
|
|
703
589
|
}
|
|
704
|
-
|
|
705
590
|
function useCustomPasswordlessConnection(m) {
|
|
706
591
|
return get(m, 'useCustomPasswordlessConnection');
|
|
707
592
|
}
|
|
708
|
-
|
|
709
593
|
function runHook(m, str) {
|
|
710
|
-
for (var _len6 = arguments.length, args = Array(_len6 > 2 ? _len6 - 2 : 0), _key6 = 2; _key6 < _len6; _key6++) {
|
|
594
|
+
for (var _len6 = arguments.length, args = new Array(_len6 > 2 ? _len6 - 2 : 0), _key6 = 2; _key6 < _len6; _key6++) {
|
|
711
595
|
args[_key6 - 2] = arguments[_key6];
|
|
712
596
|
}
|
|
713
|
-
|
|
714
|
-
return get(m, 'hookRunner').apply(undefined, [str, m].concat(args));
|
|
597
|
+
return get(m, 'hookRunner').apply(void 0, [str, m].concat(args));
|
|
715
598
|
}
|
|
716
|
-
|
|
717
599
|
function emitEvent(m, str) {
|
|
718
|
-
for (var _len7 = arguments.length, args = Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
|
|
600
|
+
for (var _len7 = arguments.length, args = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
|
|
719
601
|
args[_key7 - 2] = arguments[_key7];
|
|
720
602
|
}
|
|
721
|
-
|
|
722
603
|
setTimeout(function () {
|
|
723
604
|
var emitEventFn = get(m, 'emitEventFn');
|
|
724
|
-
var hadListener = emitEventFn.apply(
|
|
605
|
+
var hadListener = emitEventFn.apply(void 0, [str].concat(args));
|
|
725
606
|
// Handle uncaught custom error
|
|
726
607
|
if (str === 'unrecoverable_error' && !hadListener) {
|
|
727
|
-
throw
|
|
608
|
+
throw _construct(Error, args);
|
|
728
609
|
}
|
|
729
610
|
}, 0);
|
|
730
611
|
}
|
|
731
|
-
|
|
732
612
|
function handleEvent(m, str) {
|
|
733
613
|
var handleEventFn = get(m, 'handleEventFn');
|
|
734
|
-
|
|
735
|
-
for (var _len8 = arguments.length, args = Array(_len8 > 2 ? _len8 - 2 : 0), _key8 = 2; _key8 < _len8; _key8++) {
|
|
614
|
+
for (var _len8 = arguments.length, args = new Array(_len8 > 2 ? _len8 - 2 : 0), _key8 = 2; _key8 < _len8; _key8++) {
|
|
736
615
|
args[_key8 - 2] = arguments[_key8];
|
|
737
616
|
}
|
|
738
|
-
|
|
739
|
-
handleEventFn.apply(undefined, [str].concat(args));
|
|
617
|
+
handleEventFn.apply(void 0, [str].concat(args));
|
|
740
618
|
}
|
|
741
|
-
|
|
742
619
|
function loginErrorMessage(m, error, type) {
|
|
743
620
|
// NOTE: previous version of lock checked for status codes and, at
|
|
744
621
|
// some point, if the status code was 401 it defaults to an
|
|
@@ -754,36 +631,30 @@ function loginErrorMessage(m, error, type) {
|
|
|
754
631
|
if (error.code === 'rule_error' || error.code === 'hook_error') {
|
|
755
632
|
return error.description || i18n.html(m, ['error', 'login', 'lock.fallback']);
|
|
756
633
|
}
|
|
757
|
-
|
|
758
634
|
var INVALID_MAP = {
|
|
759
635
|
code: 'lock.invalid_code',
|
|
760
636
|
email: 'lock.invalid_email_password',
|
|
761
637
|
username: 'lock.invalid_username_password'
|
|
762
638
|
};
|
|
763
|
-
|
|
764
639
|
var code = error.error || error.code;
|
|
765
640
|
if (code === 'invalid_user_password' && INVALID_MAP[type]) {
|
|
766
641
|
code = INVALID_MAP[type];
|
|
767
642
|
}
|
|
768
|
-
|
|
769
643
|
if (code === 'a0.mfa_registration_required') {
|
|
770
644
|
code = 'lock.mfa_registration_required';
|
|
771
645
|
}
|
|
772
|
-
|
|
773
646
|
if (code === 'a0.mfa_invalid_code') {
|
|
774
647
|
code = 'lock.mfa_invalid_code';
|
|
775
648
|
}
|
|
776
649
|
if (code === 'password_expired') {
|
|
777
650
|
code = 'password_change_required';
|
|
778
651
|
}
|
|
779
|
-
|
|
780
652
|
if (code === 'invalid_captcha') {
|
|
781
653
|
var currentCaptcha = get(m, 'captcha');
|
|
782
654
|
if (currentCaptcha && currentCaptcha.get('provider') === 'recaptcha_v2') {
|
|
783
655
|
code = 'invalid_recaptcha';
|
|
784
656
|
}
|
|
785
657
|
}
|
|
786
|
-
|
|
787
658
|
return i18n.html(m, ['error', 'login', code]) || i18n.html(m, ['error', 'login', 'lock.fallback']);
|
|
788
659
|
}
|
|
789
660
|
|
|
@@ -794,78 +665,59 @@ function stop(m, error) {
|
|
|
794
665
|
return emitEvent(m, 'unrecoverable_error', error);
|
|
795
666
|
}, 17);
|
|
796
667
|
}
|
|
797
|
-
|
|
798
668
|
return set(m, 'stopped', true);
|
|
799
669
|
}
|
|
800
|
-
|
|
801
670
|
function hasStopped(m) {
|
|
802
671
|
return get(m, 'stopped');
|
|
803
672
|
}
|
|
804
|
-
|
|
805
673
|
function hashCleanup(m) {
|
|
806
674
|
return get(m, 'hashCleanup');
|
|
807
675
|
}
|
|
808
|
-
|
|
809
676
|
function emitHashParsedEvent(m, parsedHash) {
|
|
810
677
|
emitEvent(m, 'hash_parsed', parsedHash);
|
|
811
678
|
}
|
|
812
|
-
|
|
813
679
|
function emitAuthenticatedEvent(m, result) {
|
|
814
680
|
emitEvent(m, 'authenticated', result);
|
|
815
681
|
}
|
|
816
|
-
|
|
817
682
|
function emitAuthorizationErrorEvent(m, error) {
|
|
818
683
|
emitEvent(m, 'authorization_error', error);
|
|
819
684
|
}
|
|
820
|
-
|
|
821
685
|
function emitUnrecoverableErrorEvent(m, error) {
|
|
822
686
|
emitEvent(m, 'unrecoverable_error', error);
|
|
823
687
|
}
|
|
824
|
-
|
|
825
688
|
function showBadge(m) {
|
|
826
689
|
return (0, _index.hasFreeSubscription)(m) || false;
|
|
827
690
|
}
|
|
828
|
-
|
|
829
691
|
function overrideOptions(m, opts) {
|
|
830
692
|
if (!opts) opts = {};
|
|
831
|
-
|
|
832
693
|
if (opts.allowedConnections) {
|
|
833
|
-
m = tset(m, 'allowedConnections',
|
|
694
|
+
m = tset(m, 'allowedConnections', _immutable.default.fromJS(opts.allowedConnections));
|
|
834
695
|
}
|
|
835
|
-
|
|
836
696
|
if (opts.flashMessage) {
|
|
837
697
|
var type = opts.flashMessage.type;
|
|
838
|
-
|
|
839
698
|
var typeCapitalized = type.charAt(0).toUpperCase() + type.slice(1);
|
|
840
|
-
m = tset(m,
|
|
699
|
+
m = tset(m, "global".concat(typeCapitalized), opts.flashMessage.text);
|
|
841
700
|
}
|
|
842
|
-
|
|
843
701
|
if (opts.auth && opts.auth.params) {
|
|
844
|
-
m = tset(m, 'authParams',
|
|
702
|
+
m = tset(m, 'authParams', _immutable.default.fromJS(opts.auth.params));
|
|
845
703
|
}
|
|
846
|
-
|
|
847
704
|
if (opts.theme) {
|
|
848
705
|
if (opts.theme.primaryColor) {
|
|
849
706
|
m = tset(m, ['ui', 'primaryColor'], opts.theme.primaryColor);
|
|
850
707
|
}
|
|
851
|
-
|
|
852
708
|
if (opts.theme.logo) {
|
|
853
709
|
m = tset(m, ['ui', 'logo'], opts.theme.logo);
|
|
854
710
|
}
|
|
855
711
|
}
|
|
856
|
-
|
|
857
712
|
if (opts.language || opts.languageDictionary) {
|
|
858
713
|
if (opts.language) {
|
|
859
714
|
m = tset(m, ['ui', 'language'], opts.language);
|
|
860
715
|
}
|
|
861
|
-
|
|
862
716
|
if (opts.languageDictionary) {
|
|
863
717
|
m = tset(m, ['ui', 'dict'], opts.languageDictionary);
|
|
864
718
|
}
|
|
865
|
-
|
|
866
719
|
m = i18n.initI18n(m);
|
|
867
720
|
}
|
|
868
|
-
|
|
869
721
|
if (typeof opts.rememberLastLogin === 'boolean') {
|
|
870
722
|
m = tset(m, 'rememberLastLogin', opts.rememberLastLogin);
|
|
871
723
|
}
|
|
@@ -878,6 +730,5 @@ function overrideOptions(m, opts) {
|
|
|
878
730
|
if (typeof opts.allowPasswordAutocomplete === 'boolean') {
|
|
879
731
|
m = tset(m, 'allowPasswordAutocomplete', opts.allowPasswordAutocomplete);
|
|
880
732
|
}
|
|
881
|
-
|
|
882
733
|
return m;
|
|
883
734
|
}
|