@stokr/components-library 2.3.41-beta.16 → 2.3.41-beta.18

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.
@@ -26,9 +26,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
26
26
  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
27
  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; }
28
28
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
29
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
29
30
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
30
31
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
31
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
32
32
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
33
33
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
34
34
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -92,77 +92,160 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
92
92
  },
93
93
  isActionLoading: undefined,
94
94
  termsData: undefined,
95
- // New state to track if forgot password modal was opened due to expired link
96
- forgotPasswordFromExpiredLink: false
95
+ isPasswordResetLinkExpired: false,
96
+ tokenCheckComplete: false
97
97
  });
98
- _defineProperty(_assertThisInitialized(_this), "checkTokenExpiration", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
99
- var location, search, query, oobCode, result;
98
+ _defineProperty(_assertThisInitialized(_this), "componentDidMount", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
99
+ var _this$props, isResetPassword, urlParams, oobCode, tokenStatus;
100
100
  return _regeneratorRuntime().wrap(function _callee$(_context) {
101
101
  while (1) switch (_context.prev = _context.next) {
102
102
  case 0:
103
- location = _this.props.location;
104
- if (location) {
105
- _context.next = 3;
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;
106
174
  break;
107
175
  }
108
- return _context.abrupt("return", {
176
+ return _context2.abrupt("return", {
109
177
  expired: true
110
178
  });
111
179
  case 3:
112
- _context.prev = 3;
113
- search = location.search;
114
- query = new URLSearchParams(search);
115
- oobCode = query.get('oobCode');
180
+ _context2.prev = 3;
181
+ oobCode = urlParams.getUrlParam('oobCode');
116
182
  if (oobCode) {
117
- _context.next = 9;
183
+ _context2.next = 7;
118
184
  break;
119
185
  }
120
- return _context.abrupt("return", {
186
+ return _context2.abrupt("return", {
121
187
  expired: true
122
188
  });
123
- case 9:
124
- _context.next = 11;
189
+ case 7:
190
+ _context2.next = 9;
125
191
  return _this.context.checkActivationLinkExpired(oobCode);
126
- case 11:
127
- result = _context.sent;
128
- return _context.abrupt("return", result);
129
- case 15:
130
- _context.prev = 15;
131
- _context.t0 = _context["catch"](3);
132
- console.error('Error checking token expiration:', _context.t0);
133
- return _context.abrupt("return", {
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", {
134
210
  expired: true
135
211
  });
136
212
  case 19:
137
213
  case "end":
138
- return _context.stop();
214
+ return _context2.stop();
139
215
  }
140
- }, _callee, null, [[3, 15]]);
216
+ }, _callee2, null, [[3, 13]]);
141
217
  })));
