@stokr/components-library 2.3.41-beta.18 → 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: "right",
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 = _interopRequireDefault(require("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: _defineProperty({
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,161 +95,32 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
91
95
  message: undefined
92
96
  },
93
97
  isActionLoading: undefined,
94
- termsData: undefined,
95
- isPasswordResetLinkExpired: false,
96
- tokenCheckComplete: false
98
+ termsData: undefined
97
99
  });
98
- _defineProperty(_assertThisInitialized(_this), "componentDidMount", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
99
- var _this$props, isResetPassword, urlParams, oobCode, tokenStatus;
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;
100
102
  return _regeneratorRuntime().wrap(function _callee$(_context) {
101
103
  while (1) switch (_context.prev = _context.next) {
102
104
  case 0:
103
- _this$props = _this.props, isResetPassword = _this$props.isResetPassword, urlParams = _this$props.urlParams; // check if reset password modal and extract oobCode from URL params
104
- if (!isResetPassword) {
105
- _context.next = 22;
106
- break;
107
- }
108
- console.log('ifResetPassword running');
109
- oobCode = urlParams === null || urlParams === void 0 ? void 0 : urlParams.getUrlParam('oobCode');
110
- if (!(oobCode && oobCode !== '')) {
111
- _context.next = 19;
112
- break;
113
- }
114
- console.log('ifOobCode running');
115
- _context.prev = 6;
116
- _context.next = 9;
117
- return _this.checkTokenExpiration();
118
- case 9:
119
- tokenStatus = _context.sent;
120
- _this.setState(function (prevState) {
121
- return _objectSpread(_objectSpread({}, prevState), {}, {
122
- isPasswordResetLinkExpired: false,
123
- tokenCheckComplete: true
124
- });
125
- });
126
- _context.next = 17;
127
- break;
128
- case 13:
129
- _context.prev = 13;
130
- _context.t0 = _context["catch"](6);
131
- console.error('Error checking token expiration in componentDidMount:', _context.t0);
132
- // if there's an error checking the token, assume it's expired
133
- _this.setState(function (prevState) {
134
- return _objectSpread(_objectSpread({}, prevState), {}, {
135
- isPasswordResetLinkExpired: true,
136
- tokenCheckComplete: true
137
- });
138
- });
139
- case 17:
140
- _context.next = 20;
141
- break;
142
- case 19:
143
- // No oobCode means expired/invalid
144
- _this.setState(function (prevState) {
145
- return _objectSpread(_objectSpread({}, prevState), {}, {
146
- isPasswordResetLinkExpired: true,
147
- tokenCheckComplete: true
148
- });
149
- });
150
- case 20:
151
- _context.next = 23;
152
- break;
153
- case 22:
154
- // Not a reset password flow
155
- _this.setState(function (prevState) {
156
- return _objectSpread(_objectSpread({}, prevState), {}, {
157
- tokenCheckComplete: true
158
- });
159
- });
160
- case 23:
161
- case "end":
162
- return _context.stop();
163
- }
164
- }, _callee, null, [[6, 13]]);
165
- })));
166
- _defineProperty(_assertThisInitialized(_this), "checkTokenExpiration", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
167
- var urlParams, oobCode, result, _error$message;
168
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
169
- while (1) switch (_context2.prev = _context2.next) {
170
- case 0:
171
- urlParams = _this.props.urlParams;
172
- if (urlParams) {
173
- _context2.next = 3;
174
- break;
175
- }
176
- return _context2.abrupt("return", {
177
- expired: true
178
- });
179
- case 3:
180
- _context2.prev = 3;
181
- oobCode = urlParams.getUrlParam('oobCode');
182
- if (oobCode) {
183
- _context2.next = 7;
184
- break;
185
- }
186
- return _context2.abrupt("return", {
187
- expired: true
188
- });
189
- case 7:
190
- _context2.next = 9;
191
- return _this.context.checkActivationLinkExpired(oobCode);
192
- case 9:
193
- result = _context2.sent;
194
- return _context2.abrupt("return", result);
195
- case 13:
196
- _context2.prev = 13;
197
- _context2.t0 = _context2["catch"](3);
198
- console.error('Error checking token expiration:', _context2.t0);
199
-
200
- // Check for specific error codes that indicate invalid/expired token
201
- if (!(_context2.t0 !== null && _context2.t0 !== void 0 && (_error$message = _context2.t0.message) !== null && _error$message !== void 0 && _error$message.includes('INVALID_OOB_CODE') || (_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code) === 'auth/invalid-action-code' || (_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code) === 'auth/expired-action-code')) {
202
- _context2.next = 18;
203
- break;
204
- }
205
- return _context2.abrupt("return", {
206
- expired: true
207
- });
208
- case 18:
209
- return _context2.abrupt("return", {
210
- expired: true
211
- });
212
- case 19:
213
- case "end":
214
- return _context2.stop();
215
- }
216
- }, _callee2, null, [[3, 13]]);
217
- })));
218
- _defineProperty(_assertThisInitialized(_this), "checkForModals", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
219
- var _this$props2, isLogin, isSignUp, isResetPassword, isVerifyEmail, user, _this$state, isModalOpen, isPasswordResetLinkExpired, tokenCheckComplete, login, signUp, resetPassword, verifyEmail, forgot, isAnyModalOpen;
220
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
221
- while (1) switch (_context3.prev = _context3.next) {
222
- case 0:
223
- _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;
224
106
  user = _this.context.user;
225
- _this$state = _this.state, isModalOpen = _this$state.isModalOpen, isPasswordResetLinkExpired = _this$state.isPasswordResetLinkExpired, tokenCheckComplete = _this$state.tokenCheckComplete;
226
- login = isModalOpen.login, signUp = isModalOpen.signUp, resetPassword = isModalOpen.resetPassword, verifyEmail = isModalOpen.verifyEmail, forgot = isModalOpen.forgot; // token check needs to complete first
227
- if (tokenCheckComplete) {
228
- _context3.next = 6;
229
- break;
230
- }
231
- return _context3.abrupt("return");
232
- case 6:
233
- //checks if any modal is open
107
+ isModalOpen = _this.state.isModalOpen;
108
+ login = isModalOpen.login, signUp = isModalOpen.signUp, resetPassword = isModalOpen.resetPassword, verifyEmail = isModalOpen.verifyEmail; //checks if any modal is open
234
109
  //if true we won't open any modal from below
235
110
  isAnyModalOpen = Object.values(isModalOpen).some(function (value) {
236
111
  return value === true;
237
112
  });
238
113
  if (!isAnyModalOpen) {
239
- _context3.next = 9;
114
+ _context.next = 7;
240
115
  break;
241
116
  }
242
- return _context3.abrupt("return");
243
- case 9:
117
+ return _context.abrupt("return");
118
+ case 7:
244
119
  //dont open if modal is already open or user is logged in
245
120
  if (isLogin && !user && !login) {
246
121
  _this.setState(function (prevState) {
247
122
  return _objectSpread(_objectSpread({}, prevState), {}, {
248
- isModalOpen: _objectSpread(_objectSpread({}, prevState.isModalOpen), {}, {
123
+ isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
249
124
  login: true
250
125
  })
251
126
  });
@@ -254,60 +129,41 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
254
129
  if (isSignUp && !user && !signUp) {
255
130
  _this.setState(function (prevState) {
256
131
  return _objectSpread(_objectSpread({}, prevState), {}, {
257
- isModalOpen: _objectSpread(_objectSpread({}, prevState.isModalOpen), {}, {
132
+ isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
258
133
  signUp: true
259
134
  })
260
135
  });
261
136
  });
262
137
  }
263
- if (isResetPassword && !user && !resetPassword && !forgot) {
264
- if (isPasswordResetLinkExpired) {
265
- // open forgot password modal if token is expired/invalid
266
- console.log('Opening forgot password modal - token expired/invalid');
267
- _this.setState(function (prevState) {
268
- return _objectSpread(_objectSpread({}, prevState), {}, {
269
- isModalOpen: _objectSpread(_objectSpread({}, prevState.isModalOpen), {}, {
270
- forgot: true
271
- }),
272
- popupError: {
273
- popup: 'forgot',
274
- message: 'This password reset link has expired or is invalid. Please request a new one.',
275
- field: undefined
276
- }
277
- });
278
- });
279
- } else {
280
- // open usual reset password modal if token is valid
281
- console.log('Opening reset password modal - token valid');
282
- _this.setState(function (prevState) {
283
- return _objectSpread(_objectSpread({}, prevState), {}, {
284
- isModalOpen: _objectSpread(_objectSpread({}, prevState.isModalOpen), {}, {
285
- resetPassword: true
286
- })
287
- });
138
+ if (isResetPassword && !user && !resetPassword) {
139
+ _this.setState(function (prevState) {
140
+ return _objectSpread(_objectSpread({}, prevState), {}, {
141
+ isModalOpen: _objectSpread(_objectSpread({}, prevState.isModalOpen), {}, {
142
+ resetPassword: true
143
+ })
288
144
  });
289
- }
145
+ });
290
146
  }
291
147
  if (isVerifyEmail && !verifyEmail) {
292
148
  _this.setState(function (prevState) {
293
149
  return _objectSpread(_objectSpread({}, prevState), {}, {
294
- isModalOpen: _objectSpread(_objectSpread({}, prevState.isModalOpen), {}, {
150
+ isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
295
151
  verifyEmail: true
296
152
  })
297
153
  });
298
154
  });
299
155
  }
300
- case 13:
156
+ case 11:
301
157
  case "end":
302
- return _context3.stop();
158
+ return _context.stop();
303
159
  }
304
- }, _callee3);
160
+ }, _callee);
305
161
  })));
