@buzztech/boi-ui 0.2.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/README.md +74 -0
- package/dist/api/bankStatements.d.ts +10 -0
- package/dist/api/edoc.d.ts +11 -0
- package/dist/api/files.d.ts +4 -0
- package/dist/boi-ui.css +1 -0
- package/dist/boi-ui.js +1261 -0
- package/dist/boi-ui.js.map +1 -0
- package/dist/boi-ui.umd.cjs +2 -0
- package/dist/boi-ui.umd.cjs.map +1 -0
- package/dist/components/BankSelect.vue.d.ts +20 -0
- package/dist/components/BankStatementIntegration.vue.d.ts +119 -0
- package/dist/components/BoiButton.vue.d.ts +21 -0
- package/dist/components/Button.vue.d.ts +31 -0
- package/dist/components/EmtsIntegration.vue.d.ts +33 -0
- package/dist/components/FileInput.vue.d.ts +55 -0
- package/dist/components/ui/button/Button.vue.d.ts +31 -0
- package/dist/components/ui/button/index.d.ts +6 -0
- package/dist/composables/useAccountVerification.d.ts +29 -0
- package/dist/composables/useEdocBanks.d.ts +53 -0
- package/dist/index.d.ts +21 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/types/edoc.d.ts +73 -0
- package/package.json +61 -0
package/dist/boi-ui.js
ADDED
|
@@ -0,0 +1,1261 @@
|
|
|
1
|
+
import { defineComponent as q, openBlock as c, createElementBlock as p, normalizeClass as X, renderSlot as ne, createTextVNode as H, toDisplayString as M, unref as z, ref as I, computed as V, Fragment as W, createElementVNode as l, renderList as te, createVNode as ee, withDirectives as oe, vModelText as re, createCommentVNode as P, watch as de, onMounted as he, onUnmounted as ke, nextTick as Ue, vShow as Pe, withCtx as Oe } from "vue";
|
|
2
|
+
const Ee = /* @__PURE__ */ q({
|
|
3
|
+
__name: "BoiButton",
|
|
4
|
+
props: {
|
|
5
|
+
label: {},
|
|
6
|
+
variant: {}
|
|
7
|
+
},
|
|
8
|
+
setup(n) {
|
|
9
|
+
return (k, e) => (c(), p("button", {
|
|
10
|
+
type: "button",
|
|
11
|
+
class: X(["boi-button", [n.variant ? `boi-button--${n.variant}` : "boi-button--primary"]])
|
|
12
|
+
}, [
|
|
13
|
+
ne(k.$slots, "default", {}, () => [
|
|
14
|
+
H(M(n.label), 1)
|
|
15
|
+
], !0)
|
|
16
|
+
], 2));
|
|
17
|
+
}
|
|
18
|
+
}), Fe = (n, k) => {
|
|
19
|
+
const e = n.__vccOpts || n;
|
|
20
|
+
for (const [f, d] of k)
|
|
21
|
+
e[f] = d;
|
|
22
|
+
return e;
|
|
23
|
+
}, De = /* @__PURE__ */ Fe(Ee, [["__scopeId", "data-v-96425342"]]);
|
|
24
|
+
function ie(...n) {
|
|
25
|
+
return n.flat(1 / 0).filter(Boolean).join(" ");
|
|
26
|
+
}
|
|
27
|
+
const Te = "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", je = {
|
|
28
|
+
default: "bg-primary text-white shadow-xs hover:bg-primary/90",
|
|
29
|
+
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
30
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
31
|
+
secondary: "bg-secondary text-white shadow-xs hover:bg-secondary/80",
|
|
32
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
33
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
34
|
+
}, Me = {
|
|
35
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
36
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
37
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
38
|
+
icon: "size-9"
|
|
39
|
+
};
|
|
40
|
+
function Le(n = {}) {
|
|
41
|
+
const k = n.variant ?? "default", e = n.size ?? "default";
|
|
42
|
+
return [Te, je[k], Me[e]].join(" ");
|
|
43
|
+
}
|
|
44
|
+
const ze = ["type", "disabled"], Re = /* @__PURE__ */ q({
|
|
45
|
+
__name: "Button",
|
|
46
|
+
props: {
|
|
47
|
+
type: { default: "button" },
|
|
48
|
+
variant: { default: "default" },
|
|
49
|
+
size: { default: "default" },
|
|
50
|
+
class: { type: [Boolean, null, String, Object, Array] },
|
|
51
|
+
disabled: { type: Boolean, default: !1 }
|
|
52
|
+
},
|
|
53
|
+
setup(n) {
|
|
54
|
+
const k = n;
|
|
55
|
+
return (e, f) => (c(), p("button", {
|
|
56
|
+
type: n.type,
|
|
57
|
+
disabled: n.disabled,
|
|
58
|
+
"data-slot": "button",
|
|
59
|
+
class: X(z(ie)(
|
|
60
|
+
z(Le)({ variant: k.variant, size: k.size }),
|
|
61
|
+
k.class
|
|
62
|
+
))
|
|
63
|
+
}, [
|
|
64
|
+
ne(e.$slots, "default")
|
|
65
|
+
], 10, ze));
|
|
66
|
+
}
|
|
67
|
+
}), Q = {
|
|
68
|
+
getBanks: () => "/api/edoc/banks",
|
|
69
|
+
initializeConsent: () => "/api/edoc/consent/initialize",
|
|
70
|
+
attachAccount: () => "/api/edoc/consent/attach-account",
|
|
71
|
+
getTransactions: () => "/api/edoc/consent/transactions",
|
|
72
|
+
manualUpload: () => "/api/edoc/manual-upload"
|
|
73
|
+
}, Ne = { class: "boi-emts-integration space-y-4" }, Ke = { key: 0 }, Xe = { class: "boi-emts-instructions rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm" }, We = { class: "list-inside list-decimal space-y-1 text-amber-800" }, Ge = ["disabled"], He = {
|
|
74
|
+
key: 1,
|
|
75
|
+
class: "boi-emts-otp space-y-3 rounded-lg border-2 border-primary bg-primary/5 p-4"
|
|
76
|
+
}, Je = { class: "flex flex-wrap items-end gap-3" }, Qe = { class: "min-w-[140px]" }, qe = ["disabled"], Ye = {
|
|
77
|
+
key: 1,
|
|
78
|
+
class: "text-sm text-red-600"
|
|
79
|
+
}, Ze = {
|
|
80
|
+
key: 2,
|
|
81
|
+
class: "text-sm text-amber-600"
|
|
82
|
+
}, ve = "inline-flex items-center justify-center rounded-md bg-black px-3 py-1.5 text-xs font-medium text-white shadow-sm hover:bg-neutral-900 focus:outline-none focus:ring-2 focus:ring-black focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", et = /* @__PURE__ */ q({
|
|
83
|
+
__name: "EmtsIntegration",
|
|
84
|
+
props: {
|
|
85
|
+
account: {},
|
|
86
|
+
edocBanks: {},
|
|
87
|
+
bankOptions: {},
|
|
88
|
+
api: {},
|
|
89
|
+
companyEmail: {},
|
|
90
|
+
industrialSector: {},
|
|
91
|
+
applicationId: {},
|
|
92
|
+
disabled: { type: Boolean, default: !1 },
|
|
93
|
+
integrationBaseUrl: { default: "" }
|
|
94
|
+
},
|
|
95
|
+
emits: ["update:consentId", "statement-retrieved", "error"],
|
|
96
|
+
setup(n, { emit: k }) {
|
|
97
|
+
const e = n;
|
|
98
|
+
function f(o) {
|
|
99
|
+
const i = (e.integrationBaseUrl ?? "").replace(/\/$/, "");
|
|
100
|
+
if (!i) return o;
|
|
101
|
+
const b = o.startsWith("/") ? o : `/${o}`;
|
|
102
|
+
return `${i}${b}`;
|
|
103
|
+
}
|
|
104
|
+
const d = k, $ = I(!1), B = I(!1);
|
|
105
|
+
function u(o) {
|
|
106
|
+
const i = e.bankOptions.find((b) => b.value === o);
|
|
107
|
+
return [(i == null ? void 0 : i.label) ?? "", ...(i == null ? void 0 : i.searchKeywords) ?? []].filter(Boolean);
|
|
108
|
+
}
|
|
109
|
+
function x(o, i = !1) {
|
|
110
|
+
if (!o || !e.edocBanks.length) return;
|
|
111
|
+
const b = u(o);
|
|
112
|
+
return e.edocBanks.find((g) => {
|
|
113
|
+
const D = g.bankCode === o || g.code === o, T = b.some((N) => {
|
|
114
|
+
var K;
|
|
115
|
+
return (K = g.name) == null ? void 0 : K.toLowerCase().includes(N.toLowerCase());
|
|
116
|
+
});
|
|
117
|
+
return (D || T) && (!i || g.enabled !== !1);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const A = (o) => x(o, !1), _ = (o) => !!x(o, !0), O = V(() => {
|
|
121
|
+
var o, i;
|
|
122
|
+
return !!((i = (o = A(e.account.bank)) == null ? void 0 : o.bankInstructions) != null && i.length);
|
|
123
|
+
}), S = V(() => {
|
|
124
|
+
var i;
|
|
125
|
+
const o = e.account;
|
|
126
|
+
return !!o.bank && ((i = o.account_number) == null ? void 0 : i.length) === 10 && !$.value && !B.value;
|
|
127
|
+
}), C = V(() => !!e.account.otp && !B.value), F = (o) => {
|
|
128
|
+
var i, b, g;
|
|
129
|
+
return ((b = (i = o == null ? void 0 : o.response) == null ? void 0 : i.data) == null ? void 0 : b.message) ?? ((g = o == null ? void 0 : o.data) == null ? void 0 : g.message) ?? (o == null ? void 0 : o.message) ?? "An unexpected error occurred";
|
|
130
|
+
}, G = (o) => ({
|
|
131
|
+
email: o,
|
|
132
|
+
referenceId: `loan_${e.applicationId ?? "new"}_${e.account.id}`,
|
|
133
|
+
firstName: "Company",
|
|
134
|
+
lastName: "Account",
|
|
135
|
+
state: "Lagos",
|
|
136
|
+
fundType: "online portal",
|
|
137
|
+
statementDuration: "12",
|
|
138
|
+
redirectionUrl: typeof window < "u" ? window.location.origin + "/loan-application" : "",
|
|
139
|
+
industrialSector: e.industrialSector ?? void 0
|
|
140
|
+
});
|
|
141
|
+
async function y(o) {
|
|
142
|
+
var T, N;
|
|
143
|
+
const i = e.account.email || e.companyEmail || "", b = await e.api.post(f(Q.initializeConsent()), G(i)), g = b == null ? void 0 : b.data;
|
|
144
|
+
if (!(g != null && g.success)) throw new Error((g == null ? void 0 : g.message) ?? "Failed to initialize consent");
|
|
145
|
+
const D = (N = (T = g == null ? void 0 : g.data) == null ? void 0 : T.data) == null ? void 0 : N.consentId;
|
|
146
|
+
if (!D) throw new Error("No consent ID returned");
|
|
147
|
+
return d("update:consentId", D), await e.api.post(f(Q.attachAccount()), {
|
|
148
|
+
consentId: D,
|
|
149
|
+
bankId: o.bankId,
|
|
150
|
+
accountNumber: e.account.account_number,
|
|
151
|
+
accountType: "Business",
|
|
152
|
+
statementDuration: "12",
|
|
153
|
+
monthType: "Period",
|
|
154
|
+
uploadType: "Digital"
|
|
155
|
+
}), D;
|
|
156
|
+
}
|
|
157
|
+
async function h() {
|
|
158
|
+
var i;
|
|
159
|
+
const o = A(e.account.bank);
|
|
160
|
+
if (!e.account.bank) return d("error", "Please select a bank");
|
|
161
|
+
if (((i = e.account.account_number) == null ? void 0 : i.length) !== 10) return d("error", "Please provide a valid 10-digit account number");
|
|
162
|
+
if (!o) return d("error", "Selected bank does not support electronic statement retrieval");
|
|
163
|
+
$.value = !0;
|
|
164
|
+
try {
|
|
165
|
+
await y(o);
|
|
166
|
+
} catch (b) {
|
|
167
|
+
d("error", F(b));
|
|
168
|
+
} finally {
|
|
169
|
+
$.value = !1;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
async function w() {
|
|
173
|
+
var o;
|
|
174
|
+
if (!e.account.otp || !e.account.consent_id) return d("error", "Please enter OTP");
|
|
175
|
+
B.value = !0;
|
|
176
|
+
try {
|
|
177
|
+
const i = await e.api.post(f(Q.getTransactions()), {
|
|
178
|
+
consentId: e.account.consent_id,
|
|
179
|
+
verificationCode: e.account.otp,
|
|
180
|
+
bankStatementId: e.account.id
|
|
181
|
+
}), b = i == null ? void 0 : i.data;
|
|
182
|
+
if (!(b != null && b.success)) return d("error", (b == null ? void 0 : b.message) ?? "Failed to retrieve transactions");
|
|
183
|
+
(o = b.data) != null && o.statement && d("statement-retrieved", b.data.statement);
|
|
184
|
+
} catch (i) {
|
|
185
|
+
d("error", F(i));
|
|
186
|
+
} finally {
|
|
187
|
+
B.value = !1;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async function v() {
|
|
191
|
+
var i, b;
|
|
192
|
+
const o = A(e.account.bank);
|
|
193
|
+
if (!e.account.bank || ((i = e.account.account_number) == null ? void 0 : i.length) !== 10)
|
|
194
|
+
return d("error", "Please select a bank and provide a valid 10-digit account number");
|
|
195
|
+
if (!o) return d("error", "Selected bank does not support electronic statement retrieval");
|
|
196
|
+
B.value = !0;
|
|
197
|
+
try {
|
|
198
|
+
const g = await y(o), D = await e.api.post(f(Q.getTransactions()), {
|
|
199
|
+
consentId: g,
|
|
200
|
+
verificationCode: "",
|
|
201
|
+
bankStatementId: e.account.id
|
|
202
|
+
}), T = D == null ? void 0 : D.data;
|
|
203
|
+
if (!(T != null && T.success)) return d("error", (T == null ? void 0 : T.message) ?? "Failed to retrieve transactions");
|
|
204
|
+
(b = T.data) != null && b.statement && d("statement-retrieved", T.data.statement);
|
|
205
|
+
} catch (g) {
|
|
206
|
+
d("error", F(g));
|
|
207
|
+
} finally {
|
|
208
|
+
B.value = !1;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return (o, i) => {
|
|
212
|
+
var b;
|
|
213
|
+
return c(), p("div", Ne, [
|
|
214
|
+
_(n.account.bank) ? (c(), p("div", Ke, [
|
|
215
|
+
O.value && !n.account.statement_generated ? (c(), p(W, { key: 0 }, [
|
|
216
|
+
l("div", Xe, [
|
|
217
|
+
i[1] || (i[1] = l("p", { class: "mb-2 font-semibold text-amber-900" }, "Bank-specific instructions", -1)),
|
|
218
|
+
l("ol", We, [
|
|
219
|
+
(c(!0), p(W, null, te((b = A(n.account.bank)) == null ? void 0 : b.bankInstructions, (g, D) => (c(), p("li", { key: D }, M(g), 1))), 128))
|
|
220
|
+
])
|
|
221
|
+
]),
|
|
222
|
+
ee(De, {
|
|
223
|
+
label: B.value ? "Retrieving…" : "Retrieve statement",
|
|
224
|
+
variant: "primary",
|
|
225
|
+
disabled: !S.value || n.disabled,
|
|
226
|
+
onClick: v
|
|
227
|
+
}, null, 8, ["label", "disabled"])
|
|
228
|
+
], 64)) : !O.value && !n.account.statement_generated ? (c(), p(W, { key: 1 }, [
|
|
229
|
+
n.account.showOtpInput ? (c(), p("div", He, [
|
|
230
|
+
i[3] || (i[3] = l("p", { class: "text-sm font-medium text-gray-700" }, "Enter the OTP sent to your bank-registered email.", -1)),
|
|
231
|
+
l("div", Je, [
|
|
232
|
+
l("div", Qe, [
|
|
233
|
+
i[2] || (i[2] = l("label", { class: "mb-1 block text-xs font-medium text-gray-600" }, "OTP code", -1)),
|
|
234
|
+
oe(l("input", {
|
|
235
|
+
"onUpdate:modelValue": i[0] || (i[0] = (g) => n.account.otp = g),
|
|
236
|
+
type: "text",
|
|
237
|
+
maxlength: "6",
|
|
238
|
+
placeholder: "6-digit OTP",
|
|
239
|
+
class: "w-full rounded border border-gray-300 px-3 py-2 text-lg tracking-widest"
|
|
240
|
+
}, null, 512), [
|
|
241
|
+
[re, n.account.otp]
|
|
242
|
+
])
|
|
243
|
+
]),
|
|
244
|
+
l("button", {
|
|
245
|
+
type: "button",
|
|
246
|
+
class: X(ve),
|
|
247
|
+
disabled: !C.value || n.disabled,
|
|
248
|
+
onClick: w
|
|
249
|
+
}, " Verify OTP ", 8, qe)
|
|
250
|
+
])
|
|
251
|
+
])) : (c(), p("button", {
|
|
252
|
+
key: 0,
|
|
253
|
+
type: "button",
|
|
254
|
+
class: X(ve),
|
|
255
|
+
disabled: !S.value || n.disabled,
|
|
256
|
+
onClick: h
|
|
257
|
+
}, M($.value ? "Sending OTP…" : "Send OTP"), 9, Ge))
|
|
258
|
+
], 64)) : P("", !0)
|
|
259
|
+
])) : P("", !0),
|
|
260
|
+
n.account.edoc_status === "failed" ? (c(), p("div", Ye, "Statement retrieval failed. Please try again or upload manually.")) : P("", !0),
|
|
261
|
+
n.account.edoc_status === "processing" ? (c(), p("div", Ze, "Processing…")) : P("", !0)
|
|
262
|
+
]);
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
function tt(n) {
|
|
267
|
+
if (!n || typeof n != "object") return [];
|
|
268
|
+
const k = n, e = k.success ? k.data : k.data ?? k;
|
|
269
|
+
return Array.isArray(e) ? e : e && typeof e == "object" && Array.isArray(e.data) ? e.data : [];
|
|
270
|
+
}
|
|
271
|
+
function be(n, k) {
|
|
272
|
+
return n === void 0 ? k : typeof n == "function" ? n() : n;
|
|
273
|
+
}
|
|
274
|
+
function at(n) {
|
|
275
|
+
const { get: k, getBanksUrl: e, fallbackBanksUrl: f } = n, d = I([]), $ = I([]), B = I(!1), u = I(null);
|
|
276
|
+
let x = null;
|
|
277
|
+
return {
|
|
278
|
+
edocBanks: d,
|
|
279
|
+
banks: $,
|
|
280
|
+
loading: B,
|
|
281
|
+
error: u,
|
|
282
|
+
loadBanksForStatement: async () => d.value.length > 0 ? d.value : x || (B.value = !0, u.value = null, x = (async () => {
|
|
283
|
+
var O, S;
|
|
284
|
+
try {
|
|
285
|
+
const C = await k(be(e, Q.getBanks())), F = tt(C == null ? void 0 : C.data);
|
|
286
|
+
if (F.length)
|
|
287
|
+
return d.value = $.value = F, F;
|
|
288
|
+
} catch {
|
|
289
|
+
}
|
|
290
|
+
const _ = f != null ? be(f, "") : "";
|
|
291
|
+
if (_)
|
|
292
|
+
try {
|
|
293
|
+
const C = await k(_), F = Array.isArray(C == null ? void 0 : C.data) ? C.data : [];
|
|
294
|
+
return d.value = $.value = F, F;
|
|
295
|
+
} catch (C) {
|
|
296
|
+
throw u.value = ((S = (O = C == null ? void 0 : C.response) == null ? void 0 : O.data) == null ? void 0 : S.message) ?? "Failed to load banks", C;
|
|
297
|
+
}
|
|
298
|
+
return [];
|
|
299
|
+
})().finally(() => {
|
|
300
|
+
B.value = !1, x = null;
|
|
301
|
+
}), x),
|
|
302
|
+
invalidateCache: () => {
|
|
303
|
+
d.value = $.value = [], x = null, u.value = null;
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
const J = I({});
|
|
308
|
+
function nt(n) {
|
|
309
|
+
const k = () => typeof n == "function" && n.length === 0 ? n() : n, e = (u) => `${u.bank ?? ""}_${u.account_number ?? ""}`, f = (u) => {
|
|
310
|
+
const x = e(u);
|
|
311
|
+
return J.value[x] ?? {
|
|
312
|
+
isLoading: !1,
|
|
313
|
+
isSuccess: !1,
|
|
314
|
+
isError: !1
|
|
315
|
+
};
|
|
316
|
+
}, d = (u) => {
|
|
317
|
+
u.account_name = "";
|
|
318
|
+
}, $ = async (u) => {
|
|
319
|
+
const x = u.bank, A = u.account_number, _ = e(u), O = k();
|
|
320
|
+
if (!O || !x || !A || A.length !== 10) {
|
|
321
|
+
delete J.value[_], (A == null ? void 0 : A.length) !== 10 && d(u);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
d(u), J.value[_] = { isLoading: !0, isSuccess: !1, isError: !1 };
|
|
325
|
+
try {
|
|
326
|
+
const S = await O(A, x), C = (S == null ? void 0 : S.account_name) ?? (S == null ? void 0 : S.accountName) ?? "";
|
|
327
|
+
C ? (u.account_name = C, J.value[_] = { isLoading: !1, isSuccess: !0, isError: !1 }) : J.value[_] = {
|
|
328
|
+
isLoading: !1,
|
|
329
|
+
isSuccess: !1,
|
|
330
|
+
isError: !0,
|
|
331
|
+
errorMessage: "Account verification failed"
|
|
332
|
+
};
|
|
333
|
+
} catch (S) {
|
|
334
|
+
J.value[_] = {
|
|
335
|
+
isLoading: !1,
|
|
336
|
+
isSuccess: !1,
|
|
337
|
+
isError: !0,
|
|
338
|
+
errorMessage: S instanceof Error ? S.message : "Verification failed"
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
return {
|
|
343
|
+
handleAccountVerification: $,
|
|
344
|
+
retryVerification: (u) => $(u),
|
|
345
|
+
getVerificationState: f,
|
|
346
|
+
clearAccountName: d
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
const ge = "/api/loan-applications";
|
|
350
|
+
function ot(n, k = "") {
|
|
351
|
+
const e = k ? `${k.replace(/\/$/, "")}${ge}` : ge, f = String(n);
|
|
352
|
+
return {
|
|
353
|
+
index: `${e}/${f}/bank-statements`,
|
|
354
|
+
store: `${e}/${f}/bank-statements`,
|
|
355
|
+
update: (d) => `${e}/${f}/bank-statements/${d}`,
|
|
356
|
+
destroy: (d) => `${e}/${f}/bank-statements/${d}`,
|
|
357
|
+
uploadToEdoc: (d) => `${e}/${f}/bank-statements/${d}/upload-to-edoc`
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
const st = {
|
|
361
|
+
urls: ot
|
|
362
|
+
}, ye = "", le = {
|
|
363
|
+
upload: () => `${ye}/api/files/upload`,
|
|
364
|
+
view: (n) => `${ye}/api/files/view?path=${encodeURIComponent(n)}`
|
|
365
|
+
}, it = ["id", "disabled"], lt = { class: "truncate text-left" }, rt = {
|
|
366
|
+
key: 0,
|
|
367
|
+
class: "absolute z-[1000] mt-1 w-full rounded-lg border border-gray-200 bg-white shadow-lg"
|
|
368
|
+
}, dt = { class: "border-b border-gray-100 p-2" }, ut = { class: "relative" }, ct = { class: "max-h-48 overflow-auto py-1" }, pt = ["onClick"], mt = {
|
|
369
|
+
key: 0,
|
|
370
|
+
class: "px-3 py-2 text-center text-sm italic text-gray-500"
|
|
371
|
+
}, ft = /* @__PURE__ */ q({
|
|
372
|
+
__name: "BankSelect",
|
|
373
|
+
props: {
|
|
374
|
+
modelValue: {},
|
|
375
|
+
options: {},
|
|
376
|
+
placeholder: { default: "Select bank" },
|
|
377
|
+
disabled: { type: Boolean, default: !1 },
|
|
378
|
+
id: {}
|
|
379
|
+
},
|
|
380
|
+
emits: ["update:modelValue"],
|
|
381
|
+
setup(n, { emit: k }) {
|
|
382
|
+
const e = n, f = k, d = I(!1), $ = I(null), B = I(null), u = I(""), x = I(-1);
|
|
383
|
+
function A(h, w) {
|
|
384
|
+
if (!w) return !0;
|
|
385
|
+
const v = [
|
|
386
|
+
h.label,
|
|
387
|
+
h.shortName,
|
|
388
|
+
...h.searchKeywords ?? []
|
|
389
|
+
].filter((i) => i != null && String(i).trim() !== "").map((i) => String(i).toLowerCase());
|
|
390
|
+
if (v.some((i) => i.includes(w))) return !0;
|
|
391
|
+
const o = w.split(/\s+/).filter(Boolean);
|
|
392
|
+
return o.length > 1 ? o.every((i) => v.some((b) => b.includes(i))) : v.some((i) => i.startsWith(w));
|
|
393
|
+
}
|
|
394
|
+
const _ = V(() => {
|
|
395
|
+
var w;
|
|
396
|
+
if (!((w = e.options) != null && w.length)) return [];
|
|
397
|
+
if (!u.value.trim()) return e.options;
|
|
398
|
+
const h = u.value.toLowerCase().trim();
|
|
399
|
+
return e.options.filter((v) => A(v, h));
|
|
400
|
+
}), O = V(
|
|
401
|
+
() => {
|
|
402
|
+
var h;
|
|
403
|
+
return ((h = e.options) == null ? void 0 : h.find((w) => String(w.value) === String(e.modelValue))) ?? null;
|
|
404
|
+
}
|
|
405
|
+
), S = V(() => {
|
|
406
|
+
var h;
|
|
407
|
+
return ((h = O.value) == null ? void 0 : h.label) ?? e.placeholder;
|
|
408
|
+
});
|
|
409
|
+
function C() {
|
|
410
|
+
e.disabled || (d.value = !d.value, d.value && (u.value = "", x.value = _.value.length ? 0 : -1, Ue(() => {
|
|
411
|
+
var h;
|
|
412
|
+
return (h = B.value) == null ? void 0 : h.focus();
|
|
413
|
+
})));
|
|
414
|
+
}
|
|
415
|
+
function F(h) {
|
|
416
|
+
f("update:modelValue", String(h.value)), d.value = !1, u.value = "";
|
|
417
|
+
}
|
|
418
|
+
function G(h) {
|
|
419
|
+
if (!d.value) return;
|
|
420
|
+
const w = _.value;
|
|
421
|
+
switch (h.key) {
|
|
422
|
+
case "ArrowDown":
|
|
423
|
+
h.preventDefault(), x.value = Math.min(x.value + 1, w.length - 1);
|
|
424
|
+
break;
|
|
425
|
+
case "ArrowUp":
|
|
426
|
+
h.preventDefault(), x.value = Math.max(x.value - 1, 0);
|
|
427
|
+
break;
|
|
428
|
+
case "Enter":
|
|
429
|
+
h.preventDefault(), x.value >= 0 && w[x.value] && F(w[x.value]);
|
|
430
|
+
break;
|
|
431
|
+
case "Escape":
|
|
432
|
+
h.preventDefault(), d.value = !1;
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
function y(h) {
|
|
437
|
+
$.value && !$.value.contains(h.target) && (d.value = !1);
|
|
438
|
+
}
|
|
439
|
+
return de(u, () => {
|
|
440
|
+
x.value = _.value.length ? 0 : -1;
|
|
441
|
+
}), he(() => {
|
|
442
|
+
typeof document < "u" && document.addEventListener("click", y);
|
|
443
|
+
}), ke(() => {
|
|
444
|
+
typeof document < "u" && document.removeEventListener("click", y);
|
|
445
|
+
}), (h, w) => (c(), p("div", {
|
|
446
|
+
ref_key: "selectRef",
|
|
447
|
+
ref: $,
|
|
448
|
+
class: "relative"
|
|
449
|
+
}, [
|
|
450
|
+
l("button", {
|
|
451
|
+
type: "button",
|
|
452
|
+
id: n.id,
|
|
453
|
+
disabled: n.disabled,
|
|
454
|
+
class: X(z(ie)(
|
|
455
|
+
"flex h-9 w-full min-w-0 items-center justify-between rounded-lg border border-gray-300 bg-white px-3 py-2.5 text-sm transition-colors outline-none",
|
|
456
|
+
"focus:border-[var(--boi-primary)] focus:ring-1 focus:ring-[var(--boi-primary)]",
|
|
457
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
458
|
+
!O.value && "text-gray-500"
|
|
459
|
+
)),
|
|
460
|
+
onClick: C
|
|
461
|
+
}, [
|
|
462
|
+
l("span", lt, M(S.value), 1),
|
|
463
|
+
(c(), p("svg", {
|
|
464
|
+
class: X(["h-4 w-4 shrink-0 text-gray-400", { "rotate-180": d.value }]),
|
|
465
|
+
fill: "none",
|
|
466
|
+
stroke: "currentColor",
|
|
467
|
+
viewBox: "0 0 24 24"
|
|
468
|
+
}, [...w[1] || (w[1] = [
|
|
469
|
+
l("path", {
|
|
470
|
+
"stroke-linecap": "round",
|
|
471
|
+
"stroke-linejoin": "round",
|
|
472
|
+
"stroke-width": "2",
|
|
473
|
+
d: "M19 9l-7 7-7-7"
|
|
474
|
+
}, null, -1)
|
|
475
|
+
])], 2))
|
|
476
|
+
], 10, it),
|
|
477
|
+
d.value ? (c(), p("div", rt, [
|
|
478
|
+
l("div", dt, [
|
|
479
|
+
l("div", ut, [
|
|
480
|
+
w[2] || (w[2] = l("svg", {
|
|
481
|
+
class: "absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400",
|
|
482
|
+
fill: "none",
|
|
483
|
+
stroke: "currentColor",
|
|
484
|
+
viewBox: "0 0 24 24"
|
|
485
|
+
}, [
|
|
486
|
+
l("path", {
|
|
487
|
+
"stroke-linecap": "round",
|
|
488
|
+
"stroke-linejoin": "round",
|
|
489
|
+
"stroke-width": "2",
|
|
490
|
+
d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
491
|
+
})
|
|
492
|
+
], -1)),
|
|
493
|
+
oe(l("input", {
|
|
494
|
+
ref_key: "searchRef",
|
|
495
|
+
ref: B,
|
|
496
|
+
"onUpdate:modelValue": w[0] || (w[0] = (v) => u.value = v),
|
|
497
|
+
type: "text",
|
|
498
|
+
placeholder: "Type to search...",
|
|
499
|
+
class: "w-full rounded-md border-0 bg-gray-50 py-2 pl-9 pr-3 text-sm focus:bg-white focus:ring-1 focus:ring-[var(--boi-primary)]",
|
|
500
|
+
onKeydown: G
|
|
501
|
+
}, null, 544), [
|
|
502
|
+
[re, u.value]
|
|
503
|
+
])
|
|
504
|
+
])
|
|
505
|
+
]),
|
|
506
|
+
l("div", ct, [
|
|
507
|
+
(c(!0), p(W, null, te(_.value, (v, o) => (c(), p("button", {
|
|
508
|
+
key: v.value,
|
|
509
|
+
type: "button",
|
|
510
|
+
class: X(z(ie)(
|
|
511
|
+
"w-full cursor-pointer px-3 py-2.5 text-left text-sm transition-colors text-gray-900",
|
|
512
|
+
o === x.value ? "bg-gray-100" : "hover:bg-gray-50",
|
|
513
|
+
String(v.value) === String(n.modelValue) && n.modelValue !== "" && n.modelValue !== void 0 && "font-semibold text-[#016837]"
|
|
514
|
+
)),
|
|
515
|
+
onClick: (i) => F(v)
|
|
516
|
+
}, M(v.label), 11, pt))), 128)),
|
|
517
|
+
_.value.length === 0 ? (c(), p("p", mt, ' No options found for "' + M(u.value) + '" ', 1)) : P("", !0)
|
|
518
|
+
])
|
|
519
|
+
])) : P("", !0)
|
|
520
|
+
], 512));
|
|
521
|
+
}
|
|
522
|
+
}), vt = { class: "boi-file-input w-full space-y-2" }, bt = ["accept", "disabled", "id"], gt = { class: "truncate text-sm text-gray-600" }, yt = {
|
|
523
|
+
key: 0,
|
|
524
|
+
class: "text-sm text-red-600"
|
|
525
|
+
}, ht = {
|
|
526
|
+
key: 1,
|
|
527
|
+
class: "text-xs text-gray-500"
|
|
528
|
+
}, kt = ["href"], xt = /* @__PURE__ */ q({
|
|
529
|
+
__name: "FileInput",
|
|
530
|
+
props: {
|
|
531
|
+
modelValue: { default: "" },
|
|
532
|
+
placeholder: { default: "Choose file" },
|
|
533
|
+
accept: { default: "*/*" },
|
|
534
|
+
disabled: { type: Boolean, default: !1 },
|
|
535
|
+
id: {},
|
|
536
|
+
maxSize: { default: 10 * 1024 * 1024 },
|
|
537
|
+
allowedTypes: { default: () => [
|
|
538
|
+
"application/pdf",
|
|
539
|
+
"image/jpeg",
|
|
540
|
+
"image/jpg",
|
|
541
|
+
"image/png",
|
|
542
|
+
"application/msword",
|
|
543
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
544
|
+
"application/vnd.ms-excel",
|
|
545
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
546
|
+
"text/plain",
|
|
547
|
+
"text/csv"
|
|
548
|
+
] },
|
|
549
|
+
uploadToServer: { type: Boolean, default: !0 },
|
|
550
|
+
showRequirements: { type: Boolean, default: !0 },
|
|
551
|
+
uploadContext: {},
|
|
552
|
+
afterUpload: {},
|
|
553
|
+
uploadUrl: {},
|
|
554
|
+
viewApiBase: {},
|
|
555
|
+
viewStoragePath: {},
|
|
556
|
+
post: {}
|
|
557
|
+
},
|
|
558
|
+
emits: ["update:modelValue", "validation-error", "validation-success", "uploaded"],
|
|
559
|
+
setup(n, { emit: k }) {
|
|
560
|
+
const e = n, f = k, d = I(), $ = I(!1), B = I(""), u = I(""), x = {
|
|
561
|
+
"application/pdf": "PDF",
|
|
562
|
+
"image/jpeg": "JPG",
|
|
563
|
+
"image/jpg": "JPG",
|
|
564
|
+
"image/png": "PNG",
|
|
565
|
+
"application/msword": "DOC",
|
|
566
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "DOCX",
|
|
567
|
+
"application/vnd.ms-excel": "XLS",
|
|
568
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "XLSX",
|
|
569
|
+
"text/plain": "TXT",
|
|
570
|
+
"text/csv": "CSV"
|
|
571
|
+
}, A = {
|
|
572
|
+
pdf: ["application/pdf"],
|
|
573
|
+
jpg: ["image/jpeg", "image/jpg"],
|
|
574
|
+
jpeg: ["image/jpeg", "image/jpg"],
|
|
575
|
+
png: ["image/png"],
|
|
576
|
+
doc: ["application/msword"],
|
|
577
|
+
docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
578
|
+
xls: ["application/vnd.ms-excel"],
|
|
579
|
+
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
580
|
+
txt: ["text/plain"],
|
|
581
|
+
csv: ["text/csv"]
|
|
582
|
+
}, _ = V(
|
|
583
|
+
() => [...new Set(e.allowedTypes.map((v) => {
|
|
584
|
+
var o;
|
|
585
|
+
return x[v] || ((o = v.split("/")[1]) == null ? void 0 : o.toUpperCase()) || v;
|
|
586
|
+
}))].join(", ")
|
|
587
|
+
), O = V(() => Math.round(e.maxSize / (1024 * 1024))), S = V(() => e.disabled || $.value), C = V(() => String(e.viewApiBase ?? "").trim().replace(/\/$/, "")), F = V(() => {
|
|
588
|
+
const v = String(e.viewStoragePath ?? "").trim();
|
|
589
|
+
return v || String(e.modelValue ?? "").trim();
|
|
590
|
+
}), G = V(() => {
|
|
591
|
+
const v = F.value;
|
|
592
|
+
if (!v || !e.uploadToServer) return "#";
|
|
593
|
+
const o = encodeURIComponent(v), i = C.value;
|
|
594
|
+
return i ? `${i}/api/files/view?path=${o}` : le.view(v);
|
|
595
|
+
});
|
|
596
|
+
function y(v) {
|
|
597
|
+
var o;
|
|
598
|
+
if (u.value = "", v.size > e.maxSize) {
|
|
599
|
+
const i = `File size must be less than ${O.value}MB`;
|
|
600
|
+
return u.value = i, f("validation-error", i), !1;
|
|
601
|
+
}
|
|
602
|
+
if (e.allowedTypes.length) {
|
|
603
|
+
const i = ((o = v.name.split(".").pop()) == null ? void 0 : o.toLowerCase()) || "";
|
|
604
|
+
if (!(e.allowedTypes.includes(v.type) || (A[i] || []).some((g) => e.allowedTypes.includes(g)))) {
|
|
605
|
+
const g = `Only ${_.value} files are allowed`;
|
|
606
|
+
return u.value = g, f("validation-error", g), !1;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
return !0;
|
|
610
|
+
}
|
|
611
|
+
async function h(v) {
|
|
612
|
+
var b, g, D, T;
|
|
613
|
+
u.value = "";
|
|
614
|
+
const o = v.target, i = (b = o.files) == null ? void 0 : b[0];
|
|
615
|
+
if (!i) {
|
|
616
|
+
B.value = "", f("update:modelValue", "");
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
if (!y(i)) {
|
|
620
|
+
o.value = "", B.value = "", f("update:modelValue", "");
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
if (e.uploadToServer && e.post) {
|
|
624
|
+
$.value = !0;
|
|
625
|
+
const N = e.uploadUrl ?? le.upload(), K = new FormData();
|
|
626
|
+
K.append("file", i), K.append("folder", "documents"), e.uploadContext && K.append("context", e.uploadContext);
|
|
627
|
+
try {
|
|
628
|
+
const L = await e.post(N, K, { headers: { "Content-Type": "multipart/form-data" } }), U = L == null ? void 0 : L.data;
|
|
629
|
+
if (U != null && U.success && (U != null && U.path))
|
|
630
|
+
B.value = i.name, U.url && console.log("[FileInput] S3 URL:", U.url), f("update:modelValue", U.path), f("validation-success", "File uploaded successfully"), f("uploaded", U.path), (g = e.afterUpload) == null || g.call(e, U.path);
|
|
631
|
+
else {
|
|
632
|
+
const ae = (U == null ? void 0 : U.message) ?? "Upload failed";
|
|
633
|
+
u.value = ae, f("validation-error", ae), o.value = "", B.value = "", f("update:modelValue", "");
|
|
634
|
+
}
|
|
635
|
+
} catch (L) {
|
|
636
|
+
const U = ((T = (D = L == null ? void 0 : L.response) == null ? void 0 : D.data) == null ? void 0 : T.message) ?? (L == null ? void 0 : L.message) ?? "Upload failed";
|
|
637
|
+
u.value = U, f("validation-error", U), o.value = "", B.value = "", f("update:modelValue", "");
|
|
638
|
+
} finally {
|
|
639
|
+
$.value = !1;
|
|
640
|
+
}
|
|
641
|
+
} else
|
|
642
|
+
B.value = i.name, f("update:modelValue", i.name), f("uploaded", i.name);
|
|
643
|
+
}
|
|
644
|
+
function w() {
|
|
645
|
+
!S.value && d.value && d.value.click();
|
|
646
|
+
}
|
|
647
|
+
return de(() => e.modelValue, (v) => {
|
|
648
|
+
B.value = (typeof v == "string" && v ? v.split("/").pop() : "") || "";
|
|
649
|
+
}, { immediate: !0 }), (v, o) => (c(), p("div", vt, [
|
|
650
|
+
l("input", {
|
|
651
|
+
ref_key: "fileInput",
|
|
652
|
+
ref: d,
|
|
653
|
+
type: "file",
|
|
654
|
+
accept: n.accept,
|
|
655
|
+
disabled: S.value,
|
|
656
|
+
id: n.id,
|
|
657
|
+
class: "hidden",
|
|
658
|
+
onChange: h
|
|
659
|
+
}, null, 40, bt),
|
|
660
|
+
l("div", {
|
|
661
|
+
class: X([
|
|
662
|
+
"flex w-full items-center justify-between rounded-md border border-gray-300 bg-white px-3 py-2 transition-colors",
|
|
663
|
+
S.value ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-gray-50",
|
|
664
|
+
u.value ? "border-red-500" : ""
|
|
665
|
+
]),
|
|
666
|
+
onClick: w
|
|
667
|
+
}, [
|
|
668
|
+
l("span", gt, M($.value ? "Uploading..." : B.value || n.placeholder), 1),
|
|
669
|
+
o[0] || (o[0] = l("span", { class: "text-gray-400" }, "📎", -1))
|
|
670
|
+
], 2),
|
|
671
|
+
u.value ? (c(), p("p", yt, M(u.value), 1)) : P("", !0),
|
|
672
|
+
n.showRequirements ? (c(), p("p", ht, "Max " + M(O.value) + " MB. Allowed: " + M(_.value) + ".", 1)) : P("", !0),
|
|
673
|
+
F.value && !$.value && n.uploadToServer ? (c(), p("a", {
|
|
674
|
+
key: 2,
|
|
675
|
+
href: G.value,
|
|
676
|
+
target: "_blank",
|
|
677
|
+
rel: "noopener noreferrer",
|
|
678
|
+
class: "text-sm text-blue-600 hover:underline"
|
|
679
|
+
}, " View document >>> ", 8, kt)) : P("", !0)
|
|
680
|
+
]));
|
|
681
|
+
}
|
|
682
|
+
}), wt = ["disabled"], _t = { class: "px-4 pb-4 md:px-6 md:pb-6" }, St = { class: "mb-6 rounded-lg border border-blue-200 bg-blue-50 p-4 text-sm" }, $t = { class: "text-blue-900" }, Bt = {
|
|
683
|
+
key: 0,
|
|
684
|
+
class: "mt-3 rounded-md bg-white/80 border border-blue-100 p-3"
|
|
685
|
+
}, Ct = { class: "list-inside list-disc space-y-0.5 text-xs text-blue-800 columns-2 gap-x-4" }, At = {
|
|
686
|
+
key: 1,
|
|
687
|
+
class: "mt-2 text-xs text-blue-700"
|
|
688
|
+
}, It = {
|
|
689
|
+
key: 0,
|
|
690
|
+
class: "flex items-center justify-center py-10"
|
|
691
|
+
}, Vt = {
|
|
692
|
+
key: 0,
|
|
693
|
+
class: "flex overflow-x-auto pb-2 gap-1 -mx-1"
|
|
694
|
+
}, Ut = ["onClick"], Pt = { class: "flex items-center justify-between gap-4" }, Ot = { class: "border-b-2 border-primary pb-1 text-base font-semibold text-slate-900" }, Et = ["disabled", "onClick"], Ft = { class: "grid grid-cols-1 gap-4 md:grid-cols-3" }, Dt = ["onUpdate:modelValue", "onBlur"], Tt = ["value"], jt = {
|
|
695
|
+
key: 0,
|
|
696
|
+
class: "mt-1.5 flex flex-wrap items-center gap-2 text-xs"
|
|
697
|
+
}, Mt = {
|
|
698
|
+
key: 0,
|
|
699
|
+
class: "text-blue-600"
|
|
700
|
+
}, Lt = {
|
|
701
|
+
key: 1,
|
|
702
|
+
class: "text-green-600"
|
|
703
|
+
}, zt = {
|
|
704
|
+
key: 2,
|
|
705
|
+
class: "flex items-center gap-1"
|
|
706
|
+
}, Rt = { class: "text-red-600" }, Nt = ["onClick"], Kt = {
|
|
707
|
+
key: 0,
|
|
708
|
+
class: "boi-emts-wrapper"
|
|
709
|
+
}, Xt = {
|
|
710
|
+
key: 0,
|
|
711
|
+
class: "mt-3 text-sm font-medium text-green-800"
|
|
712
|
+
}, Wt = {
|
|
713
|
+
key: 1,
|
|
714
|
+
class: "rounded-lg border border-gray-200 bg-white p-4"
|
|
715
|
+
}, Gt = { class: "rounded-lg py-3" }, Ht = { class: "flex items-center gap-2" }, Jt = {
|
|
716
|
+
key: 0,
|
|
717
|
+
class: "inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent",
|
|
718
|
+
"aria-hidden": "true"
|
|
719
|
+
}, Qt = {
|
|
720
|
+
key: 0,
|
|
721
|
+
class: "mt-1.5 text-sm text-amber-700"
|
|
722
|
+
}, qt = {
|
|
723
|
+
key: 1,
|
|
724
|
+
class: "mt-1.5 text-sm text-red-600"
|
|
725
|
+
}, Yt = {
|
|
726
|
+
key: 2,
|
|
727
|
+
class: "rounded-lg border border-red-200 bg-red-50 p-4 flex items-start gap-3"
|
|
728
|
+
}, Zt = { class: "flex-1 text-sm text-red-800" }, ea = { class: "flex justify-center" }, na = /* @__PURE__ */ q({
|
|
729
|
+
__name: "BankStatementIntegration",
|
|
730
|
+
props: {
|
|
731
|
+
applicationId: {},
|
|
732
|
+
api: {},
|
|
733
|
+
bankOptions: {},
|
|
734
|
+
formData: {},
|
|
735
|
+
industrialSectorOptions: {},
|
|
736
|
+
baseUrl: { default: "" },
|
|
737
|
+
integrationBaseUrl: { default: "" },
|
|
738
|
+
isFormDisabled: { type: Boolean, default: !1 },
|
|
739
|
+
maxAccounts: { default: 5 },
|
|
740
|
+
verifyBankAccount: { type: [Function, null], default: null },
|
|
741
|
+
blockAutoSave: {},
|
|
742
|
+
unblockAutoSave: {},
|
|
743
|
+
pollEdocStatus: { type: Boolean, default: !0 }
|
|
744
|
+
},
|
|
745
|
+
emits: ["error"],
|
|
746
|
+
setup(n, { emit: k }) {
|
|
747
|
+
const e = n, f = k;
|
|
748
|
+
function d(t) {
|
|
749
|
+
const a = (e.integrationBaseUrl ?? "").replace(/\/$/, "");
|
|
750
|
+
if (!a) return t;
|
|
751
|
+
const s = t.startsWith("/") ? t : `/${t}`;
|
|
752
|
+
return `${a}${s}`;
|
|
753
|
+
}
|
|
754
|
+
const { edocBanks: $, loadBanksForStatement: B } = at({
|
|
755
|
+
get: e.api.get,
|
|
756
|
+
getBanksUrl: () => d(Q.getBanks())
|
|
757
|
+
}), {
|
|
758
|
+
handleAccountVerification: u,
|
|
759
|
+
retryVerification: x,
|
|
760
|
+
getVerificationState: A
|
|
761
|
+
} = nt(() => e.verifyBankAccount), _ = I(0), O = I(""), S = I(!1), C = I(null);
|
|
762
|
+
function F() {
|
|
763
|
+
var t;
|
|
764
|
+
(t = e.blockAutoSave) == null || t.call(e);
|
|
765
|
+
}
|
|
766
|
+
function G() {
|
|
767
|
+
setTimeout(() => {
|
|
768
|
+
var a;
|
|
769
|
+
const t = C.value;
|
|
770
|
+
t && !t.contains(document.activeElement) && ((a = e.unblockAutoSave) == null || a.call(e));
|
|
771
|
+
}, 0);
|
|
772
|
+
}
|
|
773
|
+
const y = I([]), h = I(!1);
|
|
774
|
+
let w = null;
|
|
775
|
+
const v = V(
|
|
776
|
+
() => {
|
|
777
|
+
var t, a;
|
|
778
|
+
return ((t = e.integrationBaseUrl) == null ? void 0 : t.replace(/\/$/, "")) || ((a = e.baseUrl) == null ? void 0 : a.replace(/\/$/, "")) || "";
|
|
779
|
+
}
|
|
780
|
+
), o = V(
|
|
781
|
+
() => e.applicationId ? st.urls(e.applicationId, v.value) : null
|
|
782
|
+
), i = V(
|
|
783
|
+
() => e.integrationBaseUrl ? d(le.upload()) : void 0
|
|
784
|
+
), b = V(() => (e.integrationBaseUrl ?? "").trim().replace(/\/$/, "")), g = V(
|
|
785
|
+
() => y.value.slice(0, e.maxAccounts)
|
|
786
|
+
), D = V(() => y.value.length < e.maxAccounts), T = V(() => y.value.length > 0), N = V(() => {
|
|
787
|
+
var t;
|
|
788
|
+
return ((t = e.formData) == null ? void 0 : t.email) ?? "";
|
|
789
|
+
});
|
|
790
|
+
function K() {
|
|
791
|
+
var s, m;
|
|
792
|
+
const t = (s = e.formData) == null ? void 0 : s.industrial_sector_id;
|
|
793
|
+
if (t == null) return;
|
|
794
|
+
const a = (m = e.industrialSectorOptions) == null ? void 0 : m.find(
|
|
795
|
+
(r) => r.value === t || r.id === t || r.value === String(t)
|
|
796
|
+
);
|
|
797
|
+
return (a == null ? void 0 : a.label) ?? (a == null ? void 0 : a.name);
|
|
798
|
+
}
|
|
799
|
+
function L(t) {
|
|
800
|
+
if (t == null || t === "") return !1;
|
|
801
|
+
const a = t.trim().toLowerCase();
|
|
802
|
+
return a.includes("edoc/statements/") && a.endsWith(".csv");
|
|
803
|
+
}
|
|
804
|
+
function U(t) {
|
|
805
|
+
const a = (t ?? "").trim();
|
|
806
|
+
return !a || L(a) ? "" : a;
|
|
807
|
+
}
|
|
808
|
+
function ae(t) {
|
|
809
|
+
var m, r;
|
|
810
|
+
const a = (m = t.uploaded_statement_path) == null ? void 0 : m.trim();
|
|
811
|
+
if (a) return a;
|
|
812
|
+
const s = ((r = t.bank_statement) == null ? void 0 : r.trim()) ?? "";
|
|
813
|
+
return s && !L(s) ? s : "";
|
|
814
|
+
}
|
|
815
|
+
function xe(t, a) {
|
|
816
|
+
t.uploaded_statement_path = a.trim(), Z(t);
|
|
817
|
+
}
|
|
818
|
+
function ue(t, a) {
|
|
819
|
+
var r;
|
|
820
|
+
const s = ((r = e.bankOptions.find((E) => E.value === t.bank)) == null ? void 0 : r.label) ?? "", m = t.account_number ?? "";
|
|
821
|
+
return s && m ? `${s} (${m})` : s || (m ? `Account (${m})` : `Account ${a + 1}`);
|
|
822
|
+
}
|
|
823
|
+
function we(t) {
|
|
824
|
+
const a = {
|
|
825
|
+
pending: "bg-gray-100 text-gray-800",
|
|
826
|
+
processing: "bg-amber-100 text-amber-800",
|
|
827
|
+
completed: "bg-green-100 text-green-800",
|
|
828
|
+
failed: "bg-red-100 text-red-800"
|
|
829
|
+
};
|
|
830
|
+
return a[t] ?? a.pending;
|
|
831
|
+
}
|
|
832
|
+
async function _e() {
|
|
833
|
+
if (o.value)
|
|
834
|
+
try {
|
|
835
|
+
h.value = !0;
|
|
836
|
+
const t = await e.api.get(o.value.index), a = t == null ? void 0 : t.data;
|
|
837
|
+
a != null && a.success && Array.isArray(a.data) && (y.value = a.data.map((s) => ({
|
|
838
|
+
...s,
|
|
839
|
+
otp: "",
|
|
840
|
+
showOtpInput: !1,
|
|
841
|
+
uploaded_statement_path: U(s.bank_statement)
|
|
842
|
+
})));
|
|
843
|
+
} catch (t) {
|
|
844
|
+
console.error("Failed to load bank statements", t);
|
|
845
|
+
} finally {
|
|
846
|
+
h.value = !1;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
async function Se() {
|
|
850
|
+
if (o.value)
|
|
851
|
+
try {
|
|
852
|
+
const t = await e.api.get(o.value.index), a = t == null ? void 0 : t.data;
|
|
853
|
+
if (!(a != null && a.success) || !Array.isArray(a.data)) return;
|
|
854
|
+
const s = ["edoc_status", "consent_id", "csv_url", "statement_generated"];
|
|
855
|
+
y.value = y.value.map((m) => {
|
|
856
|
+
const r = a.data.find((j) => j.id === m.id);
|
|
857
|
+
if (!r) return m;
|
|
858
|
+
const E = {};
|
|
859
|
+
for (const j of s)
|
|
860
|
+
j in r && (E[j] = r[j]);
|
|
861
|
+
let R = m.uploaded_statement_path ?? "";
|
|
862
|
+
if ("bank_statement" in r && r.bank_statement !== void 0) {
|
|
863
|
+
const j = String(r.bank_statement ?? "");
|
|
864
|
+
E.bank_statement = r.bank_statement, j && !L(j) ? R = j : j && L(j) && R || j || (R = "");
|
|
865
|
+
}
|
|
866
|
+
return E.uploaded_statement_path = R, { ...m, ...E };
|
|
867
|
+
});
|
|
868
|
+
} catch (t) {
|
|
869
|
+
console.error("Sync statements failed", t);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
function ce() {
|
|
873
|
+
Y(), w = setInterval(() => {
|
|
874
|
+
if (!y.value.some((a) => a.edoc_status === "processing")) {
|
|
875
|
+
Y();
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
Se();
|
|
879
|
+
}, 5e3);
|
|
880
|
+
}
|
|
881
|
+
function Y() {
|
|
882
|
+
w && (clearInterval(w), w = null);
|
|
883
|
+
}
|
|
884
|
+
de(
|
|
885
|
+
() => y.value.some((t) => t.edoc_status === "processing"),
|
|
886
|
+
(t) => {
|
|
887
|
+
if (!e.pollEdocStatus) {
|
|
888
|
+
Y();
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
t ? ce() : Y();
|
|
892
|
+
}
|
|
893
|
+
);
|
|
894
|
+
async function Z(t) {
|
|
895
|
+
if (!(!o.value || t.id < 0))
|
|
896
|
+
try {
|
|
897
|
+
await e.api.put(o.value.update(t.id), {
|
|
898
|
+
bank: t.bank,
|
|
899
|
+
account_number: t.account_number,
|
|
900
|
+
account_name: t.account_name,
|
|
901
|
+
account_type: t.account_type,
|
|
902
|
+
bvn: t.bvn,
|
|
903
|
+
email: t.email,
|
|
904
|
+
bank_statement: t.bank_statement
|
|
905
|
+
});
|
|
906
|
+
} catch (a) {
|
|
907
|
+
console.error("Failed to save bank statement", a);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
async function $e() {
|
|
911
|
+
if (!o.value || !D.value) return;
|
|
912
|
+
const t = -Date.now(), a = {
|
|
913
|
+
id: t,
|
|
914
|
+
loan_application_id: Number(e.applicationId),
|
|
915
|
+
bank: "",
|
|
916
|
+
account_number: "",
|
|
917
|
+
account_name: "",
|
|
918
|
+
account_type: "",
|
|
919
|
+
bvn: "",
|
|
920
|
+
email: N.value,
|
|
921
|
+
bank_statement: "",
|
|
922
|
+
csv_url: "",
|
|
923
|
+
consent_id: "",
|
|
924
|
+
edoc_status: "pending",
|
|
925
|
+
statement_generated: !1,
|
|
926
|
+
otp: "",
|
|
927
|
+
showOtpInput: !1,
|
|
928
|
+
uploaded_statement_path: ""
|
|
929
|
+
};
|
|
930
|
+
y.value.push(a), _.value = y.value.length - 1;
|
|
931
|
+
try {
|
|
932
|
+
const s = await e.api.post(o.value.store, { email: N.value }), m = s == null ? void 0 : s.data;
|
|
933
|
+
if (m != null && m.success && m.data) {
|
|
934
|
+
const r = y.value.findIndex((E) => E.id === t);
|
|
935
|
+
r !== -1 && (y.value[r] = {
|
|
936
|
+
...m.data,
|
|
937
|
+
otp: "",
|
|
938
|
+
showOtpInput: !1,
|
|
939
|
+
uploaded_statement_path: U(m.data.bank_statement)
|
|
940
|
+
});
|
|
941
|
+
} else
|
|
942
|
+
y.value = y.value.filter((r) => r.id !== t), _.value = Math.max(0, y.value.length - 1);
|
|
943
|
+
} catch (s) {
|
|
944
|
+
y.value = y.value.filter((m) => m.id !== t), _.value = Math.max(0, y.value.length - 1), f("error", (s == null ? void 0 : s.message) ?? "Failed to add account");
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
async function Be(t) {
|
|
948
|
+
if (!o.value) return;
|
|
949
|
+
const a = y.value.findIndex((r) => r.id === t.id), s = { ...t }, m = t.id < 0;
|
|
950
|
+
if (y.value = y.value.filter((r) => r.id !== t.id), _.value = Math.min(_.value, Math.max(0, y.value.length - 1)), !m)
|
|
951
|
+
try {
|
|
952
|
+
await e.api.delete(o.value.destroy(t.id));
|
|
953
|
+
} catch (r) {
|
|
954
|
+
y.value = y.value.slice(0, a).concat(s, y.value.slice(a)), f("error", (r == null ? void 0 : r.message) ?? "Failed to remove account");
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
function Ce(t, a) {
|
|
958
|
+
t.consent_id = a, t.showOtpInput = !0, Z(t);
|
|
959
|
+
}
|
|
960
|
+
function Ae(t, a) {
|
|
961
|
+
Object.assign(t, a), Z(t);
|
|
962
|
+
}
|
|
963
|
+
function Ie(t) {
|
|
964
|
+
O.value = t, f("error", t);
|
|
965
|
+
}
|
|
966
|
+
function Ve() {
|
|
967
|
+
O.value = "";
|
|
968
|
+
}
|
|
969
|
+
function pe(t) {
|
|
970
|
+
return (a) => {
|
|
971
|
+
var r;
|
|
972
|
+
if (!o.value) return;
|
|
973
|
+
(r = e.blockAutoSave) == null || r.call(e), t.edoc_status = "processing";
|
|
974
|
+
const s = K(), m = () => {
|
|
975
|
+
setTimeout(() => {
|
|
976
|
+
var E;
|
|
977
|
+
return (E = e.unblockAutoSave) == null ? void 0 : E.call(e);
|
|
978
|
+
}, 3e3);
|
|
979
|
+
};
|
|
980
|
+
e.api.post(o.value.uploadToEdoc(t.id), { filePath: a, industrialSector: s }).then((E) => {
|
|
981
|
+
var j;
|
|
982
|
+
const R = (j = E == null ? void 0 : E.data) == null ? void 0 : j.data;
|
|
983
|
+
if (R) {
|
|
984
|
+
const fe = t.uploaded_statement_path ?? "";
|
|
985
|
+
Object.assign(t, R), fe && R.bank_statement && L(String(R.bank_statement)) && (t.uploaded_statement_path = fe);
|
|
986
|
+
}
|
|
987
|
+
ce();
|
|
988
|
+
}).catch(() => {
|
|
989
|
+
t.edoc_status = "failed";
|
|
990
|
+
}).finally(m);
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
const me = (t) => {
|
|
994
|
+
if (!t || !$.value.length) return !1;
|
|
995
|
+
const a = e.bankOptions.find((m) => m.value === t), s = [(a == null ? void 0 : a.label) ?? "", ...(a == null ? void 0 : a.searchKeywords) ?? []].filter(Boolean);
|
|
996
|
+
return $.value.some((m) => {
|
|
997
|
+
const r = m.bankCode === t || m.code === t, E = s.some((R) => {
|
|
998
|
+
var j;
|
|
999
|
+
return (j = m.name) == null ? void 0 : j.toLowerCase().includes(R.toLowerCase());
|
|
1000
|
+
});
|
|
1001
|
+
return (r || E) && m.enabled !== !1;
|
|
1002
|
+
});
|
|
1003
|
+
}, se = V(
|
|
1004
|
+
() => ($.value || []).filter((t) => t.enabled !== !1).map((t) => t.name || t.bankCode || "Unknown").sort((t, a) => t.localeCompare(a))
|
|
1005
|
+
);
|
|
1006
|
+
return he(async () => {
|
|
1007
|
+
B(), e.applicationId && await _e();
|
|
1008
|
+
}), ke(() => {
|
|
1009
|
+
Y();
|
|
1010
|
+
}), (t, a) => (c(), p("fieldset", {
|
|
1011
|
+
ref_key: "rootRef",
|
|
1012
|
+
ref: C,
|
|
1013
|
+
disabled: n.isFormDisabled,
|
|
1014
|
+
class: "boi-bank-statement-integration rounded-xl border border-gray-200 bg-white shadow-sm",
|
|
1015
|
+
onFocusin: F,
|
|
1016
|
+
onFocusout: G
|
|
1017
|
+
}, [
|
|
1018
|
+
a[13] || (a[13] = l("div", { class: "border-b border-gray-100 px-4 py-3 md:px-6 md:py-4" }, [
|
|
1019
|
+
l("h2", { class: "text-lg font-bold text-slate-900" }, "Company Bank Statements")
|
|
1020
|
+
], -1)),
|
|
1021
|
+
l("div", _t, [
|
|
1022
|
+
l("div", St, [
|
|
1023
|
+
l("p", $t, [
|
|
1024
|
+
a[1] || (a[1] = H(" Some banks support ", -1)),
|
|
1025
|
+
a[2] || (a[2] = l("strong", null, "Electronic Bank Statement Retrieval", -1)),
|
|
1026
|
+
a[3] || (a[3] = H(", so you may not need to upload a PDF. ", -1)),
|
|
1027
|
+
l("button", {
|
|
1028
|
+
type: "button",
|
|
1029
|
+
onClick: a[0] || (a[0] = (s) => S.value = !S.value),
|
|
1030
|
+
class: "ml-1 font-semibold text-blue-700 underline hover:text-blue-800 focus:outline-none focus:ring-2 focus:ring-blue-300 rounded"
|
|
1031
|
+
}, M(S.value ? "Hide" : "See"), 1),
|
|
1032
|
+
H(" " + M(S.value ? "" : " supported banks."), 1)
|
|
1033
|
+
]),
|
|
1034
|
+
S.value && se.value.length ? (c(), p("div", Bt, [
|
|
1035
|
+
a[4] || (a[4] = l("p", { class: "mb-2 text-xs font-semibold text-blue-900" }, "Banks that support electronic statement retrieval:", -1)),
|
|
1036
|
+
l("ul", Ct, [
|
|
1037
|
+
(c(!0), p(W, null, te(se.value, (s, m) => (c(), p("li", { key: m }, M(s), 1))), 128))
|
|
1038
|
+
])
|
|
1039
|
+
])) : S.value && !se.value.length ? (c(), p("p", At, " Loading supported banks… ")) : P("", !0)
|
|
1040
|
+
]),
|
|
1041
|
+
h.value ? (c(), p("div", It, [...a[5] || (a[5] = [
|
|
1042
|
+
l("span", {
|
|
1043
|
+
class: "inline-block h-5 w-5 animate-spin rounded-full border-2 border-slate-300 border-t-slate-600 mr-2",
|
|
1044
|
+
"aria-hidden": "true"
|
|
1045
|
+
}, null, -1),
|
|
1046
|
+
l("span", { class: "text-sm text-slate-600" }, "Loading bank statements…", -1)
|
|
1047
|
+
])])) : (c(), p(W, { key: 1 }, [
|
|
1048
|
+
g.value.length ? (c(), p("div", Vt, [
|
|
1049
|
+
(c(!0), p(W, null, te(g.value, (s, m) => (c(), p("button", {
|
|
1050
|
+
key: s.id,
|
|
1051
|
+
type: "button",
|
|
1052
|
+
class: X(["shrink-0 rounded-lg px-4 py-2 text-sm font-medium whitespace-nowrap transition-colors", _.value === m ? "bg-primary text-white shadow-sm" : "bg-slate-100 text-slate-700 hover:bg-slate-200"]),
|
|
1053
|
+
onClick: (r) => _.value = m
|
|
1054
|
+
}, M(ue(s, m)), 11, Ut))), 128))
|
|
1055
|
+
])) : P("", !0),
|
|
1056
|
+
(c(!0), p(W, null, te(g.value, (s, m) => oe((c(), p("div", {
|
|
1057
|
+
key: s.id,
|
|
1058
|
+
class: "mt-6 space-y-6 rounded-xl border border-gray-100 bg-gray-50/50 p-4 md:p-6"
|
|
1059
|
+
}, [
|
|
1060
|
+
l("div", Pt, [
|
|
1061
|
+
l("h4", Ot, M(ue(s, m)), 1),
|
|
1062
|
+
l("button", {
|
|
1063
|
+
type: "button",
|
|
1064
|
+
class: "inline-flex items-center rounded-lg px-3 py-2 text-sm font-medium text-red-600 hover:bg-red-50 disabled:opacity-50 transition-colors",
|
|
1065
|
+
disabled: !T.value || n.isFormDisabled,
|
|
1066
|
+
onClick: (r) => Be(s)
|
|
1067
|
+
}, [...a[6] || (a[6] = [
|
|
1068
|
+
l("svg", {
|
|
1069
|
+
class: "w-4 h-4 mr-1.5",
|
|
1070
|
+
fill: "none",
|
|
1071
|
+
stroke: "currentColor",
|
|
1072
|
+
viewBox: "0 0 24 24"
|
|
1073
|
+
}, [
|
|
1074
|
+
l("path", {
|
|
1075
|
+
"stroke-linecap": "round",
|
|
1076
|
+
"stroke-linejoin": "round",
|
|
1077
|
+
"stroke-width": "2",
|
|
1078
|
+
d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
|
1079
|
+
})
|
|
1080
|
+
], -1),
|
|
1081
|
+
H(" Remove account ", -1)
|
|
1082
|
+
])], 8, Et)
|
|
1083
|
+
]),
|
|
1084
|
+
ne(t.$slots, "account-fields", {
|
|
1085
|
+
account: s,
|
|
1086
|
+
bankOptions: n.bankOptions,
|
|
1087
|
+
verificationState: z(A)(s),
|
|
1088
|
+
onVerify: () => z(u)(s),
|
|
1089
|
+
onRetry: () => z(x)(s)
|
|
1090
|
+
}, () => [
|
|
1091
|
+
l("div", Ft, [
|
|
1092
|
+
l("div", null, [
|
|
1093
|
+
a[7] || (a[7] = l("label", { class: "mb-1.5 block text-sm font-medium text-gray-700" }, "Bank", -1)),
|
|
1094
|
+
ee(ft, {
|
|
1095
|
+
"model-value": s.bank,
|
|
1096
|
+
options: n.bankOptions,
|
|
1097
|
+
placeholder: "Select bank",
|
|
1098
|
+
disabled: !!n.isFormDisabled,
|
|
1099
|
+
"onUpdate:modelValue": (r) => {
|
|
1100
|
+
s.bank = r, z(u)(s), Z(s);
|
|
1101
|
+
}
|
|
1102
|
+
}, null, 8, ["model-value", "options", "disabled", "onUpdate:modelValue"])
|
|
1103
|
+
]),
|
|
1104
|
+
l("div", null, [
|
|
1105
|
+
a[8] || (a[8] = l("label", { class: "mb-1.5 block text-sm font-medium text-gray-700" }, "Account number", -1)),
|
|
1106
|
+
oe(l("input", {
|
|
1107
|
+
"onUpdate:modelValue": (r) => s.account_number = r,
|
|
1108
|
+
type: "text",
|
|
1109
|
+
maxlength: "10",
|
|
1110
|
+
inputmode: "numeric",
|
|
1111
|
+
class: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2.5 text-sm focus:border-primary focus:ring-1 focus:ring-primary",
|
|
1112
|
+
placeholder: "10 digits",
|
|
1113
|
+
onBlur: (r) => {
|
|
1114
|
+
z(u)(s), Z(s);
|
|
1115
|
+
}
|
|
1116
|
+
}, null, 40, Dt), [
|
|
1117
|
+
[re, s.account_number]
|
|
1118
|
+
])
|
|
1119
|
+
]),
|
|
1120
|
+
l("div", null, [
|
|
1121
|
+
a[9] || (a[9] = l("label", { class: "mb-1.5 block text-sm font-medium text-gray-700" }, "Account name", -1)),
|
|
1122
|
+
l("input", {
|
|
1123
|
+
value: s.account_name,
|
|
1124
|
+
type: "text",
|
|
1125
|
+
readonly: "",
|
|
1126
|
+
class: "w-full cursor-default rounded-lg border border-gray-200 bg-gray-50 px-3 py-2.5 text-sm text-gray-700",
|
|
1127
|
+
placeholder: "Enter bank and account number to verify"
|
|
1128
|
+
}, null, 8, Tt),
|
|
1129
|
+
n.verifyBankAccount ? (c(), p("div", jt, [
|
|
1130
|
+
z(A)(s).isLoading ? (c(), p("span", Mt, "Verifying…")) : z(A)(s).isSuccess ? (c(), p("span", Lt, "Account verified")) : z(A)(s).isError ? (c(), p("span", zt, [
|
|
1131
|
+
l("span", Rt, M(z(A)(s).errorMessage), 1),
|
|
1132
|
+
l("button", {
|
|
1133
|
+
type: "button",
|
|
1134
|
+
class: "rounded px-2 py-0.5 text-gray-600 hover:bg-gray-100",
|
|
1135
|
+
onClick: (r) => z(x)(s)
|
|
1136
|
+
}, "Retry", 8, Nt)
|
|
1137
|
+
])) : P("", !0)
|
|
1138
|
+
])) : P("", !0)
|
|
1139
|
+
])
|
|
1140
|
+
])
|
|
1141
|
+
]),
|
|
1142
|
+
me(s.bank) ? (c(), p("div", Kt, [
|
|
1143
|
+
ee(et, {
|
|
1144
|
+
account: s,
|
|
1145
|
+
"edoc-banks": z($),
|
|
1146
|
+
"bank-options": n.bankOptions,
|
|
1147
|
+
api: { get: n.api.get, post: n.api.post },
|
|
1148
|
+
"company-email": N.value,
|
|
1149
|
+
"industrial-sector": K(),
|
|
1150
|
+
"application-id": n.applicationId,
|
|
1151
|
+
"integration-base-url": n.integrationBaseUrl,
|
|
1152
|
+
disabled: n.isFormDisabled,
|
|
1153
|
+
"onUpdate:consentId": (r) => Ce(s, r),
|
|
1154
|
+
onStatementRetrieved: (r) => Ae(s, r),
|
|
1155
|
+
onError: Ie
|
|
1156
|
+
}, null, 8, ["account", "edoc-banks", "bank-options", "api", "company-email", "industrial-sector", "application-id", "integration-base-url", "disabled", "onUpdate:consentId", "onStatementRetrieved"]),
|
|
1157
|
+
s.statement_generated || s.edoc_status === "completed" ? (c(), p("p", Xt, " Succeeded. ")) : P("", !0)
|
|
1158
|
+
])) : P("", !0),
|
|
1159
|
+
me(s.bank) ? P("", !0) : (c(), p("div", Wt, [
|
|
1160
|
+
a[11] || (a[11] = l("p", { class: "mb-3 text-sm font-medium text-gray-700" }, "Upload bank statement (PDF)", -1)),
|
|
1161
|
+
ne(t.$slots, "file-upload", {
|
|
1162
|
+
account: s,
|
|
1163
|
+
afterUpload: pe(s)
|
|
1164
|
+
}, () => [
|
|
1165
|
+
ee(xt, {
|
|
1166
|
+
modelValue: s.bank_statement,
|
|
1167
|
+
"onUpdate:modelValue": (r) => s.bank_statement = r,
|
|
1168
|
+
"view-storage-path": ae(s),
|
|
1169
|
+
post: (r, E, R) => n.api.post(r, E, R),
|
|
1170
|
+
"upload-url": i.value,
|
|
1171
|
+
"view-api-base": b.value || void 0,
|
|
1172
|
+
placeholder: "Choose 12 months bank statement (PDF)",
|
|
1173
|
+
accept: ".pdf",
|
|
1174
|
+
"max-size": 20 * 1024 * 1024,
|
|
1175
|
+
"allowed-types": ["application/pdf"],
|
|
1176
|
+
"upload-context": "bank_statement",
|
|
1177
|
+
"after-upload": pe(s),
|
|
1178
|
+
disabled: n.isFormDisabled,
|
|
1179
|
+
onUploaded: (r) => xe(s, String(r))
|
|
1180
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "view-storage-path", "post", "upload-url", "view-api-base", "after-upload", "disabled", "onUploaded"]),
|
|
1181
|
+
l("div", Gt, [
|
|
1182
|
+
l("div", Ht, [
|
|
1183
|
+
a[10] || (a[10] = l("span", { class: "text-sm font-medium text-gray-600" }, "Bank statement status:", -1)),
|
|
1184
|
+
l("span", {
|
|
1185
|
+
class: X([we(s.edoc_status || "pending"), "inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-medium capitalize"])
|
|
1186
|
+
}, [
|
|
1187
|
+
s.edoc_status === "processing" ? (c(), p("span", Jt)) : P("", !0),
|
|
1188
|
+
H(" " + M(s.edoc_status || "pending"), 1)
|
|
1189
|
+
], 2)
|
|
1190
|
+
]),
|
|
1191
|
+
s.edoc_status === "processing" ? (c(), p("p", Qt, " Processing in progress. Please wait… ")) : P("", !0),
|
|
1192
|
+
s.edoc_status === "failed" ? (c(), p("p", qt, " Processing failed. Please re-upload a valid bank statement or try another method. ")) : P("", !0)
|
|
1193
|
+
])
|
|
1194
|
+
])
|
|
1195
|
+
])),
|
|
1196
|
+
O.value ? (c(), p("div", Yt, [
|
|
1197
|
+
l("p", Zt, M(O.value), 1),
|
|
1198
|
+
l("button", {
|
|
1199
|
+
type: "button",
|
|
1200
|
+
class: "shrink-0 rounded p-1 text-red-600 hover:bg-red-100",
|
|
1201
|
+
onClick: Ve,
|
|
1202
|
+
"aria-label": "Dismiss"
|
|
1203
|
+
}, "×")
|
|
1204
|
+
])) : P("", !0)
|
|
1205
|
+
])), [
|
|
1206
|
+
[Pe, _.value === m]
|
|
1207
|
+
])), 128)),
|
|
1208
|
+
l("div", ea, [
|
|
1209
|
+
ee(Re, {
|
|
1210
|
+
type: "button",
|
|
1211
|
+
variant: "default",
|
|
1212
|
+
size: "lg",
|
|
1213
|
+
disabled: !D.value || n.isFormDisabled || !n.applicationId,
|
|
1214
|
+
onClick: $e
|
|
1215
|
+
}, {
|
|
1216
|
+
default: Oe(() => [...a[12] || (a[12] = [
|
|
1217
|
+
l("svg", {
|
|
1218
|
+
class: "w-4 h-4",
|
|
1219
|
+
fill: "none",
|
|
1220
|
+
stroke: "currentColor",
|
|
1221
|
+
viewBox: "0 0 24 24"
|
|
1222
|
+
}, [
|
|
1223
|
+
l("path", {
|
|
1224
|
+
"stroke-linecap": "round",
|
|
1225
|
+
"stroke-linejoin": "round",
|
|
1226
|
+
"stroke-width": "2",
|
|
1227
|
+
d: "M12 4v16m8-8H4"
|
|
1228
|
+
})
|
|
1229
|
+
], -1),
|
|
1230
|
+
H(" Add account ", -1)
|
|
1231
|
+
])]),
|
|
1232
|
+
_: 1
|
|
1233
|
+
}, 8, ["disabled"])
|
|
1234
|
+
])
|
|
1235
|
+
], 64))
|
|
1236
|
+
])
|
|
1237
|
+
], 40, wt));
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
function ta(n) {
|
|
1241
|
+
}
|
|
1242
|
+
const oa = {
|
|
1243
|
+
install: ta
|
|
1244
|
+
};
|
|
1245
|
+
export {
|
|
1246
|
+
ft as BankSelect,
|
|
1247
|
+
na as BankStatementIntegration,
|
|
1248
|
+
De as BoiButton,
|
|
1249
|
+
Re as Button,
|
|
1250
|
+
et as EmtsIntegration,
|
|
1251
|
+
xt as FileInput,
|
|
1252
|
+
st as bankStatementsApi,
|
|
1253
|
+
ot as bankStatementsUrls,
|
|
1254
|
+
oa as default,
|
|
1255
|
+
Q as edocApi,
|
|
1256
|
+
le as filesApi,
|
|
1257
|
+
ta as install,
|
|
1258
|
+
nt as useAccountVerification,
|
|
1259
|
+
at as useEdocBanks
|
|
1260
|
+
};
|
|
1261
|
+
//# sourceMappingURL=boi-ui.js.map
|