142
- _defineProperty(_assertThisInitialized(_this), "checkForModals", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
143
- var _this$props, isLogin, isSignUp, isResetPassword, isVerifyEmail, user, isModalOpen, login, signUp, resetPassword, verifyEmail, isAnyModalOpen, tokenStatus;
144
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
145
- while (1) switch (_context2.prev = _context2.next) {
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) {
146
222
  case 0:
147
- _this$props = _this.props, isLogin = _this$props.isLogin, isSignUp = _this$props.isSignUp, isResetPassword = _this$props.isResetPassword, isVerifyEmail = _this$props.isVerifyEmail;
223
+ _this$props2 = _this.props, isLogin = _this$props2.isLogin, isSignUp = _this$props2.isSignUp, isResetPassword = _this$props2.isResetPassword, isVerifyEmail = _this$props2.isVerifyEmail;
148
224
  user = _this.context.user;
149
- isModalOpen = _this.state.isModalOpen;
150
- login = isModalOpen.login, signUp = isModalOpen.signUp, resetPassword = isModalOpen.resetPassword, verifyEmail = isModalOpen.verifyEmail; //checks if any modal is open
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
151
234
  //if true we won't open any modal from below
152
235
  isAnyModalOpen = Object.values(isModalOpen).some(function (value) {
153
236
  return value === true;
154
237
  });
155
238
  if (!isAnyModalOpen) {
156
- _context2.next = 7;
239
+ _context3.next = 9;
157
240
  break;
158
241
  }
159
- return _context2.abrupt("return");
160
- case 7:
242
+ return _context3.abrupt("return");
243
+ case 9:
161
244
  //dont open if modal is already open or user is logged in
162
245
  if (isLogin && !user && !login) {
163
246
  _this.setState(function (prevState) {
164
247
  return _objectSpread(_objectSpread({}, prevState), {}, {
165
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
248
+ isModalOpen: _objectSpread(_objectSpread({}, prevState.isModalOpen), {}, {
166
249
  login: true
167
250
  })
168
251
  });
@@ -171,60 +254,60 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
171
254
  if (isSignUp && !user && !signUp) {
172
255
  _this.setState(function (prevState) {
173
256
  return _objectSpread(_objectSpread({}, prevState), {}, {
174
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
257
+ isModalOpen: _objectSpread(_objectSpread({}, prevState.isModalOpen), {}, {
175
258
  signUp: true
176
259
  })
177
260
  });
178
261
  });
179
262
  }
180
- if (!(isResetPassword && !user && !resetPassword)) {
181
- _context2.next = 14;
182
- break;
183
- }
184
- _context2.next = 12;
185
- return _this.checkTokenExpiration();
186
- case 12:
187
- tokenStatus = _context2.sent;
188
- if (tokenStatus.expired) {
189
- // Open special version of forgot password modal if token is expired
190
- _this.setState(function (prevState) {
191
- return _objectSpread(_objectSpread({}, prevState), {}, {
192
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
193
- forgot: true
194
- })
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
+ });
195
278
  });
196
- });
197
- } else {
198
- // Open reset password modal if token is valid
199
- _this.setState(function (prevState) {
200
- return _objectSpread(_objectSpread({}, prevState), {}, {
201
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
202
- resetPassword: true
203
- })
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
+ });
204
288
  });
205
- });
289
+ }
206
290
  }
207
- case 14:
208
291
  if (isVerifyEmail && !verifyEmail) {
209
292
  _this.setState(function (prevState) {
210
293
  return _objectSpread(_objectSpread({}, prevState), {}, {
211
- isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
294
+ isModalOpen: _objectSpread(_objectSpread({}, prevState.isModalOpen), {}, {
212
295
  verifyEmail: true
213
296
  })
214
297
  });
215
298
  });
216
299
  }
217
- case 15:
300
+ case 13:
218
301
  case "end":
219
- return _context2.stop();
302
+ return _context3.stop();
220
303
  }
221
- }, _callee2);
304
+ }, _callee3);
222
305
  })));
223
306
  _defineProperty(_assertThisInitialized(_this), "setOpenModalStatus", function (modalId, status) {
224
307
  var isModalOpen = _this.state.isModalOpen;
225
- var _this$props2 = _this.props,
226
- onSignupModalClose = _this$props2.onSignupModalClose,
227
- navigate = _this$props2.navigate;
308
+ var _this$props3 = _this.props,
309
+ onSignupModalClose = _this$props3.onSignupModalClose,
310
+ navigate = _this$props3.navigate;
228
311
 
229
312
  //if we pass custom onSignupModalClose, we don't want any modification in the url
230
313
  if (!onSignupModalClose) {
@@ -232,7 +315,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
232
315
  window.history.pushState('', '', modalId === 'login' ? '/login' : modalId === 'signUp' ? '/signup' : '/');
233
316
 
234
317
  //when we close login or signup or reset password modal, we want to remove modal url
235
- if ((modalId === 'login' || modalId === 'signUp' || modalId === 'resetPassword' || modalId === 'verifyEmail') && !status) {
318
+ if ((modalId === 'login' || modalId === 'signUp' || modalId === 'resetPassword' || modalId === 'verifyEmail' || modalId === 'forgot') && !status) {
236
319
  navigate('/');
237
320
  }
238
321
  }
@@ -340,8 +423,8 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
340
423
  this.props.navigate(0);
341
424
  }
342
425
 
343
- // Run after page loaded
344
- if (!isFetchingUser) {
426
+ // Run after page loaded AND token check is complete
427
+ if (!isFetchingUser && this.state.tokenCheckComplete) {
345
428
  this.checkForModals();
346
429
  }
347
430
  }
@@ -349,20 +432,20 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
349
432
  key: "render",
350
433
  value: function render() {
351
434
  var _this2 = this;
352
- var _this$state = this.state,
353
- isModalOpen = _this$state.isModalOpen,
354
- userInfo = _this$state.userInfo,
355
- isActionLoading = _this$state.isActionLoading,
356
- termsData = _this$state.termsData;
357
- var _this$props3 = this.props,
358
- fixed = _this$props3.fixed,
359
- activateMenu = _this$props3.activateMenu,
360
- activeMenu = _this$props3.activeMenu,
361
- withoutLoginSignupButton = _this$props3.withoutLoginSignupButton,
362
- useRelativePathForMenu = _this$props3.useRelativePathForMenu,
363
- isLoginModalOpen = _this$props3.isLoginModalOpen,
364
- setIsLoginModalOpen = _this$props3.setIsLoginModalOpen,
365
- cooldown = _this$props3.cooldown;
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;
366
449
  var _this$context2 = this.context,
367
450
  getUser = _this$context2.getUser,
368
451
  _this$context2$user = _this$context2.user,
@@ -418,47 +501,47 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
418
501
  _this2.setIsActionLoading(undefined);
419
502
  },
420
503
  onFormSend: /*#__PURE__*/function () {
421
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
504
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref5) {
422
505
  var email, password, errorMessage;
423
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
424
- while (1) switch (_context3.prev = _context3.next) {
506
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
507
+ while (1) switch (_context4.prev = _context4.next) {
425
508
  case 0:
426
- email = _ref4.email, password = _ref4.password;
509
+ email = _ref5.email, password = _ref5.password;
427
510
  _this2.clearPopupError();
428
511
  _this2.setIsActionLoading('login');
429
- _context3.prev = 3;
512
+ _context4.prev = 3;
430
513
  if (!(password.length > 128)) {
431
- _context3.next = 8;
514
+ _context4.next = 8;
432
515
  break;
433
516
  }
434
517
  _this2.setPopupError('login', 'Your password cannot exceed 128 characters');
435
518
  _this2.setIsActionLoading(undefined);
436
- return _context3.abrupt("return");
519
+ return _context4.abrupt("return");
437
520
  case 8:
438
- _context3.next = 10;
521
+ _context4.next = 10;
439
522
  return loginUser(email, password);
440
523
  case 10:
441
- _context3.next = 12;
524
+ _context4.next = 12;
442
525
  return getUser();
443
526
  case 12:
444
527
  _this2.setOpenModalStatus('login', false);
445
528
  setIsLoginModalOpen && setIsLoginModalOpen(false);
446
529
  _this2.clearPopupError();
447
530
  _this2.setIsActionLoading(undefined);
448
- _context3.next = 28;
531
+ _context4.next = 28;
449
532
  break;
450
533
  case 18:
451
- _context3.prev = 18;
452
- _context3.t0 = _context3["catch"](3);
453
- errorMessage = _context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.message; //handle switch modal correctly
454
- if (!((_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.code) === 'auth/multi-factor-auth-required')) {
455
- _context3.next = 26;
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;
456
539
  break;
457
540
  }
458
541
  _this2.switchOpenModal('login', 'enter2fa');
459
542
  _this2.clearPopupError();
460
543
  _this2.setIsActionLoading(undefined);
461
- return _context3.abrupt("return");
544
+ return _context4.abrupt("return");
462
545
  case 26:
463
546
  if (errorMessage) {
464
547
  _this2.setPopupError('login', errorMessage);
@@ -468,12 +551,12 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
468
551
  _this2.setIsActionLoading(undefined);
469
552
  case 28:
470
553
  case "end":
471
- return _context3.stop();
554
+ return _context4.stop();
472
555
  }
473
- }, _callee3, null, [[3, 18]]);
556
+ }, _callee4, null, [[3, 18]]);
474
557
  }));
