@stokr/components-library 2.3.41-beta.17 → 2.3.41-beta.19
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.
|
@@ -24,7 +24,7 @@ var Chip = function Chip(_ref) {
|
|
|
24
24
|
isActive: isActive
|
|
25
25
|
}, props), /*#__PURE__*/_react.default.createElement(_ChipStyles.ChipText, null, children), tooltip && /*#__PURE__*/_react.default.createElement(_InfoIcon.default, {
|
|
26
26
|
title: tooltip,
|
|
27
|
-
position: "
|
|
27
|
+
position: "top",
|
|
28
28
|
noIcon: true,
|
|
29
29
|
noMarginLeft: true,
|
|
30
30
|
noMarginRight: true
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _formik = require("formik");
|
|
11
11
|
var _formikPersist = require("formik-persist");
|
|
@@ -17,16 +17,17 @@ var _InputPassword = _interopRequireDefault(require("../Input/InputPassword"));
|
|
|
17
17
|
var _Button = _interopRequireDefault(require("../Button/Button.styles"));
|
|
18
18
|
var _Grid = require("../Grid/Grid.styles");
|
|
19
19
|
var _ComponentWrapper = _interopRequireDefault(require("../ComponentWrapper/ComponentWrapper.styles"));
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
21
|
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); }
|
|
21
22
|
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; }
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
var ResetPasswordModal = function ResetPasswordModal(_ref) {
|
|
24
24
|
var isModalOpen = _ref.isModalOpen,
|
|
25
25
|
onModalClose = _ref.onModalClose,
|
|
26
26
|
onFormSend = _ref.onFormSend,
|
|
27
27
|
onModalSwitch = _ref.onModalSwitch,
|
|
28
28
|
popupError = _ref.popupError,
|
|
29
|
-
isActionLoading = _ref.isActionLoading
|
|
29
|
+
isActionLoading = _ref.isActionLoading,
|
|
30
|
+
onLoad = _ref.onLoad;
|
|
30
31
|
var initialValues = {
|
|
31
32
|
password: '',
|
|
32
33
|
confirmPassword: ''
|
|
@@ -35,6 +36,9 @@ var ResetPasswordModal = function ResetPasswordModal(_ref) {
|
|
|
35
36
|
password: Yup.string().required('Oops, this can‘t be blank'),
|
|
36
37
|
confirmPassword: Yup.string().required('Oops, this can‘t be blank')
|
|
37
38
|
});
|
|
39
|
+
(0, _react.useEffect)(function () {
|
|
40
|
+
onLoad && onLoad();
|
|
41
|
+
}, [onLoad]);
|
|
38
42
|
return /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
|
|
39
43
|
isOpen: isModalOpen,
|
|
40
44
|
onClose: onModalClose
|
|
@@ -17,11 +17,14 @@ var _LoginModal = _interopRequireDefault(require("../LoginModal/LoginModal"));
|
|
|
17
17
|
var _VerifyEmailModal = _interopRequireDefault(require("../VerifyEmailModal/VerifyEmailModal"));
|
|
18
18
|
var _Header = _interopRequireDefault(require("../Header/Header"));
|
|
19
19
|
var _FA = require("../2FA");
|
|
20
|
+
var _ResendConfirmationCodeModal = _interopRequireDefault(require("../ResendConfirmationCodeModal/ResendConfirmationCodeModal"));
|
|
20
21
|
var _auth = _interopRequireDefault(require("../../api/auth"));
|
|
21
22
|
var _fetchDataPublic = _interopRequireDefault(require("../../api/fetchDataPublic"));
|
|
22
23
|
var _AuthContext = require("../../context/AuthContext");
|
|
23
24
|
var _withRouter = require("../../utils/withRouter");
|
|
24
25
|
var _customHooks = require("../../utils/customHooks");
|
|
26
|
+
var _auth2 = require("firebase/auth");
|
|
27
|
+
var _firebaseConfig = require("../../firebase-config");
|
|
25
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
29
|
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); }
|
|
27
30
|
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; }
|
|
@@ -55,6 +58,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
55
58
|
_inherits(HeaderHoClass, _Component);
|
|
56
59
|
var _super = _createSuper(HeaderHoClass);
|
|
57
60
|
function HeaderHoClass() {
|
|
61
|
+
var _isModalOpen;
|
|
58
62
|
var _this;
|
|
59
63
|
_classCallCheck(this, HeaderHoClass);
|
|
60
64
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -63,7 +67,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
63
67
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
64
68
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
65
69
|
mobileMenuOpen: false,
|
|
66
|
-
isModalOpen:
|
|
70
|
+
isModalOpen: (_isModalOpen = {
|
|
67
71
|
login: false,
|
|
68
72
|
signUp: false,
|
|
69
73
|
terms: false,
|
|
@@ -74,7 +78,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
74
78
|
enter2fa: false,
|
|
75
79
|
resetCode: false,
|
|
76
80
|
verifyEmail: false
|
|
77
|
-
}, "resetPassword", false),
|
|
81
|
+
}, _defineProperty(_isModalOpen, "resetPassword", false), _defineProperty(_isModalOpen, "resendConfirmation", false), _isModalOpen),
|
|
78
82
|
userInfo: {
|
|
79
83
|
email: undefined,
|
|
80
84
|
password: undefined,
|
|
@@ -91,112 +95,26 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
91
95
|
message: undefined
|
|
92
96
|
},
|
|
93
97
|
isActionLoading: undefined,
|
|
94
|
-
termsData: undefined
|
|
95
|
-
isPasswordResetLinkExpired: false
|
|
98
|
+
termsData: undefined
|
|
96
99
|
});
|
|
97
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
98
|
-
var _this$props, isResetPassword,
|
|
100
|
+
_defineProperty(_assertThisInitialized(_this), "checkForModals", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
101
|
+
var _this$props, isLogin, isSignUp, isResetPassword, isVerifyEmail, user, isModalOpen, login, signUp, resetPassword, verifyEmail, isAnyModalOpen;
|
|
99
102
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
100
103
|
while (1) switch (_context.prev = _context.next) {
|
|
101
104
|
case 0:
|
|
102
|
-
_this$props = _this.props,
|
|
103
|
-
if (!isResetPassword) {
|
|
104
|
-
_context.next = 15;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
oobCode = urlParams === null || urlParams === void 0 ? void 0 : urlParams.getUrlParam('oobCode');
|
|
108
|
-
if (!(oobCode && oobCode !== '')) {
|
|
109
|
-
_context.next = 15;
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
_context.prev = 4;
|
|
113
|
-
_context.next = 7;
|
|
114
|
-
return _this.checkTokenExpiration();
|
|
115
|
-
case 7:
|
|
116
|
-
tokenStatus = _context.sent;
|
|
117
|
-
_this.setState(function (prevState) {
|
|
118
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
119
|
-
isPasswordResetLinkExpired: tokenStatus.expired
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
_context.next = 15;
|
|
123
|
-
break;
|
|
124
|
-
case 11:
|
|
125
|
-
_context.prev = 11;
|
|
126
|
-
_context.t0 = _context["catch"](4);
|
|
127
|
-
console.error('Error checking token expiration in componentDidMount:', _context.t0);
|
|
128
|
-
// if there's an error checking the token, assume it's expired
|
|
129
|
-
_this.setState(function (prevState) {
|
|
130
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
131
|
-
isPasswordResetLinkExpired: true
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
case 15:
|
|
135
|
-
case "end":
|
|
136
|
-
return _context.stop();
|
|
137
|
-
}
|
|
138
|
-
}, _callee, null, [[4, 11]]);
|
|
139
|
-
})));
|
|
140
|
-
_defineProperty(_assertThisInitialized(_this), "checkTokenExpiration", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
141
|
-
var urlParams, oobCode, result;
|
|
142
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
143
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
144
|
-
case 0:
|
|
145
|
-
urlParams = _this.props.urlParams;
|
|
146
|
-
if (urlParams) {
|
|
147
|
-
_context2.next = 3;
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
return _context2.abrupt("return", {
|
|
151
|
-
expired: true
|
|
152
|
-
});
|
|
153
|
-
case 3:
|
|
154
|
-
_context2.prev = 3;
|
|
155
|
-
oobCode = urlParams.getUrlParam('oobCode');
|
|
156
|
-
if (oobCode) {
|
|
157
|
-
_context2.next = 7;
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
return _context2.abrupt("return", {
|
|
161
|
-
expired: true
|
|
162
|
-
});
|
|
163
|
-
case 7:
|
|
164
|
-
_context2.next = 9;
|
|
165
|
-
return _this.context.checkActivationLinkExpired(oobCode);
|
|
166
|
-
case 9:
|
|
167
|
-
result = _context2.sent;
|
|
168
|
-
return _context2.abrupt("return", result);
|
|
169
|
-
case 13:
|
|
170
|
-
_context2.prev = 13;
|
|
171
|
-
_context2.t0 = _context2["catch"](3);
|
|
172
|
-
console.error('Error checking token expiration:', _context2.t0);
|
|
173
|
-
return _context2.abrupt("return", {
|
|
174
|
-
expired: true
|
|
175
|
-
});
|
|
176
|
-
case 17:
|
|
177
|
-
case "end":
|
|
178
|
-
return _context2.stop();
|
|
179
|
-
}
|
|
180
|
-
}, _callee2, null, [[3, 13]]);
|
|
181
|
-
})));
|
|
182
|
-
_defineProperty(_assertThisInitialized(_this), "checkForModals", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
183
|
-
var _this$props2, isLogin, isSignUp, isResetPassword, isVerifyEmail, user, _this$state, isModalOpen, isPasswordResetLinkExpired, login, signUp, resetPassword, verifyEmail, isAnyModalOpen;
|
|
184
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
185
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
186
|
-
case 0:
|
|
187
|
-
_this$props2 = _this.props, isLogin = _this$props2.isLogin, isSignUp = _this$props2.isSignUp, isResetPassword = _this$props2.isResetPassword, isVerifyEmail = _this$props2.isVerifyEmail;
|
|
105
|
+
_this$props = _this.props, isLogin = _this$props.isLogin, isSignUp = _this$props.isSignUp, isResetPassword = _this$props.isResetPassword, isVerifyEmail = _this$props.isVerifyEmail;
|
|
188
106
|
user = _this.context.user;
|
|
189
|
-
|
|
107
|
+
isModalOpen = _this.state.isModalOpen;
|
|
190
108
|
login = isModalOpen.login, signUp = isModalOpen.signUp, resetPassword = isModalOpen.resetPassword, verifyEmail = isModalOpen.verifyEmail; //checks if any modal is open
|
|
191
109
|
//if true we won't open any modal from below
|
|
192
110
|
isAnyModalOpen = Object.values(isModalOpen).some(function (value) {
|
|
193
111
|
return value === true;
|
|
194
112
|
});
|
|
195
113
|
if (!isAnyModalOpen) {
|
|
196
|
-
|
|
114
|
+
_context.next = 7;
|
|
197
115
|
break;
|
|
198
116
|
}
|
|
199
|
-
return
|
|
117
|
+
return _context.abrupt("return");
|
|
200
118
|
case 7:
|
|
201
119
|
//dont open if modal is already open or user is logged in
|
|
202
120
|
if (isLogin && !user && !login) {
|
|
@@ -218,25 +136,13 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
218
136
|
});
|
|
219
137
|
}
|
|
220
138
|
if (isResetPassword && !user && !resetPassword) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
forgot: true
|
|
227
|
-
})
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
} else {
|
|
231
|
-
// open usual reset password modal if token is valid
|
|
232
|
-
_this.setState(function (prevState) {
|
|
233
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
234
|
-
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
235
|
-
resetPassword: true
|
|
236
|
-
})
|
|
237
|
-
});
|
|
139
|
+
_this.setState(function (prevState) {
|
|
140
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
141
|
+
isModalOpen: _objectSpread(_objectSpread({}, prevState.isModalOpen), {}, {
|
|
142
|
+
resetPassword: true
|
|
143
|
+
})
|
|
238
144
|
});
|
|
239
|
-
}
|
|
145
|
+
});
|
|
240
146
|
}
|
|
241
147
|
if (isVerifyEmail && !verifyEmail) {
|
|
242
148
|
_this.setState(function (prevState) {
|
|
@@ -249,15 +155,15 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
249
155
|
}
|
|
250
156
|
case 11:
|
|
251
157
|
case "end":
|
|
252
|
-
return
|
|
158
|
+
return _context.stop();
|
|
253
159
|
}
|
|
254
|
-
},
|
|
160
|
+
}, _callee);
|
|
255
161
|
})));
|
|
256
162
|
_defineProperty(_assertThisInitialized(_this), "setOpenModalStatus", function (modalId, status) {
|
|
257
163
|
var isModalOpen = _this.state.isModalOpen;
|
|
258
|
-
var _this$
|
|
259
|
-
onSignupModalClose = _this$
|
|
260
|
-
navigate = _this$
|
|
164
|
+
var _this$props2 = _this.props,
|
|
165
|
+
onSignupModalClose = _this$props2.onSignupModalClose,
|
|
166
|
+
navigate = _this$props2.navigate;
|
|
261
167
|
|
|
262
168
|
//if we pass custom onSignupModalClose, we don't want any modification in the url
|
|
263
169
|
if (!onSignupModalClose) {
|
|
@@ -372,8 +278,6 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
372
278
|
this.props.navigate('/login');
|
|
373
279
|
this.props.navigate(0);
|
|
374
280
|
}
|
|
375
|
-
|
|
376
|
-
// Run after page loaded
|
|
377
281
|
if (!isFetchingUser) {
|
|
378
282
|
this.checkForModals();
|
|
379
283
|
}
|
|
@@ -382,20 +286,20 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
382
286
|
key: "render",
|
|
383
287
|
value: function render() {
|
|
384
288
|
var _this2 = this;
|
|
385
|
-
var _this$
|
|
386
|
-
isModalOpen = _this$
|
|
387
|
-
userInfo = _this$
|
|
388
|
-
isActionLoading = _this$
|
|
389
|
-
termsData = _this$
|
|
390
|
-
var _this$
|
|
391
|
-
fixed = _this$
|
|
392
|
-
activateMenu = _this$
|
|
393
|
-
activeMenu = _this$
|
|
394
|
-
withoutLoginSignupButton = _this$
|
|
395
|
-
useRelativePathForMenu = _this$
|
|
396
|
-
isLoginModalOpen = _this$
|
|
397
|
-
setIsLoginModalOpen = _this$
|
|
398
|
-
cooldown = _this$
|
|
289
|
+
var _this$state = this.state,
|
|
290
|
+
isModalOpen = _this$state.isModalOpen,
|
|
291
|
+
userInfo = _this$state.userInfo,
|
|
292
|
+
isActionLoading = _this$state.isActionLoading,
|
|
293
|
+
termsData = _this$state.termsData;
|
|
294
|
+
var _this$props3 = this.props,
|
|
295
|
+
fixed = _this$props3.fixed,
|
|
296
|
+
activateMenu = _this$props3.activateMenu,
|
|
297
|
+
activeMenu = _this$props3.activeMenu,
|
|
298
|
+
withoutLoginSignupButton = _this$props3.withoutLoginSignupButton,
|
|
299
|
+
useRelativePathForMenu = _this$props3.useRelativePathForMenu,
|
|
300
|
+
isLoginModalOpen = _this$props3.isLoginModalOpen,
|
|
301
|
+
setIsLoginModalOpen = _this$props3.setIsLoginModalOpen,
|
|
302
|
+
cooldown = _this$props3.cooldown;
|
|
399
303
|
var _this$context2 = this.context,
|
|
400
304
|
getUser = _this$context2.getUser,
|
|
401
305
|
_this$context2$user = _this$context2.user,
|
|
@@ -451,47 +355,47 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
451
355
|
_this2.setIsActionLoading(undefined);
|
|
452
356
|
},
|
|
453
357
|
onFormSend: /*#__PURE__*/function () {
|
|
454
|
-
var
|
|
358
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
|
|
455
359
|
var email, password, errorMessage;
|
|
456
|
-
return _regeneratorRuntime().wrap(function
|
|
457
|
-
while (1) switch (
|
|
360
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
361
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
458
362
|
case 0:
|
|
459
|
-
email =
|
|
363
|
+
email = _ref3.email, password = _ref3.password;
|
|
460
364
|
_this2.clearPopupError();
|
|
461
365
|
_this2.setIsActionLoading('login');
|
|
462
|
-
|
|
366
|
+
_context2.prev = 3;
|
|
463
367
|
if (!(password.length > 128)) {
|
|
464
|
-
|
|
368
|
+
_context2.next = 8;
|
|
465
369
|
break;
|
|
466
370
|
}
|
|
467
371
|
_this2.setPopupError('login', 'Your password cannot exceed 128 characters');
|
|
468
372
|
_this2.setIsActionLoading(undefined);
|
|
469
|
-
return
|
|
373
|
+
return _context2.abrupt("return");
|
|
470
374
|
case 8:
|
|
471
|
-
|
|
375
|
+
_context2.next = 10;
|
|
472
376
|
return loginUser(email, password);
|
|
473
377
|
case 10:
|
|
474
|
-
|
|
378
|
+
_context2.next = 12;
|
|
475
379
|
return getUser();
|
|
476
380
|
case 12:
|
|
477
381
|
_this2.setOpenModalStatus('login', false);
|
|
478
382
|
setIsLoginModalOpen && setIsLoginModalOpen(false);
|
|
479
383
|
_this2.clearPopupError();
|
|
480
384
|
_this2.setIsActionLoading(undefined);
|
|
481
|
-
|
|
385
|
+
_context2.next = 28;
|
|
482
386
|
break;
|
|
483
387
|
case 18:
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
errorMessage =
|
|
487
|
-
if (!((
|
|
488
|
-
|
|
388
|
+
_context2.prev = 18;
|
|
389
|
+
_context2.t0 = _context2["catch"](3);
|
|
390
|
+
errorMessage = _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.message; //handle switch modal correctly
|
|
391
|
+
if (!((_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code) === 'auth/multi-factor-auth-required')) {
|
|
392
|
+
_context2.next = 26;
|
|
489
393
|
break;
|
|
490
394
|
}
|
|
491
395
|
_this2.switchOpenModal('login', 'enter2fa');
|
|
492
396
|
_this2.clearPopupError();
|
|
493
397
|
_this2.setIsActionLoading(undefined);
|
|
494
|
-
return
|
|
398
|
+
return _context2.abrupt("return");
|
|
495
399
|
case 26:
|
|
496
400
|
if (errorMessage) {
|
|
497
401
|
_this2.setPopupError('login', errorMessage);
|
|
@@ -501,12 +405,12 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
501
405
|
_this2.setIsActionLoading(undefined);
|
|
502
406
|
case 28:
|
|
503
407
|
case "end":
|
|
504
|
-
return
|
|
408
|
+
return _context2.stop();
|
|
505
409
|
}
|
|
506
|
-
},
|
|
410
|
+
}, _callee2, null, [[3, 18]]);
|
|
507
411
|
}));
|
|
508
412
|
return function (_x) {
|
|
509
|
-
return
|
|
413
|
+
return _ref4.apply(this, arguments);
|
|
510
414
|
};
|
|
511
415
|
}()
|
|
512
416
|
}), waitingFor2fa && /*#__PURE__*/_react.default.createElement(_FA.EnterCode, {
|
|
@@ -525,46 +429,46 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
525
429
|
_this2.setIsActionLoading(undefined);
|
|
526
430
|
},
|
|
527
431
|
onFormSend: /*#__PURE__*/function () {
|
|
528
|
-
var
|
|
432
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
|
|
529
433
|
var otpInput;
|
|
530
|
-
return _regeneratorRuntime().wrap(function
|
|
531
|
-
while (1) switch (
|
|
434
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
435
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
532
436
|
case 0:
|
|
533
|
-
otpInput =
|
|
437
|
+
otpInput = _ref5.otpInput;
|
|
534
438
|
_this2.setIsActionLoading('enter2fa');
|
|
535
|
-
|
|
536
|
-
|
|
439
|
+
_context3.prev = 2;
|
|
440
|
+
_context3.next = 5;
|
|
537
441
|
return loginUserWithTotp(otpInput, firebaseError);
|
|
538
442
|
case 5:
|
|
539
|
-
|
|
443
|
+
_context3.next = 7;
|
|
540
444
|
return getUser();
|
|
541
445
|
case 7:
|
|
542
446
|
_this2.setOpenModalStatus('enter2fa', false);
|
|
543
447
|
_this2.clearPopupError();
|
|
544
448
|
_this2.setIsActionLoading(undefined);
|
|
545
|
-
|
|
449
|
+
_context3.next = 16;
|
|
546
450
|
break;
|
|
547
451
|
case 12:
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
console.log('🚀 ~ file: HeaderHo.jsx:364 ~ error:',
|
|
551
|
-
if ((
|
|
552
|
-
_this2.setPopupError('enter2fa',
|
|
553
|
-
} else if ((
|
|
452
|
+
_context3.prev = 12;
|
|
453
|
+
_context3.t0 = _context3["catch"](2);
|
|
454
|
+
console.log('🚀 ~ file: HeaderHo.jsx:364 ~ error:', _context3.t0);
|
|
455
|
+
if ((_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.code) === 'auth/invalid-verification-code') {
|
|
456
|
+
_this2.setPopupError('enter2fa', 'That’s not the right 2FA code. Try again');
|
|
457
|
+
} else if ((_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.code) === 'auth/code-expired') {
|
|
554
458
|
_this2.setPopupError('enter2fa', 'Time out. Please restart the flow and log in again');
|
|
555
459
|
} else {
|
|
556
|
-
_this2.setPopupError('enter2fa',
|
|
460
|
+
_this2.setPopupError('enter2fa', _context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.message);
|
|
557
461
|
}
|
|
558
462
|
case 16:
|
|
559
463
|
_this2.setIsActionLoading(undefined);
|
|
560
464
|
case 17:
|
|
561
465
|
case "end":
|
|
562
|
-
return
|
|
466
|
+
return _context3.stop();
|
|
563
467
|
}
|
|
564
|
-
},
|
|
468
|
+
}, _callee3, null, [[2, 12]]);
|
|
565
469
|
}));
|
|
566
470
|
return function (_x2) {
|
|
567
|
-
return
|
|
471
|
+
return _ref6.apply(this, arguments);
|
|
568
472
|
};
|
|
569
473
|
}()
|
|
570
474
|
}), /*#__PURE__*/_react.default.createElement(_FA.ResetCode, {
|
|
@@ -619,24 +523,24 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
619
523
|
onSignupModalClose && onSignupModalClose();
|
|
620
524
|
},
|
|
621
525
|
onFormSend: /*#__PURE__*/function () {
|
|
622
|
-
var
|
|
623
|
-
return _regeneratorRuntime().wrap(function
|
|
624
|
-
while (1) switch (
|
|
526
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(userInfo) {
|
|
527
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
528
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
625
529
|
case 0:
|
|
626
530
|
_this2.clearPopupError();
|
|
627
531
|
_this2.setIsActionLoading('signUp');
|
|
628
532
|
|
|
629
533
|
//check password
|
|
630
|
-
|
|
534
|
+
_context4.prev = 2;
|
|
631
535
|
if (!(userInfo.password.length > 128)) {
|
|
632
|
-
|
|
536
|
+
_context4.next = 7;
|
|
633
537
|
break;
|
|
634
538
|
}
|
|
635
539
|
_this2.setPopupError('register', 'Your password cannot exceed 128 characters', 'password');
|
|
636
540
|
_this2.setIsActionLoading(undefined);
|
|
637
|
-
return
|
|
541
|
+
return _context4.abrupt("return");
|
|
638
542
|
case 7:
|
|
639
|
-
|
|
543
|
+
_context4.next = 9;
|
|
640
544
|
return createUser(userInfo.email, userInfo.password);
|
|
641
545
|
case 9:
|
|
642
546
|
//start the timer to count when user can resend email
|
|
@@ -644,10 +548,10 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
644
548
|
|
|
645
549
|
//if user checked newsletter checkbox
|
|
646
550
|
if (!userInfo.newsletter) {
|
|
647
|
-
|
|
551
|
+
_context4.next = 13;
|
|
648
552
|
break;
|
|
649
553
|
}
|
|
650
|
-
|
|
554
|
+
_context4.next = 13;
|
|
651
555
|
return (0, _fetchDataPublic.default)('emails/subscribe', {
|
|
652
556
|
email: userInfo.email,
|
|
653
557
|
listName: 'newsletter'
|
|
@@ -656,28 +560,28 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
656
560
|
_this2.setUserInfo(userInfo);
|
|
657
561
|
_this2.switchOpenModal('signUp', 'confirm');
|
|
658
562
|
_this2.setIsActionLoading(undefined);
|
|
659
|
-
|
|
563
|
+
_context4.next = 23;
|
|
660
564
|
break;
|
|
661
565
|
case 18:
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
console.log(
|
|
566
|
+
_context4.prev = 18;
|
|
567
|
+
_context4.t0 = _context4["catch"](2);
|
|
568
|
+
console.log(_context4.t0);
|
|
665
569
|
_this2.setIsActionLoading(undefined);
|
|
666
|
-
if ((
|
|
570
|
+
if ((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.code) === 'auth/email-already-in-use') {
|
|
667
571
|
_this2.setPopupError('register', 'This email address is already taken', 'email');
|
|
668
|
-
} else if ((
|
|
572
|
+
} else if ((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.code) === 'auth/weak-password') {
|
|
669
573
|
_this2.setPopupError('register', 'The password is too weak. Please try again.', 'password');
|
|
670
574
|
} else {
|
|
671
575
|
_this2.setPopupError('register', 'Oops, something went wrong');
|
|
672
576
|
}
|
|
673
577
|
case 23:
|
|
674
578
|
case "end":
|
|
675
|
-
return
|
|
579
|
+
return _context4.stop();
|
|
676
580
|
}
|
|
677
|
-
},
|
|
581
|
+
}, _callee4, null, [[2, 18]]);
|
|
678
582
|
}));
|
|
679
583
|
return function (_x3) {
|
|
680
|
-
return
|
|
584
|
+
return _ref7.apply(this, arguments);
|
|
681
585
|
};
|
|
682
586
|
}()
|
|
683
587
|
}), /*#__PURE__*/_react.default.createElement(_TermsModal.default, {
|
|
@@ -703,35 +607,35 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
703
607
|
_this2.clearPopupError();
|
|
704
608
|
_this2.setIsActionLoading(undefined);
|
|
705
609
|
},
|
|
706
|
-
onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
610
|
+
onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
707
611
|
var email;
|
|
708
|
-
return _regeneratorRuntime().wrap(function
|
|
709
|
-
while (1) switch (
|
|
612
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
613
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
710
614
|
case 0:
|
|
711
615
|
_this2.clearPopupSuccess();
|
|
712
616
|
_this2.clearPopupError();
|
|
713
617
|
_this2.setIsActionLoading('resend');
|
|
714
|
-
|
|
618
|
+
_context5.prev = 3;
|
|
715
619
|
email = _this2.state.userInfo.email;
|
|
716
|
-
|
|
620
|
+
_context5.next = 7;
|
|
717
621
|
return resendActivationEmail(email);
|
|
718
622
|
case 7:
|
|
719
623
|
cooldown === null || cooldown === void 0 || cooldown.startCooldown();
|
|
720
624
|
_this2.setPopupSuccess('resend', 'Email sent.');
|
|
721
625
|
_this2.setIsActionLoading(undefined);
|
|
722
|
-
|
|
626
|
+
_context5.next = 17;
|
|
723
627
|
break;
|
|
724
628
|
case 12:
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
console.log(
|
|
629
|
+
_context5.prev = 12;
|
|
630
|
+
_context5.t0 = _context5["catch"](3);
|
|
631
|
+
console.log(_context5.t0);
|
|
728
632
|
_this2.setPopupError('resend', 'Something went wrong.');
|
|
729
633
|
_this2.setIsActionLoading(undefined);
|
|
730
634
|
case 17:
|
|
731
635
|
case "end":
|
|
732
|
-
return
|
|
636
|
+
return _context5.stop();
|
|
733
637
|
}
|
|
734
|
-
},
|
|
638
|
+
}, _callee5, null, [[3, 12]]);
|
|
735
639
|
}))
|
|
736
640
|
}), /*#__PURE__*/_react.default.createElement(_ForgotPasswordModal.default, {
|
|
737
641
|
isActionLoading: isActionLoading,
|
|
@@ -751,38 +655,38 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
751
655
|
_this2.setIsActionLoading(undefined);
|
|
752
656
|
},
|
|
753
657
|
onFormSend: /*#__PURE__*/function () {
|
|
754
|
-
var
|
|
658
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref9) {
|
|
755
659
|
var email;
|
|
756
|
-
return _regeneratorRuntime().wrap(function
|
|
757
|
-
while (1) switch (
|
|
660
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
661
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
758
662
|
case 0:
|
|
759
|
-
email =
|
|
663
|
+
email = _ref9.email;
|
|
760
664
|
_this2.clearPopupError();
|
|
761
665
|
_this2.setIsActionLoading('forgot');
|
|
762
|
-
|
|
763
|
-
|
|
666
|
+
_context6.prev = 3;
|
|
667
|
+
_context6.next = 6;
|
|
764
668
|
return (0, _auth.default)('forgotPass', {
|
|
765
669
|
email: email
|
|
766
670
|
});
|
|
767
671
|
case 6:
|
|
768
672
|
_this2.setPopupSuccess('forgot', "We sent a message to ".concat(email, " (you might need to check your junk or spam folder) \u2014 tap the link inside to create a new password."));
|
|
769
673
|
_this2.setIsActionLoading(undefined);
|
|
770
|
-
|
|
674
|
+
_context6.next = 15;
|
|
771
675
|
break;
|
|
772
676
|
case 10:
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
console.log(
|
|
677
|
+
_context6.prev = 10;
|
|
678
|
+
_context6.t0 = _context6["catch"](3);
|
|
679
|
+
console.log(_context6.t0);
|
|
776
680
|
_this2.setPopupError('forgot', 'This email is not registered.');
|
|
777
681
|
_this2.setIsActionLoading(undefined);
|
|
778
682
|
case 15:
|
|
779
683
|
case "end":
|
|
780
|
-
return
|
|
684
|
+
return _context6.stop();
|
|
781
685
|
}
|
|
782
|
-
},
|
|
686
|
+
}, _callee6, null, [[3, 10]]);
|
|
783
687
|
}));
|
|
784
688
|
return function (_x4) {
|
|
785
|
-
return
|
|
689
|
+
return _ref10.apply(this, arguments);
|
|
786
690
|
};
|
|
787
691
|
}()
|
|
788
692
|
}), /*#__PURE__*/_react.default.createElement(_ResetPasswordModal.default, {
|
|
@@ -801,38 +705,76 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
801
705
|
_this2.setIsActionLoading(undefined);
|
|
802
706
|
},
|
|
803
707
|
onFormSend: /*#__PURE__*/function () {
|
|
804
|
-
var
|
|
805
|
-
var password
|
|
806
|
-
return _regeneratorRuntime().wrap(function
|
|
807
|
-
while (1) switch (
|
|
708
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref11) {
|
|
709
|
+
var password;
|
|
710
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
711
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
808
712
|
case 0:
|
|
809
|
-
password =
|
|
713
|
+
password = _ref11.password;
|
|
810
714
|
_this2.clearPopupError();
|
|
811
715
|
_this2.setIsActionLoading('resetPassword');
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
return handleResetPassword(password
|
|
716
|
+
_context7.prev = 3;
|
|
717
|
+
_context7.next = 6;
|
|
718
|
+
return handleResetPassword(password);
|
|
815
719
|
case 6:
|
|
816
720
|
_this2.switchOpenModal('resetPassword', 'confirmReset');
|
|
817
721
|
_this2.setIsActionLoading(undefined);
|
|
818
|
-
|
|
722
|
+
_context7.next = 15;
|
|
819
723
|
break;
|
|
820
724
|
case 10:
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
console.log(
|
|
824
|
-
_this2.setPopupError('resetPassword', (
|
|
725
|
+
_context7.prev = 10;
|
|
726
|
+
_context7.t0 = _context7["catch"](3);
|
|
727
|
+
console.log(_context7.t0);
|
|
728
|
+
_this2.setPopupError('resetPassword', (_context7.t0 === null || _context7.t0 === void 0 ? void 0 : _context7.t0.message) || 'Something went wrong.');
|
|
825
729
|
_this2.setIsActionLoading(undefined);
|
|
826
730
|
case 15:
|
|
827
731
|
case "end":
|
|
828
|
-
return
|
|
732
|
+
return _context7.stop();
|
|
829
733
|
}
|
|
830
|
-
},
|
|
734
|
+
}, _callee7, null, [[3, 10]]);
|
|
831
735
|
}));
|
|
832
736
|
return function (_x5) {
|
|
833
|
-
return
|
|
737
|
+
return _ref12.apply(this, arguments);
|
|
834
738
|
};
|
|
835
|
-
}()
|
|
739
|
+
}(),
|
|
740
|
+
onLoad: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
741
|
+
var location, query, oobCode;
|
|
742
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
743
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
744
|
+
case 0:
|
|
745
|
+
location = _this2.props.location;
|
|
746
|
+
query = new URLSearchParams(location === null || location === void 0 ? void 0 : location.search);
|
|
747
|
+
oobCode = query.get('oobCode');
|
|
748
|
+
if (!(oobCode && oobCode !== '')) {
|
|
749
|
+
_context8.next = 16;
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
_this2.setIsActionLoading('resetPassword');
|
|
753
|
+
_context8.prev = 5;
|
|
754
|
+
_context8.next = 8;
|
|
755
|
+
return (0, _auth2.checkActionCode)(_firebaseConfig.auth, oobCode);
|
|
756
|
+
case 8:
|
|
757
|
+
_this2.setIsActionLoading(undefined);
|
|
758
|
+
_context8.next = 15;
|
|
759
|
+
break;
|
|
760
|
+
case 11:
|
|
761
|
+
_context8.prev = 11;
|
|
762
|
+
_context8.t0 = _context8["catch"](5);
|
|
763
|
+
console.log('Password reset code error:', _context8.t0);
|
|
764
|
+
if ((_context8.t0 === null || _context8.t0 === void 0 ? void 0 : _context8.t0.code) === 'auth/expired-action-code' || (_context8.t0 === null || _context8.t0 === void 0 ? void 0 : _context8.t0.code) === 'auth/invalid-action-code') {
|
|
765
|
+
_this2.switchOpenModal('resetPassword', 'forgot');
|
|
766
|
+
_this2.setPopupError('forgot', 'This password reset link has expired or is invalid. Please request a new one.');
|
|
767
|
+
} else {
|
|
768
|
+
_this2.setPopupError('resetPassword', 'Something went wrong with the password reset link. Please try again.');
|
|
769
|
+
}
|
|
770
|
+
case 15:
|
|
771
|
+
_this2.setIsActionLoading(undefined);
|
|
772
|
+
case 16:
|
|
773
|
+
case "end":
|
|
774
|
+
return _context8.stop();
|
|
775
|
+
}
|
|
776
|
+
}, _callee8, null, [[5, 11]]);
|
|
777
|
+
}))
|
|
836
778
|
}), /*#__PURE__*/_react.default.createElement(_ResetConfirmModal.default, {
|
|
837
779
|
isModalOpen: isModalOpen.confirmReset,
|
|
838
780
|
onModalClose: function onModalClose() {
|
|
@@ -869,39 +811,58 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
869
811
|
_this2.setIsActionLoading(undefined);
|
|
870
812
|
},
|
|
871
813
|
onResend: /*#__PURE__*/function () {
|
|
872
|
-
var
|
|
814
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(values) {
|
|
873
815
|
var email;
|
|
874
|
-
return _regeneratorRuntime().wrap(function
|
|
875
|
-
while (1) switch (
|
|
816
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
817
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
876
818
|
case 0:
|
|
877
819
|
_this2.clearPopupSuccess();
|
|
878
820
|
_this2.clearPopupError();
|
|
879
821
|
_this2.setIsActionLoading('resend');
|
|
880
|
-
|
|
822
|
+
_context9.prev = 3;
|
|
881
823
|
email = values === null || values === void 0 ? void 0 : values.email;
|
|
882
|
-
|
|
824
|
+
_context9.next = 7;
|
|
883
825
|
return resendActivationEmail(email);
|
|
884
826
|
case 7:
|
|
885
827
|
_this2.setPopupSuccess('resend', 'Email sent.');
|
|
886
828
|
_this2.setIsActionLoading(undefined);
|
|
887
|
-
|
|
829
|
+
_context9.next = 16;
|
|
888
830
|
break;
|
|
889
831
|
case 11:
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
console.log(
|
|
893
|
-
_this2.setPopupError('resend', (
|
|
832
|
+
_context9.prev = 11;
|
|
833
|
+
_context9.t0 = _context9["catch"](3);
|
|
834
|
+
console.log(_context9.t0);
|
|
835
|
+
_this2.setPopupError('resend', (_context9.t0 === null || _context9.t0 === void 0 ? void 0 : _context9.t0.message) || 'Something went wrong.');
|
|
894
836
|
_this2.setIsActionLoading(undefined);
|
|
895
837
|
case 16:
|
|
896
838
|
case "end":
|
|
897
|
-
return
|
|
839
|
+
return _context9.stop();
|
|
898
840
|
}
|
|
899
|
-
},
|
|
841
|
+
}, _callee9, null, [[3, 11]]);
|
|
900
842
|
}));
|
|
901
843
|
return function (_x6) {
|
|
902
|
-
return
|
|
844
|
+
return _ref14.apply(this, arguments);
|
|
903
845
|
};
|
|
904
846
|
}()
|
|
847
|
+
}), /*#__PURE__*/_react.default.createElement(_ResendConfirmationCodeModal.default, {
|
|
848
|
+
isActionLoading: isActionLoading,
|
|
849
|
+
popupError: this.state.popupError,
|
|
850
|
+
isModalOpen: isModalOpen.resendConfirmation,
|
|
851
|
+
onModalClose: function onModalClose() {
|
|
852
|
+
_this2.setOpenModalStatus('resendConfirmation', false);
|
|
853
|
+
_this2.clearPopupError();
|
|
854
|
+
_this2.setIsActionLoading(undefined);
|
|
855
|
+
},
|
|
856
|
+
onModalSwitch: function onModalSwitch() {
|
|
857
|
+
window.history.pushState({}, null, '/login');
|
|
858
|
+
_this2.switchOpenModal('resendConfirmation', 'login');
|
|
859
|
+
_this2.clearPopupError();
|
|
860
|
+
_this2.setIsActionLoading(undefined);
|
|
861
|
+
},
|
|
862
|
+
onTokenRefreshed: function onTokenRefreshed() {
|
|
863
|
+
// Switch to reset password modal after token is refreshed
|
|
864
|
+
_this2.switchOpenModal('resendConfirmation', 'resetPassword');
|
|
865
|
+
}
|
|
905
866
|
}));
|
|
906
867
|
}
|
|
907
868
|
}]);
|
|
@@ -909,7 +870,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
909
870
|
}(_react.Component);
|
|
910
871
|
_defineProperty(HeaderHoClass, "propTypes", {});
|
|
911
872
|
_defineProperty(HeaderHoClass, "contextType", _AuthContext.AuthContext);
|
|
912
|
-
var HeaderHo = (0, _withRouter.withRouter)((0, _customHooks.cooldownHOC)(
|
|
873
|
+
var HeaderHo = (0, _withRouter.withRouter)((0, _customHooks.cooldownHOC)(HeaderHoClass, 90));
|
|
913
874
|
exports.HeaderHo = HeaderHo;
|
|
914
875
|
var _default = HeaderHo;
|
|
915
876
|
exports.default = _default;
|
|
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useMobileView = exports.useCooldown = exports.cooldownHOC = void 0;
|
|
8
8
|
exports.usePrevious = usePrevious;
|
|
9
|
-
exports.withUrlParams = exports.useUrlParams = void 0;
|
|
10
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
10
|
var _rwd = _interopRequireWildcard(require("../styles/rwd"));
|
|
12
|
-
var _reactRouterDom = require("react-router-dom");
|
|
13
11
|
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); }
|
|
14
12
|
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; }
|
|
15
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -118,34 +116,4 @@ var cooldownHOC = function cooldownHOC(Component) {
|
|
|
118
116
|
};
|
|
119
117
|
return Wrapper;
|
|
120
118
|
};
|
|
121
|
-
exports.cooldownHOC = cooldownHOC;
|
|
122
|
-
var useUrlParams = function useUrlParams() {
|
|
123
|
-
var location = (0, _reactRouterDom.useLocation)();
|
|
124
|
-
var getUrlParam = function getUrlParam(paramName) {
|
|
125
|
-
var searchParams = new URLSearchParams(location.search);
|
|
126
|
-
return searchParams.get(paramName);
|
|
127
|
-
};
|
|
128
|
-
var getAllParams = function getAllParams() {
|
|
129
|
-
var searchParams = new URLSearchParams(location.search);
|
|
130
|
-
return Object.fromEntries(searchParams.entries());
|
|
131
|
-
};
|
|
132
|
-
return {
|
|
133
|
-
location: location,
|
|
134
|
-
pathname: location.pathname,
|
|
135
|
-
search: location.search,
|
|
136
|
-
getUrlParam: getUrlParam,
|
|
137
|
-
getAllParams: getAllParams
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
// HOC to inject URL data
|
|
142
|
-
exports.useUrlParams = useUrlParams;
|
|
143
|
-
var withUrlParams = function withUrlParams(Component) {
|
|
144
|
-
return function (props) {
|
|
145
|
-
var urlParams = useUrlParams();
|
|
146
|
-
return /*#__PURE__*/_react.default.createElement(Component, _extends({}, props, {
|
|
147
|
-
urlParams: urlParams
|
|
148
|
-
}));
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
exports.withUrlParams = withUrlParams;
|
|
119
|
+
exports.cooldownHOC = cooldownHOC;
|