diff --git a/assets/js/admin/wc-setup.js b/assets/js/admin/wc-setup.js
index 6bfe6de34c3..571acfcb002 100644
--- a/assets/js/admin/wc-setup.js
+++ b/assets/js/admin/wc-setup.js
@@ -1,73 +1,5 @@
/*global wc_setup_params */
jQuery( function( $ ) {
-
- var locale_info = $.parseJSON( wc_setup_params.locale_info );
-
- $( 'select[name="store_location"]' ).change( function() {
- var country_option = $(this).val().split( ':' );
- var country = country_option[0];
- var state = country_option[1] || false;
- var country_locale_info = locale_info[ country ];
- var hide_if_set = [ 'thousand_sep', 'decimal_sep', 'num_decimals', 'currency_pos' ];
-
- if ( country_locale_info ) {
- $.each( country_locale_info, function( index, value ) {
- $(':input[name="' + index + '"]').val( value ).change();
-
- if ( -1 !== $.inArray( index, hide_if_set ) ) {
- $(':input[name="' + index + '"]').closest('tr').hide();
- }
- } );
-
- if ( ! $.isArray( country_locale_info.tax_rates ) ) {
- var tax_rates = [];
-
- if ( state && country_locale_info.tax_rates[ state ] ) {
- tax_rates = tax_rates.concat( country_locale_info.tax_rates[ state ] );
- } else if ( country_locale_info.tax_rates[ '' ] ) {
- tax_rates = tax_rates.concat( country_locale_info.tax_rates[ '' ] );
- }
-
- tax_rates = tax_rates.concat( country_locale_info.tax_rates[ '*' ] || [] );
-
- if ( tax_rates.length ) {
- var $rate_table = $( 'table.tax-rates tbody' ).empty();
-
- $.each( tax_rates, function( index, rate ) {
- $( '
', {
- html: [
- $( '', { 'class': 'readonly', text: rate.country || '' } ),
- $( ' | ', { 'class': 'readonly', text: rate.state || '*' } ),
- $( ' | ', { 'class': 'readonly', text: rate.rate || '' } ),
- $( ' | ', { 'class': 'readonly', text: rate.name || '' } )
- ]
- } ).appendTo( $rate_table );
- } );
-
- $( '.tax-rates' ).show();
- } else {
- $( '.tax-rates' ).hide();
- }
- }
- } else {
- $(':input[name="currency_pos"]').closest('tr').show();
- $(':input[name="thousand_sep"]').closest('tr').show();
- $(':input[name="decimal_sep"]').closest('tr').show();
- $(':input[name="num_decimals"]').closest('tr').show();
- $( '.tax-rates' ).hide();
- }
- } ).change();
-
- $( 'input[name="woocommerce_calc_taxes"]' ).change( function() {
- if ( $(this).is( ':checked' ) ) {
- $(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest('tr').show();
- $('tr.tax-rates').show();
- } else {
- $(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest('tr').hide();
- $('tr.tax-rates').hide();
- }
- } ).change();
-
function blockWizardUI() {
$('.wc-setup-content').block({
message: null,
diff --git a/assets/js/admin/wc-setup.min.js b/assets/js/admin/wc-setup.min.js
index 0e678e11db8..ef8416d0b82 100644
--- a/assets/js/admin/wc-setup.min.js
+++ b/assets/js/admin/wc-setup.min.js
@@ -1 +1 @@
-jQuery(function(e){function t(){e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function a(){e("form.activate-jetpack").submit()}function c(){wp.ajax.post("setup_wizard_check_jetpack").then(function(e){if(!e||!e.is_active||"yes"===e.is_active)return a();setTimeout(c,3e3)}).fail(function(){a()})}var i=e.parseJSON(wc_setup_params.locale_info);e('select[name="store_location"]').change(function(){var t=e(this).val().split(":"),a=t[0],c=t[1]||!1,s=i[a],n=["thousand_sep","decimal_sep","num_decimals","currency_pos"];if(s){if(e.each(s,function(t,a){e(':input[name="'+t+'"]').val(a).change(),-1!==e.inArray(t,n)&&e(':input[name="'+t+'"]').closest("tr").hide()}),!e.isArray(s.tax_rates)){var o=[];if(c&&s.tax_rates[c]?o=o.concat(s.tax_rates[c]):s.tax_rates[""]&&(o=o.concat(s.tax_rates[""])),(o=o.concat(s.tax_rates["*"]||[])).length){var r=e("table.tax-rates tbody").empty();e.each(o,function(t,a){e(" |
",{html:[e("",{"class":"readonly",text:a.country||""}),e(" | ",{"class":"readonly",text:a.state||"*"}),e(" | ",{"class":"readonly",text:a.rate||""}),e(" | ",{"class":"readonly",text:a.name||""})]}).appendTo(r)}),e(".tax-rates").show()}else e(".tax-rates").hide()}}else e(':input[name="currency_pos"]').closest("tr").show(),e(':input[name="thousand_sep"]').closest("tr").show(),e(':input[name="decimal_sep"]').closest("tr").show(),e(':input[name="num_decimals"]').closest("tr").show(),e(".tax-rates").hide()}).change(),e('input[name="woocommerce_calc_taxes"]').change(function(){e(this).is(":checked")?(e(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").show(),e("tr.tax-rates").show()):(e(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").hide(),e("tr.tax-rates").hide())}).change(),e(".button-next").on("click",function(){var a=e(this).parents("form").get(0);return("function"!=typeof a.checkValidity||a.checkValidity())&&t(),!0}),e(".wc-wizard-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"):e(this).closest(".wc-wizard-service-toggle").addClass("disabled")}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable",function(t){t.stopPropagation();var a=e(this).find(".wc-wizard-service-toggle input");a.prop("checked",!a.prop("checked")).change()}),e(".wc-wizard-services-list-toggle").on("change",".wc-wizard-service-enable input",function(){e(this).closest(".wc-wizard-services").find(".wc-wizard-service-item").slideToggle().css("display","flex")}),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-select .method",function(t){var a=e(this).parent("div"),c=t.target.value,i=a.find(".shipping-method-description");i.find("p").hide(),i.find("p."+c).show();var s=a.find(".shipping-method-settings");s.find("div").hide(),s.find("div."+c).show()}),e(".button-jetpack-connect").on("click",function(e){if(t(),"no"===wc_setup_params.pending_jetpack_install)return!0;e.preventDefault(),c()})});
\ No newline at end of file
+jQuery(function(e){function i(){e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function c(){e("form.activate-jetpack").submit()}function t(){wp.ajax.post("setup_wizard_check_jetpack").then(function(e){if(!e||!e.is_active||"yes"===e.is_active)return c();setTimeout(t,3e3)}).fail(function(){c()})}e(".button-next").on("click",function(){var c=e(this).parents("form").get(0);return("function"!=typeof c.checkValidity||c.checkValidity())&&i(),!0}),e(".wc-wizard-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"):e(this).closest(".wc-wizard-service-toggle").addClass("disabled")}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable",function(i){i.stopPropagation();var c=e(this).find(".wc-wizard-service-toggle input");c.prop("checked",!c.prop("checked")).change()}),e(".wc-wizard-services-list-toggle").on("change",".wc-wizard-service-enable input",function(){e(this).closest(".wc-wizard-services").find(".wc-wizard-service-item").slideToggle().css("display","flex")}),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-select .method",function(i){var c=e(this).parent("div"),t=i.target.value,n=c.find(".shipping-method-description");n.find("p").hide(),n.find("p."+t).show();var s=c.find(".shipping-method-settings");s.find("div").hide(),s.find("div."+t).show()}),e(".button-jetpack-connect").on("click",function(e){if(i(),"no"===wc_setup_params.pending_jetpack_install)return!0;e.preventDefault(),t()})});
\ No newline at end of file
diff --git a/includes/admin/class-wc-admin-setup-wizard.php b/includes/admin/class-wc-admin-setup-wizard.php
index 5132a822cc8..3f0744b71e4 100644
--- a/includes/admin/class-wc-admin-setup-wizard.php
+++ b/includes/admin/class-wc-admin-setup-wizard.php
@@ -154,7 +154,6 @@ class WC_Admin_Setup_Wizard {
wp_register_script( 'wc-setup', WC()->plugin_url() . '/assets/js/admin/wc-setup' . $suffix . '.js', array( 'jquery', 'wc-enhanced-select', 'jquery-blockui', 'wp-util' ), WC_VERSION );
wp_localize_script( 'wc-setup', 'wc_setup_params', array(
- 'locale_info' => json_encode( include( WC()->plugin_path() . '/i18n/locale-info.php' ) ),
'pending_jetpack_install' => $pending_jetpack ? 'yes' : 'no',
) );
|