diff --git a/gatsby-config.ts b/gatsby-config.ts index 578ada37d..47b800d73 100644 --- a/gatsby-config.ts +++ b/gatsby-config.ts @@ -86,14 +86,6 @@ const config: GatsbyConfig = { path: `${__dirname}/src/content`, }, }, - { - resolve: 'gatsby-plugin-mailchimp', - options: { - endpoint: - 'https://gmail.us20.list-manage.com/subscribe/post?u=98bed213911ed14e04f519b82&id=9c27a4ee73', - timeout: 3500, //the amount of time, in milliseconds, that you want to allow mailchimp to respond to your request before timing out. defaults to 3500 - }, - }, { resolve: `gatsby-transformer-remark`, options: { diff --git a/package-lock.json b/package-lock.json index 4e6b624c4..b28423c72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,6 @@ "eslint-plugin-prettier": "^5.2.1", "gatsby": "^5.14.1", "gatsby-plugin-google-gtag": "^5.14.0", - "gatsby-plugin-mailchimp": "^5.2.2", "gatsby-plugin-manifest": "^5.14.0", "gatsby-plugin-material-ui": "^4.1.0", "gatsby-plugin-mdx": "^5.14.0", @@ -11065,15 +11064,6 @@ "integrity": "sha512-6maZ2ASDOTBtjt9FhqYPRnbvKU5tjG0IN9SztUOWYw2AzNDNpKJYLJmlK0/En4Hs/aiWnB+JZ+gW19PIGszgKg==", "dev": true }, - "node_modules/email-validator": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/email-validator/-/email-validator-2.0.4.tgz", - "integrity": "sha512-gYCwo7kh5S3IDyZPLZf6hSS0MnZT8QmJFqYvbqlDZSbwdZlY6QZWxJ4i/6UhITOJ4XzyI647Bm2MXKCLqnJ4nQ==", - "dev": true, - "engines": { - "node": ">4.0" - } - }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", @@ -13975,17 +13965,6 @@ "react-dom": "^18.0.0 || ^0.0.0" } }, - "node_modules/gatsby-plugin-mailchimp": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/gatsby-plugin-mailchimp/-/gatsby-plugin-mailchimp-5.2.2.tgz", - "integrity": "sha512-O9JizVPJAe5YT1QAHZNRh1xUVdPnfayfIRhsBULiK2629TQRvEzzQxTDbt/WZU02cVm8415Fx2CneaxYKLt0ag==", - "dev": true, - "license": "MIT", - "dependencies": { - "email-validator": "^2.0.4", - "jsonp": "^0.2.1" - } - }, "node_modules/gatsby-plugin-manifest": { "version": "5.14.0", "resolved": "https://registry.npmjs.org/gatsby-plugin-manifest/-/gatsby-plugin-manifest-5.14.0.tgz", @@ -17888,32 +17867,6 @@ "graceful-fs": "^4.1.6" } }, - "node_modules/jsonp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/jsonp/-/jsonp-0.2.1.tgz", - "integrity": "sha512-pfog5gdDxPdV4eP7Kg87M8/bHgshlZ5pybl+yKxAnCZ5O7lCIn7Ixydj03wOlnDQesky2BPyA91SQ+5Y/mNwzw==", - "dev": true, - "dependencies": { - "debug": "^2.1.3" - } - }, - "node_modules/jsonp/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/jsonp/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" - }, "node_modules/jsx-ast-utils": { "version": "3.3.5", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", diff --git a/package.json b/package.json index f3545820e..e068eb71f 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ "serve": "gatsby serve", "clean": "gatsby clean", "check-types": "tsc -p . --noEmit", - "lint": "eslint \"{src/**,.}/*.{js,ts,tsx,mdx}\" --max-warnings 0 --fix", - "lint-check": "eslint \"{src/**,.}/*.{js,ts,tsx,mdx}\" --max-warnings 0", + "lint": "eslint \"src/**/*.{js,ts,tsx,mdx}\" --max-warnings 0 --fix", + "lint-check": "eslint \"src/**/*.{js,ts,tsx,mdx}\" --max-warnings 0", "prepare": "husky" }, "dependencies": { @@ -51,7 +51,6 @@ "eslint-plugin-prettier": "^5.2.1", "gatsby": "^5.14.1", "gatsby-plugin-google-gtag": "^5.14.0", - "gatsby-plugin-mailchimp": "^5.2.2", "gatsby-plugin-manifest": "^5.14.0", "gatsby-plugin-material-ui": "^4.1.0", "gatsby-plugin-mdx": "^5.14.0", @@ -68,7 +67,7 @@ "typescript-eslint": "^8.19.1" }, "lint-staged": { - "*.{js,ts,tsx,mdx}": [ + "src/**/*.{js,ts,tsx,mdx}": [ "npx eslint --fix" ] } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 6b18562cc..534491df4 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -20,7 +20,7 @@ import type { HeadProps } from 'gatsby'; import { Layout, SEO } from '../components'; import type { DataProps } from '../hooks'; -import { About, Blog, Landing, Libraries, News, Newsletter } from '../sections'; +import { About, Blog, Landing, Libraries, News } from '../sections'; import { PAGE } from '../helper'; import { footerContent, headerContent } from '../content'; import { Testimonials } from '../sections/home/Testimonials'; @@ -33,7 +33,6 @@ const HomePage = (): JSX.Element => ( - ); export default HomePage; diff --git a/src/sections/home/Newsletter.tsx b/src/sections/home/Newsletter.tsx deleted file mode 100644 index 36aaeddd5..000000000 --- a/src/sections/home/Newsletter.tsx +++ /dev/null @@ -1,236 +0,0 @@ -/** - * Copyright 2023 Bonitasoft S.A. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -========================================================= -* Material Kit 2 React - v2.1.0 -========================================================= - -* Product Page: https://www.creative-tim.com/product/material-kit-react -* Copyright 2023 Creative Tim (https://www.creative-tim.com) - -Coded by www.creative-tim.com - - ========================================================= - -* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -*/ - -import type { BaseSyntheticEvent, FC } from 'react'; -import React, { useState } from 'react'; - -import { - Box, - Button, - Container, - FormHelperText, - Grid, - InputAdornment, - TextField, -} from '@mui/material'; -import { CheckCircle, ErrorOutline } from '@mui/icons-material'; -import addToMailchimp from 'gatsby-plugin-mailchimp'; - -import { useMobileViewStatus } from '../../hooks'; -import { borders, boxShadows } from '../../assets/theme'; -import { MKBox, MKTypography, Section } from '../../components'; - -import logo from '../../assets/images/logo.svg'; - -type FormProps = { - onSubmit: (submitted: boolean, responseMsg: string) => void; - responseMsg: string; -}; - -type ResponseContainerProps = { - msg: string; -}; - -export const Newsletter: FC = () => { - const [submitted, setSubmitted] = useState(false); - const [responseMsg, setResponseMsg] = useState(''); - - return ( -
- - - - - Be the first to see the news - - - Join our low-traffic newsletter and get news in your inbox! - - {submitted ? ( - - ) : ( -
{ - setSubmitted(submitted); - setResponseMsg(responseMsg); - }} - responseMsg={responseMsg} - /> - )} - - - - - - -
- ); -}; - -const Form: FC = props => { - const isMobileView = useMobileViewStatus(); - const [error, setError] = useState(false); - const [email, setEmail] = useState(''); - - const isEmailValid = (email: string): boolean => { - const pattern = - /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i; - return pattern.test(email); - }; - const handleSubmit: React.FormEventHandler = ( - event: BaseSyntheticEvent, - ) => { - event.preventDefault(); - - setError(false); - props.onSubmit(false, ''); - - if (!isEmailValid(email)) { - setError(true); - props.onSubmit(false, 'Incorrect entry.'); - return; - } - - addToMailchimp(email) - .then(response => { - const isError = response.result === 'error'; - setError(isError); - props.onSubmit(!isError, response.msg); - }) - .catch(error => { - // Handle any errors that occur during the Promise execution. - console.error(error); - }); - }; - - const formHelperText = ( - <> - - {props.responseMsg} - - - ); - return ( - - - - - - - ) : undefined, - }} - required - onChange={event => setEmail(event.target.value)} - /> - {error && isMobileView && formHelperText} - - - - - - {error && !isMobileView && ( - - {formHelperText} - - )} - - ); -}; - -const ResponseContainer: FC = props => ( - - - {props.msg} - {'\u00A0'} {/* Non-breaking space */} - - - -); diff --git a/src/sections/home/index.ts b/src/sections/home/index.ts index 2a1dce762..3ee7e9fcc 100644 --- a/src/sections/home/index.ts +++ b/src/sections/home/index.ts @@ -18,4 +18,3 @@ export { Blog } from './Blog'; export { Landing } from './Landing'; export { Libraries } from './Libraries'; export { News } from './News'; -export { Newsletter } from './Newsletter'; diff --git a/src/types/gatsby-plugin-mailchimp.d.ts b/src/types/gatsby-plugin-mailchimp.d.ts deleted file mode 100644 index c48d06694..000000000 --- a/src/types/gatsby-plugin-mailchimp.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2021 Bonitasoft S.A. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -declare module 'gatsby-plugin-mailchimp' { - type MailchimpResult = 'success' | 'error'; - - export interface MailchimpResponse { - result: MailchimpResult; - msg: string; - } - - export type MailchimpFields = Record; - - // This function is made available by the plugin gatsby-plugin-mailchimp at runtime - /*email: String – required; the email address you want to subscribe - fields: Object – optional; add'l info (columns) you want included w/ this subscriber - endpointOverride: String – optional; if you want to override the default MC mailing list that's listed in your gatsby-config, pass the list in here*/ - function addToMailchimp( - email: string, - listFields?: MailchimpFields, - endpointOverride?: string, - ): Promise; - export default addToMailchimp; -}