@@ -179,7 +179,7 @@ public function form_submissions_callback() {
179179 <img style="max-width: 100%" src="<?php echo esc_url ( OTTER_BLOCKS_URL . 'assets/images/form-submissions-upsell.svg ' ); ?> " alt="Otter Form Submissions Upsell" />
180180 <h2 style="line-height: 1"><?php esc_html_e ( 'Collect Your Form Submissions ' , 'otter-blocks ' ); ?> </h2>
181181 <p><?php esc_html_e ( 'Store, manage and analyze your form submissions with ease – all in one place. With Otter powerful features, managing submissions has never been simpler. ' , 'otter-blocks ' ); ?> </p>
182- <a href="<?php echo esc_url ( tsdk_utmify ( 'https://themeisle.com/plugins/otter-blocks/upgrade/ ' , 'form-submissions ' , 'admin ' ) ); ?> " class="button button-primary" target="_blank"><?php esc_html_e ( 'Explore Otter PRO ' , 'otter-blocks ' ); ?> </a>
182+ <a href="<?php echo esc_url ( tsdk_translate_link ( tsdk_utmify ( 'https://themeisle.com/plugins/otter-blocks/upgrade/ ' , 'form-submissions ' , 'admin ' ) ) ); ?> " class="button button-primary" target="_blank"><?php esc_html_e ( 'Explore Otter PRO ' , 'otter-blocks ' ); ?> </a>
183183 </div>
184184 </div>
185185 <?php
@@ -192,9 +192,7 @@ public function form_submissions_callback() {
192192 * @access public
193193 */
194194 public function enqueue_options_assets () {
195- $ wp_upload_dir = wp_upload_dir ( null , false );
196- $ basedir = $ wp_upload_dir ['basedir ' ] . '/themeisle-gutenberg/ ' ;
197- $ asset_file = include OTTER_BLOCKS_PATH . '/build/dashboard/index.asset.php ' ;
195+ $ asset_file = include OTTER_BLOCKS_PATH . '/build/dashboard/index.asset.php ' ;
198196
199197 wp_enqueue_style (
200198 'otter-blocks-styles ' ,
@@ -213,55 +211,67 @@ public function enqueue_options_assets() {
213211
214212 wp_set_script_translations ( 'otter-blocks-scripts ' , 'otter-blocks ' );
215213
216- $ offer = new LimitedOffers ();
217-
218214 wp_localize_script (
219215 'otter-blocks-scripts ' ,
220216 'otterObj ' ,
221- apply_filters (
222- 'otter_dashboard_data ' ,
223- array (
224- 'version ' => OTTER_BLOCKS_VERSION ,
225- 'assetsPath ' => OTTER_BLOCKS_URL . 'assets/ ' ,
226- 'stylesExist ' => is_dir ( $ basedir ) || boolval ( get_transient ( 'otter_animations_parsed ' ) ),
227- 'hasPro ' => Pro::is_pro_installed (),
228- 'upgradeLink ' => tsdk_utmify ( Pro::get_url (), 'options ' , Pro::get_reference () ),
229- 'docsLink ' => Pro::get_docs_url (),
230- 'showFeedbackNotice ' => $ this ->should_show_feedback_notice (),
231- 'deal ' => ! Pro::is_pro_installed () ? $ offer ->get_localized_data () : array (),
232- 'hasOnboarding ' => false !== get_theme_support ( FSE_Onboarding::SUPPORT_KEY ),
233- 'days_since_install ' => round ( ( time () - get_option ( 'otter_blocks_install ' , time () ) ) / DAY_IN_SECONDS ),
234- 'rootUrl ' => get_site_url (),
235- 'neveThemePreviewUrl ' => esc_url (
236- add_query_arg (
237- array (
238- 'theme ' => 'neve ' ,
239- ),
240- admin_url ( 'theme-install.php ' )
241- )
217+ $ this ->get_dashboard_data ()
218+ );
219+
220+ $ this ->load_survey ();
221+ }
222+
223+ /**
224+ * Get the dashboard data to store in global object.
225+ *
226+ * @return array
227+ */
228+ public function get_dashboard_data () {
229+ $ wp_upload_dir = wp_upload_dir ( null , false );
230+ $ basedir = $ wp_upload_dir ['basedir ' ] . '/themeisle-gutenberg/ ' ;
231+ $ offer = new LimitedOffers ();
232+
233+ $ global_data = array (
234+ 'version ' => OTTER_BLOCKS_VERSION ,
235+ 'assetsPath ' => OTTER_BLOCKS_URL . 'assets/ ' ,
236+ 'stylesExist ' => is_dir ( $ basedir ) || boolval ( get_transient ( 'otter_animations_parsed ' ) ),
237+ 'hasPro ' => Pro::is_pro_installed (),
238+ 'upgradeLink ' => tsdk_translate_link ( tsdk_utmify ( Pro::get_url (), 'options ' , Pro::get_reference () ) ),
239+ 'docsLink ' => Pro::get_docs_url (),
240+ 'showFeedbackNotice ' => $ this ->should_show_feedback_notice (),
241+ 'deal ' => ! Pro::is_pro_installed () ? $ offer ->get_localized_data () : array (),
242+ 'hasOnboarding ' => false !== get_theme_support ( FSE_Onboarding::SUPPORT_KEY ),
243+ 'days_since_install ' => (int ) round ( ( time () - get_option ( 'otter_blocks_install ' , time () ) ) / DAY_IN_SECONDS ),
244+ 'rootUrl ' => get_site_url (),
245+ 'neveThemePreviewUrl ' => esc_url (
246+ add_query_arg (
247+ array (
248+ 'theme ' => 'neve ' ,
242249 ),
243- ' neveThemeActivationUrl ' => esc_url (
244- add_query_arg (
245- array (
246- ' action ' => ' activate ' ,
247- ' stylesheet ' => ' neve ' ,
248- ' _wpnonce ' => wp_create_nonce ( ' switch-theme_neve ' ),
249- ) ,
250- admin_url ( ' themes.php ' )
251- )
250+ admin_url ( ' theme-install.php ' )
251+ )
252+ ),
253+ ' neveThemeActivationUrl ' => esc_url (
254+ add_query_arg (
255+ array (
256+ ' action ' => ' activate ' ,
257+ ' stylesheet ' => ' neve ' ,
258+ ' _wpnonce ' => wp_create_nonce ( ' switch-theme_neve ' ),
252259 ),
253- ' neveDashboardUrl ' => esc_url (
254- add_query_arg (
255- array (
256- ' page ' => ' neve-welcome ' ,
257- ),
258- admin_url ( ' admin.php ' )
259- )
260+ admin_url ( ' themes.php ' )
261+ )
262+ ),
263+ ' neveDashboardUrl ' => esc_url (
264+ add_query_arg (
265+ array (
266+ ' page ' => ' neve-welcome ' ,
260267 ),
261- ' neveInstalled ' => defined ( 'NEVE_VERSION ' ),
268+ admin_url ( 'admin.php ' )
262269 )
263- )
270+ ),
271+ 'neveInstalled ' => defined ( 'NEVE_VERSION ' ),
264272 );
273+
274+ return apply_filters ( 'otter_dashboard_data ' , $ global_data );
265275 }
266276
267277 /**
@@ -720,6 +730,18 @@ public function form_submissions_widget_content() {
720730 <?php
721731 }
722732
733+ /**
734+ * Load the Formbricks deps from SDK to initiate the survey.
735+ */
736+ private function load_survey () {
737+ $ survey_handler = apply_filters ( 'themeisle_sdk_dependency_script_handler ' , 'survey ' );
738+ if ( empty ( $ survey_handler ) ) {
739+ return ;
740+ }
741+
742+ do_action ( 'themeisle_sdk_dependency_enqueue_script ' , 'survey ' );
743+ }
744+
723745 /**
724746 * The instance method for the static class.
725747 * Defines and returns the instance of the static class.
0 commit comments