diff --git a/plugins/woocommerce-admin/client/wp-admin-scripts/navigation-opt-out/container.js b/plugins/woocommerce-admin/client/wp-admin-scripts/navigation-opt-out/container.js index 5a5cd5f6785..3f7434b74eb 100644 --- a/plugins/woocommerce-admin/client/wp-admin-scripts/navigation-opt-out/container.js +++ b/plugins/woocommerce-admin/client/wp-admin-scripts/navigation-opt-out/container.js @@ -19,6 +19,10 @@ export class NavigationOptOutContainer extends Component { return null; } + if ( ! window.surveyData || ! window.surveyData.url ) { + return null; + } + return ( this.setState( { isModalOpen: false } ) } diff --git a/plugins/woocommerce-admin/src/Features/Navigation/Init.php b/plugins/woocommerce-admin/src/Features/Navigation/Init.php index 38b77e4594c..f1358e70706 100644 --- a/plugins/woocommerce-admin/src/Features/Navigation/Init.php +++ b/plugins/woocommerce-admin/src/Features/Navigation/Init.php @@ -8,6 +8,7 @@ namespace Automattic\WooCommerce\Admin\Features\Navigation; use Automattic\WooCommerce\Admin\Loader; +use Automattic\WooCommerce\Admin\Survey; use Automattic\WooCommerce\Admin\Features\Navigation\Screen; use Automattic\WooCommerce\Admin\Features\Navigation\Menu; use Automattic\WooCommerce\Admin\Features\Navigation\CoreMenu; @@ -203,6 +204,14 @@ class Init { true ); + wp_localize_script( + 'wc-admin-navigation-opt-out', + 'surveyData', + array( + 'url' => Survey::get_url( '/new-navigation-opt-out' ), + ) + ); + delete_option( 'woocommerce_navigation_show_opt_out' ); } } diff --git a/plugins/woocommerce-admin/src/Notes/GivingFeedbackNotes.php b/plugins/woocommerce-admin/src/Notes/GivingFeedbackNotes.php index 9acdb9c9fa4..d0b2746500d 100644 --- a/plugins/woocommerce-admin/src/Notes/GivingFeedbackNotes.php +++ b/plugins/woocommerce-admin/src/Notes/GivingFeedbackNotes.php @@ -9,6 +9,8 @@ namespace Automattic\WooCommerce\Admin\Notes; defined( 'ABSPATH' ) || exit; +use Automattic\WooCommerce\Admin\Survey; + /** * Giving_Feedback_Notes */ @@ -46,7 +48,7 @@ class GivingFeedbackNotes { $note->add_action( 'share-feedback', __( 'Share feedback', 'woocommerce-admin' ), - 'https://automattic.survey.fm/store-setup-survey' + Survey::get_url( '/store-setup-survey' ) ); return $note; } diff --git a/plugins/woocommerce-admin/src/Notes/NavigationFeedback.php b/plugins/woocommerce-admin/src/Notes/NavigationFeedback.php index 51cf091934c..a20edc26457 100644 --- a/plugins/woocommerce-admin/src/Notes/NavigationFeedback.php +++ b/plugins/woocommerce-admin/src/Notes/NavigationFeedback.php @@ -6,6 +6,7 @@ namespace Automattic\WooCommerce\Admin\Notes; use Automattic\WooCommerce\Admin\Loader; +use Automattic\WooCommerce\Admin\Survey; defined( 'ABSPATH' ) || exit; @@ -42,7 +43,7 @@ class NavigationFeedback { $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_name( self::NOTE_NAME ); $note->set_source( 'woocommerce-admin' ); - $note->add_action( 'share-feedback', __( 'Share feedback', 'woocommerce-admin' ), 'https://automattic.survey.fm/new-navigation' ); + $note->add_action( 'share-feedback', __( 'Share feedback', 'woocommerce-admin' ), Survey::get_url( '/new-navigation' ) ); return $note; } } diff --git a/plugins/woocommerce-admin/src/Notes/NavigationFeedbackFollowUp.php b/plugins/woocommerce-admin/src/Notes/NavigationFeedbackFollowUp.php index 256e690e177..0424c7b3487 100644 --- a/plugins/woocommerce-admin/src/Notes/NavigationFeedbackFollowUp.php +++ b/plugins/woocommerce-admin/src/Notes/NavigationFeedbackFollowUp.php @@ -6,6 +6,7 @@ namespace Automattic\WooCommerce\Admin\Notes; use Automattic\WooCommerce\Admin\Loader; +use Automattic\WooCommerce\Admin\Survey; defined( 'ABSPATH' ) || exit; @@ -56,7 +57,7 @@ class NavigationFeedbackFollowUp { $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_name( self::NOTE_NAME ); $note->set_source( 'woocommerce-admin' ); - $note->add_action( 'share-feedback', __( 'Share feedback', 'woocommerce-admin' ), 'https://automattic.survey.fm/new-navigation' ); + $note->add_action( 'share-feedback', __( 'Share feedback', 'woocommerce-admin' ), Survey::get_url( '/new-navigation' ) ); return $note; } } diff --git a/plugins/woocommerce-admin/src/Survey.php b/plugins/woocommerce-admin/src/Survey.php new file mode 100644 index 00000000000..878a4b5b07b --- /dev/null +++ b/plugins/woocommerce-admin/src/Survey.php @@ -0,0 +1,38 @@ +