@stokr/components-library 2.0.0-beta.4 → 2.0.0-beta.6

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.
@@ -32,7 +32,7 @@ exports.Dimmer = Dimmer;
32
32
  var Box = _styledComponents.default.div.withConfig({
33
33
  displayName: "Modalstyles__Box",
34
34
  componentId: "sc-9hc271-2"
35
- })(["display:inline-block;vertical-align:middle;position:relative;left:0;top:0;width:100%;background-color:", ";font-size:10px;text-align:left;box-shadow:0 2px 20px 0 rgba(0,0,0,0.1);", " ", " ", " ", " ", ""], _colors.default.white, function (props) {
35
+ })(["display:inline-block;vertical-align:middle;position:relative;left:0;top:0;width:100%;background-color:", ";font-size:10px;text-align:left;box-shadow:0 2px 20px 0 rgba(0,0,0,0.1);", " ", " ", " ", " @media screen and (max-width:767px){min-height:100vh;}@media screen and (max-width:490px){min-height:100vh;}", ""], _colors.default.white, function (props) {
36
36
  return props.fullscreen && "\n height: 90vh;\n ";
37
37
  }, function (props) {
38
38
  return props.kyc && "\n width: 100vw;\n height: 100vh;\n max-width: 1024px!important;\n max-height: 768px!important;\n ";
@@ -70,7 +70,10 @@ exports.ModalInnerWithBorder = ModalInnerWithBorder;
70
70
  var ModalInner = _styledComponents.default.div.withConfig({
71
71
  displayName: "Modalstyles__ModalInner",
72
72
  componentId: "sc-9hc271-5"
73
- })(["width:100%;height:100%;padding:40px ", ";display:flex;flex-direction:column;", " ", " ", " ", " ", " ", " ", " ", " ", ""], (0, _grid.default)(1), function (props) {
73
+ })(["width:100%;height:100%;padding:40px ", ";display:flex;flex-direction:column;@media screen and (max-width:767px){height:", ";}", " ", " ", " ", " ", " ", " ", " ", " ", ""], (0, _grid.default)(1), function (_ref2) {
74
+ var isMobile = _ref2.isMobile;
75
+ return isMobile && '100vh';
76
+ }, function (props) {
74
77
  return props.center && "\n text-align: center;\n ";
75
78
  }, function (props) {
76
79
  return props.background && "\n background-color: ".concat(_colors.default.grey, ";\n ");
@@ -35,7 +35,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
35
35
  var StyledPrivacyText = _styledComponents.default.div.withConfig({
36
36
  displayName: "TermsModal__StyledPrivacyText",
37
37
  componentId: "sc-1x5p4y6-0"
38
- })(["width:100%;p{color:", ";font-size:16px;line-height:1.5;font-weight:300;margin:0;padding-bottom:10px;font-style:normal;font-stretch:normal;letter-spacing:0.6px;}a{text-decoration:none;color:", ";font-weight:300;}}h4{font-size:17.2px !important;font-weight:700 !important;line-height:1.28571em;letter-spacing:normal;position:relative;margin-top:29px;margin-bottom:16px;}table{border-collapse:collapse;margin:32px 0;font-size:16px;tr{td:first-child{width:", ";text-align:center;}td:last-child{width:", ";}}td,th{border:1px solid #2e2e2e;padding:10px;li{margin-bottom:0;}}}ul{list-style-type:disclosure-closed;list-style:none;margin:0;padding:0;}li{padding:0 0 0 32px;color:", ";font-size:0.75rem;letter-spacing:normal;line-height:1.31rem;font-weight:200;margin-bottom:16px;position:relative;font-size:16px !important;font-weight:300;font-style:normal;font-stretch:normal;line-height:1.5 !important;letter-spacing:0.6px;a{word-break:break-all !important;}&:before{content:'';position:absolute;width:10px;height:10px;background:#0050ca;border-radius:100px;left:0;top:3px;margin-top:0.4rem;}}"], _theme.default.cBlack, _theme.default.cBlack, function (props) {
38
+ })(["&&{width:100%;p{color:", ";font-size:16px;line-height:1.5;font-weight:300;margin:0;padding-bottom:10px;font-style:normal;font-stretch:normal;letter-spacing:0.6px;}a{text-decoration:none;color:", ";font-weight:300;word-break:break-all !important;}h4{font-size:17.2px !important;font-weight:700 !important;line-height:1.28571em;letter-spacing:normal;position:relative;margin-top:29px;margin-bottom:16px;}table{border-collapse:collapse;margin:32px 0;font-size:16px;tr{td:first-child{width:", ";text-align:center;}td:last-child{width:", ";}}td,th{border:1px solid #2e2e2e;padding:10px;li{margin-bottom:0;}}}ul{list-style-type:disclosure-closed;list-style:none;margin:0;padding:0;}li{padding:0 0 0 32px;color:", ";font-size:0.75rem;letter-spacing:normal;line-height:1.31rem;font-weight:200;margin-bottom:16px;position:relative;font-size:16px !important;font-weight:300;font-style:normal;font-stretch:normal;line-height:1.5 !important;letter-spacing:0.6px;a{word-break:break-all !important;}&:before{content:'';position:absolute;width:10px;height:10px;background:#0050ca;border-radius:100px;left:0;top:3px;margin-top:0.4rem;}}}"], _theme.default.cBlack, _theme.default.cBlack, function (props) {
39
39
  return props.thirdParties ? '30%' : '40%';
40
40
  }, function (props) {
41
41
  return props.thirdParties ? '70%' : '60%';
@@ -274,7 +274,8 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
274
274
  waitingFor2fa = _this$context2.waitingFor2fa,
275
275
  firebaseError = _this$context2.firebaseError,
276
276
  loginUserWithTotp = _this$context2.loginUserWithTotp,
277
- createUser = _this$context2.createUser;
277
+ createUser = _this$context2.createUser,
278
+ handleResetPassword = _this$context2.handleResetPassword;
278
279
  return /*#__PURE__*/_react.default.createElement(Outer, {
279
280
  fixed: fixed
280
281
  }, /*#__PURE__*/_react.default.createElement(_Header.default, {
@@ -683,41 +684,35 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
683
684
  },
684
685
  onFormSend: /*#__PURE__*/function () {
685
686
  var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref10) {
686
- var password, isUsingQueryParam, token;
687
+ var password;
687
688
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
688
689
  while (1) switch (_context6.prev = _context6.next) {
689
690
  case 0:
690
691
  password = _ref10.password;
691
692
  _this2.clearPopupError();
692
693
  _this2.setIsActionLoading('resetPassword');
693
- isUsingQueryParam = window.location.href.includes('?token=');
694
- if (isUsingQueryParam) {
695
- token = window.location.href.split('reset-password?token=')[1].split('&')[0];
696
- } else {
697
- token = window.location.href.split('reset-password/')[1].split('/')[0];
698
- }
699
- _context6.prev = 5;
700
- _context6.next = 8;
701
- return (0, _auth.default)('resetPass', {
702
- password: password,
703
- token: token
704
- });
705
- case 8:
694
+
695
+ //https://stokr.info/manage-user?mode=resetPassword&oobCode=PT_AyRFYWXwDe0Ols12TOKSiGQUSdb6mM4DKDLwHGdQAAAGMgUUaEQ&apiKey=AIzaSyBBp_3Romnfv--YpUuV0mJgDymvSp3oq0c&continueUrl=https%3A%2F%2Fstokr.info&lang=en
696
+ //localhost:3001/manage-user?mode=resetPassword&oobCode=PT_AyRFYWXwDe0Ols12TOKSiGQUSdb6mM4DKDLwHGdQAAAGMgUUaEQ&apiKey=AIzaSyBBp_3Romnfv--YpUuV0mJgDymvSp3oq0c&continueUrl=https%3A%2F%2Fstokr.info&lang=en
697
+ _context6.prev = 3;
698
+ _context6.next = 6;
699
+ return handleResetPassword(password);
700
+ case 6:
706
701
  _this2.switchOpenModal('resetPassword', 'confirmReset');
707
702
  _this2.setIsActionLoading(undefined);
708
- _context6.next = 17;
703
+ _context6.next = 15;
709
704
  break;
710
- case 12:
711
- _context6.prev = 12;
712
- _context6.t0 = _context6["catch"](5);
705
+ case 10:
706
+ _context6.prev = 10;
707
+ _context6.t0 = _context6["catch"](3);
713
708
  console.log(_context6.t0);
714
- _this2.setPopupError('resetPassword', 'Something went wrong.');
709
+ _this2.setPopupError('resetPassword', (_context6.t0 === null || _context6.t0 === void 0 ? void 0 : _context6.t0.message) || 'Something went wrong.');
715
710
  _this2.setIsActionLoading(undefined);
716
- case 17:
711
+ case 15:
717
712
  case "end":
718
713
  return _context6.stop();
719
714
  }
720
- }, _callee6, null, [[5, 12]]);
715
+ }, _callee6, null, [[3, 10]]);
721
716
  }));
722
717
  return function (_x5) {
723
718
  return _ref11.apply(this, arguments);
@@ -100,6 +100,30 @@ var Auth = /*#__PURE__*/function () {
100
100
  });
101
101
  });
