// #region [Imports] =================================================================================================== // Libraries import { Select, InputNumber } from 'antd'; // Components import DebounceSelect from '../../../../../components/DebounceSelect'; // Types import { ICartConditionField } from '../../../../../types/couponTemplates'; import { IFieldOption } from '../../../../../types/fields'; // Helpers import { getConditionOptions } from '../../../../../helpers/utils'; // #endregion [Imports] // #region [Variables] ================================================================================================= declare var acfwAdminApp: any; declare var ajaxurl: any; // #endregion [Variables] // #region [Interfaces]================================================================================================= interface IFieldData { condition: string; quantity: string; value: number[]; } interface IProps { field: ICartConditionField; onChange: (data: IFieldData) => void; } // #endregion [Interfaces] // #region [Component] ================================================================================================= const CustomTaxonomyExistsInCart = (props: IProps) => { const { field, onChange } = props; const { labels } = acfwAdminApp.coupon_templates_page; const searchCategories = async (value: string) => { const response = await jQuery.ajax({ url: ajaxurl, type: 'GET', data: { action: 'woocommerce_json_search_taxonomy_terms', term: value, taxonomy: 'product_cat', security: acfwAdminApp.nonces.search_taxonomy_terms, exclude: field.data.value, }, }); return Object.keys(response).map((key) => ({ label: response[key].name, value: response[key].term_id, })); }; const handleChange = (dataKey: string, value: any) => { const data = { ...field.data, [dataKey]: value }; onChange(data); }; return (

{field.i18n.title}

handleChange( 'value', value.map((v) => v.value) ) } />