| 910 | } |
| 911 | |
| 912 | export const removeLocalStorageChatHistory = (chatflowid) => { |
| 913 | const chatDetails = localStorage.getItem(`${chatflowid}_INTERNAL`) |
| 914 | if (!chatDetails) return |
| 915 | try { |
| 916 | const parsedChatDetails = JSON.parse(chatDetails) |
| 917 | if (parsedChatDetails.lead) { |
| 918 | // Dont remove lead when chat is cleared |
| 919 | const obj = { lead: parsedChatDetails.lead } |
| 920 | localStorage.removeItem(`${chatflowid}_INTERNAL`) |
| 921 | localStorage.setItem(`${chatflowid}_INTERNAL`, JSON.stringify(obj)) |
| 922 | } else { |
| 923 | localStorage.removeItem(`${chatflowid}_INTERNAL`) |
| 924 | } |
| 925 | } catch (e) { |
| 926 | return |
| 927 | } |
| 928 | } |
| 929 | |
| 930 | export const unshiftFiles = (configData) => { |
| 931 | const filesConfig = configData.find((config) => config.name === 'files') |