475
558
  return function (_x) {
476
- return _ref5.apply(this, arguments);
559
+ return _ref6.apply(this, arguments);
477
560
  };
478
561
  }()
479
562
  }), waitingFor2fa && /*#__PURE__*/_react.default.createElement(_FA.EnterCode, {
@@ -492,46 +575,46 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
492
575
  _this2.setIsActionLoading(undefined);
493
576
  },
494
577
  onFormSend: /*#__PURE__*/function () {
495
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref6) {
578
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref7) {
496
579
  var otpInput;
497
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
498
- while (1) switch (_context4.prev = _context4.next) {
580
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
581
+ while (1) switch (_context5.prev = _context5.next) {
499
582
  case 0:
500
- otpInput = _ref6.otpInput;
583
+ otpInput = _ref7.otpInput;
501
584
  _this2.setIsActionLoading('enter2fa');
502
- _context4.prev = 2;
503
- _context4.next = 5;
585
+ _context5.prev = 2;
586
+ _context5.next = 5;
504
587
  return loginUserWithTotp(otpInput, firebaseError);
505
588
  case 5:
506
- _context4.next = 7;
589
+ _context5.next = 7;
507
590
  return getUser();
508
591
  case 7:
509
592
  _this2.setOpenModalStatus('enter2fa', false);
510
593
  _this2.clearPopupError();
511
594
  _this2.setIsActionLoading(undefined);
512
- _context4.next = 16;
595
+ _context5.next = 16;
513
596
  break;
514
597
  case 12:
515
- _context4.prev = 12;
516
- _context4.t0 = _context4["catch"](2);
517
- console.log('🚀 ~ file: HeaderHo.jsx:364 ~ error:', _context4.t0);
518
- if ((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.code) === 'auth/invalid-verification-code') {
519
- _this2.setPopupError('enter2fa', 'That’s not the right 2FA code. Try again');
520
- } else if ((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.code) === 'auth/code-expired') {
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') {
521
604
  _this2.setPopupError('enter2fa', 'Time out. Please restart the flow and log in again');
522
605
  } else {
523
- _this2.setPopupError('enter2fa', _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message);
606
+ _this2.setPopupError('enter2fa', _context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.message);
524
607
  }
525
608
  case 16:
526
609
  _this2.setIsActionLoading(undefined);
527
610
  case 17:
528
611
  case "end":
529
- return _context4.stop();
612
+ return _context5.stop();
530
613
  }
531
- }, _callee4, null, [[2, 12]]);
614
+ }, _callee5, null, [[2, 12]]);
532
615
  }));
533
616
  return function (_x2) {
534
- return _ref7.apply(this, arguments);
617
+ return _ref8.apply(this, arguments);
535
618
  };
536
619
  }()
