Skip to content

Commit 9853217

Browse files
authored
Merge pull request #1064 from singnet/development
Development
2 parents 40d0066 + fde011d commit 9853217

File tree

8 files changed

+33
-7
lines changed

8 files changed

+33
-7
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"snet-sdk-web": "5.0.4",
5252
"utf8": "^3.0.0",
5353
"validate.js": "^0.13.1",
54+
"waf-captcha-frontend": "0.0.7",
5455
"web3": "^4.11.1"
5556
},
5657
"resolutions": {
@@ -126,4 +127,4 @@
126127
"ts-protoc-gen": "^0.15.0",
127128
"url": "^0.11.4"
128129
}
129-
}
130+
}

public/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"short_name": "SingularityNET AI Merketplace",
3-
"name": "SingularityNET AI Merketplace",
2+
"short_name": "SingularityNET AI Marketplace",
3+
"name": "SingularityNET AI Marketplace",
44
"icons": [
55
{
66
"src": "favicon.ico",

src/components/AiMarketplace/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import PromoComponent from "../PromoComponent";
66
import { Helmet } from "react-helmet";
77

88
const seoData = {
9-
title: "SingularityNET AI Merketplace",
9+
title: "SingularityNET AI Marketplace",
1010
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`,
1111
image: `${process.env.REACT_APP_SNET_CDN}/dapp/assets/images/SEO/singularitynet-marketplace.png`,
1212
twitterImage: `${process.env.REACT_APP_SNET_CDN}/dapp/assets/images/SEO/singularitynet-marketplace-twitter.png`,

src/components/FeedbackFormModal/FeedbackForm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ const FeedbackForm = ({ closeForm, sendFeedbackAPI }) => {
3838
} catch (error) {
3939
setAlert({ type: alertTypes.ERROR, message: error?.message });
4040
} finally {
41+
dispatch(loaderActions.stopAppLoader());
4142
await new Promise((resolve) => setTimeout(resolve, 3000));
4243
resetForm();
4344
setIsRequestHandling(false);
44-
dispatch(loaderActions.stopAppLoader());
4545
closeForm();
4646
}
4747
};

src/components/FeedbackFormModal/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const FeedbackForm = () => {
99

1010
return (
1111
<Fragment>
12+
<div id="captchaContainer" />
1213
<FeedbackFormModal
1314
sendFeedbackAPI={sendFeedbackSnetAPI}
1415
isModalVisible={isModalVisible}

src/components/GetStarted/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useStyles } from "./styles";
99
import SeoMetadata from "../common/SeoMetadata";
1010

1111
const seoData = {
12-
title: "SingularityNET AI Merketplace",
12+
title: "SingularityNET AI Marketplace",
1313
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`,
1414
image: `${process.env.REACT_APP_SNET_CDN}/dapp/assets/images/SEO/singularitynet-marketplace.png`,
1515
twitterImage: `${process.env.REACT_APP_SNET_CDN}/dapp/assets/images/SEO/singularitynet-marketplace-twitter.png`,

src/config/SupportAPI.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import axios from "axios";
2+
import { getCaptchaFetch } from "../utility/captchaFetch";
23

34
const source = "MARKETPLACE";
45

6+
const captchaFetch = getCaptchaFetch();
7+
58
export const sendFeedbackSnetAPI = async ({ name, email, category, feedback, attachmentUrls }) => {
69
const options = {
710
method: "POST",
@@ -26,7 +29,7 @@ export const sendFeedbackSnetAPI = async ({ name, email, category, feedback, att
2629
if (!feedbackUrl) {
2730
throw new Error("Cannot start the application! process.env.REACT_APP_FEEDBACK_ENDPOINT is undefined");
2831
}
29-
await fetch(feedbackUrl + "/user/message", options);
32+
await captchaFetch(feedbackUrl + "/user/message", options);
3033
};
3134

3235
const ENTER_CODE = "%0D%0A";

src/utility/captchaFetch.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { createCaptchaFetchHandler } from "waf-captcha-frontend";
2+
3+
export const getCaptchaFetch = () => {
4+
const keys = {
5+
JSAPI_URL: process.env.REACT_APP_JSAPI_URL,
6+
CAPTCHA_TOKEN: process.env.REACT_APP_CAPTCHA_TOKEN,
7+
};
8+
9+
if (!keys.CAPTCHA_TOKEN || !keys.JSAPI_URL) {
10+
console.warn("Captcha configuration is not provided");
11+
return fetch;
12+
}
13+
14+
const captchaFetch = createCaptchaFetchHandler({
15+
API_KEY: keys.CAPTCHA_TOKEN,
16+
JSAPI_URL: keys.JSAPI_URL,
17+
captchaContainerId: "captchaContainer",
18+
});
19+
20+
return captchaFetch;
21+
};

0 commit comments

Comments
 (0)