@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.
@@ -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
- exports.UserTypes = UserTypes;
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;
@@ -761,55 +761,19 @@ var AuthProviderClass = /*#__PURE__*/function (_Component) {
761
761
  return _ref14.apply(this, arguments);
762
762
  };
763
763
  }());
764
- _defineProperty(_assertThisInitialized(_this), "checkActivationLinkExpired", /*#__PURE__*/function () {
765
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(actionCode) {
766
- var actionCodeInfo;
767
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
768
- while (1) switch (_context15.prev = _context15.next) {
769
- case 0:
770
- _context15.prev = 0;
771
- _context15.next = 3;
772
- return (0, _auth.checkActionCode)(_firebaseConfig.auth, actionCode);
773
- case 3:
774
- actionCodeInfo = _context15.sent;
775
- return _context15.abrupt("return", {
776
- expired: false,
777
- info: actionCodeInfo
778
- });
779
- case 7:
780
- _context15.prev = 7;
781
- _context15.t0 = _context15["catch"](0);
782
- if (!(_context15.t0.code === 'auth/expired-action-code' || _context15.t0.code === 'auth/invalid-action-code')) {
783
- _context15.next = 11;
784
- break;
785
- }
786
- return _context15.abrupt("return", {
787
- expired: true,
788
- error: _context15.t0
789
- });
790
- case 11:
791
- case "end":
792
- return _context15.stop();
793
- }
794
- }, _callee15, null, [[0, 7]]);
795
- }));
796
- return function (_x18) {
797
- return _ref15.apply(this, arguments);
798
- };
799
- }());
800
- _defineProperty(_assertThisInitialized(_this), "handleVerifyEmail", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
764
+ _defineProperty(_assertThisInitialized(_this), "handleVerifyEmail", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
801
765
  var location, query, oobCode, customToken, email;
802
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
803
- while (1) switch (_context16.prev = _context16.next) {
766
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
767
+ while (1) switch (_context15.prev = _context15.next) {
804
768
  case 0:
805
769
  _this.setState({
806
770
  isVerifyingEmail: true
807
771
  });
808
772
  location = _this.props.location;
809
773
  query = new URLSearchParams(location.search);
810
- _context16.prev = 3;
774
+ _context15.prev = 3;
811
775
  oobCode = query.get('oobCode');
812
- _context16.next = 7;
776
+ _context15.next = 7;
813
777
  return _Auth.default.handleVerifyEmail(oobCode);
814
778
  case 7:
815
779
  _this.setState({
@@ -819,188 +783,188 @@ var AuthProviderClass = /*#__PURE__*/function (_Component) {
819
783
  if (customToken) {
820
784
  _this.loginUser(null, null, customToken);
821
785
  }
822
- _context16.next = 28;
786
+ _context15.next = 28;
823
787
  break;
824
788
  case 12:
825
- _context16.prev = 12;
826
- _context16.t0 = _context16["catch"](3);
827
- _context16.t1 = _context16.t0 === null || _context16.t0 === void 0 ? void 0 : _context16.t0.code;
828
- _context16.next = _context16.t1 === 'auth/expired-action-code' ? 17 : _context16.t1 === 'auth/invalid-action-code' ? 21 : _context16.t1 === 'auth/user-disabled' ? 23 : 25;
789
+ _context15.prev = 12;
790
+ _context15.t0 = _context15["catch"](3);
791
+ _context15.t1 = _context15.t0 === null || _context15.t0 === void 0 ? void 0 : _context15.t0.code;
792
+ _context15.next = _context15.t1 === 'auth/expired-action-code' ? 17 : _context15.t1 === 'auth/invalid-action-code' ? 21 : _context15.t1 === 'auth/user-disabled' ? 23 : 25;
829
793
  break;
830
794
  case 17:
831
- _context16.t0.message = 'The activation link has expired. We are sending you a new one right now.';
795
+ _context15.t0.message = 'The activation link has expired. We are sending you a new one right now.';
832
796
  email = query.get('email');
833
797
  if (email) {
834
- _context16.t0.email = email;
798
+ _context15.t0.email = email;
835
799
  //Auth.resendActivationEmail(email)
836
800
  }
837
- return _context16.abrupt("break", 26);
801
+ return _context15.abrupt("break", 26);
838
802
  case 21:
839
- _context16.t0.message = 'This link is invalid. Please try verifying email again.';
840
- return _context16.abrupt("break", 26);
803
+ _context15.t0.message = 'This link is invalid. Please try verifying email again.';
804
+ return _context15.abrupt("break", 26);
841
805
  case 23:
842
- _context16.t0.message = 'Your account has been disabled. Please contact our support.';
843
- return _context16.abrupt("break", 26);
806
+ _context15.t0.message = 'Your account has been disabled. Please contact our support.';
807
+ return _context15.abrupt("break", 26);
844
808
  case 25:
845
- return _context16.abrupt("break", 26);
809
+ return _context15.abrupt("break", 26);
846
810
  case 26:
847
- console.log('🚀 ~ file: AuthContext.js:446 ~ error:', _context16.t0);
811
+ console.log('🚀 ~ file: AuthContext.js:446 ~ error:', _context15.t0);
848
812
  _this.setState({
849
- verifyEmailError: _context16.t0,
813
+ verifyEmailError: _context15.t0,
850
814
  isVerifyingEmail: false,
851
815
  isFetchingUser: false
852
816
  });
853
817
  //throw error
854
818
  case 28:
855
819
  case "end":
856
- return _context16.stop();
820
+ return _context15.stop();
857
821
  }
858
- }, _callee16, null, [[3, 12]]);
822
+ }, _callee15, null, [[3, 12]]);
859
823
  })));
