diff --git a/package.json b/package.json index 20b11ffe..e7287f70 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "snet-sdk-web": "5.0.4", "utf8": "^3.0.0", "validate.js": "^0.13.1", + "waf-captcha-frontend": "0.0.7", "web3": "^4.11.1" }, "resolutions": { @@ -126,4 +127,4 @@ "ts-protoc-gen": "^0.15.0", "url": "^0.11.4" } -} +} \ No newline at end of file diff --git a/public/manifest.json b/public/manifest.json index 6393f739..55f55d6b 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,6 +1,6 @@ { - "short_name": "SingularityNET AI Merketplace", - "name": "SingularityNET AI Merketplace", + "short_name": "SingularityNET AI Marketplace", + "name": "SingularityNET AI Marketplace", "icons": [ { "src": "favicon.ico", diff --git a/src/components/AiMarketplace/index.js b/src/components/AiMarketplace/index.js index 9ed7aa54..5dd28ba0 100644 --- a/src/components/AiMarketplace/index.js +++ b/src/components/AiMarketplace/index.js @@ -6,7 +6,7 @@ import PromoComponent from "../PromoComponent"; import { Helmet } from "react-helmet"; const seoData = { - title: "SingularityNET AI Merketplace", + title: "SingularityNET AI Marketplace", description: `The SingularityNET Marketplace hosts AI services. Services offer free calls to try before you use ${process.env.REACT_APP_TOKEN_NAME} or Paypal to purchase`, image: `${process.env.REACT_APP_SNET_CDN}/dapp/assets/images/SEO/singularitynet-marketplace.png`, twitterImage: `${process.env.REACT_APP_SNET_CDN}/dapp/assets/images/SEO/singularitynet-marketplace-twitter.png`, diff --git a/src/components/FeedbackFormModal/FeedbackForm.js b/src/components/FeedbackFormModal/FeedbackForm.js index 5eb2d87f..e29bf696 100644 --- a/src/components/FeedbackFormModal/FeedbackForm.js +++ b/src/components/FeedbackFormModal/FeedbackForm.js @@ -38,10 +38,10 @@ const FeedbackForm = ({ closeForm, sendFeedbackAPI }) => { } catch (error) { setAlert({ type: alertTypes.ERROR, message: error?.message }); } finally { + dispatch(loaderActions.stopAppLoader()); await new Promise((resolve) => setTimeout(resolve, 3000)); resetForm(); setIsRequestHandling(false); - dispatch(loaderActions.stopAppLoader()); closeForm(); } }; diff --git a/src/components/FeedbackFormModal/index.js b/src/components/FeedbackFormModal/index.js index af387a23..4eba8733 100644 --- a/src/components/FeedbackFormModal/index.js +++ b/src/components/FeedbackFormModal/index.js @@ -9,6 +9,7 @@ const FeedbackForm = () => { return ( +
{ const options = { method: "POST", @@ -26,7 +29,7 @@ export const sendFeedbackSnetAPI = async ({ name, email, category, feedback, att if (!feedbackUrl) { throw new Error("Cannot start the application! process.env.REACT_APP_FEEDBACK_ENDPOINT is undefined"); } - await fetch(feedbackUrl + "/user/message", options); + await captchaFetch(feedbackUrl + "/user/message", options); }; const ENTER_CODE = "%0D%0A"; diff --git a/src/utility/captchaFetch.js b/src/utility/captchaFetch.js new file mode 100644 index 00000000..623fa6d3 --- /dev/null +++ b/src/utility/captchaFetch.js @@ -0,0 +1,21 @@ +import { createCaptchaFetchHandler } from "waf-captcha-frontend"; + +export const getCaptchaFetch = () => { + const keys = { + JSAPI_URL: process.env.REACT_APP_JSAPI_URL, + CAPTCHA_TOKEN: process.env.REACT_APP_CAPTCHA_TOKEN, + }; + + if (!keys.CAPTCHA_TOKEN || !keys.JSAPI_URL) { + console.warn("Captcha configuration is not provided"); + return fetch; + } + + const captchaFetch = createCaptchaFetchHandler({ + API_KEY: keys.CAPTCHA_TOKEN, + JSAPI_URL: keys.JSAPI_URL, + captchaContainerId: "captchaContainer", + }); + + return captchaFetch; +};