@stokr/components-library 2.3.41-beta.13 → 2.3.41-beta.14
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.
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.HeaderHo = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
9
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
10
9
|
var sc = _interopRequireWildcard(require("../../constants/style"));
|
|
11
10
|
var _RegisterModal = _interopRequireDefault(require("../RegisterModal/RegisterModal"));
|
|
@@ -18,6 +17,7 @@ var _LoginModal = _interopRequireDefault(require("../LoginModal/LoginModal"));
|
|
|
18
17
|
var _VerifyEmailModal = _interopRequireDefault(require("../VerifyEmailModal/VerifyEmailModal"));
|
|
19
18
|
var _Header = _interopRequireDefault(require("../Header/Header"));
|
|
20
19
|
var _FA = require("../2FA");
|
|
20
|
+
var _ResendConfirmationCodeModal = _interopRequireDefault(require("../ResendConfirmationCodeModal/ResendConfirmationCodeModal"));
|
|
21
21
|
var _auth = _interopRequireDefault(require("../../api/auth"));
|
|
22
22
|
var _fetchDataPublic = _interopRequireDefault(require("../../api/fetchDataPublic"));
|
|
23
23
|
var _AuthContext = require("../../context/AuthContext");
|
|
@@ -27,11 +27,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
27
|
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); }
|
|
28
28
|
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; }
|
|
29
29
|
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); }
|
|
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; }
|
|
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; }
|
|
30
32
|
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; }
|
|
31
33
|
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); } }
|
|
32
34
|
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); }); }; }
|
|
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
35
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
36
36
|
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); } }
|
|
37
37
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -56,6 +56,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
56
56
|
_inherits(HeaderHoClass, _Component);
|
|
57
57
|
var _super = _createSuper(HeaderHoClass);
|
|
58
58
|
function HeaderHoClass() {
|
|
59
|
+
var _isModalOpen;
|
|
59
60
|
var _this;
|
|
60
61
|
_classCallCheck(this, HeaderHoClass);
|
|
61
62
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -64,7 +65,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
64
65
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
65
66
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
66
67
|
mobileMenuOpen: false,
|
|
67
|
-
isModalOpen: {
|
|
68
|
+
isModalOpen: (_isModalOpen = {
|
|
68
69
|
login: false,
|
|
69
70
|
signUp: false,
|
|
70
71
|
terms: false,
|
|
@@ -75,7 +76,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
75
76
|
enter2fa: false,
|
|
76
77
|
resetCode: false,
|
|
77
78
|
verifyEmail: false
|
|
78
|
-
},
|
|
79
|
+
}, _defineProperty(_isModalOpen, "resetPassword", false), _defineProperty(_isModalOpen, "resendConfirmation", false), _isModalOpen),
|
|
79
80
|
userInfo: {
|
|
80
81
|
email: undefined,
|
|
81
82
|
password: undefined,
|
|
@@ -94,64 +95,131 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
94
95
|
isActionLoading: undefined,
|
|
95
96
|
termsData: undefined
|
|
96
97
|
});
|
|
97
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
isModalOpen
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
98
|
+
_defineProperty(_assertThisInitialized(_this), "checkTokenExpiration", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
99
|
+
var location, search, query, oobCode, result;
|
|
100
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
101
|
+
while (1) switch (_context.prev = _context.next) {
|
|
102
|
+
case 0:
|
|
103
|
+
location = _this.props.location;
|
|
104
|
+
if (location) {
|
|
105
|
+
_context.next = 3;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
return _context.abrupt("return", {
|
|
109
|
+
expired: true
|
|
110
|
+
});
|
|
111
|
+
case 3:
|
|
112
|
+
_context.prev = 3;
|
|
113
|
+
search = location.search;
|
|
114
|
+
query = new URLSearchParams(search);
|
|
115
|
+
oobCode = query.get('oobCode');
|
|
116
|
+
if (oobCode) {
|
|
117
|
+
_context.next = 9;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
return _context.abrupt("return", {
|
|
121
|
+
expired: true
|
|
122
|
+
});
|
|
123
|
+
case 9:
|
|
124
|
+
_context.next = 11;
|
|
125
|
+
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", {
|
|
134
|
+
expired: true
|
|
135
|
+
});
|
|
136
|
+
case 19:
|
|
137
|
+
case "end":
|
|
138
|
+
return _context.stop();
|
|
139
|
+
}
|
|
140
|
+
}, _callee, null, [[3, 15]]);
|
|
141
|
+
})));
|
|
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, resendConfirmation, isAnyModalOpen, tokenStatus;
|
|
144
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
145
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
146
|
+
case 0:
|
|
147
|
+
_this$props = _this.props, isLogin = _this$props.isLogin, isSignUp = _this$props.isSignUp, isResetPassword = _this$props.isResetPassword, isVerifyEmail = _this$props.isVerifyEmail;
|
|
148
|
+
user = _this.context.user;
|
|
149
|
+
isModalOpen = _this.state.isModalOpen;
|
|
150
|
+
login = isModalOpen.login, signUp = isModalOpen.signUp, resetPassword = isModalOpen.resetPassword, verifyEmail = isModalOpen.verifyEmail, resendConfirmation = isModalOpen.resendConfirmation; //checks if any modal is open
|
|
151
|
+
//if true we won't open any modal from below
|
|
152
|
+
isAnyModalOpen = Object.values(isModalOpen).some(function (value) {
|
|
153
|
+
return value === true;
|
|
154
|
+
});
|
|
155
|
+
if (!isAnyModalOpen) {
|
|
156
|
+
_context2.next = 7;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
return _context2.abrupt("return");
|
|
160
|
+
case 7:
|
|
161
|
+
//dont open if modal is already open or user is logged in
|
|
162
|
+
if (isLogin && !user && !login) {
|
|
163
|
+
_this.setState(function (prevState) {
|
|
164
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
165
|
+
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
166
|
+
login: true
|
|
167
|
+
})
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
if (isSignUp && !user && !signUp) {
|
|
172
|
+
_this.setState(function (prevState) {
|
|
173
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
174
|
+
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
175
|
+
signUp: true
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (!(isResetPassword && !user && !resetPassword && !resendConfirmation)) {
|
|
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 resend confirmation modal if token is expired
|
|
190
|
+
_this.setState(function (prevState) {
|
|
191
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
192
|
+
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
193
|
+
resendConfirmation: true
|
|
194
|
+
})
|
|
195
|
+
});
|
|
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
|
+
})
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
case 14:
|
|
208
|
+
if (isVerifyEmail && !verifyEmail) {
|
|
209
|
+
_this.setState(function (prevState) {
|
|
210
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
211
|
+
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, {
|
|
212
|
+
verifyEmail: true
|
|
213
|
+
})
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
case 15:
|
|
218
|
+
case "end":
|
|
219
|
+
return _context2.stop();
|
|
220
|
+
}
|
|
221
|
+
}, _callee2);
|
|
222
|
+
})));
|
|
155
223
|
_defineProperty(_assertThisInitialized(_this), "setOpenModalStatus", function (modalId, status) {
|
|
156
224
|
var isModalOpen = _this.state.isModalOpen;
|
|
157
225
|
var _this$props2 = _this.props,
|
|
@@ -350,47 +418,47 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
350
418
|
_this2.setIsActionLoading(undefined);
|
|
351
419
|
},
|
|
352
420
|
onFormSend: /*#__PURE__*/function () {
|
|
353
|
-
var
|
|
421
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
|
354
422
|
var email, password, errorMessage;
|
|
355
|
-
return _regeneratorRuntime().wrap(function
|
|
356
|
-
while (1) switch (
|
|
423
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
424
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
357
425
|
case 0:
|
|
358
|
-
email =
|
|
426
|
+
email = _ref4.email, password = _ref4.password;
|
|
359
427
|
_this2.clearPopupError();
|
|
360
428
|
_this2.setIsActionLoading('login');
|
|
361
|
-
|
|
429
|
+
_context3.prev = 3;
|
|
362
430
|
if (!(password.length > 128)) {
|
|
363
|
-
|
|
431
|
+
_context3.next = 8;
|
|
364
432
|
break;
|
|
365
433
|
}
|
|
366
434
|
_this2.setPopupError('login', 'Your password cannot exceed 128 characters');
|
|
367
435
|
_this2.setIsActionLoading(undefined);
|
|
368
|
-
return
|
|
436
|
+
return _context3.abrupt("return");
|
|
369
437
|
case 8:
|
|
370
|
-
|
|
438
|
+
_context3.next = 10;
|
|
371
439
|
return loginUser(email, password);
|
|
372
440
|
case 10:
|
|
373
|
-
|
|
441
|
+
_context3.next = 12;
|
|
374
442
|
return getUser();
|
|
375
443
|
case 12:
|
|
376
444
|
_this2.setOpenModalStatus('login', false);
|
|
377
445
|
setIsLoginModalOpen && setIsLoginModalOpen(false);
|
|
378
446
|
_this2.clearPopupError();
|
|
379
447
|
_this2.setIsActionLoading(undefined);
|
|
380
|
-
|
|
448
|
+
_context3.next = 28;
|
|
381
449
|
break;
|
|
382
450
|
case 18:
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
errorMessage =
|
|
386
|
-
if (!((
|
|
387
|
-
|
|
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;
|
|
388
456
|
break;
|
|
389
457
|
}
|
|
390
458
|
_this2.switchOpenModal('login', 'enter2fa');
|
|
391
459
|
_this2.clearPopupError();
|
|
392
460
|
_this2.setIsActionLoading(undefined);
|
|
393
|
-
return
|
|
461
|
+
return _context3.abrupt("return");
|
|
394
462
|
case 26:
|
|
395
463
|
if (errorMessage) {
|
|
396
464
|
_this2.setPopupError('login', errorMessage);
|
|
@@ -400,12 +468,12 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
400
468
|
_this2.setIsActionLoading(undefined);
|
|
401
469
|
case 28:
|
|
402
470
|
case "end":
|
|
403
|
-
return
|
|
471
|
+
return _context3.stop();
|
|
404
472
|
}
|
|
405
|
-
},
|
|
473
|
+
}, _callee3, null, [[3, 18]]);
|
|
406
474
|
}));
|
|
407
475
|
return function (_x) {
|
|
408
|
-
return
|
|
476
|
+
return _ref5.apply(this, arguments);
|
|
409
477
|
};
|
|
410
478
|
}()
|
|
411
479
|
}), waitingFor2fa && /*#__PURE__*/_react.default.createElement(_FA.EnterCode, {
|
|
@@ -424,46 +492,46 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
424
492
|
_this2.setIsActionLoading(undefined);
|
|
425
493
|
},
|
|
426
494
|
onFormSend: /*#__PURE__*/function () {
|
|
427
|
-
var
|
|
495
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref6) {
|
|
428
496
|
var otpInput;
|
|
429
|
-
return _regeneratorRuntime().wrap(function
|
|
430
|
-
while (1) switch (
|
|
497
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
498
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
431
499
|
case 0:
|
|
432
|
-
otpInput =
|
|
500
|
+
otpInput = _ref6.otpInput;
|
|
433
501
|
_this2.setIsActionLoading('enter2fa');
|
|
434
|
-
|
|
435
|
-
|
|
502
|
+
_context4.prev = 2;
|
|
503
|
+
_context4.next = 5;
|
|
436
504
|
return loginUserWithTotp(otpInput, firebaseError);
|
|
437
505
|
case 5:
|
|
438
|
-
|
|
506
|
+
_context4.next = 7;
|
|
439
507
|
return getUser();
|
|
440
508
|
case 7:
|
|
441
509
|
_this2.setOpenModalStatus('enter2fa', false);
|
|
442
510
|
_this2.clearPopupError();
|
|
443
511
|
_this2.setIsActionLoading(undefined);
|
|
444
|
-
|
|
512
|
+
_context4.next = 16;
|
|
445
513
|
break;
|
|
446
514
|
case 12:
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
console.log('🚀 ~ file: HeaderHo.jsx:364 ~ error:',
|
|
450
|
-
if ((
|
|
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') {
|
|
451
519
|
_this2.setPopupError('enter2fa', 'That’s not the right 2FA code. Try again');
|
|
452
|
-
} else if ((
|
|
520
|
+
} else if ((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.code) === 'auth/code-expired') {
|
|
453
521
|
_this2.setPopupError('enter2fa', 'Time out. Please restart the flow and log in again');
|
|
454
522
|
} else {
|
|
455
|
-
_this2.setPopupError('enter2fa',
|
|
523
|
+
_this2.setPopupError('enter2fa', _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message);
|
|
456
524
|
}
|
|
457
525
|
case 16:
|
|
458
526
|
_this2.setIsActionLoading(undefined);
|
|
459
527
|
case 17:
|
|
460
528
|
case "end":
|
|
461
|
-
return
|
|
529
|
+
return _context4.stop();
|
|
462
530
|
}
|
|
463
|
-
},
|
|
531
|
+
}, _callee4, null, [[2, 12]]);
|
|
464
532
|
}));
|
|
465
533
|
return function (_x2) {
|
|
466
|
-
return
|
|
534
|
+
return _ref7.apply(this, arguments);
|
|
467
535
|
};
|
|
468
536
|
}()
|
|
469
537
|
}), /*#__PURE__*/_react.default.createElement(_FA.ResetCode, {
|
|
@@ -518,24 +586,24 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
518
586
|
onSignupModalClose && onSignupModalClose();
|
|
519
587
|
},
|
|
520
588
|
onFormSend: /*#__PURE__*/function () {
|
|
521
|
-
var
|
|
522
|
-
return _regeneratorRuntime().wrap(function
|
|
523
|
-
while (1) switch (
|
|
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) {
|
|
524
592
|
case 0:
|
|
525
593
|
_this2.clearPopupError();
|
|
526
594
|
_this2.setIsActionLoading('signUp');
|
|
527
595
|
|
|
528
596
|
//check password
|
|
529
|
-
|
|
597
|
+
_context5.prev = 2;
|
|
530
598
|
if (!(userInfo.password.length > 128)) {
|
|
531
|
-
|
|
599
|
+
_context5.next = 7;
|
|
532
600
|
break;
|
|
533
601
|
}
|
|
534
602
|
_this2.setPopupError('register', 'Your password cannot exceed 128 characters', 'password');
|
|
535
603
|
_this2.setIsActionLoading(undefined);
|
|
536
|
-
return
|
|
604
|
+
return _context5.abrupt("return");
|
|
537
605
|
case 7:
|
|
538
|
-
|
|
606
|
+
_context5.next = 9;
|
|
539
607
|
return createUser(userInfo.email, userInfo.password);
|
|
540
608
|
case 9:
|
|
541
609
|
//start the timer to count when user can resend email
|
|
@@ -543,10 +611,10 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
543
611
|
|
|
544
612
|
//if user checked newsletter checkbox
|
|
545
613
|
if (!userInfo.newsletter) {
|
|
546
|
-
|
|
614
|
+
_context5.next = 13;
|
|
547
615
|
break;
|
|
548
616
|
}
|
|
549
|
-
|
|
617
|
+
_context5.next = 13;
|
|
550
618
|
return (0, _fetchDataPublic.default)('emails/subscribe', {
|
|
551
619
|
email: userInfo.email,
|
|
552
620
|
listName: 'newsletter'
|
|
@@ -555,28 +623,28 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
555
623
|
_this2.setUserInfo(userInfo);
|
|
556
624
|
_this2.switchOpenModal('signUp', 'confirm');
|
|
557
625
|
_this2.setIsActionLoading(undefined);
|
|
558
|
-
|
|
626
|
+
_context5.next = 23;
|
|
559
627
|
break;
|
|
560
628
|
case 18:
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
console.log(
|
|
629
|
+
_context5.prev = 18;
|
|
630
|
+
_context5.t0 = _context5["catch"](2);
|
|
631
|
+
console.log(_context5.t0);
|
|
564
632
|
_this2.setIsActionLoading(undefined);
|
|
565
|
-
if ((
|
|
633
|
+
if ((_context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.code) === 'auth/email-already-in-use') {
|
|
566
634
|
_this2.setPopupError('register', 'This email address is already taken', 'email');
|
|
567
|
-
} else if ((
|
|
635
|
+
} else if ((_context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.code) === 'auth/weak-password') {
|
|
568
636
|
_this2.setPopupError('register', 'The password is too weak. Please try again.', 'password');
|
|
569
637
|
} else {
|
|
570
638
|
_this2.setPopupError('register', 'Oops, something went wrong');
|
|
571
639
|
}
|
|
572
640
|
case 23:
|
|
573
641
|
case "end":
|
|
574
|
-
return
|
|
642
|
+
return _context5.stop();
|
|
575
643
|
}
|
|
576
|
-
},
|
|
644
|
+
}, _callee5, null, [[2, 18]]);
|
|
577
645
|
}));
|
|
578
646
|
return function (_x3) {
|
|
579
|
-
return
|
|
647
|
+
return _ref8.apply(this, arguments);
|
|
580
648
|
};
|
|
581
649
|
}()
|
|
582
650
|
}), /*#__PURE__*/_react.default.createElement(_TermsModal.default, {
|
|
@@ -602,35 +670,35 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
602
670
|
_this2.clearPopupError();
|
|
603
671
|
_this2.setIsActionLoading(undefined);
|
|
604
672
|
},
|
|
605
|
-
onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
673
|
+
onResend: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
606
674
|
var email;
|
|
607
|
-
return _regeneratorRuntime().wrap(function
|
|
608
|
-
while (1) switch (
|
|
675
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
676
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
609
677
|
case 0:
|
|
610
678
|
_this2.clearPopupSuccess();
|
|
611
679
|
_this2.clearPopupError();
|
|
612
680
|
_this2.setIsActionLoading('resend');
|
|
613
|
-
|
|
681
|
+
_context6.prev = 3;
|
|
614
682
|
email = _this2.state.userInfo.email;
|
|
615
|
-
|
|
683
|
+
_context6.next = 7;
|
|
616
684
|
return resendActivationEmail(email);
|
|
617
685
|
case 7:
|
|
618
686
|
cooldown === null || cooldown === void 0 || cooldown.startCooldown();
|
|
619
687
|
_this2.setPopupSuccess('resend', 'Email sent.');
|
|
620
688
|
_this2.setIsActionLoading(undefined);
|
|
621
|
-
|
|
689
|
+
_context6.next = 17;
|
|
622
690
|
break;
|
|
623
691
|
case 12:
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
console.log(
|
|
692
|
+
_context6.prev = 12;
|
|
693
|
+
_context6.t0 = _context6["catch"](3);
|
|
694
|
+
console.log(_context6.t0);
|
|
627
695
|
_this2.setPopupError('resend', 'Something went wrong.');
|
|
628
696
|
_this2.setIsActionLoading(undefined);
|
|
629
697
|
case 17:
|
|
630
698
|
case "end":
|
|
631
|
-
return
|
|
699
|
+
return _context6.stop();
|
|
632
700
|
}
|
|
633
|
-
},
|
|
701
|
+
}, _callee6, null, [[3, 12]]);
|
|
634
702
|
}))
|
|
635
703
|
}), /*#__PURE__*/_react.default.createElement(_ForgotPasswordModal.default, {
|
|
636
704
|
isActionLoading: isActionLoading,
|
|
@@ -650,38 +718,38 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
650
718
|
_this2.setIsActionLoading(undefined);
|
|
651
719
|
},
|
|
652
720
|
onFormSend: /*#__PURE__*/function () {
|
|
653
|
-
var
|
|
721
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref10) {
|
|
654
722
|
var email;
|
|
655
|
-
return _regeneratorRuntime().wrap(function
|
|
656
|
-
while (1) switch (
|
|
723
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
724
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
657
725
|
case 0:
|
|
658
|
-
email =
|
|
726
|
+
email = _ref10.email;
|
|
659
727
|
_this2.clearPopupError();
|
|
660
728
|
_this2.setIsActionLoading('forgot');
|
|
661
|
-
|
|
662
|
-
|
|
729
|
+
_context7.prev = 3;
|
|
730
|
+
_context7.next = 6;
|
|
663
731
|
return (0, _auth.default)('forgotPass', {
|
|
664
732
|
email: email
|
|
665
733
|
});
|
|
666
734
|
case 6:
|
|
667
735
|
_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."));
|
|
668
736
|
_this2.setIsActionLoading(undefined);
|
|
669
|
-
|
|
737
|
+
_context7.next = 15;
|
|
670
738
|
break;
|
|
671
739
|
case 10:
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
console.log(
|
|
740
|
+
_context7.prev = 10;
|
|
741
|
+
_context7.t0 = _context7["catch"](3);
|
|
742
|
+
console.log(_context7.t0);
|
|
675
743
|
_this2.setPopupError('forgot', 'This email is not registered.');
|
|
676
744
|
_this2.setIsActionLoading(undefined);
|
|
677
745
|
case 15:
|
|
678
746
|
case "end":
|
|
679
|
-
return
|
|
747
|
+
return _context7.stop();
|
|
680
748
|
}
|
|
681
|
-
},
|
|
749
|
+
}, _callee7, null, [[3, 10]]);
|
|
682
750
|
}));
|
|
683
751
|
return function (_x4) {
|
|
684
|
-
return
|
|
752
|
+
return _ref11.apply(this, arguments);
|
|
685
753
|
};
|
|
686
754
|
}()
|
|
687
755
|
}), /*#__PURE__*/_react.default.createElement(_ResetPasswordModal.default, {
|
|
@@ -700,36 +768,36 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
700
768
|
_this2.setIsActionLoading(undefined);
|
|
701
769
|
},
|
|
702
770
|
onFormSend: /*#__PURE__*/function () {
|
|
703
|
-
var
|
|
771
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref12) {
|
|
704
772
|
var password;
|
|
705
|
-
return _regeneratorRuntime().wrap(function
|
|
706
|
-
while (1) switch (
|
|
773
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
774
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
707
775
|
case 0:
|
|
708
|
-
password =
|
|
776
|
+
password = _ref12.password;
|
|
709
777
|
_this2.clearPopupError();
|
|
710
778
|
_this2.setIsActionLoading('resetPassword');
|
|
711
|
-
|
|
712
|
-
|
|
779
|
+
_context8.prev = 3;
|
|
780
|
+
_context8.next = 6;
|
|
713
781
|
return handleResetPassword(password);
|
|
714
782
|
case 6:
|
|
715
783
|
_this2.switchOpenModal('resetPassword', 'confirmReset');
|
|
716
784
|
_this2.setIsActionLoading(undefined);
|
|
717
|
-
|
|
785
|
+
_context8.next = 15;
|
|
718
786
|
break;
|
|
719
787
|
case 10:
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
console.log(
|
|
723
|
-
_this2.setPopupError('resetPassword', (
|
|
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.');
|
|
724
792
|
_this2.setIsActionLoading(undefined);
|
|
725
793
|
case 15:
|
|
726
794
|
case "end":
|
|
727
|
-
return
|
|
795
|
+
return _context8.stop();
|
|
728
796
|
}
|
|
729
|
-
},
|
|
797
|
+
}, _callee8, null, [[3, 10]]);
|
|
730
798
|
}));
|
|
731
799
|
return function (_x5) {
|
|
732
|
-
return
|
|
800
|
+
return _ref13.apply(this, arguments);
|
|
733
801
|
};
|
|
734
802
|
}()
|
|
735
803
|
}), /*#__PURE__*/_react.default.createElement(_ResetConfirmModal.default, {
|
|
@@ -768,39 +836,106 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
768
836
|
_this2.setIsActionLoading(undefined);
|
|
769
837
|
},
|
|
770
838
|
onResend: /*#__PURE__*/function () {
|
|
771
|
-
var
|
|
839
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(values) {
|
|
772
840
|
var email;
|
|
773
|
-
return _regeneratorRuntime().wrap(function
|
|
774
|
-
while (1) switch (
|
|
841
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
842
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
775
843
|
case 0:
|
|
776
844
|
_this2.clearPopupSuccess();
|
|
777
845
|
_this2.clearPopupError();
|
|
778
846
|
_this2.setIsActionLoading('resend');
|
|
779
|
-
|
|
847
|
+
_context9.prev = 3;
|
|
780
848
|
email = values === null || values === void 0 ? void 0 : values.email;
|
|
781
|
-
|
|
849
|
+
_context9.next = 7;
|
|
782
850
|
return resendActivationEmail(email);
|
|
783
851
|
case 7:
|
|
784
852
|
_this2.setPopupSuccess('resend', 'Email sent.');
|
|
785
853
|
_this2.setIsActionLoading(undefined);
|
|
786
|
-
|
|
854
|
+
_context9.next = 16;
|
|
787
855
|
break;
|
|
788
856
|
case 11:
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
console.log(
|
|
792
|
-
_this2.setPopupError('resend', (
|
|
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.');
|
|
793
861
|
_this2.setIsActionLoading(undefined);
|
|
794
862
|
case 16:
|
|
795
863
|
case "end":
|
|
796
|
-
return
|
|
864
|
+
return _context9.stop();
|
|
797
865
|
}
|
|
798
|
-
},
|
|
866
|
+
}, _callee9, null, [[3, 11]]);
|
|
799
867
|
}));
|
|
800
868
|
return function (_x6) {
|
|
801
|
-
return
|
|
869
|
+
return _ref14.apply(this, arguments);
|
|
802
870
|
};
|
|
803
871
|
}()
|
|
872
|
+
}), /*#__PURE__*/_react.default.createElement(_ResetPasswordModal.default, {
|
|
873
|
+
isActionLoading: isActionLoading,
|
|
874
|
+
popupError: this.state.popupError,
|
|
875
|
+
isModalOpen: isModalOpen.resetPassword,
|
|
876
|
+
onModalClose: function onModalClose() {
|
|
877
|
+
_this2.setOpenModalStatus('resetPassword', false);
|
|
878
|
+
_this2.clearPopupError();
|
|
879
|
+
_this2.setIsActionLoading(undefined);
|
|
880
|
+
},
|
|
881
|
+
onModalSwitch: function onModalSwitch() {
|
|
882
|
+
window.history.pushState({}, null, '/login');
|
|
883
|
+
_this2.switchOpenModal('resetPassword', 'login');
|
|
884
|
+
_this2.clearPopupError();
|
|
885
|
+
_this2.setIsActionLoading(undefined);
|
|
886
|
+
},
|
|
887
|
+
onFormSend: /*#__PURE__*/function () {
|
|
888
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref15) {
|
|
889
|
+
var password, oobCode;
|
|
890
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
891
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
892
|
+
case 0:
|
|
893
|
+
password = _ref15.password, oobCode = _ref15.oobCode;
|
|
894
|
+
_this2.clearPopupError();
|
|
895
|
+
_this2.setIsActionLoading('resetPassword');
|
|
896
|
+
_context10.prev = 3;
|
|
897
|
+
_context10.next = 6;
|
|
898
|
+
return handleResetPassword(password, oobCode);
|
|
899
|
+
case 6:
|
|
900
|
+
_this2.switchOpenModal('resetPassword', 'confirmReset');
|
|
901
|
+
_this2.setIsActionLoading(undefined);
|
|
902
|
+
_context10.next = 15;
|
|
903
|
+
break;
|
|
904
|
+
case 10:
|
|
905
|
+
_context10.prev = 10;
|
|
906
|
+
_context10.t0 = _context10["catch"](3);
|
|
907
|
+
console.log(_context10.t0);
|
|
908
|
+
_this2.setPopupError('resetPassword', (_context10.t0 === null || _context10.t0 === void 0 ? void 0 : _context10.t0.message) || 'Something went wrong.');
|
|
909
|
+
_this2.setIsActionLoading(undefined);
|
|
910
|
+
case 15:
|
|
911
|
+
case "end":
|
|
912
|
+
return _context10.stop();
|
|
913
|
+
}
|
|
914
|
+
}, _callee10, null, [[3, 10]]);
|
|
915
|
+
}));
|
|
916
|
+
return function (_x7) {
|
|
917
|
+
return _ref16.apply(this, arguments);
|
|
918
|
+
};
|
|
919
|
+
}()
|
|
920
|
+
}), /*#__PURE__*/_react.default.createElement(_ResendConfirmationCodeModal.default, {
|
|
921
|
+
isActionLoading: isActionLoading,
|
|
922
|
+
popupError: this.state.popupError,
|
|
923
|
+
isModalOpen: isModalOpen.resendConfirmation,
|
|
924
|
+
onModalClose: function onModalClose() {
|
|
925
|
+
_this2.setOpenModalStatus('resendConfirmation', false);
|
|
926
|
+
_this2.clearPopupError();
|
|
927
|
+
_this2.setIsActionLoading(undefined);
|
|
928
|
+
},
|
|
929
|
+
onModalSwitch: function onModalSwitch() {
|
|
930
|
+
window.history.pushState({}, null, '/login');
|
|
931
|
+
_this2.switchOpenModal('resendConfirmation', 'login');
|
|
932
|
+
_this2.clearPopupError();
|
|
933
|
+
_this2.setIsActionLoading(undefined);
|
|
934
|
+
},
|
|
935
|
+
onTokenRefreshed: function onTokenRefreshed() {
|
|
936
|
+
// Switch to reset password modal after token is refreshed
|
|
937
|
+
_this2.switchOpenModal('resendConfirmation', 'resetPassword');
|
|
938
|
+
}
|
|
804
939
|
}));
|
|
805
940
|
}
|
|
806
941
|
}]);
|