306
162
  _defineProperty(_assertThisInitialized(_this), "setOpenModalStatus", function (modalId, status) {
307
163
  var isModalOpen = _this.state.isModalOpen;
308
- var _this$props3 = _this.props,
309
- onSignupModalClose = _this$props3.onSignupModalClose,
310
- navigate = _this$props3.navigate;
164
+ var _this$props2 = _this.props,
165
+ onSignupModalClose = _this$props2.onSignupModalClose,
166
+ navigate = _this$props2.navigate;
311
167
 
312
168
  //if we pass custom onSignupModalClose, we don't want any modification in the url
313
169
  if (!onSignupModalClose) {
@@ -315,7 +171,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
315
171
  window.history.pushState('', '', modalId === 'login' ? '/login' : modalId === 'signUp' ? '/signup' : '/');
316
172
 
317
173
  //when we close login or signup or reset password modal, we want to remove modal url
318
- if ((modalId === 'login' || modalId === 'signUp' || modalId === 'resetPassword' || modalId === 'verifyEmail' || modalId === 'forgot') && !status) {
174
+ if ((modalId === 'login' || modalId === 'signUp' || modalId === 'resetPassword' || modalId === 'verifyEmail') && !status) {
319
175
  navigate('/');
320
176
  }
321
177
  }
@@ -422,9 +278,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
422
278
  this.props.navigate('/login');
423
279
  this.props.navigate(0);
424
280
  }
425
-
426
- // Run after page loaded AND token check is complete
427
- if (!isFetchingUser && this.state.tokenCheckComplete) {
281
+ if (!isFetchingUser) {
428
282
  this.checkForModals();
429
283
  }
430
284
  }
@@ -432,20 +286,20 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
432
286
  key: "render",
433
287
  value: function render() {
434
288
  var _this2 = this;
435
- var _this$state2 = this.state,
436
- isModalOpen = _this$state2.isModalOpen,
437
- userInfo = _this$state2.userInfo,
438
- isActionLoading = _this$state2.isActionLoading,
439
- termsData = _this$state2.termsData;
440
- var _this$props4 = this.props,
441
- fixed = _this$props4.fixed,
442
- activateMenu = _this$props4.activateMenu,
443
- activeMenu = _this$props4.activeMenu,
444
- withoutLoginSignupButton = _this$props4.withoutLoginSignupButton,
445
- useRelativePathForMenu = _this$props4.useRelativePathForMenu,
446
- isLoginModalOpen = _this$props4.isLoginModalOpen,
447
- setIsLoginModalOpen = _this$props4.setIsLoginModalOpen,
448
- cooldown = _this$props4.cooldown;
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;
449
303
  var _this$context2 = this.context,
450
304
  getUser = _this$context2.getUser,
451
305
  _this$context2$user = _this$context2.user,
@@ -501,47 +355,47 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
501
355
  _this2.setIsActionLoading(undefined);
502
356
  },
503
357
  onFormSend: /*#__PURE__*/function () {
504
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref5) {
358
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
505
359
  var email, password, errorMessage;
506
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
507
- while (1) switch (_context4.prev = _context4.next) {
360
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
361
+ while (1) switch (_context2.prev = _context2.next) {
508
362
  case 0:
509
- email = _ref5.email, password = _ref5.password;
363
+ email = _ref3.email, password = _ref3.password;
510
364
  _this2.clearPopupError();
511
365
  _this2.setIsActionLoading('login');
512
- _context4.prev = 3;
366
+ _context2.prev = 3;
513
367
  if (!(password.length > 128)) {
514
- _context4.next = 8;
368
+ _context2.next = 8;
515
369
  break;
516
370
  }
517
371
  _this2.setPopupError('login', 'Your password cannot exceed 128 characters');
518
372
  _this2.setIsActionLoading(undefined);
519
- return _context4.abrupt("return");
373
+ return _context2.abrupt("return");
520
374
  case 8:
521
- _context4.next = 10;
375
+ _context2.next = 10;
522
376
  return loginUser(email, password);
523
377
  case 10:
524
- _context4.next = 12;
378
+ _context2.next = 12;
525
379
  return getUser();
526
380
  case 12:
527
381
  _this2.setOpenModalStatus('login', false);
528
382
  setIsLoginModalOpen && setIsLoginModalOpen(false);
529
383
  _this2.clearPopupError();
530
384
  _this2.setIsActionLoading(undefined);
531
- _context4.next = 28;
385
+ _context2.next = 28;
532
386
  break;
533
387
  case 18:
534
- _context4.prev = 18;
535
- _context4.t0 = _context4["catch"](3);
536
- errorMessage = _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message; //handle switch modal correctly
537
- if (!((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.code) === 'auth/multi-factor-auth-required')) {
538
- _context4.next = 26;
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;
539
393
  break;
540
394
  }
541
395
  _this2.switchOpenModal('login', 'enter2fa');
542
396
  _this2.clearPopupError();
543
397
  _this2.setIsActionLoading(undefined);
544
- return _context4.abrupt("return");
398
+ return _context2.abrupt("return");
545
399
  case 26:
546
400
  if (errorMessage) {
547
401
  _this2.setPopupError('login', errorMessage);
@@ -551,12 +405,12 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
551
405
  _this2.setIsActionLoading(undefined);
552
406
  case 28:
553
407
  case "end":
554
- return _context4.stop();
408
+ return _context2.stop();
555
409
  }
556
- }, _callee4, null, [[3, 18]]);
410
+ }, _callee2, null, [[3, 18]]);
557
411
  }));
