import Button from "@/components/Button";
import Notice from "@/components/Notice";
import { spcApi } from "@/lib/api";
import { LINKS } from "@/lib/constants";
import { cn } from "@/lib/utils";
import { createInterpolateElement, useState } from "@wordpress/element";
import { __, sprintf } from "@wordpress/i18n";
import { Settings } from "lucide-react";
import { toast } from "sonner";
const PluginConflictsNotice = () => {
const {conflicts }= window.SPCDash;
const [isDismissed, setIsDismissed] = useState(false);
const [isVisible, setIsVisible] = useState(true);
const text = createInterpolateElement(
sprintf(
/* translators: %s: Plugin name/names */
__('We also detected %s active on your site. Running multiple caching plugins simultaneously may cause conflicts and reduce performance.', 'wp-cloudflare_page_cache'),
conflicts.map(conflict => `${conflict}`).join(', ')
), {
strong:
});
const handleDismiss = async () => {
const response = await spcApi.dismissNotice('conflicts');
if (response.success) {
setIsVisible(false);
window.SPCDash.conflicts = [];
setTimeout(() => {
setIsDismissed(true);
}, 300);
return;
}
toast.error(response.message);
}
if (isDismissed) {
return null;
}
return (
{text}
{__('For the best results, we recommend temporarily disabling other caching plugins to test Super Page Cache performance, or choose one primary caching solution.', 'wp-cloudflare_page_cache')}
);
};
export default PluginConflictsNotice;