Skip to content

Commit

Permalink
🐛 Simple fix #2346
Browse files Browse the repository at this point in the history
  • Loading branch information
padms committed Aug 6, 2024
1 parent 91be52a commit a07f4a6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
18 changes: 18 additions & 0 deletions satellitesConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
},
}

Expand Down Expand Up @@ -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,
}
}
10 changes: 9 additions & 1 deletion web/languages.js
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)
5 changes: 3 additions & 2 deletions web/pageComponents/topicPages/Form/FriendlyCaptcha.jsx
Original file line number Diff line number Diff line change
@@ -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(() => {
Expand Down

0 comments on commit a07f4a6

Please sign in to comment.