558
412
  return function (_x) {
559
- return _ref6.apply(this, arguments);
413
+ return _ref4.apply(this, arguments);
560
414
  };
561
415
  }()
562
416
  }), waitingFor2fa && /*#__PURE__*/_react.default.createElement(_FA.EnterCode, {
@@ -575,46 +429,46 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
575
429
  _this2.setIsActionLoading(undefined);
576
430
  },
577
431
  onFormSend: /*#__PURE__*/function () {
578
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref7) {
432
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
579
433
  var otpInput;
580
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
581
- while (1) switch (_context5.prev = _context5.next) {
434
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
435
+ while (1) switch (_context3.prev = _context3.next) {
582
436
  case 0:
583
- otpInput = _ref7.otpInput;
437
+ otpInput = _ref5.otpInput;
584
438
  _this2.setIsActionLoading('enter2fa');
585
- _context5.prev = 2;
586
- _context5.next = 5;
439
+ _context3.prev = 2;
440
+ _context3.next = 5;
587
441
  return loginUserWithTotp(otpInput, firebaseError);
588
442
  case 5:
589
- _context5.next = 7;
443
+ _context3.next = 7;
590
444
  return getUser();
591
445
  case 7:
592
446
  _this2.setOpenModalStatus('enter2fa', false);
593
447
  _this2.clearPopupError();
594
448
  _this2.setIsActionLoading(undefined);
595
- _context5.next = 16;
449
+ _context3.next = 16;
596
450
  break;
597
451
  case 12:
598
- _context5.prev = 12;
599
- _context5.t0 = _context5["catch"](2);
600
- console.log('🚀 ~ file: HeaderHo.jsx:364 ~ error:', _context5.t0);
601
- if ((_context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.code) === 'auth/invalid-verification-code') {
602
- _this2.setPopupError('enter2fa', "That's not the right 2FA code. Try again");
603
- } else if ((_context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.code) === 'auth/code-expired') {
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', 'Thats 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') {
604
458
  _this2.setPopupError('enter2fa', 'Time out. Please restart the flow and log in again');
605
459
  } else {
606
- _this2.setPopupError('enter2fa', _context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.message);
460
+ _this2.setPopupError('enter2fa', _context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.message);
607
461
  }
608
462
  case 16:
609
463
  _this2.setIsActionLoading(undefined);
610
464
  case 17:
611
465
  case "end":
612
- return _context5.stop();
466
+ return _context3.stop();
613
467
  }
614
- }, _callee5, null, [[2, 12]]);
468
+ }, _callee3, null, [[2, 12]]);
615
469
  }));
