PageSourceSearch

https://login.kamero.ai/assets/BuyProductsComp-C_c0MYur.js

js kamero.ai collected 2026-10-05 16:21:29 UTC 12,106 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PhonePeV2Wrapper-CVMT6h2f.js","assets/index-DLsZ3GMo.js","assets/posthog-Awc6wRBS.js","assets/antd-DsHVv5LK.js","assets/react-vendor-C-YOEkO4.js","assets/index-kZDhNgOj.css","assets/PayPalWrapper-B1p7ZcKo.js"])))=>i.map(i=>d[i]);
2import{f as D,j as e,u as Ye,F as Y,_ as De,P as p}from"./index-DLsZ3GMo.js";import{r as n,s as P,q as Xe,B as O,X,C as ve,v as Je,W as Ze}from"./antd-DsHVv5LK.js";import{o as ke}from"./OrderService-Bo5fQrwn.js";import{P as N,p as et}from"./ProductService-BUqQYcca.js";import Re from"./PaymentService-CbTLfF1P.js";import{R as tt}from"./ResponsiveTable-lP83dzeE.js";import{b as nt,A as st}from"./AddBillingDetails-A86CHulb.js";import{c as rt}from"./index-B9Yf3CvV.js";import{M as it}from"./minus-BkW1Guzm.js";import{P as lt}from"./plus-C6O1Q6yQ.js";import"./posthog-Awc6wRBS.js";import"./react-vendor-C-YOEkO4.js";import"./imageUrlBuilder-Cb1WEe4h.js";import"./pincode-B9YnLcIO.js";const at=n.lazy(()=>De(()=>import("./PhonePeV2Wrapper-CVMT6h2f.js"),__vite__mapDeps([0,1,2,3,4,5]))),ot=n.lazy(()=>De(()=>import("./PayPalWrapper-B1p7ZcKo.js"),__vite__mapDeps([6,1,2,3,4,5]))),Oe=({userId:m,email:T,mobile:_,whitelabelId:J,fetchProducts:B,placeOrder:Z,confirmOrder:ee,purchaseNeedsUpdate:x,eventId:I,productType:l,walletBalance:h,walletBalanceUSD:g,className:v,paymentInProgress:te,detectedCountry:A,phone:ct})=>{const[C,Te]=n.useState(void 0),[_e,E]=n.useState(!0),[U,ne]=n.useState(!1),[Be,j]=n.useState(!1),[se,re]=n.useState(void 0),[W,ie]=n.useState([]),[le,b]=n.useState(void 0),[ae,oe]=n.useState(0),[ce,de]=n.useState(0),[V,Ae]=n.useState(!0),[L,Q]=n.useState(null),[ue,Ue]=n.useState(!1),[We,pe]=n.useState(!1);Ye(576);const[k,qe]=n.useState(A||"IN"),[ze,fe]=n.useState(0),[dt,me]=n.useState(0),[xe,ye]=n.useState(0),[S,he]=n.useState(0),[Fe,ge]=n.useState(!1),q=n.useRef(W);q.current=W;const R=n.useRef(C);R.current=C;const M=n.useRef(V);M.current=V;const w=n.useRef(k);w.current=k;const G=n.useRef(null),H=n.useCallback(t=>w.current!=="IN"&&t.costUSD?t.costUSD:t.cost,[]),d=n.useCallback(t=>{const s=w.current!=="IN",r=t/100;if(s)return`$${r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`;const o={minimumFractionDigits:2,maximumFractionDigits:2,style:"currency",currency:"INR"};try{return new Intl.NumberFormat("en-IN",o).format(r)}catch{return r.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}},[]),je=n.useCallback(t=>{const s=q.current;let r=s.findIndex(o=>o.productId===t.id);return r<0?0:s[r].quantity},[]),be=n.useCallback(async()=>{Ue(!0);try{const t=await nt.getBillingDetails(m);Q(t)}catch(t){t.message&&t.message.includes("404"),Q(null)}},[m]),$=n.useCallback((t,s,r,o)=>{const a=o!=="IN",i=a?g||0:h||0;var c=t.reduce((He,we)=>{const K=s[s.findIndex(Ke=>Ke.id===we.productId)],$e=a&&K.costUSD?K.costUSD:K.cost;return He+we.quantity*$e},0),u=c,f=0,F=!1;i&&r&&(c<=i?(F=!0,u=0,f=c):(u=c-i,f=i));var Ie=a?0:u*.18,Ce=c+Ie,Ge=Ce-f;fe(c),me(u),ye(Ie),he(f),ge(F),de(Ge),oe(Ce)},[h,g]),z=n.useCallback((t,s)=>{const r=l===N.facial_support?1:50;s<0||s>r||ie(o=>{const a=o.length;let i=[...o];const c=i.findIndex(u=>u.productId===t.id);if(s>0){const u={quantity:s,productId:t.id};c>=0?i[c]=u:i.push(u)}else c>=0&&i.splice(c,1);return setTimeout(()=>{R.current&&$(i,R.current,M.current,w.current),a===0&&i.length>0&&!ue&&be()},0),i})},[l,$,ue,be]),Se=n.useCallback(()=>{if(G.current)return G.current;const t=[{title:"Pack",dataIndex:"index",align:"center"},{title:"Photos",dataIndex:"photos",align:"center"},{title:"Validity",dataIndex:"validity",align:"center",render:s=>e.jsx("p",{children:s+" Months"})},{title:"Cost",dataIndex:"cost",align:"center",render:(s,r)=>e.jsx("p",{children:d(H(r))})},{title:"Quantity",key:"quantity",width:150,align:"center",render:(s,r)=>{const o=je(r),a=l===N.facial_support?1:50;return o===0?e.jsx(O,{type:"primary",onClick:()=>z(r,1),children:"Add to Cart"}):e.jsxs(X,{align:"middle",justify:"center",gap:8,children:[e.jsx(O,{shape:"circle",icon:e.jsx(it,{size:"1em"}),onClick:()=>z(r,o-1)}),e.jsx("span",{style:{minWidth:24,textAlign:"center",fontSize:"16px"},children:o}),e.jsx(O,{shape:"circle",icon:e.jsx(lt,{size:"1em"}),disabled:o>=a,onClick:()=>z(r,o+1)})]})}}];return l===N.photos_pack&&I?t.splice(2,1):l===N.facial_support&&t.splice(1,1),G.current=t,t},[l,I,d,H,je,z]),Ne=n.useCallback(async()=>{try{let t=await B(m);t.length>0?(t=t.map((s,r)=>(s.index=r+1,s)),E(!1),Te(t)):(E(!1),re("No Packs to buy!"))}catch(t){E(!1),re(t.message)}},[B,m]);n.useEffect(()=>{Ne(),Se()},[]),n.useEffect(()=>{A&&qe(A)},[A]);const y=n.useCallback(()=>{ne(!1),ie([]),fe(0),me(0),ye(0),he(0),ge(!1),de(0),oe(0)},[]),Ee=n.useCallback(async()=>{const t=q.current,s=w.current!=="IN",r=s?"USD":"INR";if(!(t.length===0||U))try{ne(!0);const o=window.location.origin+"/payment/callback";Re.setProvider(s?"paypal":"phonepe");const a=await Re.placeOrder({userId:m,orderItems:t,useWallet:M.current,eventId:I,redirectUrl:o,email:T,mobile:_,currency:r});if(a.phonePeV2IframeUrl==="wallet_only"||a.phonePeRedirectUrl==="wallet_only"||a.paypalRedirectUrl==="wallet_only"){y(),x&&x(),P.success("Order processed successfully using wallet balance!");return}if(s&&a.paypalRedirectUrl){j(!0),b(a);return}if(a.phonePeV2IframeUrl||a.phonePeRedirectUrl)j(!0),b(a);else throw new Error(`No valid redirect URL received for ${r} payment.`)}catch(o){P.error(o.message||"Failed to process payment. Please try again."),y()}},[U,m,I,T,_,x,y]),Ve=t=>k!=="IN"&&t.paypalRedirectUrl?e.jsx(n.Suspense,{fallback:e.jsx(Y,{}),children:e.jsx(ot,{order:t,onCancel:()=>{j(!1),b(void 0),y(),P.error("Payment process was cancelled")},onSuccess:()=>{j(!1),b(void 0),y(),P.success("Payment successful! Your packs should reflect shortly."),x&&x(),setTimeout(()=>{window.location.reload()},1e3)},onError:r=>{j(!1),b(void 0),y(),P.error("Payment failed via PayPal.")}})}):!t.phonePeV2IframeUrl&&!t.phonePeRedirectUrl||t.phonePeV2IframeUrl==="wallet_only"||t.phonePeRedirectUrl==="wallet_only"||t.paypalRedirectUrl==="wallet_only"?null:e.jsx(n.Suspense,{fallback:e.jsx(Y,{}),children:e.jsx(at,{order:t,onSuccess:()=>
2{j(!1),b(void 0),y(),P.success("Payment completed successfully!"),x&&x()},onCancel:()=>{j(!1),b(void 0),y(),P.error("Payment process was cancelled")}})}),Pe=()=>{const t=k!=="IN",s=t?g||0:h||0;return e.jsxs("div",{style:{backgroundColor:"#fafafa",borderRadius:"8px",padding:"16px",marginTop:"16px"},children:[s>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px",padding:"10px 12px",backgroundColor:"#fff",borderRadius:"6px",border:"1px solid #f0f0f0"},children:[e.jsx(Ze,{checked:V,onChange:r=>{Ae(r.target.checked),setTimeout(()=>{R.current&&$(q.current,R.current,r.target.checked,w.current)},0)},children:e.jsx("span",{style:{fontSize:"15px",fontWeight:500},children:"Use Credits"})}),e.jsx("span",{style:{fontSize:"15px",fontWeight:500},children:d(s)})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"16px",fontWeight:500},children:"Total:"}),S>0&&e.jsx("span",{style:{fontSize:"14px",textDecoration:"line-through",color:"#999"},children:d(ae)}),e.jsx("span",{style:{fontSize:"20px",fontWeight:600,color:"#6F4898"},children:d(ce)})]}),e.jsx(O,{type:"primary",size:"large",disabled:ae===0,onClick:r=>{r.preventDefault(),!U&&Ee()},children:Fe?"Add Packs":"Buy Now"})]}),t&&e.jsx("div",{style:{textAlign:"center",color:"#999",fontSize:"12px",marginTop:"10px"},children:"Payment will be processed via PayPal in USD"})]})},Le=()=>{const t=k!=="IN",s=18;if(W.length===0)return e.jsx("div",{children:Pe()});const r=W.map((i,c)=>{const u=C[C.findIndex(F=>F.id===i.productId)],f=H(u);return{index:c+1,name:u.photos,cost:f,quantity:i.quantity,subTotal:i.quantity*f/100,gstAmount:t?0:i.quantity*f*s/1e4,total:t?i.quantity*f/100:i.quantity*f*1.18/100}}),o=e.jsx(X,{justify:"center",align:"middle",style:{marginTop:"10px"},children:e.jsx(ve,{xs:24,sm:24,md:24,style:{textAlign:"right"},children:e.jsxs("div",{children:[e.jsxs("p",{style:{fontSize:"16px",marginBottom:"5px"},children:["Subtotal :"," ",e.jsx("span",{style:{fontSize:"16px"},children:d(ze)})]}),S?e.jsxs("p",{style:{fontSize:"16px",marginBottom:"5px"},children:["Credits Used :"," ",e.jsxs("span",{style:{fontSize:"16px"},children:["- ",d(S)]})]}):null,xe?e.jsxs("p",{style:{fontSize:"16px",marginBottom:"5px"},children:["GST (18%) :"," ",e.jsxs("span",{style:{fontSize:"16px"},children:["+ ",d(xe)]})]}):null,e.jsxs("p",{style:{fontSize:"16px"},children:["Total :"," ",e.jsx("span",{style:{fontSize:"16px"},children:d(ce)})]})]})})}),a=[{title:"No.",dataIndex:"index",width:S?null:30,align:"center",responsive:["md"]},{title:"Photos",dataIndex:"name",width:S?null:50,align:"center"},{title:"Price",dataIndex:"cost",align:"center",responsive:["md"],render:i=>e.jsx("p",{children:i!=="-"?d(i):"-"})},{title:"Qty",dataIndex:"quantity",width:S?null:50,align:"center"},{title:"Subtotal",align:"center",responsive:["md"],render:(i,c)=>e.jsx("p",{children:d(c.subTotal*100)})}];return S||(t||a.push({title:"GST (18%)",align:"center",render:(i,c)=>e.jsx("p",{children:d(c.gstAmount*100)})}),a.push({title:"Total",align:"center",render:(i,c)=>e.jsx("p",{children:d(c.total*100)})})),e.jsxs(e.Fragment,{children:[e.jsx(X,{justify:"space-between",align:"middle",children:e.jsxs(ve,{span:24,children:[e.jsxs("div",{className:"invoice-container",children:[e.jsx("h4",{children:"Purchase Summary"}),e.jsx(Je,{columns:a,dataSource:r,pagination:!1,components:{body:{row:i=>e.jsx("tr",{...i,style:{backgroundColor:i.index===r.length-1?"#f0f0f0":"inherit"}})}}})]}),o,e.jsx("div",{children:L?null:e.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"10px",marginBottom:"10px"},children:e.jsxs("div",{style:{display:"inline-flex",alignItems:"center"},children:[e.jsx("p",{style:{marginRight:"10px"},children:t?"Add Billing Details for your invoice :":"Add Billing Details first if you want GST Invoice :"}),e.jsx(O,{type:"dashed",className:"pageRightDetail",onClick:()=>pe(!0),children:"Add Billing Details"})]})})}),We?e.jsx(st,{editingBillingDetails:L||null,onClose:()=>{pe(!1)},onSave:i=>{Q(i)}}):null]})}),e.jsx("div",{children:Pe()})]})},Qe=t=>e.jsx(tt,{className:"purchase-table",columns:Se(),rowKey:s=>s.id,dataSource:t,pagination:!1,footer:()=>Le(),cardTitleKey:"photos",emptyText:"No packs available"}),Me=()=>e.jsxs("div",{style:{minHeight:"200px",background:"#f5f5f5",borderRadius:"8px",padding:"20px"},children:[e.jsx("div",{style:{height:"30px",background:"#e0e0e0",borderRadius:"4px",marginBottom:"20px",width:"40%"}}),e.jsxs("div",{style:{display:"flex",gap:"16px",flexWrap:"wrap"},children:[e.jsx("div",{style:{flex:"1 1 200px",minHeight:"150px",background:"#e0e0e0",borderRadius:"8px"}}),e.jsx("div",{style:{flex:"1 1 200px",minHeight:"150px",background:"#e0e0e0",borderRadius:"8px"}}),e.jsx("div",{style:{flex:"1 1 200px",minHeight:"150px",background:"#e0e0e0",borderRadius:"8px"}})]})]});return e.jsxs("div",{className:rt(v,"buy-pack"),style:{margin:0,minWidth:0},children:[se?e.jsx(Xe,{message:se,type:"error"}):null,_e?e.jsx(Me,{}):C?Qe(C):null,U?e.jsx(Y,{}):null,Be&&le?Ve(le):null]})};Oe.propTypes={userId:p.string.isRequired,email:p.string.isRequired,whitelabelId:p.string.isRequired,mobile:p.string,fetchProducts:p.func.isRequired,placeOrder:p.func.isRequired,confirmOrder:p.func.isRequired,purchaseNeedsUpdate:p.func.isRequired,eventId:p.string,productType:p.number.isRequired,walletBalance:p.number};const wt=m=>{const T=D(l=>l.userId),_=D(l=>l.whitelabelId),J=D(l=>l.email),B=D(l=>l.phone),Z=D(l=>l.detectedCountry),ee=async l=>await et.getProductList(l,m.productType),x=async(l,h,g,v)=>await ke.placeOrder(l,h,g,v),I=async(l,h,g,v,te)=>await ke.confirmOrder(l,h,"razorpay",te,g,v);return e.jsx(Oe,{...m,userId:T,whitelabelId:_,email:J,phone:B,detectedCountry:Z,fetchProducts:ee,placeOrder:x,confirmOrder:I})};export{wt as default};

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.