Skip to content

Commit

Permalink
refactor: use formbricks deps from SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Feb 27, 2024
1 parent 211a349 commit 4c4fff2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions includes/admin/feedzy-rss-feeds-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1699,9 +1699,13 @@ public function register_survey() {
return;
}

// Register the survey script.
wp_register_script( $this->plugin_name . '_survey_formbrick', 'https://unpkg.com/@formbricks/js@^1.5.1/dist/index.umd.js', array(), $this->version, true );
wp_enqueue_script( $this->plugin_name . '_survey', FEEDZY_ABSURL . 'js/survey.js', array( $this->plugin_name . '_survey_formbrick' ), $this->version, true );
$survey_handler = apply_filters( 'themeisle_sdk_dependency_script_handler', 'survey' );
if ( empty( $survey_handler ) ) {
return;
}

do_action( 'themeisle_sdk_dependency_enqueue_script', 'survey' );
wp_enqueue_script( $this->plugin_name . '_survey', FEEDZY_ABSURL . 'js/survey.js', array( $survey_handler ), $this->version, true );
wp_localize_script( $this->plugin_name . '_survey', 'feedzySurveyData', $this->get_survery_metadata() );
}
}
4 changes: 2 additions & 2 deletions js/survey.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*
* @see https://github.com/formbricks/setup-examples/tree/main/html
*/
window.addEventListener('load', function () {
window?.formbricks?.init?.({
window.addEventListener('themeisle:survey:loaded', function () {
window?.tsdk_formbricks?.init?.({
environmentId: "clskgehf78eu5podwdrnzciti",
apiHost: "https://app.formbricks.com",
...(window?.feedzySurveyData ?? {}),
Expand Down

0 comments on commit 4c4fff2

Please sign in to comment.