/* eslint-disable @wordpress/no-unsafe-wp-apis */ import { __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from "@wordpress/components"; import { useDeviceType } from "../../controls/controls"; // import Responsive from '../responsive/responsive'; import "./editor.scss"; import { memo } from "@wordpress/element"; import Responsive from "../responsive/responsive"; import { priceLink } from "../../blocks/shared/helpFn"; const SPToggleGroupControl = ({ attributes, attributesKey, setAttributes, label = "", items, border = false, flexStyle = false, onClick = false, hasDivider = true, extraClass = "", pro = false, }) => { // Device type const deviceType = useDeviceType(); // Update button group value const setButtonGroup = (newValue) => { if (attributes?.device) { setAttributes({ [attributesKey]: { ...attributes, device: { ...attributes.device, [deviceType]: newValue, }, }, }); } else { setAttributes({ [attributesKey]: newValue }); } }; // Get the active value const activeValue = attributes?.device ? attributes.device?.[deviceType] : attributes; // Handle button click const handleClick = (value) => { if (onClick) { onClick(value); } else { setButtonGroup(value); } }; return (