UNPKG

@benny_gebeya/gebeya-whatsapp-otp

Version:

React WhatsApp OTP verification component library with Supabase integration for phone number authentication

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