Skip to content

Commit

Permalink
Merge pull request #64 from gigya/GMSP-12
Browse files Browse the repository at this point in the history
Fixed a JavaScript error on certain Gigya submit events due to a conflict with Magento
  • Loading branch information
Ynhockey authored Jun 5, 2019
2 parents 4498cea + eaaae56 commit 046fa29
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions view/frontend/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ var config = {
'Magento_Customer/js/view/authentication-popup': {
'Gigya_GigyaIM/js/view/authentication-popup': true
},
'Magento_Customer/js/customer-data': {
'Gigya_GigyaIM/js/customer-data': true
},
'Magento_Checkout/js/view/authentication': {
'Gigya_GigyaIM/js/view/authentication': true
},
Expand Down
1 change: 1 addition & 0 deletions view/frontend/templates/gigya_script.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ $scriptDomain = $this->helper('Gigya\GigyaIM\Helper\GigyaScriptHelper')->getGigy
var magento_user_logged_in = false;
var enable_login = true;
var gigya_enabled = <?php echo $block->isGigyaEnabled() ? 'true' : 'false'; ?>;
var gigya_login_in_progress = false;

var m;
</script>
Expand Down
16 changes: 16 additions & 0 deletions view/frontend/web/js/customer-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
define(function () {
'use strict';

return function (Component) {
Component.reloadOriginal = Component.reload;
Component.reload = function (sectionNames, updateSectionId) {
if (typeof gigya_enabled !== "undefined" && gigya_enabled && gigya_login_in_progress == true) {
return;
}

return this.reloadOriginal(sectionNames, updateSectionId);
}

return Component;
}
});
3 changes: 3 additions & 0 deletions view/frontend/web/js/gigya_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ define([
"login[]": "",
login_data: JSON.stringify(loginData)
};

gigya_login_in_progress = true;

gigyaMage2.Functions.gigyaAjaxSubmit(action, data, $('.gigya-loader-location'));
};

Expand Down

0 comments on commit 046fa29

Please sign in to comment.