Do not render messages when buttons are not rendered.

This commit is contained in:
Narek Zakarian 2022-06-01 15:43:49 +04:00
parent 77230fefa8
commit 6effc222f2
2 changed files with 11 additions and 0 deletions

View file

@ -14,6 +14,7 @@ class SingleProductBootstap {
if (!this.shouldRender()) {
this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);
this.renderer.hideButtons(this.gateway.button.wrapper);
this.messages.hideMessages();
return;
}
@ -26,6 +27,7 @@ class SingleProductBootstap {
if (!this.shouldRender()) {
this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);
this.messages.hideMessages();
return;
}

View file

@ -53,5 +53,14 @@ class MessageRenderer {
}
return true;
}
hideMessages() {
const domElement = document.querySelector(this.config.wrapper);
if (! domElement ) {
return false;
}
domElement.style.display = 'none';
return true;
}
}
export default MessageRenderer;