Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RZ-9295 same approach for the link in the last message and final button #59

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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];
IlievaDayana marked this conversation as resolved.
Show resolved Hide resolved

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