// #region [Imports] ===================================================================================================
// Libraries
import {useState} from "@wordpress/element";
import ServerSideRender from '@wordpress/server-side-render';
import {
Button,
Placeholder,
PanelBody,
ToolbarGroup,
withSpokenMessages
} from "@wordpress/components";
// @ts-ignore
import { BlockControls, InspectorControls, useBlockProps } from "@wordpress/block-editor";
// Components
import ContentSettingsControl from "../../components/ContentSettingsControl";
import CouponSearchControl from "../../components/CouponSearchControl";
// Types
import {IContentVisibility} from "../../types/settings";
// #endregion [Imports]
// #region [Variables] =================================================================================================
declare var acfwfBlocksi18n: any;
const {
singleCouponTexts,
contentDisplaySettings,
currentlySelectedCouponLabel,
doneBtnText
} = acfwfBlocksi18n;
// #endregion [Variables]
// #region [Interfaces] ================================================================================================
interface IAttributes {
coupon_id: number;
coupon_code: string;
contentVisibility: IContentVisibility;
}
interface IProps {
attributes: IAttributes;
name: string;
setAttributes: (IAttributes) => void;
}
// #endregion [Interfaces]
// #region [Component] =================================================================================================
const SingleCouponBlock = (props: IProps) => {
const {attributes, name, setAttributes} = props;
const [isEditing, setIsEditing]: [boolean, any] = useState(1 > attributes.coupon_id);
const setCouponId = (couponId: number) => {
setAttributes({coupon_id: couponId});
};
const blockProps = useBlockProps();
return (
<>
{singleCouponTexts.selectDesc}