Skip to content

Commit

Permalink
Merge branch 'release/3.7.15'
Browse files Browse the repository at this point in the history
  • Loading branch information
nurul-umbhiya committed Mar 23, 2023
2 parents a12ef52 + 4cf627f commit 977297d
Show file tree
Hide file tree
Showing 19 changed files with 782 additions and 605 deletions.
258 changes: 145 additions & 113 deletions README.md

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions assets/js/product-category-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,11 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
},
loadChildCategories: function loadChildCategories(catlevel, termId, name, haschild) {
/**
* By passing true in this filter hook anyone can enable capability to select aby middle category in dokan product
* multi-step category selection.
* If enabled any one middle category in dokan product multi-step category selection.
*/
var middleCategorySelection = wp.hooks.applyFilters('dokan_middle_category_selection', false); // If selected category has no child OR middle category selection is true then enable the category select done button else disable.
var middleCategorySelection = dokan_product_category_data.any_category_selection; // If selected category has no child OR middle category selection is true then enable the category select done button else disable.

if (!haschild || true === middleCategorySelection) {
if (!haschild || true === Boolean(middleCategorySelection)) {
ProductCategory.disableDoneBtn(false);
} else {
ProductCategory.disableDoneBtn();
Expand Down
2 changes: 1 addition & 1 deletion assets/js/product-category-ui.min.js

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions assets/js/vendor-registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var Dokan_Vendor_Registration = {
$( '#seller-url', form ).on( 'focusout', this.checkSlugAvailability );

this.validationLocalized();
this.handlePasswordStrengthObserver();
// this.validate(this);
},

Expand Down Expand Up @@ -143,9 +144,11 @@ var Dokan_Vendor_Registration = {
if ( resp.success === true ) {
$('#url-alart').removeClass('text-danger').addClass('text-success');
$('#url-alart-mgs').removeClass('text-danger').addClass('text-success').text(dokan.seller.available);
$('.woocommerce-form-register__submit').prop('disabled', false);
} else {
$('#url-alart').removeClass('text-success').addClass('text-danger');
$('#url-alart-mgs').removeClass('text-success').addClass('text-danger').text(dokan.seller.notAvailable);
$('.woocommerce-form-register__submit').prop('disabled', true);
}

row.unblock();
Expand All @@ -168,6 +171,43 @@ var Dokan_Vendor_Registration = {
dokan_messages.min = $.validator.format( dokan_messages.min_msg );

$.validator.messages = dokan_messages;
},

handlePasswordStrengthObserver: function() {
// Identify the password input element to observe.
const elementToObserve = document.querySelector( '.woocommerce-form-register .password-input' ),
AllowedClassNames = [ 'good', 'strong' ];

// Create a new instance of `MutationObserver` named `observer`.
const observer = new MutationObserver( ( mutationList, observer ) => {
for ( const mutation of mutationList ) {
// Check if the mutation element class list contains at least an allowed class names.
if ( AllowedClassNames.some( className => mutation.target.classList.contains( className ) ) ) {
this.ensureShopSlugAvailability();
}
}
});

// Call `observe()` on that MutationObserver instance.
observer.observe( elementToObserve, { subtree: true, childList: true } );
},

ensureShopSlugAvailability: function() {
const slugAvailabilityStatus = $( '#url-alart-mgs' ).hasClass( 'text-success' ),
registrationRoleInput = $( '.vendor-customer-registration input[name="role"]:checked' ),
submitButton = $( '.woocommerce-form-register__submit' );

// Check if the registration role is `seller`.
if ( 'seller' !== registrationRoleInput.val() ) {
return;
}

// Enable/disable submit button based on shop slug availability.
if ( slugAvailabilityStatus ) {
submitButton.prop( 'disabled', false );
} else {
submitButton.prop( 'disabled', true );
}
}
};

Expand Down
7 changes: 3 additions & 4 deletions assets/src/js/product-category-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,12 @@

loadChildCategories( catlevel, termId, name, haschild ) {
/**
* By passing true in this filter hook anyone can enable capability to select aby middle category in dokan product
* multi-step category selection.
* If enabled any one middle category in dokan product multi-step category selection.
*/
const middleCategorySelection = wp.hooks.applyFilters( 'dokan_middle_category_selection', false );
const middleCategorySelection = dokan_product_category_data.any_category_selection;

// If selected category has no child OR middle category selection is true then enable the category select done button else disable.
if ( ! haschild || true === middleCategorySelection ) {
if ( ! haschild || true === Boolean( middleCategorySelection ) ) {
ProductCategory.disableDoneBtn(false);
} else {
ProductCategory.disableDoneBtn();
Expand Down
68 changes: 35 additions & 33 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dokan.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* Plugin Name: Dokan
* Plugin URI: https://wordpress.org/plugins/dokan-lite/
* Description: An e-commerce marketplace plugin for WordPress. Powered by WooCommerce and weDevs.
* Version: 3.7.14
* Version: 3.7.15
* Author: weDevs
* Author URI: https://wedevs.com/
* Text Domain: dokan-lite
* WC requires at least: 5.0.0
* WC tested up to: 7.4.1
* WC tested up to: 7.5.1
* Domain Path: /languages/
* License: GPL2
*/
Expand Down Expand Up @@ -56,7 +56,7 @@ final class WeDevs_Dokan {
*
* @var string
*/
public $version = '3.7.14';
public $version = '3.7.15';

/**
* Instance of self
Expand Down
7 changes: 7 additions & 0 deletions includes/Admin/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,13 @@ public function get_settings_fields() {
'default' => 'on',
'tooltip' => __( 'Checking this will enable sellers to change the order status. If unchecked, only admin can change the order status.', 'dokan-lite' ),
],
'dokan_any_category_selection' => [
'name' => 'dokan_any_category_selection',
'label' => __( 'Select any category', 'dokan-lite' ),
'desc' => __( 'Allow vendors to select any category while creating/editing products.', 'dokan-lite' ),
'type' => 'switcher',
'default' => 'off',
],
]
);

Expand Down
Loading

0 comments on commit 977297d

Please sign in to comment.