PageSourceSearch

https://zuri.health/_next/static/chunks/pages/Cnpl-f534d30cfd985498.js

js zuri.health collected 2026-09-24 12:08:43 UTC 13,756 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4369],{33129:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/Cnpl",function(){return s(75612)}])},75612:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return j},default:function(){return pages_Cnpl}});var r=s(85893),a=s(67294),n=s(25675),l=s.n(n),i=s(37094),c=s(52091),Cnpl_CnplModal=e=>{let{isOpen:t,onClose:s,message:n}=e,[o,d]=(0,a.useState)(!1),[m,u]=(0,a.useState)(!1),[h,x]=(0,a.useState)(30),[p,b]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=setInterval(()=>{p>0?b(p-1):h>0?(x(h-1),b(59)):clearInterval(e)},1e3);return()=>clearInterval(e)},[h,p]),(0,a.useEffect)(()=>{let e,t;return o&&(e=setTimeout(()=>d(!1),2e3)),m&&(t=setTimeout(()=>u(!1),2e3)),()=>{clearTimeout(e),clearTimeout(t)}},[o,m]);let copyToClipboard=(e,t)=>{navigator.clipboard.writeText(e).then(()=>{"merchant"===t?d(!0):u(!0)}).catch(e=>{console.error("Failed to copy text: ",e)})};return(0,r.jsx)("div",{className:"fixed inset-0 z-[1050] ".concat(t?"block":"hidden"),children:(0,r.jsx)("div",{className:"absolute inset-y-0 left-0 flex w-full transform items-center justify-center bg-[#344054c7]",children:(0,r.jsxs)("div",{className:"relative flex h-[100%] w-[90%] flex-col overflow-hidden overflow-y-scroll rounded-xl bg-[#F7FEFF] md:h-[329px] md:w-[60%] xl:h-[78%]",children:[(0,r.jsx)(i.mpJ,{size:25,className:"absolute right-0 top-1 flex cursor-pointer justify-end transition-transform duration-200 hover:scale-110",color:"#EA526F",onClick:s}),(0,r.jsxs)("div",{className:"mx-auto max-w-md p-6",children:[(0,r.jsx)("div",{className:"mb-6 rounded-md bg-amber-100 p-2",children:(0,r.jsx)("p",{className:"text-amber-500",children:"Please validate your transaction on the I&M Bank application using the Partner Code and Purchase Code below."})}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-500 font-bold text-white",children:"1"}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-gray-800",children:"Open the I&M Bank App on your phone, select Short Term Loan, select Buy Now Pay Later."})})]}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)(l(),{src:"/assets/i_m.png",width:100,height:100,alt:"I&M Bank logo"})}),(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-500 font-bold text-white",children:"2"}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-gray-800",children:"Select Apply for Loan"})})]}),(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-blue-500 font-bold text-white",children:"3"}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-gray-800",children:"Copy the Partner Code and the Purchase Code below in your Mobile App:"})})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-blue-50 p-2",children:[(0,r.jsxs)("div",{className:"font-medium",children:["Partner Code:"," ",(0,r.jsx)("span",{className:"font-bold",children:n.MerchantCode})]}),(0,r.jsx)("button",{onClick:()=>copyToClipboard(n.MerchantCode,"merchant"),className:"flex items-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors duration-200 ".concat(o?"bg-green-500 text-white":"bg-blue-500 text-white hover:bg-blue-600"),children:o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.l_A,{size:12}),(0,r.jsx)("span",{children:"Copied!"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.esY,{size:12}),(0,r.jsx)("span",{children:"Copy"})]})})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-blue-50 p-2",children:[(0,r.jsxs)("div",{className:"font-medium",children:["Purchase Code:"," ",(0,r.jsx)("span",{className:"font-bold",children:n.SpotitCheckoutCode})]}),(0,r.jsx)("button",{onClick:()=>copyToClipboard(n.SpotitCheckoutCode,"checkout"),className:"flex items-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors duration-200 ".concat(m?"bg-green-500 text-white":"bg-blue-500 text-white hover:bg-blue-600"),children:m?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.l_A,{size:12}),(0,r.jsx)("span",{children:"Copied!"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.esY,{size:12}),(0,r.jsx)("span",{children:"Copy"})]})})]}),(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("p",{className:"text-center text-sm text-gray-500",children:"This transaction expires in:"}),(0,r.jsx)("div",{className:"mt-2 rounded-lg border border-blue-200 p-2",children:(0,r.jsxs)("div",{className:"flex items-center justify-center",children:[(0,r.jsxs)("div",{className:"w-16 text-center",children:[(0,r.jsx)("div",{className:"text-2xl font-bold text-blue-500",children:h.toString().padStart(2,"0")}),(0,r.jsx)("div",{className:"text-xs text-blue-400",children:"minutes"})]}),(0,r.jsx)("div",{className:"mx-2 text-2xl font-bold text-blue-500",children:":"}),(0,r.jsxs)("div",{className:"w-16 text-center",children:[(0,r.jsx)("div",{className:"text-2xl font-bold text-blue-500",children:p.toString().padStart(2,"0")}),(0,r.jsx)("div",{className:"text-xs text-blue-400",children:"seconds"})]})]})})]})]})]})]})})})},o=s(11163),d=s(9473),m=s(55678),u=s(78153),h=s(36281),x=s(92729),p=s(83454),b=s(21876).Buffer;let f=x.default.create({baseURL:"/api/proxy"});let PaymentService=class PaymentService{_getBasicAuthHeader(){let e=p.env.SPOTIT_BASIC_AUTH;return e?"Basic ".concat(b.from(e).toString("base64")):null}async getAccessToken(){let e=this._getBasicAuthHeader();if(!e)return null;try{let t=await f.get("/authenticate",{headers:{Authorization:e}});if("200"===t.data.ResponseCode){let{Token:e,Ttl:s}=t.data;return{token:e,expiresAt:Date.now()+1e3*s}}throw Error("Access token not found in response")}catch(e){console.error(e)}}async getBankList(e){try{let t=await f.get("/banks",{headers:{Authorization:"Bearer ".concat(e)}});if("200"===t.data.ResponseCode)return{banks:t.data.Banks};throw Error("Could not get bank lists")}catch(e){console.error(e)}}async processStk(e,t,s,r){let a=p.env.SPOTIT_SHORTCODE,n=p.env.SPOTIT_PASSKEY;if(!a||!n)return{success:!1,message:"Payments are temporarily unavailable."};let l=this._getLongTimestamp(),i=b.from(a+n+l).toString("base64");try{let n=await f.post("/spotitcode",{BusinessShortCode:a,Password:i,Timestamp:l,TransactionType:"SpotitCustomerPayOnline",Cart:t,PartyA:e,PartyB:a,PhoneNumber:e,Bank:s,CallbackURL:"https://9716-197-232-74-40.ngrok-free.app",AccountReference:"12345678901234",TransactionDesc:"Test description"},{headers:{Authorization:"Bearer ".concat(r),Accept:"application/json","Content-Type":"application/json"}});if(n.data&&200!=n.data.ResponseCode)return{success:!1,message:n.data.errorMessage||n.data.error||"Payment processing failed"};return{success:!0,message:n.data}}catch(t){console.error(t);let e="Something went wrong";if(t.response){var c;e=(null===(c=t.response.data)||void 0===c?void 0:c.message)||t.response.statusText}else e=t.request?"No response from server":t.message;return{success:!1,message:e}}}constructor(){this._getLongTimestamp=()=>new Date().toISOString().replace(/[-:T.Z]/g,"").slice(0,14)}};s(53181),s(33321);var g=s(47960),j=!0,pages_Cnpl=()=>{let e=new PaymentService,[t,s]=(0,a.useState)(null),[n,i]=(0,a.useState)(""),[c,x]=(0,a.useState)("+254"),[p,b]=(0,a.useState)([]),[f,j]=(0,a.useState)({}),[y,v]=(0,a.useState)(!0),[N,w]=(0,a.useState)([]),[C,S]=(0,a.useState)(0),[k,P]=(0,a.useState)(!1),[T,_]=(0,a.useState)(!1),[A,B]=(0,a.useState)(""),E=(0,d.v9)(u.Aq),I=(0,d.v9)(h.gj),z=(0,o.useRouter)(),{page:M}=z.query;(0,a.useEffect)(()=>
1{if(!z.isReady)return;"lab"===M?(w(I),S(I.reduce((e,t)=>e+t.price,0))):(w(E),S(E.reduce((e,t)=>e+t.price,0)));let fetchData=async()=>{v(!0);try{let t=await e.getAccessToken();if(s(null==t?void 0:t.token),null==t?void 0:t.token){let s=await e.getBankList(t.token);s.banks&&s.banks.length>0&&(b(s.banks.slice(0,1)),j(s.banks[0]))}let r=JSON.parse(sessionStorage.getItem("user"));r&&i(r.country_code+r.mobile_no)}catch(e){console.error("Error fetching data:",e)}finally{v(!1)}};fetchData()},[z.isReady,M,E,I]);let handlePayment=async()=>{if(v(!0),!t){console.error("Access token is missing!");return}if(!f){console.error("No bank available for payment"),m.Am.error("No bank available for payment");return}let s=N.map(e=>({SKUCode:e.product._id,Name:e.product.name,Description:e.product.description,Quantity:String(e.quantity),Price:String(e.price),Action:"NEWSALE"})),{success:r,message:a}=await e.processStk("254"+n,s,f,t);r?(_(a),m.Am.success("Payment successful. ".concat(a.CustomerMessage)),P(!0)):m.Am.error("Payment not successful. ".concat(a)),v(!1)};return(0,r.jsxs)("div",{className:"relative",children:[y?(0,r.jsx)("div",{className:"fixed inset-0 z-[1050] flex items-center justify-center bg-white bg-opacity-80",children:(0,r.jsxs)("div",{className:"flex flex-col items-center",children:[(0,r.jsx)("div",{className:"mb-3 h-12 w-12 animate-spin rounded-full border-b-2 border-t-2 border-primary-teal"}),(0,r.jsx)("p",{className:"font-medium text-primary-teal",children:"Processing..."})]})}):null,(0,r.jsx)(Cnpl_CnplModal,{isOpen:k,message:T,onClose:()=>{P(!k)}}),(0,r.jsxs)("div",{className:"mx-auto my-6 max-w-md bg-white p-6 ",children:[(0,r.jsxs)("p",{className:"text-md mb-5",children:["Be sure that you have an account with I&M to proceed if not"," ",(0,r.jsx)("a",{href:"https://digital.imbank.com/retail-onboarding/prospect/select-products",target:"_blank",className:"text-primary-pink underline",rel:"noreferrer",children:"Create account"})]}),(0,r.jsxs)("div",{className:"mb-6 border-t border-gray-200 pt-6",children:[(0,r.jsx)("h2",{className:"mb-4 text-sm font-bold",children:"Selected Items"}),(0,r.jsx)("div",{className:"space-y-4",children:N.map(e=>(0,r.jsxs)("div",{className:"border-1 mb-8 flex items-center justify-between rounded-lg bg-gray-50 p-4",children:[(0,r.jsx)(l(),{src:(0,g.G)(e.product.image),width:50,height:50,alt:"help",className:"mr-4 max-h-[50px] min-h-[50px] w-[50px] items-center object-contain"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-md",children:e.product.name}),(0,r.jsxs)("p",{className:"text-sm text-gray-500",children:["Quantity: ",e.quantity]})]}),(0,r.jsxs)("p",{className:"text-sm font-medium text-primary-teal",children:["Kes ",e.product.price]})]},e.product.id))})]}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)("p",{className:"text-md mb-6 font-medium",children:["Total Amount"," ",(0,r.jsxs)("span",{className:"text-md text-primary-teal",children:["Kes ",C]})]})}),(0,r.jsxs)("div",{className:"mb-6 border-t border-gray-200 pt-6",children:[(0,r.jsx)("label",{htmlFor:"phoneNumber",className:"mb-2 block text-sm font-bold",children:"Enter your phone number"}),(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("select",{className:"rounded-l-lg border border-gray-300 bg-gray-50 p-3",value:c,onChange:e=>x(e.target.value),children:[{code:"+254",country:"Ke"}].map(e=>(0,r.jsxs)("option",{value:e.code,children:[e.code," (",e.country,")"]},e.code))}),(0,r.jsx)("input",{type:"text",id:"phoneNumber",value:n,onChange:e=>{let t=e.target.value,s=t.replace(/\D/g,"");i(s),"+254"===c&&(s.length>0&&9!==s.length?B("Phone number must be exactly 9 digits.  ex. 712345678 0r 102345678"):B(""))},className:"w-full rounded-r-lg border border-gray-300 p-3",placeholder:"ex. 712345678 or 102338984"})]}),A?(0,r.jsx)("p",{className:"mt-1 text-sm text-red-600",children:A}):null]}),(0,r.jsxs)("div",{className:"flex max-w-md items-start rounded-md border border-blue-200 bg-blue-50 p-4 shadow-sm",children:[(0,r.jsx)("div",{className:"mr-3 flex-shrink-0 text-blue-500",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
1currentColor",className:"h-5 w-5",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 01.67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 11-.671-1.34l.041-.022zM12 9a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})})}),(0,r.jsx)("p",{className:"text-sm text-blue-700",children:"Purchase code and Partner code will be sent to the number provided"})]}),(0,r.jsx)("button",{disabled:y||!n,className:"mt-8 w-full rounded-lg ".concat(y||!n?"bg-grey-500":"bg-primary-teal"," px-4 py-2 text-white"),onClick:handlePayment,children:y?"Processing...":"Submit"}),(0,r.jsxs)("p",{className:"mt-4 text-sm",children:["By submitting you agree to Zuri Health's"," ",(0,r.jsx)("a",{className:"text-primary-pink",href:"https://zuri.health/policies/terms",children:"Terms and Conditions"})," ","and"," ",(0,r.jsx)("a",{className:"text-primary-pink",href:"https://zuri.health/policies/privacy",children:"Privacy Policy"})," "]})]})]})}},47960:function(e,t,s){"use strict";s.d(t,{AE:function(){return requiresPrescription},G:function(){return getProductImageUrl},wi:function(){return r}});let r="/assets/images/dummy-drug.svg";function getProductImageUrl(e){var t;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,a=Array.isArray(e)?null===(t=e[0])||void 0===t?void 0:t.imgPath:null==e?void 0:e.imgPath;return!function(e){if(!e||"string"!=typeof e)return!1;let t=e.trim();return t.startsWith("/")||t.startsWith("http://")||t.startsWith("https://")}(a)?s:a.trim()}function requiresPrescription(e){return!!e&&!0===e.prescription}}},function(e){e.O(0,[2729,9774,2888,179],function(){return e(e.s=33129)}),_N_E=e.O()}]);

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.