nba-kyc-lib
Version:
A simple input form Web Component usable in React and Angular
61 lines (56 loc) • 1.81 kB
HTML
<html>
<head>
<title>Simple Form (Modular)</title>
</head>
<body>
<div id="my-form"></div>
<script type="module">
import { renderSimpleForm } from "./input-form.js";
import { data } from "./config.js";
let openModal = true;
const modal = await renderSimpleForm(
document.getElementById("my-form"),
null,
{
showBank: true,
requiredFields: { kycType: true, kycNumber: true, otp: true },
onSuccess: (data) => console.log("✅ Success:", data),
onError: (err) => console.error("❌ Error:", err),
onClose: () => {
openModal = !openModal;
},
openModal: openModal,
auth: {
token: data.token || null,
customerId: data.customerId || null,
customerId: data?.customerId,
companyId: data?.companyId,
// Add any other auth-related parameters here
},
// Add any other custom parameters here
customParams: {
// User can add any custom parameters here
...data.customParams,
},
},
{
endpoints: {
sendOTP: data.sendOTP || null,
verifyOTP: data.verifyOTP || null,
verifyIFSC: data.verifyIFSC || null,
updateBankDetails: data.updateBankDetails || null,
getBankDetails: data.getBankDetails || null,
},
baseUrl: data.API_BASE_URL || null,
// Add any other API-related configurations here
apiConfig: {
// User can add any custom API configurations here
...data.apiConfig,
},
},
{ iconPath: "./public/icons" }
);
</script>
</body>
</html>