860
824
  _defineProperty(_assertThisInitialized(_this), "handleResetPassword", /*#__PURE__*/function () {
861
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(password) {
825
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(password) {
862
826
  var location, query, oobCode;
863
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
864
- while (1) switch (_context17.prev = _context17.next) {
827
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
828
+ while (1) switch (_context16.prev = _context16.next) {
865
829
  case 0:
866
830
  location = _this.props.location;
867
- _context17.prev = 1;
831
+ _context16.prev = 1;
868
832
  query = new URLSearchParams(location.search);
869
833
  oobCode = query.get('oobCode');
870
- _context17.next = 6;
834
+ _context16.next = 6;
871
835
  return _Auth.default.handleResetPassword(oobCode, password);
872
836
  case 6:
873
- _context17.next = 21;
837
+ _context16.next = 21;
874
838
  break;
875
839
  case 8:
876
- _context17.prev = 8;
877
- _context17.t0 = _context17["catch"](1);
878
- _context17.t1 = _context17.t0 === null || _context17.t0 === void 0 ? void 0 : _context17.t0.code;
879
- _context17.next = _context17.t1 === 'auth/expired-action-code' ? 13 : _context17.t1 === 'auth/invalid-action-code' ? 15 : _context17.t1 === 'auth/user-disabled' ? 17 : 19;
840
+ _context16.prev = 8;
841
+ _context16.t0 = _context16["catch"](1);
842
+ _context16.t1 = _context16.t0 === null || _context16.t0 === void 0 ? void 0 : _context16.t0.code;
843
+ _context16.next = _context16.t1 === 'auth/expired-action-code' ? 13 : _context16.t1 === 'auth/invalid-action-code' ? 15 : _context16.t1 === 'auth/user-disabled' ? 17 : 19;
880
844
  break;
881
845
  case 13:
882
- _context17.t0.message = 'This link has expired. Please try reseting password again.';
883
- return _context17.abrupt("break", 20);
846
+ _context16.t0.message = 'This link has expired. Please try reseting password again.';
847
+ return _context16.abrupt("break", 20);
884
848
  case 15:
885
- _context17.t0.message = 'This link is invalid. Please try reseting password again.';
886
- return _context17.abrupt("break", 20);
849
+ _context16.t0.message = 'This link is invalid. Please try reseting password again.';
850
+ return _context16.abrupt("break", 20);
887
851
  case 17:
888
- _context17.t0.message = 'Your account has been disabled. Please contact our support.';
889
- return _context17.abrupt("break", 20);
852
+ _context16.t0.message = 'Your account has been disabled. Please contact our support.';
853
+ return _context16.abrupt("break", 20);
890
854
  case 19:
891
- return _context17.abrupt("break", 20);
855
+ return _context16.abrupt("break", 20);
892
856
  case 20:
893
- throw _context17.t0;
857
+ throw _context16.t0;
894
858
  case 21:
895
859
  case "end":
896
- return _context17.stop();
860
+ return _context16.stop();
897
861
  }
898
- }, _callee17, null, [[1, 8]]);
862
+ }, _callee16, null, [[1, 8]]);
899
863
  }));
900
- return function (_x19) {
901
- return _ref17.apply(this, arguments);
864
+ return function (_x18) {
865
+ return _ref16.apply(this, arguments);
902
866
  };
903
867
  }());
