import{useProductOfferDiscount as e,useCurrentVariant as t,useQuantity as l,useFormatMoney as i,convertDecimalToNumber as o,shopifyPriceRounding as a}from"@gem-sdk/core";import{useDynamicProduct as u}from"./useDynamicProduct.js";let useGetMoneyLines=(s,n)=>{let{isDynamicProduct:p,dynamicPrice:b,dynamicDiscount:r,isEnableDynamicDiscount:L}=u(),h=e(),c=t(),{quantity:d}=l(),m=h*(d||1),w=i(m,!1),S=o(c?.price)??0,f=S*(d||1),g=i(f,!1),y=a(m,2),T=i(f-parseFloat(y),!1),q=()=>{let e=[];return!1!==s.isShowSubTotalLabel&&e.push({title:n.subTotalLabel,money:p?b:g,uniqueId:"subTotalLabel"}),!1!==s.isShowDiscountLabel&&e.push({title:n.discountLabel,money:p&&r&&L?`${r.value}%`:h>0?w:"No discount",uniqueId:"discountLabel"}),!1!==s.isShowShippingLabel&&e.push({title:n.shippingLabel,uniqueId:"shippingLabel",tooltip:{content:"Shipping fee will be calculated on real offer page",width:"23em"}}),!1!==s.isShowTaxesLabel&&e.push({title:n.taxesLabel,uniqueId:"taxesLabel",tooltip:{content:"Taxes will be calculated on real offer page",width:"20em"}}),!1!==s.isShowTotalLabel&&e.push({title:n.totalLabel,money:p?b:T,uniqueId:"totalLabel"}),e};return{getMoneyLines:q}};export{useGetMoneyLines};
