PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 2.4.0
Subscriptions for WooCommerce with Stripe Recurring Payments v2.4.0
2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 All 65 releases
← All changes | assets/js/admin.js +18 -7 1.10.8 → 2.4.0 View file →
@@ -12,10 +12,15 @@
12 12 } else {
13 13 jQuery(".show_if_subscription").hide();
14 14 }
15 15
16 + // WooCommerce fires this from its variations AJAX callback, before it removes
17 + // the panel's loading overlay. A product with no variations yet renders no
18 + // `.woocommerce_variations[data-total]`, and JSON.parse(undefined) threw out
19 + // of that callback, leaving the Variations panel spinning forever. No count
20 + // means no variations.
16 21 jQuery(document).on("woocommerce_variations_loaded", () => {
17 - let total_variations = JSON.parse(jQuery(".woocommerce_variations").attr("data-total"));
22 + let total_variations = parseInt(jQuery(".woocommerce_variations").attr("data-total"), 10) || 0;
18 23 for (let index = 0; index < total_variations; index++) {
19 24 let element = document.getElementById("subscrpt_enable[" + index + "]");
20 25 if (element && element.checked) {
21 26 jQuery(".show_if_subscription_" + index).show();
@@ -85,15 +90,15 @@
85 90 var action2 = jQuery('[name="action2"]').val();
86 91 var selectedAction = action && action !== "-1" ? action : action2;
87 92
88 93 if (!selectedAction || selectedAction === "-1") {
89 - alert("Please select a bulk action.");
94 + alert(wp.i18n.__("Please select a bulk action.", "subscription"));
90 95 return false;
91 96 }
92 97
93 98 var checkedBoxes = jQuery('input[name="subscription_ids[]"]:checked');
94 99 if (checkedBoxes.length === 0) {
95 - alert("Please select at least one subscription.");
100 + alert(wp.i18n.__("Please select at least one subscription.", "subscription"));
96 101 return false;
97 102 }
98 103
99 104 // Handle bulk action via AJAX (confirm already handled by adv-select data-confirm)
@@ -109,9 +114,9 @@
109 114
110 115 // Show loading state
111 116 var submitButton = jQuery('input[name="bulk_action"]:focus, input[name="bulk_action2"]:focus');
112 117 var originalText = submitButton.val();
113 - submitButton.val("Processing...").prop("disabled", true);
118 + submitButton.val(wp.i18n.__("Processing…", "subscription")).prop("disabled", true);
114 119
115 120 // Make AJAX request
116 121 jQuery.ajax({
117 122 url: wp_subscription_ajax.ajaxurl,
@@ -131,13 +136,16 @@
131 136 window.location.reload();
132 137 }, 1000);
133 138 } else {
134 139 // Show error message
135 - showAdminNotice(response.data.message || "An error occurred while processing the bulk action.", "error");
140 + showAdminNotice(
141 + response.data.message || wp.i18n.__("An error occurred while processing the bulk action.", "subscription"),
142 + "error",
143 + );
136 144 }
137 145 },
138 146 error: function () {
139 - showAdminNotice("An error occurred while processing the bulk action.", "error");
147 + showAdminNotice(wp.i18n.__("An error occurred while processing the bulk action.", "subscription"), "error");
140 148 },
141 149 complete: function () {
142 150 // Reset button state
143 151 submitButton.val(originalText).prop("disabled", false);
@@ -179,9 +187,12 @@
179 187 "simple" !== subscrpt_product_type.val() &&
180 188 "variable" !== subscrpt_product_type.val()
181 189 ) {
182 190 const confirmTypeChange = confirm(
183 - "Are you sure to change the product type ? If product type changed then You'll lose related subscriptions beacuse of they can't be renewed !",
191 + wp.i18n.__(
192 + "Are you sure you want to change the product type? Its subscriptions can no longer be renewed.",
193 + "subscription",
194 + ),
184 195 );
185 196 if (confirmTypeChange) {
186 197 latest_value_of_subscrpt_product_type = subscrpt_product_type.val();
187 198 } else {