@@ -29,19 +29,27 @@ interface TemplateButtonProps {
2929 template : HomepageData [ "templates" ] [ 0 ] ;
3030}
3131
32+ export const handleClickTemplate = (
33+ createUrl : string ,
34+ template : TemplateButtonProps [ "template" ]
35+ ) => {
36+ trackClientJourneyEvent ( "ai_interest_shown" , {
37+ page : window . location . pathname ,
38+ source : "template_gallery" ,
39+ template_id : template . id ,
40+ template_name : template . name ,
41+ template_type : template . type ,
42+ } ) ;
43+
44+ setTimeout ( ( ) => {
45+ window . location . href = createUrl ;
46+ } , 100 ) ;
47+ } ;
48+
3249export function TemplateButton ( { createUrl, template } : TemplateButtonProps ) {
33- const handleClick = ( ) => {
34- trackClientJourneyEvent ( "ai_interest_shown" , {
35- page : window . location . pathname ,
36- source : "template_gallery" ,
37- template_id : template . id ,
38- template_name : template . name ,
39- template_type : template . type ,
40- } ) ;
41-
42- setTimeout ( ( ) => {
43- window . location . href = createUrl ;
44- } , 100 ) ;
50+ const handleClick = ( ev : React . MouseEvent < HTMLButtonElement > ) => {
51+ ev . stopPropagation ( ) ;
52+ handleClickTemplate ( createUrl , template ) ;
4553 } ;
4654
4755 return (
0 commit comments