@reevit/vue 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,7 +66,8 @@ interface StripeCardElement {
66
66
  */
67
67
  export declare function loadPaystackScript(): Promise<void>;
68
68
  /**
69
- * Loads the Hubtel checkout script
69
+ * Hubtel now uses npm package @hubteljs/checkout
70
+ * No script loading needed
70
71
  */
71
72
  export declare function loadHubtelScript(): Promise<void>;
72
73
  /**
@@ -183,7 +184,7 @@ export interface MPesaConfig {
183
184
  */
184
185
  export declare function openPaystackPopup(config: PaystackConfig): Promise<void>;
185
186
  /**
186
- * Opens Hubtel popup
187
+ * Opens Hubtel popup using the @hubteljs/checkout npm package
187
188
  */
188
189
  export declare function openHubtelPopup(config: HubtelConfig): Promise<void>;
189
190
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../src/bridges/loaders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,WAAW,CAAC,EAAE;YACZ,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK;gBAC1C,UAAU,EAAE,MAAM,IAAI,CAAC;aACxB,CAAC;SACH,CAAC;QACF,cAAc,CAAC,EAAE;YACf,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;SACpD,CAAC;QACF,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QAChE,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,cAAc,CAAC;QACpD,UAAU,CAAC,EAAE;YACX,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,C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F,OAAO,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC/C;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB7E;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCzE;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBnF;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAQ1F;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,YAAY,GAAG;IAAE,QAAQ,EAAE,cAAc,CAAA;CAAE,GAClD,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC3E;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,kBAAkB,CAAC,CAqC7B"}
package/dist/index.js CHANGED
@@ -1 +1,101 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),d=require("@reevit/core");function X(t){const s=t.toLowerCase();return s.includes("paystack")?"paystack":s.includes("hubtel")?"hubtel":s.includes("flutterwave")?"flutterwave":"paystack"}function Z(t,s){return{id:t.id,clientSecret:t.client_secret,pspPublicKey:t.psp_public_key,amount:t.amount,currency:t.currency,status:t.status,recommendedPsp:X(t.provider),availableMethods:s.paymentMethods||["card","mobile_money"],reference:t.reference||s.reference,connectionId:t.connection_id,provider:t.provider,feeAmount:t.fee_amount,feeCurrency:t.fee_currency,netAmount:t.net_amount,metadata:s.metadata}}function F(t){const{config:s,onSuccess:n,onError:i,onClose:p,onStateChange:l,apiBaseUrl:u}=t,a=e.ref(d.createInitialState());if(s.initialPaymentIntent){const r=s.initialPaymentIntent;a.value={...a.value,status:"ready",paymentIntent:r,selectedMethod:r.availableMethods?.length===1?r.availableMethods[0]:null}}const b=new d.ReevitAPIClient({publicKey:s.publicKey,baseUrl:u}),m=r=>{a.value=d.reevitReducer(a.value,r)};e.watch(()=>a.value.status,r=>{l?.(r)});const y=async r=>{m({type:"INIT_START"});try{const o=s.reference||d.generateReference(),c=d.detectCountryFromCurrency(s.currency),E=r||s.paymentMethods?.[0]||"card",{data:f,error:O}=await b.createPaymentIntent({...s,reference:o},E,c);if(O){m({type:"INIT_ERROR",payload:O}),i?.(O);return}if(!f){const $={code:"INIT_FAILED",message:"No data received from API",recoverable:!0};m({type:"INIT_ERROR",payload:$}),i?.($);return}const W=Z(f,{...s,reference:o});m({type:"INIT_SUCCESS",payload:W})}catch(o){const c={code:"INIT_FAILED",message:o instanceof Error?o.message:"Failed to initialize checkout",recoverable:!0,originalError:o};m({type:"INIT_ERROR",payload:c}),i?.(c)}},h=r=>{m({type:"SELECT_METHOD",payload:r})},k=async r=>{if(!(!a.value.paymentIntent||!a.value.selectedMethod)){m({type:"PROCESS_START"});try{let o;if(a.value.paymentIntent.clientSecret){const{data:E,error:f}=await b.confirmPaymentIntent(a.value.paymentIntent.id,a.value.paymentIntent.clientSecret);if(f){m({type:"PROCESS_ERROR",payload:f}),i?.(f);return}o=E}else{const{data:E,error:f}=await b.confirmPayment(a.value.paymentIntent.id);if(f){m({type:"PROCESS_ERROR",payload:f}),i?.(f);return}o=E}const c={paymentId:a.value.paymentIntent.id,reference:r.reference||a.value.paymentIntent.reference||a.value.paymentIntent.metadata?.reference||"",amount:a.value.paymentIntent.amount,currency:a.value.paymentIntent.currency,paymentMethod:a.value.selectedMethod,psp:a.value.paymentIntent.recommendedPsp,pspReference:r.pspReference||o?.provider_ref_id||"",status:"success",metadata:r};m({type:"PROCESS_SUCCESS",payload:c}),n?.(c)}catch(o){const c={code:"PAYMENT_FAILED",message:o instanceof Error?o.message:"Payment failed",recoverable:!0,originalError:o};m({type:"PROCESS_ERROR",payload:c}),i?.(c)}}},S=async r=>{await k(r)},V=r=>{m({type:"PROCESS_ERROR",payload:r}),i?.(r)},P=()=>{m({type:"RESET"})},M=async()=>{if(a.value.paymentIntent&&a.value.status!=="success")try{await b.cancelPaymentIntent(a.value.paymentIntent.id)}catch{}m({type:"CLOSE"}),p?.()},w=e.computed(()=>a.value.status),B=e.computed(()=>a.value.paymentIntent),C=e.computed(()=>a.value.selectedMethod),g=e.computed(()=>a.value.error),v=e.computed(()=>a.value.result),R=e.computed(()=>a.value.status==="loading"||a.value.status==="processing"),_=e.computed(()=>a.value.status==="ready"||a.value.status==="method_selected"||a.value.status==="processing"),N=e.computed(()=>a.value.status==="success"),T=e.computed(()=>a.value.error?.recoverable??!1);return{status:e.readonly(w),paymentIntent:e.readonly(B),selectedMethod:e.readonly(C),error:e.readonly(g),result:e.readonly(v),initialize:y,selectMethod:h,processPayment:k,handlePspSuccess:S,handlePspError:V,reset:P,close:M,isLoading:e.readonly(R),isReady:e.readonly(_),isComplete:e.readonly(N),canRetry:e.readonly(T)}}const ee={class:"reevit-method-selector"},te={class:"reevit-amount-display"},ne={class:"reevit-methods-grid"},oe=["onClick"],ae={class:"reevit-method-icon"},re={class:"reevit-method-info"},se={class:"reevit-method-name"},le={class:"reevit-method-description"},ce={class:"reevit-method-radio"},ie={key:0,class:"reevit-radio-inner"},K=e.defineComponent({__name:"PaymentMethodSelector",props:{methods:{},selected:{},amount:{},currency:{}},emits:["select"],setup(t,{emit:s}){const n=t,i=s,p=e.computed(()=>[{id:"card",name:"Card",description:"Visa, Mastercard, Maestro",icon:"💳"},{id:"mobile_money",name:"Mobile Money",description:"MTN, Vodafone, AirtelTigo",icon:"📱"},{id:"bank_transfer",name:"Bank Transfer",description:"Transfer directly from your bank",icon:"🏦"}].filter(l=>n.methods.includes(l.id)));return(l,u)=>(e.openBlock(),e.createElementBlock("div",ee,[u[0]||(u[0]=e.createElementVNode("h3",{class:"reevit-section-title"},"Select Payment Method",-1)),e.createElementVNode("p",te," Pay "+e.toDisplayString(e.unref(d.formatAmount)(t.amount,t.currency)),1),e.createElementVNode("div",ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,a=>(e.openBlock(),e.createElementBlock("button",{key:a.id,type:"button",class:e.normalizeClass(e.unref(d.cn)("reevit-method-card",t.selected===a.id&&"reevit-method-card--selected")),onClick:b=>i("select",a.id)},[e.createElementVNode("span",ae,e.toDisplayString(a.icon),1),e.createElementVNode("div",re,[e.createElementVNode("span",se,e.toDisplayString(a.name),1),e.createElementVNode("span",le,e.toDisplayString(a.description),1)]),e.createElementVNode("div",ce,[t.selected===a.id?(e.openBlock(),e.createElementBlock("div",ie)):e.createCommentVNode("",!0)])],10,oe))),128))])]))}}),ue={class:"reevit-form-group"},de=["disabled"],me={class:"reevit-network-selector"},pe={class:"reevit-networks-grid"},ye=["onClick","disabled"],ve={key:0,class:"reevit-error-message"},he=["disabled"],fe={key:0,class:"reevit-spinner"},be={key:1},j=e.defineComponent({__name:"MobileMoneyForm",props:{initialPhone:{},loading:{type:Boolean}},emits:["submit"],setup(t,{emit:s}){const n=t,i=s,p=e.ref(n.initialPhone||""),l=e.ref(null),u=e.ref(null);e.watch(p,m=>{const y=d.detectNetwork(m);y&&(l.value=y),u.value&&(u.value=null)});const a=()=>{if(!d.validatePhone(p.value)){u.value="Please enter a valid phone number";return}if(!l.value){u.value="Please select your mobile network";return}i("submit",{phone:p.value,network:l.value})},b=[{id:"mtn",name:"MTN",color:"#FFCC00"},{id:"vodafone",name:"Vodafone",color:"#E60000"},{id:"airteltigo",name:"AirtelTigo",color:"#005596"}];return(m,y)=>(e.openBlock(),e.createElementBlock("form",{class:"reevit-momo-form",onSubmit:e.withModifiers(a,["prevent"])},[e.createElementVNode("div",ue,[y[1]||(y[1]=e.createElementVNode("label",{class:"reevit-label",for:"reevit-phone"},"Phone Number",-1)),e.withDirectives(e.createElementVNode("input",{id:"reevit-phone","onUpdate:modelValue":y[0]||(y[0]=h=>p.value=h),type:"tel",class:e.normalizeClass(["reevit-input",{"reevit-input--error":u.value&&!e.unref(d.validatePhone)(p.value)}]),placeholder:"e.g. 024 123 4567",disabled:t.loading,autocomplete:"tel"},null,10,de),[[e.vModelText,p.value]])]),e.createElementVNode("div",me,[y[2]||(y[2]=e.createElementVNode("label",{class:"reevit-label"},"Select Network",-1)),e.createElementVNode("div",pe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(b,h=>e.createElementVNode("button",{key:h.id,type:"button",class:e.normalizeClass(e.unref(d.cn)("reevit-network-btn",l.value===h.id&&"reevit-network-btn--selected")),onClick:k=>l.value=h.id,disabled:t.loading},[e.createElementVNode("div",{class:"reevit-network-dot",style:e.normalizeStyle({backgroundColor:h.color})},null,4),e.createTextVNode(" "+e.toDisplayString(h.name),1)],10,ye)),64))])]),u.value?(e.openBlock(),e.createElementBlock("p",ve,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"submit",class:"reevit-submit-btn",disabled:t.loading||!p.value},[t.loading?(e.openBlock(),e.createElementBlock("span",fe)):(e.openBlock(),e.createElementBlock("span",be,"Continue"))],8,he),y[3]||(y[3]=e.createElementVNode("p",{class:"reevit-secure-text"}," 🔒 Secure mobile money payment via Reevit ",-1))],32))}}),D=new Map;function I(t,s){const n=D.get(s);if(n)return n;const i=new Promise((p,l)=>{if(document.getElementById(s)){p();return}const u=document.createElement("script");u.id=s,u.src=t,u.async=!0,u.onload=()=>p(),u.onerror=()=>l(new Error(`Failed to load ${s} script`)),document.head.appendChild(u)});return D.set(s,i),i}function A(){return I("https://js.paystack.co/v1/inline.js","paystack-script")}function L(){return I("https://checkout-v3.hubtel.com/js/checkout.js","hubtel-script")}function U(){return I("https://checkout.flutterwave.com/v3.js","flutterwave-script")}function z(){return I("https://js.stripe.com/v3/","stripe-script")}function x(){return I("https://sdk.monnify.com/plugin/monnify.js","monnify-script")}async function H(t){if(await A(),!window.PaystackPop)throw new Error("Paystack script not loaded");window.PaystackPop.setup({key:t.key,email:t.email,amount:t.amount,currency:t.currency,ref:t.ref,metadata:t.metadata,callback:t.onSuccess,onClose:t.onClose}).openIframe()}async function q(t){if(await L(),!window.HubtelCheckout)throw new Error("Hubtel script not loaded");window.HubtelCheckout.initPay({clientId:t.clientId,purchaseDescription:t.purchaseDescription,amount:t.amount,callbackUrl:t.callbackUrl,customerPhone:t.customerPhone,customerEmail:t.customerEmail,onSuccess:t.onSuccess,onClose:t.onClose})}async function Y(t){if(await U(),!window.FlutterwaveCheckout)throw new Error("Flutterwave script not loaded");window.FlutterwaveCheckout({public_key:t.public_key,tx_ref:t.tx_ref,amount:t.amount,currency:t.currency,customer:t.customer,payment_options:t.payment_options,customizations:t.customizations,callback:t.callback,onclose:t.onclose})}async function G(t){if(await z(),!window.Stripe)throw new Error("Stripe.js not loaded");return window.Stripe(t)}async function ke(t){const n=await(await G(t.publishableKey)).confirmPayment({elements:t.elements,clientSecret:t.clientSecret,redirect:"if_required"});n.error?t.onError({message:n.error.message||"Payment failed"}):n.paymentIntent&&t.onSuccess({paymentIntentId:n.paymentIntent.id,status:n.paymentIntent.status})}async function J(t){if(await x(),!window.MonnifySDK)throw new Error("Monnify SDK not loaded");window.MonnifySDK.initialize({amount:t.amount,currency:t.currency,reference:t.reference,customerName:t.customerName,customerEmail:t.customerEmail,customerMobileNumber:t.customerPhone,apiKey:t.apiKey,contractCode:t.contractCode,paymentDescription:t.paymentDescription||"Payment",isTestMode:t.isTestMode??!1,metadata:t.metadata,onComplete:s=>{s.status==="SUCCESS"?t.onSuccess({transactionReference:s.transactionReference,paymentReference:s.paymentReference,...s}):t.onError?.({message:s.message||"Payment failed"})},onClose:t.onClose})}async function Q(t,s){t.onInitiated();try{const n=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phone_number:t.phoneNumber,amount:t.amount,reference:t.reference,description:t.description})});if(!n.ok){const l=(await n.json().catch(()=>({}))).message||"Failed to initiate M-Pesa payment";return t.onError({message:l}),{status:"failed",message:l}}const i=await n.json();return{status:"initiated",message:"Please check your phone and enter your M-Pesa PIN to complete the payment.",transactionId:i.checkout_request_id||i.transaction_id}}catch(n){const i=n instanceof Error?n.message:"Network error";return t.onError({message:i}),{status:"failed",message:i}}}const Ee=["disabled"],Pe={key:0,class:"reevit-spinner"},Se={class:"reevit-modal-body"},we={key:0,class:"reevit-loading-state"},Ce={key:1,class:"reevit-error-state"},_e={key:2,class:"reevit-success-state"},Ne={key:1,class:"reevit-method-form-container"},Ie={key:2,class:"reevit-card-info"},Me=["disabled"],Re={key:0,class:"reevit-spinner"},Ve={key:1},Be=e.defineComponent({__name:"ReevitCheckout",props:{publicKey:{},amount:{},currency:{},email:{},phone:{},reference:{},metadata:{},paymentMethods:{},theme:{},isOpen:{type:Boolean},apiBaseUrl:{},initialPaymentIntent:{}},emits:["success","error","close"],setup(t,{emit:s}){const n=t,i=s,{status:p,paymentIntent:l,selectedMethod:u,error:a,isLoading:b,isReady:m,initialize:y,selectMethod:h,handlePspSuccess:k,handlePspError:S,close:V}=F({config:{publicKey:n.publicKey,amount:n.amount,currency:n.currency,email:n.email,phone:n.phone,reference:n.reference,metadata:n.metadata,paymentMethods:n.paymentMethods,initialPaymentIntent:n.initialPaymentIntent},apiBaseUrl:n.apiBaseUrl,onSuccess:r=>i("success",r),onError:r=>i("error",r),onClose:()=>i("close")}),P=e.ref(n.isOpen??!1);e.watch(()=>n.isOpen,r=>{r!==void 0&&(P.value=r)});const M=()=>{P.value=!0,!l.value&&p.value==="idle"&&y()};e.watch([P,l,u],([r,o,c])=>{r&&o&&c&&c==="card"&&C(null)});const w=()=>{P.value=!1,V()},B=r=>{h(r)},C=async r=>{if(!l.value)return;const o=l.value.recommendedPsp;try{if(o==="paystack")await H({key:n.publicKey,email:n.email||"",amount:n.amount,currency:n.currency,ref:l.value.id,onSuccess:c=>k(c),onClose:()=>{}});else if(o==="hubtel")await q({clientId:n.publicKey,purchaseDescription:`Payment for ${n.amount} ${n.currency}`,amount:n.amount,customerPhone:r?.phone||n.phone,customerEmail:n.email,onSuccess:c=>k(c),onClose:()=>{}});else if(o==="flutterwave")await Y({public_key:n.publicKey,tx_ref:l.value.id,amount:n.amount,currency:n.currency,customer:{email:n.email||"",phone_number:r?.phone||n.phone},callback:c=>k(c),onclose:()=>{}});else if(o==="monnify")await J({apiKey:l.value.pspPublicKey||n.publicKey,contractCode:n.metadata?.contract_code||n.publicKey,amount:n.amount,currency:n.currency,reference:l.value.reference||l.value.id,customerName:n.metadata?.customer_name||n.email||"",customerEmail:n.email||"",customerPhone:r?.phone||n.phone,metadata:n.metadata,onSuccess:c=>k(c),onClose:()=>{}});else if(o==="mpesa"){const c=`${n.apiBaseUrl||"https://api.reevit.io"}/v1/payments/${l.value.id}/mpesa`;await Q({phoneNumber:r?.phone||n.phone||"",amount:n.amount,reference:l.value.reference||l.value.id,description:`Payment ${l.value.reference||""}`,onInitiated:()=>{},onSuccess:E=>k(E),onError:E=>S({code:"MPESA_ERROR",message:E.message})},c)}else S(o==="stripe"?{code:"STRIPE_NOT_IMPLEMENTED",message:"Stripe integration requires custom Elements setup. Please use the React SDK or implement custom Stripe Elements."}:{code:"UNSUPPORTED_PSP",message:`Payment provider "${o}" is not supported in this checkout.`})}catch(c){S({code:"BRIDGE_ERROR",message:c instanceof Error?c.message:"Failed to open payment gateway"})}},g=e.computed(()=>d.createThemeVariables(n.theme||{}));e.watch(P,r=>{r?document.body.style.overflow="hidden":document.body.style.overflow=""}),e.onUnmounted(()=>{document.body.style.overflow=""});const v=e.computed(()=>p.value),R=e.computed(()=>a.value),_=e.computed(()=>u.value),N=e.computed(()=>b.value),T=e.computed(()=>m.value);return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:"reevit-sdk-container",style:e.normalizeStyle(g.value)},[e.renderSlot(r.$slots,"default",{open:M,isLoading:N.value},()=>[e.createElementVNode("button",{type:"button",class:"reevit-pay-button",onClick:M,disabled:N.value},[N.value?(e.openBlock(),e.createElementBlock("span",Pe)):e.renderSlot(r.$slots,"button-text",{key:1},()=>[o[1]||(o[1]=e.createTextVNode("Pay Now",-1))])],8,Ee)]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[P.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"reevit-modal-overlay",onClick:e.withModifiers(w,["self"])},[e.createElementVNode("div",{class:e.normalizeClass(["reevit-modal-content",{"reevit-modal--dark":n.theme?.darkMode}])},[e.createElementVNode("button",{class:"reevit-modal-close",onClick:w,"aria-label":"Close"}," × "),o[9]||(o[9]=e.createElementVNode("div",{class:"reevit-modal-header"},[e.createElementVNode("img",{src:"https://i.imgur.com/bzUR5Lm.png",alt:"Reevit",class:"reevit-modal__logo"})],-1)),e.createElementVNode("div",Se,[v.value==="loading"?(e.openBlock(),e.createElementBlock("div",we,[...o[2]||(o[2]=[e.createElementVNode("div",{class:"reevit-spinner reevit-spinner--large"},null,-1),e.createElementVNode("p",null,"Initializing payment...",-1)])])):v.value==="failed"&&R.value?(e.openBlock(),e.createElementBlock("div",Ce,[o[3]||(o[3]=e.createElementVNode("div",{class:"reevit-error-icon"},"⚠️",-1)),o[4]||(o[4]=e.createElementVNode("h3",null,"Payment Failed",-1)),e.createElementVNode("p",null,e.toDisplayString(R.value.message),1),e.createElementVNode("button",{class:"reevit-retry-btn",onClick:o[0]||(o[0]=c=>e.unref(y)())},"Retry")])):v.value==="success"?(e.openBlock(),e.createElementBlock("div",_e,[o[5]||(o[5]=e.createElementVNode("div",{class:"reevit-success-icon"},"✅",-1)),o[6]||(o[6]=e.createElementVNode("h3",null,"Payment Successful",-1)),o[7]||(o[7]=e.createElementVNode("p",null,"Thank you for your payment.",-1)),e.createElementVNode("button",{class:"reevit-done-btn",onClick:w},"Done")])):T.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[v.value==="ready"||v.value==="method_selected"||v.value==="processing"?(e.openBlock(),e.createBlock(K,{key:0,methods:n.paymentMethods||["card","mobile_money"],selected:_.value,amount:n.amount,currency:n.currency,onSelect:B},null,8,["methods","selected","amount","currency"])):e.createCommentVNode("",!0),(v.value==="method_selected"||v.value==="processing")&&_.value==="mobile_money"?(e.openBlock(),e.createElementBlock("div",Ne,[e.createVNode(j,{"initial-phone":n.phone,loading:v.value==="processing",onSubmit:C},null,8,["initial-phone","loading"])])):e.createCommentVNode("",!0),(v.value==="method_selected"||v.value==="processing")&&_.value==="card"?(e.openBlock(),e.createElementBlock("div",Ie,[o[8]||(o[8]=e.createElementVNode("p",{class:"reevit-info-text"},"You will be redirected to our secure payment partner to complete your card payment.",-1)),e.createElementVNode("button",{class:"reevit-submit-btn",onClick:C,disabled:v.value==="processing"},[v.value==="processing"?(e.openBlock(),e.createElementBlock("span",Re)):(e.openBlock(),e.createElementBlock("span",Ve,"Proceed to Card Payment"))],8,Me)])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]),o[10]||(o[10]=e.createElementVNode("div",{class:"reevit-modal-footer"},[e.createElementVNode("div",{class:"reevit-trust-badges"},[e.createElementVNode("span",null,"PCI DSS Compliant"),e.createElementVNode("span",null,"•"),e.createElementVNode("span",null,"SSL Secure")])],-1))],2)])):e.createCommentVNode("",!0)]))],4))}});Object.defineProperty(exports,"ReevitAPIClient",{enumerable:!0,get:()=>d.ReevitAPIClient});Object.defineProperty(exports,"cn",{enumerable:!0,get:()=>d.cn});Object.defineProperty(exports,"createReevitClient",{enumerable:!0,get:()=>d.createReevitClient});Object.defineProperty(exports,"detectCountryFromCurrency",{enumerable:!0,get:()=>d.detectCountryFromCurrency});Object.defineProperty(exports,"detectNetwork",{enumerable:!0,get:()=>d.detectNetwork});Object.defineProperty(exports,"formatAmount",{enumerable:!0,get:()=>d.formatAmount});Object.defineProperty(exports,"formatPhone",{enumerable:!0,get:()=>d.formatPhone});Object.defineProperty(exports,"validatePhone",{enumerable:!0,get:()=>d.validatePhone});exports.MobileMoneyForm=j;exports.PaymentMethodSelector=K;exports.ReevitCheckout=Be;exports.confirmStripePayment=ke;exports.createStripeInstance=G;exports.initiateMPesaSTKPush=Q;exports.loadFlutterwaveScript=U;exports.loadHubtelScript=L;exports.loadMonnifyScript=x;exports.loadPaystackScript=A;exports.loadStripeScript=z;exports.openFlutterwaveModal=Y;exports.openHubtelPopup=q;exports.openMonnifyModal=J;exports.openPaystackPopup=H;exports.useReevit=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),v=require("@reevit/core");function Q(t){const o=t.toLowerCase();return o.includes("paystack")?"paystack":o.includes("hubtel")?"hubtel":o.includes("flutterwave")?"flutterwave":"paystack"}function X(t,o){return{id:t.id,clientSecret:t.client_secret,pspPublicKey:t.psp_public_key,amount:t.amount,currency:t.currency,status:t.status,recommendedPsp:Q(t.provider),availableMethods:o.paymentMethods||["card","mobile_money"],reference:t.reference||o.reference,connectionId:t.connection_id,provider:t.provider,feeAmount:t.fee_amount,feeCurrency:t.fee_currency,netAmount:t.net_amount,metadata:o.metadata}}function U(t){const{config:o,onSuccess:n,onError:c,onClose:a,onStateChange:i,apiBaseUrl:u}=t,r=e.ref(v.createInitialState());if(o.initialPaymentIntent){const d=o.initialPaymentIntent;r.value={...r.value,status:"ready",paymentIntent:d,selectedMethod:d.availableMethods?.length===1?d.availableMethods[0]:null}}const y=new v.ReevitAPIClient({publicKey:o.publicKey,baseUrl:u}),m=d=>{r.value=v.reevitReducer(r.value,d)};e.watch(()=>r.value.status,d=>{i?.(d)});const l=async d=>{m({type:"INIT_START"});try{const s=o.reference||v.generateReference(),p=v.detectCountryFromCurrency(o.currency),k=d||o.paymentMethods?.[0]||"card",{data:b,error:T}=await y.createPaymentIntent({...o,reference:s},k,p);if(T){m({type:"INIT_ERROR",payload:T}),c?.(T);return}if(!b){const O={code:"INIT_FAILED",message:"No data received from API",recoverable:!0};m({type:"INIT_ERROR",payload:O}),c?.(O);return}const J=X(b,{...o,reference:s});m({type:"INIT_SUCCESS",payload:J})}catch(s){const p={code:"INIT_FAILED",message:s instanceof Error?s.message:"Failed to initialize checkout",recoverable:!0,originalError:s};m({type:"INIT_ERROR",payload:p}),c?.(p)}},h=d=>{m({type:"SELECT_METHOD",payload:d})},E=async d=>{if(!(!r.value.paymentIntent||!r.value.selectedMethod)){m({type:"PROCESS_START"});try{let s;if(r.value.paymentIntent.clientSecret){const{data:k,error:b}=await y.confirmPaymentIntent(r.value.paymentIntent.id,r.value.paymentIntent.clientSecret);if(b){m({type:"PROCESS_ERROR",payload:b}),c?.(b);return}s=k}else{const{data:k,error:b}=await y.confirmPayment(r.value.paymentIntent.id);if(b){m({type:"PROCESS_ERROR",payload:b}),c?.(b);return}s=k}const p={paymentId:r.value.paymentIntent.id,reference:d.reference||r.value.paymentIntent.reference||r.value.paymentIntent.metadata?.reference||"",amount:r.value.paymentIntent.amount,currency:r.value.paymentIntent.currency,paymentMethod:r.value.selectedMethod,psp:r.value.paymentIntent.recommendedPsp,pspReference:d.pspReference||s?.provider_ref_id||"",status:"success",metadata:d};m({type:"PROCESS_SUCCESS",payload:p}),n?.(p)}catch(s){const p={code:"PAYMENT_FAILED",message:s instanceof Error?s.message:"Payment failed",recoverable:!0,originalError:s};m({type:"PROCESS_ERROR",payload:p}),c?.(p)}}},w=async d=>{await E(d)},R=d=>{m({type:"PROCESS_ERROR",payload:d}),c?.(d)},P=()=>{m({type:"RESET"})},I=async()=>{if(r.value.paymentIntent&&r.value.status!=="success")try{await y.cancelPaymentIntent(r.value.paymentIntent.id)}catch{}m({type:"CLOSE"}),a?.()},C=e.computed(()=>r.value.status),V=e.computed(()=>r.value.paymentIntent),S=e.computed(()=>r.value.selectedMethod),B=e.computed(()=>r.value.error),f=e.computed(()=>r.value.result),N=e.computed(()=>r.value.status==="loading"||r.value.status==="processing"),g=e.computed(()=>r.value.status==="ready"||r.value.status==="method_selected"||r.value.status==="processing"),_=e.computed(()=>r.value.status==="success"),x=e.computed(()=>r.value.error?.recoverable??!1);return{status:e.readonly(C),paymentIntent:e.readonly(V),selectedMethod:e.readonly(S),error:e.readonly(B),result:e.readonly(f),initialize:l,selectMethod:h,processPayment:E,handlePspSuccess:w,handlePspError:R,reset:P,close:I,isLoading:e.readonly(N),isReady:e.readonly(g),isComplete:e.readonly(_),canRetry:e.readonly(x)}}const Z={class:"reevit-method-selector"},ee={class:"reevit-amount-display"},te={class:"reevit-methods-grid"},ne=["onClick"],oe={class:"reevit-method-icon"},re={class:"reevit-method-info"},ae={class:"reevit-method-name"},se={class:"reevit-method-description"},ie={class:"reevit-method-radio"},le={key:0,class:"reevit-radio-inner"},D=e.defineComponent({__name:"PaymentMethodSelector",props:{methods:{},selected:{},amount:{},currency:{}},emits:["select"],setup(t,{emit:o}){const n=t,c=o,a=e.computed(()=>[{id:"card",name:"Card",description:"Visa, Mastercard, Maestro",icon:"💳"},{id:"mobile_money",name:"Mobile Money",description:"MTN, Vodafone, AirtelTigo",icon:"📱"},{id:"bank_transfer",name:"Bank Transfer",description:"Transfer directly from your bank",icon:"🏦"}].filter(i=>n.methods.includes(i.id)));return(i,u)=>(e.openBlock(),e.createElementBlock("div",Z,[u[0]||(u[0]=e.createElementVNode("h3",{class:"reevit-section-title"},"Select Payment Method",-1)),e.createElementVNode("p",ee," Pay "+e.toDisplayString(e.unref(v.formatAmount)(t.amount,t.currency)),1),e.createElementVNode("div",te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,r=>(e.openBlock(),e.createElementBlock("button",{key:r.id,type:"button",class:e.normalizeClass(e.unref(v.cn)("reevit-method-card",t.selected===r.id&&"reevit-method-card--selected")),onClick:y=>c("select",r.id)},[e.createElementVNode("span",oe,e.toDisplayString(r.icon),1),e.createElementVNode("div",re,[e.createElementVNode("span",ae,e.toDisplayString(r.name),1),e.createElementVNode("span",se,e.toDisplayString(r.description),1)]),e.createElementVNode("div",ie,[t.selected===r.id?(e.openBlock(),e.createElementBlock("div",le)):e.createCommentVNode("",!0)])],10,ne))),128))])]))}}),ce={class:"reevit-form-group"},de=["disabled"],ue={class:"reevit-network-selector"},me={class:"reevit-networks-grid"},pe=["onClick","disabled"],ye={key:0,class:"reevit-error-message"},ve=["disabled"],he={key:0,class:"reevit-spinner"},fe={key:1},L=e.defineComponent({__name:"MobileMoneyForm",props:{initialPhone:{},loading:{type:Boolean}},emits:["submit"],setup(t,{emit:o}){const n=t,c=o,a=e.ref(n.initialPhone||""),i=e.ref(null),u=e.ref(null);e.watch(a,m=>{const l=v.detectNetwork(m);l&&(i.value=l),u.value&&(u.value=null)});const r=()=>{if(!v.validatePhone(a.value)){u.value="Please enter a valid phone number";return}if(!i.value){u.value="Please select your mobile network";return}c("submit",{phone:a.value,network:i.value})},y=[{id:"mtn",name:"MTN",color:"#FFCC00"},{id:"vodafone",name:"Vodafone",color:"#E60000"},{id:"airteltigo",name:"AirtelTigo",color:"#005596"}];return(m,l)=>(e.openBlock(),e.createElementBlock("form",{class:"reevit-momo-form",onSubmit:e.withModifiers(r,["prevent"])},[e.createElementVNode("div",ce,[l[1]||(l[1]=e.createElementVNode("label",{class:"reevit-label",for:"reevit-phone"},"Phone Number",-1)),e.withDirectives(e.createElementVNode("input",{id:"reevit-phone","onUpdate:modelValue":l[0]||(l[0]=h=>a.value=h),type:"tel",class:e.normalizeClass(["reevit-input",{"reevit-input--error":u.value&&!e.unref(v.validatePhone)(a.value)}]),placeholder:"e.g. 024 123 4567",disabled:t.loading,autocomplete:"tel"},null,10,de),[[e.vModelText,a.value]])]),e.createElementVNode("div",ue,[l[2]||(l[2]=e.createElementVNode("label",{class:"reevit-label"},"Select Network",-1)),e.createElementVNode("div",me,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(y,h=>e.createElementVNode("button",{key:h.id,type:"button",class:e.normalizeClass(e.unref(v.cn)("reevit-network-btn",i.value===h.id&&"reevit-network-btn--selected")),onClick:E=>i.value=h.id,disabled:t.loading},[e.createElementVNode("div",{class:"reevit-network-dot",style:e.normalizeStyle({backgroundColor:h.color})},null,4),e.createTextVNode(" "+e.toDisplayString(h.name),1)],10,pe)),64))])]),u.value?(e.openBlock(),e.createElementBlock("p",ye,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"submit",class:"reevit-submit-btn",disabled:t.loading||!a.value},[t.loading?(e.openBlock(),e.createElementBlock("span",he)):(e.openBlock(),e.createElementBlock("span",fe,"Continue"))],8,ve),l[3]||(l[3]=e.createElementVNode("p",{class:"reevit-secure-text"}," 🔒 Secure mobile money payment via Reevit ",-1))],32))}});class be{constructor(o){this.baseUrl="https://unified-pay.hubtel.com",this.messageHandler=null,this.stylesInjected=!1,o&&(this.baseUrl=o)}redirect({purchaseInfo:o,config:n}){const c=this.createCheckoutUrl(o,n),a=window.open(c);if(!a||a.closed||typeof a.closed>"u")throw new Error("Popup was blocked by the browser. Please allow popups for this site.")}initIframe({purchaseInfo:o,callBacks:n,config:c,iframeStyle:a}){var i,u,r;this.registerEvents(n);const y=document.getElementById("hubtel-checkout-iframe");if(!y)throw new Error('Container element with id "hubtel-checkout-iframe" not found in the DOM.');y.innerHTML="";const m=document.createElement("div");m.textContent="Loading...",y.appendChild(m);const l=document.createElement("iframe");l.setAttribute("id","hubtel-iframe-element"),l.src=this.createCheckoutUrl(o,c),l.style.display="none",l.style.width=(i=a?.width)!==null&&i!==void 0?i:"100%",l.style.height=(u=a?.height)!==null&&u!==void 0?u:"100%",l.style.minHeight=a?.minHeight||"400px",l.style.border=(r=a?.border)!==null&&r!==void 0?r:"none",l.onload=()=>{var h;y.removeChild(m),l.style.display="block",(h=n.onLoad)===null||h===void 0||h.call(n)},y.appendChild(l)}openModal({purchaseInfo:o,callBacks:n,config:c}){this.injectStyles(),this.createIframe(),this.handleBackButton(),this.registerEvents(n),this.renderWebpageInPopup(this.createCheckoutUrl(o,c),n.onClose,n.onLoad)}createCheckoutUrl(o,n){const c=Object.assign(Object.assign({},o),n),a=Object.keys(c).reduce((m,l)=>(c[l]!==null&&c[l]!==void 0&&(m[l]=c[l]),m),{}),i=Object.keys(a).map(m=>`${m}=${encodeURIComponent(a[m])}`).join("&"),u=this.encodeBase64(i),r=encodeURIComponent(u);return`${a?.branding==="disabled"?`${this.baseUrl}/pay/direct`:`${this.baseUrl}/pay`}?p=${r}`}encodeBase64(o){return btoa(unescape(encodeURIComponent(o)))}handleBackButton(){window.addEventListener("popstate",()=>{this.closePopUp()})}createIframe(){const o=document.createElement("div");o.setAttribute("id","backdrop"),o.classList.add("backdrop");const n=document.createElement("span");n.classList.add("checkout-loader"),o.appendChild(n),document.body.appendChild(o)}registerEvents(o){this.messageHandler&&window.removeEventListener("message",this.messageHandler,!1);const n=c=>{var a,i,u,r,y,m;if(c.origin!==this.baseUrl)return;const{data:l}=c;if(l.success===!0)(a=o.onPaymentSuccess)===null||a===void 0||a.call(o,l);else if(l.success===!1)(i=o.onPaymentFailure)===null||i===void 0||i.call(o,l);else if(l.initialized)(u=o.init)===null||u===void 0||u.call(o,l),(r=o.onInit)===null||r===void 0||r.call(o,l);else if(l.feesChanged)(y=o.onFeesChanged)===null||y===void 0||y.call(o,l.fees);else if(l.resize){const h=document.getElementById("hubtel-iframe-element");h&&(h.style.height=l.height+"px"),(m=o?.onResize)===null||m===void 0||m.call(o,l)}};this.messageHandler=n,window.addEventListener("message",n,!1)}destroy(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler,!1),this.messageHandler=null)}renderWebpageInPopup(o,n,c){const a=document.createElement("div");a.classList.add("checkout-modal");const i=document.createElement("div");i.setAttribute("id","checkout-close-icon"),i.innerHTML="&times;",i.classList.add("close-icon"),i.addEventListener("click",()=>{this.closePopUp(),n?.()}),a.appendChild(i);const u=document.createElement("iframe");u.src=o,history.pushState({modalOpen:!0},""),u.classList.add("iframe"),a.appendChild(u),document.body.appendChild(a),a.style.opacity="0",u.addEventListener("load",()=>{a.style.opacity="1",c?.()})}closePopUp(){const o=document.querySelector(".backdrop"),n=document.querySelector(".checkout-modal");o&&document.body.removeChild(o),n&&document.body.removeChild(n),history.replaceState(null,""),window.removeEventListener("popstate",this.closePopUp)}injectStyles(){if(this.stylesInjected)return;const o=document.createElement("style");o.type="text/css",o.setAttribute("data-hubtel-checkout","true"),o.innerHTML=`
2
+ .backdrop {
3
+ position: fixed;
4
+ left: 0;
5
+ top: 0;
6
+ width: 100%;
7
+ height: 100%;
8
+ background-color: rgba(0, 0, 0, 0.5);
9
+ z-index: 999998;
10
+ }
11
+
12
+ .loader {
13
+ position: fixed;
14
+ top: 50%;
15
+ left: 50%;
16
+ transform: translate(-50%, -50%);
17
+ z-index: 999999;
18
+ /* Your loader styles */
19
+ }
20
+
21
+ .checkout-modal {
22
+ position: fixed;
23
+ top: 50%;
24
+ left: 50%;
25
+ transform: translate(-50%, -50%);
26
+ width: 90%;
27
+ height: 90%;
28
+ padding-top: 20px;
29
+ max-width: 480px;
30
+ background-color: #fff;
31
+ border-radius: 10px;
32
+ z-index: 1000000;
33
+ transition: opacity 0.5s ease, transform 0.5s ease;
34
+ opacity: 0;
35
+ }
36
+
37
+ .close-icon {
38
+ position: absolute;
39
+ top: 10px;
40
+ width: 25px;
41
+ height: 25px;
42
+ font-size: 20px;
43
+ right: 10px;
44
+ cursor: pointer;
45
+ color: #fff;
46
+ background-color: #000;
47
+ text-align: center;
48
+ border-radius: 50%;
49
+ }
50
+
51
+ .iframe {
52
+ width: 100%;
53
+ height: calc(100% - 20px);
54
+ border: none;
55
+ }
56
+
57
+ .checkout-loader {
58
+ width: 30px;
59
+ height: 30px;
60
+ border: 3px solid #FFF;
61
+ border-bottom-color: #42b883;
62
+ border-radius: 50%;
63
+ display: inline-block;
64
+ box-sizing: border-box;
65
+ position : fixed;
66
+ top : 50%;
67
+ left : 50%;
68
+ transform : translate(-50%, -50%);
69
+ z-index : 999999;
70
+ animation: rotation 1s linear infinite;
71
+ }
72
+
73
+ @keyframes rotation {
74
+ 0% {
75
+ transform: rotate(0deg);
76
+ }
77
+ 100% {
78
+ transform: rotate(360deg);
79
+ }
80
+ }
81
+
82
+ @media screen and (max-width: 600px) {
83
+ .checkout-modal {
84
+ width: 100%;
85
+ height: 100%;
86
+ border-radius: 0;
87
+ padding-bottom: 0px;
88
+ padding-top: 0px;
89
+ }
90
+ .close-icon{
91
+ top: 10px;
92
+ right: 15px;
93
+ }
94
+
95
+ .iframe {
96
+
97
+ height: 100%;
98
+
99
+ }
100
+ }
101
+ `,document.head.appendChild(o),this.stylesInjected=!0}}const $=new Map;function M(t,o){const n=$.get(o);if(n)return n;const c=new Promise((a,i)=>{if(document.getElementById(o)){a();return}const u=document.createElement("script");u.id=o,u.src=t,u.async=!0,u.onload=()=>a(),u.onerror=()=>i(new Error(`Failed to load ${o} script`)),document.head.appendChild(u)});return $.set(o,c),c}function F(){return M("https://js.paystack.co/v1/inline.js","paystack-script")}function Ee(){return Promise.resolve()}function j(){return M("https://checkout.flutterwave.com/v3.js","flutterwave-script")}function A(){return M("https://js.stripe.com/v3/","stripe-script")}function z(){return M("https://sdk.monnify.com/plugin/monnify.js","monnify-script")}async function K(t){if(await F(),!window.PaystackPop)throw new Error("Paystack script not loaded");window.PaystackPop.setup({key:t.key,email:t.email,amount:t.amount,currency:t.currency,ref:t.ref,metadata:t.metadata,callback:t.onSuccess,onClose:t.onClose}).openIframe()}async function H(t){const o=new be,n={amount:t.amount,purchaseDescription:t.purchaseDescription,customerPhoneNumber:t.customerPhone||"",clientReference:`hubtel_${Date.now()}`},c={branding:"enabled",callbackUrl:t.callbackUrl||(typeof window<"u"?window.location.href:""),merchantAccount:typeof t.clientId=="string"?parseInt(t.clientId,10):t.clientId,basicAuth:""};o.openModal({purchaseInfo:n,config:c,callBacks:{onPaymentSuccess:a=>{t.onSuccess(a),o.closePopUp()},onPaymentFailure:()=>{t.onClose()},onClose:()=>{t.onClose()}}})}async function q(t){if(await j(),!window.FlutterwaveCheckout)throw new Error("Flutterwave script not loaded");window.FlutterwaveCheckout({public_key:t.public_key,tx_ref:t.tx_ref,amount:t.amount,currency:t.currency,customer:t.customer,payment_options:t.payment_options,customizations:t.customizations,callback:t.callback,onclose:t.onclose})}async function Y(t){if(await A(),!window.Stripe)throw new Error("Stripe.js not loaded");return window.Stripe(t)}async function ke(t){const n=await(await Y(t.publishableKey)).confirmPayment({elements:t.elements,clientSecret:t.clientSecret,redirect:"if_required"});n.error?t.onError({message:n.error.message||"Payment failed"}):n.paymentIntent&&t.onSuccess({paymentIntentId:n.paymentIntent.id,status:n.paymentIntent.status})}async function W(t){if(await z(),!window.MonnifySDK)throw new Error("Monnify SDK not loaded");window.MonnifySDK.initialize({amount:t.amount,currency:t.currency,reference:t.reference,customerName:t.customerName,customerEmail:t.customerEmail,customerMobileNumber:t.customerPhone,apiKey:t.apiKey,contractCode:t.contractCode,paymentDescription:t.paymentDescription||"Payment",isTestMode:t.isTestMode??!1,metadata:t.metadata,onComplete:o=>{o.status==="SUCCESS"?t.onSuccess({transactionReference:o.transactionReference,paymentReference:o.paymentReference,...o}):t.onError?.({message:o.message||"Payment failed"})},onClose:t.onClose})}async function G(t,o){t.onInitiated();try{const n=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phone_number:t.phoneNumber,amount:t.amount,reference:t.reference,description:t.description})});if(!n.ok){const i=(await n.json().catch(()=>({}))).message||"Failed to initiate M-Pesa payment";return t.onError({message:i}),{status:"failed",message:i}}const c=await n.json();return{status:"initiated",message:"Please check your phone and enter your M-Pesa PIN to complete the payment.",transactionId:c.checkout_request_id||c.transaction_id}}catch(n){const c=n instanceof Error?n.message:"Network error";return t.onError({message:c}),{status:"failed",message:c}}}const Pe=["disabled"],we={key:0,class:"reevit-spinner"},Ce={class:"reevit-modal-body"},Se={key:0,class:"reevit-loading-state"},ge={key:1,class:"reevit-error-state"},_e={key:2,class:"reevit-success-state"},Ie={key:1,class:"reevit-method-form-container"},Ne={key:2,class:"reevit-card-info"},Me=["disabled"],Re={key:0,class:"reevit-spinner"},Ve={key:1},Be=e.defineComponent({__name:"ReevitCheckout",props:{publicKey:{},amount:{},currency:{},email:{},phone:{},reference:{},metadata:{},paymentMethods:{},theme:{},isOpen:{type:Boolean},apiBaseUrl:{},initialPaymentIntent:{}},emits:["success","error","close"],setup(t,{emit:o}){const n=t,c=o,{status:a,paymentIntent:i,selectedMethod:u,error:r,isLoading:y,isReady:m,initialize:l,selectMethod:h,handlePspSuccess:E,handlePspError:w,close:R}=U({config:{publicKey:n.publicKey,amount:n.amount,currency:n.currency,email:n.email,phone:n.phone,reference:n.reference,metadata:n.metadata,paymentMethods:n.paymentMethods,initialPaymentIntent:n.initialPaymentIntent},apiBaseUrl:n.apiBaseUrl,onSuccess:d=>c("success",d),onError:d=>c("error",d),onClose:()=>c("close")}),P=e.ref(n.isOpen??!1);e.watch(()=>n.isOpen,d=>{d!==void 0&&(P.value=d)});const I=()=>{P.value=!0,!i.value&&a.value==="idle"&&l()};e.watch([P,i,u],([d,s,p])=>{d&&s&&p&&p==="card"&&S(null)});const C=()=>{P.value=!1,R()},V=d=>{h(d)},S=async d=>{if(!i.value)return;const s=i.value.recommendedPsp;try{if(s==="paystack")await K({key:n.publicKey,email:n.email||"",amount:n.amount,currency:n.currency,ref:i.value.id,onSuccess:p=>E(p),onClose:()=>{}});else if(s==="hubtel")await H({clientId:n.publicKey,purchaseDescription:`Payment for ${n.amount} ${n.currency}`,amount:n.amount,customerPhone:d?.phone||n.phone,customerEmail:n.email,onSuccess:p=>E(p),onClose:()=>{}});else if(s==="flutterwave")await q({public_key:n.publicKey,tx_ref:i.value.id,amount:n.amount,currency:n.currency,customer:{email:n.email||"",phone_number:d?.phone||n.phone},callback:p=>E(p),onclose:()=>{}});else if(s==="monnify")await W({apiKey:i.value.pspPublicKey||n.publicKey,contractCode:n.metadata?.contract_code||n.publicKey,amount:n.amount,currency:n.currency,reference:i.value.reference||i.value.id,customerName:n.metadata?.customer_name||n.email||"",customerEmail:n.email||"",customerPhone:d?.phone||n.phone,metadata:n.metadata,onSuccess:p=>E(p),onClose:()=>{}});else if(s==="mpesa"){const p=`${n.apiBaseUrl||"https://api.reevit.io"}/v1/payments/${i.value.id}/mpesa`;await G({phoneNumber:d?.phone||n.phone||"",amount:n.amount,reference:i.value.reference||i.value.id,description:`Payment ${i.value.reference||""}`,onInitiated:()=>{},onSuccess:k=>E(k),onError:k=>w({code:"MPESA_ERROR",message:k.message})},p)}else w(s==="stripe"?{code:"STRIPE_NOT_IMPLEMENTED",message:"Stripe integration requires custom Elements setup. Please use the React SDK or implement custom Stripe Elements."}:{code:"UNSUPPORTED_PSP",message:`Payment provider "${s}" is not supported in this checkout.`})}catch(p){w({code:"BRIDGE_ERROR",message:p instanceof Error?p.message:"Failed to open payment gateway"})}},B=e.computed(()=>v.createThemeVariables(n.theme||{}));e.watch(P,d=>{d?document.body.style.overflow="hidden":document.body.style.overflow=""}),e.onUnmounted(()=>{document.body.style.overflow=""});const f=e.computed(()=>a.value),N=e.computed(()=>r.value),g=e.computed(()=>u.value),_=e.computed(()=>y.value),x=e.computed(()=>m.value);return(d,s)=>(e.openBlock(),e.createElementBlock("div",{class:"reevit-sdk-container",style:e.normalizeStyle(B.value)},[e.renderSlot(d.$slots,"default",{open:I,isLoading:_.value},()=>[e.createElementVNode("button",{type:"button",class:"reevit-pay-button",onClick:I,disabled:_.value},[_.value?(e.openBlock(),e.createElementBlock("span",we)):e.renderSlot(d.$slots,"button-text",{key:1},()=>[s[1]||(s[1]=e.createTextVNode("Pay Now",-1))])],8,Pe)]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[P.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"reevit-modal-overlay",onClick:e.withModifiers(C,["self"])},[e.createElementVNode("div",{class:e.normalizeClass(["reevit-modal-content",{"reevit-modal--dark":n.theme?.darkMode}])},[e.createElementVNode("button",{class:"reevit-modal-close",onClick:C,"aria-label":"Close"}," × "),s[9]||(s[9]=e.createElementVNode("div",{class:"reevit-modal-header"},[e.createElementVNode("img",{src:"https://i.imgur.com/bzUR5Lm.png",alt:"Reevit",class:"reevit-modal__logo"})],-1)),e.createElementVNode("div",Ce,[f.value==="loading"?(e.openBlock(),e.createElementBlock("div",Se,[...s[2]||(s[2]=[e.createElementVNode("div",{class:"reevit-spinner reevit-spinner--large"},null,-1),e.createElementVNode("p",null,"Initializing payment...",-1)])])):f.value==="failed"&&N.value?(e.openBlock(),e.createElementBlock("div",ge,[s[3]||(s[3]=e.createElementVNode("div",{class:"reevit-error-icon"},"⚠️",-1)),s[4]||(s[4]=e.createElementVNode("h3",null,"Payment Failed",-1)),e.createElementVNode("p",null,e.toDisplayString(N.value.message),1),e.createElementVNode("button",{class:"reevit-retry-btn",onClick:s[0]||(s[0]=p=>e.unref(l)())},"Retry")])):f.value==="success"?(e.openBlock(),e.createElementBlock("div",_e,[s[5]||(s[5]=e.createElementVNode("div",{class:"reevit-success-icon"},"✅",-1)),s[6]||(s[6]=e.createElementVNode("h3",null,"Payment Successful",-1)),s[7]||(s[7]=e.createElementVNode("p",null,"Thank you for your payment.",-1)),e.createElementVNode("button",{class:"reevit-done-btn",onClick:C},"Done")])):x.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[f.value==="ready"||f.value==="method_selected"||f.value==="processing"?(e.openBlock(),e.createBlock(D,{key:0,methods:n.paymentMethods||["card","mobile_money"],selected:g.value,amount:n.amount,currency:n.currency,onSelect:V},null,8,["methods","selected","amount","currency"])):e.createCommentVNode("",!0),(f.value==="method_selected"||f.value==="processing")&&g.value==="mobile_money"?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(L,{"initial-phone":n.phone,loading:f.value==="processing",onSubmit:S},null,8,["initial-phone","loading"])])):e.createCommentVNode("",!0),(f.value==="method_selected"||f.value==="processing")&&g.value==="card"?(e.openBlock(),e.createElementBlock("div",Ne,[s[8]||(s[8]=e.createElementVNode("p",{class:"reevit-info-text"},"You will be redirected to our secure payment partner to complete your card payment.",-1)),e.createElementVNode("button",{class:"reevit-submit-btn",onClick:S,disabled:f.value==="processing"},[f.value==="processing"?(e.openBlock(),e.createElementBlock("span",Re)):(e.openBlock(),e.createElementBlock("span",Ve,"Proceed to Card Payment"))],8,Me)])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]),s[10]||(s[10]=e.createElementVNode("div",{class:"reevit-modal-footer"},[e.createElementVNode("div",{class:"reevit-trust-badges"},[e.createElementVNode("span",null,"PCI DSS Compliant"),e.createElementVNode("span",null,"•"),e.createElementVNode("span",null,"SSL Secure")])],-1))],2)])):e.createCommentVNode("",!0)]))],4))}});Object.defineProperty(exports,"ReevitAPIClient",{enumerable:!0,get:()=>v.ReevitAPIClient});Object.defineProperty(exports,"cn",{enumerable:!0,get:()=>v.cn});Object.defineProperty(exports,"createReevitClient",{enumerable:!0,get:()=>v.createReevitClient});Object.defineProperty(exports,"detectCountryFromCurrency",{enumerable:!0,get:()=>v.detectCountryFromCurrency});Object.defineProperty(exports,"detectNetwork",{enumerable:!0,get:()=>v.detectNetwork});Object.defineProperty(exports,"formatAmount",{enumerable:!0,get:()=>v.formatAmount});Object.defineProperty(exports,"formatPhone",{enumerable:!0,get:()=>v.formatPhone});Object.defineProperty(exports,"validatePhone",{enumerable:!0,get:()=>v.validatePhone});exports.MobileMoneyForm=L;exports.PaymentMethodSelector=D;exports.ReevitCheckout=Be;exports.confirmStripePayment=ke;exports.createStripeInstance=Y;exports.initiateMPesaSTKPush=G;exports.loadFlutterwaveScript=j;exports.loadHubtelScript=Ee;exports.loadMonnifyScript=z;exports.loadPaystackScript=F;exports.loadStripeScript=A;exports.openFlutterwaveModal=q;exports.openHubtelPopup=H;exports.openMonnifyModal=W;exports.openPaystackPopup=K;exports.useReevit=U;