PageSourceSearch

https://kapten-son.com/_sfassets/BiRT2NTy.js

js kapten-son.com collected 2026-10-01 12:22:20 UTC 1,562 bytes, 1 lines download raw bytes

1import{$ as g,Y as f,J as l,c1 as s,c2 as v,c3 as y,c4 as P,as as r}from"./BpI9WzFj.js";function R(){const{push:m}=g(),{trackAddToBasket:u,trackRemoveFromBasket:_}=f();l("useCheckoutEvents");const h=(t,n,e)=>{const c=v(t?.appliedReductions??[]),o=y(t?.appliedReductions??[]),i=P(t?.appliedReductions??[]);m({event:"begin_checkout",value:r(t?.withTax),sale_reduction_with_tax:r(o),promotion_reduction_with_tax:r(i),campaign_reduction_with_tax:r(c),tax:r(t?.tax.vat.amount),checkout_type:n,ecommerce:{items:(e??[]).map(s)}})},p=(t,n,e,c,o)=>{const i=o?.map((a,k)=>({...s(a),index:k}));m({event:"add_shipping_info",shipping_type:t,shipping_method:n,currency:e,value:c,ecommerce:{items:i}})},d=(t,n)=>{const e=n?.map((c,o)=>({...s(c),index:o}));m({event:"add_payment_info",payment_type:t,ecommerce:{items:e}})};return{trackBeginCheckout:h,trackAddShippingInfo:p,trackAddPaymentInfo:d,trackCompleteCheckout:t=>{const n=t.map((e,c)=>({...s(e),index:c}));m({event:"complete_checkout",ecommerce:{items:n}})},handleTrackingEvent:(t,n)=>{const e=t.data.event;if(!e)return;const c=e.event;if(c==="add_to_cart"){const o=e.ecommerce?.items?.[0]?.item_id,i=n.find(a=>a.product.id.toString()===o);i&&u(i.variant,i.product,i.quantity)}else if(c==="remove_from_cart"){const o=e.ecommerce?.items?.[0]?.item_id,i=n.find(a=>a.product.id.toString()===o);i&&_(i,"checkout")}else c==="add_payment_info"?d(e.payment_type??"",n):c==="feature"&&e.name==="add_shipping_info"&&p(e.shipping_type??"",e.shipping_method??"",e.ecommerce?.currency??"",e.ecommerce?.value??0,n)}}}export{R as u};

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.