PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
← All changes | app/Hooks/Handlers/MenuHandler.php +40 -4 1.4.2 → 1.6.5 View file →
@@ -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,11 +28,18 @@
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\Modules\Shipping\Services\Filter\ShippingClassFilter;
36 +use FluentCart\App\Modules\Shipping\Services\Filter\ShippingZoneFilter;
30 37 use FluentCart\App\Modules\Integrations\AddOnModule;
38 +use FluentCart\App\Services\DateTime\DayjsFormatter;
31 39 use FluentCart\App\Services\Translations\TransStrings;
32 40 use FluentCart\App\Services\Permission\PermissionManager;
41 +use FluentCart\Database\DataBackfills;
33 42 use FluentCart\App\Modules\PaymentMethods\Core\GatewayManager;
34 43
35 44 class MenuHandler
36 45 {
@@ -43,8 +52,9 @@
43 52
44 53 if ($page == 'fluent-cart') {
45 54
46 55 \FluentCart\App\Events\FirstTimePluginActivation::handle();
56 + (new AdminFooter())->register();
47 57 add_action('admin_enqueue_scripts', function () {
48 58 Vite::enqueueStyle('fluent_cart_admin_app_css',
49 59 'styles/tailwind/style.css',
50 60 );
@@ -438,9 +448,10 @@
438 448
439 449 do_action('fluent_cart/loading_app', $app);
440 450
441 451 //This should be done before enqueueing the global script.
442 - Vite::enqueueScript($slug . '_admin_app_start', 'admin/bootstrap/app.js', [$slug . '_global_admin_hooks']);
452 + // wp-i18n backs the admin translator (resources/admin/utils/translator/Translator.js).
453 + Vite::enqueueScript($slug . '_admin_app_start', 'admin/bootstrap/app.js', [$slug . '_global_admin_hooks', 'wp-i18n']);
443 454
444 455 //Don't register this script using vite.
445 456 if (!wp_script_is('wp-hooks', 'registered')) {
446 457 $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
@@ -460,8 +471,9 @@
460 471
461 472 $settings = new StoreSettings();
462 473 $checkoutUrl = add_query_arg(Helper::INSTANT_CHECKOUT_URL_PARAM, '=', $settings->getCheckoutPage());
463 474 $restVars = Helper::getRestInfo();
475 + $hasDataMigrations = current_user_can('manage_options') && DataBackfills::hasPending();
464 476
465 477 $filterOptions = [
466 478 'order_filter_options' => OrderFilter::getTableFilterOptions(),
467 479 'customer_filter_options' => CustomerFilter::getTableFilterOptions(),
@@ -481,10 +493,30 @@
481 493 'license_sites' => ['filters' => Arr::get($filterOptions, 'license_site_filter_options', [])],
482 494 'taxes_table' => ['filters' => Arr::get($filterOptions, 'tax_filter_options', [])],
483 495 'subscriptions' => ['filters' => Arr::get($filterOptions, 'subscription_filter_options', [])],
484 496 'shipping_zone_table' => ['filters' => Arr::get($filterOptions, 'shipping_zone_filter_options', [])],
497 + // The Order Sources report filters orders, so its advanced-filter UI
498 + // reuses the Orders filter vocabulary rather than defining its own.
499 + 'source_report' => ['filters' => Arr::get($filterOptions, 'order_filter_options', [])],
485 500 ];
486 501
502 + // Tables that declare sort options on their filter class but carry no
503 + // filter-options entry above: the Sort popover still needs them, and
504 + // they are what `fluent_cart/{filterName}_table_sorts` feeds.
505 + $sortOnlyTables = [
506 + 'coupon_table' => CouponFilter::class,
507 + 'log_table' => LogFilter::class,
508 + 'order_bump_table' => OrderBumpFilter::class,
509 + 'shipping_class_table' => ShippingClassFilter::class,
510 + 'shipping_zone_table' => ShippingZoneFilter::class,
511 + ];
512 +
513 + foreach ($sortOnlyTables as $tableName => $filterClass) {
514 + if (empty($tableConfig[$tableName]['filters']['sorts'])) {
515 + $tableConfig[$tableName]['filters']['sorts'] = call_user_func([$filterClass, 'getSortOptions']);
516 + }
517 + }
518 +
487 519 $tableConfig = apply_filters('fluent_cart/admin_table_saved_views', $tableConfig, [
488 520 'filterOptions' => $filterOptions
489 521 ]);
490 522
@@ -495,8 +527,9 @@
495 527 $appConfig['version'] = FLUENTCART_VERSION;
496 528 $appConfig['permissions'] = PermissionManager::getUserPermissions();
497 529 $appConfig['isProActive'] = App::isProActive();
498 530 $appConfig['proVersion'] = defined('FLUENTCART_PRO_PLUGIN_VERSION') ? FLUENTCART_PRO_PLUGIN_VERSION : null;
531 + $appConfig['fluentPlayer'] = FluentPlayerBridge::adminAppConfig();
499 532
500 533 $appConfig['logos'] = [
501 534 'dark' => Vite::getAssetUrl('images/logo/logo-full-dark.svg'),
502 535 'light' => Vite::getAssetUrl('images/logo/logo-full.svg'),
@@ -501,9 +534,9 @@
501 534 'dark' => Vite::getAssetUrl('images/logo/logo-full-dark.svg'),
502 535 'light' => Vite::getAssetUrl('images/logo/logo-full.svg'),
503 536 ];
504 537 $appConfig['isModuleTabEnabled'] = $settings->isModuleTabEnabled();
505 - $appConfig['upgrade_url'] = 'https://fluentcart.com/pricing/';
538 + $appConfig['upgrade_url'] = Helper::getUpgradeUrl();
506 539
507 540 $max_upload_size = wp_max_upload_size(); // Returns size in bytes
508 541 $adminLocalizeData = apply_filters('fluent_cart/admin_app_data', [
509 542 'app_config' => $appConfig,
@@ -508,8 +541,9 @@
508 541 $adminLocalizeData = apply_filters('fluent_cart/admin_app_data', [
509 542 'app_config' => $appConfig,
510 543 'slug' => $app->config->get('app.slug'),
511 544 'admin_url' => admin_url('admin.php?page=fluent-cart#/'),
545 + 'wp_admin_url' => rtrim(admin_url(), '/'),
512 546 'frontend_url' => URL::getFrontEndUrl(''),
513 547 'nonce' => wp_create_nonce($slug),
514 548 'rest' => $restVars,
515 549 'brand_logo' => $this->getMenuIcon(),
@@ -534,9 +568,9 @@
534 568 'order_statues' => Status::getOrderStatuses(),
535 569 'editable_order_statues' => Status::getEditableOrderStatuses(),
536 570 'editable_customer_statues' => Status::getEditableCustomerStatuses(),
537 571 'shipping_statuses' => Status::getShippingStatuses(),
538 - 'allow_bulk_payment_status_change' => true,
572 + // Attribute library powering the Advanced Variation feature.
539 573 'variation_attributes' => AttributeGroup::with(['terms'])->get(),
540 574 'variation_terms' => AttributeTerm::query()->get()->keyBy('id'),
541 575 'product_image_base_uri' => Helper::getProductImageBaseUri(),
542 576 'add_on_modules' => AddOnModule::showAddOns(),
@@ -561,11 +595,13 @@
561 595 'site_url' => site_url(),
562 596 'modules_settings' => ModuleSettings::getAllSettings(),
563 597 'purchase_fluent_cart_link' => 'https://fluentcart.com/',
564 598 'admin_notices' => apply_filters('fluent_cart/admin_notices', []),
599 + // POSTs data-backfills/run until done; endpoint requires manage_options
600 + 'has_data_migrations' => $hasDataMigrations,
565 601 'subscription_intervals' => Helper::getAvailableSubscriptionIntervalOptions(),
566 602
567 - 'datei18' => TransStrings::dateTimeStrings(),
603 + 'datei18' => DayjsFormatter::localizedStrings(),
568 604 'el_strings' => TransStrings::elStrings(),
569 605 'wp_locale' => get_locale(),
570 606 'is_full_name_required' => CheckoutFieldsSchema::isFullNameRequired(),
571 607 'business_details' => [