Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tjitse-E committed May 16, 2024
0 parents commit 2443385
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Vendic B.V.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 27 additions & 0 deletions Plugin/DispatchBrowserEventAfterSelect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* @copyright Copyright (c) Vendic B.V https://vendic.nl/
*/
namespace Vendic\HyvaCheckoutHideBusinessFieldsGoogleAutocompleteCompat\Plugin;

use Hyva\Checkout\Magewire\Checkout\AddressView\MagewireAddressFormInterface;
use Hyva\Checkout\Model\Form\EntityFieldInterface;
use Hyva\Checkout\Model\Form\EntityFormInterface;

class DispatchBrowserEventAfterSelect
{
/**
* Dispatch browser event after select field
*/
public function afterSaveSelectField(
\Vendic\HyvaCheckoutHideBusinessFields\Model\Form\AddCustomerTypeRadioButtons $subject,
$result,
EntityFormInterface $form,
EntityFieldInterface $field,
MagewireAddressFormInterface $addressComponent
) {
if (method_exists($addressComponent, 'dispatchBrowserEvent')) {
$addressComponent->dispatchBrowserEvent('re-init-google-autocomplete');
}
}
}
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Hyva Checkout Hide Business Fields Google Autocomplete Compatibility Module

This Magento 2 module ensures compatibility between the Hyva Checkout Hide Business Fields module and the Google Autocomplete module. By integrating these two modules, it allows for a smoother and more efficient checkout experience.

## Installation

To install this module, use Composer. Run the following command in your Magento 2 root directory:

```bash
composer require vendic/hyva-checkout-hide-business-fields-google-autocomplete-compat
```

## Requirements

- PHP ~8.2
- [vendic/hyva-checkout-google-address-autocomplete](https://github.com/Vendic/hyva-checkout-google-address-autocomplete) ^1.2
- [vendic/hyva-checkout-hide-business-fields](https://github.com/Vendic/hyva-checkout-hide-business-fields) ^1.0

## License

This module is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
19 changes: 19 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "vendic/hyva-checkout-hide-business-fields-google-autocomplate-compat",
"description": "Compatibility module that makes the Hyva Checkout Hide Business Fields module compatible with the Google Autocomplete module",
"require": {
"php": "~8.2",
"vendic/hyva-checkout-google-address-autocomplete": "^1.2",
"vendic/hyva-checkout-hide-business-fields": "^1.0"
},
"type": "magento2-module",
"license": ["MIT"],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Vendic\\HyvaCheckoutHideBusinessFieldsGoogleAutocompleteCompat\\": ""
}
}
}
9 changes: 9 additions & 0 deletions etc/frontend/di.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="Vendic\HyvaCheckoutHideBusinessFields\Model\Form\AddCustomerTypeRadioButtons">
<plugin sortOrder="1"
name="vendicHyvaCheckoutHideBusinessFieldsGoogleAutocompleteCompatAddCustomerTypeRadioButtons"
type="Vendic\HyvaCheckoutHideBusinessFieldsGoogleAutocompleteCompat\Plugin\DispatchBrowserEventAfterSelect"/>
</type>
</config>
10 changes: 10 additions & 0 deletions etc/module.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendic_HyvaCheckoutHideBusinessFieldsGoogleAutocompleteCompat">
<sequence>
<module name="Vendic_HyvaCheckoutHideBusinessFields"/>
<module name="Vendic_HyvaCheckoutGoogleAddressAutocomplete"/>
</sequence>
</module>
</config>
7 changes: 7 additions & 0 deletions registration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Vendic_HyvaCheckoutHideBusinessFieldsGoogleAutocompleteCompat',
__DIR__
);

0 comments on commit 2443385

Please sign in to comment.