102
102
  }
103
+ }, {
104
+ key: "handleResetPassword",
105
+ value: function handleResetPassword(actionCode, newPassword, continueUrl) {
106
+ return new Promise(function (resolve, reject) {
107
+ // Verify the password reset code is valid.
108
+ (0, _auth.verifyPasswordResetCode)(_firebaseConfig.auth, actionCode).then(function (email) {
109
+ var accountEmail = email;
110
+ (0, _auth.confirmPasswordReset)(_firebaseConfig.auth, actionCode, newPassword).then(function (resp) {
111
+ // Password reset has been confirmed and new password updated.
112
+
113
+ _firebaseConfig.auth.signInWithEmailAndPassword(accountEmail, newPassword);
114
+ resolve(accountEmail);
115
+ }).catch(function (error) {
116
+ // Error occurred during confirmation. The code might have expired or the
117
+ // password is too weak.
118
+ reject(error);
119
+ });
120
+ }).catch(function (error) {
121
+ // Invalid or expired action code. Ask user to try to reset the password
122
+ // again.
123
+ reject(error);
124
+ });
125
+ });
126
+ }
103
127
  }, {
104
128
  key: "getUser",
105
129
  value: function getUser() {
@@ -517,7 +517,7 @@ var AuthProviderClass = /*#__PURE__*/function (_Component) {
517
517
  })));