616
470
  return function (_x2) {
617
- return _ref8.apply(this, arguments);
471
+ return _ref6.apply(this, arguments);
618
472
  };
619
473
  }()
620
474
  }), /*#__PURE__*/_react.default.createElement(_FA.ResetCode, {
@@ -669,24 +523,24 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
669
523
  onSignupModalClose && onSignupModalClose();
670
524
  },
671
525
  onFormSend: /*#__PURE__*/function () {
672
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userInfo) {
673
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
674
- while (1) switch (_context6.prev = _context6.next) {
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) {
675
529
  case 0:
676
530
  _this2.clearPopupError();
677
531
  _this2.setIsActionLoading('signUp');
678
532
 
679
533
  //check password
680
- _context6.prev = 2;
534
+ _context4.prev = 2;
681
535
  if (!(userInfo.password.length > 128)) {
682
- _context6.next = 7;
536
+ _context4.next = 7;
683
537
  break;
684
538
  }
685
539
  _this2.setPopupError('register', 'Your password cannot exceed 128 characters', 'password');
686
540
  _this2.setIsActionLoading(undefined);
687
- return _context6.abrupt("return");
541
+ return _context4.abrupt("return");
688
542
  case 7:
689
- _context6.next = 9;
543
+ _context4.next = 9;
690
544
  return createUser(userInfo.email, userInfo.password);
691
545
  case 9:
692
546
  //start the timer to count when user can resend email
@@ -694,10 +548,10 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
694
548
 
695
549
  //if user checked newsletter checkbox
696
550
  if (!userInfo.newsletter) {
697
- _context6.next = 13;
551
+ _context4.next = 13;
698
552
  break;
699
553
  }
700
- _context6.next = 13;
554
+ _context4.next = 13;
701
555
  return (0, _fetchDataPublic.default)('emails/subscribe', {
702
556
  email: userInfo.email,
703
557
  listName: 'newsletter'
@@ -706,28 +560,28 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
706
560
  _this2.setUserInfo(userInfo);
707
561
  _this2.switchOpenModal('signUp', 'confirm');
708
562
  _this2.setIsActionLoading(undefined);
709
- _context6.next = 23;
563
+ _context4.next = 23;
710
564
  break;
711
565
  case 18:
712
- _context6.prev = 18;
713
- _context6.t0 = _context6["catch"](2);
714
- console.log(_context6.t0);
566
+ _context4.prev = 18;
567
+ _context4.t0 = _context4["catch"](2);
568
+ console.log(_context4.t0);
715
569
  _this2.setIsActionLoading(undefined);
716
- if ((_context6.t0 === null || _context6.t0 === void 0 ? void 0 : _context6.t0.code) === 'auth/email-already-in-use') {
570
+ if ((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.code) === 'auth/email-already-in-use') {
717
571
  _this2.setPopupError('register', 'This email address is already taken', 'email');
718
- } else if ((_context6.t0 === null || _context6.t0 === void 0 ? void 0 : _context6.t0.code) === 'auth/weak-password') {
572
+ } else if ((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.code) === 'auth/weak-password') {
719
573
  _this2.setPopupError('register', 'The password is too weak. Please try again.', 'password');
720
574
  } else {
721
575
  _this2.setPopupError('register', 'Oops, something went wrong');
722
576
  }
723
577
  case 23:
724
578
  case "end":
725
- return _context6.stop();
579
+ return _context4.stop();
726
580
  }
727
- }, _callee6, null, [[2, 18]]);
581
+ }, _callee4, null, [[2, 18]]);
728
582
  }));
