diff --git a/.eslintrc.json b/.eslintrc.json index 77f1a37..afdeb5b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,26 @@ { - "extends": ["next/babel","next/core-web-vitals"], + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "extends: next/core-web-vitals" + ], + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": 12, + "sourceType": "module" + }, + "plugins": [ + "react" + ], "rules": { - "@next/next/no-page-custom-font":"off", - "@next/next/no-sync-scripts":"off", - "@next/next/no-img-element":"off", - "react-hooks/exhaustive-deps":"off", - "import/no-anonymous-default-export":"off" + "react/prop-types":0, + "no-undef":"off", + "no-unused-vars": "off" } } diff --git a/.gitignore b/.gitignore index 74b7586..737d872 100644 --- a/.gitignore +++ b/.gitignore @@ -23,13 +23,13 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +.pnpm-debug.log* # local env files -.env -.env.local -.env.development.local -.env.test.local -.env.production.local +.env*.local # vercel .vercel + +# typescript +*.tsbuildinfo diff --git a/README.md b/README.md index 981ecdd..a380173 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,3 @@ Read Contentstack [docs](https://www.contentstack.com/docs/) Region support [docs](https://www.contentstack.com/docs/developers/selecting-region-in-contentstack-starter-apps) Learn about [Next.js](https://learnnextjs.com/) - - - - - - - - - diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..b5fe070 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +## Security + +Contentstack takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations. + +If you believe you have found a security vulnerability in any Contentstack-owned repository, please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Send email to [security@contentstack.com](mailto:security@contentstack.com). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +[https://www.contentstack.com/trust/](https://www.contentstack.com/trust/) diff --git a/components/about-section-bucket.js b/components/about-section-bucket.tsx similarity index 71% rename from components/about-section-bucket.js rename to components/about-section-bucket.tsx index 81a8e0a..2ef308c 100644 --- a/components/about-section-bucket.js +++ b/components/about-section-bucket.tsx @@ -1,8 +1,38 @@ import React from 'react'; import parse from 'html-react-parser'; +import { Action,Image } from '../typescript/action'; -export default function AboutSectionBucket({ sectionWithBuckets }) { - function bucketContent(bucket, index) { +type AdditionalParam = { + title_h2?: string; + title_h3?: string; + description?: string; +} + +type Bucket = { + title_h3: string; + description: string; + icon: Image; + $: AdditionalParam; + url: string; +} + +type BucketsList = { + title_h3: string; + description: string; + url: string; + call_to_action: Action; + icon: Image; + $: AdditionalParam; +} + +type BucketProps = { + title_h2: string; + buckets:[BucketsList]; + $: AdditionalParam; +} + +export default function AboutSectionBucket({ sectionWithBuckets }: {sectionWithBuckets:BucketProps}) { + function bucketContent(bucket: Bucket, index: number) { return (
diff --git a/components/layout.js b/components/layout.tsx
similarity index 77%
rename from components/layout.js
rename to components/layout.tsx
index 517a576..86931fb 100644
--- a/components/layout.js
+++ b/components/layout.tsx
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import Header from './header';
import Footer from './footer';
import DevTools from './devtools';
+import { HeaderProps, FooterProps, PageProps, Posts, ChilderenProps, Entry, NavLinks, Links } from "../typescript/layout";
export default function Layout({
header,
@@ -11,20 +12,21 @@ export default function Layout({
blogList,
entries,
children,
-}) {
+}: { header: HeaderProps, footer: FooterProps, page: PageProps, blogPost: Posts, blogList: Posts, entries: Entry, children: ChilderenProps }) {
+
const [getLayout, setLayout] = useState({ header, footer });
- const jsonObj = { header, footer };
+ const jsonObj: any = { header, footer };
page && (jsonObj.page = page);
blogPost && (jsonObj.blog_post = blogPost);
blogList && (jsonObj.blog_post = blogList);
- function buildNavigation(ent, hd, ft) {
+ function buildNavigation(ent: Entry, hd: HeaderProps, ft: FooterProps) {
let newHeader = { ...hd };
let newFooter = { ...ft };
if (ent.length !== newHeader.navigation_menu.length) {
ent.forEach((entry) => {
const hFound = newHeader?.navigation_menu.find(
- (navLink) => navLink.label === entry.title
+ (navLink: NavLinks) => navLink.label === entry.title
);
if (!hFound) {
newHeader.navigation_menu?.push({
@@ -36,7 +38,7 @@ export default function Layout({
});
}
const fFound = newFooter?.navigation.link.find(
- (nlink) => nlink.title === entry.title
+ (nlink: Links) => nlink.title === entry.title
);
if (!fFound) {
newFooter.navigation.link?.push({
@@ -61,8 +63,10 @@ export default function Layout({
<>
{header ?