File tree 1 file changed +49
-2
lines changed
frontend/express/public/javascripts/countly/vue/components
1 file changed +49
-2
lines changed Original file line number Diff line number Diff line change 898
898
return menu ;
899
899
} ) ;
900
900
} ,
901
- handleButtonClick : function ( ) {
901
+ getFlexBannerUrl : function ( ) {
902
+ let defaultFlexUrl = 'https://flex.countly.com?utm_source=countly_lite_banner' ; //fallback
903
+
904
+ return new Promise ( ( resolve ) => {
905
+ try {
906
+ if ( ! window . Countly ) {
907
+ CountlyHelpers . notify ( {
908
+ title : "Error" ,
909
+ message : "Countly SDK is not available" ,
910
+ type : "error"
911
+ } ) ;
912
+ return resolve ( defaultFlexUrl ) ;
913
+ }
914
+
915
+ let CountlySDK ;
916
+ if ( window . Countly . present_feedback_widget ) {
917
+ CountlySDK = window . Countly ;
918
+ }
919
+ else {
920
+ CountlySDK = window . Countly . init ( {
921
+ app_key : countlyGlobal . frontend_app ,
922
+ url : countlyGlobal . frontend_server ,
923
+ device_id : window . Countly . device_id || window . location . hostname ,
924
+ remote_config : true
925
+ } ) ;
926
+ }
927
+
928
+ if ( CountlySDK . fetch_remote_config ) {
929
+ CountlySDK . fetch_remote_config ( function ( err , conf ) {
930
+ if ( err ) {
931
+ resolve ( defaultFlexUrl ) ;
932
+ }
933
+ else {
934
+ resolve ( conf . flex_banner_url || defaultFlexUrl ) ;
935
+ }
936
+ } ) ;
937
+ }
938
+ else {
939
+ resolve ( defaultFlexUrl ) ;
940
+ }
941
+ }
942
+ catch {
943
+ resolve ( defaultFlexUrl ) ;
944
+ }
945
+ } ) ;
946
+ } ,
947
+ handleButtonClick : async function ( ) {
948
+ const flexRedirectUrl = await this . getFlexBannerUrl ( ) ;
902
949
CountlyHelpers . goTo ( {
903
- url : "https://flex.countly.com" ,
950
+ url : flexRedirectUrl ,
904
951
isExternalLink : true
905
952
} ) ;
906
953
}
You can’t perform that action at this time.
0 commit comments