-
Notifications
You must be signed in to change notification settings - Fork 1
FEAT: Add consult us form and update page hero #577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
4205845
feat: Add consult us form
stefanskoricdev f4a13d3
fix: Image size
stefanskoricdev 10823b9
fix: Section widths
stefanskoricdev 9bb364d
feat: Update hero section on staff augmentation page
stefanskoricdev f20958b
refactor: Split Staff augmentation into components. Add content to md…
stefanskoricdev eaf0a5c
fix: Smaller styling issues
stefanskoricdev d11ace9
refactor: Move components to staff augmentation dir
stefanskoricdev 236eb2a
feat: Add Book a call button
stefanskoricdev 7d90459
fix: improve color contrast on form submit button
stefanskoricdev c6bd857
fix: Remove button opacity when disabled
stefanskoricdev bbc94f3
fix: Heading elements in sequentially-descending order
stefanskoricdev 9cadc43
fix: Heading elements in sequentially-descending order
stefanskoricdev b0c763f
feat: create thank you card, edit existing form to fit design
ivke995 fa509e6
fix: Staff augmentation background pattern issue on wide screens
stefanskoricdev e008555
feat: Make main content fact check section dynamic based on URL query…
stefanskoricdev 501a702
feat: Add content for different hero and ideal for section variants
stefanskoricdev 4b6e968
chore: copy updates
vele616 81ec619
feat: Make page content dynamic and update existing content (#605)
stefanskoricdev cae9817
feat: 2 separated requests for modal and primary form, created form f…
ivke995 c4e2700
feat: add source into getPlan endpoint
ivke995 0fcb0e9
feat: add notification error message and source in api response message
ivke995 d24dd98
feat: show 2 quarters ahead on the dropdown
ivke995 62a73c3
fix: Svg background gets blurry on bigger screens
stefanskoricdev 02daa09
fix: Smaller styling issues
stefanskoricdev 33ba7de
fix: edit variant id's, pill width on small screens
ivke995 8be4351
fix: add opacity for disabled button
ivke995 4e30ae3
chore: copy updates
vele616 e01a506
chore: minor copy correction
vele616 3f3768e
fix: edit line heights and text sizes for headers and description par…
ivke995 a9e5e4a
fix: change button background
ivke995 bdf580f
fix: add hover bg and cursor pointer on thank you card button
ivke995 1223b24
fix: enable all button click but show error message if something wrong
ivke995 5679c3b
fix: path to notion
ivke995 7629a26
feat: frontend contact us validation on get your plan form
ivke995 7e53b37
feat: add frontend validation for base contact form
ivke995 cbe3f47
fix: import collections with astro:content
ivke995 ec1198d
fix: astro:content available only on server-side
ivke995 0dbcce7
fix: allow 1 char for name in contact form API
ivke995 c46afce
fix: revert direct .md file import for single files
ivke995 7856fef
Feat ideal for section redesign (#619)
stefanskoricdev 21afed8
fix: add listener on whole form and check input clicked
ivke995 080f1ce
FEAT: Update specialization page (#622)
stefanskoricdev 0ff1ae6
FEAT: Add Trusted by and Testimonial section (#626)
stefanskoricdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,142 @@ | ||
| import { processContact } from "@/helpers/notion"; | ||
| import { nanoid } from "nanoid"; | ||
| import { NextRequest } from "next/server"; | ||
| import z from "zod"; | ||
|
|
||
| const { NOTION_GET_PLAN_DATABASE_ID } = process.env; | ||
|
|
||
| const bodyValidationSchema = z.object({ | ||
| name: z.string(), | ||
| email: z | ||
| .email({ message: "Invalid email adress" }) | ||
| .min(1, { message: "Required field" }), | ||
| companyName: z.string().optional(), | ||
| mainChallenge: z.string().optional(), | ||
| expectedStartDate: z.string().optional(), | ||
| hasConsent: z.boolean().optional(), | ||
| }); | ||
|
|
||
| type RequestBody = z.infer<typeof bodyValidationSchema>; | ||
|
|
||
| const allowRequest = async (request: Request & { ip?: string }) => { | ||
| return { success: true, limit: 1, reset: Date.now() + 30000, remaining: 1 }; | ||
| }; | ||
|
|
||
| export async function OPTIONS() { | ||
| return new Response(null, { | ||
| status: 200, | ||
| headers: { | ||
| "Access-Control-Allow-Origin": "*", | ||
| "Access-Control-Allow-Methods": "OPTIONS, POST", | ||
| "Access-Control-Allow-Headers": "Content-Type, Authorization", | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export async function POST(request: NextRequest) { | ||
| const corsHeaders = { | ||
| "Access-Control-Allow-Origin": "*", | ||
| "Access-Control-Allow-Credentials": "true", | ||
| "Access-Control-Allow-Methods": "POST, OPTIONS", | ||
| "Access-Control-Allow-Headers": "Content-Type, Authorization", | ||
| }; | ||
|
|
||
| if (request.headers.get("Content-Type") === "application/json") { | ||
| try { | ||
| const body = (await request.json()) as RequestBody; | ||
| const bodyValidationResult = bodyValidationSchema.safeParse(body); | ||
|
|
||
| if (!body || bodyValidationResult.error) { | ||
| return new Response( | ||
| JSON.stringify({ | ||
| message: bodyValidationResult.error?.message || "No body was found", | ||
| }), | ||
| { | ||
| status: 400, | ||
| headers: { | ||
| ...corsHeaders, | ||
| }, | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| const { | ||
| name, | ||
| email, | ||
| companyName, | ||
| mainChallenge, | ||
| expectedStartDate, | ||
| hasConsent, | ||
| } = body; | ||
|
|
||
| const message = ` | ||
| Company name: ${companyName || ""} \n | ||
| Main challenge: ${mainChallenge || ""} \n | ||
| Expected start date: ${expectedStartDate || ""} \n`; | ||
|
|
||
| if (!hasConsent) { | ||
| return new Response(JSON.stringify({ message: "No consent by user" }), { | ||
| status: 403, | ||
| headers: { | ||
| ...corsHeaders, | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| const { success, limit, reset, remaining } = await allowRequest(request); | ||
|
|
||
| if (!success) { | ||
| return new Response( | ||
| JSON.stringify({ | ||
| message: "Too many requests. Please try again in a minute", | ||
| }), | ||
| { | ||
| status: 429, | ||
| headers: { | ||
| ...corsHeaders, | ||
| }, | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| await processContact({ | ||
| id: nanoid(), | ||
| email, | ||
| name, | ||
| message: message || "", | ||
| databaseID: NOTION_GET_PLAN_DATABASE_ID || "", | ||
| source: request.nextUrl.searchParams.get("source") || "Unknown", | ||
| }); | ||
|
|
||
| return new Response( | ||
| JSON.stringify({ | ||
| message: "Success", | ||
| }), | ||
| { | ||
| status: 200, | ||
| headers: { | ||
| ...corsHeaders, | ||
| "X-RateLimit-Limit": limit.toString(), | ||
| "X-RateLimit-Remaining": remaining.toString(), | ||
| "X-RateLimit-Reset": reset.toString(), | ||
| }, | ||
| }, | ||
| ); | ||
| } catch (error) { | ||
| console.error("Error - api/get-plan", error); | ||
|
|
||
| const statusCode = (error as any).statusCode || 501; | ||
| const message = | ||
| (error as any)?.body?.message || "Issue while processing request"; | ||
|
|
||
| return new Response(JSON.stringify({ message }), { | ||
| status: statusCode, | ||
| headers: { | ||
| ...corsHeaders, | ||
| }, | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| return new Response(null, { status: 400, headers: corsHeaders }); | ||
| } | ||
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Exception text reinterpreted as HTML Medium