537
620
  }), /*#__PURE__*/_react.default.createElement(_FA.ResetCode, {
@@ -586,24 +669,24 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
586
669
  onSignupModalClose && onSignupModalClose();
587
670
  },
588
671
  onFormSend: /*#__PURE__*/function () {
589
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(userInfo) {
590
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
591
- while (1) switch (_context5.prev = _context5.next) {
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) {
592
675
  case 0:
593
676
  _this2.clearPopupError();
594
677
  _this2.setIsActionLoading('signUp');
595
678
 
596
679
  //check password
597
- _context5.prev = 2;
680
+ _context6.prev = 2;
598
681
  if (!(userInfo.password.length > 128)) {
599
- _context5.next = 7;
682
+ _context6.next = 7;
600
683
  break;
601
684
  }
602
685
  _this2.setPopupError('register', 'Your password cannot exceed 128 characters', 'password');
603
686
  _this2.setIsActionLoading(undefined);
604
- return _context5.abrupt("return");
687
+ return _context6.abrupt("return");
605
688
  case 7:
606
- _context5.next = 9;
689
+ _context6.next = 9;
607
690
  return createUser(userInfo.email, userInfo.password);
608
691
  case 9:
609
692
  //start the timer to count when user can resend email
@@ -611,10 +694,10 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
611
694
 
612
695
  //if user checked newsletter checkbox
613
696
  if (!userInfo.newsletter) {
614
- _context5.next = 13;
697
+ _context6.next = 13;
615
698
  break;
616
699
  }
617
- _context5.next = 13;
700
+ _context6.next = 13;
618
701
  return (0, _fetchDataPublic.default)('emails/subscribe', {
619
702
  email: userInfo.email,
620
703
  listName: 'newsletter'
@@ -623,28 +706,28 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
623
706
  _this2.setUserInfo(userInfo);
624
707
  _this2.switchOpenModal('signUp', 'confirm');
625
708
  _this2.setIsActionLoading(undefined);
626
- _context5.next = 23;
709
+ _context6.next = 23;
627
710
  break;
628
711
  case 18:
629
- _context5.prev = 18;
630
- _context5.t0 = _context5["catch"](2);
631
- console.log(_context5.t0);
712
+ _context6.prev = 18;
713
+ _context6.t0 = _context6["catch"](2);
714
+ console.log(_context6.t0);
632
715
  _this2.setIsActionLoading(undefined);
633
- if ((_context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.code) === 'auth/email-already-in-use') {
716
+ if ((_context6.t0 === null || _context6.t0 === void 0 ? void 0 : _context6.t0.code) === 'auth/email-already-in-use') {
634
717
  _this2.setPopupError('register', 'This email address is already taken', 'email');
635
- } else if ((_context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.code) === 'auth/weak-password') {
718
+ } else if ((_context6.t0 === null || _context6.t0 === void 0 ? void 0 : _context6.t0.code) === 'auth/weak-password') {
636
719
  _this2.setPopupError('register', 'The password is too weak. Please try again.', 'password');
637
720
  } else {
638
721
  _this2.setPopupError('register', 'Oops, something went wrong');
639
722
  }
640
723
  case 23:
641
724
  case "end":
642
- return _context5.stop();
725
+ return _context6.stop();
643
726
  }
644
- }, _callee5, null, [[2, 18]]);
727
+ }, _callee6, null, [[2, 18]]);
645
728
  }));
646
729
  return function (_x3) {
647
- return _ref8.apply(this, arguments);
730
+ return _ref9.apply(this, arguments);
648
731
  };
649
732
  }()
650
733
  }), /*#__PURE__*/_react.default.createElement(_TermsModal.default, {
@@ -670,35 +753,35 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
670
753
  _this2.clearPopupError();
671
754
  _this2.setIsActionLoading(undefined);
672
755
  },
673
- onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
756
+ onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
674
757
  var email;
675
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
676
- while (1) switch (_context6.prev = _context6.next) {
758
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
759
+ while (1) switch (_context7.prev = _context7.next) {
677
760
  case 0:
678
761
  _this2.clearPopupSuccess();
679
762
  _this2.clearPopupError();
680
763
  _this2.setIsActionLoading('resend');
681
- _context6.prev = 3;
764
+ _context7.prev = 3;
682
765
  email = _this2.state.userInfo.email;
683
- _context6.next = 7;
766
+ _context7.next = 7;
684
767
  return resendActivationEmail(email);
685
768
  case 7:
686
769
  cooldown === null || cooldown === void 0 || cooldown.startCooldown();
687
770
  _this2.setPopupSuccess('resend', 'Email sent.');
688
771
  _this2.setIsActionLoading(undefined);
689
- _context6.next = 17;
772
+ _context7.next = 17;
690
773
  break;
691
774
  case 12:
692
- _context6.prev = 12;
693
- _context6.t0 = _context6["catch"](3);
694
- console.log(_context6.t0);
775
+ _context7.prev = 12;
776
+ _context7.t0 = _context7["catch"](3);
777
+ console.log(_context7.t0);
695
778
  _this2.setPopupError('resend', 'Something went wrong.');
696
779
  _this2.setIsActionLoading(undefined);
697
780
  case 17:
698
781
  case "end":
699
- return _context6.stop();
782
+ return _context7.stop();
700
783
  }
701
- }, _callee6, null, [[3, 12]]);
784
+ }, _callee7, null, [[3, 12]]);
702
785
  }))
