@reevit/vue 0.3.6 → 0.3.7
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.
- package/dist/bridges/index.d.ts +0 -1
- package/dist/bridges/loaders.d.ts +1 -1
- package/dist/components/MobileMoneyForm.vue.d.ts +0 -1
- package/dist/components/PaymentMethodSelector.vue.d.ts +0 -1
- package/dist/components/ReevitCheckout.vue.d.ts +0 -1
- package/dist/composables/index.d.ts +0 -1
- package/dist/composables/useReevit.d.ts +10 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +227 -224
- package/package.json +2 -2
- package/dist/bridges/index.d.ts.map +0 -1
- package/dist/bridges/loaders.d.ts.map +0 -1
- package/dist/components/MobileMoneyForm.vue.d.ts.map +0 -1
- package/dist/components/PaymentMethodSelector.vue.d.ts.map +0 -1
- package/dist/components/ReevitCheckout.vue.d.ts.map +0 -1
- package/dist/composables/index.d.ts.map +0 -1
- package/dist/composables/useReevit.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
package/dist/bridges/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
1
|
export { loadPaystackScript, loadHubtelScript, loadFlutterwaveScript, loadStripeScript, loadMonnifyScript, openPaystackPopup, openHubtelPopup, openFlutterwaveModal, createStripeInstance, confirmStripePayment, openMonnifyModal, initiateMPesaSTKPush, type PaystackConfig, type HubtelConfig, type FlutterwaveConfig, type StripeConfig, type MonnifyConfig, type MPesaConfig, type MPesaSTKPushResult, } from './loaders';
|
|
2
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -102,6 +102,7 @@ export interface HubtelConfig {
|
|
|
102
102
|
callbackUrl?: string;
|
|
103
103
|
customerPhone?: string;
|
|
104
104
|
customerEmail?: string;
|
|
105
|
+
basicAuth?: string;
|
|
105
106
|
onSuccess: (response: Record<string, unknown>) => void;
|
|
106
107
|
onClose: () => void;
|
|
107
108
|
}
|
|
@@ -222,4 +223,3 @@ export interface MPesaSTKPushResult {
|
|
|
222
223
|
*/
|
|
223
224
|
export declare function initiateMPesaSTKPush(config: MPesaConfig, apiEndpoint: string): Promise<MPesaSTKPushResult>;
|
|
224
225
|
export {};
|
|
225
|
-
//# sourceMappingURL=loaders.d.ts.map
|
|
@@ -9,4 +9,3 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
9
9
|
onSubmit?: ((data: MobileMoneyFormData) => any) | undefined;
|
|
10
10
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLFormElement>;
|
|
11
11
|
export default _default;
|
|
12
|
-
//# sourceMappingURL=MobileMoneyForm.vue.d.ts.map
|
|
@@ -11,4 +11,3 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
11
11
|
onSelect?: ((method: PaymentMethod) => any) | undefined;
|
|
12
12
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
13
13
|
export default _default;
|
|
14
|
-
//# sourceMappingURL=PaymentMethodSelector.vue.d.ts.map
|
|
@@ -13,6 +13,11 @@ export declare function useReevit(options: UseReevitOptions): {
|
|
|
13
13
|
readonly id: string;
|
|
14
14
|
readonly clientSecret: string;
|
|
15
15
|
readonly pspPublicKey?: string | undefined;
|
|
16
|
+
readonly pspCredentials?: {
|
|
17
|
+
readonly [x: string]: Readonly<unknown>;
|
|
18
|
+
readonly merchantAccount?: string | number | undefined;
|
|
19
|
+
readonly basicAuth?: string | undefined;
|
|
20
|
+
} | undefined;
|
|
16
21
|
readonly amount: number;
|
|
17
22
|
readonly currency: string;
|
|
18
23
|
readonly status: "pending" | "processing" | "succeeded" | "failed" | "cancelled";
|
|
@@ -31,6 +36,11 @@ export declare function useReevit(options: UseReevitOptions): {
|
|
|
31
36
|
readonly id: string;
|
|
32
37
|
readonly clientSecret: string;
|
|
33
38
|
readonly pspPublicKey?: string | undefined;
|
|
39
|
+
readonly pspCredentials?: {
|
|
40
|
+
readonly [x: string]: Readonly<unknown>;
|
|
41
|
+
readonly merchantAccount?: string | number | undefined;
|
|
42
|
+
readonly basicAuth?: string | undefined;
|
|
43
|
+
} | undefined;
|
|
34
44
|
readonly amount: number;
|
|
35
45
|
readonly currency: string;
|
|
36
46
|
readonly status: "pending" | "processing" | "succeeded" | "failed" | "cancelled";
|
|
@@ -108,4 +118,3 @@ export declare function useReevit(options: UseReevitOptions): {
|
|
|
108
118
|
canRetry: Readonly<import('vue').Ref<boolean, boolean>>;
|
|
109
119
|
};
|
|
110
120
|
export {};
|
|
111
|
-
//# sourceMappingURL=useReevit.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,3 @@ export { useReevit } from './composables';
|
|
|
5
5
|
export type { PaymentMethod, MobileMoneyNetwork, ReevitCheckoutConfig, ReevitCheckoutCallbacks, CheckoutState, PaymentResult, PaymentError, ReevitTheme, MobileMoneyFormData, PaymentIntent, PSPType, PaymentSource, } from '../../core/src/index.ts';
|
|
6
6
|
export { formatAmount, validatePhone, detectNetwork, formatPhone, detectCountryFromCurrency, cn, ReevitAPIClient, createReevitClient, } from '../../core/src/index.ts';
|
|
7
7
|
export { loadPaystackScript, loadHubtelScript, loadFlutterwaveScript, loadStripeScript, loadMonnifyScript, openPaystackPopup, openHubtelPopup, openFlutterwaveModal, createStripeInstance, confirmStripePayment, openMonnifyModal, initiateMPesaSTKPush, type PaystackConfig, type HubtelConfig, type FlutterwaveConfig, type StripeConfig, type MonnifyConfig, type MPesaConfig, type MPesaSTKPushResult, } from './bridges';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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="×",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=`
|
|
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,pspCredentials:t.psp_credentials,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:l,onClose:a,onStateChange:u,apiBaseUrl:d}=t,r=e.ref(v.createInitialState());if(o.initialPaymentIntent){const c=o.initialPaymentIntent;r.value={...r.value,status:"ready",paymentIntent:c,selectedMethod:c.availableMethods?.length===1?c.availableMethods[0]:null}}const y=new v.ReevitAPIClient({publicKey:o.publicKey,baseUrl:d}),m=c=>{r.value=v.reevitReducer(r.value,c)};e.watch(()=>r.value.status,c=>{u?.(c)});const i=async c=>{m({type:"INIT_START"});try{const s=o.reference||v.generateReference(),p=v.detectCountryFromCurrency(o.currency),f=c||o.paymentMethods?.[0]||"card",{data:E,error:T}=await y.createPaymentIntent({...o,reference:s},f,p);if(T){m({type:"INIT_ERROR",payload:T}),l?.(T);return}if(!E){const O={code:"INIT_FAILED",message:"No data received from API",recoverable:!0};m({type:"INIT_ERROR",payload:O}),l?.(O);return}const J=X(E,{...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}),l?.(p)}},h=c=>{m({type:"SELECT_METHOD",payload:c})},k=async c=>{if(!(!r.value.paymentIntent||!r.value.selectedMethod)){m({type:"PROCESS_START"});try{let s;if(r.value.paymentIntent.clientSecret){const{data:f,error:E}=await y.confirmPaymentIntent(r.value.paymentIntent.id,r.value.paymentIntent.clientSecret);if(E){m({type:"PROCESS_ERROR",payload:E}),l?.(E);return}s=f}else{const{data:f,error:E}=await y.confirmPayment(r.value.paymentIntent.id);if(E){m({type:"PROCESS_ERROR",payload:E}),l?.(E);return}s=f}const p={paymentId:r.value.paymentIntent.id,reference:c.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:c.pspReference||s?.provider_ref_id||"",status:"success",metadata:c};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}),l?.(p)}}},w=async c=>{await k(c)},R=c=>{m({type:"PROCESS_ERROR",payload:c}),l?.(c)},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),b=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(b),initialize:i,selectMethod:h,processPayment:k,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,l=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(u=>n.methods.includes(u.id)));return(u,d)=>(e.openBlock(),e.createElementBlock("div",Z,[d[0]||(d[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=>l("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,l=o,a=e.ref(n.initialPhone||""),u=e.ref(null),d=e.ref(null);e.watch(a,m=>{const i=v.detectNetwork(m);i&&(u.value=i),d.value&&(d.value=null)});const r=()=>{if(!v.validatePhone(a.value)){d.value="Please enter a valid phone number";return}if(!u.value){d.value="Please select your mobile network";return}l("submit",{phone:a.value,network:u.value})},y=[{id:"mtn",name:"MTN",color:"#FFCC00"},{id:"vodafone",name:"Vodafone",color:"#E60000"},{id:"airteltigo",name:"AirtelTigo",color:"#005596"}];return(m,i)=>(e.openBlock(),e.createElementBlock("form",{class:"reevit-momo-form",onSubmit:e.withModifiers(r,["prevent"])},[e.createElementVNode("div",ce,[i[1]||(i[1]=e.createElementVNode("label",{class:"reevit-label",for:"reevit-phone"},"Phone Number",-1)),e.withDirectives(e.createElementVNode("input",{id:"reevit-phone","onUpdate:modelValue":i[0]||(i[0]=h=>a.value=h),type:"tel",class:e.normalizeClass(["reevit-input",{"reevit-input--error":d.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,[i[2]||(i[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",u.value===h.id&&"reevit-network-btn--selected")),onClick:k=>u.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))])]),d.value?(e.openBlock(),e.createElementBlock("p",ye,e.toDisplayString(d.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),i[3]||(i[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 l=this.createCheckoutUrl(o,n),a=window.open(l);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:l,iframeStyle:a}){var u,d,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 i=document.createElement("iframe");i.setAttribute("id","hubtel-iframe-element"),i.src=this.createCheckoutUrl(o,l),i.style.display="none",i.style.width=(u=a?.width)!==null&&u!==void 0?u:"100%",i.style.height=(d=a?.height)!==null&&d!==void 0?d:"100%",i.style.minHeight=a?.minHeight||"400px",i.style.border=(r=a?.border)!==null&&r!==void 0?r:"none",i.onload=()=>{var h;y.removeChild(m),i.style.display="block",(h=n.onLoad)===null||h===void 0||h.call(n)},y.appendChild(i)}openModal({purchaseInfo:o,callBacks:n,config:l}){this.injectStyles(),this.createIframe(),this.handleBackButton(),this.registerEvents(n),this.renderWebpageInPopup(this.createCheckoutUrl(o,l),n.onClose,n.onLoad)}createCheckoutUrl(o,n){const l=Object.assign(Object.assign({},o),n),a=Object.keys(l).reduce((m,i)=>(l[i]!==null&&l[i]!==void 0&&(m[i]=l[i]),m),{}),u=Object.keys(a).map(m=>`${m}=${encodeURIComponent(a[m])}`).join("&"),d=this.encodeBase64(u),r=encodeURIComponent(d);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=l=>{var a,u,d,r,y,m;if(l.origin!==this.baseUrl)return;const{data:i}=l;if(i.success===!0)(a=o.onPaymentSuccess)===null||a===void 0||a.call(o,i);else if(i.success===!1)(u=o.onPaymentFailure)===null||u===void 0||u.call(o,i);else if(i.initialized)(d=o.init)===null||d===void 0||d.call(o,i),(r=o.onInit)===null||r===void 0||r.call(o,i);else if(i.feesChanged)(y=o.onFeesChanged)===null||y===void 0||y.call(o,i.fees);else if(i.resize){const h=document.getElementById("hubtel-iframe-element");h&&(h.style.height=i.height+"px"),(m=o?.onResize)===null||m===void 0||m.call(o,i)}};this.messageHandler=n,window.addEventListener("message",n,!1)}destroy(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler,!1),this.messageHandler=null)}renderWebpageInPopup(o,n,l){const a=document.createElement("div");a.classList.add("checkout-modal");const u=document.createElement("div");u.setAttribute("id","checkout-close-icon"),u.innerHTML="×",u.classList.add("close-icon"),u.addEventListener("click",()=>{this.closePopUp(),n?.()}),a.appendChild(u);const d=document.createElement("iframe");d.src=o,history.pushState({modalOpen:!0},""),d.classList.add("iframe"),a.appendChild(d),document.body.appendChild(a),a.style.opacity="0",d.addEventListener("load",()=>{a.style.opacity="1",l?.()})}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
2
|
.backdrop {
|
|
3
3
|
position: fixed;
|
|
4
4
|
left: 0;
|
|
@@ -98,4 +98,4 @@
|
|
|
98
98
|
|
|
99
99
|
}
|
|
100
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;
|
|
101
|
+
`,document.head.appendChild(o),this.stylesInjected=!0}}const $=new Map;function M(t,o){const n=$.get(o);if(n)return n;const l=new Promise((a,u)=>{if(document.getElementById(o)){a();return}const d=document.createElement("script");d.id=o,d.src=t,d.async=!0,d.onload=()=>a(),d.onerror=()=>u(new Error(`Failed to load ${o} script`)),document.head.appendChild(d)});return $.set(o,l),l}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()}`},l={branding:"enabled",callbackUrl:t.callbackUrl||(typeof window<"u"?window.location.href:""),merchantAccount:typeof t.clientId=="string"?parseInt(t.clientId,10):t.clientId,basicAuth:t.basicAuth||""};o.openModal({purchaseInfo:n,config:l,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 u=(await n.json().catch(()=>({}))).message||"Failed to initiate M-Pesa payment";return t.onError({message:u}),{status:"failed",message:u}}const l=await n.json();return{status:"initiated",message:"Please check your phone and enter your M-Pesa PIN to complete the payment.",transactionId:l.checkout_request_id||l.transaction_id}}catch(n){const l=n instanceof Error?n.message:"Network error";return t.onError({message:l}),{status:"failed",message:l}}}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,l=o,{status:a,paymentIntent:u,selectedMethod:d,error:r,isLoading:y,isReady:m,initialize:i,selectMethod:h,handlePspSuccess:k,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:c=>l("success",c),onError:c=>l("error",c),onClose:()=>l("close")}),P=e.ref(n.isOpen??!1);e.watch(()=>n.isOpen,c=>{c!==void 0&&(P.value=c)});const I=()=>{P.value=!0,!u.value&&a.value==="idle"&&i()};e.watch([P,u,d],([c,s,p])=>{c&&s&&p&&p==="card"&&S(null)});const C=()=>{P.value=!1,R()},V=c=>{h(c)},S=async c=>{const s=u.value;if(!s)return;const p=s.recommendedPsp;try{if(p==="paystack")await K({key:n.publicKey,email:n.email||"",amount:n.amount,currency:n.currency,ref:s.id,onSuccess:f=>k(f),onClose:()=>{}});else if(p==="hubtel")await H({clientId:s.pspCredentials?.merchantAccount||n.publicKey,purchaseDescription:`Payment for ${n.amount} ${n.currency}`,amount:n.amount,customerPhone:c?.phone||n.phone,customerEmail:n.email,basicAuth:s.pspCredentials?.basicAuth,onSuccess:f=>k(f),onClose:()=>{}});else if(p==="flutterwave")await q({public_key:n.publicKey,tx_ref:s.id,amount:n.amount,currency:n.currency,customer:{email:n.email||"",phone_number:c?.phone||n.phone},callback:f=>k(f),onclose:()=>{}});else if(p==="monnify")await W({apiKey:s.pspPublicKey||n.publicKey,contractCode:n.metadata?.contract_code||n.publicKey,amount:n.amount,currency:n.currency,reference:s.reference||s.id,customerName:n.metadata?.customer_name||n.email||"",customerEmail:n.email||"",customerPhone:c?.phone||n.phone,metadata:n.metadata,onSuccess:f=>k(f),onClose:()=>{}});else if(p==="mpesa"){const f=`${n.apiBaseUrl||"https://api.reevit.io"}/v1/payments/${s.id}/mpesa`;await G({phoneNumber:c?.phone||n.phone||"",amount:n.amount,reference:s.reference||s.id,description:`Payment ${s.reference||""}`,onInitiated:()=>{},onSuccess:E=>k(E),onError:E=>w({code:"MPESA_ERROR",message:E.message})},f)}else w(p==="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 "${p}" is not supported in this checkout.`})}catch(f){w({code:"BRIDGE_ERROR",message:f instanceof Error?f.message:"Failed to open payment gateway"})}},B=e.computed(()=>v.createThemeVariables(n.theme||{}));e.watch(P,c=>{c?document.body.style.overflow="hidden":document.body.style.overflow=""}),e.onUnmounted(()=>{document.body.style.overflow=""});const b=e.computed(()=>a.value),N=e.computed(()=>r.value),g=e.computed(()=>d.value),_=e.computed(()=>y.value),x=e.computed(()=>m.value);return(c,s)=>(e.openBlock(),e.createElementBlock("div",{class:"reevit-sdk-container",style:e.normalizeStyle(B.value)},[e.renderSlot(c.$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(c.$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,[b.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)])])):b.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(i)())},"Retry")])):b.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},[b.value==="ready"||b.value==="method_selected"||b.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),(b.value==="method_selected"||b.value==="processing")&&g.value==="mobile_money"?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(L,{"initial-phone":n.phone,loading:b.value==="processing",onSubmit:S},null,8,["initial-phone","loading"])])):e.createCommentVNode("",!0),(b.value==="method_selected"||b.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:b.value==="processing"},[b.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;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as $, watch as N, computed as
|
|
1
|
+
import { ref as $, watch as N, computed as w, readonly as _, defineComponent as V, createElementBlock as h, openBlock as y, createElementVNode as c, toDisplayString as S, unref as U, Fragment as q, renderList as Q, normalizeClass as A, createCommentVNode as I, withModifiers as X, withDirectives as oe, vModelText as ae, createTextVNode as Z, normalizeStyle as ee, onUnmounted as re, renderSlot as Y, createBlock as W, Teleport as se, createVNode as ie } from "vue";
|
|
2
2
|
import { createInitialState as le, ReevitAPIClient as ce, generateReference as de, detectCountryFromCurrency as ue, reevitReducer as me, formatAmount as pe, cn as te, detectNetwork as ye, validatePhone as G, createThemeVariables as ve } from "@reevit/core";
|
|
3
3
|
import { ReevitAPIClient as vt, cn as ht, createReevitClient as ft, detectCountryFromCurrency as bt, detectNetwork as wt, formatAmount as Pt, formatPhone as kt, validatePhone as Ct } from "@reevit/core";
|
|
4
4
|
function he(e) {
|
|
@@ -10,6 +10,7 @@ function fe(e, n) {
|
|
|
10
10
|
id: e.id,
|
|
11
11
|
clientSecret: e.client_secret,
|
|
12
12
|
pspPublicKey: e.psp_public_key,
|
|
13
|
+
pspCredentials: e.psp_credentials,
|
|
13
14
|
amount: e.amount,
|
|
14
15
|
currency: e.currency,
|
|
15
16
|
status: e.status,
|
|
@@ -25,50 +26,50 @@ function fe(e, n) {
|
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
function be(e) {
|
|
28
|
-
const { config: n, onSuccess: t, onError:
|
|
29
|
+
const { config: n, onSuccess: t, onError: i, onClose: a, onStateChange: u, apiBaseUrl: d } = e, o = $(le());
|
|
29
30
|
if (n.initialPaymentIntent) {
|
|
30
|
-
const
|
|
31
|
+
const l = n.initialPaymentIntent;
|
|
31
32
|
o.value = {
|
|
32
33
|
...o.value,
|
|
33
34
|
status: "ready",
|
|
34
|
-
paymentIntent:
|
|
35
|
-
selectedMethod:
|
|
35
|
+
paymentIntent: l,
|
|
36
|
+
selectedMethod: l.availableMethods?.length === 1 ? l.availableMethods[0] : null
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
const v = new ce({
|
|
39
40
|
publicKey: n.publicKey,
|
|
40
|
-
baseUrl:
|
|
41
|
-
}), m = (
|
|
42
|
-
o.value = me(o.value,
|
|
41
|
+
baseUrl: d
|
|
42
|
+
}), m = (l) => {
|
|
43
|
+
o.value = me(o.value, l);
|
|
43
44
|
};
|
|
44
45
|
N(
|
|
45
46
|
() => o.value.status,
|
|
46
|
-
(
|
|
47
|
-
|
|
47
|
+
(l) => {
|
|
48
|
+
u?.(l);
|
|
48
49
|
}
|
|
49
50
|
);
|
|
50
|
-
const
|
|
51
|
+
const s = async (l) => {
|
|
51
52
|
m({ type: "INIT_START" });
|
|
52
53
|
try {
|
|
53
|
-
const r = n.reference || de(), p = ue(n.currency),
|
|
54
|
+
const r = n.reference || de(), p = ue(n.currency), b = l || n.paymentMethods?.[0] || "card", { data: k, error: H } = await v.createPaymentIntent(
|
|
54
55
|
{ ...n, reference: r },
|
|
55
|
-
|
|
56
|
+
b,
|
|
56
57
|
p
|
|
57
58
|
);
|
|
58
59
|
if (H) {
|
|
59
|
-
m({ type: "INIT_ERROR", payload: H }),
|
|
60
|
+
m({ type: "INIT_ERROR", payload: H }), i?.(H);
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
if (!
|
|
63
|
+
if (!k) {
|
|
63
64
|
const B = {
|
|
64
65
|
code: "INIT_FAILED",
|
|
65
66
|
message: "No data received from API",
|
|
66
67
|
recoverable: !0
|
|
67
68
|
};
|
|
68
|
-
m({ type: "INIT_ERROR", payload: B }),
|
|
69
|
+
m({ type: "INIT_ERROR", payload: B }), i?.(B);
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
|
-
const ne = fe(
|
|
72
|
+
const ne = fe(k, { ...n, reference: r });
|
|
72
73
|
m({ type: "INIT_SUCCESS", payload: ne });
|
|
73
74
|
} catch (r) {
|
|
74
75
|
const p = {
|
|
@@ -77,43 +78,43 @@ function be(e) {
|
|
|
77
78
|
recoverable: !0,
|
|
78
79
|
originalError: r
|
|
79
80
|
};
|
|
80
|
-
m({ type: "INIT_ERROR", payload: p }),
|
|
81
|
+
m({ type: "INIT_ERROR", payload: p }), i?.(p);
|
|
81
82
|
}
|
|
82
|
-
}, f = (
|
|
83
|
-
m({ type: "SELECT_METHOD", payload:
|
|
84
|
-
},
|
|
83
|
+
}, f = (l) => {
|
|
84
|
+
m({ type: "SELECT_METHOD", payload: l });
|
|
85
|
+
}, C = async (l) => {
|
|
85
86
|
if (!(!o.value.paymentIntent || !o.value.selectedMethod)) {
|
|
86
87
|
m({ type: "PROCESS_START" });
|
|
87
88
|
try {
|
|
88
89
|
let r;
|
|
89
90
|
if (o.value.paymentIntent.clientSecret) {
|
|
90
|
-
const { data:
|
|
91
|
+
const { data: b, error: k } = await v.confirmPaymentIntent(
|
|
91
92
|
o.value.paymentIntent.id,
|
|
92
93
|
o.value.paymentIntent.clientSecret
|
|
93
94
|
);
|
|
94
|
-
if (
|
|
95
|
-
m({ type: "PROCESS_ERROR", payload:
|
|
95
|
+
if (k) {
|
|
96
|
+
m({ type: "PROCESS_ERROR", payload: k }), i?.(k);
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
98
|
-
r =
|
|
99
|
+
r = b;
|
|
99
100
|
} else {
|
|
100
|
-
const { data:
|
|
101
|
-
if (
|
|
102
|
-
m({ type: "PROCESS_ERROR", payload:
|
|
101
|
+
const { data: b, error: k } = await v.confirmPayment(o.value.paymentIntent.id);
|
|
102
|
+
if (k) {
|
|
103
|
+
m({ type: "PROCESS_ERROR", payload: k }), i?.(k);
|
|
103
104
|
return;
|
|
104
105
|
}
|
|
105
|
-
r =
|
|
106
|
+
r = b;
|
|
106
107
|
}
|
|
107
108
|
const p = {
|
|
108
109
|
paymentId: o.value.paymentIntent.id,
|
|
109
|
-
reference:
|
|
110
|
+
reference: l.reference || o.value.paymentIntent.reference || o.value.paymentIntent.metadata?.reference || "",
|
|
110
111
|
amount: o.value.paymentIntent.amount,
|
|
111
112
|
currency: o.value.paymentIntent.currency,
|
|
112
113
|
paymentMethod: o.value.selectedMethod,
|
|
113
114
|
psp: o.value.paymentIntent.recommendedPsp,
|
|
114
|
-
pspReference:
|
|
115
|
+
pspReference: l.pspReference || r?.provider_ref_id || "",
|
|
115
116
|
status: "success",
|
|
116
|
-
metadata:
|
|
117
|
+
metadata: l
|
|
117
118
|
};
|
|
118
119
|
m({ type: "PROCESS_SUCCESS", payload: p }), t?.(p);
|
|
119
120
|
} catch (r) {
|
|
@@ -123,13 +124,13 @@ function be(e) {
|
|
|
123
124
|
recoverable: !0,
|
|
124
125
|
originalError: r
|
|
125
126
|
};
|
|
126
|
-
m({ type: "PROCESS_ERROR", payload: p }),
|
|
127
|
+
m({ type: "PROCESS_ERROR", payload: p }), i?.(p);
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
|
-
}, g = async (
|
|
130
|
-
await
|
|
131
|
-
},
|
|
132
|
-
m({ type: "PROCESS_ERROR", payload:
|
|
130
|
+
}, g = async (l) => {
|
|
131
|
+
await C(l);
|
|
132
|
+
}, F = (l) => {
|
|
133
|
+
m({ type: "PROCESS_ERROR", payload: l }), i?.(l);
|
|
133
134
|
}, E = () => {
|
|
134
135
|
m({ type: "RESET" });
|
|
135
136
|
}, L = async () => {
|
|
@@ -139,24 +140,24 @@ function be(e) {
|
|
|
139
140
|
} catch {
|
|
140
141
|
}
|
|
141
142
|
m({ type: "CLOSE" }), a?.();
|
|
142
|
-
}, R =
|
|
143
|
+
}, R = w(() => o.value.status), K = w(() => o.value.paymentIntent), M = w(() => o.value.selectedMethod), j = w(() => o.value.error), P = w(() => o.value.result), O = w(
|
|
143
144
|
() => o.value.status === "loading" || o.value.status === "processing"
|
|
144
|
-
), x =
|
|
145
|
+
), x = w(
|
|
145
146
|
() => o.value.status === "ready" || o.value.status === "method_selected" || o.value.status === "processing"
|
|
146
|
-
), T =
|
|
147
|
+
), T = w(() => o.value.status === "success"), z = w(() => o.value.error?.recoverable ?? !1);
|
|
147
148
|
return {
|
|
148
149
|
// State (readonly refs)
|
|
149
150
|
status: _(R),
|
|
150
151
|
paymentIntent: _(K),
|
|
151
152
|
selectedMethod: _(M),
|
|
152
153
|
error: _(j),
|
|
153
|
-
result: _(
|
|
154
|
+
result: _(P),
|
|
154
155
|
// Actions
|
|
155
|
-
initialize:
|
|
156
|
+
initialize: s,
|
|
156
157
|
selectMethod: f,
|
|
157
|
-
processPayment:
|
|
158
|
+
processPayment: C,
|
|
158
159
|
handlePspSuccess: g,
|
|
159
|
-
handlePspError:
|
|
160
|
+
handlePspError: F,
|
|
160
161
|
reset: E,
|
|
161
162
|
close: L,
|
|
162
163
|
// Computed
|
|
@@ -179,7 +180,7 @@ const we = { class: "reevit-method-selector" }, Pe = { class: "reevit-amount-dis
|
|
|
179
180
|
},
|
|
180
181
|
emits: ["select"],
|
|
181
182
|
setup(e, { emit: n }) {
|
|
182
|
-
const t = e,
|
|
183
|
+
const t = e, i = n, a = w(() => [
|
|
183
184
|
{
|
|
184
185
|
id: "card",
|
|
185
186
|
name: "Card",
|
|
@@ -198,23 +199,23 @@ const we = { class: "reevit-method-selector" }, Pe = { class: "reevit-amount-dis
|
|
|
198
199
|
description: "Transfer directly from your bank",
|
|
199
200
|
icon: "🏦"
|
|
200
201
|
}
|
|
201
|
-
].filter((
|
|
202
|
-
return (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
].filter((u) => t.methods.includes(u.id)));
|
|
203
|
+
return (u, d) => (y(), h("div", we, [
|
|
204
|
+
d[0] || (d[0] = c("h3", { class: "reevit-section-title" }, "Select Payment Method", -1)),
|
|
205
|
+
c("p", Pe, " Pay " + S(U(pe)(e.amount, e.currency)), 1),
|
|
206
|
+
c("div", ke, [
|
|
206
207
|
(y(!0), h(q, null, Q(a.value, (o) => (y(), h("button", {
|
|
207
208
|
key: o.id,
|
|
208
209
|
type: "button",
|
|
209
|
-
class:
|
|
210
|
-
onClick: (v) =>
|
|
210
|
+
class: A(U(te)("reevit-method-card", e.selected === o.id && "reevit-method-card--selected")),
|
|
211
|
+
onClick: (v) => i("select", o.id)
|
|
211
212
|
}, [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
c("span", _e, S(o.icon), 1),
|
|
214
|
+
c("div", Ee, [
|
|
215
|
+
c("span", Ie, S(o.name), 1),
|
|
216
|
+
c("span", Se, S(o.description), 1)
|
|
216
217
|
]),
|
|
217
|
-
|
|
218
|
+
c("div", ge, [
|
|
218
219
|
e.selected === o.id ? (y(), h("div", Re)) : I("", !0)
|
|
219
220
|
])
|
|
220
221
|
], 10, Ce))), 128))
|
|
@@ -224,10 +225,10 @@ const we = { class: "reevit-method-selector" }, Pe = { class: "reevit-amount-dis
|
|
|
224
225
|
}), xe = { class: "reevit-form-group" }, Te = ["disabled"], $e = { class: "reevit-network-selector" }, Ne = { class: "reevit-networks-grid" }, Ue = ["onClick", "disabled"], Le = {
|
|
225
226
|
key: 0,
|
|
226
227
|
class: "reevit-error-message"
|
|
227
|
-
}, Oe = ["disabled"],
|
|
228
|
+
}, Oe = ["disabled"], Ae = {
|
|
228
229
|
key: 0,
|
|
229
230
|
class: "reevit-spinner"
|
|
230
|
-
},
|
|
231
|
+
}, De = { key: 1 }, Fe = /* @__PURE__ */ V({
|
|
231
232
|
__name: "MobileMoneyForm",
|
|
232
233
|
props: {
|
|
233
234
|
initialPhone: {},
|
|
@@ -235,43 +236,43 @@ const we = { class: "reevit-method-selector" }, Pe = { class: "reevit-amount-dis
|
|
|
235
236
|
},
|
|
236
237
|
emits: ["submit"],
|
|
237
238
|
setup(e, { emit: n }) {
|
|
238
|
-
const t = e,
|
|
239
|
+
const t = e, i = n, a = $(t.initialPhone || ""), u = $(null), d = $(null);
|
|
239
240
|
N(a, (m) => {
|
|
240
|
-
const
|
|
241
|
-
|
|
241
|
+
const s = ye(m);
|
|
242
|
+
s && (u.value = s), d.value && (d.value = null);
|
|
242
243
|
});
|
|
243
244
|
const o = () => {
|
|
244
245
|
if (!G(a.value)) {
|
|
245
|
-
|
|
246
|
+
d.value = "Please enter a valid phone number";
|
|
246
247
|
return;
|
|
247
248
|
}
|
|
248
|
-
if (!
|
|
249
|
-
|
|
249
|
+
if (!u.value) {
|
|
250
|
+
d.value = "Please select your mobile network";
|
|
250
251
|
return;
|
|
251
252
|
}
|
|
252
|
-
|
|
253
|
+
i("submit", {
|
|
253
254
|
phone: a.value,
|
|
254
|
-
network:
|
|
255
|
+
network: u.value
|
|
255
256
|
});
|
|
256
257
|
}, v = [
|
|
257
258
|
{ id: "mtn", name: "MTN", color: "#FFCC00" },
|
|
258
259
|
{ id: "vodafone", name: "Vodafone", color: "#E60000" },
|
|
259
260
|
{ id: "airteltigo", name: "AirtelTigo", color: "#005596" }
|
|
260
261
|
];
|
|
261
|
-
return (m,
|
|
262
|
+
return (m, s) => (y(), h("form", {
|
|
262
263
|
class: "reevit-momo-form",
|
|
263
264
|
onSubmit: X(o, ["prevent"])
|
|
264
265
|
}, [
|
|
265
|
-
|
|
266
|
-
|
|
266
|
+
c("div", xe, [
|
|
267
|
+
s[1] || (s[1] = c("label", {
|
|
267
268
|
class: "reevit-label",
|
|
268
269
|
for: "reevit-phone"
|
|
269
270
|
}, "Phone Number", -1)),
|
|
270
|
-
oe(
|
|
271
|
+
oe(c("input", {
|
|
271
272
|
id: "reevit-phone",
|
|
272
|
-
"onUpdate:modelValue":
|
|
273
|
+
"onUpdate:modelValue": s[0] || (s[0] = (f) => a.value = f),
|
|
273
274
|
type: "tel",
|
|
274
|
-
class:
|
|
275
|
+
class: A(["reevit-input", { "reevit-input--error": d.value && !U(G)(a.value) }]),
|
|
275
276
|
placeholder: "e.g. 024 123 4567",
|
|
276
277
|
disabled: e.loading,
|
|
277
278
|
autocomplete: "tel"
|
|
@@ -279,17 +280,17 @@ const we = { class: "reevit-method-selector" }, Pe = { class: "reevit-amount-dis
|
|
|
279
280
|
[ae, a.value]
|
|
280
281
|
])
|
|
281
282
|
]),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
(y(), h(q, null, Q(v, (f) =>
|
|
283
|
+
c("div", $e, [
|
|
284
|
+
s[2] || (s[2] = c("label", { class: "reevit-label" }, "Select Network", -1)),
|
|
285
|
+
c("div", Ne, [
|
|
286
|
+
(y(), h(q, null, Q(v, (f) => c("button", {
|
|
286
287
|
key: f.id,
|
|
287
288
|
type: "button",
|
|
288
|
-
class:
|
|
289
|
-
onClick: (
|
|
289
|
+
class: A(U(te)("reevit-network-btn", u.value === f.id && "reevit-network-btn--selected")),
|
|
290
|
+
onClick: (C) => u.value = f.id,
|
|
290
291
|
disabled: e.loading
|
|
291
292
|
}, [
|
|
292
|
-
|
|
293
|
+
c("div", {
|
|
293
294
|
class: "reevit-network-dot",
|
|
294
295
|
style: ee({ backgroundColor: f.color })
|
|
295
296
|
}, null, 4),
|
|
@@ -297,15 +298,15 @@ const we = { class: "reevit-method-selector" }, Pe = { class: "reevit-amount-dis
|
|
|
297
298
|
], 10, Ue)), 64))
|
|
298
299
|
])
|
|
299
300
|
]),
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
d.value ? (y(), h("p", Le, S(d.value), 1)) : I("", !0),
|
|
302
|
+
c("button", {
|
|
302
303
|
type: "submit",
|
|
303
304
|
class: "reevit-submit-btn",
|
|
304
305
|
disabled: e.loading || !a.value
|
|
305
306
|
}, [
|
|
306
|
-
e.loading ? (y(), h("span",
|
|
307
|
+
e.loading ? (y(), h("span", Ae)) : (y(), h("span", De, "Continue"))
|
|
307
308
|
], 8, Oe),
|
|
308
|
-
|
|
309
|
+
s[3] || (s[3] = c("p", { class: "reevit-secure-text" }, " 🔒 Secure mobile money payment via Reevit ", -1))
|
|
309
310
|
], 32));
|
|
310
311
|
}
|
|
311
312
|
});
|
|
@@ -320,7 +321,7 @@ class Ke {
|
|
|
320
321
|
* @throws {Error} If the popup is blocked by the browser.
|
|
321
322
|
*/
|
|
322
323
|
redirect({ purchaseInfo: n, config: t }) {
|
|
323
|
-
const
|
|
324
|
+
const i = this.createCheckoutUrl(n, t), a = window.open(i);
|
|
324
325
|
if (!a || a.closed || typeof a.closed > "u")
|
|
325
326
|
throw new Error("Popup was blocked by the browser. Please allow popups for this site.");
|
|
326
327
|
}
|
|
@@ -333,8 +334,8 @@ class Ke {
|
|
|
333
334
|
* @param iframeStyle - The style options for the iframe (optional).
|
|
334
335
|
* @throws {Error} If the container element with id "hubtel-checkout-iframe" is not found.
|
|
335
336
|
*/
|
|
336
|
-
initIframe({ purchaseInfo: n, callBacks: t, config:
|
|
337
|
-
var
|
|
337
|
+
initIframe({ purchaseInfo: n, callBacks: t, config: i, iframeStyle: a }) {
|
|
338
|
+
var u, d, o;
|
|
338
339
|
this.registerEvents(t);
|
|
339
340
|
const v = document.getElementById("hubtel-checkout-iframe");
|
|
340
341
|
if (!v)
|
|
@@ -342,17 +343,17 @@ class Ke {
|
|
|
342
343
|
v.innerHTML = "";
|
|
343
344
|
const m = document.createElement("div");
|
|
344
345
|
m.textContent = "Loading...", v.appendChild(m);
|
|
345
|
-
const
|
|
346
|
-
|
|
346
|
+
const s = document.createElement("iframe");
|
|
347
|
+
s.setAttribute("id", "hubtel-iframe-element"), s.src = this.createCheckoutUrl(n, i), s.style.display = "none", s.style.width = (u = a?.width) !== null && u !== void 0 ? u : "100%", s.style.height = (d = a?.height) !== null && d !== void 0 ? d : "100%", s.style.minHeight = a?.minHeight || "400px", s.style.border = (o = a?.border) !== null && o !== void 0 ? o : "none", s.onload = () => {
|
|
347
348
|
var f;
|
|
348
|
-
v.removeChild(m),
|
|
349
|
-
}, v.appendChild(
|
|
349
|
+
v.removeChild(m), s.style.display = "block", (f = t.onLoad) === null || f === void 0 || f.call(t);
|
|
350
|
+
}, v.appendChild(s);
|
|
350
351
|
}
|
|
351
|
-
openModal({ purchaseInfo: n, callBacks: t, config:
|
|
352
|
-
this.injectStyles(), this.createIframe(), this.handleBackButton(), this.registerEvents(t), this.renderWebpageInPopup(this.createCheckoutUrl(n,
|
|
352
|
+
openModal({ purchaseInfo: n, callBacks: t, config: i }) {
|
|
353
|
+
this.injectStyles(), this.createIframe(), this.handleBackButton(), this.registerEvents(t), this.renderWebpageInPopup(this.createCheckoutUrl(n, i), t.onClose, t.onLoad);
|
|
353
354
|
}
|
|
354
355
|
createCheckoutUrl(n, t) {
|
|
355
|
-
const
|
|
356
|
+
const i = Object.assign(Object.assign({}, n), t), a = Object.keys(i).reduce((m, s) => (i[s] !== null && i[s] !== void 0 && (m[s] = i[s]), m), {}), u = Object.keys(a).map((m) => `${m}=${encodeURIComponent(a[m])}`).join("&"), d = this.encodeBase64(u), o = encodeURIComponent(d);
|
|
356
357
|
return `${a?.branding === "disabled" ? `${this.baseUrl}/pay/direct` : `${this.baseUrl}/pay`}?p=${o}`;
|
|
357
358
|
}
|
|
358
359
|
encodeBase64(n) {
|
|
@@ -371,22 +372,22 @@ class Ke {
|
|
|
371
372
|
}
|
|
372
373
|
registerEvents(n) {
|
|
373
374
|
this.messageHandler && window.removeEventListener("message", this.messageHandler, !1);
|
|
374
|
-
const t = (
|
|
375
|
-
var a,
|
|
376
|
-
if (
|
|
375
|
+
const t = (i) => {
|
|
376
|
+
var a, u, d, o, v, m;
|
|
377
|
+
if (i.origin !== this.baseUrl)
|
|
377
378
|
return;
|
|
378
|
-
const { data:
|
|
379
|
-
if (
|
|
380
|
-
(a = n.onPaymentSuccess) === null || a === void 0 || a.call(n,
|
|
381
|
-
else if (
|
|
382
|
-
(
|
|
383
|
-
else if (
|
|
384
|
-
(
|
|
385
|
-
else if (
|
|
386
|
-
(v = n.onFeesChanged) === null || v === void 0 || v.call(n,
|
|
387
|
-
else if (
|
|
379
|
+
const { data: s } = i;
|
|
380
|
+
if (s.success === !0)
|
|
381
|
+
(a = n.onPaymentSuccess) === null || a === void 0 || a.call(n, s);
|
|
382
|
+
else if (s.success === !1)
|
|
383
|
+
(u = n.onPaymentFailure) === null || u === void 0 || u.call(n, s);
|
|
384
|
+
else if (s.initialized)
|
|
385
|
+
(d = n.init) === null || d === void 0 || d.call(n, s), (o = n.onInit) === null || o === void 0 || o.call(n, s);
|
|
386
|
+
else if (s.feesChanged)
|
|
387
|
+
(v = n.onFeesChanged) === null || v === void 0 || v.call(n, s.fees);
|
|
388
|
+
else if (s.resize) {
|
|
388
389
|
const f = document.getElementById("hubtel-iframe-element");
|
|
389
|
-
f && (f.style.height =
|
|
390
|
+
f && (f.style.height = s.height + "px"), (m = n?.onResize) === null || m === void 0 || m.call(n, s);
|
|
390
391
|
}
|
|
391
392
|
};
|
|
392
393
|
this.messageHandler = t, window.addEventListener("message", t, !1);
|
|
@@ -398,16 +399,16 @@ class Ke {
|
|
|
398
399
|
destroy() {
|
|
399
400
|
this.messageHandler && (window.removeEventListener("message", this.messageHandler, !1), this.messageHandler = null);
|
|
400
401
|
}
|
|
401
|
-
renderWebpageInPopup(n, t,
|
|
402
|
+
renderWebpageInPopup(n, t, i) {
|
|
402
403
|
const a = document.createElement("div");
|
|
403
404
|
a.classList.add("checkout-modal");
|
|
404
|
-
const
|
|
405
|
-
|
|
405
|
+
const u = document.createElement("div");
|
|
406
|
+
u.setAttribute("id", "checkout-close-icon"), u.innerHTML = "×", u.classList.add("close-icon"), u.addEventListener("click", () => {
|
|
406
407
|
this.closePopUp(), t?.();
|
|
407
|
-
}), a.appendChild(
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
a.style.opacity = "1",
|
|
408
|
+
}), a.appendChild(u);
|
|
409
|
+
const d = document.createElement("iframe");
|
|
410
|
+
d.src = n, history.pushState({ modalOpen: !0 }, ""), d.classList.add("iframe"), a.appendChild(d), document.body.appendChild(a), a.style.opacity = "0", d.addEventListener("load", () => {
|
|
411
|
+
a.style.opacity = "1", i?.();
|
|
411
412
|
});
|
|
412
413
|
}
|
|
413
414
|
closePopUp() {
|
|
@@ -522,33 +523,33 @@ class Ke {
|
|
|
522
523
|
}
|
|
523
524
|
}
|
|
524
525
|
const J = /* @__PURE__ */ new Map();
|
|
525
|
-
function
|
|
526
|
+
function D(e, n) {
|
|
526
527
|
const t = J.get(n);
|
|
527
528
|
if (t) return t;
|
|
528
|
-
const
|
|
529
|
+
const i = new Promise((a, u) => {
|
|
529
530
|
if (document.getElementById(n)) {
|
|
530
531
|
a();
|
|
531
532
|
return;
|
|
532
533
|
}
|
|
533
|
-
const
|
|
534
|
-
|
|
534
|
+
const d = document.createElement("script");
|
|
535
|
+
d.id = n, d.src = e, d.async = !0, d.onload = () => a(), d.onerror = () => u(new Error(`Failed to load ${n} script`)), document.head.appendChild(d);
|
|
535
536
|
});
|
|
536
|
-
return J.set(n,
|
|
537
|
+
return J.set(n, i), i;
|
|
537
538
|
}
|
|
538
539
|
function je() {
|
|
539
|
-
return
|
|
540
|
+
return D("https://js.paystack.co/v1/inline.js", "paystack-script");
|
|
540
541
|
}
|
|
541
542
|
function dt() {
|
|
542
543
|
return Promise.resolve();
|
|
543
544
|
}
|
|
544
545
|
function ze() {
|
|
545
|
-
return
|
|
546
|
+
return D("https://checkout.flutterwave.com/v3.js", "flutterwave-script");
|
|
546
547
|
}
|
|
547
548
|
function He() {
|
|
548
|
-
return
|
|
549
|
+
return D("https://js.stripe.com/v3/", "stripe-script");
|
|
549
550
|
}
|
|
550
551
|
function Ve() {
|
|
551
|
-
return
|
|
552
|
+
return D("https://sdk.monnify.com/plugin/monnify.js", "monnify-script");
|
|
552
553
|
}
|
|
553
554
|
async function qe(e) {
|
|
554
555
|
if (await je(), !window.PaystackPop)
|
|
@@ -570,15 +571,15 @@ async function Be(e) {
|
|
|
570
571
|
purchaseDescription: e.purchaseDescription,
|
|
571
572
|
customerPhoneNumber: e.customerPhone || "",
|
|
572
573
|
clientReference: `hubtel_${Date.now()}`
|
|
573
|
-
},
|
|
574
|
+
}, i = {
|
|
574
575
|
branding: "enabled",
|
|
575
576
|
callbackUrl: e.callbackUrl || (typeof window < "u" ? window.location.href : ""),
|
|
576
577
|
merchantAccount: typeof e.clientId == "string" ? parseInt(e.clientId, 10) : e.clientId,
|
|
577
|
-
basicAuth: ""
|
|
578
|
+
basicAuth: e.basicAuth || ""
|
|
578
579
|
};
|
|
579
580
|
n.openModal({
|
|
580
581
|
purchaseInfo: t,
|
|
581
|
-
config:
|
|
582
|
+
config: i,
|
|
582
583
|
callBacks: {
|
|
583
584
|
onPaymentSuccess: (a) => {
|
|
584
585
|
e.onSuccess(a), n.closePopUp();
|
|
@@ -662,18 +663,18 @@ async function Je(e, n) {
|
|
|
662
663
|
})
|
|
663
664
|
});
|
|
664
665
|
if (!t.ok) {
|
|
665
|
-
const
|
|
666
|
-
return e.onError({ message:
|
|
666
|
+
const u = (await t.json().catch(() => ({}))).message || "Failed to initiate M-Pesa payment";
|
|
667
|
+
return e.onError({ message: u }), { status: "failed", message: u };
|
|
667
668
|
}
|
|
668
|
-
const
|
|
669
|
+
const i = await t.json();
|
|
669
670
|
return {
|
|
670
671
|
status: "initiated",
|
|
671
672
|
message: "Please check your phone and enter your M-Pesa PIN to complete the payment.",
|
|
672
|
-
transactionId:
|
|
673
|
+
transactionId: i.checkout_request_id || i.transaction_id
|
|
673
674
|
};
|
|
674
675
|
} catch (t) {
|
|
675
|
-
const
|
|
676
|
-
return e.onError({ message:
|
|
676
|
+
const i = t instanceof Error ? t.message : "Network error";
|
|
677
|
+
return e.onError({ message: i }), { status: "failed", message: i };
|
|
677
678
|
}
|
|
678
679
|
}
|
|
679
680
|
const Qe = ["disabled"], Xe = {
|
|
@@ -715,18 +716,18 @@ const Qe = ["disabled"], Xe = {
|
|
|
715
716
|
},
|
|
716
717
|
emits: ["success", "error", "close"],
|
|
717
718
|
setup(e, { emit: n }) {
|
|
718
|
-
const t = e,
|
|
719
|
+
const t = e, i = n, {
|
|
719
720
|
status: a,
|
|
720
|
-
paymentIntent:
|
|
721
|
-
selectedMethod:
|
|
721
|
+
paymentIntent: u,
|
|
722
|
+
selectedMethod: d,
|
|
722
723
|
error: o,
|
|
723
724
|
isLoading: v,
|
|
724
725
|
isReady: m,
|
|
725
|
-
initialize:
|
|
726
|
+
initialize: s,
|
|
726
727
|
selectMethod: f,
|
|
727
|
-
handlePspSuccess:
|
|
728
|
+
handlePspSuccess: C,
|
|
728
729
|
handlePspError: g,
|
|
729
|
-
close:
|
|
730
|
+
close: F
|
|
730
731
|
} = be({
|
|
731
732
|
config: {
|
|
732
733
|
publicKey: t.publicKey,
|
|
@@ -740,125 +741,127 @@ const Qe = ["disabled"], Xe = {
|
|
|
740
741
|
initialPaymentIntent: t.initialPaymentIntent
|
|
741
742
|
},
|
|
742
743
|
apiBaseUrl: t.apiBaseUrl,
|
|
743
|
-
onSuccess: (
|
|
744
|
-
onError: (
|
|
745
|
-
onClose: () =>
|
|
744
|
+
onSuccess: (l) => i("success", l),
|
|
745
|
+
onError: (l) => i("error", l),
|
|
746
|
+
onClose: () => i("close")
|
|
746
747
|
}), E = $(t.isOpen ?? !1);
|
|
747
|
-
N(() => t.isOpen, (
|
|
748
|
-
|
|
748
|
+
N(() => t.isOpen, (l) => {
|
|
749
|
+
l !== void 0 && (E.value = l);
|
|
749
750
|
});
|
|
750
751
|
const L = () => {
|
|
751
|
-
E.value = !0, !
|
|
752
|
+
E.value = !0, !u.value && a.value === "idle" && s();
|
|
752
753
|
};
|
|
753
|
-
N([E,
|
|
754
|
-
|
|
754
|
+
N([E, u, d], ([l, r, p]) => {
|
|
755
|
+
l && r && p && p === "card" && M(null);
|
|
755
756
|
});
|
|
756
757
|
const R = () => {
|
|
757
|
-
E.value = !1,
|
|
758
|
-
}, K = (
|
|
759
|
-
f(
|
|
760
|
-
}, M = async (
|
|
761
|
-
|
|
762
|
-
|
|
758
|
+
E.value = !1, F();
|
|
759
|
+
}, K = (l) => {
|
|
760
|
+
f(l);
|
|
761
|
+
}, M = async (l) => {
|
|
762
|
+
const r = u.value;
|
|
763
|
+
if (!r) return;
|
|
764
|
+
const p = r.recommendedPsp;
|
|
763
765
|
try {
|
|
764
|
-
if (
|
|
766
|
+
if (p === "paystack")
|
|
765
767
|
await qe({
|
|
766
768
|
key: t.publicKey,
|
|
767
769
|
email: t.email || "",
|
|
768
770
|
amount: t.amount,
|
|
769
771
|
currency: t.currency,
|
|
770
|
-
ref:
|
|
771
|
-
onSuccess: (
|
|
772
|
+
ref: r.id,
|
|
773
|
+
onSuccess: (b) => C(b),
|
|
772
774
|
onClose: () => {
|
|
773
775
|
}
|
|
774
776
|
});
|
|
775
|
-
else if (
|
|
777
|
+
else if (p === "hubtel")
|
|
776
778
|
await Be({
|
|
777
|
-
clientId: t.publicKey,
|
|
779
|
+
clientId: r.pspCredentials?.merchantAccount || t.publicKey,
|
|
778
780
|
purchaseDescription: `Payment for ${t.amount} ${t.currency}`,
|
|
779
781
|
amount: t.amount,
|
|
780
|
-
customerPhone:
|
|
782
|
+
customerPhone: l?.phone || t.phone,
|
|
781
783
|
customerEmail: t.email,
|
|
782
|
-
|
|
784
|
+
basicAuth: r.pspCredentials?.basicAuth,
|
|
785
|
+
onSuccess: (b) => C(b),
|
|
783
786
|
onClose: () => {
|
|
784
787
|
}
|
|
785
788
|
});
|
|
786
|
-
else if (
|
|
789
|
+
else if (p === "flutterwave")
|
|
787
790
|
await Ye({
|
|
788
791
|
public_key: t.publicKey,
|
|
789
|
-
tx_ref:
|
|
792
|
+
tx_ref: r.id,
|
|
790
793
|
amount: t.amount,
|
|
791
794
|
currency: t.currency,
|
|
792
795
|
customer: {
|
|
793
796
|
email: t.email || "",
|
|
794
|
-
phone_number:
|
|
797
|
+
phone_number: l?.phone || t.phone
|
|
795
798
|
},
|
|
796
|
-
callback: (
|
|
799
|
+
callback: (b) => C(b),
|
|
797
800
|
onclose: () => {
|
|
798
801
|
}
|
|
799
802
|
});
|
|
800
|
-
else if (
|
|
803
|
+
else if (p === "monnify")
|
|
801
804
|
await Ge({
|
|
802
|
-
apiKey:
|
|
805
|
+
apiKey: r.pspPublicKey || t.publicKey,
|
|
803
806
|
contractCode: t.metadata?.contract_code || t.publicKey,
|
|
804
807
|
amount: t.amount,
|
|
805
808
|
currency: t.currency,
|
|
806
|
-
reference:
|
|
809
|
+
reference: r.reference || r.id,
|
|
807
810
|
customerName: t.metadata?.customer_name || t.email || "",
|
|
808
811
|
customerEmail: t.email || "",
|
|
809
|
-
customerPhone:
|
|
812
|
+
customerPhone: l?.phone || t.phone,
|
|
810
813
|
metadata: t.metadata,
|
|
811
|
-
onSuccess: (
|
|
814
|
+
onSuccess: (b) => C(b),
|
|
812
815
|
onClose: () => {
|
|
813
816
|
}
|
|
814
817
|
});
|
|
815
|
-
else if (
|
|
816
|
-
const
|
|
818
|
+
else if (p === "mpesa") {
|
|
819
|
+
const b = `${t.apiBaseUrl || "https://api.reevit.io"}/v1/payments/${r.id}/mpesa`;
|
|
817
820
|
await Je({
|
|
818
|
-
phoneNumber:
|
|
821
|
+
phoneNumber: l?.phone || t.phone || "",
|
|
819
822
|
amount: t.amount,
|
|
820
|
-
reference:
|
|
821
|
-
description: `Payment ${
|
|
823
|
+
reference: r.reference || r.id,
|
|
824
|
+
description: `Payment ${r.reference || ""}`,
|
|
822
825
|
onInitiated: () => {
|
|
823
826
|
},
|
|
824
|
-
onSuccess: (
|
|
825
|
-
onError: (
|
|
826
|
-
},
|
|
827
|
-
} else g(
|
|
827
|
+
onSuccess: (k) => C(k),
|
|
828
|
+
onError: (k) => g({ code: "MPESA_ERROR", message: k.message })
|
|
829
|
+
}, b);
|
|
830
|
+
} else g(p === "stripe" ? {
|
|
828
831
|
code: "STRIPE_NOT_IMPLEMENTED",
|
|
829
832
|
message: "Stripe integration requires custom Elements setup. Please use the React SDK or implement custom Stripe Elements."
|
|
830
833
|
} : {
|
|
831
834
|
code: "UNSUPPORTED_PSP",
|
|
832
|
-
message: `Payment provider "${
|
|
835
|
+
message: `Payment provider "${p}" is not supported in this checkout.`
|
|
833
836
|
});
|
|
834
|
-
} catch (
|
|
837
|
+
} catch (b) {
|
|
835
838
|
g({
|
|
836
839
|
code: "BRIDGE_ERROR",
|
|
837
|
-
message:
|
|
840
|
+
message: b instanceof Error ? b.message : "Failed to open payment gateway"
|
|
838
841
|
});
|
|
839
842
|
}
|
|
840
|
-
}, j =
|
|
841
|
-
N(E, (
|
|
842
|
-
|
|
843
|
+
}, j = w(() => ve(t.theme || {}));
|
|
844
|
+
N(E, (l) => {
|
|
845
|
+
l ? document.body.style.overflow = "hidden" : document.body.style.overflow = "";
|
|
843
846
|
}), re(() => {
|
|
844
847
|
document.body.style.overflow = "";
|
|
845
848
|
});
|
|
846
|
-
const
|
|
847
|
-
return (
|
|
849
|
+
const P = w(() => a.value), O = w(() => o.value), x = w(() => d.value), T = w(() => v.value), z = w(() => m.value);
|
|
850
|
+
return (l, r) => (y(), h("div", {
|
|
848
851
|
class: "reevit-sdk-container",
|
|
849
852
|
style: ee(j.value)
|
|
850
853
|
}, [
|
|
851
|
-
Y(
|
|
854
|
+
Y(l.$slots, "default", {
|
|
852
855
|
open: L,
|
|
853
856
|
isLoading: T.value
|
|
854
857
|
}, () => [
|
|
855
|
-
|
|
858
|
+
c("button", {
|
|
856
859
|
type: "button",
|
|
857
860
|
class: "reevit-pay-button",
|
|
858
861
|
onClick: L,
|
|
859
862
|
disabled: T.value
|
|
860
863
|
}, [
|
|
861
|
-
T.value ? (y(), h("span", Xe)) : Y(
|
|
864
|
+
T.value ? (y(), h("span", Xe)) : Y(l.$slots, "button-text", { key: 1 }, () => [
|
|
862
865
|
r[1] || (r[1] = Z("Pay Now", -1))
|
|
863
866
|
])
|
|
864
867
|
], 8, Qe)
|
|
@@ -869,43 +872,43 @@ const Qe = ["disabled"], Xe = {
|
|
|
869
872
|
class: "reevit-modal-overlay",
|
|
870
873
|
onClick: X(R, ["self"])
|
|
871
874
|
}, [
|
|
872
|
-
|
|
873
|
-
class:
|
|
875
|
+
c("div", {
|
|
876
|
+
class: A(["reevit-modal-content", { "reevit-modal--dark": t.theme?.darkMode }])
|
|
874
877
|
}, [
|
|
875
|
-
|
|
878
|
+
c("button", {
|
|
876
879
|
class: "reevit-modal-close",
|
|
877
880
|
onClick: R,
|
|
878
881
|
"aria-label": "Close"
|
|
879
882
|
}, " × "),
|
|
880
|
-
r[9] || (r[9] =
|
|
881
|
-
|
|
883
|
+
r[9] || (r[9] = c("div", { class: "reevit-modal-header" }, [
|
|
884
|
+
c("img", {
|
|
882
885
|
src: "https://i.imgur.com/bzUR5Lm.png",
|
|
883
886
|
alt: "Reevit",
|
|
884
887
|
class: "reevit-modal__logo"
|
|
885
888
|
})
|
|
886
889
|
], -1)),
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
])])) :
|
|
892
|
-
r[3] || (r[3] =
|
|
893
|
-
r[4] || (r[4] =
|
|
894
|
-
|
|
895
|
-
|
|
890
|
+
c("div", Ze, [
|
|
891
|
+
P.value === "loading" ? (y(), h("div", et, [...r[2] || (r[2] = [
|
|
892
|
+
c("div", { class: "reevit-spinner reevit-spinner--large" }, null, -1),
|
|
893
|
+
c("p", null, "Initializing payment...", -1)
|
|
894
|
+
])])) : P.value === "failed" && O.value ? (y(), h("div", tt, [
|
|
895
|
+
r[3] || (r[3] = c("div", { class: "reevit-error-icon" }, "⚠️", -1)),
|
|
896
|
+
r[4] || (r[4] = c("h3", null, "Payment Failed", -1)),
|
|
897
|
+
c("p", null, S(O.value.message), 1),
|
|
898
|
+
c("button", {
|
|
896
899
|
class: "reevit-retry-btn",
|
|
897
|
-
onClick: r[0] || (r[0] = (p) => U(
|
|
900
|
+
onClick: r[0] || (r[0] = (p) => U(s)())
|
|
898
901
|
}, "Retry")
|
|
899
|
-
])) :
|
|
900
|
-
r[5] || (r[5] =
|
|
901
|
-
r[6] || (r[6] =
|
|
902
|
-
r[7] || (r[7] =
|
|
903
|
-
|
|
902
|
+
])) : P.value === "success" ? (y(), h("div", nt, [
|
|
903
|
+
r[5] || (r[5] = c("div", { class: "reevit-success-icon" }, "✅", -1)),
|
|
904
|
+
r[6] || (r[6] = c("h3", null, "Payment Successful", -1)),
|
|
905
|
+
r[7] || (r[7] = c("p", null, "Thank you for your payment.", -1)),
|
|
906
|
+
c("button", {
|
|
904
907
|
class: "reevit-done-btn",
|
|
905
908
|
onClick: R
|
|
906
909
|
}, "Done")
|
|
907
910
|
])) : z.value ? (y(), h(q, { key: 3 }, [
|
|
908
|
-
|
|
911
|
+
P.value === "ready" || P.value === "method_selected" || P.value === "processing" ? (y(), W(Me, {
|
|
909
912
|
key: 0,
|
|
910
913
|
methods: t.paymentMethods || ["card", "mobile_money"],
|
|
911
914
|
selected: x.value,
|
|
@@ -913,30 +916,30 @@ const Qe = ["disabled"], Xe = {
|
|
|
913
916
|
currency: t.currency,
|
|
914
917
|
onSelect: K
|
|
915
918
|
}, null, 8, ["methods", "selected", "amount", "currency"])) : I("", !0),
|
|
916
|
-
(
|
|
917
|
-
ie(
|
|
919
|
+
(P.value === "method_selected" || P.value === "processing") && x.value === "mobile_money" ? (y(), h("div", ot, [
|
|
920
|
+
ie(Fe, {
|
|
918
921
|
"initial-phone": t.phone,
|
|
919
|
-
loading:
|
|
922
|
+
loading: P.value === "processing",
|
|
920
923
|
onSubmit: M
|
|
921
924
|
}, null, 8, ["initial-phone", "loading"])
|
|
922
925
|
])) : I("", !0),
|
|
923
|
-
(
|
|
924
|
-
r[8] || (r[8] =
|
|
925
|
-
|
|
926
|
+
(P.value === "method_selected" || P.value === "processing") && x.value === "card" ? (y(), h("div", at, [
|
|
927
|
+
r[8] || (r[8] = c("p", { class: "reevit-info-text" }, "You will be redirected to our secure payment partner to complete your card payment.", -1)),
|
|
928
|
+
c("button", {
|
|
926
929
|
class: "reevit-submit-btn",
|
|
927
930
|
onClick: M,
|
|
928
|
-
disabled:
|
|
931
|
+
disabled: P.value === "processing"
|
|
929
932
|
}, [
|
|
930
|
-
|
|
933
|
+
P.value === "processing" ? (y(), h("span", st)) : (y(), h("span", it, "Proceed to Card Payment"))
|
|
931
934
|
], 8, rt)
|
|
932
935
|
])) : I("", !0)
|
|
933
936
|
], 64)) : I("", !0)
|
|
934
937
|
]),
|
|
935
|
-
r[10] || (r[10] =
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
938
|
+
r[10] || (r[10] = c("div", { class: "reevit-modal-footer" }, [
|
|
939
|
+
c("div", { class: "reevit-trust-badges" }, [
|
|
940
|
+
c("span", null, "PCI DSS Compliant"),
|
|
941
|
+
c("span", null, "•"),
|
|
942
|
+
c("span", null, "SSL Secure")
|
|
940
943
|
])
|
|
941
944
|
], -1))
|
|
942
945
|
], 2)
|
|
@@ -946,7 +949,7 @@ const Qe = ["disabled"], Xe = {
|
|
|
946
949
|
}
|
|
947
950
|
});
|
|
948
951
|
export {
|
|
949
|
-
|
|
952
|
+
Fe as MobileMoneyForm,
|
|
950
953
|
Me as PaymentMethodSelector,
|
|
951
954
|
vt as ReevitAPIClient,
|
|
952
955
|
mt as ReevitCheckout,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reevit/vue",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Unified Payment Widget for Vue 3 Applications",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"vue": "^3.3.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@reevit/core": "^0.3.
|
|
47
|
+
"@reevit/core": "^0.3.7",
|
|
48
48
|
"@hubteljs/checkout": "^1.0.4"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bridges/index.ts"],"names":[],"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BAAsB,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MobileMoneyForm.vue.d.ts","sourceRoot":"","sources":["../../src/components/MobileMoneyForm.vue"],"names":[],"mappings":"AA6GA,OAAO,KAAK,EAAsB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE5E,KAAK,WAAW,GAAG;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;;;;;;AA6JF,wBAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentMethodSelector.vue.d.ts","sourceRoot":"","sources":["../../src/components/PaymentMethodSelector.vue"],"names":[],"mappings":"AAuEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B,MA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
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReevit.d.ts","sourceRoot":"","sources":["../../src/composables/useReevit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EAKjB,KAAK,OAAO,EACb,MAAM,cAAc,CAAC;AAEtB,UAAU,gBAAgB;IACxB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAuCD,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAwCd,aAAa;2BA8ClB,aAAa;kCAKA,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gCA8DzB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;4BAKjC,YAAY;;;;;;;EAgE5C"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,cAAc,CAAC;AAGtB,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAG9E,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,OAAO,EACP,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,yBAAyB,EACzB,EAAE,EACF,eAAe,EACf,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EAGjB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EAGpB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,kBAAkB,GACxB,MAAM,WAAW,CAAC"}
|