PageSourceSearch

https://www.totvs.com/wp-content/plugins/gravityforms/assets/js/di…/gform-products.ad434d71da2b0f9d3ae4.min.js

js totvs.com collected 2026-09-24 08:53:06 UTC 6,481 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkgravityforms=self.webpackChunkgravityforms||[]).push([[157],{1206:function(t,e,n){n.r(e),n.d(e,{default:function(){return R}});var r=n(5798),o=n(8134),i=n(455),a=n(9280),u=n.n(a),c=n(3771),l=n(8773),d={};n.r(d),n.d(d,{getFieldId:function(){return l.kV},getFieldLabel:function(){return l.lu},getFormId:function(){return l.eM},getOptionFields:function(){return l.bs},getProductFields:function(){return l.L2},getProductMeta:function(){return l.hp},getProductQuantity:function(){return l.JN},getShippingField:function(){return l.d9},parseChoiceValue:function(){return l.kx}});var f=n(7489),p=function(t){var e=l.eM(t.target),n=l.kV(t.target),o=t.target;(0,r.trigger)({event:"gform/products/product_field_changed",data:{event:t,formId:e,productFieldId:n,htmlInput:o},native:!1}),g(e)},g=function(){var t=(0,i.A)(u().mark(function t(e){var n,o,i,a;return u().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=(0,r.getNode)("#gform_".concat(e),document,!0)){t.next=3;break}return t.abrupt("return");case 3:return o={products:[]},l.L2(n).forEach(function(t){var e=l.hp(n,t);if(0!==e.length){var r=e[0];r.quantity=l.JN(n,t),r.options=v(n,t),r.repeaterPath=(0,f.getRepeaterPath)(t),o.products.push(r)}}),(i=s(n))&&(o.shipping=i),t.next=10,(0,r.filter)({event:"gform/products/pre_product_change",data:{formId:e,products:o}});case 10:a=t.sent,o=a.products,c.hZ(e,"products",o);case 13:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),s=function(t){var e=l.d9(t);if(!e)return null;var n=l.hp(t,e);return n.length>0?n[0]:null},v=function(t,e){var n=[];return l.bs(t,e).forEach(function(e){var r=l.hp(t,e);0!==r.length&&(r.forEach(function(t){t.field_label=l.lu(e)}),n.push.apply(n,(0,o.A)(r)))}),n},m=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=o||c.Jt(t,"products"),a=null==i||null===(e=i.products)||void 0===e?void 0:e.filter(function(t){return t.repeaterPath.startsWith(r)});if(!a||0===a.length)return 0;for(var u=0,l=0;l<a.length;l++){for(var d=a[l],f=d.price,p=0;p<d.options.length;p++)f+=d.options[p].price;if(f*=d.quantity,n&&parseFloat(n)===parseFloat(d.id))return f;u+=f}if(n)return 0;if(r)return u;i.shipping&&(u+=i.shipping.price);var g=u;return!((u=window.gform.applyFilters("gform_product_total",u,t))!==g)&&i.discount&&(u=(u-=i.discount)<0?0:u),u};window.gform.products={getTotal:m,getPaymentAmount:function(t){var e=m(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,"");return e<0?0:e},handleProductChange:p,updateProducts:g,parser:d};var h=n(1295),_=function(t){t.querySelectorAll(".gfield--type-option select, .gfield--type-option input, .gfield--type-shipping select, .gfield--type-shipping input").forEach(function(t){L(t)})},y=function(t){var e=t.detail.htmlInput.closest(".gfield");(e.classList.contains("gfield--type-option")||e.classList.contains("gfield--type-shipping"))&&L(t.detail.htmlInput)},L=function(t){var e=t.id.split("_")[2],n=t.closest("form").dataset.formid;"SELECT"===t.tagName?b(n,e,t):"checkbox"===t.type?E(n,e,t):"radio"===t.type&&I(n,e,t)},b=function(t,e,n){var r=k(n.value);Array.from(n.options).forEach(function(n){var o=k(n.value);w(n,o,r,t,e)})},E=function(t,e,n){var r,o=(null===(r=n.labels)||void 0===r?void 0:r[0])||null;if(o){var i=k(n.value);w(o,i,0,t,e)}},I=function(t,e,n){var r=n.closest(".gfield").querySelectorAll('input[type="radio"]'),o=Array.from(r).find(function(t){return t.checked})||null,i=o?k(o.value):0;Array.from(r).forEach(function(n){var r,o=(null===(r=n.labels)||void 0===r?void 0:r[0])||null;if(o){var a=k(n.value);w(o,a,i,t,e)}})},w=function(t,e,n,r,o){var i=F(t),a=q(n,e);t.setAttribute("price",a);var u="option"===t.tagName.toLowerCase()?a:"<span class='ginput_price'>".concat(a,"</span>"),c=i+u;window.gform_format_option_label&&(c=window.gform_format_option_label(c,i,u,n,e,r,o)),t.innerHTML=c},F=function(t){var e;return null===(e=t.querySelector(".ginput_price"))||void 0===e||e.remove(),t.innerHTML=t.innerHTML.replace(t.getAttribute("price"),""),t.innerHTML},k=function(t){var e=t.split("|"),n=e.length>1?e[1]:0;return(0,h.Ro)(n)},q=function(t,e){var n=parseFloat(e)-parseFloat(t);if(0===n)return"";var r=(0,h.qG)(n,!0);return n>0&&(r="+".concat(r))," ".concat(r)},A=function(t){var e=document.getElementById("gform_".concat(t));_(e),document.addEventListener("gform/products/product_field_changed",y)},P=n(428),T=n.n(P),x=function(t){t.querySelectorAll(".ginput_amount, .ginput_donation_amount").forEach(function(t){t.value=(0,h.qG)(t.value)})},M=function(t){var e=document.getElementById("gform_".concat(t));(0,r.delegate)(e,".ginput_amount, .ginput_donation_amount","change",function(t){t.target.value=(0,h.qG)(t.target.value)}),document.addEventListener("gform/repeater/post_item_add",function(t){x(t.detail.container)}),x(e)},S=function(t){var e=(0,r.getNodes)(".ginput_total_".concat(t),!0,document,!0);(e=e.filter(function(t){return!t.closest(".gfield_repeater_template")}
1)).forEach(function(e){C(t,e)})},C=function(t,e){var n=(0,f.getRepeaterPath)(e),r=m(t,0,n),o=(0,h.qG)(r,!0);G(t)?(T()(e).next().val(r).trigger("change"),e.innerHTML=o):(T()(e).val(r).trigger("change"),e.value=o)},G=function(t){var e;return"legacy"===(null===(e=document.querySelector("#gform_wrapper_".concat(t)).dataset)||void 0===e?void 0:e.formTheme)},N=function(t){c.wB(t,["products"],S),S(t),(0,r.consoleInfo)("Gravity Forms Theme: Initialized total field.")},H=function(){document.addEventListener("gform/conditionalLogic/applyRules/end",function(t){g(t.detail.formId)}),document.addEventListener("gform/frontend_pages/evaluated",function(t){g(t.detail.formId)}),document.addEventListener("gform/repeater/post_item_delete",function(t){g(t.detail.form.dataset.formid)}),document.addEventListener("gform/repeater/post_item_add",function(t){g(t.detail.form.dataset.formid)}),(0,r.delegate)('.gfield_price input[type="text"], .gfield_price input[type="number"]',"input",p),(0,r.delegate)('.gfield_price input[type="text"], .gfield_price input[type="number"]',"change",p),(0,r.delegate)(".ginput_calculated_price","change",p),(0,r.delegate)('.gfield_price input[type="radio"], .gfield_price input[type="checkbox"]',"click",p),T()(document).on("change",".gfield_price select",p)},R=function(t){g(t),A(t),M(t),N(t),H(),(0,r.consoleInfo)("Gravity Forms Theme: Initialized product field.")}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.