729
583
  return function (_x3) {
730
- return _ref9.apply(this, arguments);
584
+ return _ref7.apply(this, arguments);
731
585
  };
732
586
  }()
733
587
  }), /*#__PURE__*/_react.default.createElement(_TermsModal.default, {
@@ -753,35 +607,35 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
753
607
  _this2.clearPopupError();
754
608
  _this2.setIsActionLoading(undefined);
755
609
  },
756
- onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
610
+ onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
757
611
  var email;
758
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
759
- while (1) switch (_context7.prev = _context7.next) {
612
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
613
+ while (1) switch (_context5.prev = _context5.next) {
760
614
  case 0:
761
615
  _this2.clearPopupSuccess();
762
616
  _this2.clearPopupError();
763
617
  _this2.setIsActionLoading('resend');
764
- _context7.prev = 3;
618
+ _context5.prev = 3;
765
619
  email = _this2.state.userInfo.email;
766
- _context7.next = 7;
620
+ _context5.next = 7;
767
621
  return resendActivationEmail(email);
768
622
  case 7:
769
623
  cooldown === null || cooldown === void 0 || cooldown.startCooldown();
770
624
  _this2.setPopupSuccess('resend', 'Email sent.');
771
625
  _this2.setIsActionLoading(undefined);
772
- _context7.next = 17;
626
+ _context5.next = 17;
773
627
  break;
774
628
  case 12:
775
- _context7.prev = 12;
776
- _context7.t0 = _context7["catch"](3);
777
- console.log(_context7.t0);
629
+ _context5.prev = 12;
630
+ _context5.t0 = _context5["catch"](3);
631
+ console.log(_context5.t0);
778
632
  _this2.setPopupError('resend', 'Something went wrong.');
779
633
  _this2.setIsActionLoading(undefined);
780
634
  case 17:
781
635
  case "end":
782
- return _context7.stop();
636
+ return _context5.stop();
783
637
  }
784
- }, _callee7, null, [[3, 12]]);
638
+ }, _callee5, null, [[3, 12]]);
785
639
  }))
