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