518
518
  _defineProperty(_assertThisInitialized(_this), "replaceLocationPathName", function () {
519
519
  var pathname = _this.props.location.pathname;
520
- if (pathname === '/login' || pathname === '/signup' || pathname.includes('/reset-password')) {
520
+ if (pathname === '/login' || pathname === '/signup') {
521
521
  _this.props.navigate('/');
522
522
  }
523
523
  });
@@ -692,105 +692,152 @@ var AuthProviderClass = /*#__PURE__*/function (_Component) {
692
692
  return _ref13.apply(this, arguments);
693
693
  };
694
694
  }());
695
- _defineProperty(_assertThisInitialized(_this), "sendWelcomeEmail", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
696
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
697
- while (1) switch (_context14.prev = _context14.next) {
695
+ _defineProperty(_assertThisInitialized(_this), "handleResetPassword", /*#__PURE__*/function () {
696
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(password) {
697
+ var location, query, oobCode;
698
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
699
+ while (1) switch (_context14.prev = _context14.next) {
700
+ case 0:
701
+ location = _this.props.location;
702
+ _context14.prev = 1;
703
+ query = new URLSearchParams(location.search);
704
+ oobCode = query.get('oobCode');
705
+ _context14.next = 6;
706
+ return _Auth.default.handleResetPassword(oobCode, password);
707
+ case 6:
708
+ _context14.next = 21;
709
+ break;
710
+ case 8:
711
+ _context14.prev = 8;
712
+ _context14.t0 = _context14["catch"](1);
713
+ _context14.t1 = _context14.t0 === null || _context14.t0 === void 0 ? void 0 : _context14.t0.code;
714
+ _context14.next = _context14.t1 === 'auth/expired-action-code' ? 13 : _context14.t1 === 'auth/invalid-action-code' ? 15 : _context14.t1 === 'auth/user-disabled' ? 17 : 19;
715
+ break;
716
+ case 13:
717
+ _context14.t0.message = 'This link has expired. Please try reseting password again.';
718
+ return _context14.abrupt("break", 20);
719
+ case 15:
720
+ _context14.t0.message = 'This link is invalid. Please try reseting password again.';
721
+ return _context14.abrupt("break", 20);
722
+ case 17:
723
+ _context14.t0.message = 'Your account has been disabled. Please contact our support.';
724
+ return _context14.abrupt("break", 20);
725
+ case 19:
726
+ return _context14.abrupt("break", 20);
727
+ case 20:
728
+ throw _context14.t0;
729
+ case 21:
730
+ case "end":
731
+ return _context14.stop();
732
+ }
733
+ }, _callee14, null, [[1, 8]]);
734
+ }));
735
+ return function (_x16) {
736
+ return _ref14.apply(this, arguments);
737
+ };
738
+ }());
739
+ _defineProperty(_assertThisInitialized(_this), "sendWelcomeEmail", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
740
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
741
+ while (1) switch (_context15.prev = _context15.next) {
698
742
  case 0:
699
- _context14.prev = 0;
700
- _context14.next = 3;
743
+ _context15.prev = 0;
744
+ _context15.next = 3;
701
745
  return _Auth.default.sendWelcomeEmail();
702
746
  case 3:
703
- _context14.next = 8;
747
+ _context15.next = 8;
704
748
  break;
705
749
  case 5:
706
- _context14.prev = 5;
707
- _context14.t0 = _context14["catch"](0);
708
- console.log("Error sending welcome email: ".concat(_context14.t0));
750
+ _context15.prev = 5;
751
+ _context15.t0 = _context15["catch"](0);
752
+ console.log("Error sending welcome email: ".concat(_context15.t0));
709
753
  // No need to throw error, let the app continue even if it fails
710
754
  case 8:
711
755
  case "end":
712
- return _context14.stop();
756
+ return _context15.stop();
713
757
  }
714
- }, _callee14, null, [[0, 5]]);
758
+ }, _callee15, null, [[0, 5]]);
715
759
  })));
