Skip to content

Commit

Permalink
Merge pull request #11 from alvinjohnsonso/master
Browse files Browse the repository at this point in the history
Changed file structure for composer and fix for removing widget
  • Loading branch information
GeekOfAges authored Nov 18, 2020
2 parents 4907c39 + d56fa1c commit 4e19ee5
Show file tree
Hide file tree
Showing 23 changed files with 22 additions and 19 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Magento Tawk.to Live Chat Module

This module adds Tawk.to Live Chat to your Magento 2 site.

To install and set up your tawk.to account, please follow this documentation https://www.tawk.to/knowledgebase/plugins-and-modules/magento-2-integration/
To install and set up your tawk.to account, please follow this documentation https://docs.tawk.help/article/magento
File renamed without changes.
5 changes: 0 additions & 5 deletions app/code/Tawk/Widget/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions app/code/Tawk/Widget/composer.json → composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"name": "tawk/widget",
"description": "Tawk live chat widget",
"type": "magento2-module",
"version": "1.0.0",
"version": "1.4.0",
"license": [
"OSL-3.0"
],
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.12"
"php": ">=5.6.0"
},
"autoload": {
"files": [ "registration.php" ],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/code/Tawk/Widget/etc/module.xml → etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
-->

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Tawk_Widget" setup_version="1.3.1"/>
<module name="Tawk_Widget" setup_version="1.4.0"/>
</config>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,20 @@ input:checked + .slider:before {
}
</style>
<script type="text/javascript">
require(['jquery', 'jquery/ui'], function($){
require(['jquery', 'jquery/ui'], function($){
$.noConflict();
jQuery(function() {

jQuery.get('<?php echo $this->getStoreWidget() ?>?id=' + jQuery( "#websiteids" ).val(), function (response) {
document.getElementById('tawk_widget_customization').src = 'https://plugins.tawk.to/generic/widgets?currentWidgetId=' + response.widgetid + '&currentPageId='+ response.pageid +'&transparentBackground=1&parentDomain=<?php echo $this->mainurl() ?>';

jQuery.get('<?php echo $this->getStoreWidget() ?>?id=' + jQuery( "#websiteids" ).val(), function (response) {
var src = 'https://plugins.tawk.to/generic/widgets?'
if (response.widgetid) {
src = src + '&currentWidgetId=' + response.widgetid;
}
if (response.pageid) {
src = src + '&currentPageId=' + response.pageid;
}
src = src + '&transparentBackground=1&parentDomain=<?php echo $this->mainurl() ?>';
document.getElementById('tawk_widget_customization').src = src;

jQuery('#excludeurl').val(response.excludeurl);
jQuery('#includeurl').val(response.includeurl);
Expand All @@ -161,7 +169,7 @@ input:checked + .slider:before {
}

});


if(jQuery("#alwaysdisplay").prop("checked")){
jQuery("#exlucded_urls_container").show();
Expand All @@ -185,7 +193,7 @@ input:checked + .slider:before {
}
}
});

function setWidget(e) {
alwaysdisplay = jQuery('#alwaysdisplay').is(":checked");
var alwaysdisplayvalue = alwaysdisplay ? 1 : 0;
Expand All @@ -208,7 +216,7 @@ input:checked + .slider:before {
}

function removeWidget(e) {
jQuery.get('<?php echo $this->getRemoveUrl() ?>?id=' + e.data.id, function (response) {
jQuery.get('<?php echo $this->getRemoveUrl() ?>?id=' + jQuery( "#websiteids" ).val(), function (response) {
e.source.postMessage({action : 'removeDone'}, '<?php echo $this->getBaseUrl() ?>');
});
}
Expand Down Expand Up @@ -240,9 +248,9 @@ input:checked + .slider:before {
document.getElementById('tawk_widget_customization').src = "";
jQuery("#visibility_options").hide();
}else{
jQuery.get('<?php echo $this->getStoreWidget() ?>?id=' + this.value, function (response) {
jQuery.get('<?php echo $this->getStoreWidget() ?>?id=' + this.value, function (response) {
document.getElementById('tawk_widget_customization').src = 'https://plugins.tawk.to/generic/widgets?currentWidgetId=' + response.widgetid + '&currentPageId='+ response.pageid +'&transparentBackground=1&parentDomain=<?php echo $this->mainurl() ?>';
jQuery("#visibility_options").show();
jQuery("#visibility_options").show();
});

jQuery('#excludeurl').val(response.excludeurl);
Expand All @@ -262,7 +270,7 @@ input:checked + .slider:before {
jQuery("#included_urls_container").hide();
}

}
}
});

jQuery("#alwaysdisplay").change(function() {
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 4e19ee5

Please sign in to comment.