| @@ -19,8 +19,10 @@ | ||
| 19 | 19 | use FluentCart\App\Models\AttributeTerm; |
| 20 | 20 | use FluentCart\App\Models\AttributeGroup; |
| 21 | 21 | use FluentCart\App\Models\ShippingMethod; |
| 22 | 22 | use FluentCart\App\Modules\Tax\TaxModule; |
| 23 | +use FluentCart\App\Modules\FluentPlayer\FluentPlayerBridge; | |
| 24 | +use FluentCart\App\Modules\AdminFooter\AdminFooter; | |
| 23 | 25 | use FluentCart\App\Helpers\CurrenciesHelper; |
| 24 | 26 | use FluentCart\App\Services\Filter\TaxFilter; |
| 25 | 27 | use FluentCart\App\Services\Filter\OrderFilter; |
| 26 | 28 | use FluentCart\App\Services\Filter\LicenseFilter; |
| @@ -26,9 +28,16 @@ | ||
| 26 | 28 | use FluentCart\App\Services\Filter\LicenseFilter; |
| 27 | 29 | use FluentCart\App\Services\Filter\LicenseSiteFilter; |
| 28 | 30 | use FluentCart\App\Services\Filter\ProductFilter; |
| 29 | 31 | use FluentCart\App\Services\Filter\CustomerFilter; |
| 32 | +use FluentCart\App\Services\Filter\CouponFilter; | |
| 33 | +use FluentCart\App\Services\Filter\LogFilter; | |
| 34 | +use FluentCart\App\Services\Filter\OrderBumpFilter; | |
| 35 | +use FluentCart\App\Services\Filter\ReviewFilter; | |
| 36 | +use FluentCart\App\Modules\Shipping\Services\Filter\ShippingClassFilter; | |
| 37 | +use FluentCart\App\Modules\Shipping\Services\Filter\ShippingZoneFilter; | |
| 30 | 38 | use FluentCart\App\Modules\Integrations\AddOnModule; |
| 39 | +use FluentCart\App\Services\DateTime\DayjsFormatter; | |
| 31 | 40 | use FluentCart\App\Services\Translations\TransStrings; |
| 32 | 41 | use FluentCart\App\Services\Permission\PermissionManager; |
| 33 | 42 | use FluentCart\Database\DataBackfills; |
| 34 | 43 | use FluentCart\App\Modules\PaymentMethods\Core\GatewayManager; |
| @@ -44,8 +53,9 @@ | ||
| 44 | 53 | |
| 45 | 54 | if ($page == 'fluent-cart') { |
| 46 | 55 | |
| 47 | 56 | \FluentCart\App\Events\FirstTimePluginActivation::handle(); |
| 57 | + (new AdminFooter())->register(); | |
| 48 | 58 | add_action('admin_enqueue_scripts', function () { |
| 49 | 59 | Vite::enqueueStyle('fluent_cart_admin_app_css', |
| 50 | 60 | 'styles/tailwind/style.css', |
| 51 | 61 | ); |
| @@ -79,8 +89,9 @@ | ||
| 79 | 89 | $targetKeys = [ |
| 80 | 90 | 'checkout_page_id' => __('Checkout Page', 'fluent-cart'), |
| 81 | 91 | 'cart_page_id' => __('Cart Page', 'fluent-cart'), |
| 82 | 92 | 'receipt_page_id' => __('Receipt Page', 'fluent-cart'), |
| 93 | + 'order_review_page_id' => __('Order Review Page', 'fluent-cart'), | |
| 83 | 94 | 'shop_page_id' => __('Shop Page', 'fluent-cart'), |
| 84 | 95 | 'customer_profile_page_id' => __('Customer Profile Page', 'fluent-cart'), |
| 85 | 96 | ]; |
| 86 | 97 | |
| @@ -177,8 +188,22 @@ | ||
| 177 | 188 | { |
| 178 | 189 | |
| 179 | 190 | add_action('admin_menu', array($this, 'addAdminMenu')); |
| 180 | 191 | |
| 192 | + // The "↳" children under Products stay visible on every page so the | |
| 193 | + // sidebar never changes shape. Pro's "↳ Inventory" still hides itself | |
| 194 | + // with inline CSS (it relied on the admin app to reveal it), so keep | |
| 195 | + // that row visible whichever Pro version is installed. | |
| 196 | + add_action('admin_enqueue_scripts', function () { | |
| 197 | + wp_register_style('fluent-cart-admin-submenu', false); | |
| 198 | + wp_enqueue_style('fluent-cart-admin-submenu'); | |
| 199 | + wp_add_inline_style('fluent-cart-admin-submenu', ' | |
| 200 | + #adminmenu .toplevel_page_fluent-cart li.fluent_cart_inventory { | |
| 201 | + display: list-item; | |
| 202 | + } | |
| 203 | + '); | |
| 204 | + }); | |
| 205 | + | |
| 181 | 206 | /* |
| 182 | 207 | * Disable Gutenberg for Products |
| 183 | 208 | */ |
| 184 | 209 | add_filter('parent_file', function ($parent_file) { |
| @@ -439,9 +464,10 @@ | ||
| 439 | 464 | |
| 440 | 465 | do_action('fluent_cart/loading_app', $app); |
| 441 | 466 | |
| 442 | 467 | //This should be done before enqueueing the global script. |
| 443 | - Vite::enqueueScript($slug . '_admin_app_start', 'admin/bootstrap/app.js', [$slug . '_global_admin_hooks']); | |
| 468 | + // wp-i18n backs the admin translator (resources/admin/utils/translator/Translator.js). | |
| 469 | + Vite::enqueueScript($slug . '_admin_app_start', 'admin/bootstrap/app.js', [$slug . '_global_admin_hooks', 'wp-i18n']); | |
| 444 | 470 | |
| 445 | 471 | //Don't register this script using vite. |
| 446 | 472 | if (!wp_script_is('wp-hooks', 'registered')) { |
| 447 | 473 | $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
| @@ -470,8 +496,9 @@ | ||
| 470 | 496 | 'product_filter_options' => ProductFilter::getTableFilterOptions(), |
| 471 | 497 | 'license_filter_options' => LicenseFilter::getTableFilterOptions(), |
| 472 | 498 | 'license_site_filter_options' => LicenseSiteFilter::getTableFilterOptions(), |
| 473 | 499 | 'tax_filter_options' => TaxFilter::getTableFilterOptions(), |
| 500 | + 'review_filter_options' => ReviewFilter::getTableFilterOptions(), | |
| 474 | 501 | ]; |
| 475 | 502 | $filterOptions = apply_filters('fluent_cart/admin_filter_options', $filterOptions, []); |
| 476 | 503 | |
| 477 | 504 | // Structured table config keyed by table name (used by Table.js base class) |
| @@ -483,10 +510,31 @@ | ||
| 483 | 510 | 'license_sites' => ['filters' => Arr::get($filterOptions, 'license_site_filter_options', [])], |
| 484 | 511 | 'taxes_table' => ['filters' => Arr::get($filterOptions, 'tax_filter_options', [])], |
| 485 | 512 | 'subscriptions' => ['filters' => Arr::get($filterOptions, 'subscription_filter_options', [])], |
| 486 | 513 | 'shipping_zone_table' => ['filters' => Arr::get($filterOptions, 'shipping_zone_filter_options', [])], |
| 514 | + 'review_table' => ['filters' => Arr::get($filterOptions, 'review_filter_options', [])], | |
| 515 | + // The Order Sources report filters orders, so its advanced-filter UI | |
| 516 | + // reuses the Orders filter vocabulary rather than defining its own. | |
| 517 | + 'source_report' => ['filters' => Arr::get($filterOptions, 'order_filter_options', [])], | |
| 487 | 518 | ]; |
| 488 | 519 | |
| 520 | + // Tables that declare sort options on their filter class but carry no | |
| 521 | + // filter-options entry above: the Sort popover still needs them, and | |
| 522 | + // they are what `fluent_cart/{filterName}_table_sorts` feeds. | |
| 523 | + $sortOnlyTables = [ | |
| 524 | + 'coupon_table' => CouponFilter::class, | |
| 525 | + 'log_table' => LogFilter::class, | |
| 526 | + 'order_bump_table' => OrderBumpFilter::class, | |
| 527 | + 'shipping_class_table' => ShippingClassFilter::class, | |
| 528 | + 'shipping_zone_table' => ShippingZoneFilter::class, | |
| 529 | + ]; | |
| 530 | + | |
| 531 | + foreach ($sortOnlyTables as $tableName => $filterClass) { | |
| 532 | + if (empty($tableConfig[$tableName]['filters']['sorts'])) { | |
| 533 | + $tableConfig[$tableName]['filters']['sorts'] = call_user_func([$filterClass, 'getSortOptions']); | |
| 534 | + } | |
| 535 | + } | |
| 536 | + | |
| 489 | 537 | $tableConfig = apply_filters('fluent_cart/admin_table_saved_views', $tableConfig, [ |
| 490 | 538 | 'filterOptions' => $filterOptions |
| 491 | 539 | ]); |
| 492 | 540 | |
| @@ -497,8 +545,9 @@ | ||
| 497 | 545 | $appConfig['version'] = FLUENTCART_VERSION; |
| 498 | 546 | $appConfig['permissions'] = PermissionManager::getUserPermissions(); |
| 499 | 547 | $appConfig['isProActive'] = App::isProActive(); |
| 500 | 548 | $appConfig['proVersion'] = defined('FLUENTCART_PRO_PLUGIN_VERSION') ? FLUENTCART_PRO_PLUGIN_VERSION : null; |
| 549 | + $appConfig['fluentPlayer'] = FluentPlayerBridge::adminAppConfig(); | |
| 501 | 550 | |
| 502 | 551 | $appConfig['logos'] = [ |
| 503 | 552 | 'dark' => Vite::getAssetUrl('images/logo/logo-full-dark.svg'), |
| 504 | 553 | 'light' => Vite::getAssetUrl('images/logo/logo-full.svg'), |
| @@ -503,9 +552,9 @@ | ||
| 503 | 552 | 'dark' => Vite::getAssetUrl('images/logo/logo-full-dark.svg'), |
| 504 | 553 | 'light' => Vite::getAssetUrl('images/logo/logo-full.svg'), |
| 505 | 554 | ]; |
| 506 | 555 | $appConfig['isModuleTabEnabled'] = $settings->isModuleTabEnabled(); |
| 507 | - $appConfig['upgrade_url'] = 'https://fluentcart.com/pricing/'; | |
| 556 | + $appConfig['upgrade_url'] = Helper::getUpgradeUrl(); | |
| 508 | 557 | |
| 509 | 558 | $max_upload_size = wp_max_upload_size(); // Returns size in bytes |
| 510 | 559 | $adminLocalizeData = apply_filters('fluent_cart/admin_app_data', [ |
| 511 | 560 | 'app_config' => $appConfig, |
| @@ -510,8 +559,9 @@ | ||
| 510 | 559 | $adminLocalizeData = apply_filters('fluent_cart/admin_app_data', [ |
| 511 | 560 | 'app_config' => $appConfig, |
| 512 | 561 | 'slug' => $app->config->get('app.slug'), |
| 513 | 562 | 'admin_url' => admin_url('admin.php?page=fluent-cart#/'), |
| 563 | + 'wp_admin_url' => rtrim(admin_url(), '/'), | |
| 514 | 564 | 'frontend_url' => URL::getFrontEndUrl(''), |
| 515 | 565 | 'nonce' => wp_create_nonce($slug), |
| 516 | 566 | 'rest' => $restVars, |
| 517 | 567 | 'brand_logo' => $this->getMenuIcon(), |
| @@ -560,8 +610,9 @@ | ||
| 560 | 610 | 'is_tax_enabled' => TaxModule::isTaxEnabled(), |
| 561 | 611 | 'eu_vat_county_options' => TaxModule::euVatCountyOptions(), |
| 562 | 612 | 'country_tax_titles' => TaxModule::taxTitleLists(), |
| 563 | 613 | 'site_url' => site_url(), |
| 614 | + 'store_logo' => (new \FluentCart\Api\StoreSettings())->get('store_logo.url', ''), | |
| 564 | 615 | 'modules_settings' => ModuleSettings::getAllSettings(), |
| 565 | 616 | 'purchase_fluent_cart_link' => 'https://fluentcart.com/', |
| 566 | 617 | 'admin_notices' => apply_filters('fluent_cart/admin_notices', []), |
| 567 | 618 | // POSTs data-backfills/run until done; endpoint requires manage_options |
| @@ -567,9 +618,9 @@ | ||
| 567 | 618 | // POSTs data-backfills/run until done; endpoint requires manage_options |
| 568 | 619 | 'has_data_migrations' => $hasDataMigrations, |
| 569 | 620 | 'subscription_intervals' => Helper::getAvailableSubscriptionIntervalOptions(), |
| 570 | 621 | |
| 571 | - 'datei18' => TransStrings::dateTimeStrings(), | |
| 622 | + 'datei18' => DayjsFormatter::localizedStrings(), | |
| 572 | 623 | 'el_strings' => TransStrings::elStrings(), |
| 573 | 624 | 'wp_locale' => get_locale(), |
| 574 | 625 | 'is_full_name_required' => CheckoutFieldsSchema::isFullNameRequired(), |
| 575 | 626 | 'business_details' => [ |