-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4c8dbc
commit 94e4d72
Showing
10 changed files
with
96 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# CONTACT FORM | ||
DATAJEGER_EMAIL_ADDRESS=datajegeren.staging@norge.no | ||
FDK_MAIL_SERVICE_ENDPOINT=mail-sender-service.staging.fellesdatakatalog.digdir.no/api/sendmail | ||
FDK_MAIL_SERVICE_API_KEY= | ||
FDK_BASE_URI=https://staging.fellesdatakatalog.digdir.no | ||
FDK_COMMUNITY_BASE_URI=https://community.staging.fellesdatakatalog.digdir.no | ||
FDK_REGISTRATION_BASE_URI=https://registrering.staging.fellesdatakatalog.digdir.no | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import _ from 'lodash'; | ||
import { SchemaType } from './schema'; | ||
|
||
const getEmailContent = (emailData: SchemaType) => ({ | ||
subject: 'Takk for din forespørsel til Datajegeren', | ||
body: `Når en av våre datajegere starter søket etter datasettet du ønsker tilgang på, får du en epost fra oss. I perioder med stor pågang kan det ta lenger tid før du hører fra oss igjen. | ||
Vi gjør vårt ytterste for å hjelpe deg, men vi kan ikke garantere vi finner dataene du ønsker. Vi har heller ikke kontroll på datakvaliteten på det forespurte datasettet. | ||
Under er kopi av forespørselen din. Dersom du har ytterligere informasjon å legge til, er det bare å svare på denne e-posten. | ||
Med vennlig hilsen | ||
Datafabrikken | ||
Hvilket datasett trenger du? | ||
${_.escape(emailData.dataset)} | ||
Vet du hvor datasettet befinner seg? | ||
${_.escape(emailData.location)} | ||
Har du forsøkt å få tak i dette datasettet selv? | ||
${_.escape(emailData.efforts)} | ||
Ditt navn | ||
${_.escape(emailData.name)} | ||
E-postadresse | ||
${_.escape(emailData.email)} | ||
Telefonnummer | ||
${_.escape(emailData.phoneNumber)} | ||
Organisasjonsnummer | ||
${_.escape(emailData.organizationNumber)} | ||
`, | ||
}); | ||
|
||
export const sendEmail = async (emailData: SchemaType) => { | ||
const { DATAJEGER_EMAIL_ADDRESS, FDK_MAIL_SERVICE_ENDPOINT, FDK_MAIL_SERVICE_API_KEY } = process.env; | ||
const emailContent = getEmailContent(emailData); | ||
const mail = { | ||
from: DATAJEGER_EMAIL_ADDRESS, | ||
to: emailData.email, | ||
bcc: DATAJEGER_EMAIL_ADDRESS, | ||
subject: emailContent.subject, | ||
body: emailContent.body, | ||
}; | ||
const fetchOptions = { | ||
headers: { | ||
'X-API-KEY': FDK_MAIL_SERVICE_API_KEY ?? '', | ||
}, | ||
method: 'POST', | ||
body: JSON.stringify(mail), | ||
}; | ||
|
||
try { | ||
if (!FDK_MAIL_SERVICE_ENDPOINT) { | ||
throw new Error('Missing FDK_MAIL_SERVICE_ENDPOINT'); | ||
} | ||
return await fetch(FDK_MAIL_SERVICE_ENDPOINT, fetchOptions); | ||
} catch (e) { | ||
return e; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
// Use this file to export React client components (e.g. those with 'use client' directive) or other non-server utilities | ||
export * from './lib/forms'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
} | ||
|
||
.logo * { | ||
width: auto; | ||
height: 45px; | ||
margin-left: 0.75rem; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters