| 1 |
/** |
| 2 |
* Schema Software Application Form Component |
| 3 |
* |
| 4 |
* Extracted from SchemaGeneration.js - handles software application schema form fields |
| 5 |
* |
| 6 |
* @package ThinkRank |
| 7 |
* @since 1.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
import { __ } from '@wordpress/i18n'; |
| 11 |
import { |
| 12 |
Card, |
| 13 |
CardBody, |
| 14 |
CardHeader, |
| 15 |
TextControl, |
| 16 |
TextareaControl, |
| 17 |
SelectControl, |
| 18 |
Flex, |
| 19 |
FlexItem, |
| 20 |
FormTokenField |
| 21 |
} from '@wordpress/components'; |
| 22 |
|
| 23 |
/** |
| 24 |
* Schema Software Application Form Component |
| 25 |
*/ |
| 26 |
const SchemaSoftwareForm = ({ |
| 27 |
settings, |
| 28 |
onSettingChange, |
| 29 |
isLoading |
| 30 |
}) => { |
| 31 |
return ( |
| 32 |
<Card size="small"> |
| 33 |
<CardHeader> |
| 34 |
<h4>💻 {__('Software Application Configuration', 'thinkrank')}</h4> |
| 35 |
</CardHeader> |
| 36 |
<CardBody> |
| 37 |
<Flex direction="column" gap={4}> |
| 38 |
{/* Basic Information */} |
| 39 |
<div> |
| 40 |
<h5 style={{ margin: '0 0 12px 0', fontSize: '14px', fontWeight: '600', color: '#1e1e1e' }}> |
| 41 |
{__('Basic Information', 'thinkrank')} |
| 42 |
</h5> |
| 43 |
<Flex direction="column" gap={3}> |
| 44 |
<TextControl |
| 45 |
label={__('Application Name', 'thinkrank')} |
| 46 |
value={settings.software_name || ''} |
| 47 |
onChange={(value) => onSettingChange('software_name', value)} |
| 48 |
help={__('Full name of the software application', 'thinkrank')} |
| 49 |
disabled={!settings.enabled} |
| 50 |
__next40pxDefaultSize={true} |
| 51 |
__nextHasNoMarginBottom={true} |
| 52 |
/> |
| 53 |
<TextControl |
| 54 |
label={__('Tagline/Alternate Name', 'thinkrank')} |
| 55 |
value={settings.software_alternate_name || ''} |
| 56 |
onChange={(value) => onSettingChange('software_alternate_name', value)} |
| 57 |
help={__('Tagline or alternate name (e.g., "Design Made Simple", "Code Without Limits")', 'thinkrank')} |
| 58 |
disabled={!settings.enabled} |
| 59 |
__next40pxDefaultSize={true} |
| 60 |
__nextHasNoMarginBottom={true} |
| 61 |
/> |
| 62 |
<Flex gap={2}> |
| 63 |
<FlexItem> |
| 64 |
<TextControl |
| 65 |
label={__('Version', 'thinkrank')} |
| 66 |
value={settings.software_version || ''} |
| 67 |
onChange={(value) => onSettingChange('software_version', value)} |
| 68 |
help={__('Current version (e.g., 2.1.0, v1.5)', 'thinkrank')} |
| 69 |
disabled={!settings.enabled} |
| 70 |
__next40pxDefaultSize={true} |
| 71 |
__nextHasNoMarginBottom={true} |
| 72 |
/> |
| 73 |
</FlexItem> |
| 74 |
<FlexItem> |
| 75 |
<TextControl |
| 76 |
label={__('Website URL', 'thinkrank')} |
| 77 |
type="url" |
| 78 |
value={settings.software_url || ''} |
| 79 |
onChange={(value) => onSettingChange('software_url', value)} |
| 80 |
help={__('Official application website', 'thinkrank')} |
| 81 |
disabled={!settings.enabled} |
| 82 |
__next40pxDefaultSize={true} |
| 83 |
__nextHasNoMarginBottom={true} |
| 84 |
/> |
| 85 |
</FlexItem> |
| 86 |
</Flex> |
| 87 |
<Flex gap={4} align="flex-start"> |
| 88 |
<FlexItem style={{ flex: '2' }}> |
| 89 |
<TextControl |
| 90 |
label={__('Creator/Developer', 'thinkrank')} |
| 91 |
value={settings.software_creator || ''} |
| 92 |
onChange={(value) => onSettingChange('software_creator', value)} |
| 93 |
help={__('Name of the person or organization who created this software', 'thinkrank')} |
| 94 |
disabled={!settings.enabled} |
| 95 |
__next40pxDefaultSize={true} |
| 96 |
__nextHasNoMarginBottom={true} |
| 97 |
/> |
| 98 |
</FlexItem> |
| 99 |
<FlexItem style={{ flex: '1' }}> |
| 100 |
<SelectControl |
| 101 |
label={__('Creator Type', 'thinkrank')} |
| 102 |
value={settings.software_creator_type || 'Person'} |
| 103 |
options={[ |
| 104 |
{ value: 'Person', label: __('Person', 'thinkrank') }, |
| 105 |
{ value: 'Organization', label: __('Organization', 'thinkrank') } |
| 106 |
]} |
| 107 |
onChange={(value) => onSettingChange('software_creator_type', value)} |
| 108 |
help={__('Whether the creator is a person or organization', 'thinkrank')} |
| 109 |
disabled={!settings.enabled} |
| 110 |
__next40pxDefaultSize={true} |
| 111 |
__nextHasNoMarginBottom={true} |
| 112 |
/> |
| 113 |
</FlexItem> |
| 114 |
</Flex> |
| 115 |
<TextareaControl |
| 116 |
label={__('Description', 'thinkrank')} |
| 117 |
value={settings.software_description || ''} |
| 118 |
onChange={(value) => onSettingChange('software_description', value)} |
| 119 |
help={__('Detailed description of features and functionality', 'thinkrank')} |
| 120 |
disabled={!settings.enabled} |
| 121 |
rows={3} |
| 122 |
__nextHasNoMarginBottom={true} |
| 123 |
/> |
| 124 |
</Flex> |
| 125 |
</div> |
| 126 |
|
| 127 |
{/* Technical Specifications */} |
| 128 |
<div> |
| 129 |
<h5 style={{ margin: '0 0 12px 0', fontSize: '14px', fontWeight: '600', color: '#1e1e1e' }}> |
| 130 |
{__('Technical Specifications', 'thinkrank')} |
| 131 |
</h5> |
| 132 |
<Flex direction="column" gap={3}> |
| 133 |
<div> |
| 134 |
<label style={{ display: 'block', marginBottom: '8px', fontWeight: '500' }}> |
| 135 |
{__('Operating Systems', 'thinkrank')} |
| 136 |
</label> |
| 137 |
<FormTokenField |
| 138 |
value={settings.software_operating_systems || []} |
| 139 |
suggestions={[ |
| 140 |
'Windows', 'macOS', 'Linux', 'Ubuntu', 'Debian', 'CentOS', 'Fedora', |
| 141 |
'iOS', 'Android', 'Chrome OS', 'Web Browser', 'Cross-platform' |
| 142 |
]} |
| 143 |
onChange={(tokens) => onSettingChange('software_operating_systems', tokens)} |
| 144 |
placeholder={__('Type and press Enter to add OS (e.g., Windows, macOS, Linux)', 'thinkrank')} |
| 145 |
disabled={!settings.enabled} |
| 146 |
__experimentalExpandOnFocus={true} |
| 147 |
__experimentalShowHowTo={false} |
| 148 |
__next40pxDefaultSize={true} |
| 149 |
__nextHasNoMarginBottom={true} |
| 150 |
/> |
| 151 |
<p style={{ fontSize: '12px', color: '#666', margin: '4px 0 0 0' }}> |
| 152 |
{__('Select multiple operating systems that support this application', 'thinkrank')} |
| 153 |
</p> |
| 154 |
</div> |
| 155 |
<Flex gap={2}> |
| 156 |
<FlexItem> |
| 157 |
<TextControl |
| 158 |
label={__('File Size', 'thinkrank')} |
| 159 |
value={settings.software_file_size || ''} |
| 160 |
onChange={(value) => onSettingChange('software_file_size', value)} |
| 161 |
help={__('Download size (e.g., 25MB, 1.2GB)', 'thinkrank')} |
| 162 |
disabled={!settings.enabled} |
| 163 |
__next40pxDefaultSize={true} |
| 164 |
__nextHasNoMarginBottom={true} |
| 165 |
/> |
| 166 |
</FlexItem> |
| 167 |
<FlexItem> |
| 168 |
<SelectControl |
| 169 |
label={__('License Type', 'thinkrank')} |
| 170 |
value={settings.software_license || ''} |
| 171 |
options={[ |
| 172 |
{ value: '', label: __('Select License', 'thinkrank') }, |
| 173 |
{ value: 'Free', label: __('Free', 'thinkrank') }, |
| 174 |
{ value: 'Freemium', label: __('Freemium', 'thinkrank') }, |
| 175 |
{ value: 'Paid', label: __('Paid', 'thinkrank') }, |
| 176 |
{ value: 'Subscription', label: __('Subscription', 'thinkrank') }, |
| 177 |
{ value: 'Open Source', label: __('Open Source', 'thinkrank') }, |
| 178 |
{ value: 'Trial', label: __('Free Trial', 'thinkrank') } |
| 179 |
]} |
| 180 |
onChange={(value) => onSettingChange('software_license', value)} |
| 181 |
disabled={!settings.enabled} |
| 182 |
__next40pxDefaultSize={true} |
| 183 |
__nextHasNoMarginBottom={true} |
| 184 |
/> |
| 185 |
</FlexItem> |
| 186 |
</Flex> |
| 187 |
</Flex> |
| 188 |
</div> |
| 189 |
|
| 190 |
{/* Category & Features */} |
| 191 |
<div> |
| 192 |
<h5 style={{ margin: '0 0 12px 0', fontSize: '14px', fontWeight: '600', color: '#1e1e1e' }}> |
| 193 |
{__('Category & Features', 'thinkrank')} |
| 194 |
</h5> |
| 195 |
<Flex direction="column" gap={3}> |
| 196 |
<SelectControl |
| 197 |
label={__('Application Category', 'thinkrank')} |
| 198 |
value={settings.software_category || ''} |
| 199 |
options={[ |
| 200 |
{ value: '', label: __('Select Category', 'thinkrank') }, |
| 201 |
{ value: 'BusinessApplication', label: __('Business & Productivity', 'thinkrank') }, |
| 202 |
{ value: 'GameApplication', label: __('Games & Entertainment', 'thinkrank') }, |
| 203 |
{ value: 'MultimediaApplication', label: __('Multimedia & Graphics', 'thinkrank') }, |
| 204 |
{ value: 'MobileApplication', label: __('Mobile App', 'thinkrank') }, |
| 205 |
{ value: 'WebApplication', label: __('Web Application', 'thinkrank') }, |
| 206 |
{ value: 'DesktopEnhancementApplication', label: __('Desktop Enhancement', 'thinkrank') }, |
| 207 |
{ value: 'EducationalApplication', label: __('Educational', 'thinkrank') }, |
| 208 |
{ value: 'DeveloperApplication', label: __('Developer Tools', 'thinkrank') }, |
| 209 |
{ value: 'SecurityApplication', label: __('Security & Privacy', 'thinkrank') }, |
| 210 |
{ value: 'UtilitiesApplication', label: __('Utilities & System', 'thinkrank') } |
| 211 |
]} |
| 212 |
onChange={(value) => onSettingChange('software_category', value)} |
| 213 |
help={__('Primary category that best describes your application', 'thinkrank')} |
| 214 |
disabled={!settings.enabled} |
| 215 |
__next40pxDefaultSize={true} |
| 216 |
__nextHasNoMarginBottom={true} |
| 217 |
/> |
| 218 |
<div> |
| 219 |
<label style={{ display: 'block', marginBottom: '8px', fontWeight: '500' }}> |
| 220 |
{__('Key Features', 'thinkrank')} |
| 221 |
</label> |
| 222 |
<FormTokenField |
| 223 |
value={settings.software_features || []} |
| 224 |
onChange={(tokens) => onSettingChange('software_features', tokens)} |
| 225 |
placeholder={__('Type and press Enter to add features', 'thinkrank')} |
| 226 |
disabled={!settings.enabled} |
| 227 |
__experimentalExpandOnFocus={true} |
| 228 |
__experimentalShowHowTo={false} |
| 229 |
__next40pxDefaultSize={true} |
| 230 |
__nextHasNoMarginBottom={true} |
| 231 |
/> |
| 232 |
<p style={{ fontSize: '12px', color: '#666', margin: '4px 0 0 0' }}> |
| 233 |
{__('List key features and capabilities (e.g., "User-friendly interface", "Cloud synchronization", "Advanced reporting")', 'thinkrank')} |
| 234 |
</p> |
| 235 |
</div> |
| 236 |
</Flex> |
| 237 |
</div> |
| 238 |
|
| 239 |
{/* Pricing & Availability */} |
| 240 |
<div> |
| 241 |
<h5 style={{ margin: '0 0 12px 0', fontSize: '14px', fontWeight: '600', color: '#1e1e1e' }}> |
| 242 |
{__('Pricing & Availability', 'thinkrank')} |
| 243 |
</h5> |
| 244 |
<Flex direction="column" gap={3}> |
| 245 |
<Flex gap={2}> |
| 246 |
<FlexItem> |
| 247 |
<TextControl |
| 248 |
label={__('Price', 'thinkrank')} |
| 249 |
type="number" |
| 250 |
step="0.01" |
| 251 |
min="0" |
| 252 |
value={settings.software_price || ''} |
| 253 |
onChange={(value) => onSettingChange('software_price', value)} |
| 254 |
help={__('Price (0 for free apps)', 'thinkrank')} |
| 255 |
disabled={!settings.enabled} |
| 256 |
__next40pxDefaultSize={true} |
| 257 |
__nextHasNoMarginBottom={true} |
| 258 |
/> |
| 259 |
</FlexItem> |
| 260 |
<FlexItem> |
| 261 |
<SelectControl |
| 262 |
label={__('Currency', 'thinkrank')} |
| 263 |
value={settings.software_currency || 'USD'} |
| 264 |
options={[ |
| 265 |
{ value: 'USD', label: 'USD ($)' }, |
| 266 |
{ value: 'EUR', label: 'EUR (€)' }, |
| 267 |
{ value: 'GBP', label: 'GBP (£)' }, |
| 268 |
{ value: 'CAD', label: 'CAD (C$)' }, |
| 269 |
{ value: 'AUD', label: 'AUD (A$)' } |
| 270 |
]} |
| 271 |
onChange={(value) => onSettingChange('software_currency', value)} |
| 272 |
disabled={!settings.enabled} |
| 273 |
__next40pxDefaultSize={true} |
| 274 |
__nextHasNoMarginBottom={true} |
| 275 |
/> |
| 276 |
</FlexItem> |
| 277 |
</Flex> |
| 278 |
<Flex gap={2}> |
| 279 |
<FlexItem> |
| 280 |
<TextControl |
| 281 |
label={__('Price Valid Until', 'thinkrank')} |
| 282 |
type="date" |
| 283 |
value={settings.software_price_valid_until || ''} |
| 284 |
onChange={(value) => onSettingChange('software_price_valid_until', value)} |
| 285 |
help={__('When this price expires (optional)', 'thinkrank')} |
| 286 |
disabled={!settings.enabled} |
| 287 |
__next40pxDefaultSize={true} |
| 288 |
__nextHasNoMarginBottom={true} |
| 289 |
/> |
| 290 |
</FlexItem> |
| 291 |
<FlexItem> |
| 292 |
<SelectControl |
| 293 |
label={__('Availability', 'thinkrank')} |
| 294 |
value={settings.software_availability || 'InStock'} |
| 295 |
options={[ |
| 296 |
{ value: 'InStock', label: __('Available', 'thinkrank') }, |
| 297 |
{ value: 'OutOfStock', label: __('Not Available', 'thinkrank') }, |
| 298 |
{ value: 'PreOrder', label: __('Pre-Order', 'thinkrank') }, |
| 299 |
{ value: 'ComingSoon', label: __('Coming Soon', 'thinkrank') } |
| 300 |
]} |
| 301 |
onChange={(value) => onSettingChange('software_availability', value)} |
| 302 |
disabled={!settings.enabled} |
| 303 |
__next40pxDefaultSize={true} |
| 304 |
__nextHasNoMarginBottom={true} |
| 305 |
/> |
| 306 |
</FlexItem> |
| 307 |
</Flex> |
| 308 |
<TextareaControl |
| 309 |
label={__('Pricing Description', 'thinkrank')} |
| 310 |
value={settings.software_pricing_description || ''} |
| 311 |
onChange={(value) => onSettingChange('software_pricing_description', value)} |
| 312 |
help={__('Describe pricing model (e.g., "Free version available with premium features", "One-time purchase with lifetime updates")', 'thinkrank')} |
| 313 |
disabled={!settings.enabled} |
| 314 |
rows={2} |
| 315 |
__nextHasNoMarginBottom={true} |
| 316 |
/> |
| 317 |
</Flex> |
| 318 |
</div> |
| 319 |
|
| 320 |
{/* Optional: User Ratings */} |
| 321 |
<div> |
| 322 |
<h5 style={{ margin: '0 0 12px 0', fontSize: '14px', fontWeight: '600', color: '#1e1e1e' }}> |
| 323 |
{__('User Ratings (Optional)', 'thinkrank')} |
| 324 |
</h5> |
| 325 |
<Flex direction="column" gap={3}> |
| 326 |
<Flex gap={2}> |
| 327 |
<FlexItem> |
| 328 |
<TextControl |
| 329 |
label={__('Average Rating', 'thinkrank')} |
| 330 |
type="number" |
| 331 |
step="0.1" |
| 332 |
min="1" |
| 333 |
max="5" |
| 334 |
value={settings.software_rating_value || ''} |
| 335 |
onChange={(value) => onSettingChange('software_rating_value', value)} |
| 336 |
help={__('Average rating (1-5 scale)', 'thinkrank')} |
| 337 |
disabled={!settings.enabled} |
| 338 |
__next40pxDefaultSize={true} |
| 339 |
__nextHasNoMarginBottom={true} |
| 340 |
/> |
| 341 |
</FlexItem> |
| 342 |
<FlexItem> |
| 343 |
<TextControl |
| 344 |
label={__('Total Reviews', 'thinkrank')} |
| 345 |
type="number" |
| 346 |
min="0" |
| 347 |
value={settings.software_rating_count || ''} |
| 348 |
onChange={(value) => onSettingChange('software_rating_count', value)} |
| 349 |
help={__('Number of reviews/ratings', 'thinkrank')} |
| 350 |
disabled={!settings.enabled} |
| 351 |
__next40pxDefaultSize={true} |
| 352 |
__nextHasNoMarginBottom={true} |
| 353 |
/> |
| 354 |
</FlexItem> |
| 355 |
</Flex> |
| 356 |
<p style={{ fontSize: '12px', color: '#666', margin: '0' }}> |
| 357 |
{__('Leave empty if you don\'t have user ratings data', 'thinkrank')} |
| 358 |
</p> |
| 359 |
</Flex> |
| 360 |
</div> |
| 361 |
</Flex> |
| 362 |
</CardBody> |
| 363 |
</Card> |
| 364 |
); |
| 365 |
}; |
| 366 |
|
| 367 |
export default SchemaSoftwareForm; |
| 368 |
|