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 Nov 30, 2023
1 parent e57d130 commit 469acd8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "1ff-chat-ui",
"version": "1.0.46",
"version": "1.0.47",
"description": "chatbot to communicate with taught ai",
"main": "src/lib/chat-ui.js",
"scripts": {
Expand Down
14 changes: 14 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 Expand Up @@ -548,6 +561,7 @@ const ChatUi = {
emailInput: document.getElementById('chat-email'),
errorEmail: document.querySelector('.js-error-email'),
paymentFormLoader: document.querySelector('.js-payment-form-loader'),

};
},
/**
Expand Down

0 comments on commit 469acd8

Please sign in to comment.