786
640
  }), /*#__PURE__*/_react.default.createElement(_ForgotPasswordModal.default, {
787
641
  isActionLoading: isActionLoading,
@@ -801,38 +655,38 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
801
655
  _this2.setIsActionLoading(undefined);
802
656
  },
803
657
  onFormSend: /*#__PURE__*/function () {
804
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref11) {
658
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref9) {
805
659
  var email;
806
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
807
- while (1) switch (_context8.prev = _context8.next) {
660
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
661
+ while (1) switch (_context6.prev = _context6.next) {
808
662
  case 0:
809
- email = _ref11.email;
663
+ email = _ref9.email;
810
664
  _this2.clearPopupError();
811
665
  _this2.setIsActionLoading('forgot');
812
- _context8.prev = 3;
813
- _context8.next = 6;
666
+ _context6.prev = 3;
667
+ _context6.next = 6;
814
668
  return (0, _auth.default)('forgotPass', {
815
669
  email: email
816
670
  });
817
671
  case 6:
818
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."));
819
673
  _this2.setIsActionLoading(undefined);
820
- _context8.next = 15;
674
+ _context6.next = 15;
821
675
  break;
822
676
  case 10:
823
- _context8.prev = 10;
824
- _context8.t0 = _context8["catch"](3);
825
- console.log(_context8.t0);
677
+ _context6.prev = 10;
678
+ _context6.t0 = _context6["catch"](3);
679
+ console.log(_context6.t0);
826
680
  _this2.setPopupError('forgot', 'This email is not registered.');
827
681
  _this2.setIsActionLoading(undefined);
828
682
  case 15:
829
683
  case "end":
830
- return _context8.stop();
684
+ return _context6.stop();
831
685
  }
832
- }, _callee8, null, [[3, 10]]);
686
+ }, _callee6, null, [[3, 10]]);
833
687
  }));
834
688
  return function (_x4) {
835
- return _ref12.apply(this, arguments);
689
+ return _ref10.apply(this, arguments);
836
690
  };
837
691
  }()