904
- _defineProperty(_assertThisInitialized(_this), "sendWelcomeEmail", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
905
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
906
- while (1) switch (_context18.prev = _context18.next) {
868
+ _defineProperty(_assertThisInitialized(_this), "sendWelcomeEmail", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
869
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
870
+ while (1) switch (_context17.prev = _context17.next) {
907
871
  case 0:
908
- _context18.prev = 0;
909
- _context18.next = 3;
872
+ _context17.prev = 0;
873
+ _context17.next = 3;
910
874
  return _Auth.default.sendWelcomeEmail();
911
875
  case 3:
912
- _context18.next = 8;
876
+ _context17.next = 8;
913
877
  break;
914
878
  case 5:
915
- _context18.prev = 5;
916
- _context18.t0 = _context18["catch"](0);
917
- console.log("Error sending welcome email: ".concat(_context18.t0));
879
+ _context17.prev = 5;
880
+ _context17.t0 = _context17["catch"](0);
881
+ console.log("Error sending welcome email: ".concat(_context17.t0));
918
882
  // No need to throw error, let the app continue even if it fails
919
883
  case 8:
920
884
  case "end":
921
- return _context18.stop();
885
+ return _context17.stop();
922
886
  }
923
- }, _callee18, null, [[0, 5]]);
887
+ }, _callee17, null, [[0, 5]]);
924
888
  })));
925
889
  _defineProperty(_assertThisInitialized(_this), "uploaProofOfAddress", /*#__PURE__*/function () {
926
- var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data, ip) {
890
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(data, ip) {
927
891
  var user;
928
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
929
- while (1) switch (_context19.prev = _context19.next) {
892
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
893
+ while (1) switch (_context18.prev = _context18.next) {
930
894
  case 0:
931
- _context19.prev = 0;
932
- _context19.next = 3;
895
+ _context18.prev = 0;
896
+ _context18.next = 3;
933
897
  return _Auth.default.uploaProofOfAddress(data, ip);
934
898
  case 3:
935
- user = _context19.sent;
899
+ user = _context18.sent;
936
900
  _this.setUser(user);
937
- _context19.next = 11;
901
+ _context18.next = 11;
938
902
  break;
939
903
  case 7:
940
- _context19.prev = 7;
941
- _context19.t0 = _context19["catch"](0);
942
- console.log("Error uploading proof of address: ".concat(_context19.t0));
943
- throw _context19.t0;
904
+ _context18.prev = 7;
905
+ _context18.t0 = _context18["catch"](0);
906
+ console.log("Error uploading proof of address: ".concat(_context18.t0));
907
+ throw _context18.t0;
944
908
  case 11:
945
909
  case "end":
946
- return _context19.stop();
910
+ return _context18.stop();
947
911
  }
948
- }, _callee19, null, [[0, 7]]);
912
+ }, _callee18, null, [[0, 7]]);
949
913
  }));
950
- return function (_x20, _x21) {
951
- return _ref19.apply(this, arguments);
914
+ return function (_x19, _x20) {
915
+ return _ref18.apply(this, arguments);
952
916
  };
953
917
  }());
954
918
  _defineProperty(_assertThisInitialized(_this), "validateGreenWalletId", /*#__PURE__*/function () {
955
- var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(id) {
956
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
957
- while (1) switch (_context20.prev = _context20.next) {
919
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(id) {
920
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
921
+ while (1) switch (_context19.prev = _context19.next) {
958
922
  case 0:
959
- _context20.prev = 0;
960
- _context20.next = 3;
923
+ _context19.prev = 0;
924
+ _context19.next = 3;
961
925
  return _Auth.default.validateGreenWalletId(id);
962
926
  case 3:
963
- return _context20.abrupt("return", _context20.sent);
927
+ return _context19.abrupt("return", _context19.sent);
964
928
  case 6:
965
- _context20.prev = 6;
966
- _context20.t0 = _context20["catch"](0);
967
- console.log("Error validating Green Wallet ID: ".concat(_context20.t0));
968
- throw _context20.t0;
929
+ _context19.prev = 6;
930
+ _context19.t0 = _context19["catch"](0);
931
+ console.log("Error validating Green Wallet ID: ".concat(_context19.t0));
932
+ throw _context19.t0;
969
933
  case 10:
970
934
  case "end":
971
- return _context20.stop();
935
+ return _context19.stop();
972
936
  }
973
- }, _callee20, null, [[0, 6]]);
937
+ }, _callee19, null, [[0, 6]]);
974
938
  }));
975
- return function (_x22) {
976
- return _ref20.apply(this, arguments);
939
+ return function (_x21) {
940
+ return _ref19.apply(this, arguments);
977
941
  };
978
942
  }());
