Skip to content

Commit

Permalink
Fix: Small fixes to make it release ready
Browse files Browse the repository at this point in the history
  • Loading branch information
fean committed Nov 30, 2021
1 parent 6e51d1b commit c84f5c7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
15 changes: 7 additions & 8 deletions assets/admin/providers/Config/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
doUpdateUseTntLinksRequest,
doUpdateUseTntAccountsRequest,
doUpdateUseAllOrdersAreTrunkrsRequest,
doUpdateUseBigTextRequest,
} from './helpers'

const initialConfigText = document.getElementById('__tr-wc-settings__')
Expand Down Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions includes/admin/admin-endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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']);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions includes/wc-internal/shipping-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function renderLabel($label, $method)
return sprintf(
'<span class="tr-wc-checkout-container">
<span class="tr-wc-checkout-title-container">
<img class="tr-wc-checkout-logo" alt="Trunkrs logo" src="%s" />
<img class="tr-wc-checkout-logo" style="height: 28px;" alt="Trunkrs logo" src="%s" />
<p class="tr-wc-checkout-title"><b>Trunkrs</b>: %s</p>
</span>
</span>
Expand Down Expand Up @@ -71,7 +71,7 @@ public static function renderLabel($label, $method)
return sprintf(
'<span class="tr-wc-checkout-container">
<span class="tr-wc-checkout-title-container">
<img class="tr-wc-checkout-logo" alt="Trunkrs logo" src="%s" />
<img class="tr-wc-checkout-logo" style="height: 28px;" alt="Trunkrs logo" src="%s" />
<p class="tr-wc-checkout-title"><b>Trunkrs</b>: %s</p>
</span>
<p class="tr-wc-checkout-description">%s</p>
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.

4 changes: 2 additions & 2 deletions trunkrs-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit c84f5c7

Please sign in to comment.