import React, {useReducer} from "react"; import localizeSettings from "./localizeSettings"; import {__} from "@wordpress/i18n"; import {Button} from "@wordpress/components"; import {external} from "@wordpress/icons"; import DisplayShopLabelTooltip from "../components/DisplayShopLabelTooltip"; import ProductConditionTooltip from "../components/ProductConditionTooltip"; import DisplayShopLabelNotice from "../components/DisplayShopLabelNotice"; import SchemaConditionTooltip from "../components/SchemaConditionTooltip"; import LockIcon from "../components/LockIcon"; import {FreemiusOverlay} from "../components/FreemiusOverlay"; const {DOCUMENTATION, conditions, settings, globalSettings} = localizeSettings; type State = { hulk_woo_pcm_productCondition: string; hulk_woo_pcm_productConditionCustom: string; hulk_woo_pcm_productConditionCustomGroup: string; hulk_woo_pcm_productConditionLabel: string; hulk_woo_pcm_productConditionShopLabel: string; }; type Action = Partial; const ProductDataMetaSettings = () => { const [state, dispatch] = useReducer( (prevState: State, action: Action) => ({...prevState, ...action}), { hulk_woo_pcm_productCondition: "", hulk_woo_pcm_productConditionCustom: "", hulk_woo_pcm_productConditionCustomGroup: "", hulk_woo_pcm_productConditionLabel: "", hulk_woo_pcm_productConditionShopLabel: "", ...settings, }, ); return ( <>
 
{state.hulk_woo_pcm_productCondition && ( <> {state.hulk_woo_pcm_productCondition === "other" && (
{__( "Read more", "product-condition-manager-for-woocommerce", )}
{ dispatch({ hulk_woo_pcm_productConditionCustom: event.target .value, }); }} />
)}
{ dispatch({ hulk_woo_pcm_productConditionLabel: event.target.value, }); }} type="text" placeholder={__( "Product Condition:", "product-condition-manager-for-woocommerce", )} />
{ dispatch({ hulk_woo_pcm_productConditionShopLabel: event.target.value, }); }} type="text" placeholder={__( "Product Condition:", "product-condition-manager-for-woocommerce", )} readOnly={ !globalSettings.showOnShopPage } /> {!globalSettings.showOnShopPage && ( )}
)}
); }; export default ProductDataMetaSettings;