Skip to content

Commit

Permalink
Merge pull request #102 from Paazl/release/1.15.1
Browse files Browse the repository at this point in the history
Release/1.15.1
  • Loading branch information
Marvin-Magmodules authored Nov 15, 2023
2 parents d462faa + cbc0478 commit 7b16f36
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 26,678 deletions.
60 changes: 31 additions & 29 deletions Block/Checkout/Widget.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* Copyright © Paazl. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Paazl\CheckoutWidget\Block\Checkout;

use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Paazl\CheckoutWidget\Model\Api\UrlProvider;
use Paazl\CheckoutWidget\Model\Api\UrlProviderFactory;
use Paazl\CheckoutWidget\Model\Checkout\WidgetConfigProvider;
use Paazl\CheckoutWidget\Model\Config;
use Magento\Framework\View\Element\Template\Context;

/**
* Class Widget
*
* @package Paazl\CheckoutWidget\Block\Checkout
*/
class Widget extends Template
{

Expand All @@ -26,11 +20,6 @@ class Widget extends Template
*/
private $scopeConfig;

/**
* @var WidgetConfigProvider
*/
private $widgetConfigProvider;

/**
* @var UrlProvider
*/
Expand All @@ -39,27 +28,22 @@ class Widget extends Template
/**
* Widget constructor.
*
* @param Context $context
* @param Config $scopeConfig
* @param UrlProviderFactory $urlProviderFactory
* @param WidgetConfigProvider $widgetConfigProvider
* @param array $data
* @param Context $context
* @param Config $scopeConfig
* @param UrlProviderFactory $urlProviderFactory
* @param array $data
*/
public function __construct(
Context $context,
Config $scopeConfig,
UrlProviderFactory $urlProviderFactory,
WidgetConfigProvider $widgetConfigProvider,
array $data = []
) {
$this->scopeConfig = $scopeConfig;
$this->widgetConfigProvider = $widgetConfigProvider;
$this->urlProvider = $urlProviderFactory->create();
parent::__construct($context, $data);
}

// ---

/**
* @return mixed
*/
Expand All @@ -71,17 +55,35 @@ public function getCustomCss()
/**
* @return boolean
*/
public function isEnabled()
public function getGoogleMapKey()
{
return $this->scopeConfig->isEnabled();
return $this->scopeConfig->getGoogleMapKey();
}

/**
* @return string
*/
public function getApiBaseUrl()
{
return $this->urlProvider->getBaseUrl();
}

/**
* @return boolean
*/
public function getGoogleMapKey()
public function useLocal(): bool
{
return $this->scopeConfig->getGoogleMapKey();
return $this->scopeConfig->isUseLocalCopyOfWidgetJs();
}

/**
* @return string
*/
public function getLocalResourceUrl(): string
{
$cssFile = 'paazl-checkout.min.css';
$url = $this->getViewFileUrl('Paazl_CheckoutWidget::css/' . $cssFile);
return str_replace($cssFile, '', $url);
}

/**
Expand All @@ -97,10 +99,10 @@ protected function _toHtml()
}

/**
* @return string
* @return boolean
*/
public function getApiBaseUrl()
public function isEnabled()
{
return $this->urlProvider->getBaseUrl();
return $this->scopeConfig->isEnabled();
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "paazl/magento2-checkout-widget",
"description": "Paazl checkoutWidget for Magento 2",
"type": "magento2-module",
"version": "1.15.0",
"version": "1.15.1",
"keywords": [
"Paazl",
"Magento 2",
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<default>
<carriers>
<paazlshipping>
<version>v1.15.0</version>
<version>v1.15.1</version>
<active>0</active>
<sallowspecific>0</sallowspecific>
<price>0</price>
Expand Down
6 changes: 6 additions & 0 deletions view/base/templates/checkout/widget.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
<?php if ($block->getApiBaseUrl()) : ?>
<script type="text/javascript">
window.PAAZL_CHECKOUT_WIDGET_API_URL = '<?= /* @escapeNotVerified */ $block->getApiBaseUrl(); ?>';
window.PAAZL_CHECKOUT_WIDGET_LOCAL_RESOURCE_URL = '<?= /* @escapeNotVerified */ $block->getLocalResourceUrl(); ?>';
</script>
<?php endif; ?>
<?php if ($block->useLocal()) : ?>
<script type="text/javascript">
window.PAAZL_CHECKOUT_WIDGET_RESOURCE_URL = '<?= /* @escapeNotVerified */ $block->getLocalResourceUrl(); ?>';
</script>
<?php endif; ?>
<?php if ($block->getCustomCss() != '') : ?>
<style>:root {<?= /* @escapeNotVerified */ $block->getCustomCss() ?>}</style>
<?php endif; ?>
3 changes: 3 additions & 0 deletions view/frontend/web/css/paazl-checkout.min.css

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion view/frontend/web/js/checkout/lib/checkout_local_live.js

Large diffs are not rendered by default.

Loading

0 comments on commit 7b16f36

Please sign in to comment.