Skip to content

Commit

Permalink
RZ-9295 same approach for the link in the last message and final button
Browse files Browse the repository at this point in the history
  • Loading branch information
insssomniac committed Dec 4, 2023
1 parent e57d130 commit ce4f5e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/lib/chat-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,12 @@ const ChatUi = {

if (this.link) {
this.setCtaButton();
this.attachLinkEventListener();
if(getTerm() === experimentsPrompt.finalPage){
this.link.remove();
}
}

if (content.includes(intentionType.email)) {
this.setEmailVisibility();
}
Expand Down Expand Up @@ -377,6 +379,7 @@ const ChatUi = {
this.link = constructLink(this.boldedText);
if (this.link) {
this.setCtaButton();
this.attachLinkEventListener();
}

let strongTaggedText = this.boldedText.replace('{', '').replace('}', '');
Expand Down Expand Up @@ -501,6 +504,16 @@ const ChatUi = {
});
},

attachLinkEventListener() {
const links = document.querySelectorAll('.js-assistant-message a');
const link = links[links.length - 1];

link.addEventListener('click', () => {
this.track(customEventTypes.linkClicked);
this.closeWidget();
});
},

/**
* Sets custom variables and applies them to the main container element and font family.
* Theme-specific properties are handled separately.
Expand Down

0 comments on commit ce4f5e4

Please sign in to comment.