| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace RadiusTheme\SB\Models; |
| 4 | 4 | |
| 5 | -use RadiusTheme\SB\AI\AIFns; | |
| 5 | +// use RadiusTheme\SB\Helpers\Fns; | |
| 6 | +use RadiusTheme\SB\Elementor\Helper\ControlHelper; | |
| 6 | 7 | use RadiusTheme\SB\Helpers\Fns; |
| 7 | -use RadiusTheme\SB\Helpers\SvgIcons; | |
| 8 | 8 | use RadiusTheme\SB\Models\Base\ListModel; |
| 9 | 9 | use RadiusTheme\SB\Traits\SingletonTrait; |
| 10 | 10 | |
| 11 | 11 | defined( 'ABSPATH' ) || exit; |
| @@ -51,403 +51,15 @@ | ||
| 51 | 51 | * @return array |
| 52 | 52 | */ |
| 53 | 53 | protected function raw_list() { |
| 54 | 54 | $list = [ |
| 55 | - 'optimization' => apply_filters( | |
| 56 | - 'rtsb/settings/optimization/options', | |
| 57 | - [ | |
| 58 | - 'id' => 'optimization', | |
| 59 | - 'icon' => SvgIcons::get( 'optimization' ), | |
| 60 | - 'category' => 'general', | |
| 61 | - 'title' => esc_html__( 'Advanced Optimizations', 'shopbuilder' ), | |
| 62 | - 'package' => $this->pro_version_checker(), | |
| 63 | - 'badge' => 'new', | |
| 64 | - 'links' => [ | |
| 65 | - 'doc' => '', | |
| 66 | - 'video' => '', | |
| 67 | - ], | |
| 68 | - 'active_field' => [ | |
| 69 | - 'disable' => true, | |
| 70 | - ], | |
| 71 | - 'fields' => [ | |
| 72 | - 'optimization_intro' => [ | |
| 73 | - 'id' => 'optimization_intro', | |
| 74 | - 'type' => 'description', | |
| 75 | - 'text' => __( 'Optimize your website for maximum performance from these advanced options. <br /> <span style="color: #dc3545; display: block; margin-top: 10px;">⚠️ Note: After enabling or disabling any of these settings, clear the ShopBuilder cache to ensure changes are applied correctly.</span> <span style="color: #16a34a; display: block; margin-top: 10px;">✅ Recommended: Keep Asset Optimization enabled on live/production sites for faster loading. Turn it off only while troubleshooting or verifying a recent change.</span>', 'shopbuilder' ), | |
| 76 | - ], | |
| 77 | - 'enable_optimization' => [ | |
| 78 | - 'id' => 'enable', | |
| 79 | - 'type' => 'switch', | |
| 80 | - 'value' => 'on', | |
| 81 | - 'label' => esc_html__( 'Enable Asset Optimization?', 'shopbuilder' ), | |
| 82 | - 'help' => esc_html__( 'Enable this option to dynamically load assets (styles, scripts) only when needed, helping to optimize your website\'s performance', 'shopbuilder' ), | |
| 83 | - ], | |
| 84 | - 'load_elementor_scripts' => [ | |
| 85 | - 'id' => 'enable', | |
| 86 | - 'type' => 'switch', | |
| 87 | - 'label' => esc_html__( 'Load Elementor Assets?', 'shopbuilder' ), | |
| 88 | - 'help' => __( 'Enable this option to load necessary Elementor assets on your website. <br /> <span style="color: #dc3545;">Turn this off if you are not using Elementor widgets to optimize site performance.</span>', 'shopbuilder' ), | |
| 89 | - 'value' => 'on', | |
| 90 | - 'dependency' => [ | |
| 91 | - 'rules' => [ | |
| 92 | - [ | |
| 93 | - 'item' => 'general.optimization.enable_optimization', | |
| 94 | - 'value' => 'on', | |
| 95 | - 'operator' => '==', | |
| 96 | - ], | |
| 97 | - ], | |
| 98 | - ], | |
| 99 | - ], | |
| 100 | - 'context_asset_loading' => [ | |
| 101 | - 'id' => 'enable', | |
| 102 | - 'type' => 'switch', | |
| 103 | - 'label' => esc_html__( 'Context-Aware Asset Loading?', 'shopbuilder' ), | |
| 104 | - 'help' => esc_html__( 'Enable this option to dynamically Load only the necessary CSS and JS for each page type (e.g., product, cart, checkout). Disabling this option will include all assets globally on every page.', 'shopbuilder' ), | |
| 105 | - 'dependency' => [ | |
| 106 | - 'rules' => [ | |
| 107 | - [ | |
| 108 | - 'item' => 'general.optimization.enable_optimization', | |
| 109 | - 'value' => 'on', | |
| 110 | - 'operator' => '==', | |
| 111 | - ], | |
| 112 | - ], | |
| 113 | - ], | |
| 114 | - ], | |
| 115 | - 'wp_rocket_compatibility' => [ | |
| 116 | - 'id' => 'wp_rocket_compatibility', | |
| 117 | - 'type' => 'switch', | |
| 118 | - 'label' => esc_html__( 'WP Rocket Compatibility', 'shopbuilder' ), | |
| 119 | - 'help' => esc_html__( 'Enable this option to ensure compatibility with the WP Rocket plugin for optimized asset loading.', 'shopbuilder' ), | |
| 120 | - ], | |
| 121 | - | |
| 122 | - 'remove_pre_loader' => [ | |
| 123 | - 'id' => 'remove_pre_loader', | |
| 124 | - 'type' => 'switch', | |
| 125 | - 'label' => esc_html__( 'Disable Element Preloader', 'shopbuilder' ), | |
| 126 | - 'help' => esc_html__( 'Enable this option to remove the element preloader.', 'shopbuilder' ), | |
| 127 | - ], | |
| 128 | - /** | |
| 129 | - 'load_gutenberg_scripts' => [ | |
| 130 | - 'id' => 'enable', | |
| 131 | - 'type' => 'switch', | |
| 132 | - 'label' => esc_html__( 'Load Gutenberg Scripts?', 'shopbuilder' ), | |
| 133 | - 'help' => esc_html__( 'Switch on to load elementor scripts by dynamically loading scripts', 'shopbuilder' ), | |
| 134 | - ], | |
| 135 | - */ | |
| 136 | - ], | |
| 137 | - ], | |
| 138 | - ), | |
| 139 | - 'ai_implementation' => apply_filters( | |
| 140 | - 'rtsb/settings/ai_implementation/options', | |
| 141 | - [ | |
| 142 | - 'id' => 'ai_implementation', | |
| 143 | - 'icon' => SvgIcons::get( 'ai_implementation' ), | |
| 144 | - 'category' => 'general', | |
| 145 | - 'title' => esc_html__( 'AI-implementation', 'shopbuilder' ), | |
| 146 | - 'package' => 'free', | |
| 147 | - 'badge' => 'beta', | |
| 148 | - 'links' => [ | |
| 149 | - 'doc' => '', | |
| 150 | - 'video' => '', | |
| 151 | - ], | |
| 152 | - 'active_field' => [ | |
| 153 | - 'disable' => true, | |
| 154 | - ], | |
| 155 | - 'fields' => [ | |
| 156 | - 'data_ai_feature_beta_message' => [ | |
| 157 | - 'id' => 'data_ai_feature_beta_message', | |
| 158 | - 'type' => 'description', | |
| 159 | - 'text' => esc_html__( '🧠 AI feature is in beta — stable and fully functional, with more enhancements coming soon.', 'shopbuilder' ), | |
| 160 | - ], | |
| 161 | - 'ai_tools' => [ | |
| 162 | - 'id' => 'ai_tools', | |
| 163 | - 'label' => esc_html__( 'AI Tools', 'shopbuilder' ), | |
| 164 | - 'type' => 'select', | |
| 165 | - 'value' => '', | |
| 166 | - 'options' => [ | |
| 167 | - '' => esc_html__( '----', 'shopbuilder' ), | |
| 168 | - 'OpenAI' => esc_html__( 'ChatGPT', 'shopbuilder' ), | |
| 169 | - 'Gemini' => esc_html__( 'Google Gemini', 'shopbuilder' ), | |
| 170 | - // phpcs:ignore Generic.Commenting | |
| 171 | - // DeepSeek' => esc_html__( 'DeepSeek', 'shopbuilder' ), . | |
| 172 | - ], | |
| 173 | - ], | |
| 174 | - // GPT. | |
| 175 | - 'gpt_models' => [ | |
| 176 | - 'id' => 'gpt_models', | |
| 177 | - 'label' => esc_html__( 'GPT Model', 'shopbuilder' ), | |
| 178 | - 'type' => 'select', | |
| 179 | - 'value' => 'gpt-4o', | |
| 180 | - 'options' => [ | |
| 181 | - 'gpt-4o' => esc_html__( 'GPT-4o (Full Version)', 'shopbuilder' ), | |
| 182 | - 'gpt-4o-mini' => esc_html__( 'GPT-4o Mini (Light Version)', 'shopbuilder' ), | |
| 183 | - ], | |
| 184 | - 'dependency' => [ | |
| 185 | - 'rules' => [ | |
| 186 | - [ | |
| 187 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 188 | - 'value' => 'OpenAI', | |
| 189 | - 'operator' => '==', | |
| 190 | - ], | |
| 191 | - ], | |
| 192 | - ], | |
| 193 | - ], | |
| 194 | - 'gpt_api_key' => [ | |
| 195 | - 'id' => 'gpt_api_key', | |
| 196 | - 'label' => esc_html__( 'ChatGPT API Key', 'shopbuilder' ), | |
| 197 | - 'type' => 'password', | |
| 198 | - 'placeholder' => esc_html__( 'sk-p********', 'shopbuilder' ), | |
| 199 | - 'help' => wp_kses( | |
| 200 | - __( | |
| 201 | - 'To integrate with ChatGPT, you need to obtain an API key from OpenAI. Visit <a href="https://platform.openai.com/account/api-keys" target="_blank">OpenAI API Keys</a> to generate one.', | |
| 202 | - 'shopbuilder' | |
| 203 | - ), | |
| 204 | - [ | |
| 205 | - 'a' => [ | |
| 206 | - 'href' => [], | |
| 207 | - 'target' => [], | |
| 208 | - ], | |
| 209 | - ] | |
| 210 | - ), | |
| 211 | - 'dependency' => [ | |
| 212 | - 'rules' => [ | |
| 213 | - [ | |
| 214 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 215 | - 'value' => 'OpenAI', | |
| 216 | - 'operator' => '==', | |
| 217 | - ], | |
| 218 | - ], | |
| 219 | - ], | |
| 220 | - ], | |
| 221 | - 'gpt_max_token' => [ | |
| 222 | - 'id' => 'gpt_max_token', | |
| 223 | - 'label' => esc_html__( 'ChatGPT Maximum Characters in Prompt Input', 'shopbuilder' ), | |
| 224 | - 'type' => 'number', | |
| 225 | - 'help' => esc_html__( | |
| 226 | - 'Set the maximum character limit for the prompt input. This controls how many characters users can enter, ensuring input stays concise and manageable. Higher limits may affect performance and response quality.', | |
| 227 | - 'shopbuilder' | |
| 228 | - ), | |
| 229 | - 'value' => 200, | |
| 230 | - 'placeholder' => esc_html__( '200', 'shopbuilder' ), | |
| 231 | - 'dependency' => [ | |
| 232 | - 'rules' => [ | |
| 233 | - [ | |
| 234 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 235 | - 'value' => 'OpenAI', | |
| 236 | - 'operator' => '==', | |
| 237 | - ], | |
| 238 | - ], | |
| 239 | - ], | |
| 240 | - ], | |
| 241 | - // Gemini. | |
| 242 | - 'gemini_api_key' => [ | |
| 243 | - 'id' => 'gemini_api_key', | |
| 244 | - 'label' => esc_html__( 'Gemini API Key', 'shopbuilder' ), | |
| 245 | - 'type' => 'password', | |
| 246 | - 'placeholder' => esc_html__( 'AIzaSy***********************', 'shopbuilder' ), | |
| 247 | - 'help' => wp_kses( | |
| 248 | - __( | |
| 249 | - 'To integrate with Google Gemini, you need to obtain an API key from Google Cloud. Visit <a href="https://makersuite.google.com/app/apikey" target="_blank">Google AI Studio API Keys</a> to generate one.', | |
| 250 | - 'shopbuilder' | |
| 251 | - ), | |
| 252 | - [ | |
| 253 | - 'a' => [ | |
| 254 | - 'href' => [], | |
| 255 | - 'target' => [], | |
| 256 | - ], | |
| 257 | - ] | |
| 258 | - ), | |
| 259 | - 'dependency' => [ | |
| 260 | - 'rules' => [ | |
| 261 | - [ | |
| 262 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 263 | - 'value' => 'Gemini', | |
| 264 | - 'operator' => '==', | |
| 265 | - ], | |
| 266 | - ], | |
| 267 | - ], | |
| 268 | - ], | |
| 269 | - /** | |
| 270 | - * User Will Not Understand how Its Works. | |
| 271 | - 'gemini_models' => [ | |
| 272 | - 'id' => 'gemini_models', | |
| 273 | - 'label' => esc_html__( 'Gemini Model', 'shopbuilder' ), | |
| 274 | - 'type' => 'select', | |
| 275 | - 'value' => 'gemini-2.5-flash', | |
| 276 | - 'options' => [ | |
| 277 | - 'gemini-2.5-flash' => esc_html__( 'Gemini 2.5 Flash', 'shopbuilder' ), | |
| 278 | - 'gemini-2.5-pro' => esc_html__( 'Gemini 2.5 Pro', 'shopbuilder' ), | |
| 279 | - ], | |
| 280 | - 'dependency' => [ | |
| 281 | - 'rules' => [ | |
| 282 | - [ | |
| 283 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 284 | - 'value' => 'Gemini', | |
| 285 | - 'operator' => '==', | |
| 286 | - ], | |
| 287 | - ], | |
| 288 | - ], | |
| 289 | - ], | |
| 290 | - */ | |
| 291 | - 'gemini_max_token' => [ | |
| 292 | - 'id' => 'gemini_max_token', | |
| 293 | - 'label' => esc_html__( 'Gemini Maximum Characters', 'shopbuilder' ), | |
| 294 | - 'type' => 'number', | |
| 295 | - 'help' => esc_html__( | |
| 296 | - 'Set the maximum character limit for Gemini model prompts. Adjust according to model capabilities and performance.', | |
| 297 | - 'shopbuilder' | |
| 298 | - ), | |
| 299 | - 'value' => 200, | |
| 300 | - 'placeholder' => esc_html__( '200', 'shopbuilder' ), | |
| 301 | - 'dependency' => [ | |
| 302 | - 'rules' => [ | |
| 303 | - [ | |
| 304 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 305 | - 'value' => 'Gemini', | |
| 306 | - 'operator' => '==', | |
| 307 | - ], | |
| 308 | - ], | |
| 309 | - ], | |
| 310 | - ], | |
| 311 | - // DeepSeek. | |
| 312 | - 'deepseek_api_key' => [ | |
| 313 | - 'id' => 'deepseek_api_key', | |
| 314 | - 'label' => esc_html__( 'DeepSeek API Key', 'shopbuilder' ), | |
| 315 | - 'type' => 'password', | |
| 316 | - 'placeholder' => esc_html__( 'ds-***********************', 'shopbuilder' ), | |
| 317 | - 'help' => wp_kses( | |
| 318 | - __( | |
| 319 | - 'To integrate with DeepSeek, you need to obtain an API key from DeepSeek. Visit <a href="https://www.deepseek.com/api-keys" target="_blank">DeepSeek API Keys</a> to generate one.', | |
| 320 | - 'shopbuilder' | |
| 321 | - ), | |
| 322 | - [ | |
| 323 | - 'a' => [ | |
| 324 | - 'href' => [], | |
| 325 | - 'target' => [], | |
| 326 | - ], | |
| 327 | - ] | |
| 328 | - ), | |
| 329 | - 'dependency' => [ | |
| 330 | - 'rules' => [ | |
| 331 | - [ | |
| 332 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 333 | - 'value' => 'DeepSeek', | |
| 334 | - 'operator' => '==', | |
| 335 | - ], | |
| 336 | - ], | |
| 337 | - ], | |
| 338 | - ], | |
| 339 | - 'deepseek_models' => [ | |
| 340 | - 'id' => 'deepseek_models', | |
| 341 | - 'label' => esc_html__( 'DeepSeek Model', 'shopbuilder' ), | |
| 342 | - 'type' => 'select', | |
| 343 | - 'value' => 'gpt-4o', | |
| 344 | - 'options' => [ | |
| 345 | - 'deepseek-chat' => __( 'DeepSeek Chat (Full Version)', 'shopbuilder' ), | |
| 346 | - 'deepseek-reasoner' => __( 'DeepSeek Reasoner Mini (Light Version)', 'shopbuilder' ), | |
| 347 | - ], | |
| 348 | - 'dependency' => [ | |
| 349 | - 'rules' => [ | |
| 350 | - [ | |
| 351 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 352 | - 'value' => 'DeepSeek', | |
| 353 | - 'operator' => '==', | |
| 354 | - ], | |
| 355 | - ], | |
| 356 | - ], | |
| 357 | - ], | |
| 358 | - 'deepseek_max_token' => [ | |
| 359 | - 'id' => 'deepseek_max_token', | |
| 360 | - 'label' => esc_html__( 'Deepshek Maximum Characters', 'shopbuilder' ), | |
| 361 | - 'type' => 'number', | |
| 362 | - 'help' => esc_html__( | |
| 363 | - 'Set the maximum character limit for Deepshek model prompts. Adjust according to model configuration and speed requirements.', | |
| 364 | - 'shopbuilder' | |
| 365 | - ), | |
| 366 | - 'value' => 200, | |
| 367 | - 'placeholder' => esc_html__( '200', 'shopbuilder' ), | |
| 368 | - 'dependency' => [ | |
| 369 | - 'rules' => [ | |
| 370 | - [ | |
| 371 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 372 | - 'value' => 'DeepSeek', | |
| 373 | - 'operator' => '==', | |
| 374 | - ], | |
| 375 | - ], | |
| 376 | - ], | |
| 377 | - ], | |
| 378 | - 'enable_semantic_search' => [ | |
| 379 | - 'id' => 'enable_semantic_search', | |
| 380 | - 'type' => 'switch', | |
| 381 | - 'label' => esc_html__( 'Enable Semantic Search?', 'shopbuilder' ), | |
| 382 | - 'help' => esc_html__( 'Enable AI product search instead of keyword matching to get product', 'shopbuilder' ), | |
| 383 | - 'dependency' => [ | |
| 384 | - 'rules' => [ | |
| 385 | - [ | |
| 386 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 387 | - 'value' => [ 'OpenAI', 'Gemini' ], | |
| 388 | - 'operator' => 'in', | |
| 389 | - ], | |
| 390 | - ], | |
| 391 | - ], | |
| 392 | - ], | |
| 393 | - 'minimum_matching_percentage' => [ | |
| 394 | - 'id' => 'minimum_matching_percentage', | |
| 395 | - 'label' => esc_html__( 'Minimum Accuracy (in percentage)', 'shopbuilder' ), | |
| 396 | - 'help' => esc_html__( 'Set the minimum Accuracy. It is good between 40 and 60', 'shopbuilder' ), | |
| 397 | - 'type' => 'number', | |
| 398 | - 'min' => 1, | |
| 399 | - 'max' => 99, | |
| 400 | - 'value' => 40, | |
| 401 | - 'placeholder' => esc_html__( '40', 'shopbuilder' ), | |
| 402 | - 'dependency' => [ | |
| 403 | - 'rules' => [ | |
| 404 | - [ | |
| 405 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 406 | - 'value' => [ 'OpenAI', 'Gemini' ], | |
| 407 | - 'operator' => 'in', | |
| 408 | - ], | |
| 409 | - [ | |
| 410 | - 'item' => 'general.ai_implementation.enable_semantic_search', | |
| 411 | - 'value' => 'on', | |
| 412 | - 'operator' => '==', | |
| 413 | - ], | |
| 414 | - ], | |
| 415 | - ], | |
| 416 | - ], | |
| 417 | - 'data_training' => [ | |
| 418 | - 'id' => 'data_training', | |
| 419 | - 'type' => 'title', | |
| 420 | - 'label' => esc_html__( 'Data Training', 'shopbuilder' ), | |
| 421 | - 'dependency' => [ | |
| 422 | - 'rules' => [ | |
| 423 | - [ | |
| 424 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 425 | - 'value' => [ 'OpenAI', 'Gemini' ], | |
| 426 | - 'operator' => 'in', | |
| 427 | - ], | |
| 428 | - ], | |
| 429 | - ], | |
| 430 | - ], | |
| 431 | - 'data_training_note_gemini' => $this->get_data_training_note_field( 'Gemini' ), | |
| 432 | - 'data_training_note_openai' => $this->get_data_training_note_field( 'OpenAI' ), | |
| 433 | - 'data_training_note_missing_openai_key' => $this->get_data_training_note_field( 'missingOpenAIKey' ), | |
| 434 | - 'data_training_note_missing_gemneni_key' => $this->get_data_training_note_field( 'missingGeminiKey' ), | |
| 435 | - ], | |
| 436 | - ], | |
| 437 | - ), | |
| 438 | - 'notification' => apply_filters( | |
| 55 | + 'notification' => apply_filters( | |
| 439 | 56 | 'rtsb/settings/notification/options', |
| 440 | 57 | [ |
| 441 | 58 | 'id' => 'notification', |
| 442 | - 'icon' => SvgIcons::get( 'notification' ), | |
| 443 | 59 | 'category' => 'general', |
| 444 | 60 | 'title' => esc_html__( 'Notification Settings', 'shopbuilder' ), |
| 445 | 61 | 'package' => 'free', |
| 446 | - 'links' => [ | |
| 447 | - 'doc' => '', | |
| 448 | - 'video' => '', | |
| 449 | - ], | |
| 450 | 62 | 'active_field' => [ |
| 451 | 63 | 'disable' => true, |
| 452 | 64 | ], |
| 453 | 65 | 'fields' => [ |
| @@ -470,21 +82,8 @@ | ||
| 470 | 82 | 'top-center' => esc_html__( 'Top center', 'shopbuilder' ), |
| 471 | 83 | 'bottom-center' => esc_html__( 'Bottom center', 'shopbuilder' ), |
| 472 | 84 | ], |
| 473 | 85 | ], |
| 474 | - 'notification_timeOut' => [ | |
| 475 | - 'id' => 'notification_timeOut', | |
| 476 | - 'label' => esc_html__( 'Notification Time-Out (in seconds)', 'shopbuilder' ), | |
| 477 | - 'type' => 'number', | |
| 478 | - 'help' => esc_html__( | |
| 479 | - 'Duration (in seconds) before the notification hides automatically.', | |
| 480 | - 'shopbuilder' | |
| 481 | - ), | |
| 482 | - 'min' => 1, | |
| 483 | - 'max' => 20, | |
| 484 | - 'value' => 5, | |
| 485 | - 'placeholder' => esc_html__( '3', 'shopbuilder' ), | |
| 486 | - ], | |
| 487 | 86 | 'notification_color' => [ |
| 488 | 87 | 'id' => 'notification_color', |
| 489 | 88 | 'label' => esc_html__( 'Text Color', 'shopbuilder' ), |
| 490 | 89 | 'type' => 'color', |
| @@ -510,20 +109,15 @@ | ||
| 510 | 109 | ], |
| 511 | 110 | ], |
| 512 | 111 | ], |
| 513 | 112 | ), |
| 514 | - 'social_share' => apply_filters( | |
| 113 | + 'social_share' => apply_filters( | |
| 515 | 114 | 'rtsb/settings/social_share/options', |
| 516 | 115 | [ |
| 517 | 116 | 'id' => 'social_share', |
| 518 | - 'icon' => SvgIcons::get( 'social_share' ), | |
| 519 | 117 | 'category' => 'general', |
| 520 | 118 | 'title' => esc_html__( 'Social Share Settings', 'shopbuilder' ), |
| 521 | 119 | 'package' => 'free', |
| 522 | - 'links' => [ | |
| 523 | - 'doc' => '', | |
| 524 | - 'video' => '', | |
| 525 | - ], | |
| 526 | 120 | 'active_field' => [ |
| 527 | 121 | 'disable' => true, |
| 528 | 122 | ], |
| 529 | 123 | 'fields' => [ |
| @@ -545,8 +139,25 @@ | ||
| 545 | 139 | 'type' => 'switch', |
| 546 | 140 | 'label' => esc_html__( 'Sharing Button in Single Product Page', 'shopbuilder' ), |
| 547 | 141 | 'help' => esc_html__( 'Enable this option to allow share a product from product page. Woocommerce Supported Sharing plugins added to Hook: woocommerce_share', 'shopbuilder' ), |
| 548 | 142 | ], |
| 143 | + /* | |
| 144 | + * TODO : Implement later. | |
| 145 | + 'share_icon_show_to_product_page' => array( | |
| 146 | + 'id' => 'share_icon_show_to_product_page', | |
| 147 | + 'type' => 'switch', | |
| 148 | + 'label' => esc_html__( 'Sharing Icon in Single Product Page', 'shopbuilder' ), | |
| 149 | + 'dependency' => [ | |
| 150 | + 'rules' => [ | |
| 151 | + [ | |
| 152 | + 'item' => 'general.social_share.share_platforms_to_product_page', | |
| 153 | + 'value' => 'on', | |
| 154 | + 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value // | |
| 155 | + ], | |
| 156 | + ], | |
| 157 | + ], | |
| 158 | + ), | |
| 159 | + */ | |
| 549 | 160 | 'share_icon_layout' => [ |
| 550 | 161 | 'type' => 'select', |
| 551 | 162 | 'value' => 'share-layout1', |
| 552 | 163 | 'label' => esc_html__( 'Share Button Layout', 'shopbuilder' ), |
| @@ -566,54 +177,39 @@ | ||
| 566 | 177 | ], |
| 567 | 178 | ], |
| 568 | 179 | ], |
| 569 | 180 | ), |
| 570 | - 'guest_user' => apply_filters( | |
| 181 | + 'guest_user' => apply_filters( | |
| 571 | 182 | 'rtsb/settings/guest_user/options', |
| 572 | 183 | [ |
| 573 | 184 | 'id' => 'guest_user', |
| 574 | - 'icon' => SvgIcons::get( 'guest_user' ), | |
| 575 | 185 | 'category' => 'general', |
| 576 | 186 | 'title' => esc_html__( 'Guest User Controls', 'shopbuilder' ), |
| 577 | 187 | 'package' => $this->pro_package(), |
| 578 | - 'links' => [ | |
| 579 | - 'doc' => '', | |
| 580 | - 'video' => '', | |
| 581 | - ], | |
| 582 | 188 | 'active_field' => [ |
| 583 | 189 | 'disable' => true, |
| 584 | 190 | ], |
| 585 | 191 | ], |
| 586 | 192 | ), |
| 587 | - 'tooltip' => apply_filters( | |
| 193 | + 'tooltip' => apply_filters( | |
| 588 | 194 | 'rtsb/settings/tooltip/options', |
| 589 | 195 | [ |
| 590 | 196 | 'id' => 'tooltip', |
| 591 | - 'icon' => SvgIcons::get( 'tooltip' ), | |
| 592 | 197 | 'category' => 'general', |
| 593 | 198 | 'title' => esc_html__( 'Tooltip Settings', 'shopbuilder' ), |
| 594 | 199 | 'package' => $this->pro_package(), |
| 595 | - 'links' => [ | |
| 596 | - 'doc' => '', | |
| 597 | - 'video' => '', | |
| 598 | - ], | |
| 599 | 200 | 'active_field' => [ |
| 600 | 201 | 'disable' => true, |
| 601 | 202 | ], |
| 602 | 203 | ], |
| 603 | 204 | ), |
| 604 | - 'billing_form' => apply_filters( | |
| 205 | + 'billing_form' => apply_filters( | |
| 605 | 206 | 'rtsb/settings/billing_form/options', |
| 606 | 207 | [ |
| 607 | 208 | 'id' => 'billing_form', |
| 608 | - 'icon' => SvgIcons::get( 'billing_form' ), | |
| 609 | 209 | 'category' => 'checkout', |
| 610 | 210 | 'title' => esc_html__( 'Billing Form Settings', 'shopbuilder' ), |
| 611 | 211 | 'package' => 'free', |
| 612 | - 'links' => [ | |
| 613 | - 'doc' => '', | |
| 614 | - 'video' => '', | |
| 615 | - ], | |
| 616 | 212 | 'active_field' => [ |
| 617 | 213 | 'label' => esc_html__( 'Customize Billing Form Fields?', 'shopbuilder' ), |
| 618 | 214 | 'help' => esc_html__( 'Switch on to customize billing form fields.', 'shopbuilder' ), |
| 619 | 215 | ], |
| @@ -618,13 +214,12 @@ | ||
| 618 | 214 | 'help' => esc_html__( 'Switch on to customize billing form fields.', 'shopbuilder' ), |
| 619 | 215 | ], |
| 620 | 216 | 'fields' => [ |
| 621 | 217 | 'checkout_billing_info' => [ |
| 622 | - 'id' => 'checkout_billing_info', | |
| 623 | - 'type' => 'deprecated', | |
| 624 | - 'label' => __( '<strong>Deprecated:</strong> Billing Form Settings is deprecated. Please use the <strong><u>Checkout Fields Editor</u></strong> module to customize checkout fields. These settings will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is active.', 'shopbuilder' ), | |
| 625 | - 'customClass' => 'checkout-notice', | |
| 626 | - 'before_active' => true, | |
| 218 | + 'id' => 'checkout_billing_info', | |
| 219 | + 'type' => 'title', | |
| 220 | + 'label' => __( 'The below form fields customization will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is activated.', 'shopbuilder' ), | |
| 221 | + 'customClass' => 'checkout-notice', | |
| 627 | 222 | ], |
| 628 | 223 | 'billing_first_name_heading' => [ |
| 629 | 224 | 'id' => 'billing_first_name_heading', |
| 630 | 225 | 'type' => 'title', |
| @@ -799,16 +394,19 @@ | ||
| 799 | 394 | 'label' => esc_html__( 'Country', 'shopbuilder' ), |
| 800 | 395 | 'type' => 'checkbox', |
| 801 | 396 | 'orientation' => 'vertical', |
| 802 | 397 | 'value' => [ 'show', 'required' ], |
| 398 | + // 'help' => esc_html__( 'If the Shipping Form is enabled, the Country field is mandatory.', 'shopbuilder' ), | |
| 803 | 399 | 'options' => [ |
| 804 | 400 | [ |
| 805 | 401 | 'value' => 'show', |
| 806 | 402 | 'label' => 'Show Country?', |
| 403 | + // 'disabled' => true, | |
| 807 | 404 | ], |
| 808 | 405 | [ |
| 809 | 406 | 'value' => 'required', |
| 810 | 407 | 'label' => 'Required Field', |
| 408 | + // 'disabled' => true, | |
| 811 | 409 | ], |
| 812 | 410 | ], |
| 813 | 411 | ], |
| 814 | 412 | |
| @@ -1041,8 +639,9 @@ | ||
| 1041 | 639 | 'id' => 'billing_state_label', |
| 1042 | 640 | 'label' => esc_html__( 'State label', 'shopbuilder' ), |
| 1043 | 641 | 'type' => 'text', |
| 1044 | 642 | 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ), |
| 643 | + // 'help' => esc_html__( 'Leave empty to set default. If the Shipping Form is enabled, the State field is mandatory.', 'shopbuilder' ), | |
| 1045 | 644 | 'dependency' => [ |
| 1046 | 645 | 'rules' => [ |
| 1047 | 646 | [ |
| 1048 | 647 | 'item' => 'general.billing_form.billing_state', |
| @@ -1215,20 +814,15 @@ | ||
| 1215 | 814 | ], |
| 1216 | 815 | |
| 1217 | 816 | ] |
| 1218 | 817 | ), |
| 1219 | - 'shipping_form' => apply_filters( | |
| 818 | + 'shipping_form' => apply_filters( | |
| 1220 | 819 | 'rtsb/module/shipping_form/options', |
| 1221 | 820 | [ |
| 1222 | 821 | 'id' => 'shipping_form', |
| 1223 | - 'icon' => SvgIcons::get( 'shipping_form' ), | |
| 1224 | 822 | 'category' => 'checkout', |
| 1225 | 823 | 'title' => esc_html__( 'Shipping Form Settings', 'shopbuilder' ), |
| 1226 | 824 | 'package' => 'free', |
| 1227 | - 'links' => [ | |
| 1228 | - 'doc' => '', | |
| 1229 | - 'video' => '', | |
| 1230 | - ], | |
| 1231 | 825 | 'active_field' => [ |
| 1232 | 826 | 'label' => esc_html__( 'Customize Shipping form Fields?', 'shopbuilder' ), |
| 1233 | 827 | 'help' => esc_html__( 'Switch on to customize shipping form fields.', 'shopbuilder' ), |
| 1234 | 828 | ], |
| @@ -1233,13 +827,12 @@ | ||
| 1233 | 827 | 'help' => esc_html__( 'Switch on to customize shipping form fields.', 'shopbuilder' ), |
| 1234 | 828 | ], |
| 1235 | 829 | 'fields' => [ |
| 1236 | 830 | 'checkout_shipping_info' => [ |
| 1237 | - 'id' => 'checkout_shipping_info', | |
| 1238 | - 'type' => 'deprecated', | |
| 1239 | - 'label' => __( '<strong>Deprecated:</strong> Shipping Form Settings is deprecated. Please use the <strong><u>Checkout Fields Editor</u></strong> module to customize checkout fields. These settings will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is active.', 'shopbuilder' ), | |
| 1240 | - 'customClass' => 'checkout-notice', | |
| 1241 | - 'before_active' => true, | |
| 831 | + 'id' => 'checkout_shipping_info', | |
| 832 | + 'type' => 'title', | |
| 833 | + 'label' => __( 'The below form fields customization will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is activated.', 'shopbuilder' ), | |
| 834 | + 'customClass' => 'checkout-notice', | |
| 1242 | 835 | ], |
| 1243 | 836 | 'shipping_first_name_heading' => [ |
| 1244 | 837 | 'id' => 'shipping_first_name_heading', |
| 1245 | 838 | 'type' => 'title', |
| @@ -1412,12 +1005,14 @@ | ||
| 1412 | 1005 | 'options' => [ |
| 1413 | 1006 | [ |
| 1414 | 1007 | 'value' => 'show', |
| 1415 | 1008 | 'label' => 'Show Country?', |
| 1009 | + // 'disabled' => true, | |
| 1416 | 1010 | ], |
| 1417 | 1011 | [ |
| 1418 | 1012 | 'value' => 'required', |
| 1419 | 1013 | 'label' => 'Required Field', |
| 1014 | + // 'disabled' => true, | |
| 1420 | 1015 | ], |
| 1421 | 1016 | ], |
| 1422 | 1017 | ], |
| 1423 | 1018 | |
| @@ -1640,8 +1235,29 @@ | ||
| 1640 | 1235 | 'label' => 'Required Field', |
| 1641 | 1236 | ], |
| 1642 | 1237 | ], |
| 1643 | 1238 | ], |
| 1239 | + // | |
| 1240 | + // 'shipping_state_label' => [ | |
| 1241 | + // 'id' => 'shipping_state_label', | |
| 1242 | + // 'label' => esc_html__( 'State label', 'shopbuilder' ), | |
| 1243 | + // 'type' => 'text', | |
| 1244 | + // 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ), | |
| 1245 | + // 'dependency' => [ | |
| 1246 | + // 'rules' => [ | |
| 1247 | + // [ | |
| 1248 | + // 'item' => 'general.shipping_form.shipping_state', | |
| 1249 | + // 'value' => 'show', | |
| 1250 | + // 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value // | |
| 1251 | + // ], | |
| 1252 | + // ], | |
| 1253 | + // ], | |
| 1254 | + // ], | |
| 1255 | + // 'shipping_postcode_heading' => [ | |
| 1256 | + // 'id' => 'shipping_postcode_heading', | |
| 1257 | + // 'type' => 'title', | |
| 1258 | + // 'label' => esc_html__( 'Postcode / ZIP', 'shopbuilder' ), | |
| 1259 | + // ], | |
| 1644 | 1260 | 'shipping_postcode' => [ |
| 1645 | 1261 | 'id' => 'shipping_postcode', |
| 1646 | 1262 | 'label' => esc_html__( 'Postcode / ZIP', 'shopbuilder' ), |
| 1647 | 1263 | 'type' => 'checkbox', |
| @@ -1653,132 +1269,43 @@ | ||
| 1653 | 1269 | 'label' => 'Show Postcode / ZIP?', |
| 1654 | 1270 | ], |
| 1655 | 1271 | ], |
| 1656 | 1272 | ], |
| 1273 | + // 'shipping_postcode_label' => [ | |
| 1274 | + // 'id' => 'shipping_postcode_label', | |
| 1275 | + // 'label' => esc_html__( 'Postcode / ZIP label', 'shopbuilder' ), | |
| 1276 | + // 'type' => 'text', | |
| 1277 | + // 'help' => esc_html__( 'Leave empty to set default. ', 'shopbuilder' ), | |
| 1278 | + // 'dependency' => [ | |
| 1279 | + // 'rules' => [ | |
| 1280 | + // [ | |
| 1281 | + // 'item' => 'general.shipping_form.shipping_postcode', | |
| 1282 | + // 'value' => 'show', | |
| 1283 | + // 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value // | |
| 1284 | + // ], | |
| 1285 | + // ], | |
| 1286 | + // ], | |
| 1287 | + // ], | |
| 1288 | + // 'shipping_postcode_placeholder' => [ | |
| 1289 | + // 'id' => 'shipping_postcode_placeholder', | |
| 1290 | + // 'label' => esc_html__( 'Postcode / ZIP placeholder', 'shopbuilder' ), | |
| 1291 | + // 'type' => 'text', | |
| 1292 | + // 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ), | |
| 1293 | + // 'dependency' => [ | |
| 1294 | + // 'rules' => [ | |
| 1295 | + // [ | |
| 1296 | + // 'item' => 'general.shipping_form.shipping_postcode', | |
| 1297 | + // 'value' => 'show', | |
| 1298 | + // 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value // | |
| 1299 | + // ], | |
| 1300 | + // ], | |
| 1301 | + // ], | |
| 1302 | + // ], | |
| 1657 | 1303 | |
| 1658 | 1304 | ], |
| 1659 | 1305 | ] |
| 1660 | 1306 | ), |
| 1661 | - | |
| 1662 | 1307 | ]; |
| 1663 | 1308 | |
| 1664 | - if ( ! defined( 'ELEMENTOR_VERSION' ) ) { | |
| 1665 | - unset( $list['optimization']['fields']['load_elementor_scripts'] ); | |
| 1666 | - } | |
| 1667 | 1309 | return apply_filters( 'rtsb/core/general_settings/raw_list', $list ); |
| 1668 | - } | |
| 1669 | - | |
| 1670 | - /** | |
| 1671 | - * Get the Data Training Note field. | |
| 1672 | - * | |
| 1673 | - * @param string $tool Meta values. | |
| 1674 | - * @return array | |
| 1675 | - */ | |
| 1676 | - public function get_data_training_note_field( $tool ): array { | |
| 1677 | - $progress = get_option( 'rtsb_embedding_progress', [ 'processed' => 0 ] ); | |
| 1678 | - $total = AIFns::need_product_embedding(); | |
| 1679 | - $processed = (int) $progress['processed']; | |
| 1680 | - $remaining = max( $total - $processed, 0 ); | |
| 1681 | - $generate_url = add_query_arg( | |
| 1682 | - [ | |
| 1683 | - rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ), | |
| 1684 | - 'action' => 'rtsb_start_embedding_process', | |
| 1685 | - ], | |
| 1686 | - admin_url( 'admin.php?page=rtsb-settings' ) | |
| 1687 | - ); | |
| 1688 | - | |
| 1689 | - if ( wp_next_scheduled( 'rtsb_embedding_cron_run' ) ) { | |
| 1690 | - $text = esc_html__( 'Processing embeddings in the background. You can continue using the site.', 'shopbuilder' ); | |
| 1691 | - } else { | |
| 1692 | - if ( $remaining > 0 ) { | |
| 1693 | - // Build the correct text based on embedding progress. | |
| 1694 | - $text = sprintf( | |
| 1695 | - '%1$s <a class="rtsb-generate-embedding" href="%2$s">%3$s</a>', | |
| 1696 | - esc_html__( 'Make Compatible your existing products with semantic search process.', 'shopbuilder' ), | |
| 1697 | - esc_url( $generate_url ), | |
| 1698 | - esc_html__( 'Generate Embeddings', 'shopbuilder' ) | |
| 1699 | - ); | |
| 1700 | - } else { | |
| 1701 | - $text = esc_html__( '🎉 Congratulations! All your products are successfully embedded and up to date.', 'shopbuilder' ); | |
| 1702 | - } | |
| 1703 | - } | |
| 1704 | - $note = [ | |
| 1705 | - 'OpenAI' => [ | |
| 1706 | - 'id' => 'data_training_note_openai', | |
| 1707 | - 'type' => 'description', | |
| 1708 | - 'text' => $text, | |
| 1709 | - 'dependency' => [ | |
| 1710 | - 'rules' => [ | |
| 1711 | - [ | |
| 1712 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 1713 | - 'value' => 'OpenAI', | |
| 1714 | - 'operator' => '==', | |
| 1715 | - ], | |
| 1716 | - [ | |
| 1717 | - 'item' => 'general.ai_implementation.gpt_api_key', | |
| 1718 | - 'value' => '', | |
| 1719 | - 'operator' => '!=', | |
| 1720 | - ], | |
| 1721 | - ], | |
| 1722 | - ], | |
| 1723 | - ], | |
| 1724 | - 'Gemini' => [ | |
| 1725 | - 'id' => 'data_training_note_gemini', | |
| 1726 | - 'type' => 'description', | |
| 1727 | - 'text' => $text, | |
| 1728 | - 'dependency' => [ | |
| 1729 | - 'rules' => [ | |
| 1730 | - [ | |
| 1731 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 1732 | - 'value' => 'Gemini', | |
| 1733 | - 'operator' => '==', | |
| 1734 | - ], | |
| 1735 | - [ | |
| 1736 | - 'item' => 'general.ai_implementation.gemini_api_key', | |
| 1737 | - 'value' => '', | |
| 1738 | - 'operator' => '!=', | |
| 1739 | - ], | |
| 1740 | - ], | |
| 1741 | - ], | |
| 1742 | - ], | |
| 1743 | - 'missingGeminiKey' => [ | |
| 1744 | - 'id' => 'data_training_note_missing_gemneni_key', | |
| 1745 | - 'type' => 'description', | |
| 1746 | - 'text' => esc_html__( 'Missing Gemini API key. Enter and save your API key to turn on the data training feature.', 'shopbuilder' ), | |
| 1747 | - 'dependency' => [ | |
| 1748 | - 'rules' => [ | |
| 1749 | - [ | |
| 1750 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 1751 | - 'value' => 'Gemini', | |
| 1752 | - 'operator' => '==', | |
| 1753 | - ], | |
| 1754 | - [ | |
| 1755 | - 'item' => 'general.ai_implementation.gemini_api_key', | |
| 1756 | - 'value' => '', | |
| 1757 | - 'operator' => '==', | |
| 1758 | - ], | |
| 1759 | - ], | |
| 1760 | - ], | |
| 1761 | - ], | |
| 1762 | - 'missingOpenAIKey' => [ | |
| 1763 | - 'id' => 'data_training_note_missing_openai_key', | |
| 1764 | - 'type' => 'description', | |
| 1765 | - 'text' => esc_html__( 'Missing OpenAI API key. Enter and save your API key to turn on the data training feature.', 'shopbuilder' ), | |
| 1766 | - 'dependency' => [ | |
| 1767 | - 'rules' => [ | |
| 1768 | - [ | |
| 1769 | - 'item' => 'general.ai_implementation.ai_tools', | |
| 1770 | - 'value' => 'OpenAI', | |
| 1771 | - 'operator' => '==', | |
| 1772 | - ], | |
| 1773 | - [ | |
| 1774 | - 'item' => 'general.ai_implementation.gpt_api_key', | |
| 1775 | - 'value' => '', | |
| 1776 | - 'operator' => '==', | |
| 1777 | - ], | |
| 1778 | - ], | |
| 1779 | - ], | |
| 1780 | - ], | |
| 1781 | - ]; | |
| 1782 | - return $note[ $tool ] ?? []; | |
| 1783 | 1310 | } |
| 1784 | 1311 | } |