1.0.1 ā€¢ Published 4 years ago

odoc_patient_sdk v1.0.1

Weekly downloads
1
License
Apache-2.0
Repository
-
Last release
4 years ago

oDoc is an app that connects you with doctors for video, audio, and text consultations over your phone. It allows you to book over 350 SLMC registered GPs and specialists, obtain medical advice, receive a prescription (if medically required) and get your medication delivered. If lab tests are required, you could even order a mobile lab to your home or office. oDoc here gives you a javascript SDK in order to embed oDoc service inside your application.

Prerequisites

react ^16.x
async-storage ^1.x

Install

npm i odoc_patient_sdk

Usage

import * as React from 'react';
import ODOCSDK from 'odoc_patient_sdk'
import AsyncStorage from '@react-native-community/async-storage';
import { Constants } from 'odoc_patient_sdk/src/constants';


export interface Payload {
  phoneNumber: string
  firstName: string
  lastName: string
  appId: string
  jsonData: string
  authToken: string
  mode: string
}
export default class App extends React.Component <Payload>{
  constructor(props: any) {
    super(props);

    this.state = {
      phoneNumber: "", /* Optional Prams*/
      firstName: "", /* Optional Prams*/
      lastName: "", /* Optional Prams*/
      appId: "XXX", 
      jsonData: "", /* Optional Prams*/ 
      authToken: "XXX", /* For signUp, you can pass an empty string to setAuthToken. Next time onwards, A valid auth token should be passed here. */
      mode: Constants.development
    }
    AsyncStorage.getItem(Constants.authToken).then((token) => {
      this.setState({
        authToken: token || ""
       })
    })
  }
    callback(token: string) {
      if(token != ""){
        /* This token can be saved in any data source for next use. For example, AsyncStorage can be used here. */
        AsyncStorage.setItem(Constants.authToken,token);  
      }
    }

    render() {
      return (
          <ODOCSDK callHome={this.callback.bind(this)} payload={this.state} />
      );
    }
  }

Optional Parms

  phoneNumber:"7XXXXXXXX",
  firstName:"Jone",
  lastName:"Jude",
  jsonData:"{}" //Set the custom json string used for branding, styling, etc..

AppId

  oDoc uses appId in order to identify each app that uses oDoc service.
  You can build a sample oDoc integration using this npm. You will have to
  use the following appId in order to test how oDoc works with the oDoc development server .

  appId:  1.0.0_test_1

  If you would like to connect with oDoc Live server and connect & consult more than 350
  SLMS registered doctors, You will have to contact oDoc Pvt Ltd, register your company/app
  there & get your unique appId in order to build oDoc service in your app.

Mode

  Constants.development - development
  Constants.production  - production

Author

šŸ‘¤ oDoc (Private) Limited