diff --git a/package.json b/package.json index b9b8724f9..bcaa8799c 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "redux-thunk": "^3.1.0", "singularitynet-platform-contracts": "^1.0.4", "slick-carousel": "^1.8.1", - "snet-sdk-web": "^4.0.4", + "snet-sdk-web": "^4.1.2", "utf8": "^3.0.0", "validate.js": "^0.13.1", "web3": "^4.11.1" diff --git a/src/Redux/actionCreators/ServiceDetailsActions.js b/src/Redux/actionCreators/ServiceDetailsActions.js index 748950453..fd8cbb3d4 100644 --- a/src/Redux/actionCreators/ServiceDetailsActions.js +++ b/src/Redux/actionCreators/ServiceDetailsActions.js @@ -88,7 +88,8 @@ export const fetchMeteringData = async (dispatch) => { const { email, token } = await dispatch(fetchAuthenticatedUser()); const usageData = await meteringAPI(token, orgId, serviceId, groupId, email); - return dispatch(fetchMeteringDataSuccess(usageData)); + dispatch(fetchMeteringDataSuccess(usageData)); + return usageData; }; export const getIsTrainingAvailable = (detailsTraining, isLoggedIn) => { diff --git a/src/Redux/actionCreators/UserActions.js b/src/Redux/actionCreators/UserActions.js index 78adcd81c..41cbdd3f6 100644 --- a/src/Redux/actionCreators/UserActions.js +++ b/src/Redux/actionCreators/UserActions.js @@ -569,21 +569,25 @@ export const registerWallet = (address, type) => async (dispatch) => { }; export const updateMetamaskWallet = () => async (dispatch, getState) => { - const sdk = await dispatch(sdkActions.getSdk()); - const address = await sdk.account.getAddress(); + try { + const sdk = await dispatch(sdkActions.getSdk()); + const address = await sdk.account.getAddress(); - if (getState().userReducer.wallet?.address === address) { - return address; - } + if (getState().userReducer.wallet?.address === address) { + return address; + } - const availableUserWallets = await dispatch(fetchAvailableUserWallets()); - const addressAlreadyRegistered = availableUserWallets.some( - (wallet) => wallet.address.toLowerCase() === address.toLowerCase() - ); + const availableUserWallets = await dispatch(fetchAvailableUserWallets()); + const addressAlreadyRegistered = availableUserWallets.some( + (wallet) => wallet.address.toLowerCase() === address.toLowerCase() + ); - if (!addressAlreadyRegistered) { - await dispatch(registerWallet(address, walletTypes.METAMASK)); + if (!addressAlreadyRegistered) { + await dispatch(registerWallet(address, walletTypes.METAMASK)); + } + dispatch(updateWallet({ type: walletTypes.METAMASK, address })); + return address; + } catch (err) { + throw new Error("Can't update metamask wallet"); } - dispatch(updateWallet({ type: walletTypes.METAMASK, address })); - return address; }; diff --git a/src/components/AiMarketplace/MainSection/Filter/index.js b/src/components/AiMarketplace/MainSection/Filter/index.js index 2b647da17..4ff8d79ba 100644 --- a/src/components/AiMarketplace/MainSection/Filter/index.js +++ b/src/components/AiMarketplace/MainSection/Filter/index.js @@ -21,7 +21,7 @@ const Filter = ({ listView, total_count, handleSearchChange, toggleView, current useEffect(() => { return () => dispatch(serviceActions.resetFilter({ pagination })); - }, []); + }, [dispatch]); const handleSearch = (event) => { setSearchKeyword(event.currentTarget.value); diff --git a/src/components/FeedbackFormModal/styles.css b/src/components/FeedbackFormModal/styles.css index fc8e5541a..0f1c14440 100644 --- a/src/components/FeedbackFormModal/styles.css +++ b/src/components/FeedbackFormModal/styles.css @@ -81,7 +81,7 @@ } .cancel-button { - border-color: var(--button-background) !important; + border-color: var(--button-background) !important; } /* FORM LAUNCHER */ @@ -91,7 +91,7 @@ position: fixed; bottom: 50px; right: 30px; - z-index: var(--modal-layout-z-index); + z-index: 1; } .feedback-form-launcher { diff --git a/src/components/Login/Signup/styles.js b/src/components/Login/Signup/styles.js index 37bd9fc8e..2f32a36e6 100644 --- a/src/components/Login/Signup/styles.js +++ b/src/components/Login/Signup/styles.js @@ -121,7 +121,7 @@ export const useStyles = (theme) => ({ marginTop: 10, display: "flex", "& button": { - padding: " 13px 60px 11px", + padding: "15px 60px", marginTop: 10, "&:first-of-type": { marginRight: 10 }, }, diff --git a/src/components/Onboarding/Authentication/styles.js b/src/components/Onboarding/Authentication/styles.js index 8166785bd..b8c7b70dd 100644 --- a/src/components/Onboarding/Authentication/styles.js +++ b/src/components/Onboarding/Authentication/styles.js @@ -45,7 +45,7 @@ export const useStyles = (theme) => ({ buttonsContainer: { marginTop: 40, "& button": { - padding: " 13px 60px 11px", + padding: "15px 60px", }, }, infoText: { diff --git a/src/components/Onboarding/index.js b/src/components/Onboarding/index.js index 64c838a83..5b70eb9d4 100644 --- a/src/components/Onboarding/index.js +++ b/src/components/Onboarding/index.js @@ -20,25 +20,25 @@ const Onboarding = ({ classes }) => { const [activeSection, setActiveSection] = useState(0); const progressText = [{ label: "Authentication" }, { label: "Terms of service" }]; - const initialChecks = () => { - if (!isEmailVerified) { - return; - } - if (activeSection === 0) { - setActiveSection(1); - } - if (isTermsAccepted) { - if (location?.state && location?.state?.sourcePath) { - navigate(location.state.sourcePath); + useEffect(() => { + const initialChecks = () => { + if (!isEmailVerified) { return; } - navigate(`/${Routes.AI_MARKETPLACE}`); - } - }; + if (activeSection === 0) { + setActiveSection(1); + } + if (isTermsAccepted) { + if (location?.state && location?.state?.sourcePath) { + navigate(location.state.sourcePath); + return; + } + navigate(`/${Routes.AI_MARKETPLACE}`); + } + }; - useEffect(() => { initialChecks(); - }, []); + }, [navigate, isEmailVerified, isTermsAccepted, activeSection, location.state]); const handleNextSection = () => { setActiveSection(activeSection + 1); diff --git a/src/components/ServiceDetails/AboutService/ServiceDemo/CompletedActions/styles.js b/src/components/ServiceDetails/AboutService/ServiceDemo/CompletedActions/styles.js index e6faf37e7..dddd0d0b0 100644 --- a/src/components/ServiceDetails/AboutService/ServiceDemo/CompletedActions/styles.js +++ b/src/components/ServiceDetails/AboutService/ServiceDemo/CompletedActions/styles.js @@ -5,7 +5,7 @@ export const useStyles = makeStyles((theme) => ({ marginTop: 10, textAlign: "center", "& button": { - padding: " 13px 60px 11px", + padding: "15px 60px", marginTop: 10, marginRight: "0 !important", }, diff --git a/src/components/ServiceDetails/AboutService/ServiceDemo/Purchase/ActiveSession/index.js b/src/components/ServiceDetails/AboutService/ServiceDemo/Purchase/ActiveSession/index.js index 310043e81..e5d6e8207 100644 --- a/src/components/ServiceDetails/AboutService/ServiceDemo/Purchase/ActiveSession/index.js +++ b/src/components/ServiceDetails/AboutService/ServiceDemo/Purchase/ActiveSession/index.js @@ -1,7 +1,6 @@ import React, { useState } from "react"; import { withStyles } from "@mui/styles"; import Tooltip from "@mui/material/Tooltip"; -import CircularProgress from "@mui/material/CircularProgress"; import AlertBox from "../../../../../common/AlertBox"; import StyledButton from "../../../../../common/StyledButton"; @@ -14,20 +13,12 @@ import { currentServiceDetails } from "../../../../../../Redux/reducers/ServiceD import { isUndefined } from "lodash"; import { updateMetamaskWallet } from "../../../../../../Redux/actionCreators/UserActions"; -const ActiveSession = ({ - classes, - isFreecallLoading, - freeCallsRemaining, - handleComplete, - freeCallsAllowed, - isServiceAvailable, -}) => { +const ActiveSession = ({ classes, freeCallsRemaining, handleComplete, freeCallsAllowed, isServiceAvailable }) => { const dispatch = useDispatch(); const { detailsTraining } = useSelector((state) => state.serviceDetailsReducer); const { org_id, service_id } = useSelector((state) => currentServiceDetails(state)); const { modelsList } = useSelector((state) => state.serviceTrainingReducer); const isLoggedIn = useSelector((state) => state.userReducer.login.isLoggedIn); - const [showTooltip, setShowTooltip] = useState(false); const progressValue = () => (freeCallsRemaining / freeCallsAllowed) * 100; @@ -49,7 +40,7 @@ const ActiveSession = ({ await dispatch(getTrainingModels(org_id, service_id, address)); }; - const isActionsDisabled = !isServiceAvailable || isFreecallLoading; + const isActionsDisabled = !isServiceAvailable; return (
Please select a payment method to continue
-This AI Model Traning requires a very small fee. Please select a payment method to continue
-//+
{message}