From c84f5c73a10937aba7cf7bb6f442aea73005b49a Mon Sep 17 00:00:00 2001 From: Leonard Breitkopf Date: Tue, 30 Nov 2021 11:16:33 +0100 Subject: [PATCH] Fix: Small fixes to make it release ready --- assets/admin/providers/Config/Provider.tsx | 15 +++++++-------- includes/admin/admin-endpoints.php | 11 +++++++++++ includes/wc-internal/shipping-method.php | 4 ++-- readme.txt | 6 +++++- trunkrs-woocommerce.php | 4 ++-- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/assets/admin/providers/Config/Provider.tsx b/assets/admin/providers/Config/Provider.tsx index 60f28ef..5ce298b 100644 --- a/assets/admin/providers/Config/Provider.tsx +++ b/assets/admin/providers/Config/Provider.tsx @@ -9,6 +9,7 @@ import { doUpdateUseTntLinksRequest, doUpdateUseTntAccountsRequest, doUpdateUseAllOrdersAreTrunkrsRequest, + doUpdateUseBigTextRequest, } from './helpers' const initialConfigText = document.getElementById('__tr-wc-settings__') @@ -121,14 +122,12 @@ const ConfigProvider: React.FC = ({ children }) => { isBigTextEnabled: !config.isBigTextEnabled, }) - doUpdateUseAllOrdersAreTrunkrsRequest(!config.isBigTextEnabled).catch( - () => { - setConfig({ - ...config, - isBigTextEnabled: !config.isBigTextEnabled, - }) - }, - ) + doUpdateUseBigTextRequest(!config.isBigTextEnabled).catch(() => { + setConfig({ + ...config, + isBigTextEnabled: !config.isBigTextEnabled, + }) + }) }, [config]) const contextValue = React.useMemo( diff --git a/includes/admin/admin-endpoints.php b/includes/admin/admin-endpoints.php index 61f9592..7b3efb2 100644 --- a/includes/admin/admin-endpoints.php +++ b/includes/admin/admin-endpoints.php @@ -11,6 +11,7 @@ class TRUNKRS_WC_AdminEndpoints const UPDATE_USE_TNT_LINKS_ACTION = 'tr-wc_update-use-tnt-links'; const UPDATE_USE_TNT_ACCOUNT_ACTION = 'tr-wc_update-use-tnt-account'; const UPDATE_USE_ALL_ORDERS_ARE_TRUNKRS = 'tr-wc_update-use-all-orders-are-trunkrs'; + const UPDATE_USE_BIG_CHECKOUT_TEXT = 'tr-wc_update-use-big-checkout-text'; public function __construct() { @@ -19,6 +20,7 @@ public function __construct() add_action('wp_ajax_' . self::UPDATE_USE_TNT_LINKS_ACTION, [$this, 'executeUpdateUseTnTLinksEndpoint']); add_action('wp_ajax_' . self::UPDATE_USE_TNT_ACCOUNT_ACTION, [$this, 'executeUpdateUseTnTAccountEndpoint']); add_action('wp_ajax_' . self::UPDATE_USE_ALL_ORDERS_ARE_TRUNKRS, [$this, 'executeUpdateUseAllOrdersAreTrunkrsEndpoint']); + add_action('wp_ajax_' . self::UPDATE_USE_BIG_CHECKOUT_TEXT, [$this, 'executeUpdateUseBigCheckoutText']); add_action('wp_ajax_' . self::DOWNLOAD_LABEL_ACTION, [$this, 'executeDownloadLabelEndpoint']); add_action('wp_ajax_' . self::CANCEL_ACTION, [$this, 'executeCancelEndpoint']); @@ -90,6 +92,15 @@ public function executeUpdateUseAllOrdersAreTrunkrsEndpoint() wp_die(); } + public function executeUpdateUseBigCheckoutText() { + $value = sanitize_text_field($_POST['isUseBigTextEnabled']) === 'true'; + + TRUNKRS_WC_Settings::setIsBigCheckoutTextEnabled($value); + + status_header(204); + wp_die(); + } + public function executeDownloadLabelEndpoint() { $trunkrsNr = sanitize_text_field($_GET['trunkrsNr']); $labelUrl = TRUNKRS_WC_Api::getLabel($trunkrsNr); diff --git a/includes/wc-internal/shipping-method.php b/includes/wc-internal/shipping-method.php index 01befec..eedfaa8 100644 --- a/includes/wc-internal/shipping-method.php +++ b/includes/wc-internal/shipping-method.php @@ -29,7 +29,7 @@ public static function renderLabel($label, $method) return sprintf( ' - +

Trunkrs: %s

@@ -71,7 +71,7 @@ public static function renderLabel($label, $method) return sprintf( ' - +

Trunkrs: %s

%s

diff --git a/readme.txt b/readme.txt index 9d7fa5e..0d189a0 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: fean Tags: delivery, packages, woocommerce, trunkrs, sameday, delivery Requires at least: 3.6 & WooCommerce 3.0+ Tested up to: 5.8 -Stable tag: 1.0.1 +Stable tag: 1.1.1 Requires PHP: 7.1 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -41,6 +41,10 @@ Reach out to your customer success manager or account manager to get started, th == Changelog == += 1.1.0 = +This release contains more settings to adjust the way we show up in your cart and checkout area. +It's now also possible to redirect all orders to the Trunkrs shipping service. + = 1.0.0 = The first release of the plugin. All of the basic functionality has been implemented. diff --git a/trunkrs-woocommerce.php b/trunkrs-woocommerce.php index 1180f6e..bc76632 100644 --- a/trunkrs-woocommerce.php +++ b/trunkrs-woocommerce.php @@ -5,7 +5,7 @@ * Description: Add excellent consumer focused shipping to your WooCommerce store. * Author: Trunkrs * Author URI: https://trunkrs.nl - * Version: 1.0.1 + * Version: 1.1.1 * Requires at least: 3.6 & WooCommerce 3.0+ * Requires PHP: 7.1 * License: GPLv3 @@ -23,7 +23,7 @@ class TRUNKRS_WC_Bootstrapper /** * @var string The semver version of the plugin. */ - public $version = '1.0.1'; + public $version = '1.1.0'; /** * @var TRUNKRS_WC_Bootstrapper The shared plugin instance.