703
786
  }), /*#__PURE__*/_react.default.createElement(_ForgotPasswordModal.default, {
704
787
  isActionLoading: isActionLoading,
@@ -718,38 +801,38 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
718
801
  _this2.setIsActionLoading(undefined);
719
802
  },
720
803
  onFormSend: /*#__PURE__*/function () {
721
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref10) {
804
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref11) {
722
805
  var email;
723
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
724
- while (1) switch (_context7.prev = _context7.next) {
806
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
807
+ while (1) switch (_context8.prev = _context8.next) {
725
808
  case 0:
726
- email = _ref10.email;
809
+ email = _ref11.email;
727
810
  _this2.clearPopupError();
728
811
  _this2.setIsActionLoading('forgot');
729
- _context7.prev = 3;
730
- _context7.next = 6;
812
+ _context8.prev = 3;
813
+ _context8.next = 6;
731
814
  return (0, _auth.default)('forgotPass', {
732
815
  email: email
733
816
  });
734
817
  case 6:
735
818
  _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."));
736
819
  _this2.setIsActionLoading(undefined);
737
- _context7.next = 15;
820
+ _context8.next = 15;
738
821
  break;
739
822
  case 10:
740
- _context7.prev = 10;
741
- _context7.t0 = _context7["catch"](3);
742
- console.log(_context7.t0);
823
+ _context8.prev = 10;
824
+ _context8.t0 = _context8["catch"](3);
825
+ console.log(_context8.t0);
743
826
  _this2.setPopupError('forgot', 'This email is not registered.');
744
827
  _this2.setIsActionLoading(undefined);
745
828
  case 15:
746
829
  case "end":
747
- return _context7.stop();
830
+ return _context8.stop();
748
831
  }
749
- }, _callee7, null, [[3, 10]]);
832
+ }, _callee8, null, [[3, 10]]);
750
833
  }));
751
834
  return function (_x4) {
752
- return _ref11.apply(this, arguments);
835
+ return _ref12.apply(this, arguments);
753
836
  };
754
837
  }()
755
838
  }), /*#__PURE__*/_react.default.createElement(_ResetPasswordModal.default, {
@@ -768,36 +851,36 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
768
851
  _this2.setIsActionLoading(undefined);
769
852
  },
770
853
  onFormSend: /*#__PURE__*/function () {
771
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref12) {
854
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref13) {
772
855
  var password, oobCode;
773
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
774
- while (1) switch (_context8.prev = _context8.next) {
856
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
857
+ while (1) switch (_context9.prev = _context9.next) {
775
858
  case 0:
776
- password = _ref12.password, oobCode = _ref12.oobCode;
859
+ password = _ref13.password, oobCode = _ref13.oobCode;
777
860
  _this2.clearPopupError();
778
861
  _this2.setIsActionLoading('resetPassword');
779
- _context8.prev = 3;
780
- _context8.next = 6;
862
+ _context9.prev = 3;
863
+ _context9.next = 6;
781
864
  return handleResetPassword(password, oobCode);
782
865
  case 6:
783
866
  _this2.switchOpenModal('resetPassword', 'confirmReset');
784
867
  _this2.setIsActionLoading(undefined);
785
- _context8.next = 15;
868
+ _context9.next = 15;
786
869
  break;
787
870
  case 10:
788
- _context8.prev = 10;
789
- _context8.t0 = _context8["catch"](3);
790
- console.log(_context8.t0);
791
- _this2.setPopupError('resetPassword', (_context8.t0 === null || _context8.t0 === void 0 ? void 0 : _context8.t0.message) || 'Something went wrong.');
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.');
792
875
  _this2.setIsActionLoading(undefined);
793
876
  case 15:
794
877
  case "end":
795
- return _context8.stop();
878
+ return _context9.stop();
796
879
  }
797
- }, _callee8, null, [[3, 10]]);
880
+ }, _callee9, null, [[3, 10]]);
798
881
  }));