979
943
  _defineProperty(_assertThisInitialized(_this), "createWallet", /*#__PURE__*/function () {
980
- var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(data) {
944
+ var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(data) {
981
945
  var wallet;
982
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
983
- while (1) switch (_context21.prev = _context21.next) {
946
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
947
+ while (1) switch (_context20.prev = _context20.next) {
984
948
  case 0:
985
- _context21.prev = 0;
986
- _context21.next = 3;
949
+ _context20.prev = 0;
950
+ _context20.next = 3;
987
951
  return _Auth.default.createWallet(data);
988
952
  case 3:
989
- wallet = _context21.sent;
990
- return _context21.abrupt("return", wallet);
953
+ wallet = _context20.sent;
954
+ return _context20.abrupt("return", wallet);
991
955
  case 7:
992
- _context21.prev = 7;
993
- _context21.t0 = _context21["catch"](0);
994
- console.log("Error creating wallet: ".concat(_context21.t0));
995
- throw _context21.t0;
956
+ _context20.prev = 7;
957
+ _context20.t0 = _context20["catch"](0);
958
+ console.log("Error creating wallet: ".concat(_context20.t0));
959
+ throw _context20.t0;
996
960
  case 11:
997
961
  case "end":
998
- return _context21.stop();
962
+ return _context20.stop();
999
963
  }
1000
- }, _callee21, null, [[0, 7]]);
964
+ }, _callee20, null, [[0, 7]]);
1001
965
  }));
1002
- return function (_x23) {
1003
- return _ref21.apply(this, arguments);
966
+ return function (_x22) {
967
+ return _ref20.apply(this, arguments);
1004
968
  };
1005
969
  }());
1006
970
  _defineProperty(_assertThisInitialized(_this), "setUser", function (user) {
@@ -1012,12 +976,12 @@ var AuthProviderClass = /*#__PURE__*/function (_Component) {
1012
976
  });
1013
977
  });
1014
978
  _defineProperty(_assertThisInitialized(_this), "fetchLastTime", /*#__PURE__*/function () {
1015
- var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(projectName, page, userId) {
979
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(projectName, page, userId) {
1016
980
  var filterBody, response;
1017
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1018
- while (1) switch (_context22.prev = _context22.next) {
981
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
982
+ while (1) switch (_context21.prev = _context21.next) {
1019
983
  case 0:
1020
- _context22.prev = 0;
984
+ _context21.prev = 0;
1021
985
  filterBody = {
1022
986
  projectName: projectName,
1023
987
  page: page
@@ -1025,25 +989,25 @@ var AuthProviderClass = /*#__PURE__*/function (_Component) {
1025
989
  if (userId) {
1026
990
  filterBody.userId = userId;
1027
991
  }
1028
- _context22.next = 5;
992
+ _context21.next = 5;
1029
993
  return _Auth.default.fetchTrackingUserLastTime({
1030
994
  filter: filterBody
1031
995
  });
1032
996
  case 5:
1033
- response = _context22.sent;
1034
- return _context22.abrupt("return", response);
997
+ response = _context21.sent;
998
+ return _context21.abrupt("return", response);
1035
999
  case 9:
1036
- _context22.prev = 9;
1037
- _context22.t0 = _context22["catch"](0);
1038
- console.log(' error', _context22.t0);
1000
+ _context21.prev = 9;
1001
+ _context21.t0 = _context21["catch"](0);
1002
+ console.log(' error', _context21.t0);
1039
1003
  case 12:
1040
1004
  case "end":
1041
- return _context22.stop();
1005
+ return _context21.stop();
1042
1006
  }
1043
- }, _callee22, null, [[0, 9]]);
1007
+ }, _callee21, null, [[0, 9]]);
1044
1008
  }));
1045
- return function (_x24, _x25, _x26) {
1046
- return _ref22.apply(this, arguments);
1009
+ return function (_x23, _x24, _x25) {
1010
+ return _ref21.apply(this, arguments);
1047
1011
  };
1048
1012
  }());
1049
1013
  return _this;
@@ -1095,7 +1059,6 @@ var AuthProviderClass = /*#__PURE__*/function (_Component) {
1095
1059
  updateFirebaseUser: _Auth.default.updateFirebaseUser,
1096
1060
  handleResetPassword: this.handleResetPassword,
1097
1061
  handleVerifyEmail: this.handleVerifyEmail,
1098
- checkActivationLinkExpired: this.checkActivationLinkExpired,
1099
1062
  setUser: this.setUser,
1100
1063
  refreshIdToken: _Auth.default.refreshIdToken
1101
1064
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "2.3.41-beta.19",
3
+ "version": "2.3.41-beta.20",
4
4
  "description": "STOKR - Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",