PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.6
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.6
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
fluent-cart / assets / chunks / productService.js

productService.js in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.6, at assets/chunks/productService.js

2 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import{A as p}from"./Translator.js?ver=1.6.6";import{C as c}from"./CurrencyFormatter.js?ver=1.6.6";function f(a,n){var o;let l=[],t,e;if(a){for(const i of a)if(i!=null&&i.detail){if(t={},t.id=i.detail.id,t.order_id=n,t.post_id=i.ID,t.object_id=i.detail.default_variation_id,t.featured_media=(o=i.detail.featured_media)==null?void 0:o.url,t.price=i.detail.item_price,t.unit_price=i.detail.item_price,t.title=i.post_title,t.post_title=i.post_title,t.quantity=1,t.fulfillment_type=i.detail.fulfillment_type,t.manage_stock=i.detail.manage_stock,t.stockStatus=i.detail.manage_stock==1?i.detail.stock_availability:"in-stock",t.soldIndividually=i.detail.sold_individually,t.settings=i.detail.settings,t.checked=!1,t.min_price=i.detail.min_price,t.max_price=i.detail.max_price,i.detail.variants&&i.detail.variants.length){t.children=[];for(const d in i.detail.variants){e=i.detail.variants[d],t.title=e.variation_title,t.variation_display_title=e.variation_display_title||e.variation_title;let s=i.detail.default_variation_id==e.id;if(!s&&i.detail.variation_type==="simple"&&(s=!0),s&&(t.available=e.manage_stock.toString()==="1"?e.available:1/0,t.price=e.item_price,t.unit_price=e.item_price,t.object_id=e.id,t.cost=e.item_cost,t.other_info=e.other_info,t.payment_type=e.other_info.payment_type,t.bundle_items=e.bundle_children),i.detail.variants&&(i.detail.variation_type==="simple_variations"||i.detail.variation_type==="advanced_variations")){let r={};e=i.detail.variants[d],r.id=e.id,r.order_id=n,r.post_id=e.post_id,r.object_id=e.id,r.price=e.item_price,r.unit_price=e.item_price,r.item_cost=e.item_cost,r.featured_media=e.media&&e.media.meta_value&&e.media.meta_value[0]?e.media.meta_value[0].url:t.featured_media,r.quantity=1,r.post_title=i.post_title,r.title=e.variation_title,r.variation_display_title=e.variation_display_title||e.variation_title,r.fulfillment_type=i.detail.fulfillment_type,r.manage_stock=e.manage_stock,r.stockStatus=e.manage_stock==1?e.stock_status:"in-stock",r.available=e.manage_stock==1?e.available:1/0,r.soldIndividually=e.sold_individually,r.settings=e.settings,r.checked=!1,r.disable=_(r),r.other_info=e.other_info,r.payment_type=e.other_info.payment_type,r.bundle_items=e.bundle_children,t.children.push(r)}}}t.disable=_(t),l.push(t)}}return l}const _=a=>!(a.stockStatus==="in-stock"&&(Array.isArray(a.children)&&a.children.length===0||!a.children)),v=(a,n,l=!1)=>!a&&l?"":(a||(a="0.00"),p.get("shop.currency_sign")+" "+a),y=(a,n,l=!1)=>c.formatNumber(a,n,l),b=a=>{if(!a.item_price||!a.item_cost)return"--";const n=Number(String(a.item_price).replace(",",".")),l=Number(String(a.item_cost).replace(",","."));return isNaN(n)||isNaN(l)||n===0?"--":((n-l)/n*100).toFixed(2)+"% "},h=a=>{if(!a.item_price||!a.item_cost)return"--";const n=Number(String(a.item_price).replace(",",".")),l=Number(String(a.item_cost).replace(",","."));return isNaN(n)||isNaN(l)?"--":c.formatNumber(n-l,!0)},g=a=>a.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "),k=a=>{const n=new Set;return a.order_items.forEach(l=>{(Number(l.object_id)!==0||l.object_id===null)&&n.add(l.object_id)}),n.size};export{g as a,v as b,h as c,b as d,y as f,k as g,f as p};
2