716
760
  _defineProperty(_assertThisInitialized(_this), "uploaProofOfAddress", /*#__PURE__*/function () {
717
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(data, ip) {
761
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(data, ip) {
718
762
  var user;
719
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
720
- while (1) switch (_context15.prev = _context15.next) {
763
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
764
+ while (1) switch (_context16.prev = _context16.next) {
721
765
  case 0:
722
- _context15.prev = 0;
723
- _context15.next = 3;
766
+ _context16.prev = 0;
767
+ _context16.next = 3;
724
768
  return _Auth.default.uploaProofOfAddress(data, ip);
725
769
  case 3:
726
- user = _context15.sent;
770
+ user = _context16.sent;
727
771
  _this.setUser(user);
728
- _context15.next = 11;
772
+ _context16.next = 11;
729
773
  break;
730
774
  case 7:
731
- _context15.prev = 7;
732
- _context15.t0 = _context15["catch"](0);
733
- console.log("Error uploading proof of address: ".concat(_context15.t0));
734
- throw _context15.t0;
735
- case 11:
736
- case "end":
737
- return _context15.stop();
738
- }
739
- }, _callee15, null, [[0, 7]]);
740
- }));
741
- return function (_x16, _x17) {
742
- return _ref15.apply(this, arguments);
743
- };
744
- }());
745
- _defineProperty(_assertThisInitialized(_this), "validateGreenWalletId", /*#__PURE__*/function () {
746
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(id) {
747
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
748
- while (1) switch (_context16.prev = _context16.next) {
749
- case 0:
750
- _context16.prev = 0;
751
- return _context16.abrupt("return", _Auth.default.validateGreenWalletId(id));
752
- case 4:
753
- _context16.prev = 4;
775
+ _context16.prev = 7;
754
776
  _context16.t0 = _context16["catch"](0);
755
- console.log("Error validating Green Wallet ID: ".concat(_context16.t0));
777
+ console.log("Error uploading proof of address: ".concat(_context16.t0));
756
778
  throw _context16.t0;
757
- case 8:
779
+ case 11:
758
780
  case "end":
759
781
  return _context16.stop();
760
782
  }
761
- }, _callee16, null, [[0, 4]]);
783
+ }, _callee16, null, [[0, 7]]);
762
784
  }));
763
- return function (_x18) {
785
+ return function (_x17, _x18) {
764
786
  return _ref16.apply(this, arguments);
765
787
  };
766
788
  }());
767
- _defineProperty(_assertThisInitialized(_this), "createWallet", /*#__PURE__*/function () {
768
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(data) {
769
- var wallet;
789
+ _defineProperty(_assertThisInitialized(_this), "validateGreenWalletId", /*#__PURE__*/function () {
790
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(id) {
770
791
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
771
792
  while (1) switch (_context17.prev = _context17.next) {
772
793
  case 0:
773
794
  _context17.prev = 0;
774
795
  _context17.next = 3;
775
- return _Auth.default.createWallet(data);
796
+ return _Auth.default.validateGreenWalletId(id);
776
797
  case 3:
777
- wallet = _context17.sent;
778
- return _context17.abrupt("return", wallet);
779
- case 7:
780
- _context17.prev = 7;
798
+ return _context17.abrupt("return", _context17.sent);
799
+ case 6:
800
+ _context17.prev = 6;
781
801
  _context17.t0 = _context17["catch"](0);
782
- console.log("Error creating wallet: ".concat(_context17.t0));
802
+ console.log("Error validating Green Wallet ID: ".concat(_context17.t0));
783
803
  throw _context17.t0;
784
- case 11:
804
+ case 10:
785
805
  case "end":
786
806
  return _context17.stop();
787
807
  }
788
- }, _callee17, null, [[0, 7]]);
808
+ }, _callee17, null, [[0, 6]]);
789
809
  }));