799
882
  return function (_x5) {
800
- return _ref13.apply(this, arguments);
883
+ return _ref14.apply(this, arguments);
801
884
  };
802
885
  }()
803
886
  }), /*#__PURE__*/_react.default.createElement(_ResetConfirmModal.default, {
@@ -836,37 +919,37 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
836
919
  _this2.setIsActionLoading(undefined);
837
920
  },
838
921
  onResend: /*#__PURE__*/function () {
839
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(values) {
922
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(values) {
840
923
  var email;
841
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
842
- while (1) switch (_context9.prev = _context9.next) {
924
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
925
+ while (1) switch (_context10.prev = _context10.next) {
843
926
  case 0:
844
927
  _this2.clearPopupSuccess();
845
928
  _this2.clearPopupError();
846
929
  _this2.setIsActionLoading('resend');
847
- _context9.prev = 3;
930
+ _context10.prev = 3;
848
931
  email = values === null || values === void 0 ? void 0 : values.email;
849
- _context9.next = 7;
932
+ _context10.next = 7;
850
933
  return resendActivationEmail(email);
851
934
  case 7:
852
935
  _this2.setPopupSuccess('resend', 'Email sent.');
853
936
  _this2.setIsActionLoading(undefined);
854
- _context9.next = 16;
937
+ _context10.next = 16;
855
938
  break;
856
939
  case 11:
857
- _context9.prev = 11;
858
- _context9.t0 = _context9["catch"](3);
859
- console.log(_context9.t0);
860
- _this2.setPopupError('resend', (_context9.t0 === null || _context9.t0 === void 0 ? void 0 : _context9.t0.message) || 'Something went wrong.');
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.');
861
944
  _this2.setIsActionLoading(undefined);
862
945
  case 16:
863
946
  case "end":
864
- return _context9.stop();
947
+ return _context10.stop();
865
948
  }
866
- }, _callee9, null, [[3, 11]]);
949
+ }, _callee10, null, [[3, 11]]);
867
950
  }));
868
951
  return function (_x6) {
869
- return _ref14.apply(this, arguments);
952
+ return _ref15.apply(this, arguments);
870
953
  };
871
954
  }()
872
955
  }));
@@ -876,7 +959,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
876
959
  }(_react.Component);
877
960
  _defineProperty(HeaderHoClass, "propTypes", {});
878
961
  _defineProperty(HeaderHoClass, "contextType", _AuthContext.AuthContext);
879
- var HeaderHo = (0, _withRouter.withRouter)((0, _customHooks.cooldownHOC)(HeaderHoClass, 90));
962
+ var HeaderHo = (0, _withRouter.withRouter)((0, _customHooks.cooldownHOC)((0, _customHooks.withUrlParams)(HeaderHoClass), 90));
880
963
  exports.HeaderHo = HeaderHo;
881
964
  var _default = HeaderHo;
882
965
  exports.default = _default;
@@ -6,8 +6,10 @@ 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;
9
10
  var _react = _interopRequireWildcard(require("react"));
10
11
  var _rwd = _interopRequireWildcard(require("../styles/rwd"));
12
+ var _reactRouterDom = require("react-router-dom");
11
13
  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); }
12
14
  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; }
13
15
  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); }
@@ -116,4 +118,34 @@ var cooldownHOC = function cooldownHOC(Component) {
116
118
  };
117
119
  return Wrapper;
118
120
  };
119
- exports.cooldownHOC = cooldownHOC;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "2.3.41-beta.16",
3
+ "version": "2.3.41-beta.18",
4
4
  "description": "STOKR - Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",