diff --git a/app/(Customer)/user/page.tsx b/app/(Customer)/user/page.tsx deleted file mode 100644 index c7da558..0000000 --- a/app/(Customer)/user/page.tsx +++ /dev/null @@ -1,128 +0,0 @@ -'use client'; -import { useSession } from 'next-auth/react'; -import { useEffect, useState } from 'react'; -import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card'; -import { Bookmark, Delete, Edit, Mail, Text, Trash, User } from 'lucide-react'; -import { getuserById } from '@/actions/user/userGET'; -import toast from 'react-hot-toast'; -import { User as UserType } from '@prisma/client'; -import { useBookmark } from '@/context/UserBookmarkProvider'; - -export default function UserProfile() { - const { data: session } = useSession(); - const [user, setUser] = useState(null); - - const { bookmarks, fetchBookmarks, removeFromBookmarks, loading, error } = - useBookmark(); - - useEffect(() => { - if (session) { - // Fetch user details when the session is available - const fetchUserData = async () => { - const userData = await getuserById({ id: session.user.id }); - if (!userData.success && userData.error) { - toast.error(userData.error); - return; - } else { - if (!userData.data) { - toast.error('NADA'); - return; - } - setUser(userData.data); - } - }; - fetchUserData(); - - fetchBookmarks(session.user.id); - } - }, []); - - - - // if(!loading&&bookmarks.length>0){ - // console.log('BOOKMARKSSSSSSS' + bookmarks[0].listing); - // } - - return ( -
- {/* User Info Section */} - {user && user.id && ( - <> - - -
- -
- - - {user.name} - -

- - {user.email} -

-
-
- - -
-
-
-
- - {loading && ( -
Loading Bookmarks....
- )} - {!loading && ( - -
-

- - Bookmarked Listings -

-
- {bookmarks.length>0 && bookmarks.map(bookmark => ( - - - - {bookmark.listing.name} - -

- {bookmark.listing.description} -

-
- - {bookmark.listing.name} -

${bookmark.listing.price}

- - - -
-
- ))} -
- - {bookmarks.length === 0 && ( -

- No bookmarks yet. -

- )} -
- )} - - )} -
- ); -} diff --git a/app/api/webhook/route.ts b/app/api/webhook/route.ts index 0151f32..fe1941f 100644 --- a/app/api/webhook/route.ts +++ b/app/api/webhook/route.ts @@ -1,4 +1,3 @@ -import prismadb from "@/lib/prismadb"; import { NextResponse } from "next/server"; import { validateWebhookSignature } from "razorpay/dist/utils/razorpay-utils"; // import crypto from "crypto"; @@ -77,18 +76,18 @@ export async function POST(req: Request) { } // Update the order in the database - await prismadb.order.update({ - where: { - RZP_OID: entity.order_id, - }, - data: { - name, - contact, - email, - address, - isPaid: true, - }, - }); + // await prismadb.order.update({ + // where: { + // RZP_OID: entity.order_id, + // }, + // data: { + // name, + // contact, + // email, + // address, + // isPaid: true, + // }, + // }); // console.log("Order update successful:", res); return NextResponse.json( diff --git a/components/chatbot/chatbot.tsx b/components/chatbot/chatbot.tsx index e701c9f..5bf144d 100644 --- a/components/chatbot/chatbot.tsx +++ b/components/chatbot/chatbot.tsx @@ -1,33 +1,34 @@ import { useState } from "react"; import ChatBot from "react-simple-chatbot"; + const Chatbot = () => { - const [userMessage, setUserMessage] = useState(""); + const [userMessage, setUserMessage] = useState(""); - const handleMessage = (msg) => { + const handleMessage = (msg: string) => { setUserMessage(msg); // Update user message on each interaction }; - - const flow = [ + // , { ChatBotProps, Step } + const flow= [ { id: "1", message: "Welcome to **EzyShop**, your one-stop shop for everything you need! What is your name?", - trigger: "2", // Proceed to step 2 after the question + trigger: "2", }, { id: "2", - user: true, // Wait for user input (name) - trigger: "3", // Proceed to step 3 once the user responds + user: true, // Correctly capturing user input without a message + trigger: "3", }, { id: "3", message: "Hi {previousValue}, nice to meet you! How can I assist you today?", - trigger: "4", // Proceed to step 4 after greeting + trigger: "4", }, { id: "4", message: "Please choose an option below to proceed:", - trigger: "5", // Provide options to the user + trigger: "5", }, { id: "5", @@ -37,11 +38,11 @@ const Chatbot = () => { { value: "Explore vendor details", label: "Explore vendors", trigger: "16" }, ], }, - // ------------------- Request a product flow ------------------- + // Request a product flow { id: "6", message: "Great! What type of product would you like to request from a vendor?", - trigger: "7", // Go to step 7 to choose the product + trigger: "7", }, { id: "7", @@ -60,13 +61,13 @@ const Chatbot = () => { { id: "10", message: "Your request has been forwarded! A vendor will contact you shortly. Is there anything else I can help you with?", - trigger: "5", // Give another set of options or end the chat + trigger: "5", }, - // ------------------- Browse Categories flow ------------------- + // Browse Categories flow { id: "8", message: "Here are some categories you can explore:", - trigger: "11", // Proceed to category options + trigger: "11", }, { id: "11", @@ -82,7 +83,7 @@ const Chatbot = () => { message: "Here are some popular {previousValue} products:\n\n - Smart TV (₹30,000)\n - Bluetooth Headphones (₹3,500)\n - Gaming Laptop (₹70,000)\n\nWould you like to explore more, request a product, or view other categories?", trigger: "5", }, - // ------------------- Explore Vendor Flow ------------------- + // Explore Vendor Flow { id: "16", message: "Here are some top vendors on EzyShop:", @@ -101,11 +102,11 @@ const Chatbot = () => { message: "{previousValue} specializes in {previousValue.split(' ')[1]} products. Here are some of their offerings:\n - Smartwatch (₹5,000)\n - Wireless Earbuds (₹2,000)\n - 4K TV (₹45,000)\n\nRating: 4.8/5\nWould you like to request a product or explore other vendors?", trigger: "5", }, - // ------------------- Thank you message ------------------- + // Thank you message { id: "14", message: "Thank you for using EzyShop! Enjoy your shopping experience!", - end: true, // End the chat + end: true, }, ]; diff --git a/next.config.mjs b/next.config.mjs index 4f0fa73..72cc992 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,5 +1,6 @@ /** @type {import('next').NextConfig} */ const nextConfig = { + reactStrictMode: false, images: { remotePatterns: [ { @@ -11,6 +12,8 @@ const nextConfig = { ], domains: ['avatars.githubusercontent.com'], }, + + // async headers() { // return [ // { diff --git a/package-lock.json b/package-lock.json index 300ba3e..b3be142 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,6 +43,7 @@ "next-themes": "^0.3.0", "nodemailer": "^6.9.15", "query-string": "^9.1.1", + "razorpay": "^2.9.5", "react": "^18.3.1", "react-confetti": "^6.1.0", "react-dom": "^18.3.1", @@ -8453,6 +8454,15 @@ "integrity": "sha512-e1E0fCzmRQcSxeAFnCybHkVi4filc7c07INtA1BAjKFRfKyO+upZ3q0OhxMnyJ2PRwTSpy/jiMN0ZXwLtyQaBw==", "license": "MIT" }, + "node_modules/razorpay": { + "version": "2.9.5", + "resolved": "https://registry.npmjs.org/razorpay/-/razorpay-2.9.5.tgz", + "integrity": "sha512-bmybwyszgfbYWAdO4igyHFk5zFj/D4YuoZAFNbyIYnPwzd+FBY5WvtpfUA9lVBMgnV4NzVEhncxR3It9RI/gCQ==", + "license": "MIT", + "dependencies": { + "axios": "^1.6.8" + } + }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", diff --git a/package.json b/package.json index a18bffb..8277d9b 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "next-themes": "^0.3.0", "nodemailer": "^6.9.15", "query-string": "^9.1.1", + "razorpay": "^2.9.5", "react": "^18.3.1", "react-confetti": "^6.1.0", "react-dom": "^18.3.1", diff --git a/types/react-simple-chatbot.d.ts b/types/react-simple-chatbot.d.ts index 6400ce2..53dab77 100644 --- a/types/react-simple-chatbot.d.ts +++ b/types/react-simple-chatbot.d.ts @@ -2,15 +2,18 @@ declare module 'react-simple-chatbot' { import * as React from 'react'; interface Step { - id: string; - message: string; - trigger: string; - user?: boolean; - end?: boolean; - delay?: number; - options?: { value: string; label: string; trigger: string }[]; - asMessage?: boolean; + id: string; // A unique identifier for each step + message?: string; // Message to be displayed to the user + trigger?: string; // The ID of the next step to trigger + user?: boolean; // If true, allows user input at this step + options?: Array<{ + value: string; // The value that is used when an option is selected + label: string; // The text shown for the option + trigger: string; // The step ID to go to after this option is selected + }>; + end?: boolean; // If true, ends the chat at this step } + interface ChatBotProps { steps: Step[];