From 8e655c54f31968b7da74a7f5a1464c958a0147ed Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Mon, 18 Mar 2024 18:18:11 +0000 Subject: [PATCH] v1.4.12 --- includes/Admin/Menu.php | 57 +++++++---- includes/Admin/templates/upgrade.php | 136 +-------------------------- package.json | 2 +- readme.txt | 6 +- woocommerce-pos.php | 10 +- 5 files changed, 54 insertions(+), 157 deletions(-) diff --git a/includes/Admin/Menu.php b/includes/Admin/Menu.php index dd046359..57a6dba0 100644 --- a/includes/Admin/Menu.php +++ b/includes/Admin/Menu.php @@ -12,6 +12,7 @@ use const HOUR_IN_SECONDS; use const WCPOS\WooCommercePOS\PLUGIN_NAME; +use const WCPOS\WooCommercePOS\VERSION as PLUGIN_VERSION; /** * @@ -39,6 +40,7 @@ public function __construct() { $this->register_pos_admin(); add_filter( 'custom_menu_order', '__return_true' ); add_filter( 'menu_order', array( $this, 'menu_order' ), 9, 1 ); + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_landing_scripts_and_styles' ) ); } // add_filter( 'woocommerce_analytics_report_menu_items', array( $this, 'analytics_menu_items' ) ); @@ -79,25 +81,6 @@ public function menu_order( array $menu_order ): array { * Render the upgrade page. */ public function display_upgrade_page(): void { - $upgrade = get_transient( 'remote_pro_page' ); - - // Check for transient, if none, grab remote HTML file - if ( false === $upgrade ) { - // Get remote HTML file - $response = wp_remote_get( 'http://wcpos.com/pro/?wp-admin=woocommerce-pos' ); - // Check for error - if ( is_wp_error( $response ) ) { - return; - } - // Parse remote HTML file - $upgrade = wp_remote_retrieve_body( $response ); - // Check for error - if ( is_wp_error( $upgrade ) ) { - return; - } - // Store remote HTML file in transient, expire after 24 hours - set_transient( 'remote_pro_page', $upgrade, 24 * HOUR_IN_SECONDS ); - } include_once 'templates/upgrade.php'; } @@ -192,4 +175,40 @@ private function register_pos_admin(): void { ) ); } + + /** + * Enqueue landing page scripts and styles. + */ + public function enqueue_landing_scripts_and_styles( $hook_suffix ): void { + if ( $hook_suffix === $this->toplevel_screen_id ) { + $is_development = isset( $_ENV['DEVELOPMENT'] ) && $_ENV['DEVELOPMENT']; + $url = $is_development ? 'http://localhost:9000/' : 'https://cdn.jsdelivr.net/gh/wcpos/wp-admin-landing/assets/'; + + // Enqueue the landing page CSS from CDN + wp_enqueue_style( + 'wcpos-landing', + $url . 'css/landing.css', + array(), + PLUGIN_VERSION + ); + + // Ensure WordPress bundled React and lodash are loaded as dependencies + wp_enqueue_script( 'react' ); + wp_enqueue_script( 'lodash' ); + + // Enqueue the landing page JS from CDN, with React and lodash as dependencies + wp_enqueue_script( + 'wcpos-landing', + $url . 'js/landing.js', + array( + 'react', + 'react-dom', + 'wp-element', + 'lodash', + ), + PLUGIN_VERSION, + true + ); + } + } } diff --git a/includes/Admin/templates/upgrade.php b/includes/Admin/templates/upgrade.php index 7614aa0f..a02596d9 100644 --- a/includes/Admin/templates/upgrade.php +++ b/includes/Admin/templates/upgrade.php @@ -4,145 +4,19 @@ * * @author Paul Kilmurray * - * @see http://www.kilbot.com.au + * @see http://www.kilbot.com */ ?> - - - -
- - -

- -

Thank you for using WooCommerce POS!

+

- +
- diff --git a/package.json b/package.json index ee7878df..60c63ebb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wcpos/woocommerce-pos", - "version": "1.4.11", + "version": "1.4.12", "description": "A simple front-end for taking WooCommerce orders at the Point of Sale.", "main": "index.js", "workspaces": { diff --git a/readme.txt b/readme.txt index 433e6087..590ed624 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: kilbot Tags: cart, e-commerce, ecommerce, inventory, point-of-sale, pos, sales, sell, shop, shopify, store, vend, woocommerce, wordpress-ecommerce Requires at least: 5.6 -Tested up to: 6.4 -Stable tag: 1.4.11 +Tested up to: 6.5 +Stable tag: 1.4.12 License: GPL-3.0 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -63,7 +63,7 @@ There is more information on our website at [https://wcpos.com](https://wcpos.co == Changelog == -= 1.4.12 - 2024/03/XX = += 1.4.12 - 2024/03/18 = * Security: Fix Insufficient Verification of Data Authenticity to Authenticated (Customer+) Information Disclosure (reported by Lucio Sá) * Fix: Pro plugin not showing updates for some users diff --git a/woocommerce-pos.php b/woocommerce-pos.php index e30c889d..7050d7a0 100644 --- a/woocommerce-pos.php +++ b/woocommerce-pos.php @@ -3,15 +3,19 @@ * Plugin Name: WooCommerce POS * Plugin URI: https://wordpress.org/plugins/woocommerce-pos/ * Description: A simple front-end for taking WooCommerce orders at the Point of Sale. Requires WooCommerce. - * Version: 1.4.11 + * Version: 1.4.12 * Author: kilbot * Author URI: http://wcpos.com * Text Domain: woocommerce-pos * License: GPL-3.0+ * License URI: http://www.gnu.org/licenses/gpl-3.0.txt * Domain Path: /languages + * Requires at least: 5.6 + * Requires PHP: 7.4 + * Requires Plugins: woocommerce + * Tested up to: 6.5 * WC tested up to: 8.6 - * WC requires at least: 5.3. + * WC requires at least: 5.3 * * @author Paul Kilmurray * @@ -22,7 +26,7 @@ namespace WCPOS\WooCommercePOS; // Define plugin constants. -const VERSION = '1.4.11'; +const VERSION = '1.4.12'; const PLUGIN_NAME = 'woocommerce-pos'; const SHORT_NAME = 'wcpos'; \define( __NAMESPACE__ . '\PLUGIN_FILE', plugin_basename( __FILE__ ) ); // 'woocommerce-pos/woocommerce-pos.php'