Skip to content

Latest commit

 

History

History
165 lines (142 loc) · 3.14 KB

README.md

File metadata and controls

165 lines (142 loc) · 3.14 KB

AutoFillOtp

An AutoFillOTP component will help you to enable a listener. The listner will wait for the SMS in your phone to enable autoFillOTP.

Note: SMS should follow the format. To use auto fill OTP, last line of the sms should contain

@your-domain.com #12345

Demo

A minimal Demo Link

Usage/Examples

Value Used as a Description
AutoFillOtp ✅ Component Can be used as Component
autoFillOtp ✅ Service Can be used as Service
1. Here's an example of basic usage with Default Import:
 // Default import will return AutoFillOtp Component
 import AutoFillOtp from 'fe-pilot/AutoFillOtp';

 <AutoFillOtp /> // Used as a Component
2. Here's an example of basic usage with Multiple Import:
import { AutoFillOtp, autoFillOtp } from 'fe-pilot/AutoFillOtp'; // Multi Export

<AutoFillOtp /> // Used as a Component

autoFillOtp(); // Used as a Service
3. Here's an example of a advanced usage:
import { autoFillOtp } from 'fe-pilot/AutoFillOtp';

const successCb = (response) => {
  console.log("success response:", response);
}

const failureCb = (response) => {
  console.log("failure response:", response);
}

autoFillOtp({
  successCb
  failureCb
});

Important

To work AutoFillOtp successfully, your otp message template should follow the below format.

Your OTP is 123456
@your-domain.com #123456

Props

Props Type Description Response
successCb Function It will be called on success
  {
      data: "Can be array/object/string/number",
      msgType: "SUCCESSFUL",
      msg: "A success msg",
      status: "SUCCESS"
  }
        
loadingCb Function It will be called before success/failure.
  {
    msgType: "LOADING",
    msg: "LOADING...",
    status: "LOADING"
  }
  
failureCb Function It will be called on failure
  {
    msgType: "ERROR",
    msg: "A failed msg",
    status: "FAILURE"
  }
         
Props Type Description Default Values
showForever Boolean To hide/remove unsupported feature, make it false. Default value is true.