This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | export const mapResponseToDTO = <T, U>( | |
| responseDTO: U, | |
| propertyMappings?: Record<string, keyof T> | |
| ): T => { | |
| // Create an empty object that will hold the mapped DTO | |
| const mappedDTO: Partial<T> = {}; | |
| // Loop through each property in the responseDTO | |
| for (const key in responseDTO) { | |
| // Check if propertyMappings exist and if the current key is in propertyMappings | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { PropsWithChildren, useRef } from "react"; | |
| import { UseFormRegisterReturn } from "react-hook-form"; | |
| type FileUploadProps = { | |
| register: UseFormRegisterReturn; | |
| accept?: string; | |
| }; | |
| export const FileUpload = (props:PropsWithChildren<FileUploadProps>) => { | |
| const { register, accept, children } = props; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import html2canvas from "html2canvas"; | |
| import { jsPDF } from "jspdf"; | |
| import { useState } from "react"; | |
| interface DownloadPDFProps { | |
| docName: string; | |
| id: string; | |
| width?: number; | |
| height?: number; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { useEffect, useState } from "react"; | |
| export const useDebounceValue = <T>(value: T, delay: number) => { | |
| const [debouncedValue, setDebounceValue] = useState<T>(value); | |
| useEffect(() => { | |
| const timer = setTimeout(() => { | |
| setDebounceValue(value); | |
| }, delay); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | export function deleteCookie(name: string) { | |
| if (typeof window !== "undefined") { | |
| const date = new Date(); | |
| // Set it expire in -1 days | |
| date.setTime(date.getTime() + -1 * 24 * 60 * 60 * 1000); | |
| // Set it | |
| document.cookie = name + "=; expires=" + date.toUTCString() + "; path=/"; | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | export function requireAuthentication< | |
| P extends Record<string, any> = Record<string, any>, | |
| Q extends ParsedUrlQuery = ParsedUrlQuery, | |
| D extends PreviewData = PreviewData, | |
| >(gssp: GetServerSideProps<P, Q, D>): GetServerSideProps<P, Q, D> { | |
| return async context => { | |
| const { req } = context; | |
| const token = req?.cookies?.b2bToken; | |
| if (!token) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | export const storage = { | |
| get: function (key: string) { | |
| try { | |
| let response = localStorage.getItem(key); | |
| return response ? JSON.parse(response) : null; | |
| } catch (error) { | |
| console.log(error); | |
| } | |
| }, | |
| post: <T>(key: string, value: T) => { |