@@ -76,6 +76,33 @@ function( $data, $page_slug ) {
76
76
2
77
77
);
78
78
}
79
+
80
+ /**
81
+ * Load SDK dependencies.
82
+ */
83
+ add_filter ( 'themeisle_internal_page ' , function ( $ product_name , $ page_slug ) {
84
+ if ( $ product_name !== $ this ->plugin_name ) {
85
+ return ;
86
+ }
87
+
88
+ if ( in_array ( $ page_slug , array ( 'imports ' , 'categories ' ), true ) ) {
89
+ $ this ->add_banner_anchor ();
90
+ }
91
+
92
+ if ( in_array ( $ page_slug , array ( 'imports ' , 'categories ' , 'settings ' ), true ) ) {
93
+ $ license_data = get_option ( 'feedzy_rss_feeds_pro_license_data ' , array () );
94
+ if ( self ::plan_category ( $ license_data ) <= 1 ) {
95
+ do_action ( 'themeisle_sdk_load_banner ' , 'feedzy ' );
96
+ }
97
+ }
98
+
99
+ if (
100
+ in_array ( $ page_slug , array ( 'imports ' , 'new-category ' , 'settings ' ), true )
101
+ && 'yes ' === get_option ( 'feedzy_rss_feeds_logger_flag ' , false )
102
+ ) {
103
+ $ this ->enable_telemetry ();
104
+ }
105
+ }, 10 , 2 );
79
106
}
80
107
81
108
/**
@@ -133,22 +160,8 @@ public function enqueue_styles_admin() {
133
160
return ;
134
161
}
135
162
136
- $ telemetry_enabled = get_option ( 'feedzy_rss_feeds_logger_flag ' , false );
137
- if ( ! defined ( 'TI_CYPRESS_TESTING ' ) &&
138
- ! empty ( $ telemetry_enabled ) &&
139
- (
140
- 'feedzy_categories ' === $ screen ->post_type ||
141
- 'feedzy_page_feedzy-settings ' === $ screen ->base ||
142
- 'feedzy_imports ' === $ screen ->post_type
143
- )
144
- ) {
145
- wp_enqueue_script ( $ this ->plugin_name . '_telemetry ' , FEEDZY_ABSURL . 'js/telemetry.js ' , array (), $ this ->version , true );
146
- }
147
-
148
163
if ( 'feedzy_imports ' === $ screen ->post_type && 'edit ' === $ screen ->base ) {
149
164
$ this ->do_internal_page ( 'imports ' );
150
-
151
- $ this ->add_banner_anchor ();
152
165
}
153
166
154
167
if ( 'feedzy_categories ' === $ screen ->post_type ) {
@@ -175,7 +188,6 @@ public function enqueue_styles_admin() {
175
188
),
176
189
)
177
190
);
178
- $ this ->add_banner_anchor ();
179
191
}
180
192
181
193
if ( 'feedzy_page_feedzy-settings ' === $ screen ->base || 'feedzy_page_feedzy-integration ' === $ screen ->base ) {
@@ -197,17 +209,6 @@ public function enqueue_styles_admin() {
197
209
);
198
210
}
199
211
200
- if (
201
- 'feedzy_page_feedzy-settings ' === $ screen ->base ||
202
- 'feedzy_categories ' === $ screen ->post_type ||
203
- ( 'feedzy_imports ' === $ screen ->post_type && 'edit ' === $ screen ->base )
204
- ) {
205
- $ license_data = get_option ( 'feedzy_rss_feeds_pro_license_data ' , array () );
206
- if ( self ::plan_category ( $ license_data ) <= 1 ) {
207
- do_action ( 'themeisle_sdk_load_banner ' , 'feedzy ' );
208
- }
209
- }
210
-
211
212
$ upsell_screens = array ( 'feedzy-rss_page_feedzy-settings ' , 'feedzy-rss_page_feedzy-admin-menu-pro-upsell ' );
212
213
if ( 'feedzy_imports ' === $ screen ->post_type && 'edit ' !== $ screen ->base ) {
213
214
@@ -252,11 +253,13 @@ public function enqueue_styles_admin() {
252
253
wp_enqueue_style ( 'wp-block-editor ' );
253
254
254
255
wp_set_script_translations ( $ this ->plugin_name . '_conditions ' , 'feedzy-rss-feeds ' );
256
+ $ this ->enable_telemetry ();
255
257
}
256
258
if ( ! defined ( 'TI_CYPRESS_TESTING ' ) && ( 'edit ' !== $ screen ->base && 'feedzy_imports ' === $ screen ->post_type && feedzy_show_import_tour () ) ) {
257
259
$ asset_file = include FEEDZY_ABSPATH . '/build/onboarding/index.asset.php ' ;
258
260
wp_enqueue_script ( $ this ->plugin_name . '_on_boarding ' , FEEDZY_ABSURL . 'build/onboarding/index.js ' , array_merge ( $ asset_file ['dependencies ' ], array ( 'wp-editor ' , 'wp-api ' ) ), $ asset_file ['version ' ], true );
259
261
wp_set_script_translations ( $ this ->plugin_name . '_on_boarding ' , 'feedzy-rss-feeds ' );
262
+ $ this ->enable_telemetry ();
260
263
}
261
264
262
265
if ( 'feedzy_page_feedzy-settings ' === $ screen ->base ) {
@@ -2064,7 +2067,8 @@ public function get_survey_data() {
2064
2067
$ integration_status = $ this ->api_license_status ();
2065
2068
2066
2069
$ days_since_install = round ( ( time () - get_option ( 'feedzy_rss_feeds_install ' , time () ) ) / DAY_IN_SECONDS );
2067
- $ install_category = 0 ;
2070
+ $ install_category = 0 ;
2071
+
2068
2072
if ( 0 === $ days_since_install || 1 === $ days_since_install ) {
2069
2073
$ install_category = 0 ;
2070
2074
} elseif ( 1 < $ days_since_install && 8 > $ days_since_install ) {
@@ -2077,14 +2081,8 @@ public function get_survey_data() {
2077
2081
$ install_category = 91 ;
2078
2082
}
2079
2083
2080
- $ masked_key_license = null ;
2081
- if ( isset ( $ license_data ->key ) ) {
2082
- $ masked_key_license = str_repeat ( '* ' , strlen ( $ license_data ->key ) / 2 ) . substr ( $ license_data ->key , strlen ( $ license_data ->key ) / 2 );
2083
- }
2084
-
2085
- return array (
2084
+ $ survey_data = array (
2086
2085
'environmentId ' => 'clskgehf78eu5podwdrnzciti ' ,
2087
- 'apiHost ' => 'https://app.formbricks.com ' ,
2088
2086
'attributes ' => array (
2089
2087
'free_version ' => $ this ->version ,
2090
2088
'pro_version ' => defined ( 'FEEDZY_PRO_VERSION ' ) ? FEEDZY_PRO_VERSION : '' ,
@@ -2095,10 +2093,15 @@ public function get_survey_data() {
2095
2093
'plan ' => $ this ->plan_category ( $ license_data ),
2096
2094
'days_since_install ' => $ install_category ,
2097
2095
'install_days_number ' => $ days_since_install ,
2098
- 'license_status ' => ! empty ( $ license_data ->license ) ? $ license_data ->license : 'invalid ' ,
2099
- 'license_key ' => $ masked_key_license
2096
+ 'license_status ' => ! empty ( $ license_data ->license ) ? $ license_data ->license : 'invalid '
2100
2097
),
2101
2098
);
2099
+
2100
+ if ( isset ( $ license_data ->key ) ) {
2101
+ $ survey_data ['attributes ' ]['license_key ' ] = apply_filters ( 'themeisle_sdk_secret_masking ' , $ license_data ->key );
2102
+ }
2103
+
2104
+ return $ survey_data ;
2102
2105
}
2103
2106
2104
2107
/**
@@ -2348,4 +2351,16 @@ public function register_settings() {
2348
2351
private function do_internal_page ( $ page_slug ) {
2349
2352
do_action ( 'themeisle_internal_page ' , $ this ->plugin_name , $ page_slug );
2350
2353
}
2354
+
2355
+ /**
2356
+ * Enable the loading of telemetry script in page.
2357
+ */
2358
+ private function enable_telemetry () {
2359
+ if ( defined ( 'E2E_TESTING ' ) ) {
2360
+ return ;
2361
+ }
2362
+
2363
+ add_filter ( 'themeisle_sdk_enable_telemetry ' , '__return_true ' );
2364
+ wp_enqueue_script ( $ this ->plugin_name . '_telemetry ' , FEEDZY_ABSURL . 'js/telemetry.js ' , array (), $ this ->version , true );
2365
+ }
2351
2366
}
0 commit comments