File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,9 +62,20 @@ function setupPylon() {
6262 }
6363}
6464
65+ export function hidePylon ( ) {
66+ if ( typeof window . Pylon !== 'undefined' ) {
67+ window . Pylon ( 'hideChatBubble' )
68+ }
69+ }
70+
6571export function identifyChatUser ( ) {
6672 if ( flagsmith . hasFeature ( 'pylon_chat' ) && ! isFreePlan ( ) ) {
6773 setupPylon ( )
74+ if ( typeof window . Pylon !== 'undefined' ) {
75+ window . Pylon ( 'showChatBubble' )
76+ }
77+ } else {
78+ hidePylon ( )
6879 }
6980}
7081
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import { sortBy } from 'lodash'
1313import Project from 'common/project'
1414import { getStore } from 'common/store'
1515import { setSelectedOrganisationId } from 'common/selectedOrganisationSlice'
16+ import { hidePylon , identifyChatUser } from 'common/loadChat'
1617import { service } from 'common/service'
1718import { getBuildVersion } from 'common/services/useBuildVersion'
1819import { createOnboardingSupportOptIn } from 'common/services/useOnboardingSupportOptIn'
@@ -312,6 +313,7 @@ const controller = {
312313 store . organisation = find ( store . model . organisations , { id } )
313314 getStore ( ) . dispatch ( setSelectedOrganisationId ( id ) )
314315 store . changed ( )
316+ identifyChatUser ( )
315317 } ,
316318
317319 setToken : ( token ) => {
@@ -373,6 +375,7 @@ const controller = {
373375 ) . finally ( ( ) => {
374376 API . setCookie ( 't' , '' )
375377 data . setToken ( null )
378+ hidePylon ( )
376379 API . reset ( ) . finally ( ( ) => {
377380 store . model = user
378381 store . organisation = null
You can’t perform that action at this time.
0 commit comments