diff --git a/README.md b/README.md index d9ec25c7..467f961a 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,16 @@ -Documentation site for [Plural](https://www.plural.sh/), the open-source, unified, application deployment platform that makes it easy to run open-source software on Kubernetes. Our marketplace has dozens of top tier applications ready to deploy. +[![Netlify Status](https://api.netlify.com/api/v1/badges/58af7361-4aec-4e82-a963-7b192690851a/deploy-status)](https://app.netlify.com/sites/pluraldocs/deploys) + +Marketing site for [Plural](https://www.plural.sh/), the open-source, unified, application deployment platform that makes it easy to run open-source software on Kubernetes. Our marketplace has dozens of top tier applications ready to deploy. Built with [Next.js](https://nextjs.org/) and [Markdoc](https://markdoc.dev/). ## Contributing -### Running the docs locally +### Running the site locally -To run the docs locally, you'll need to have yarn and node as prerequisites. Then run the following commands: +To run the site locally, you'll need to have yarn and node as prerequisites. Then run the following commands: ```shell yarn # build the environment -yarn dev # run docs locally +yarn dev # run site locally ``` - -### Adding a new document - -All content can be located under the [pages](/pages) directory. The directory structure directly informs the website URL structure, so consider that when placing your new document. - -All of our documents are in standard Markdown (.md) file format. If you are including an image, add it to [public/assets] using the same directory structure as pages. - -Finally, make sure to add your new document to the NavData.tsx file located [here](/src/NavData.tsx). - -### Updating structure - -If you are making any changes to the documentation structure or organization, you'll likely need to set up page redirects. These can be added in [next.config.js](next.config.js). Make sure to -look for internal usages throughout all the documents on the site to make sure that there are no broken links. \ No newline at end of file diff --git a/app/api/newsletter/route.ts b/app/api/newsletter/route.ts new file mode 100644 index 00000000..33fb230c --- /dev/null +++ b/app/api/newsletter/route.ts @@ -0,0 +1,128 @@ +import { type NextRequest, NextResponse } from 'next/server' + +import { Client } from '@hubspot/api-client' +import queryString from 'query-string' + +import { isValidEmail } from '@src/utils/text' + +const hubspotClient = new Client({ + accessToken: process.env.HUBSPOT_API_SECRET, +}) + +async function isCaptchaValid(captchaVal) { + const postBody = queryString.stringify({ + secret: process.env.SITE_RECAPTCHA_SECRET, + response: captchaVal, + }) + const headers = new Headers({ + 'Content-Type': 'application/x-www-form-urlencoded', + }) + + try { + const res = await fetch('https://www.google.com/recaptcha/api/siteverify', { + method: 'POST', + headers, + body: postBody, + }) + const response = await res.json() + + return response.success + } catch (e) { + return false + } +} + +async function setEmail(email) { + const response = await hubspotClient.apiRequest({ + method: 'POST', + path: '/crm/v3/objects/contacts', + body: { properties: { email } }, + }) + + if (!response.ok) { + try { + const body = (await response.json()) as { + category?: string + message?: string + } + + if (body?.category === 'CONFLICT') { + const contactId = body.message?.match(/Existing ID:\s*(?\d+)/) + ?.groups?.id + + if (!contactId) { + return false + } + const patchRes = await hubspotClient.apiRequest({ + method: 'PATCH', + path: `/crm/v3/objects/contacts/${contactId}`, + body: { properties: { email } }, + }) + + if (patchRes.ok) { + return true + } + + return false + } + } catch (e) { + return false + } + } + + return true +} + +const ErrorResponse = (error: { + type: 'form' | 'captcha' | 'hubspot' + message: string +}) => + NextResponse.json( + { + error, + }, + { status: 500 } + ) + +export async function POST(req: NextRequest) { + let formData: FormData + + try { + formData = await req.formData() + } catch (e) { + return ErrorResponse({ type: 'form', message: `${e}` }) + } + const email = formData.get('email') + + if (!email || typeof email !== 'string') { + return ErrorResponse({ + type: 'form', + message: 'Missing email address', + }) + } + if (!isValidEmail(email)) { + return ErrorResponse({ + type: 'form', + message: 'Invalid email address', + }) + } + + const validCaptcha = await isCaptchaValid( + formData.get('g-recaptcha-response') + ) + + if (!validCaptcha) { + return ErrorResponse({ type: 'captcha', message: 'Invalid captcha' }) + } + + const success = setEmail(email) + + if (!success) { + return ErrorResponse({ + type: 'hubspot', + message: 'Could not create contact', + }) + } + + return NextResponse.json({ success }) +} diff --git a/next-env.d.ts b/next-env.d.ts index 4f11a03d..fd36f949 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,5 +1,6 @@ /// /// +/// // NOTE: This file should not be edited // see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/package.json b/package.json index de02685d..8bb441b3 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@graphql-codegen/typescript": "4.0.1", "@graphql-codegen/typescript-operations": "4.0.1", "@graphql-codegen/typescript-react-apollo": "3.3.7", + "@hubspot/api-client": "9.1.0", "@loomhq/loom-embed": "1.5.0", "@markdoc/markdoc": "0.3.0", "@markdoc/next.js": "0.2.2", @@ -56,15 +57,16 @@ "js-yaml": "4.1.0", "lodash-es": "4.17.21", "memoize-one": "6.0.0", - "moment-timezone": "^0.5.43", + "moment-timezone": "0.5.43", "next": "13.4.12", "next-compose-plugins": "2.2.1", "next-transpile-modules": "10.0.0", - "octokit": "^3.1.0", + "octokit": "3.1.0", "posthog-js": "1.75.2", + "query-string": "8.1.0", "raw-loader": "4.0.2", "react": "18.2.0", - "react-add-to-calendar": "^0.1.5", + "react-add-to-calendar": "0.1.5", "react-aria": "3.25.0", "react-dom": "18.2.0", "react-embed": "3.7.0", diff --git a/public/forms/newsletter.html b/public/forms/newsletter.html deleted file mode 100644 index 457b6c42..00000000 --- a/public/forms/newsletter.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - Forms - - -
- - - -
- - diff --git a/public/images/careers/photo-1.jpg b/public/images/careers/photo-1.jpg index 87ffa1e8..b759bfa6 100644 Binary files a/public/images/careers/photo-1.jpg and b/public/images/careers/photo-1.jpg differ diff --git a/public/images/careers/photo-2.jpg b/public/images/careers/photo-2.jpg index cce55496..3f1b6c0d 100644 Binary files a/public/images/careers/photo-2.jpg and b/public/images/careers/photo-2.jpg differ diff --git a/public/images/careers/photo-group-1.jpg b/public/images/careers/photo-group-1.jpg index 336079ec..dea1a3f4 100644 Binary files a/public/images/careers/photo-group-1.jpg and b/public/images/careers/photo-group-1.jpg differ diff --git a/public/images/careers/photo-group-2.jpg b/public/images/careers/photo-group-2.jpg index e6ba91af..8dcf478b 100644 Binary files a/public/images/careers/photo-group-2.jpg and b/public/images/careers/photo-group-2.jpg differ diff --git a/public/images/cont-deploy/create-cluster-m.png b/public/images/cont-deploy/create-cluster-m.png old mode 100755 new mode 100644 index d36b5d3f..57a7b24b Binary files a/public/images/cont-deploy/create-cluster-m.png and b/public/images/cont-deploy/create-cluster-m.png differ diff --git a/public/images/cont-deploy/deploy-service.png b/public/images/cont-deploy/deploy-service.png index 9ba813a6..a1c6c255 100644 Binary files a/public/images/cont-deploy/deploy-service.png and b/public/images/cont-deploy/deploy-service.png differ diff --git a/public/images/cont-deploy/deployments-clusters-update.png b/public/images/cont-deploy/deployments-clusters-update.png index a38f48e8..490c439d 100644 Binary files a/public/images/cont-deploy/deployments-clusters-update.png and b/public/images/cont-deploy/deployments-clusters-update.png differ diff --git a/public/images/cont-deploy/pipelines.png b/public/images/cont-deploy/pipelines.png index 0aaa0495..a9212b48 100644 Binary files a/public/images/cont-deploy/pipelines.png and b/public/images/cont-deploy/pipelines.png differ diff --git a/public/images/cont-deploy/whitepaper.png b/public/images/cont-deploy/whitepaper.png index 8fee4106..4034bb2f 100644 Binary files a/public/images/cont-deploy/whitepaper.png and b/public/images/cont-deploy/whitepaper.png differ diff --git a/public/images/gradients/gradient-blue-1.png b/public/images/gradients/gradient-blue-1.png deleted file mode 100644 index 63eff735..00000000 Binary files a/public/images/gradients/gradient-blue-1.png and /dev/null differ diff --git a/public/images/homepage/features/easy-setup-2_poster.png b/public/images/homepage/features/easy-setup-2_poster.png index a410a762..a37e4c68 100644 Binary files a/public/images/homepage/features/easy-setup-2_poster.png and b/public/images/homepage/features/easy-setup-2_poster.png differ diff --git a/public/images/homepage/features/production-2.mp4 b/public/images/homepage/features/production-2.mp4 new file mode 100644 index 00000000..1c2ae5b0 Binary files /dev/null and b/public/images/homepage/features/production-2.mp4 differ diff --git a/public/images/homepage/features/production-2.png b/public/images/homepage/features/production-2.png deleted file mode 100644 index f085ed81..00000000 Binary files a/public/images/homepage/features/production-2.png and /dev/null differ diff --git a/public/images/homepage/features/production-2_poster.png b/public/images/homepage/features/production-2_poster.png new file mode 100644 index 00000000..58fb58e9 Binary files /dev/null and b/public/images/homepage/features/production-2_poster.png differ diff --git a/public/images/homepage/features/security-2_poster.png b/public/images/homepage/features/security-2_poster.png index 3bab8e17..b190f67a 100644 Binary files a/public/images/homepage/features/security-2_poster.png and b/public/images/homepage/features/security-2_poster.png differ diff --git a/public/images/homepage/features/upgrades-1.mp4 b/public/images/homepage/features/upgrades-1.mp4 new file mode 100644 index 00000000..5a35d479 Binary files /dev/null and b/public/images/homepage/features/upgrades-1.mp4 differ diff --git a/public/images/homepage/features/upgrades-1.png b/public/images/homepage/features/upgrades-1.png deleted file mode 100644 index 332e58a3..00000000 Binary files a/public/images/homepage/features/upgrades-1.png and /dev/null differ diff --git a/public/images/homepage/features/upgrades-1_poster.png b/public/images/homepage/features/upgrades-1_poster.png new file mode 100644 index 00000000..a2bf4d65 Binary files /dev/null and b/public/images/homepage/features/upgrades-1_poster.png differ diff --git a/public/images/homepage/hero-apps.png b/public/images/homepage/hero-apps.png old mode 100755 new mode 100644 index 74eccb63..44209d02 Binary files a/public/images/homepage/hero-apps.png and b/public/images/homepage/hero-apps.png differ diff --git a/public/images/homepage/hero-configuration.png b/public/images/homepage/hero-configuration.png index a46434c0..b0e743a8 100644 Binary files a/public/images/homepage/hero-configuration.png and b/public/images/homepage/hero-configuration.png differ diff --git a/public/images/how-plural-works/how-plural-works-screen.png b/public/images/how-plural-works/how-plural-works-screen.png index 0f33f20f..564953aa 100644 Binary files a/public/images/how-plural-works/how-plural-works-screen.png and b/public/images/how-plural-works/how-plural-works-screen.png differ diff --git a/public/images/icons/search-icon.svg b/public/images/icons/search-icon.svg index f3de79e4..dd761afc 100644 --- a/public/images/icons/search-icon.svg +++ b/public/images/icons/search-icon.svg @@ -1,11 +1 @@ - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/public/images/icons/star.svg b/public/images/icons/star.svg index 3c5bb703..06528719 100644 --- a/public/images/icons/star.svg +++ b/public/images/icons/star.svg @@ -1,5 +1 @@ - - - - - + \ No newline at end of file diff --git a/public/images/marketplace/png/stack-card-data-sm@2x.png b/public/images/marketplace/png/stack-card-data-sm@2x.png index fbc9d4ed..05d3bc10 100644 Binary files a/public/images/marketplace/png/stack-card-data-sm@2x.png and b/public/images/marketplace/png/stack-card-data-sm@2x.png differ diff --git a/public/images/marketplace/png/stack-card-devops-sm@2x.png b/public/images/marketplace/png/stack-card-devops-sm@2x.png index d2510a06..470839b7 100644 Binary files a/public/images/marketplace/png/stack-card-devops-sm@2x.png and b/public/images/marketplace/png/stack-card-devops-sm@2x.png differ diff --git a/public/images/marketplace/png/stack-card-observability-lg@2x.png b/public/images/marketplace/png/stack-card-observability-lg@2x.png index 030b3ad6..773f11f1 100644 Binary files a/public/images/marketplace/png/stack-card-observability-lg@2x.png and b/public/images/marketplace/png/stack-card-observability-lg@2x.png differ diff --git a/public/images/marketplace/png/stack-card-observability-sm@2x.png b/public/images/marketplace/png/stack-card-observability-sm@2x.png index ea9c934a..1eb06afc 100644 Binary files a/public/images/marketplace/png/stack-card-observability-sm@2x.png and b/public/images/marketplace/png/stack-card-observability-sm@2x.png differ diff --git a/public/images/marketplace/png/stack-card-observability-xl@2x.png b/public/images/marketplace/png/stack-card-observability-xl@2x.png index d4cd8998..7058e54b 100644 Binary files a/public/images/marketplace/png/stack-card-observability-xl@2x.png and b/public/images/marketplace/png/stack-card-observability-xl@2x.png differ diff --git a/public/images/marketplace/png/stack-card-security-sm@2x.png b/public/images/marketplace/png/stack-card-security-sm@2x.png index ce2b6d86..50a38102 100644 Binary files a/public/images/marketplace/png/stack-card-security-sm@2x.png and b/public/images/marketplace/png/stack-card-security-sm@2x.png differ diff --git a/public/images/plural-logo.svg b/public/images/plural-logo.svg index f3368380..0881a3fa 100644 --- a/public/images/plural-logo.svg +++ b/public/images/plural-logo.svg @@ -1,27 +1 @@ - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/public/images/product/dotted-line-vertical.png b/public/images/product/dotted-line-vertical.png index 9e0fb0ad..e82bde0b 100644 Binary files a/public/images/product/dotted-line-vertical.png and b/public/images/product/dotted-line-vertical.png differ diff --git a/public/images/product/gdpr-cert.png b/public/images/product/gdpr-cert.png old mode 100755 new mode 100644 index 626dc51e..3a1377d8 Binary files a/public/images/product/gdpr-cert.png and b/public/images/product/gdpr-cert.png differ diff --git a/src/components/ExternalScripts.tsx b/src/components/ExternalScripts.tsx index 339c4227..5f3edd8f 100644 --- a/src/components/ExternalScripts.tsx +++ b/src/components/ExternalScripts.tsx @@ -50,7 +50,7 @@ function HubSpot() { return (