PageSourceSearch

https://www.bagchee.com/static/js/816.062c1580.chunk.js

js bagchee.com collected 2026-10-02 11:14:57 UTC 2,870 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[816],{816(e,r,t){t.r(r),t.d(r,{default:()=>i});var a=t(5043),n=t(7874),o=t(9722),s=t(2339),d=t(579);const c="https://www.bagchee.com/api";function i(){const[e]=(0,n.ok)(),r=(0,n.Zp)(),t=(0,a.useRef)(!1),[i,l]=(0,a.useState)("");return(0,a.useEffect)(()=>{if(t.current)return;t.current=!0;const a=e.get("token");if(e.get("cancelled")||!a)return s.Ay.error("Payment cancelled. Your order is saved \u2014 you can retry from My Orders."),void r("/account/orders",{replace:!0});const n=(()=>{try{return JSON.parse(sessionStorage.getItem("paypal_pending")||"{}")}catch(e){return{}}})();if(!n.orderId)return void l("Session expired \u2014 your order is saved. If payment was deducted, contact support.");(async()=>{try{var e;const u=JSON.parse(localStorage.getItem("auth")||"{}"),p=null===u||void 0===u?void 0:u.token,y=Boolean(n.paymentToken),h=y?"/paypal/capture-by-token":"/paypal/capture-order",f=y?{token:a,orderId:n.orderId,paymentToken:n.paymentToken}:{token:a,orderId:n.orderId},g=await o.A.post("".concat(c).concat(h),f,{headers:p?{Authorization:"Bearer ".concat(p)}:{}});if(null!==(e=g.data)&&void 0!==e&&e.status){sessionStorage.removeItem("paypal_pending"),s.Ay.success("Payment successful!");let e={id:n.orderId,orderNumber:n.orderNumber};try{var t,d;const r=await o.A.get("".concat(c,"/orders/get/").concat(n.orderId),{headers:p?{Authorization:"Bearer ".concat(p)}:{}});null!==(t=r.data)&&void 0!==t&&t.status&&null!==(d=r.data)&&void 0!==d&&d.data&&(e=r.data.data)}catch(m){}r("/order-receipt",{state:{orderDetails:e,paymentConfirmed:!0},replace:!0})}else{var i;l((null===(i=g.data)||void 0===i?void 0:i.msg)||"Payment capture failed. Please contact support.")}}catch(y){var u,p;l((null===(u=y.response)||void 0===u||null===(p=u.data)||void 0===p?void 0:p.msg)||"Something went wrong. Please contact support.")}})()},[]),i?(0,d.jsxs)("div",{className:"min-h-screen flex flex-col items-center justify-center p-8 text-center",children:[(0,d.jsx)("p",{className:"text-red-600 text-lg font-semibold mb-4",children:i}),(0,d.jsxs)("p",{className:"text-gray-600 mb-6",children:["Your order has been saved. If payment was deducted, please email us at ",(0,d.jsx)("a",{href:"mailto:[email protected]",className:"underline",children:"[email protected]"})," with your order number."]}),(0,d.jsx)("a",{href:"/account/orders",className:"bg-blue-900 text-white px-6 py-3 rounded-lg hover:bg-blue-800",children:"View My Orders"})]}):(0,d.jsxs)("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4",children:[(0,d.jsx)("div",{className:"w-10 h-10 border-4 border-blue-900 border-t-transparent rounded-full animate-spin"}),(0,d.jsx)("p",{className:"text-gray-700 font-medium",children:"Confirming your payment, please wait\u2026"})]})}}}]);
2//# sourceMappingURL=816.062c1580.chunk.js.map

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.