auth0-lock 11.34.2 → 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 +26 -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
|
@@ -1,91 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var _react2 = _interopRequireDefault(_react);
|
|
12
|
-
|
|
13
|
-
var _auth_button = require('../button/auth_button');
|
|
14
|
-
|
|
15
|
-
var _auth_button2 = _interopRequireDefault(_auth_button);
|
|
16
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _auth_button = _interopRequireDefault(require("../button/auth_button"));
|
|
17
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
11
|
var QuickAuthPane = function QuickAuthPane(props) {
|
|
20
12
|
var alternativeLabel = props.alternativeLabel,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
buttonClickHandler(e);
|
|
57
|
-
},
|
|
58
|
-
strategy: strategy,
|
|
59
|
-
primaryColor: primaryColor,
|
|
60
|
-
foregroundColor: foregroundColor,
|
|
61
|
-
icon: buttonIcon
|
|
62
|
-
}),
|
|
63
|
-
alternative,
|
|
64
|
-
_react2.default.createElement(
|
|
65
|
-
'div',
|
|
66
|
-
{ className: 'auth0-loading-container' },
|
|
67
|
-
_react2.default.createElement('div', { className: 'auth0-loading' })
|
|
68
|
-
)
|
|
69
|
-
);
|
|
13
|
+
alternativeClickHandler = props.alternativeClickHandler,
|
|
14
|
+
buttonLabel = props.buttonLabel,
|
|
15
|
+
buttonClickHandler = props.buttonClickHandler,
|
|
16
|
+
header = props.header,
|
|
17
|
+
strategy = props.strategy,
|
|
18
|
+
buttonIcon = props.buttonIcon,
|
|
19
|
+
primaryColor = props.primaryColor,
|
|
20
|
+
foregroundColor = props.foregroundColor;
|
|
21
|
+
var alternative = alternativeLabel ? /*#__PURE__*/_react.default.createElement("p", {
|
|
22
|
+
className: "auth0-lock-alternative"
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
24
|
+
className: "auth0-lock-alternative-link",
|
|
25
|
+
href: "#",
|
|
26
|
+
onClick: function onClick(e) {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
alternativeClickHandler(e);
|
|
29
|
+
}
|
|
30
|
+
}, alternativeLabel)) : null;
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
className: "auth0-lock-last-login-pane"
|
|
33
|
+
}, header, /*#__PURE__*/_react.default.createElement(_auth_button.default, {
|
|
34
|
+
label: buttonLabel,
|
|
35
|
+
onClick: function onClick(e) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
buttonClickHandler(e);
|
|
38
|
+
},
|
|
39
|
+
strategy: strategy,
|
|
40
|
+
primaryColor: primaryColor,
|
|
41
|
+
foregroundColor: foregroundColor,
|
|
42
|
+
icon: buttonIcon
|
|
43
|
+
}), alternative, /*#__PURE__*/_react.default.createElement("div", {
|
|
44
|
+
className: "auth0-loading-container"
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
46
|
+
className: "auth0-loading"
|
|
47
|
+
})));
|
|
70
48
|
};
|
|
71
|
-
|
|
72
49
|
QuickAuthPane.propTypes = {
|
|
73
|
-
alternativeLabel:
|
|
50
|
+
alternativeLabel: _propTypes.default.string,
|
|
74
51
|
alternativeClickHandler: function alternativeClickHandler(props, propName, component) {
|
|
75
|
-
for (var _len = arguments.length, rest = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
76
|
-
rest[_key - 3] = arguments[_key];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
52
|
if (props.alternativeLabel !== undefined) {
|
|
80
53
|
var _PropTypes$func;
|
|
81
|
-
|
|
82
|
-
|
|
54
|
+
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
55
|
+
rest[_key - 3] = arguments[_key];
|
|
56
|
+
}
|
|
57
|
+
return (_PropTypes$func = _propTypes.default.func).isRequired.apply(_PropTypes$func, [props, propName, component].concat(rest));
|
|
83
58
|
}
|
|
84
59
|
},
|
|
85
|
-
buttonLabel:
|
|
86
|
-
buttonClickHandler:
|
|
87
|
-
header:
|
|
88
|
-
strategy:
|
|
60
|
+
buttonLabel: _propTypes.default.string.isRequired,
|
|
61
|
+
buttonClickHandler: _propTypes.default.func.isRequired,
|
|
62
|
+
header: _propTypes.default.element,
|
|
63
|
+
strategy: _propTypes.default.string.isRequired
|
|
89
64
|
};
|
|
90
|
-
|
|
91
|
-
exports.default =
|
|
65
|
+
var _default = QuickAuthPane;
|
|
66
|
+
exports.default = _default;
|
package/lib/utils/atom.js
CHANGED
|
@@ -1,64 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.default = atom;
|
|
5
|
-
|
|
7
|
+
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); }
|
|
6
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
+
var Atom = /*#__PURE__*/function () {
|
|
9
14
|
function Atom(state) {
|
|
10
15
|
_classCallCheck(this, Atom);
|
|
11
|
-
|
|
12
16
|
this.state = state;
|
|
13
17
|
this.watches = {};
|
|
14
18
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Atom.prototype.swap = function swap(f) {
|
|
21
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
22
|
-
args[_key - 1] = arguments[_key];
|
|
19
|
+
_createClass(Atom, [{
|
|
20
|
+
key: "reset",
|
|
21
|
+
value: function reset(state) {
|
|
22
|
+
return this._change(state);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
24
|
+
}, {
|
|
25
|
+
key: "swap",
|
|
26
|
+
value: function swap(f) {
|
|
27
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
28
|
+
args[_key - 1] = arguments[_key];
|
|
29
|
+
}
|
|
30
|
+
return this._change(f.apply(void 0, [this.state].concat(args)));
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
key: "deref",
|
|
34
|
+
value: function deref() {
|
|
35
|
+
return this.state;
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
key: "addWatch",
|
|
39
|
+
value: function addWatch(k, f) {
|
|
40
|
+
// if (this.watches[key]) {
|
|
41
|
+
// console.warn(`adding a watch with an already registered key: ${k}`);
|
|
42
|
+
// }
|
|
43
|
+
this.watches[k] = f;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "removeWatch",
|
|
48
|
+
value: function removeWatch(k) {
|
|
49
|
+
// if (!this.watches[key]) {
|
|
50
|
+
// console.warn(`removing a watch with an unknown key: ${k}`);
|
|
51
|
+
// }
|
|
52
|
+
delete this.watches[k];
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
key: "_change",
|
|
57
|
+
value: function _change(newState) {
|
|
58
|
+
var state = this.state,
|
|
50
59
|
watches = this.watches;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
|
|
60
|
+
this.state = newState;
|
|
61
|
+
Object.keys(watches).forEach(function (k) {
|
|
62
|
+
return watches[k](k, state, newState);
|
|
63
|
+
});
|
|
64
|
+
return this.state;
|
|
65
|
+
}
|
|
66
|
+
}]);
|
|
59
67
|
return Atom;
|
|
60
68
|
}();
|
|
61
|
-
|
|
62
69
|
function atom(state) {
|
|
63
70
|
return new Atom(state);
|
|
64
71
|
}
|
package/lib/utils/cache.js
CHANGED
|
@@ -1,57 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
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); }
|
|
8
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
5
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
|
|
7
|
-
|
|
15
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
+
var Cache = /*#__PURE__*/function () {
|
|
8
20
|
function Cache(fetchFn) {
|
|
9
21
|
_classCallCheck(this, Cache);
|
|
10
|
-
|
|
11
22
|
this.cache = {};
|
|
12
23
|
this.cbs = {};
|
|
13
24
|
this.fetchFn = fetchFn;
|
|
14
25
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
args
|
|
26
|
+
_createClass(Cache, [{
|
|
27
|
+
key: "get",
|
|
28
|
+
value: function get() {
|
|
29
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
|
+
args[_key] = arguments[_key];
|
|
31
|
+
}
|
|
32
|
+
var cb = args.pop();
|
|
33
|
+
var key = JSON.stringify(args);
|
|
34
|
+
if (this.cache[key]) return cb(null, this.cache[key]);
|
|
35
|
+
if (this.registerCallback(key, cb) > 1) return;
|
|
36
|
+
this.fetch(key, args);
|
|
19
37
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Cache.prototype.fetch = function fetch(key, args) {
|
|
29
|
-
var _this = this;
|
|
30
|
-
|
|
31
|
-
this.fetchFn.apply(this, args.concat([function (error, result) {
|
|
32
|
-
if (!error) _this.cache[key] = result;
|
|
33
|
-
_this.execCallbacks(key, error, result);
|
|
34
|
-
}]));
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
Cache.prototype.registerCallback = function registerCallback(key, cb) {
|
|
38
|
-
this.cbs[key] = this.cbs[key] || [];
|
|
39
|
-
this.cbs[key].push(cb);
|
|
40
|
-
return this.cbs[key].length;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
Cache.prototype.execCallbacks = function execCallbacks(key) {
|
|
44
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
45
|
-
args[_key2 - 1] = arguments[_key2];
|
|
38
|
+
}, {
|
|
39
|
+
key: "fetch",
|
|
40
|
+
value: function fetch(key, args) {
|
|
41
|
+
var _this = this;
|
|
42
|
+
this.fetchFn.apply(this, _toConsumableArray(args).concat([function (error, result) {
|
|
43
|
+
if (!error) _this.cache[key] = result;
|
|
44
|
+
_this.execCallbacks(key, error, result);
|
|
45
|
+
}]));
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
}, {
|
|
48
|
+
key: "registerCallback",
|
|
49
|
+
value: function registerCallback(key, cb) {
|
|
50
|
+
this.cbs[key] = this.cbs[key] || [];
|
|
51
|
+
this.cbs[key].push(cb);
|
|
52
|
+
return this.cbs[key].length;
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "execCallbacks",
|
|
56
|
+
value: function execCallbacks(key) {
|
|
57
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
58
|
+
args[_key2 - 1] = arguments[_key2];
|
|
59
|
+
}
|
|
60
|
+
if (this.cbs[key]) this.cbs[key].forEach(function (f) {
|
|
61
|
+
return f.apply(void 0, args);
|
|
62
|
+
});
|
|
63
|
+
delete this.cbs[key];
|
|
64
|
+
}
|
|
65
|
+
}]);
|
|
54
66
|
return Cache;
|
|
55
67
|
}();
|
|
56
|
-
|
|
57
68
|
exports.default = Cache;
|
package/lib/utils/cdn_utils.js
CHANGED
|
@@ -1,35 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.load = load;
|
|
5
7
|
exports.preload = preload;
|
|
6
|
-
|
|
7
|
-
var _auth0Js = require('auth0-js');
|
|
8
|
-
|
|
9
|
-
var _auth0Js2 = _interopRequireDefault(_auth0Js);
|
|
10
|
-
|
|
8
|
+
var _auth0Js = _interopRequireDefault(require("auth0-js"));
|
|
11
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
10
|
if (typeof window !== 'undefined' && !window.Auth0) {
|
|
14
11
|
window.Auth0 = {};
|
|
15
12
|
}
|
|
16
|
-
|
|
17
13
|
var cbs = {};
|
|
18
|
-
|
|
19
14
|
function load(attrs) {
|
|
20
15
|
var cb = attrs.cb,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
check = attrs.check,
|
|
17
|
+
method = attrs.method,
|
|
18
|
+
url = attrs.url;
|
|
26
19
|
if (!cbs[method]) {
|
|
27
20
|
cbs[method] = [];
|
|
28
21
|
window.Auth0[method] = function () {
|
|
29
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
22
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
23
|
args[_key] = arguments[_key];
|
|
31
24
|
}
|
|
32
|
-
|
|
33
25
|
cbs[method] = cbs[method].filter(function (x) {
|
|
34
26
|
if (x.check.apply(x, args)) {
|
|
35
27
|
setTimeout(function () {
|
|
@@ -42,19 +34,18 @@ function load(attrs) {
|
|
|
42
34
|
});
|
|
43
35
|
};
|
|
44
36
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
cbs[method].push({
|
|
38
|
+
cb: cb,
|
|
39
|
+
check: check,
|
|
40
|
+
url: url
|
|
41
|
+
});
|
|
48
42
|
var count = cbs[method].reduce(function (r, x) {
|
|
49
43
|
return r + (x.url === url ? 1 : 0);
|
|
50
44
|
}, 0);
|
|
51
|
-
|
|
52
45
|
if (count > 1) return;
|
|
53
|
-
|
|
54
46
|
var script = window.document.createElement('script');
|
|
55
47
|
script.src = url;
|
|
56
48
|
window.document.getElementsByTagName('head')[0].appendChild(script);
|
|
57
|
-
|
|
58
49
|
var handleError = function handleError(err) {
|
|
59
50
|
cbs[method] = cbs[method].filter(function (x) {
|
|
60
51
|
if (x.url === url) {
|
|
@@ -67,24 +58,19 @@ function load(attrs) {
|
|
|
67
58
|
}
|
|
68
59
|
});
|
|
69
60
|
};
|
|
70
|
-
|
|
71
61
|
var timeoutID = setTimeout(function () {
|
|
72
|
-
return handleError(new Error(url
|
|
62
|
+
return handleError(new Error("".concat(url, " timed out")));
|
|
73
63
|
}, 20000);
|
|
74
|
-
|
|
75
64
|
script.addEventListener('load', function () {
|
|
76
65
|
return clearTimeout(timeoutID);
|
|
77
66
|
});
|
|
78
|
-
|
|
79
67
|
script.addEventListener('error', function () {
|
|
80
68
|
clearTimeout(timeoutID);
|
|
81
|
-
handleError(new Error(url
|
|
69
|
+
handleError(new Error("".concat(url, " could not be loaded.")));
|
|
82
70
|
});
|
|
83
71
|
}
|
|
84
|
-
|
|
85
72
|
function preload(_ref) {
|
|
86
73
|
var method = _ref.method,
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
cb = _ref.cb;
|
|
89
75
|
window.Auth0[method] = cb;
|
|
90
76
|
}
|
package/lib/utils/createRef.js
CHANGED
package/lib/utils/data_utils.js
CHANGED
|
@@ -1,40 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
|
|
5
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
1
|
+
"use strict";
|
|
6
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
7
6
|
exports.dataFns = dataFns;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
var _immutable = require("immutable");
|
|
8
|
+
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); }
|
|
11
9
|
function dataFns(baseNSKeyPath) {
|
|
12
10
|
function keyPath(nsKeyPath, keyOrKeyPath) {
|
|
13
|
-
return nsKeyPath.concat(
|
|
11
|
+
return nsKeyPath.concat(_typeof(keyOrKeyPath) === 'object' ? keyOrKeyPath : [keyOrKeyPath]);
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
function getFn(nsKeyPath) {
|
|
17
14
|
return function (m, keyOrKeyPath) {
|
|
18
15
|
var notSetValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
19
|
-
|
|
20
16
|
return m.getIn(keyPath(nsKeyPath, keyOrKeyPath), notSetValue);
|
|
21
17
|
};
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
function setFn(nsKeyPath) {
|
|
25
20
|
return function (m, keyOrKeyPath, value) {
|
|
26
21
|
return m.setIn(keyPath(nsKeyPath, keyOrKeyPath), value);
|
|
27
22
|
};
|
|
28
23
|
}
|
|
29
|
-
|
|
30
24
|
function removeFn(nsKeyPath) {
|
|
31
25
|
return function (m, keyOrKeyPath) {
|
|
32
26
|
return m.removeIn(keyPath(nsKeyPath, keyOrKeyPath));
|
|
33
27
|
};
|
|
34
28
|
}
|
|
35
|
-
|
|
36
29
|
var transientNSKeyPath = baseNSKeyPath.concat(['transient']);
|
|
37
|
-
|
|
38
30
|
return {
|
|
39
31
|
get: getFn(baseNSKeyPath),
|
|
40
32
|
set: setFn(baseNSKeyPath),
|
|
@@ -48,7 +40,9 @@ function dataFns(baseNSKeyPath) {
|
|
|
48
40
|
});
|
|
49
41
|
},
|
|
50
42
|
init: function init(id, m) {
|
|
51
|
-
return new _immutable.Map({
|
|
43
|
+
return new _immutable.Map({
|
|
44
|
+
id: id
|
|
45
|
+
}).setIn(baseNSKeyPath, m);
|
|
52
46
|
},
|
|
53
47
|
initNS: function initNS(m, ns) {
|
|
54
48
|
return m.setIn(baseNSKeyPath, ns);
|
package/lib/utils/fn_utils.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.debounce = debounce;
|
|
5
7
|
function debounce(f, delay) {
|
|
6
|
-
var t
|
|
8
|
+
var t;
|
|
7
9
|
return function () {
|
|
8
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
10
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9
11
|
args[_key] = arguments[_key];
|
|
10
12
|
}
|
|
11
|
-
|
|
12
13
|
function handler() {
|
|
13
14
|
clearTimeout(t);
|
|
14
15
|
f.apply(undefined, args);
|
package/lib/utils/format.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
|
|
5
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
1
|
+
"use strict";
|
|
6
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
7
6
|
exports.default = format;
|
|
7
|
+
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); }
|
|
8
8
|
// Code attribution
|
|
9
9
|
// Inlined and modified from https://github.com/browserify/node-util/blob/e37ce41f4063bcd7bc27e01470d6654053bdcd14/util.js#L33-L69
|
|
10
10
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
11
11
|
// Please see LICENSE for full copyright and license attribution.
|
|
12
12
|
var formatRegExp = /%[sdj%]/g;
|
|
13
|
-
|
|
14
13
|
function format(f) {
|
|
15
14
|
var i = 1;
|
|
16
15
|
var args = arguments;
|
|
@@ -42,7 +41,6 @@ function format(f) {
|
|
|
42
41
|
}
|
|
43
42
|
return str;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
44
|
function isObject(arg) {
|
|
47
|
-
return
|
|
45
|
+
return _typeof(arg) === 'object' && arg !== null;
|
|
48
46
|
}
|
package/lib/utils/id_utils.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
5
6
|
exports.incremental = incremental;
|
|
7
|
+
exports.random = random;
|
|
6
8
|
function random() {
|
|
7
9
|
return (+new Date() + Math.floor(Math.random() * 10000000)).toString(36);
|
|
8
10
|
}
|
|
9
|
-
|
|
10
11
|
var start = 1;
|
|
11
12
|
function incremental() {
|
|
12
13
|
return start++;
|