838
692
  }), /*#__PURE__*/_react.default.createElement(_ResetPasswordModal.default, {
@@ -851,38 +705,76 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
851
705
  _this2.setIsActionLoading(undefined);
852
706
  },
853
707
  onFormSend: /*#__PURE__*/function () {
854
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref13) {
855
- var password, oobCode;
856
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
857
- while (1) switch (_context9.prev = _context9.next) {
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) {
858
712
  case 0:
859
- password = _ref13.password, oobCode = _ref13.oobCode;
713
+ password = _ref11.password;
860
714
  _this2.clearPopupError();
861
715
  _this2.setIsActionLoading('resetPassword');
862
- _context9.prev = 3;
863
- _context9.next = 6;
864
- return handleResetPassword(password, oobCode);
716
+ _context7.prev = 3;
717
+ _context7.next = 6;
718
+ return handleResetPassword(password);
865
719
  case 6:
866
720
  _this2.switchOpenModal('resetPassword', 'confirmReset');
867
721
  _this2.setIsActionLoading(undefined);
868
- _context9.next = 15;
722
+ _context7.next = 15;
869
723
  break;
870
724
  case 10:
871
- _context9.prev = 10;
872
- _context9.t0 = _context9["catch"](3);
873
- console.log(_context9.t0);
874
- _this2.setPopupError('resetPassword', (_context9.t0 === null || _context9.t0 === void 0 ? void 0 : _context9.t0.message) || 'Something went wrong.');
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.');
875
729
  _this2.setIsActionLoading(undefined);
876
730
  case 15:
877
731
  case "end":
878
- return _context9.stop();
732
+ return _context7.stop();
879
733
  }
880
- }, _callee9, null, [[3, 10]]);
734
+ }, _callee7, null, [[3, 10]]);
881
735
  }));
882
736
  return function (_x5) {
883
- return _ref14.apply(this, arguments);
737
+ return _ref12.apply(this, arguments);
884
738
  };
885
- }()
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
+ }))
886
778
  }), /*#__PURE__*/_react.default.createElement(_ResetConfirmModal.default, {
887
779
  isModalOpen: isModalOpen.confirmReset,
888
780
  onModalClose: function onModalClose() {
@@ -919,39 +811,58 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
919
811
  _this2.setIsActionLoading(undefined);
920
812
  },
921
813
  onResend: /*#__PURE__*/function () {
922
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(values) {
814
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(values) {
923
815
  var email;
924
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
925
- while (1) switch (_context10.prev = _context10.next) {
816
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
817
+ while (1) switch (_context9.prev = _context9.next) {
926
818
  case 0:
927
819
  _this2.clearPopupSuccess();
928
820
  _this2.clearPopupError();
929
821
  _this2.setIsActionLoading('resend');
930
- _context10.prev = 3;
822
+ _context9.prev = 3;
931
823
  email = values === null || values === void 0 ? void 0 : values.email;
932
- _context10.next = 7;
824
+ _context9.next = 7;
933
825
  return resendActivationEmail(email);
934
826
  case 7:
935
827
  _this2.setPopupSuccess('resend', 'Email sent.');
936
828
  _this2.setIsActionLoading(undefined);
937
- _context10.next = 16;
829
+ _context9.next = 16;
938
830
  break;
939
831
  case 11:
940
- _context10.prev = 11;
941
- _context10.t0 = _context10["catch"](3);
942
- console.log(_context10.t0);
943
- _this2.setPopupError('resend', (_context10.t0 === null || _context10.t0 === void 0 ? void 0 : _context10.t0.message) || 'Something went wrong.');
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.');
944
836
  _this2.setIsActionLoading(undefined);
945
837
  case 16:
946
838
  case "end":
947
- return _context10.stop();
839
+ return _context9.stop();
948
840
  }
949
- }, _callee10, null, [[3, 11]]);
841
+ }, _callee9, null, [[3, 11]]);
950
842
  }));
951
843
  return function (_x6) {
952
- return _ref15.apply(this, arguments);
844
+ return _ref14.apply(this, arguments);
953
845
  };
954
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
+ }
955
866
  }));
956
867
  }
957
868
  }]);
@@ -959,7 +870,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
959
870
  }(_react.Component);
960
871
  _defineProperty(HeaderHoClass, "propTypes", {});
961
872
  _defineProperty(HeaderHoClass, "contextType", _AuthContext.AuthContext);
962
- var HeaderHo = (0, _withRouter.withRouter)((0, _customHooks.cooldownHOC)((0, _customHooks.withUrlParams)(HeaderHoClass), 90));
873
+ var HeaderHo = (0, _withRouter.withRouter)((0, _customHooks.cooldownHOC)(HeaderHoClass, 90));
963
874
  exports.HeaderHo = HeaderHo;
964
875
  var _default = HeaderHo;
965
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "2.3.41-beta.18",
3
+ "version": "2.3.41-beta.19",
4
4
  "description": "STOKR - Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",