+ {/* Sidebar - Desktop always visible, Mobile toggleable */}
+ {showSidebar && (
+
+
+
+ )}
+
+ {/* Mobile Sidebar Overlay */}
+ {showSidebar && (
+
+
setShowSidebar(false)}
+ />
+
+
+
+
+ )}
+
+ {/* Main Chat Area */}
+
+ {/* Header */}
+
+
+
+
+
+ چتبات راهنما
+
+
+ سوالات خود را در مورد محصولات تابلو برق بپرسید
+
+
+
+
+
+
+ {/* Chat Window */}
+
+
+ {/* Message Input */}
+
+
+
+ );
+}
diff --git a/src/app/chatbot/service/SocketService.ts b/src/app/chatbot/service/SocketService.ts
new file mode 100644
index 0000000..89c02d2
--- /dev/null
+++ b/src/app/chatbot/service/SocketService.ts
@@ -0,0 +1,377 @@
+import { io, Socket } from "socket.io-client";
+import { BASE_URL } from "@/config/const";
+import { getChatbotSessionId, setChatbotSessionId } from "../utils/cookies";
+import { generateULID } from "../utils/ulid";
+import {
+ ChatSession,
+ SessionCreatedResponse,
+ ChatJoinedResponse,
+ MessageReceivedResponse,
+ BotResponse,
+ BotResponseStart,
+ BotResponseChunk,
+ BotResponseEnd,
+ ErrorResponse,
+ AuthenticatedResponse,
+ UnauthorizedResponse,
+ SendMessagePayload,
+ ConnectionStatus,
+} from "../types/Types";
+
+class ChatbotSocketService {
+ private socket: Socket | null = null;
+ private eventListeners: { [key: string]: ((data: unknown) => void)[] } = {};
+ private connectionStatus: ConnectionStatus = "disconnected";
+ private reconnectAttempts = 0;
+ private maxReconnectAttempts = 5;
+ private reconnectDelay = 1000;
+
+ constructor() {
+ this.initializeEventListeners();
+ }
+
+ private initializeEventListeners(): void {
+ this.eventListeners = {
+ connect: [],
+ disconnect: [],
+ connection_failed: [],
+ authenticated: [],
+ unauthorized: [],
+ session_created: [],
+ chat_joined: [],
+ chat_left: [],
+ message_received: [],
+ bot_response: [],
+ bot_response_start: [],
+ bot_response_chunk: [],
+ bot_response_end: [],
+ typing_start: [],
+ typing_stop: [],
+ user_joined: [],
+ user_left: [],
+ error: [],
+ websocket_error: [],
+ session_error: [],
+ message_error: [],
+ connection_status_changed: [],
+ };
+ }
+
+ connect(token?: string): Promise
{
+ return new Promise((resolve, reject) => {
+ try {
+ this.connectionStatus = "connecting";
+ this.emit("connection_status_changed", this.connectionStatus);
+
+ // اگر session ID وجود ندارد، یکی بساز
+ let sessionId = getChatbotSessionId();
+ if (!sessionId) {
+ sessionId = generateULID();
+ setChatbotSessionId(sessionId);
+ }
+
+ const connectionOptions: {
+ path: string;
+ query?: Record;
+ transports: string[];
+ timeout: number;
+ reconnection: boolean;
+ reconnectionAttempts: number;
+ reconnectionDelay: number;
+ reconnectionDelayMax: number;
+ } = {
+ path: "/ws-chatbot",
+ transports: ["websocket"],
+ timeout: 10000,
+ reconnection: true,
+ reconnectionAttempts: this.maxReconnectAttempts,
+ reconnectionDelay: this.reconnectDelay,
+ reconnectionDelayMax: 5000,
+ };
+
+ // اگر token وجود دارد، از آن استفاده کن
+ if (token) {
+ connectionOptions.query = { token };
+ }
+
+ console.log("🔌 اتصال به chatbot socket:", `${BASE_URL}/ws-chatbot`);
+
+ this.socket = io(BASE_URL, connectionOptions);
+
+ this.setupSocketListeners();
+
+ // مدیریت اتصال موفق
+ this.socket.on("connect", () => {
+ console.log("✅ اتصال chatbot socket برقرار شد:", this.socket?.id);
+ this.connectionStatus = "connected";
+ this.reconnectAttempts = 0;
+ this.emit("connection_status_changed", this.connectionStatus);
+ this.emit("connect", null);
+ resolve();
+ });
+
+ // مدیریت خطای اتصال
+ this.socket.on("connect_error", (err) => {
+ console.error("❌ خطا در اتصال chatbot socket:", err.message);
+ this.connectionStatus = "error";
+ this.emit("connection_status_changed", this.connectionStatus);
+ this.emit("connection_failed", err);
+ reject(err);
+ });
+
+ // مدیریت قطع اتصال
+ this.socket.on("disconnect", (reason) => {
+ console.log("❌ اتصال chatbot socket قطع شد:", reason);
+ if (reason === "io server disconnect") {
+ this.connectionStatus = "disconnected";
+ } else {
+ this.connectionStatus = "reconnecting";
+ }
+ this.emit("connection_status_changed", this.connectionStatus);
+ this.emit("disconnect", reason);
+ });
+
+ // مدیریت reconnect
+ this.socket.io.on("reconnect_attempt", () => {
+ this.reconnectAttempts++;
+ this.connectionStatus = "reconnecting";
+ this.emit("connection_status_changed", this.connectionStatus);
+ console.log(
+ `🔄 تلاش برای اتصال مجدد (${this.reconnectAttempts}/${this.maxReconnectAttempts})`
+ );
+ });
+
+ this.socket.io.on("reconnect", () => {
+ console.log("✅ اتصال مجدد برقرار شد");
+ this.connectionStatus = "connected";
+ this.reconnectAttempts = 0;
+ this.emit("connection_status_changed", this.connectionStatus);
+ });
+
+ this.socket.io.on("reconnect_failed", () => {
+ console.error("❌ اتصال مجدد ناموفق");
+ this.connectionStatus = "error";
+ this.emit("connection_status_changed", this.connectionStatus);
+ });
+ } catch (error) {
+ console.error("خطا در ایجاد اتصال chatbot socket:", error);
+ this.connectionStatus = "error";
+ this.emit("connection_status_changed", this.connectionStatus);
+ reject(error);
+ }
+ });
+ }
+
+ private setupSocketListeners(): void {
+ if (!this.socket) return;
+
+ // Authentication events
+ this.socket.on("authenticated", (data: AuthenticatedResponse) => {
+ console.log("✅ احراز هویت موفق:", data);
+ this.emit("authenticated", data);
+ });
+
+ this.socket.on("unauthorized", (data: UnauthorizedResponse) => {
+ console.error("❌ احراز هویت ناموفق:", data);
+ this.emit("unauthorized", data);
+ });
+
+ // Session events
+ this.socket.on("session_created", (data: SessionCreatedResponse) => {
+ console.log("✅ سشن ایجاد شد:", data);
+ this.emit("session_created", data);
+ });
+
+ this.socket.on("chat_joined", (data: ChatJoinedResponse) => {
+ console.log("✅ به چت پیوست:", data);
+ this.emit("chat_joined", data);
+ });
+
+ this.socket.on("chat_left", () => {
+ console.log("✅ از چت خارج شد");
+ this.emit("chat_left", null);
+ });
+
+ // Message events
+ this.socket.on("message_received", (data: MessageReceivedResponse) => {
+ console.log("💬 پیام دریافت شد:", data);
+ this.emit("message_received", data);
+ });
+
+ // Bot response events (non-streaming)
+ this.socket.on("bot_response", (data: BotResponse) => {
+ console.log("🤖 پاسخ ربات:", data);
+ this.emit("bot_response", data);
+ });
+
+ // Bot response events (streaming)
+ this.socket.on("bot_response_start", (data: BotResponseStart) => {
+ console.log("🤖 شروع پاسخ ربات:", data);
+ this.emit("bot_response_start", data);
+ });
+
+ this.socket.on("bot_response_chunk", (data: BotResponseChunk) => {
+ this.emit("bot_response_chunk", data);
+ });
+
+ this.socket.on("bot_response_end", (data: BotResponseEnd) => {
+ console.log("🤖 پایان پاسخ ربات:", data);
+ this.emit("bot_response_end", data);
+ });
+
+ // Typing events
+ this.socket.on(
+ "typing_start",
+ (data: { sessionId: string; userId?: string }) => {
+ this.emit("typing_start", data);
+ }
+ );
+
+ this.socket.on(
+ "typing_stop",
+ (data: { sessionId: string; userId?: string }) => {
+ this.emit("typing_stop", data);
+ }
+ );
+
+ // User presence events
+ this.socket.on(
+ "user_joined",
+ (data: { sessionId: string; userId: string }) => {
+ console.log("👤 کاربر پیوست:", data);
+ this.emit("user_joined", data);
+ }
+ );
+
+ this.socket.on(
+ "user_left",
+ (data: { sessionId: string; userId: string }) => {
+ console.log("👤 کاربر خارج شد:", data);
+ this.emit("user_left", data);
+ }
+ );
+
+ // Error events
+ this.socket.on("error", (data: ErrorResponse) => {
+ console.error("⚠️ خطای عمومی:", data);
+ this.emit("error", data);
+ });
+
+ this.socket.on("websocket_error", (data: ErrorResponse) => {
+ console.error("⚠️ خطای WebSocket:", data);
+ this.emit("websocket_error", data);
+ });
+
+ this.socket.on("session_error", (data: ErrorResponse) => {
+ console.error("⚠️ خطای سشن:", data);
+ this.emit("session_error", data);
+ });
+
+ this.socket.on("message_error", (data: ErrorResponse) => {
+ console.error("⚠️ خطای پیام:", data);
+ this.emit("message_error", data);
+ });
+ }
+
+ // Session management
+ createSession(): void {
+ if (this.socket && this.socket.connected) {
+ console.log("📝 ایجاد سشن جدید");
+ this.socket.emit("create_session");
+ } else {
+ console.error("سوکت متصل نیست - نمیتوان سشن ایجاد کرد");
+ }
+ }
+
+ joinChat(sessionId: string): void {
+ if (this.socket && this.socket.connected) {
+ console.log("🔗 ورود به چت:", sessionId);
+ this.socket.emit("join_chat", sessionId);
+ } else {
+ console.error("سوکت متصل نیست - نمیتوان به چت وارد شد");
+ }
+ }
+
+ leaveChat(sessionId: string): void {
+ if (this.socket && this.socket.connected) {
+ console.log("🚪 خروج از چت:", sessionId);
+ this.socket.emit("leave_chat", sessionId);
+ }
+ }
+
+ // Message sending
+ sendMessage(payload: SendMessagePayload): void {
+ if (this.socket && this.socket.connected) {
+ console.log("📤 ارسال پیام:", payload);
+ this.socket.emit("send_message", payload);
+ } else {
+ console.error("سوکت متصل نیست - نمیتوان پیام ارسال کرد");
+ }
+ }
+
+ sendMessageStream(payload: SendMessagePayload): void {
+ if (this.socket && this.socket.connected) {
+ console.log("📤 ارسال پیام با streaming:", payload);
+ this.socket.emit("send_message_stream", payload);
+ } else {
+ console.error("سوکت متصل نیست - نمیتوان پیام ارسال کرد");
+ }
+ }
+
+ // Typing indicators
+ typingStart(sessionId: string): void {
+ if (this.socket && this.socket.connected) {
+ this.socket.emit("typing_start", sessionId);
+ }
+ }
+
+ typingStop(sessionId: string): void {
+ if (this.socket && this.socket.connected) {
+ this.socket.emit("typing_stop", sessionId);
+ }
+ }
+
+ // Connection management
+ disconnect(): void {
+ if (this.socket) {
+ console.log("🔌 قطع اتصال chatbot socket");
+ this.socket.disconnect();
+ this.socket = null;
+ this.connectionStatus = "disconnected";
+ this.emit("connection_status_changed", this.connectionStatus);
+ }
+ }
+
+ isConnected(): boolean {
+ return this.socket?.connected || false;
+ }
+
+ getConnectionStatus(): ConnectionStatus {
+ return this.connectionStatus;
+ }
+
+ // Event system
+ on(event: string, callback: (data: unknown) => void): void {
+ if (!this.eventListeners[event]) {
+ this.eventListeners[event] = [];
+ }
+ this.eventListeners[event].push(callback);
+ }
+
+ off(event: string, callback: (data: unknown) => void): void {
+ if (this.eventListeners[event]) {
+ this.eventListeners[event] = this.eventListeners[event].filter(
+ (cb) => cb !== callback
+ );
+ }
+ }
+
+ private emit(event: string, data: unknown): void {
+ if (this.eventListeners[event]) {
+ this.eventListeners[event].forEach((callback) => callback(data));
+ }
+ }
+}
+
+// ایجاد instance singleton
+export const chatbotSocketService = new ChatbotSocketService();
diff --git a/src/app/chatbot/store/ChatbotStore.ts b/src/app/chatbot/store/ChatbotStore.ts
new file mode 100644
index 0000000..978b0e8
--- /dev/null
+++ b/src/app/chatbot/store/ChatbotStore.ts
@@ -0,0 +1,166 @@
+import { create } from "zustand";
+import {
+ ChatSession,
+ ChatMessage,
+ ConnectionStatus,
+ SessionCreatedResponse,
+ ChatJoinedResponse,
+ MessageReceivedResponse,
+ BotResponse,
+ BotResponseStart,
+ BotResponseChunk,
+ BotResponseEnd,
+ ErrorResponse,
+} from "../types/Types";
+
+interface ChatbotState {
+ // Connection
+ connectionStatus: ConnectionStatus;
+ setConnectionStatus: (status: ConnectionStatus) => void;
+
+ // Current session
+ currentSession: ChatSession | null;
+ setCurrentSession: (session: ChatSession | null) => void;
+
+ // Messages
+ messages: ChatMessage[];
+ addMessage: (message: ChatMessage) => void;
+ updateMessage: (messageId: string, updates: Partial) => void;
+ setMessages: (messages: ChatMessage[]) => void;
+ clearMessages: () => void;
+
+ // Streaming message
+ streamingMessage: {
+ userMessageId: string | null;
+ content: string;
+ isStreaming: boolean;
+ };
+ startStreaming: (userMessageId: string) => void;
+ appendStreamChunk: (chunk: string) => void;
+ endStreaming: (fullResponse: string) => void;
+ clearStreaming: () => void;
+
+ // Sessions list
+ sessions: ChatSession[];
+ setSessions: (sessions: ChatSession[]) => void;
+ addSession: (session: ChatSession) => void;
+ updateSession: (sessionId: string, updates: Partial) => void;
+
+ // Typing indicators
+ typingUsers: Set;
+ setTyping: (sessionId: string, isTyping: boolean) => void;
+ clearTyping: () => void;
+
+ // Errors
+ error: string | null;
+ setError: (error: string | null) => void;
+}
+
+export const useChatbotStore = create((set, get) => ({
+ // Connection
+ connectionStatus: "disconnected",
+ setConnectionStatus: (status) => set({ connectionStatus: status }),
+
+ // Current session
+ currentSession: null,
+ setCurrentSession: (session) => set({ currentSession: session }),
+
+ // Messages
+ messages: [],
+ addMessage: (message) =>
+ set((state) => ({
+ messages: [...state.messages, message],
+ })),
+ updateMessage: (messageId, updates) =>
+ set((state) => ({
+ messages: state.messages.map((msg) =>
+ msg.id === messageId ? { ...msg, ...updates } : msg
+ ),
+ })),
+ setMessages: (messages) => set({ messages }),
+ clearMessages: () => set({ messages: [] }),
+
+ // Streaming message
+ streamingMessage: {
+ userMessageId: null,
+ content: "",
+ isStreaming: false,
+ },
+ startStreaming: (userMessageId) =>
+ set({
+ streamingMessage: {
+ userMessageId,
+ content: "",
+ isStreaming: true,
+ },
+ }),
+ appendStreamChunk: (chunk) =>
+ set((state) => ({
+ streamingMessage: {
+ ...state.streamingMessage,
+ content: state.streamingMessage.content + chunk,
+ },
+ })),
+ endStreaming: (fullResponse) => {
+ const state = get();
+ // تبدیل streaming message به message معمولی
+ if (state.streamingMessage.userMessageId) {
+ const botMessage: ChatMessage = {
+ id: `temp-${Date.now()}`,
+ content: fullResponse,
+ type: "bot",
+ status: "sent",
+ createdAt: new Date().toISOString(),
+ responseToId: state.streamingMessage.userMessageId,
+ };
+ set((s) => ({
+ messages: [...s.messages, botMessage],
+ streamingMessage: {
+ userMessageId: null,
+ content: "",
+ isStreaming: false,
+ },
+ }));
+ }
+ },
+ clearStreaming: () =>
+ set({
+ streamingMessage: {
+ userMessageId: null,
+ content: "",
+ isStreaming: false,
+ },
+ }),
+
+ // Sessions list
+ sessions: [],
+ setSessions: (sessions) => set({ sessions }),
+ addSession: (session) =>
+ set((state) => ({
+ sessions: [session, ...state.sessions],
+ })),
+ updateSession: (sessionId, updates) =>
+ set((state) => ({
+ sessions: state.sessions.map((session) =>
+ session.id === sessionId ? { ...session, ...updates } : session
+ ),
+ })),
+
+ // Typing indicators
+ typingUsers: new Set(),
+ setTyping: (sessionId, isTyping) =>
+ set((state) => {
+ const newSet = new Set(state.typingUsers);
+ if (isTyping) {
+ newSet.add(sessionId);
+ } else {
+ newSet.delete(sessionId);
+ }
+ return { typingUsers: newSet };
+ }),
+ clearTyping: () => set({ typingUsers: new Set() }),
+
+ // Errors
+ error: null,
+ setError: (error) => set({ error }),
+}));
diff --git a/src/app/chatbot/types/Types.ts b/src/app/chatbot/types/Types.ts
new file mode 100644
index 0000000..ad535d7
--- /dev/null
+++ b/src/app/chatbot/types/Types.ts
@@ -0,0 +1,116 @@
+export type MessageType = "user" | "bot" | "system";
+export type MessageStatus = "sent" | "delivered" | "read" | "failed";
+export type SessionStatus = "active" | "closed";
+
+export interface ChatMessage {
+ id: string;
+ content: string;
+ type: MessageType;
+ status: MessageStatus;
+ createdAt: string;
+ responseToId?: string | null;
+ metadata?: Record;
+ tokensUsed?: number;
+}
+
+export interface ChatSession {
+ id: string;
+ status: SessionStatus;
+ createdAt: string;
+ lastMessageAt: string;
+ messages: ChatMessage[];
+}
+
+export interface SessionCreatedResponse {
+ status: "success";
+ data: ChatSession;
+ timestamp: string;
+}
+
+export interface ChatJoinedResponse {
+ status: "success";
+ data: ChatSession;
+ timestamp: string;
+}
+
+export interface MessageReceivedResponse {
+ status: "success";
+ data: ChatMessage;
+ timestamp: string;
+}
+
+export interface BotResponse {
+ status: "success";
+ data: {
+ id: string;
+ content: string;
+ type: "bot";
+ status: MessageStatus;
+ createdAt: string;
+ responseToId: string;
+ metadata?: {
+ confidence?: number;
+ sources?: unknown[];
+ llmContext?: Record;
+ };
+ tokensUsed: number;
+ };
+ timestamp: string;
+}
+
+export interface BotResponseStart {
+ status: "success";
+ data: {
+ userMessageId: string;
+ };
+ timestamp: string;
+}
+
+export interface BotResponseChunk {
+ status: "success";
+ data: {
+ chunk: string;
+ userMessageId: string;
+ };
+ timestamp: string;
+}
+
+export interface BotResponseEnd {
+ status: "success";
+ data: {
+ userMessageId: string;
+ fullResponse: string;
+ };
+ timestamp: string;
+}
+
+export interface ErrorResponse {
+ status: "error";
+ message: string;
+ timestamp: string;
+}
+
+export interface AuthenticatedResponse {
+ message: "authenticated";
+ userId?: string;
+ timestamp: string;
+}
+
+export interface UnauthorizedResponse {
+ message: string;
+ timestamp: string;
+}
+
+export interface SendMessagePayload {
+ content: string;
+ sessionId: string;
+ responseToId?: string | null;
+ metadata?: Record;
+}
+
+export type ConnectionStatus =
+ | "disconnected"
+ | "connecting"
+ | "connected"
+ | "reconnecting"
+ | "error";
diff --git a/src/app/chatbot/utils/cookies.ts b/src/app/chatbot/utils/cookies.ts
new file mode 100644
index 0000000..b6fa215
--- /dev/null
+++ b/src/app/chatbot/utils/cookies.ts
@@ -0,0 +1,35 @@
+const CHATBOT_SESSION_ID_COOKIE = "chatbot_session_id";
+
+export const getCookie = (name: string): string | null => {
+ if (typeof document === "undefined") return null;
+
+ const value = `; ${document.cookie}`;
+ const parts = value.split(`; ${name}=`);
+
+ if (parts.length === 2) {
+ return parts.pop()?.split(";").shift() || null;
+ }
+
+ return null;
+};
+
+export const setCookie = (
+ name: string,
+ value: string,
+ days: number = 365
+): void => {
+ if (typeof document === "undefined") return;
+
+ const date = new Date();
+ date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
+ const expires = `expires=${date.toUTCString()}`;
+ document.cookie = `${name}=${value};${expires};path=/;SameSite=Lax`;
+};
+
+export const getChatbotSessionId = (): string | null => {
+ return getCookie(CHATBOT_SESSION_ID_COOKIE);
+};
+
+export const setChatbotSessionId = (sessionId: string): void => {
+ setCookie(CHATBOT_SESSION_ID_COOKIE, sessionId);
+};
diff --git a/src/app/chatbot/utils/ulid.ts b/src/app/chatbot/utils/ulid.ts
new file mode 100644
index 0000000..3eca5f0
--- /dev/null
+++ b/src/app/chatbot/utils/ulid.ts
@@ -0,0 +1,36 @@
+// Simple ULID generator
+// ULID format: 01234567890123456789012345 (26 characters)
+// Time (10 chars) + Random (16 chars)
+
+const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
+const TIME_LEN = 10;
+const RANDOM_LEN = 16;
+
+const getRandomChar = (): string => {
+ return ENCODING[Math.floor(Math.random() * ENCODING.length)];
+};
+
+const encodeTime = (now: number): string => {
+ let time = "";
+ let num = now;
+
+ for (let i = 0; i < TIME_LEN; i++) {
+ time = ENCODING[num % ENCODING.length] + time;
+ num = Math.floor(num / ENCODING.length);
+ }
+
+ return time;
+};
+
+const encodeRandom = (): string => {
+ let random = "";
+ for (let i = 0; i < RANDOM_LEN; i++) {
+ random += getRandomChar();
+ }
+ return random;
+};
+
+export const generateULID = (): string => {
+ const now = Date.now();
+ return encodeTime(now) + encodeRandom();
+};
diff --git a/src/app/globals.css b/src/app/globals.css
index d5fed93..9e826b6 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -2,6 +2,37 @@
@import "tw-animate-css";
@import "leaflet/dist/leaflet.css";
+/* Animation for chatbot widget slide-up */
+@keyframes slide-up {
+ from {
+ transform: translateY(100%);
+ opacity: 0;
+ }
+ to {
+ transform: translateY(0);
+ opacity: 1;
+ }
+}
+
+.animate-slide-up {
+ animation: slide-up 0.3s ease-out;
+}
+
+/* Subtle bounce animation for chat button */
+@keyframes bounce-subtle {
+ 0%,
+ 100% {
+ transform: translateY(0);
+ }
+ 50% {
+ transform: translateY(-5px);
+ }
+}
+
+.animate-bounce-subtle {
+ animation: bounce-subtle 2s ease-in-out infinite;
+}
+
/* بهبود responsive design برای موبایل */
html {
overflow-x: hidden;
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 87b953b..8018e89 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -10,6 +10,7 @@ import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import { viewport } from './viewport'
import { SHOP_CONFIG } from "@/config/const";
import ManageData from "@/components/ManageData";
+import FloatingChatButton from "./chatbot/components/FloatingChatButton";
export const metadata: Metadata = {
title: `${SHOP_CONFIG.fullName} | ${SHOP_CONFIG.englishName}`,
@@ -33,6 +34,7 @@ export default function RootLayout({
{children}
+
diff --git a/src/app/profile/orders/[id]/return/page.tsx b/src/app/profile/orders/[id]/return/page.tsx
index 2118b97..bdd3e7d 100644
--- a/src/app/profile/orders/[id]/return/page.tsx
+++ b/src/app/profile/orders/[id]/return/page.tsx
@@ -230,7 +230,7 @@ const ReturnPage: NextPage = () => {
returnReasons={returnReasons?.results.reasons || []}
onSubmit={handleFinalSubmit}
onBack={handleBackToStep2}
- isLoading={returnOrderMutation.isPending}
+ isLoading={returnOrderMutation.isPending || uploadImageMutation.isPending}
/>
)}