790
810
  return function (_x19) {
791
811
  return _ref17.apply(this, arguments);
792
812
  };
793
813
  }());
814
+ _defineProperty(_assertThisInitialized(_this), "createWallet", /*#__PURE__*/function () {
815
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(data) {
816
+ var wallet;
817
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
818
+ while (1) switch (_context18.prev = _context18.next) {
819
+ case 0:
820
+ _context18.prev = 0;
821
+ _context18.next = 3;
822
+ return _Auth.default.createWallet(data);
823
+ case 3:
824
+ wallet = _context18.sent;
825
+ return _context18.abrupt("return", wallet);
826
+ case 7:
827
+ _context18.prev = 7;
828
+ _context18.t0 = _context18["catch"](0);
829
+ console.log("Error creating wallet: ".concat(_context18.t0));
830
+ throw _context18.t0;
831
+ case 11:
832
+ case "end":
833
+ return _context18.stop();
834
+ }
835
+ }, _callee18, null, [[0, 7]]);
836
+ }));
837
+ return function (_x20) {
838
+ return _ref18.apply(this, arguments);
839
+ };
840
+ }());
794
841
  _defineProperty(_assertThisInitialized(_this), "setUser", function (user) {
795
842
  //there are a few cases where we need user object in event handlers (that don't have access to updated state)
796
843
  //that's why we store it in a ref
@@ -800,12 +847,12 @@ var AuthProviderClass = /*#__PURE__*/function (_Component) {
800
847
  });
801
848
  });
802
849
  _defineProperty(_assertThisInitialized(_this), "fetchLastTime", /*#__PURE__*/function () {
803
- var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(projectName, page, userId) {
850
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(projectName, page, userId) {
804
851
  var filterBody, response;
805
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
806
- while (1) switch (_context18.prev = _context18.next) {
852
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
853
+ while (1) switch (_context19.prev = _context19.next) {
807
854
  case 0:
808
- _context18.prev = 0;
855
+ _context19.prev = 0;
809
856
  filterBody = {
810
857
  projectName: projectName,
811
858
  page: page
@@ -813,25 +860,25 @@ var AuthProviderClass = /*#__PURE__*/function (_Component) {
813
860
  if (userId) {
814
861
  filterBody.userId = userId;
815
862
  }
816
- _context18.next = 5;
863
+ _context19.next = 5;
817
864
  return _Auth.default.fetchTrackingUserLastTime({
818
865
  filter: filterBody
819
866
  });
820
867
  case 5:
821
- response = _context18.sent;
822
- return _context18.abrupt("return", response);
868
+ response = _context19.sent;
869
+ return _context19.abrupt("return", response);
823
870
  case 9:
824
- _context18.prev = 9;
825
- _context18.t0 = _context18["catch"](0);
826
- console.log(' error', _context18.t0);
871
+ _context19.prev = 9;
872
+ _context19.t0 = _context19["catch"](0);
873
+ console.log(' error', _context19.t0);
827
874
  case 12:
828
875
  case "end":
829
- return _context18.stop();
876
+ return _context19.stop();
830
877
  }
831
- }, _callee18, null, [[0, 9]]);
878
+ }, _callee19, null, [[0, 9]]);
832
879
  }));
833
- return function (_x20, _x21, _x22) {
834
- return _ref18.apply(this, arguments);
880
+ return function (_x21, _x22, _x23) {
881
+ return _ref19.apply(this, arguments);
835
882
  };
836
883
  }());
837
884
  return _this;
@@ -879,6 +926,7 @@ var AuthProviderClass = /*#__PURE__*/function (_Component) {
879
926
  updatePassword: _Auth.default.updateUserPassword,
880
927
  createUser: _Auth.default.createUser,
881
928
  updateFirebaseUser: _Auth.default.updateFirebaseUser,
929
+ handleResetPassword: this.handleResetPassword,
882
930
  setUser: this.setUser
883
931
  })
884
932
  }, children);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.6",
4
4
  "description": "STOKR - Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",