-
+
-
-
diff --git a/plugins/Goftino/page.jsx b/plugins/Goftino/page.jsx
new file mode 100644
index 0000000..317ea72
--- /dev/null
+++ b/plugins/Goftino/page.jsx
@@ -0,0 +1,19 @@
+import Script from "next/script";
+
+export default function Goftino() {
+ const getGoftiono = () => {
+ return {
+ __html: ` !function(){var i="Gk1Yld",a=window,d=document;function g(){var g=d.createElement("script"),s="https://www.goftino.com/widget/"+i,l=localStorage.getItem("goftino_"+i);g.async=!0,g.src=l?s+"?o="+l:s;d.getElementsByTagName("head")[0].appendChild(g);}"complete"===d.readyState?g():a.attachEvent?a.attachEvent("onload",g):a.addEventListener("load",g,!1);}();
+ `,
+ };
+ };
+
+ return (
+ <>
+
+ >
+ );
+}
diff --git a/plugins/bottomSheet/BottomSheetAddress.jsx b/plugins/bottomSheet/BottomSheetAddress.jsx
index 937f488..fdebd63 100644
--- a/plugins/bottomSheet/BottomSheetAddress.jsx
+++ b/plugins/bottomSheet/BottomSheetAddress.jsx
@@ -4,6 +4,7 @@ import AppContext from "@ctx/AppContext";
import { iranCities } from "iranCities";
import { iranProvince } from "iranProvince";
import Chapar from "plugins/Chapar";
+import validateIranPhone from "plugins/IranPhoneRegex";
import { useContext, useEffect, useRef, useState } from "react";
import { BottomSheet } from "react-spring-bottom-sheet";
import { toast } from "react-toastify";
@@ -51,33 +52,45 @@ const BottomSheetAddress = () => {
};
const handleCreateAddress = async () => {
- if (validator.current.allValid()) {
- try {
- const data = await Chapar.post(
- `${process.env.NEXT_PUBLIC_API_URL}/user/address`,
- JSON.stringify(body),
- {
- headers: {
- Authorization: localStorage.getItem("token"),
- },
- }
- );
+ if (validateIranPhone(receiverPhoneNumber)) {
+ if (validator.current.allValid()) {
+ try {
+ const data = await Chapar.post(
+ `${process.env.NEXT_PUBLIC_API_URL}/user/address`,
+ JSON.stringify(body),
+ {
+ headers: {
+ Authorization: localStorage.getItem("token"),
+ },
+ }
+ );
- toast.success(`آدرس اضافه شد`, {
- position: "bottom-right",
- closeOnClick: true,
- });
+ toast.success(`آدرس اضافه شد`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
- CTX.setBottomSheetAddressOpen(false);
- CTX.fetchAddressUser();
- } catch ({ error, status }) {
- toast.error(`${error?.response?.data?.message}`, {
+ CTX.setBottomSheetAddressOpen(false);
+ CTX.fetchAddressUser();
+ } catch ({ error, status }) {
+ toast.error(`${error?.response?.data?.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ }
+ } else {
+ toast.error("پرکردن همه ی فیلد ها واجب است", {
position: "bottom-right",
+ autoClose: 2000,
+ hideProgressBar: false,
closeOnClick: true,
+ pauseOnHover: true,
+ draggable: true,
+ progress: undefined,
});
}
} else {
- toast.error("پرکردن همه ی فیلد ها واجب است", {
+ toast.error("شماره تماس را درست وارد کنید", {
position: "bottom-right",
autoClose: 2000,
hideProgressBar: false,
diff --git a/plugins/bottomSheet/BottomSheetLogOut.jsx b/plugins/bottomSheet/BottomSheetLogOut.jsx
index 1279f7f..631e897 100644
--- a/plugins/bottomSheet/BottomSheetLogOut.jsx
+++ b/plugins/bottomSheet/BottomSheetLogOut.jsx
@@ -12,6 +12,8 @@ const BottomSheetLogOut = ({ id }) => {
const handleLogOut = async () => {
localStorage.removeItem("token");
+ CTX.setProfile([]);
+ CTX.setBottomSheetLogOutOpen(false);
router.push("/");
};
diff --git a/src/app/cart/checkout/page.jsx b/src/app/cart/checkout/page.jsx
index 6aa3d20..6e4497a 100644
--- a/src/app/cart/checkout/page.jsx
+++ b/src/app/cart/checkout/page.jsx
@@ -94,6 +94,8 @@ const Page = () => {
},
}
);
+
+ router.push(data?.paymentUrl);
} catch ({ error, status }) {
toast.error(`${error?.response?.data?.message}`, {
position: "bottom-right",
@@ -145,9 +147,9 @@ const Page = () => {
{addressData.map((e, index) => (
setAddressId(index)}
@@ -216,9 +218,9 @@ const Page = () => {
{shippingData?.map((e, index) => (
handleShippingID(index)}
@@ -276,8 +278,8 @@ const Page = () => {
@@ -302,9 +304,10 @@ const Page = () => {
آسان پرداخت
+
{
if (checkOutData?.discountCode == "") {
@@ -342,14 +345,17 @@ const Page = () => {
-
- +
-
-
-
-
- کد تخفیف ثبت شد{" "}
-
+ {checkOutData?.discountCode == "" ? (
+
+ +
+
+ ) : (
+
+
+ کد تخفیف ثبت شد{" "}
+
+
+ )}
diff --git a/src/app/cart/page.jsx b/src/app/cart/page.jsx
index cf8c352..8f7d5c7 100644
--- a/src/app/cart/page.jsx
+++ b/src/app/cart/page.jsx
@@ -105,7 +105,7 @@ const Page = () => {
-
حساب نهایی
+
حساب نهایی
{/*
@@ -123,7 +123,7 @@ const Page = () => {
@@ -136,7 +136,7 @@ const Page = () => {
تخفیف محصول
-
+
{
calculateTotalCostWithDiscount) /
10
)?.toLocaleString()}
- style={"!text-[14px] !font-semibold"}
+ style={"!text-[14px] !font-medium"}
/>
@@ -186,7 +186,7 @@ const Page = () => {
handleGoCheckOut()}
- permissionGoPay={true}
+ permissionGoPay={!!cart.length > 0}
/>
>
diff --git a/src/app/layout.jsx b/src/app/layout.jsx
index dd217e9..b4069ee 100644
--- a/src/app/layout.jsx
+++ b/src/app/layout.jsx
@@ -13,6 +13,15 @@ import "react-toastify/dist/ReactToastify.css";
import "swiper/css";
import "../../style/fontiran.css";
import "../../style/globals.css";
+import Goftino from "plugins/Goftino/page";
+
+export const metadata = {
+ title: "Acme",
+ openGraph: {
+ title: "Acme",
+ description: "Acme is a...",
+ },
+};
export default function RootLayout({ children }) {
const [cart, setCart] = useState([]);
@@ -37,8 +46,6 @@ export default function RootLayout({ children }) {
const [isMobile, setIsMobile] = useState(false);
const [isOpenLightBox, setIsOpenLightBox] = useState(false);
- console.log("products", products);
-
const AddItemToCart = (
id,
persianName,
@@ -337,6 +344,8 @@ export default function RootLayout({ children }) {
+
+