UNPKG

gebeya-whatsapp-otp

Version:

React WhatsApp OTP verification component with Supabase integration

16 lines (15 loc) 685 B
import { jsx as _jsx } from "react/jsx-runtime"; import { createContext, useContext } from 'react'; import { useWhatsAppOTP } from '../hooks/useWhatsAppOTP'; const WhatsAppOTPContext = createContext(undefined); export const WhatsAppOTPProvider = ({ children, config, callbacks, }) => { const otpState = useWhatsAppOTP(config, callbacks); return (_jsx(WhatsAppOTPContext.Provider, { value: otpState, children: children })); }; export const useWhatsAppOTPContext = () => { const context = useContext(WhatsAppOTPContext); if (context === undefined) { throw new Error('useWhatsAppOTPContext must be used within a WhatsAppOTPProvider'); } return context; };