// import { IntlMessageFormat } from 'intl-messageformat';
// export function formatMessage(message: string, locale: string, variables: Record<string, any>) {
//   return new IntlMessageFormat(message, locale).format(variables);
// }
// TODO fix IntlMessageFormat
import { useState, useEffect, useCallback } from "@saasquatch/universal-hooks";
export function formatMessage(message, locale, variables) {
  return message + locale + variables;
}
export function isMobile(breakPoint) {
  const [width, setWidth] = useState(window.innerWidth);
  const handleWindowResize = useCallback(() => setWidth(window.innerWidth), []);
  useEffect(() => {
    window.addEventListener("resize", handleWindowResize);
    return () => window.removeEventListener("resize", handleWindowResize);
  }, []);
  return width > breakPoint ? false : true;
}
export function isValidColor(teststr) {
  return CSS.supports(`(color: ${teststr})`);
}
export function optional(property, value) {
  return value ? { [property]: value } : {};
}
export function isEmpty(value) {
  return (!value || (Object.keys(value).length === 0 && value.constructor === Object));
}
