@stokr/components-library 2.3.41-beta.8 → 2.3.42-beta
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/Chips/Chip.js +1 -1
- package/dist/components/Footer/FooterMenu.js +25 -6
- package/dist/components/Footer/FooterMenu.styles.js +1 -1
- package/dist/components/ForgotPasswordModal/ForgotPasswordModal.js +22 -24
- package/dist/components/ForgotPasswordModal/ForgotPasswordModal.stories.js +28 -1
- package/dist/components/Header/Header.js +3 -1
- package/dist/components/Header/Header.styles.js +9 -2
- package/dist/components/Input/Input.js +15 -6
- package/dist/components/LoginModal/LoginModal.js +12 -31
- package/dist/components/LoginModal/LoginModal.stories.js +15 -15
- package/dist/components/RegisterModal/RegisterModal.js +5 -13
- package/dist/components/ResendConfirmationCodeModal/ResendConfirmationCodeModal.js +223 -0
- package/dist/components/ResendConfirmationCodeModal/ResendConfirmationCodeModal.stories.js +48 -0
- package/dist/components/ResetPasswordModal/ResetPasswordModal.js +34 -248
- package/dist/components/VerifyEmailModal/VerifyEmailModal.js +8 -13
- package/dist/components/headerHo/HeaderHo.js +105 -31
- package/dist/constants/globalVariables.js +6 -2
- package/dist/context/AuthContext.js +113 -154
- package/package.json +1 -1
|
@@ -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"));
|
|
@@ -23,6 +22,8 @@ var _fetchDataPublic = _interopRequireDefault(require("../../api/fetchDataPublic
|
|
|
23
22
|
var _AuthContext = require("../../context/AuthContext");
|
|
24
23
|
var _withRouter = require("../../utils/withRouter");
|
|
25
24
|
var _customHooks = require("../../utils/customHooks");
|
|
25
|
+
var _auth2 = require("firebase/auth");
|
|
26
|
+
var _firebaseConfig = require("../../firebase-config");
|
|
26
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
28
|
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
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; }
|
|
@@ -92,7 +93,8 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
92
93
|
message: undefined
|
|
93
94
|
},
|
|
94
95
|
isActionLoading: undefined,
|
|
95
|
-
termsData: undefined
|
|
96
|
+
termsData: undefined,
|
|
97
|
+
isResettingExpiredToken: false
|
|
96
98
|
});
|
|
97
99
|
_defineProperty(_assertThisInitialized(_this), "checkForModals", function () {
|
|
98
100
|
var _this$props = _this.props,
|
|
@@ -171,6 +173,8 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
171
173
|
_this.setState(function (prevState) {
|
|
172
174
|
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
173
175
|
isModalOpen: _objectSpread(_objectSpread({}, isModalOpen), {}, _defineProperty({}, modalId, status))
|
|
176
|
+
}, modalId === 'forgot' && !status && {
|
|
177
|
+
isResettingExpiredToken: false
|
|
174
178
|
});
|
|
175
179
|
});
|
|
176
180
|
});
|
|
@@ -271,8 +275,6 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
271
275
|
this.props.navigate('/login');
|
|
272
276
|
this.props.navigate(0);
|
|
273
277
|
}
|
|
274
|
-
|
|
275
|
-
// Run after page loaded
|
|
276
278
|
if (!isFetchingUser) {
|
|
277
279
|
this.checkForModals();
|
|
278
280
|
}
|
|
@@ -285,7 +287,8 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
285
287
|
isModalOpen = _this$state.isModalOpen,
|
|
286
288
|
userInfo = _this$state.userInfo,
|
|
287
289
|
isActionLoading = _this$state.isActionLoading,
|
|
288
|
-
termsData = _this$state.termsData
|
|
290
|
+
termsData = _this$state.termsData,
|
|
291
|
+
isResettingExpiredToken = _this$state.isResettingExpiredToken;
|
|
289
292
|
var _this$props3 = this.props,
|
|
290
293
|
fixed = _this$props3.fixed,
|
|
291
294
|
activateMenu = _this$props3.activateMenu,
|
|
@@ -637,11 +640,18 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
637
640
|
popupError: this.state.popupError,
|
|
638
641
|
popupSuccess: this.state.popupSuccess,
|
|
639
642
|
isModalOpen: isModalOpen.forgot,
|
|
643
|
+
isResettingExpiredToken: isResettingExpiredToken,
|
|
640
644
|
onModalClose: function onModalClose() {
|
|
641
645
|
_this2.setOpenModalStatus('forgot', false);
|
|
642
646
|
_this2.clearPopupError();
|
|
643
647
|
_this2.clearPopupSuccess();
|
|
644
648
|
_this2.setIsActionLoading(undefined);
|
|
649
|
+
|
|
650
|
+
// if we are in the expired token reset flow, we
|
|
651
|
+
// also need to close the reset password modal
|
|
652
|
+
if (isResettingExpiredToken) {
|
|
653
|
+
_this2.setOpenModalStatus('resetPassword', false);
|
|
654
|
+
}
|
|
645
655
|
},
|
|
646
656
|
onModalSwitch: function onModalSwitch() {
|
|
647
657
|
_this2.switchOpenModal('forgot', 'login');
|
|
@@ -651,34 +661,40 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
651
661
|
},
|
|
652
662
|
onFormSend: /*#__PURE__*/function () {
|
|
653
663
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref8) {
|
|
654
|
-
var email;
|
|
664
|
+
var email, payload;
|
|
655
665
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
656
666
|
while (1) switch (_context5.prev = _context5.next) {
|
|
657
667
|
case 0:
|
|
658
668
|
email = _ref8.email;
|
|
659
669
|
_this2.clearPopupError();
|
|
660
670
|
_this2.setIsActionLoading('forgot');
|
|
661
|
-
|
|
662
|
-
_context5.next = 6;
|
|
663
|
-
return (0, _auth.default)('forgotPass', {
|
|
671
|
+
payload = {
|
|
664
672
|
email: email
|
|
665
|
-
}
|
|
666
|
-
|
|
673
|
+
};
|
|
674
|
+
if (isResettingExpiredToken) {
|
|
675
|
+
console.log('isResettingExpiredToken: ', isResettingExpiredToken);
|
|
676
|
+
payload.ventureInvite = true;
|
|
677
|
+
}
|
|
678
|
+
console.log('payload obj: ', payload);
|
|
679
|
+
_context5.prev = 6;
|
|
680
|
+
_context5.next = 9;
|
|
681
|
+
return (0, _auth.default)('forgotPass', payload);
|
|
682
|
+
case 9:
|
|
667
683
|
_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
684
|
_this2.setIsActionLoading(undefined);
|
|
669
|
-
_context5.next =
|
|
685
|
+
_context5.next = 18;
|
|
670
686
|
break;
|
|
671
|
-
case
|
|
672
|
-
_context5.prev =
|
|
673
|
-
_context5.t0 = _context5["catch"](
|
|
687
|
+
case 13:
|
|
688
|
+
_context5.prev = 13;
|
|
689
|
+
_context5.t0 = _context5["catch"](6);
|
|
674
690
|
console.log(_context5.t0);
|
|
675
691
|
_this2.setPopupError('forgot', 'This email is not registered.');
|
|
676
692
|
_this2.setIsActionLoading(undefined);
|
|
677
|
-
case
|
|
693
|
+
case 18:
|
|
678
694
|
case "end":
|
|
679
695
|
return _context5.stop();
|
|
680
696
|
}
|
|
681
|
-
}, _callee5, null, [[
|
|
697
|
+
}, _callee5, null, [[6, 13]]);
|
|
682
698
|
}));
|
|
683
699
|
return function (_x4) {
|
|
684
700
|
return _ref9.apply(this, arguments);
|
|
@@ -689,6 +705,11 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
689
705
|
popupError: this.state.popupError,
|
|
690
706
|
isModalOpen: isModalOpen.resetPassword,
|
|
691
707
|
onModalClose: function onModalClose() {
|
|
708
|
+
// clean up URL params
|
|
709
|
+
var url = new URL(window.location);
|
|
710
|
+
url.searchParams.delete('oobCode');
|
|
711
|
+
url.searchParams.delete('mode');
|
|
712
|
+
window.history.replaceState({}, '', url.toString());
|
|
692
713
|
_this2.setOpenModalStatus('resetPassword', false);
|
|
693
714
|
_this2.clearPopupError();
|
|
694
715
|
_this2.setIsActionLoading(undefined);
|
|
@@ -731,7 +752,60 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
731
752
|
return function (_x5) {
|
|
732
753
|
return _ref11.apply(this, arguments);
|
|
733
754
|
};
|
|
734
|
-
}()
|
|
755
|
+
}(),
|
|
756
|
+
onLoad: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
757
|
+
var location, query, oobCode, url;
|
|
758
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
759
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
760
|
+
case 0:
|
|
761
|
+
location = _this2.props.location;
|
|
762
|
+
query = new URLSearchParams(location === null || location === void 0 ? void 0 : location.search);
|
|
763
|
+
oobCode = query.get('oobCode');
|
|
764
|
+
if (!(oobCode && oobCode !== '')) {
|
|
765
|
+
_context7.next = 16;
|
|
766
|
+
break;
|
|
767
|
+
}
|
|
768
|
+
_this2.setIsActionLoading('resetPassword');
|
|
769
|
+
_context7.prev = 5;
|
|
770
|
+
_context7.next = 8;
|
|
771
|
+
return (0, _auth2.checkActionCode)(_firebaseConfig.auth, oobCode);
|
|
772
|
+
case 8:
|
|
773
|
+
_this2.setIsActionLoading(undefined);
|
|
774
|
+
_context7.next = 15;
|
|
775
|
+
break;
|
|
776
|
+
case 11:
|
|
777
|
+
_context7.prev = 11;
|
|
778
|
+
_context7.t0 = _context7["catch"](5);
|
|
779
|
+
console.log('Password reset code error:', _context7.t0);
|
|
780
|
+
if ((_context7.t0 === null || _context7.t0 === void 0 ? void 0 : _context7.t0.code) === 'auth/expired-action-code') {
|
|
781
|
+
_this2.setState(function (prevState) {
|
|
782
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
783
|
+
isResettingExpiredToken: true
|
|
784
|
+
});
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
// before switching to Forgot Password modal, we need to clean up
|
|
788
|
+
// the URL parameters that keep the reset password modal open.
|
|
789
|
+
url = new URL(window.location);
|
|
790
|
+
url.searchParams.delete('oobCode');
|
|
791
|
+
url.searchParams.delete('mode');
|
|
792
|
+
window.history.replaceState({}, '', url.toString());
|
|
793
|
+
|
|
794
|
+
// we use a special version of Forgot Password modal
|
|
795
|
+
// adjusted to handle and resend expired tokens.
|
|
796
|
+
// isResettingExpiredToken makes it adjust.
|
|
797
|
+
_this2.switchOpenModal('resetPassword', 'forgot');
|
|
798
|
+
} else {
|
|
799
|
+
_this2.setPopupError('resetPassword', 'Something went wrong with the password reset link. Please try again.');
|
|
800
|
+
}
|
|
801
|
+
case 15:
|
|
802
|
+
_this2.setIsActionLoading(undefined);
|
|
803
|
+
case 16:
|
|
804
|
+
case "end":
|
|
805
|
+
return _context7.stop();
|
|
806
|
+
}
|
|
807
|
+
}, _callee7, null, [[5, 11]]);
|
|
808
|
+
}))
|
|
735
809
|
}), /*#__PURE__*/_react.default.createElement(_ResetConfirmModal.default, {
|
|
736
810
|
isModalOpen: isModalOpen.confirmReset,
|
|
737
811
|
onModalClose: function onModalClose() {
|
|
@@ -768,37 +842,37 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
768
842
|
_this2.setIsActionLoading(undefined);
|
|
769
843
|
},
|
|
770
844
|
onResend: /*#__PURE__*/function () {
|
|
771
|
-
var
|
|
845
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(values) {
|
|
772
846
|
var email;
|
|
773
|
-
return _regeneratorRuntime().wrap(function
|
|
774
|
-
while (1) switch (
|
|
847
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
848
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
775
849
|
case 0:
|
|
776
850
|
_this2.clearPopupSuccess();
|
|
777
851
|
_this2.clearPopupError();
|
|
778
852
|
_this2.setIsActionLoading('resend');
|
|
779
|
-
|
|
853
|
+
_context8.prev = 3;
|
|
780
854
|
email = values === null || values === void 0 ? void 0 : values.email;
|
|
781
|
-
|
|
855
|
+
_context8.next = 7;
|
|
782
856
|
return resendActivationEmail(email);
|
|
783
857
|
case 7:
|
|
784
858
|
_this2.setPopupSuccess('resend', 'Email sent.');
|
|
785
859
|
_this2.setIsActionLoading(undefined);
|
|
786
|
-
|
|
860
|
+
_context8.next = 16;
|
|
787
861
|
break;
|
|
788
862
|
case 11:
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
console.log(
|
|
792
|
-
_this2.setPopupError('resend', (
|
|
863
|
+
_context8.prev = 11;
|
|
864
|
+
_context8.t0 = _context8["catch"](3);
|
|
865
|
+
console.log(_context8.t0);
|
|
866
|
+
_this2.setPopupError('resend', (_context8.t0 === null || _context8.t0 === void 0 ? void 0 : _context8.t0.message) || 'Something went wrong.');
|
|
793
867
|
_this2.setIsActionLoading(undefined);
|
|
794
868
|
case 16:
|
|
795
869
|
case "end":
|
|
796
|
-
return
|
|
870
|
+
return _context8.stop();
|
|
797
871
|
}
|
|
798
|
-
},
|
|
872
|
+
}, _callee8, null, [[3, 11]]);
|
|
799
873
|
}));
|
|
800
874
|
return function (_x6) {
|
|
801
|
-
return
|
|
875
|
+
return _ref13.apply(this, arguments);
|
|
802
876
|
};
|
|
803
877
|
}()
|
|
804
878
|
}));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.walletTypes = exports.platformURL = exports.platformDomain = exports.UserTypes = exports.ProjectTypes = exports.ProjectStatus = exports.ProjectStates = void 0;
|
|
6
|
+
exports.walletTypes = exports.platformURL = exports.platformDomain = exports.emailRegex = exports.UserTypes = exports.ProjectTypes = exports.ProjectStatus = exports.ProjectStates = void 0;
|
|
7
7
|
var platformDomain = process.env.REACT_APP_WEBSITE_DOMAIN;
|
|
8
8
|
exports.platformDomain = platformDomain;
|
|
9
9
|
var platformURL = 'https://' + platformDomain;
|
|
@@ -37,4 +37,8 @@ var UserTypes = {
|
|
|
37
37
|
investor: 'investor',
|
|
38
38
|
investor_entity: 'investor_entity'
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
// should be used for all email form validation globally
|
|
42
|
+
exports.UserTypes = UserTypes;
|
|
43
|
+
var emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;
|
|
44
|
+
exports.emailRegex = emailRegex;
|