From 6d379c166eacce75785d5c6db7882a01d2b6a1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rabbi=20Islam=20Rony=20=E2=9A=A1=EF=B8=8F?= <35329385+RabbiIslamRony@users.noreply.github.com> Date: Wed, 15 Jul 2026 11:58:17 +0600 Subject: [PATCH] fix: add required validation for pricing field --- assets/build/js/global/add-listing.js | 2 +- assets/src/js/global/add-listing.js | 167 ++++++++++++++++-- .../class-directorist-pricing-field.php | 57 +++++- .../builder-preset-fields.php | 5 + .../class-multi-directory-migration.php | 3 +- templates/listing-form/fields/pricing.php | 20 ++- 6 files changed, 228 insertions(+), 26 deletions(-) diff --git a/assets/build/js/global/add-listing.js b/assets/build/js/global/add-listing.js index 36095a1797..11bb738d3f 100644 --- a/assets/build/js/global/add-listing.js +++ b/assets/build/js/global/add-listing.js @@ -1 +1 @@ -!function(){var t={8324:function(){function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i'.concat(n,"");t.append(r)}var c=t.find(".directorist-select2-dropdown-toggle");e(".select2-hidden-accessible").on("select2:open",function(t){e(this).next().find(".directorist-select2-dropdown-toggle").addClass("--is-open")}),e(".select2-hidden-accessible").on("select2:close",function(t){e(this).next().find(".directorist-select2-dropdown-toggle").removeClass("--is-open");var i=e(this).closest(".directorist-search-field");e(this).next().find(".select2-selection__rendered").attr("title")?i.addClass("input-has-value"):i.removeClass("input-is-focused")}),c.on("click",function(t){var i=e(this).hasClass("--is-open"),n=e(this).closest(".select2-container").siblings("select:enabled");i?n.select2("close"):n.select2("open")}),a()}}(),function(){var i=e(".select2-hidden-accessible");if(i||i.length){var n,o=function(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return t(e,i);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var t=n.next();return c=t.done,t},e:function(t){s=!0,a=t},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw a}}}}(i);try{for(o.s();!(n=o.n()).done;){var a=n.value;e(a).children("option:selected").val()&&r(a)}}catch(t){o.e(t)}finally{o.f()}}}(),e(".select2-hidden-accessible").on("change",function(t){if(e(this).children("option:selected").val()){r(e(this)),this.parentElement.querySelectorAll(".select2-selection__choice").forEach(function(t){t.childNodes&&t.childNodes.forEach(function(e){if(e.nodeType&&e.nodeType===Node.TEXT_NODE){var i=e.textContent.replace(/^[\s\xa0]+/,"");e.textContent=i,t.title=i}})});var i=this.parentElement.querySelector(".select2-selection__rendered");i.childNodes&&i.childNodes.forEach(function(t){if(t.nodeType&&t.nodeType===Node.TEXT_NODE){var e=t.textContent.replace(/^[\s\xa0]+/,"");t.textContent=e}})}})}function r(t){e(".select2-selection__clear").css({display:"none"});var i=o(t);if(i&&i.length){i.find(".directorist-select2-dropdown-close").remove();var n=directorist.assets_url+"icons/font-awesome/svgs/solid/times.svg",r=directorist.icon_markup.replace("##URL##",n).replace("##CLASS##","");i.prepend(''.concat(r,"")),i.find(".directorist-select2-dropdown-close").on("click",function(t){e(this).closest(".select2-container").siblings("select:enabled").val(null).trigger("change"),i.find(".directorist-select2-dropdown-close").remove(),a()}),a()}}function o(t){var i=t?e(t).next(".select2-container"):e(".select2-container");if((i=e(i).find(".directorist-select2-addons-area")).length||(e(".select2-container").append(''),i=e(".select2-container").find(".directorist-select2-addons-area")),!(i=t?e(t).next(".select2-container"):null))return null;var n=e(i).find(".directorist-select2-addons-area");return n.length?n:(i.append(''),i.find(".directorist-select2-addons-area"))}function a(){var t=e(".select2-container").find(".directorist-select2-addons-area");if(t.length){var i=t.outerWidth();e(".select2-container").find(".select2-selection__rendered").css({"padding-right":i+"px"})}}window.addEventListener("load",i),window.addEventListener("directorist-search-form-nav-tab-reloaded",i),window.addEventListener("directorist-type-change",i),window.addEventListener("directorist-instant-search-reloaded",i)},3563:function(){var t;t=jQuery,void 0===window.directorist_colorPicker_executed&&(window.directorist_colorPicker_executed=!0,window.addEventListener("load",function(){function e(){document.querySelectorAll(".directorist-color-picker-wrap").forEach(function(e){var i=t(e).find(".directorist-color-picker");i&&(t.fn.wpColorPicker?i.wpColorPicker({change:function(t,e){var i=e.color.toString(),n=new CustomEvent("directorist-color-changed",{detail:{color:i,input:t.target,form:t.target.closest("form")}});window.dispatchEvent(n)}}):console.warn("wpColorPicker is NOT available!"))})}e(),window.addEventListener("directorist-instant-search-reloaded",e)}))},8883:function(){var t;t=jQuery,void 0===window.directorist_dropdown_executed&&(window.directorist_dropdown_executed=!0,window.addEventListener("load",function(){var e=document.querySelectorAll(".directorist-dropdown-select"),i=0;null!==e&&e.forEach(function(t){t.querySelector(".directorist-dropdown-select-toggle").addEventListener("click",function(e){e.preventDefault(),++i%2==1?(document.querySelectorAll(".directorist-dropdown-select-items").forEach(function(t){t.classList.remove("directorist-dropdown-select-show")}),t.querySelector(".directorist-dropdown-select-items").classList.add("directorist-dropdown-select-show")):document.querySelectorAll(".directorist-dropdown-select-items").forEach(function(t){t.classList.remove("directorist-dropdown-select-show")})})}),document.body.addEventListener("click",function(t){"directorist-dropdown-select-toggle"!==t.target.getAttribute("data-drop-toggle")&&(i=0,document.querySelectorAll(".directorist-dropdown-select-items").forEach(function(t){t.classList.remove("directorist-dropdown-select-show")}))});var n=document.querySelectorAll(".atbd-drop-select");null!==n&&n.forEach(function(t){t.querySelectorAll(".directorist-dropdown-select-items").forEach(function(e){e.addEventListener("click",function(i){i.preventDefault(),t.querySelector(".directorist-dropdown-select-toggle").textContent=i.target.textContent,t.querySelectorAll(".directorist-dropdown-select-items").forEach(function(t){t.classList.remove("atbd-active")}),e.classList.add("atbd-active")})})}),t("body").on("click",".directorist-dropdown .directorist-dropdown-toggle",function(e){e.preventDefault(),t(this).siblings(".directorist-dropdown-option").toggle()}),t("body").on("click",".directorist-dropdown .directorist-dropdown-option ul li a",function(e){e.preventDefault();var i=t(this).html();t(this).children(".directorist-dropdown-toggle__text").html(i),t(this).closest(".directorist-dropdown-option").siblings(".directorist-dropdown-toggle").children(".directorist-dropdown-toggle__text").html(i),t(".directorist-dropdown-option").hide()}),t(document).bind("click",function(e){t(e.target).parents().hasClass("directorist-dropdown")||t(".directorist-dropdown-option").hide()}),t(document).on("click",".atbd_dropdown",function(e){"atbd_dropdown"===t(this).attr("class")&&(e.preventDefault(),t(this).siblings(".atbd_dropdown").removeClass("atbd_drop--active"),t(this).toggleClass("atbd_drop--active"),e.stopPropagation())}),t(document).on("click",function(e){!1===t(e.target).is(".atbd_dropdown, .atbd_drop--active")&&t(".atbd_dropdown").removeClass("atbd_drop--active")}),t("body").on("click",".atbd_dropdown-toggle",function(t){t.preventDefault()}),t("body").on("click",".directorist-dropdown-js .directorist-dropdown__toggle-js",function(e){e.preventDefault(),t(this).siblings(".directorist-dropdown__links-js").is(":visible")||t(".directorist-dropdown__links").hide(),t(this).siblings(".directorist-dropdown__links-js").toggle()}),t("body").on("click",function(e){e.target.closest(".directorist-dropdown-js")||t(".directorist-dropdown__links-js").hide()})}))},5386:function(){window.addEventListener("load",function(){if(void 0===window.directorist_select_executed){window.directorist_select_executed=!0;var t=document.querySelectorAll(".atbd-drop-select");null!==t&&t.forEach(function(t){t.querySelectorAll(".atbd-dropdown-item").forEach(function(e){e.addEventListener("click",function(i){i.preventDefault(),t.querySelector(".atbd-dropdown-toggle").textContent=e.textContent,t.querySelectorAll(".atbd-dropdown-item").forEach(function(t){t.classList.remove("atbd-active")}),e.classList.add("atbd-active")})})}),document.querySelectorAll(".atbd-drop-select.with-sort").forEach(function(t){t.querySelectorAll(".atbd-dropdown-item").forEach(function(e){var i=t.querySelector(".atbd-dropdown-toggle"),n=e.getAttribute("data-status");e.addEventListener("click",function(t){i.setAttribute("data-status","".concat(n))})})})}})}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,i),o.exports}!function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i