@reevit/vue 0.1.0

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/index.mjs ADDED
@@ -0,0 +1,670 @@
1
+ import { ref as R, watch as D, computed as h, readonly as k, defineComponent as B, createElementBlock as m, openBlock as l, createElementVNode as n, toDisplayString as P, unref as T, Fragment as U, renderList as W, normalizeClass as A, createCommentVNode as C, withModifiers as X, withDirectives as oe, vModelText as ae, createTextVNode as Z, normalizeStyle as ee, onUnmounted as re, renderSlot as Y, createBlock as G, Teleport as se, createVNode as ie } from "vue";
2
+ import { createInitialState as le, ReevitAPIClient as ce, generateReference as ue, detectCountryFromCurrency as de, reevitReducer as me, formatAmount as pe, cn as te, detectNetwork as ye, validatePhone as J, createThemeVariables as ve } from "@reevit/core";
3
+ import { ReevitAPIClient as yt, cn as vt, createReevitClient as ht, detectCountryFromCurrency as bt, detectNetwork as ft, formatAmount as kt, formatPhone as wt, validatePhone as St } from "@reevit/core";
4
+ function he(e) {
5
+ const r = e.toLowerCase();
6
+ return r.includes("paystack") ? "paystack" : r.includes("hubtel") ? "hubtel" : r.includes("flutterwave") ? "flutterwave" : "paystack";
7
+ }
8
+ function be(e, r) {
9
+ return {
10
+ id: e.id,
11
+ clientSecret: e.client_secret,
12
+ amount: e.amount,
13
+ currency: e.currency,
14
+ status: e.status,
15
+ recommendedPsp: he(e.provider),
16
+ availableMethods: r.paymentMethods || ["card", "mobile_money"],
17
+ connectionId: e.connection_id,
18
+ provider: e.provider,
19
+ feeAmount: e.fee_amount,
20
+ feeCurrency: e.fee_currency,
21
+ netAmount: e.net_amount,
22
+ metadata: r.metadata
23
+ };
24
+ }
25
+ function fe(e) {
26
+ const { config: r, onSuccess: t, onError: i, onClose: y, onStateChange: c, apiBaseUrl: u } = e, o = R(le()), w = new ce({
27
+ publicKey: r.publicKey,
28
+ baseUrl: u
29
+ }), p = (s) => {
30
+ o.value = me(o.value, s);
31
+ };
32
+ D(
33
+ () => o.value.status,
34
+ (s) => {
35
+ c?.(s);
36
+ }
37
+ );
38
+ const v = async (s) => {
39
+ p({ type: "INIT_START" });
40
+ try {
41
+ const a = r.reference || ue(), d = de(r.currency), g = s || r.paymentMethods?.[0] || "card", { data: H, error: z } = await w.createPaymentIntent(
42
+ { ...r, reference: a },
43
+ g,
44
+ d
45
+ );
46
+ if (z) {
47
+ p({ type: "INIT_ERROR", payload: z }), i?.(z);
48
+ return;
49
+ }
50
+ if (!H) {
51
+ const q = {
52
+ code: "INIT_FAILED",
53
+ message: "No data received from API",
54
+ recoverable: !0
55
+ };
56
+ p({ type: "INIT_ERROR", payload: q }), i?.(q);
57
+ return;
58
+ }
59
+ const ne = be(H, { ...r, reference: a });
60
+ p({ type: "INIT_SUCCESS", payload: ne });
61
+ } catch (a) {
62
+ const d = {
63
+ code: "INIT_FAILED",
64
+ message: a instanceof Error ? a.message : "Failed to initialize checkout",
65
+ recoverable: !0,
66
+ originalError: a
67
+ };
68
+ p({ type: "INIT_ERROR", payload: d }), i?.(d);
69
+ }
70
+ }, f = (s) => {
71
+ p({ type: "SELECT_METHOD", payload: s });
72
+ }, S = async (s) => {
73
+ if (!(!o.value.paymentIntent || !o.value.selectedMethod)) {
74
+ p({ type: "PROCESS_START" });
75
+ try {
76
+ const { data: a, error: d } = await w.confirmPayment(o.value.paymentIntent.id);
77
+ if (d) {
78
+ p({ type: "PROCESS_ERROR", payload: d }), i?.(d);
79
+ return;
80
+ }
81
+ const g = {
82
+ paymentId: o.value.paymentIntent.id,
83
+ reference: s.reference || o.value.paymentIntent.metadata?.reference || "",
84
+ amount: o.value.paymentIntent.amount,
85
+ currency: o.value.paymentIntent.currency,
86
+ paymentMethod: o.value.selectedMethod,
87
+ psp: o.value.paymentIntent.recommendedPsp,
88
+ pspReference: s.pspReference || a?.provider_ref_id || "",
89
+ status: "success",
90
+ metadata: s
91
+ };
92
+ p({ type: "PROCESS_SUCCESS", payload: g }), t?.(g);
93
+ } catch (a) {
94
+ const d = {
95
+ code: "PAYMENT_FAILED",
96
+ message: a instanceof Error ? a.message : "Payment failed",
97
+ recoverable: !0,
98
+ originalError: a
99
+ };
100
+ p({ type: "PROCESS_ERROR", payload: d }), i?.(d);
101
+ }
102
+ }
103
+ }, K = async (s) => {
104
+ await S(s);
105
+ }, L = (s) => {
106
+ p({ type: "PROCESS_ERROR", payload: s }), i?.(s);
107
+ }, _ = () => {
108
+ p({ type: "RESET" });
109
+ }, N = async () => {
110
+ if (o.value.paymentIntent && o.value.status !== "success")
111
+ try {
112
+ await w.cancelPaymentIntent(o.value.paymentIntent.id);
113
+ } catch {
114
+ }
115
+ p({ type: "CLOSE" }), y?.();
116
+ }, E = h(() => o.value.status), j = h(() => o.value.paymentIntent), F = h(() => o.value.selectedMethod), x = h(() => o.value.error), b = h(() => o.value.result), O = h(
117
+ () => o.value.status === "loading" || o.value.status === "processing"
118
+ ), I = h(
119
+ () => o.value.status === "ready" || o.value.status === "method_selected" || o.value.status === "processing"
120
+ ), M = h(() => o.value.status === "success"), V = h(() => o.value.error?.recoverable ?? !1);
121
+ return {
122
+ // State (readonly refs)
123
+ status: k(E),
124
+ paymentIntent: k(j),
125
+ selectedMethod: k(F),
126
+ error: k(x),
127
+ result: k(b),
128
+ // Actions
129
+ initialize: v,
130
+ selectMethod: f,
131
+ processPayment: S,
132
+ handlePspSuccess: K,
133
+ handlePspError: L,
134
+ reset: _,
135
+ close: N,
136
+ // Computed
137
+ isLoading: k(O),
138
+ isReady: k(I),
139
+ isComplete: k(M),
140
+ canRetry: k(V)
141
+ };
142
+ }
143
+ const ke = { class: "reevit-method-selector" }, we = { class: "reevit-amount-display" }, Se = { class: "reevit-methods-grid" }, _e = ["onClick"], Ce = { class: "reevit-method-icon" }, Pe = { class: "reevit-method-info" }, Ee = { class: "reevit-method-name" }, Ie = { class: "reevit-method-description" }, Me = { class: "reevit-method-radio" }, Re = {
144
+ key: 0,
145
+ class: "reevit-radio-inner"
146
+ }, Te = /* @__PURE__ */ B({
147
+ __name: "PaymentMethodSelector",
148
+ props: {
149
+ methods: {},
150
+ selected: {},
151
+ amount: {},
152
+ currency: {}
153
+ },
154
+ emits: ["select"],
155
+ setup(e, { emit: r }) {
156
+ const t = e, i = r, y = h(() => [
157
+ {
158
+ id: "card",
159
+ name: "Card",
160
+ description: "Visa, Mastercard, Maestro",
161
+ icon: "💳"
162
+ },
163
+ {
164
+ id: "mobile_money",
165
+ name: "Mobile Money",
166
+ description: "MTN, Vodafone, AirtelTigo",
167
+ icon: "📱"
168
+ },
169
+ {
170
+ id: "bank_transfer",
171
+ name: "Bank Transfer",
172
+ description: "Transfer directly from your bank",
173
+ icon: "🏦"
174
+ }
175
+ ].filter((c) => t.methods.includes(c.id)));
176
+ return (c, u) => (l(), m("div", ke, [
177
+ u[0] || (u[0] = n("h3", { class: "reevit-section-title" }, "Select Payment Method", -1)),
178
+ n("p", we, " Pay " + P(T(pe)(e.amount, e.currency)), 1),
179
+ n("div", Se, [
180
+ (l(!0), m(U, null, W(y.value, (o) => (l(), m("button", {
181
+ key: o.id,
182
+ type: "button",
183
+ class: A(T(te)("reevit-method-card", e.selected === o.id && "reevit-method-card--selected")),
184
+ onClick: (w) => i("select", o.id)
185
+ }, [
186
+ n("span", Ce, P(o.icon), 1),
187
+ n("div", Pe, [
188
+ n("span", Ee, P(o.name), 1),
189
+ n("span", Ie, P(o.description), 1)
190
+ ]),
191
+ n("div", Me, [
192
+ e.selected === o.id ? (l(), m("div", Re)) : C("", !0)
193
+ ])
194
+ ], 10, _e))), 128))
195
+ ])
196
+ ]));
197
+ }
198
+ }), $e = { class: "reevit-form-group" }, Ne = ["disabled"], Fe = { class: "reevit-network-selector" }, Oe = { class: "reevit-networks-grid" }, ge = ["onClick", "disabled"], De = {
199
+ key: 0,
200
+ class: "reevit-error-message"
201
+ }, Ae = ["disabled"], Ke = {
202
+ key: 0,
203
+ class: "reevit-spinner"
204
+ }, Le = { key: 1 }, je = /* @__PURE__ */ B({
205
+ __name: "MobileMoneyForm",
206
+ props: {
207
+ initialPhone: {},
208
+ loading: { type: Boolean }
209
+ },
210
+ emits: ["submit"],
211
+ setup(e, { emit: r }) {
212
+ const t = e, i = r, y = R(t.initialPhone || ""), c = R(null), u = R(null);
213
+ D(y, (p) => {
214
+ const v = ye(p);
215
+ v && (c.value = v), u.value && (u.value = null);
216
+ });
217
+ const o = () => {
218
+ if (!J(y.value)) {
219
+ u.value = "Please enter a valid phone number";
220
+ return;
221
+ }
222
+ if (!c.value) {
223
+ u.value = "Please select your mobile network";
224
+ return;
225
+ }
226
+ i("submit", {
227
+ phone: y.value,
228
+ network: c.value
229
+ });
230
+ }, w = [
231
+ { id: "mtn", name: "MTN", color: "#FFCC00" },
232
+ { id: "vodafone", name: "Vodafone", color: "#E60000" },
233
+ { id: "airteltigo", name: "AirtelTigo", color: "#005596" }
234
+ ];
235
+ return (p, v) => (l(), m("form", {
236
+ class: "reevit-momo-form",
237
+ onSubmit: X(o, ["prevent"])
238
+ }, [
239
+ n("div", $e, [
240
+ v[1] || (v[1] = n("label", {
241
+ class: "reevit-label",
242
+ for: "reevit-phone"
243
+ }, "Phone Number", -1)),
244
+ oe(n("input", {
245
+ id: "reevit-phone",
246
+ "onUpdate:modelValue": v[0] || (v[0] = (f) => y.value = f),
247
+ type: "tel",
248
+ class: A(["reevit-input", { "reevit-input--error": u.value && !T(J)(y.value) }]),
249
+ placeholder: "e.g. 024 123 4567",
250
+ disabled: e.loading,
251
+ autocomplete: "tel"
252
+ }, null, 10, Ne), [
253
+ [ae, y.value]
254
+ ])
255
+ ]),
256
+ n("div", Fe, [
257
+ v[2] || (v[2] = n("label", { class: "reevit-label" }, "Select Network", -1)),
258
+ n("div", Oe, [
259
+ (l(), m(U, null, W(w, (f) => n("button", {
260
+ key: f.id,
261
+ type: "button",
262
+ class: A(T(te)("reevit-network-btn", c.value === f.id && "reevit-network-btn--selected")),
263
+ onClick: (S) => c.value = f.id,
264
+ disabled: e.loading
265
+ }, [
266
+ n("div", {
267
+ class: "reevit-network-dot",
268
+ style: ee({ backgroundColor: f.color })
269
+ }, null, 4),
270
+ Z(" " + P(f.name), 1)
271
+ ], 10, ge)), 64))
272
+ ])
273
+ ]),
274
+ u.value ? (l(), m("p", De, P(u.value), 1)) : C("", !0),
275
+ n("button", {
276
+ type: "submit",
277
+ class: "reevit-submit-btn",
278
+ disabled: e.loading || !y.value
279
+ }, [
280
+ e.loading ? (l(), m("span", Ke)) : (l(), m("span", Le, "Continue"))
281
+ ], 8, Ae),
282
+ v[3] || (v[3] = n("p", { class: "reevit-secure-text" }, " 🔒 Secure mobile money payment via Reevit ", -1))
283
+ ], 32));
284
+ }
285
+ }), Q = /* @__PURE__ */ new Map();
286
+ function $(e, r) {
287
+ const t = Q.get(r);
288
+ if (t) return t;
289
+ const i = new Promise((y, c) => {
290
+ if (document.getElementById(r)) {
291
+ y();
292
+ return;
293
+ }
294
+ const u = document.createElement("script");
295
+ u.id = r, u.src = e, u.async = !0, u.onload = () => y(), u.onerror = () => c(new Error(`Failed to load ${r} script`)), document.head.appendChild(u);
296
+ });
297
+ return Q.set(r, i), i;
298
+ }
299
+ function xe() {
300
+ return $("https://js.paystack.co/v1/inline.js", "paystack-script");
301
+ }
302
+ function Ve() {
303
+ return $("https://checkout.hubtel.com/js/hubtel-checkout.js", "hubtel-script");
304
+ }
305
+ function ze() {
306
+ return $("https://checkout.flutterwave.com/v3.js", "flutterwave-script");
307
+ }
308
+ function Be() {
309
+ return $("https://js.stripe.com/v3/", "stripe-script");
310
+ }
311
+ function Ue() {
312
+ return $("https://sdk.monnify.com/plugin/monnify.js", "monnify-script");
313
+ }
314
+ async function He(e) {
315
+ if (await xe(), !window.PaystackPop)
316
+ throw new Error("Paystack script not loaded");
317
+ window.PaystackPop.setup({
318
+ key: e.key,
319
+ email: e.email,
320
+ amount: e.amount,
321
+ currency: e.currency,
322
+ ref: e.ref,
323
+ metadata: e.metadata,
324
+ callback: e.onSuccess,
325
+ onClose: e.onClose
326
+ }).openIframe();
327
+ }
328
+ async function qe(e) {
329
+ if (await Ve(), !window.HubtelCheckout)
330
+ throw new Error("Hubtel script not loaded");
331
+ window.HubtelCheckout.initPay({
332
+ clientId: e.clientId,
333
+ purchaseDescription: e.purchaseDescription,
334
+ amount: e.amount,
335
+ callbackUrl: e.callbackUrl,
336
+ customerPhone: e.customerPhone,
337
+ customerEmail: e.customerEmail,
338
+ onSuccess: e.onSuccess,
339
+ onClose: e.onClose
340
+ });
341
+ }
342
+ async function Ye(e) {
343
+ if (await ze(), !window.FlutterwaveCheckout)
344
+ throw new Error("Flutterwave script not loaded");
345
+ window.FlutterwaveCheckout({
346
+ public_key: e.public_key,
347
+ tx_ref: e.tx_ref,
348
+ amount: e.amount,
349
+ currency: e.currency,
350
+ customer: e.customer,
351
+ payment_options: e.payment_options,
352
+ customizations: e.customizations,
353
+ callback: e.callback,
354
+ onclose: e.onclose
355
+ });
356
+ }
357
+ async function Ge(e) {
358
+ if (await Be(), !window.Stripe)
359
+ throw new Error("Stripe.js not loaded");
360
+ return window.Stripe(e);
361
+ }
362
+ async function lt(e) {
363
+ const t = await (await Ge(e.publishableKey)).confirmPayment({
364
+ elements: e.elements,
365
+ clientSecret: e.clientSecret,
366
+ redirect: "if_required"
367
+ });
368
+ t.error ? e.onError({ message: t.error.message || "Payment failed" }) : t.paymentIntent && e.onSuccess({
369
+ paymentIntentId: t.paymentIntent.id,
370
+ status: t.paymentIntent.status
371
+ });
372
+ }
373
+ async function ct(e) {
374
+ if (await Ue(), !window.MonnifySDK)
375
+ throw new Error("Monnify SDK not loaded");
376
+ window.MonnifySDK.initialize({
377
+ amount: e.amount,
378
+ currency: e.currency,
379
+ reference: e.reference,
380
+ customerName: e.customerName,
381
+ customerEmail: e.customerEmail,
382
+ customerMobileNumber: e.customerPhone,
383
+ apiKey: e.apiKey,
384
+ contractCode: e.contractCode,
385
+ paymentDescription: e.paymentDescription || "Payment",
386
+ isTestMode: e.isTestMode ?? !1,
387
+ metadata: e.metadata,
388
+ onComplete: (r) => {
389
+ r.status === "SUCCESS" ? e.onSuccess({
390
+ transactionReference: r.transactionReference,
391
+ paymentReference: r.paymentReference,
392
+ ...r
393
+ }) : e.onError?.({ message: r.message || "Payment failed" });
394
+ },
395
+ onClose: e.onClose
396
+ });
397
+ }
398
+ async function ut(e, r) {
399
+ e.onInitiated();
400
+ try {
401
+ const t = await fetch(r, {
402
+ method: "POST",
403
+ headers: { "Content-Type": "application/json" },
404
+ body: JSON.stringify({
405
+ phone_number: e.phoneNumber,
406
+ amount: e.amount,
407
+ reference: e.reference,
408
+ description: e.description
409
+ })
410
+ });
411
+ if (!t.ok) {
412
+ const c = (await t.json().catch(() => ({}))).message || "Failed to initiate M-Pesa payment";
413
+ return e.onError({ message: c }), { status: "failed", message: c };
414
+ }
415
+ const i = await t.json();
416
+ return {
417
+ status: "initiated",
418
+ message: "Please check your phone and enter your M-Pesa PIN to complete the payment.",
419
+ transactionId: i.checkout_request_id || i.transaction_id
420
+ };
421
+ } catch (t) {
422
+ const i = t instanceof Error ? t.message : "Network error";
423
+ return e.onError({ message: i }), { status: "failed", message: i };
424
+ }
425
+ }
426
+ const Je = ["disabled"], Qe = {
427
+ key: 0,
428
+ class: "reevit-spinner"
429
+ }, We = { class: "reevit-modal-body" }, Xe = {
430
+ key: 0,
431
+ class: "reevit-loading-state"
432
+ }, Ze = {
433
+ key: 1,
434
+ class: "reevit-error-state"
435
+ }, et = {
436
+ key: 2,
437
+ class: "reevit-success-state"
438
+ }, tt = {
439
+ key: 1,
440
+ class: "reevit-method-form-container"
441
+ }, nt = {
442
+ key: 2,
443
+ class: "reevit-card-info"
444
+ }, ot = ["disabled"], at = {
445
+ key: 0,
446
+ class: "reevit-spinner"
447
+ }, rt = { key: 1 }, dt = /* @__PURE__ */ B({
448
+ __name: "ReevitCheckout",
449
+ props: {
450
+ publicKey: {},
451
+ amount: {},
452
+ currency: {},
453
+ email: {},
454
+ phone: {},
455
+ reference: {},
456
+ metadata: {},
457
+ paymentMethods: {},
458
+ theme: {},
459
+ isOpen: { type: Boolean }
460
+ },
461
+ emits: ["success", "error", "close"],
462
+ setup(e, { emit: r }) {
463
+ const t = e, i = r, {
464
+ status: y,
465
+ paymentIntent: c,
466
+ selectedMethod: u,
467
+ error: o,
468
+ isLoading: w,
469
+ isReady: p,
470
+ initialize: v,
471
+ selectMethod: f,
472
+ handlePspSuccess: S,
473
+ handlePspError: K,
474
+ close: L
475
+ } = fe({
476
+ config: {
477
+ publicKey: t.publicKey,
478
+ amount: t.amount,
479
+ currency: t.currency,
480
+ email: t.email,
481
+ phone: t.phone,
482
+ reference: t.reference,
483
+ metadata: t.metadata,
484
+ paymentMethods: t.paymentMethods
485
+ },
486
+ onSuccess: (s) => i("success", s),
487
+ onError: (s) => i("error", s),
488
+ onClose: () => i("close")
489
+ }), _ = R(t.isOpen ?? !1);
490
+ D(() => t.isOpen, (s) => {
491
+ s !== void 0 && (_.value = s);
492
+ });
493
+ const N = () => {
494
+ _.value = !0, c.value || v();
495
+ }, E = () => {
496
+ _.value = !1, L();
497
+ }, j = (s) => {
498
+ f(s);
499
+ }, F = async (s) => {
500
+ if (!c.value) return;
501
+ const a = c.value.recommendedPsp;
502
+ try {
503
+ a === "paystack" ? await He({
504
+ key: t.publicKey,
505
+ email: t.email || "",
506
+ amount: t.amount,
507
+ currency: t.currency,
508
+ ref: c.value.id,
509
+ onSuccess: (d) => S(d),
510
+ onClose: () => {
511
+ }
512
+ }) : a === "hubtel" ? await qe({
513
+ clientId: t.publicKey,
514
+ purchaseDescription: `Payment for ${t.amount} ${t.currency}`,
515
+ amount: t.amount,
516
+ customerPhone: s?.phone || t.phone,
517
+ customerEmail: t.email,
518
+ onSuccess: (d) => S(d),
519
+ onClose: () => {
520
+ }
521
+ }) : a === "flutterwave" && await Ye({
522
+ public_key: t.publicKey,
523
+ tx_ref: c.value.id,
524
+ amount: t.amount,
525
+ currency: t.currency,
526
+ customer: {
527
+ email: t.email || "",
528
+ phone_number: s?.phone || t.phone
529
+ },
530
+ callback: (d) => S(d),
531
+ onclose: () => {
532
+ }
533
+ });
534
+ } catch (d) {
535
+ K({
536
+ code: "BRIDGE_ERROR",
537
+ message: d instanceof Error ? d.message : "Failed to open payment gateway"
538
+ });
539
+ }
540
+ }, x = h(() => ve(t.theme || {}));
541
+ D(_, (s) => {
542
+ s ? document.body.style.overflow = "hidden" : document.body.style.overflow = "";
543
+ }), re(() => {
544
+ document.body.style.overflow = "";
545
+ });
546
+ const b = h(() => y.value), O = h(() => o.value), I = h(() => u.value), M = h(() => w.value), V = h(() => p.value);
547
+ return (s, a) => (l(), m("div", {
548
+ class: "reevit-sdk-container",
549
+ style: ee(x.value)
550
+ }, [
551
+ Y(s.$slots, "default", {
552
+ open: N,
553
+ isLoading: M.value
554
+ }, () => [
555
+ n("button", {
556
+ type: "button",
557
+ class: "reevit-pay-button",
558
+ onClick: N,
559
+ disabled: M.value
560
+ }, [
561
+ M.value ? (l(), m("span", Qe)) : Y(s.$slots, "button-text", { key: 1 }, () => [
562
+ a[1] || (a[1] = Z("Pay Now", -1))
563
+ ])
564
+ ], 8, Je)
565
+ ]),
566
+ (l(), G(se, { to: "body" }, [
567
+ _.value ? (l(), m("div", {
568
+ key: 0,
569
+ class: "reevit-modal-overlay",
570
+ onClick: X(E, ["self"])
571
+ }, [
572
+ n("div", {
573
+ class: A(["reevit-modal-content", { "reevit-modal--dark": t.theme?.darkMode }])
574
+ }, [
575
+ n("button", {
576
+ class: "reevit-modal-close",
577
+ onClick: E,
578
+ "aria-label": "Close"
579
+ }, " × "),
580
+ a[9] || (a[9] = n("div", { class: "reevit-modal-header" }, [
581
+ n("h2", { class: "reevit-modal-title" }, "Reevit Checkout"),
582
+ n("p", { class: "reevit-modal-subtitle" }, "Secure payment powered by Reevit")
583
+ ], -1)),
584
+ n("div", We, [
585
+ b.value === "loading" ? (l(), m("div", Xe, [...a[2] || (a[2] = [
586
+ n("div", { class: "reevit-spinner reevit-spinner--large" }, null, -1),
587
+ n("p", null, "Initializing payment...", -1)
588
+ ])])) : b.value === "failed" && O.value ? (l(), m("div", Ze, [
589
+ a[3] || (a[3] = n("div", { class: "reevit-error-icon" }, "⚠️", -1)),
590
+ a[4] || (a[4] = n("h3", null, "Payment Failed", -1)),
591
+ n("p", null, P(O.value.message), 1),
592
+ n("button", {
593
+ class: "reevit-retry-btn",
594
+ onClick: a[0] || (a[0] = (d) => T(v)())
595
+ }, "Retry")
596
+ ])) : b.value === "success" ? (l(), m("div", et, [
597
+ a[5] || (a[5] = n("div", { class: "reevit-success-icon" }, "✅", -1)),
598
+ a[6] || (a[6] = n("h3", null, "Payment Successful", -1)),
599
+ a[7] || (a[7] = n("p", null, "Thank you for your payment.", -1)),
600
+ n("button", {
601
+ class: "reevit-done-btn",
602
+ onClick: E
603
+ }, "Done")
604
+ ])) : V.value ? (l(), m(U, { key: 3 }, [
605
+ b.value === "ready" || b.value === "method_selected" || b.value === "processing" ? (l(), G(Te, {
606
+ key: 0,
607
+ methods: t.paymentMethods || ["card", "mobile_money"],
608
+ selected: I.value,
609
+ amount: t.amount,
610
+ currency: t.currency,
611
+ onSelect: j
612
+ }, null, 8, ["methods", "selected", "amount", "currency"])) : C("", !0),
613
+ (b.value === "method_selected" || b.value === "processing") && I.value === "mobile_money" ? (l(), m("div", tt, [
614
+ ie(je, {
615
+ "initial-phone": t.phone,
616
+ loading: b.value === "processing",
617
+ onSubmit: F
618
+ }, null, 8, ["initial-phone", "loading"])
619
+ ])) : C("", !0),
620
+ (b.value === "method_selected" || b.value === "processing") && I.value === "card" ? (l(), m("div", nt, [
621
+ a[8] || (a[8] = n("p", { class: "reevit-info-text" }, "You will be redirected to our secure payment partner to complete your card payment.", -1)),
622
+ n("button", {
623
+ class: "reevit-submit-btn",
624
+ onClick: F,
625
+ disabled: b.value === "processing"
626
+ }, [
627
+ b.value === "processing" ? (l(), m("span", at)) : (l(), m("span", rt, "Proceed to Card Payment"))
628
+ ], 8, ot)
629
+ ])) : C("", !0)
630
+ ], 64)) : C("", !0)
631
+ ]),
632
+ a[10] || (a[10] = n("div", { class: "reevit-modal-footer" }, [
633
+ n("div", { class: "reevit-trust-badges" }, [
634
+ n("span", null, "PCI DSS Compliant"),
635
+ n("span", null, "•"),
636
+ n("span", null, "SSL Secure")
637
+ ])
638
+ ], -1))
639
+ ], 2)
640
+ ])) : C("", !0)
641
+ ]))
642
+ ], 4));
643
+ }
644
+ });
645
+ export {
646
+ je as MobileMoneyForm,
647
+ Te as PaymentMethodSelector,
648
+ yt as ReevitAPIClient,
649
+ dt as ReevitCheckout,
650
+ vt as cn,
651
+ lt as confirmStripePayment,
652
+ ht as createReevitClient,
653
+ Ge as createStripeInstance,
654
+ bt as detectCountryFromCurrency,
655
+ ft as detectNetwork,
656
+ kt as formatAmount,
657
+ wt as formatPhone,
658
+ ut as initiateMPesaSTKPush,
659
+ ze as loadFlutterwaveScript,
660
+ Ve as loadHubtelScript,
661
+ Ue as loadMonnifyScript,
662
+ xe as loadPaystackScript,
663
+ Be as loadStripeScript,
664
+ Ye as openFlutterwaveModal,
665
+ qe as openHubtelPopup,
666
+ ct as openMonnifyModal,
667
+ He as openPaystackPopup,
668
+ fe as useReevit,
669
+ St as validatePhone
670
+ };
File without changes
package/dist/vue.css ADDED
File without changes