@@ -14,7 +14,7 @@ export async function setupIntercom(
1414 return ;
1515 }
1616
17- const { enableFeedbackPanel, networkTraffic } = preferences . getPreferences ( ) ;
17+ const { enableFeedbackPanel } = preferences . getPreferences ( ) ;
1818
1919 const intercomAppId = process . env . HADRON_METRICS_INTERCOM_APP_ID ;
2020
@@ -37,19 +37,16 @@ export async function setupIntercom(
3737 } ;
3838
3939 async function toggleEnableFeedbackPanel ( enableFeedbackPanel : boolean ) {
40- if ( enableFeedbackPanel ) {
41- if ( await isIntercomAllowed ( networkTraffic ) ) {
42- debug ( 'loading intercom script' ) ;
43- intercomScript . load ( metadata ) ;
44- }
40+ if ( enableFeedbackPanel && ( await isIntercomAllowed ( ) ) ) {
41+ debug ( 'loading intercom script' ) ;
42+ intercomScript . load ( metadata ) ;
4543 } else {
4644 debug ( 'unloading intercom script' ) ;
4745 intercomScript . unload ( ) ;
4846 }
4947 }
5048
51- const shouldLoad =
52- enableFeedbackPanel && ( await isIntercomAllowed ( networkTraffic ) ) ;
49+ const shouldLoad = enableFeedbackPanel && ( await isIntercomAllowed ( ) ) ;
5350
5451 if ( shouldLoad ) {
5552 // In some environment the network can be firewalled, this is a safeguard to avoid
@@ -79,7 +76,7 @@ export async function setupIntercom(
7976 await toggleEnableFeedbackPanel ( shouldLoad ) ;
8077 } catch ( error ) {
8178 debug ( 'initial toggle failed' , {
82- error : error instanceof Error && error . message ,
79+ error,
8380 } ) ;
8481 }
8582
@@ -92,19 +89,17 @@ export async function setupIntercom(
9289 ) ;
9390}
9491
95- function isIntercomAllowed ( allowNetworkTraffic = true ) : Promise < boolean > {
96- return allowNetworkTraffic
97- ? fetchIntegrations ( ) . then (
98- ( { intercom } ) => intercom ,
99- ( error ) => {
100- debug (
101- 'Failed to fetch intercom integration status, defaulting to false' ,
102- { error : error instanceof Error && error . message }
103- ) ;
104- return false ;
105- }
106- )
107- : Promise . resolve ( false ) ;
92+ function isIntercomAllowed ( ) : Promise < boolean > {
93+ return fetchIntegrations ( ) . then (
94+ ( { intercom } ) => intercom ,
95+ ( error ) => {
96+ debug (
97+ 'Failed to fetch intercom integration status, defaulting to false' ,
98+ { error }
99+ ) ;
100+ return false ;
101+ }
102+ ) ;
108103}
109104
110105/**
0 commit comments