@stokr/components-library 2.3.41-beta.19 → 2.3.41-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Footer/FooterMenu.styles.js +1 -1
- package/dist/components/ForgotPasswordModal/ForgotPasswordModal.js +13 -4
- package/dist/components/LoginModal/LoginModal.js +2 -2
- package/dist/components/RegisterModal/RegisterModal.js +3 -4
- package/dist/components/VerifyEmailModal/VerifyEmailModal.js +2 -1
- package/dist/components/headerHo/HeaderHo.js +196 -207
- package/dist/constants/globalVariables.js +6 -2
- package/dist/context/AuthContext.js +113 -150
- package/package.json +1 -1
|
@@ -17,7 +17,6 @@ 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"));
|
|
21
20
|
var _auth = _interopRequireDefault(require("../../api/auth"));
|
|
22
21
|
var _fetchDataPublic = _interopRequireDefault(require("../../api/fetchDataPublic"));
|
|
23
22
|
var _AuthContext = require("../../context/AuthContext");
|
|
@@ -30,10 +29,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
30
29
|
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; }
|
|
31
30
|
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); }
|
|
32
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; }
|
|
33
|
-
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; }
|
|
34
|
-
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; }
|
|
35
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); } }
|
|
36
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
|
+
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; }
|
|
35
|
+
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; }
|
|
37
36
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
38
37
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
39
38
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -58,7 +57,6 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
58
57
|
_inherits(HeaderHoClass, _Component);
|
|
59
58
|
var _super = _createSuper(HeaderHoClass);
|
|
60
59
|
function HeaderHoClass() {
|
|
61
|
-
var _isModalOpen;
|
|
62
60
|
var _this;
|
|
63
61
|
_classCallCheck(this, HeaderHoClass);
|
|
64
62
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -67,7 +65,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
67
65
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
68
66
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
69
67
|
mobileMenuOpen: false,
|
|
70
|
-
isModalOpen:
|
|
68
|
+
isModalOpen: {
|
|
71
69
|
login: false,
|
|
72
70
|
signUp: false,
|
|
73
71
|
terms: false,
|
|
@@ -78,7 +76,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
78
76
|
enter2fa: false,
|
|
79
77
|
resetCode: false,
|
|
80
78
|
verifyEmail: false
|
|
81
|
-
},
|
|
79
|
+
},
|
|
82
80
|
userInfo: {
|
|
83
81
|
email: undefined,
|
|
84
82
|
password: undefined,
|
|
@@ -95,70 +93,67 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
95
93
|
message: undefined
|
|
96
94
|
},
|
|
97
95
|
isActionLoading: undefined,
|
|
98
|
-
termsData: undefined
|
|
96
|
+
termsData: undefined,
|
|
97
|
+
isResettingExpiredToken: false
|
|
98
|
+
});
|
|
99
|
+
_defineProperty(_assertThisInitialized(_this), "checkForModals", function () {
|
|
100
|
+
var _this$props = _this.props,
|
|
101
|
+
isLogin = _this$props.isLogin,
|
|
102
|
+
isSignUp = _this$props.isSignUp,
|
|
103
|
+
isResetPassword = _this$props.isResetPassword,
|
|
104
|
+
isVerifyEmail = _this$props.isVerifyEmail;
|
|
105
|
+
var user = _this.context.user;
|
|
106
|
+
var isModalOpen = _this.state.isModalOpen;
|
|
107
|
+
var login = isModalOpen.login,
|
|
108
|
+
signUp = isModalOpen.signUp,
|
|
109
|
+
resetPassword = isModalOpen.resetPassword,
|
|
110
|
+
verifyEmail = isModalOpen.verifyEmail;
|
|
111
|
+
|
|
112
|
+
//checks if any modal is open
|
|
113
|
+
//if true we won't open any modal from below
|
|
114
|
+
var isAnyModalOpen = Object.values(isModalOpen).some(function (value) {
|
|
115
|
+
return value === true;
|
|
116
|
+
});
|
|
117
|
+
if (isAnyModalOpen) return;
|
|
118
|
+
|
|
119
|
+
//dont open if modal is already open or user is logged in
|
|
120
|
+
if (isLogin && !user && !login) {
|
|
121
|
+
_this.setState(function (prevState) {
|
|
122
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
123
|
+
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
124
|
+
login: true
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
if (isSignUp && !user && !signUp) {
|
|
130
|
+
_this.setState(function (prevState) {
|
|
131
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
132
|
+
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
133
|
+
signUp: true
|
|
134
|
+
})
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (isResetPassword && !user && !resetPassword) {
|
|
139
|
+
_this.setState(function (prevState) {
|
|
140
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
141
|
+
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
142
|
+
resetPassword: true
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (isVerifyEmail && !verifyEmail) {
|
|
148
|
+
_this.setState(function (prevState) {
|
|
149
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
150
|
+
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
151
|
+
verifyEmail: true
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
}
|
|
99
156
|
});
|
|
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;
|
|
102
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
103
|
-
while (1) switch (_context.prev = _context.next) {
|
|
104
|
-
case 0:
|
|
105
|
-
_this$props = _this.props, isLogin = _this$props.isLogin, isSignUp = _this$props.isSignUp, isResetPassword = _this$props.isResetPassword, isVerifyEmail = _this$props.isVerifyEmail;
|
|
106
|
-
user = _this.context.user;
|
|
107
|
-
isModalOpen = _this.state.isModalOpen;
|
|
108
|
-
login = isModalOpen.login, signUp = isModalOpen.signUp, resetPassword = isModalOpen.resetPassword, verifyEmail = isModalOpen.verifyEmail; //checks if any modal is open
|
|
109
|
-
//if true we won't open any modal from below
|
|
110
|
-
isAnyModalOpen = Object.values(isModalOpen).some(function (value) {
|
|
111
|
-
return value === true;
|
|
112
|
-
});
|
|
113
|
-
if (!isAnyModalOpen) {
|
|
114
|
-
_context.next = 7;
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
return _context.abrupt("return");
|
|
118
|
-
case 7:
|
|
119
|
-
//dont open if modal is already open or user is logged in
|
|
120
|
-
if (isLogin && !user && !login) {
|
|
121
|
-
_this.setState(function (prevState) {
|
|
122
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
123
|
-
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
124
|
-
login: true
|
|
125
|
-
})
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
if (isSignUp && !user && !signUp) {
|
|
130
|
-
_this.setState(function (prevState) {
|
|
131
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
132
|
-
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
133
|
-
signUp: true
|
|
134
|
-
})
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
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
|
-
})
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
if (isVerifyEmail && !verifyEmail) {
|
|
148
|
-
_this.setState(function (prevState) {
|
|
149
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
150
|
-
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
151
|
-
verifyEmail: true
|
|
152
|
-
})
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
case 11:
|
|
157
|
-
case "end":
|
|
158
|
-
return _context.stop();
|
|
159
|
-
}
|
|
160
|
-
}, _callee);
|
|
161
|
-
})));
|
|
162
157
|
_defineProperty(_assertThisInitialized(_this), "setOpenModalStatus", function (modalId, status) {
|
|
163
158
|
var isModalOpen = _this.state.isModalOpen;
|
|
164
159
|
var _this$props2 = _this.props,
|
|
@@ -178,6 +173,8 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
178
173
|
_this.setState(function (prevState) {
|
|
179
174
|
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
180
175
|
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, _defineProperty({}, modalId, status))
|
|
176
|
+
}, modalId === 'forgot' && !status && {
|
|
177
|
+
isResettingExpiredToken: false
|
|
181
178
|
});
|
|
182
179
|
});
|
|
183
180
|
});
|
|
@@ -290,7 +287,8 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
290
287
|
isModalOpen = _this$state.isModalOpen,
|
|
291
288
|
userInfo = _this$state.userInfo,
|
|
292
289
|
isActionLoading = _this$state.isActionLoading,
|
|
293
|
-
termsData = _this$state.termsData
|
|
290
|
+
termsData = _this$state.termsData,
|
|
291
|
+
isResettingExpiredToken = _this$state.isResettingExpiredToken;
|
|
294
292
|
var _this$props3 = this.props,
|
|
295
293
|
fixed = _this$props3.fixed,
|
|
296
294
|
activateMenu = _this$props3.activateMenu,
|
|
@@ -355,47 +353,47 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
355
353
|
_this2.setIsActionLoading(undefined);
|
|
356
354
|
},
|
|
357
355
|
onFormSend: /*#__PURE__*/function () {
|
|
358
|
-
var
|
|
356
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
359
357
|
var email, password, errorMessage;
|
|
360
|
-
return _regeneratorRuntime().wrap(function
|
|
361
|
-
while (1) switch (
|
|
358
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
359
|
+
while (1) switch (_context.prev = _context.next) {
|
|
362
360
|
case 0:
|
|
363
|
-
email =
|
|
361
|
+
email = _ref2.email, password = _ref2.password;
|
|
364
362
|
_this2.clearPopupError();
|
|
365
363
|
_this2.setIsActionLoading('login');
|
|
366
|
-
|
|
364
|
+
_context.prev = 3;
|
|
367
365
|
if (!(password.length > 128)) {
|
|
368
|
-
|
|
366
|
+
_context.next = 8;
|
|
369
367
|
break;
|
|
370
368
|
}
|
|
371
369
|
_this2.setPopupError('login', 'Your password cannot exceed 128 characters');
|
|
372
370
|
_this2.setIsActionLoading(undefined);
|
|
373
|
-
return
|
|
371
|
+
return _context.abrupt("return");
|
|
374
372
|
case 8:
|
|
375
|
-
|
|
373
|
+
_context.next = 10;
|
|
376
374
|
return loginUser(email, password);
|
|
377
375
|
case 10:
|
|
378
|
-
|
|
376
|
+
_context.next = 12;
|
|
379
377
|
return getUser();
|
|
380
378
|
case 12:
|
|
381
379
|
_this2.setOpenModalStatus('login', false);
|
|
382
380
|
setIsLoginModalOpen && setIsLoginModalOpen(false);
|
|
383
381
|
_this2.clearPopupError();
|
|
384
382
|
_this2.setIsActionLoading(undefined);
|
|
385
|
-
|
|
383
|
+
_context.next = 28;
|
|
386
384
|
break;
|
|
387
385
|
case 18:
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
errorMessage =
|
|
391
|
-
if (!((
|
|
392
|
-
|
|
386
|
+
_context.prev = 18;
|
|
387
|
+
_context.t0 = _context["catch"](3);
|
|
388
|
+
errorMessage = _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message; //handle switch modal correctly
|
|
389
|
+
if (!((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.code) === 'auth/multi-factor-auth-required')) {
|
|
390
|
+
_context.next = 26;
|
|
393
391
|
break;
|
|
394
392
|
}
|
|
395
393
|
_this2.switchOpenModal('login', 'enter2fa');
|
|
396
394
|
_this2.clearPopupError();
|
|
397
395
|
_this2.setIsActionLoading(undefined);
|
|
398
|
-
return
|
|
396
|
+
return _context.abrupt("return");
|
|
399
397
|
case 26:
|
|
400
398
|
if (errorMessage) {
|
|
401
399
|
_this2.setPopupError('login', errorMessage);
|
|
@@ -405,12 +403,12 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
405
403
|
_this2.setIsActionLoading(undefined);
|
|
406
404
|
case 28:
|
|
407
405
|
case "end":
|
|
408
|
-
return
|
|
406
|
+
return _context.stop();
|
|
409
407
|
}
|
|
410
|
-
},
|
|
408
|
+
}, _callee, null, [[3, 18]]);
|
|
411
409
|
}));
|
|
412
410
|
return function (_x) {
|
|
413
|
-
return
|
|
411
|
+
return _ref3.apply(this, arguments);
|
|
414
412
|
};
|
|
415
413
|
}()
|
|
416
414
|
}), waitingFor2fa && /*#__PURE__*/_react.default.createElement(_FA.EnterCode, {
|
|
@@ -429,46 +427,46 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
429
427
|
_this2.setIsActionLoading(undefined);
|
|
430
428
|
},
|
|
431
429
|
onFormSend: /*#__PURE__*/function () {
|
|
432
|
-
var
|
|
430
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref4) {
|
|
433
431
|
var otpInput;
|
|
434
|
-
return _regeneratorRuntime().wrap(function
|
|
435
|
-
while (1) switch (
|
|
432
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
433
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
436
434
|
case 0:
|
|
437
|
-
otpInput =
|
|
435
|
+
otpInput = _ref4.otpInput;
|
|
438
436
|
_this2.setIsActionLoading('enter2fa');
|
|
439
|
-
|
|
440
|
-
|
|
437
|
+
_context2.prev = 2;
|
|
438
|
+
_context2.next = 5;
|
|
441
439
|
return loginUserWithTotp(otpInput, firebaseError);
|
|
442
440
|
case 5:
|
|
443
|
-
|
|
441
|
+
_context2.next = 7;
|
|
444
442
|
return getUser();
|
|
445
443
|
case 7:
|
|
446
444
|
_this2.setOpenModalStatus('enter2fa', false);
|
|
447
445
|
_this2.clearPopupError();
|
|
448
446
|
_this2.setIsActionLoading(undefined);
|
|
449
|
-
|
|
447
|
+
_context2.next = 16;
|
|
450
448
|
break;
|
|
451
449
|
case 12:
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
console.log('🚀 ~ file: HeaderHo.jsx:364 ~ error:',
|
|
455
|
-
if ((
|
|
450
|
+
_context2.prev = 12;
|
|
451
|
+
_context2.t0 = _context2["catch"](2);
|
|
452
|
+
console.log('🚀 ~ file: HeaderHo.jsx:364 ~ error:', _context2.t0);
|
|
453
|
+
if ((_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code) === 'auth/invalid-verification-code') {
|
|
456
454
|
_this2.setPopupError('enter2fa', 'That’s not the right 2FA code. Try again');
|
|
457
|
-
} else if ((
|
|
455
|
+
} else if ((_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code) === 'auth/code-expired') {
|
|
458
456
|
_this2.setPopupError('enter2fa', 'Time out. Please restart the flow and log in again');
|
|
459
457
|
} else {
|
|
460
|
-
_this2.setPopupError('enter2fa',
|
|
458
|
+
_this2.setPopupError('enter2fa', _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.message);
|
|
461
459
|
}
|
|
462
460
|
case 16:
|
|
463
461
|
_this2.setIsActionLoading(undefined);
|
|
464
462
|
case 17:
|
|
465
463
|
case "end":
|
|
466
|
-
return
|
|
464
|
+
return _context2.stop();
|
|
467
465
|
}
|
|
468
|
-
},
|
|
466
|
+
}, _callee2, null, [[2, 12]]);
|
|
469
467
|
}));
|
|
470
468
|
return function (_x2) {
|
|
471
|
-
return
|
|
469
|
+
return _ref5.apply(this, arguments);
|
|
472
470
|
};
|
|
473
471
|
}()
|
|
474
472
|
}), /*#__PURE__*/_react.default.createElement(_FA.ResetCode, {
|
|
@@ -523,24 +521,24 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
523
521
|
onSignupModalClose && onSignupModalClose();
|
|
524
522
|
},
|
|
525
523
|
onFormSend: /*#__PURE__*/function () {
|
|
526
|
-
var
|
|
527
|
-
return _regeneratorRuntime().wrap(function
|
|
528
|
-
while (1) switch (
|
|
524
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(userInfo) {
|
|
525
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
526
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
529
527
|
case 0:
|
|
530
528
|
_this2.clearPopupError();
|
|
531
529
|
_this2.setIsActionLoading('signUp');
|
|
532
530
|
|
|
533
531
|
//check password
|
|
534
|
-
|
|
532
|
+
_context3.prev = 2;
|
|
535
533
|
if (!(userInfo.password.length > 128)) {
|
|
536
|
-
|
|
534
|
+
_context3.next = 7;
|
|
537
535
|
break;
|
|
538
536
|
}
|
|
539
537
|
_this2.setPopupError('register', 'Your password cannot exceed 128 characters', 'password');
|
|
540
538
|
_this2.setIsActionLoading(undefined);
|
|
541
|
-
return
|
|
539
|
+
return _context3.abrupt("return");
|
|
542
540
|
case 7:
|
|
543
|
-
|
|
541
|
+
_context3.next = 9;
|
|
544
542
|
return createUser(userInfo.email, userInfo.password);
|
|
545
543
|
case 9:
|
|
546
544
|
//start the timer to count when user can resend email
|
|
@@ -548,10 +546,10 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
548
546
|
|
|
549
547
|
//if user checked newsletter checkbox
|
|
550
548
|
if (!userInfo.newsletter) {
|
|
551
|
-
|
|
549
|
+
_context3.next = 13;
|
|
552
550
|
break;
|
|
553
551
|
}
|
|
554
|
-
|
|
552
|
+
_context3.next = 13;
|
|
555
553
|
return (0, _fetchDataPublic.default)('emails/subscribe', {
|
|
556
554
|
email: userInfo.email,
|
|
557
555
|
listName: 'newsletter'
|
|
@@ -560,28 +558,28 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
560
558
|
_this2.setUserInfo(userInfo);
|
|
561
559
|
_this2.switchOpenModal('signUp', 'confirm');
|
|
562
560
|
_this2.setIsActionLoading(undefined);
|
|
563
|
-
|
|
561
|
+
_context3.next = 23;
|
|
564
562
|
break;
|
|
565
563
|
case 18:
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
console.log(
|
|
564
|
+
_context3.prev = 18;
|
|
565
|
+
_context3.t0 = _context3["catch"](2);
|
|
566
|
+
console.log(_context3.t0);
|
|
569
567
|
_this2.setIsActionLoading(undefined);
|
|
570
|
-
if ((
|
|
568
|
+
if ((_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.code) === 'auth/email-already-in-use') {
|
|
571
569
|
_this2.setPopupError('register', 'This email address is already taken', 'email');
|
|
572
|
-
} else if ((
|
|
570
|
+
} else if ((_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.code) === 'auth/weak-password') {
|
|
573
571
|
_this2.setPopupError('register', 'The password is too weak. Please try again.', 'password');
|
|
574
572
|
} else {
|
|
575
573
|
_this2.setPopupError('register', 'Oops, something went wrong');
|
|
576
574
|
}
|
|
577
575
|
case 23:
|
|
578
576
|
case "end":
|
|
579
|
-
return
|
|
577
|
+
return _context3.stop();
|
|
580
578
|
}
|
|
581
|
-
},
|
|
579
|
+
}, _callee3, null, [[2, 18]]);
|
|
582
580
|
}));
|
|
583
581
|
return function (_x3) {
|
|
584
|
-
return
|
|
582
|
+
return _ref6.apply(this, arguments);
|
|
585
583
|
};
|
|
586
584
|
}()
|
|
587
585
|
}), /*#__PURE__*/_react.default.createElement(_TermsModal.default, {
|
|
@@ -607,41 +605,42 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
607
605
|
_this2.clearPopupError();
|
|
608
606
|
_this2.setIsActionLoading(undefined);
|
|
609
607
|
},
|
|
610
|
-
onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
608
|
+
onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
611
609
|
var email;
|
|
612
|
-
return _regeneratorRuntime().wrap(function
|
|
613
|
-
while (1) switch (
|
|
610
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
611
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
614
612
|
case 0:
|
|
615
613
|
_this2.clearPopupSuccess();
|
|
616
614
|
_this2.clearPopupError();
|
|
617
615
|
_this2.setIsActionLoading('resend');
|
|
618
|
-
|
|
616
|
+
_context4.prev = 3;
|
|
619
617
|
email = _this2.state.userInfo.email;
|
|
620
|
-
|
|
618
|
+
_context4.next = 7;
|
|
621
619
|
return resendActivationEmail(email);
|
|
622
620
|
case 7:
|
|
623
621
|
cooldown === null || cooldown === void 0 || cooldown.startCooldown();
|
|
624
622
|
_this2.setPopupSuccess('resend', 'Email sent.');
|
|
625
623
|
_this2.setIsActionLoading(undefined);
|
|
626
|
-
|
|
624
|
+
_context4.next = 17;
|
|
627
625
|
break;
|
|
628
626
|
case 12:
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
console.log(
|
|
627
|
+
_context4.prev = 12;
|
|
628
|
+
_context4.t0 = _context4["catch"](3);
|
|
629
|
+
console.log(_context4.t0);
|
|
632
630
|
_this2.setPopupError('resend', 'Something went wrong.');
|
|
633
631
|
_this2.setIsActionLoading(undefined);
|
|
634
632
|
case 17:
|
|
635
633
|
case "end":
|
|
636
|
-
return
|
|
634
|
+
return _context4.stop();
|
|
637
635
|
}
|
|
638
|
-
},
|
|
636
|
+
}, _callee4, null, [[3, 12]]);
|
|
639
637
|
}))
|
|
640
638
|
}), /*#__PURE__*/_react.default.createElement(_ForgotPasswordModal.default, {
|
|
641
639
|
isActionLoading: isActionLoading,
|
|
642
640
|
popupError: this.state.popupError,
|
|
643
641
|
popupSuccess: this.state.popupSuccess,
|
|
644
642
|
isModalOpen: isModalOpen.forgot,
|
|
643
|
+
isResettingExpiredToken: isResettingExpiredToken,
|
|
645
644
|
onModalClose: function onModalClose() {
|
|
646
645
|
_this2.setOpenModalStatus('forgot', false);
|
|
647
646
|
_this2.clearPopupError();
|
|
@@ -655,38 +654,38 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
655
654
|
_this2.setIsActionLoading(undefined);
|
|
656
655
|
},
|
|
657
656
|
onFormSend: /*#__PURE__*/function () {
|
|
658
|
-
var
|
|
657
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref8) {
|
|
659
658
|
var email;
|
|
660
|
-
return _regeneratorRuntime().wrap(function
|
|
661
|
-
while (1) switch (
|
|
659
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
660
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
662
661
|
case 0:
|
|
663
|
-
email =
|
|
662
|
+
email = _ref8.email;
|
|
664
663
|
_this2.clearPopupError();
|
|
665
664
|
_this2.setIsActionLoading('forgot');
|
|
666
|
-
|
|
667
|
-
|
|
665
|
+
_context5.prev = 3;
|
|
666
|
+
_context5.next = 6;
|
|
668
667
|
return (0, _auth.default)('forgotPass', {
|
|
669
668
|
email: email
|
|
670
669
|
});
|
|
671
670
|
case 6:
|
|
672
671
|
_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."));
|
|
673
672
|
_this2.setIsActionLoading(undefined);
|
|
674
|
-
|
|
673
|
+
_context5.next = 15;
|
|
675
674
|
break;
|
|
676
675
|
case 10:
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
console.log(
|
|
676
|
+
_context5.prev = 10;
|
|
677
|
+
_context5.t0 = _context5["catch"](3);
|
|
678
|
+
console.log(_context5.t0);
|
|
680
679
|
_this2.setPopupError('forgot', 'This email is not registered.');
|
|
681
680
|
_this2.setIsActionLoading(undefined);
|
|
682
681
|
case 15:
|
|
683
682
|
case "end":
|
|
684
|
-
return
|
|
683
|
+
return _context5.stop();
|
|
685
684
|
}
|
|
686
|
-
},
|
|
685
|
+
}, _callee5, null, [[3, 10]]);
|
|
687
686
|
}));
|
|
688
687
|
return function (_x4) {
|
|
689
|
-
return
|
|
688
|
+
return _ref9.apply(this, arguments);
|
|
690
689
|
};
|
|
691
690
|
}()
|
|
692
691
|
}), /*#__PURE__*/_react.default.createElement(_ResetPasswordModal.default, {
|
|
@@ -705,63 +704,72 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
705
704
|
_this2.setIsActionLoading(undefined);
|
|
706
705
|
},
|
|
707
706
|
onFormSend: /*#__PURE__*/function () {
|
|
708
|
-
var
|
|
707
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref10) {
|
|
709
708
|
var password;
|
|
710
|
-
return _regeneratorRuntime().wrap(function
|
|
711
|
-
while (1) switch (
|
|
709
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
710
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
712
711
|
case 0:
|
|
713
|
-
password =
|
|
712
|
+
password = _ref10.password;
|
|
714
713
|
_this2.clearPopupError();
|
|
715
714
|
_this2.setIsActionLoading('resetPassword');
|
|
716
|
-
|
|
717
|
-
|
|
715
|
+
_context6.prev = 3;
|
|
716
|
+
_context6.next = 6;
|
|
718
717
|
return handleResetPassword(password);
|
|
719
718
|
case 6:
|
|
720
719
|
_this2.switchOpenModal('resetPassword', 'confirmReset');
|
|
721
720
|
_this2.setIsActionLoading(undefined);
|
|
722
|
-
|
|
721
|
+
_context6.next = 15;
|
|
723
722
|
break;
|
|
724
723
|
case 10:
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
console.log(
|
|
728
|
-
_this2.setPopupError('resetPassword', (
|
|
724
|
+
_context6.prev = 10;
|
|
725
|
+
_context6.t0 = _context6["catch"](3);
|
|
726
|
+
console.log(_context6.t0);
|
|
727
|
+
_this2.setPopupError('resetPassword', (_context6.t0 === null || _context6.t0 === void 0 ? void 0 : _context6.t0.message) || 'Something went wrong.');
|
|
729
728
|
_this2.setIsActionLoading(undefined);
|
|
730
729
|
case 15:
|
|
731
730
|
case "end":
|
|
732
|
-
return
|
|
731
|
+
return _context6.stop();
|
|
733
732
|
}
|
|
734
|
-
},
|
|
733
|
+
}, _callee6, null, [[3, 10]]);
|
|
735
734
|
}));
|
|
736
735
|
return function (_x5) {
|
|
737
|
-
return
|
|
736
|
+
return _ref11.apply(this, arguments);
|
|
738
737
|
};
|
|
739
738
|
}(),
|
|
740
|
-
onLoad: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
739
|
+
onLoad: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
741
740
|
var location, query, oobCode;
|
|
742
|
-
return _regeneratorRuntime().wrap(function
|
|
743
|
-
while (1) switch (
|
|
741
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
742
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
744
743
|
case 0:
|
|
745
744
|
location = _this2.props.location;
|
|
746
745
|
query = new URLSearchParams(location === null || location === void 0 ? void 0 : location.search);
|
|
747
746
|
oobCode = query.get('oobCode');
|
|
748
747
|
if (!(oobCode && oobCode !== '')) {
|
|
749
|
-
|
|
748
|
+
_context7.next = 16;
|
|
750
749
|
break;
|
|
751
750
|
}
|
|
752
751
|
_this2.setIsActionLoading('resetPassword');
|
|
753
|
-
|
|
754
|
-
|
|
752
|
+
_context7.prev = 5;
|
|
753
|
+
_context7.next = 8;
|
|
755
754
|
return (0, _auth2.checkActionCode)(_firebaseConfig.auth, oobCode);
|
|
756
755
|
case 8:
|
|
757
756
|
_this2.setIsActionLoading(undefined);
|
|
758
|
-
|
|
757
|
+
_context7.next = 15;
|
|
759
758
|
break;
|
|
760
759
|
case 11:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
console.log('Password reset code error:',
|
|
764
|
-
if ((
|
|
760
|
+
_context7.prev = 11;
|
|
761
|
+
_context7.t0 = _context7["catch"](5);
|
|
762
|
+
console.log('Password reset code error:', _context7.t0);
|
|
763
|
+
if ((_context7.t0 === null || _context7.t0 === void 0 ? void 0 : _context7.t0.code) === 'auth/expired-action-code') {
|
|
764
|
+
_this2.setState(function (prevState) {
|
|
765
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
766
|
+
isResettingExpiredToken: true
|
|
767
|
+
});
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
// we use a special version of Forgot Password modal
|
|
771
|
+
// adjusted to handle and resend expired tokens.
|
|
772
|
+
// isResettingExpiredToken makes it adjust.
|
|
765
773
|
_this2.switchOpenModal('resetPassword', 'forgot');
|
|
766
774
|
_this2.setPopupError('forgot', 'This password reset link has expired or is invalid. Please request a new one.');
|
|
767
775
|
} else {
|
|
@@ -771,9 +779,9 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
771
779
|
_this2.setIsActionLoading(undefined);
|
|
772
780
|
case 16:
|
|
773
781
|
case "end":
|
|
774
|
-
return
|
|
782
|
+
return _context7.stop();
|
|
775
783
|
}
|
|
776
|
-
},
|
|
784
|
+
}, _callee7, null, [[5, 11]]);
|
|
777
785
|
}))
|
|
778
786
|
}), /*#__PURE__*/_react.default.createElement(_ResetConfirmModal.default, {
|
|
779
787
|
isModalOpen: isModalOpen.confirmReset,
|
|
@@ -811,58 +819,39 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
811
819
|
_this2.setIsActionLoading(undefined);
|
|
812
820
|
},
|
|
813
821
|
onResend: /*#__PURE__*/function () {
|
|
814
|
-
var
|
|
822
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(values) {
|
|
815
823
|
var email;
|
|
816
|
-
return _regeneratorRuntime().wrap(function
|
|
817
|
-
while (1) switch (
|
|
824
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
825
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
818
826
|
case 0:
|
|
819
827
|
_this2.clearPopupSuccess();
|
|
820
828
|
_this2.clearPopupError();
|
|
821
829
|
_this2.setIsActionLoading('resend');
|
|
822
|
-
|
|
830
|
+
_context8.prev = 3;
|
|
823
831
|
email = values === null || values === void 0 ? void 0 : values.email;
|
|
824
|
-
|
|
832
|
+
_context8.next = 7;
|
|
825
833
|
return resendActivationEmail(email);
|
|
826
834
|
case 7:
|
|
827
835
|
_this2.setPopupSuccess('resend', 'Email sent.');
|
|
828
836
|
_this2.setIsActionLoading(undefined);
|
|
829
|
-
|
|
837
|
+
_context8.next = 16;
|
|
830
838
|
break;
|
|
831
839
|
case 11:
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
console.log(
|
|
835
|
-
_this2.setPopupError('resend', (
|
|
840
|
+
_context8.prev = 11;
|
|
841
|
+
_context8.t0 = _context8["catch"](3);
|
|
842
|
+
console.log(_context8.t0);
|
|
843
|
+
_this2.setPopupError('resend', (_context8.t0 === null || _context8.t0 === void 0 ? void 0 : _context8.t0.message) || 'Something went wrong.');
|
|
836
844
|
_this2.setIsActionLoading(undefined);
|
|
837
845
|
case 16:
|
|
838
846
|
case "end":
|
|
839
|
-
return
|
|
847
|
+
return _context8.stop();
|
|
840
848
|
}
|
|
841
|
-
},
|
|
849
|
+
}, _callee8, null, [[3, 11]]);
|
|
842
850
|
}));
|
|
843
851
|
return function (_x6) {
|
|
844
|
-
return
|
|
852
|
+
return _ref13.apply(this, arguments);
|
|
845
853
|
};
|
|
846
854
|
}()
|
|
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
|
-
}
|
|
866
855
|
}));
|
|
867
856
|
}
|
|
868
857
|
}]);
|