hunk.code_window: import { Injectable } from '@nestjs/common';
   import { MessageTemplateEntity, MessageTemplateRepository } from '@novu/dal';
   import { ChangeEntityTypeEnum } from '@novu/shared';
   import { CreateMessageTemplateCommand } from './create-message-template.command';
   import { sanitizeMessageContent } from '../../shared/sanitizer.service';
   import { CreateChange, CreateChangeCommand } from '../../../change/usecases';
  
hunk.labels: keep keep replace keep keep keep keep
hunk.after_edit: import { ChangeEntityTypeEnum, TemplateVariableTypeEnum } from '@novu/shared';
  
hunk.file_path: apps/api/src/app/message-template/usecases/create-message-template/create-message-template.usecase.ts
hunk.type: replace
file: import { useEffect, useState } from 'react';
  
  export default function useDebounce(value, delay = 500) {
    const [debouncedValue, setDebouncedValue] = useState(value);
  
    useEffect(() => {
      const handler: NodeJS.Timeout = setTimeout(() => {
        setDebouncedValue(value);
      }, delay);
  
      // Cancel the timeout if value changes (also on delay change or unmount)
      return () => {
        clearTimeout(handler);
      };
    }, [value, delay]);
  
    return debouncedValue;
  }
  