From a07f4a627ef4f36c4809282bb7a53ab0f2ef5cb8 Mon Sep 17 00:00:00 2001 From: Padmaja <52911293+padms@users.noreply.github.com> Date: Tue, 6 Aug 2024 19:00:12 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Simple=20fix=20#2346?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- satellitesConfig.js | 18 ++++++++++++++++++ web/languages.js | 10 +++++++++- .../topicPages/Form/FriendlyCaptcha.jsx | 5 +++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/satellitesConfig.js b/satellitesConfig.js index b6dc08600..b53644455 100644 --- a/satellitesConfig.js +++ b/satellitesConfig.js @@ -95,6 +95,8 @@ const websiteDomains = { global: { url: 'https://www.equinor.com', meta: 'Equinor', + fc_sitekey: 'FCMLCFU23ASH8D84', + fc_puzzle_endpoint: 'https://eu-api.friendlycaptcha.eu/api/v1/puzzle', }, poland: { url: 'https://www.equinor.pl', @@ -103,6 +105,8 @@ const websiteDomains = { brazil: { url: 'https://www.equinor.com.br', meta: 'equinor.com.br', + fc_sitekey: 'FCMLCFU238ACUELS', + fc_puzzle_endpoint: 'https://api.friendlycaptcha.com/api/v1/puzzle', }, germany: { url: 'https://www.equinor.de', @@ -143,10 +147,14 @@ const websiteDomains = { 'global-development': { url: 'localhost:3000', meta: 'Equinor', + fc_sitekey: 'FCMLCFU23ASH8D84', + fc_puzzle_endpoint: 'https://eu-api.friendlycaptcha.eu/api/v1/puzzle', }, 'global-test': { url: 'https://web-global-test-equinor-web-sites-test.c2.radix.equinor.com', meta: 'Equinor', + fc_sitekey: 'FCMLCFU23ASH8D84', + fc_puzzle_endpoint: 'https://eu-api.friendlycaptcha.eu/api/v1/puzzle', }, } @@ -185,3 +193,13 @@ export const getDomain = (dataset) => websiteDomains[dataset]?.url || 'Domain no export const getMetaTitleSuffix = (dataset) => { return websiteDomains[dataset]?.meta || 'Equinor' } + +/** + * @param {string} dataset + */ +export const getFriendlyCaptchaConstants = (dataset) => { + return { + sitekey: websiteDomains[dataset]?.sitekey, + puzzleEndpoint: websiteDomains[dataset]?.puzzleEndpoint, + } +} diff --git a/web/languages.js b/web/languages.js index 44b40d38a..78a68498b 100644 --- a/web/languages.js +++ b/web/languages.js @@ -1,4 +1,10 @@ -import { defaultWebLanguage, getDomain, getLanguages, getMetaTitleSuffix } from '../satellitesConfig.js' +import { + defaultWebLanguage, + getDomain, + getFriendlyCaptchaConstants, + getLanguages, + getMetaTitleSuffix, +} from '../satellitesConfig.js' export const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET @@ -9,3 +15,5 @@ export const defaultLanguage = languages.find((lang) => lang.id === defaultWebLa export const domain = getDomain(dataset) export const metaTitleSuffix = getMetaTitleSuffix(dataset) + +export const friendlycaptcha = getFriendlyCaptchaConstants(dataset) diff --git a/web/pageComponents/topicPages/Form/FriendlyCaptcha.jsx b/web/pageComponents/topicPages/Form/FriendlyCaptcha.jsx index 2d5bdb5b5..46b699636 100644 --- a/web/pageComponents/topicPages/Form/FriendlyCaptcha.jsx +++ b/web/pageComponents/topicPages/Form/FriendlyCaptcha.jsx @@ -1,9 +1,10 @@ import { useEffect, useRef } from 'react' import { WidgetInstance } from 'friendly-challenge' +import { friendlycaptcha } from '../../../languages' const FriendlyCaptcha = ({ doneCallback, errorCallback }) => { - const sitekey = process.env.NEXT_PUBLIC_FRIENDLY_CAPTCHA_SITEKEY - const puzzleEndpoint = process.env.NEXT_PUBLIC_FRIENDLY_CAPTCHA_PUZZLE_ENDPOINT + const sitekey = friendlycaptcha.sitekey + const puzzleEndpoint = friendlycaptcha.puzzleEndpoint const container = useRef() const widget = useRef() useEffect(() => {