Skip to content

FanapSoft/pod-chat-react-module

Repository files navigation

Podchatweb

Podchatweb is a web app built by react for handling POD chating use cases

Preview of Podchat web

Installation

npm install podchatweb --save

Development

git clone https://github.com/FanapSoft/pod-chat-react-module.git
npm install

Required Post installation (UI kit)

git clone https://github.com/FanapSoft/pod-chat-ui-kit.git
npm install

After packages installation:

__
  |_ pod-chat-react-module
  |_ pod-chat-ui-kit
npm run start

Usage

React component:

import {PodchatJSX} from "podchatweb";

class MyApp extends Component {
  render() {
    const {token} = this.props;
    return <PodchatJSX token={token}/>
  }
}

Programmatic calling:

Module loader:

import {Podchat} from "podchatweb"

class MyApp extends Component {

  componentDidMount() {
    const {token} = this.props;
    Podchat({token}, "myChat")
  }

  render() {
    return <div id="myChat"/>
  }
}

Old school:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="dist/index.js"/>
</head>

<body>
<div id="app"></div>
<script>
    var podchat = Podchat({token: "YOUR_TOKEN"}, "app");
    //GOT NEW TOKEN
    podchat.setToken("YOUR_NEW_TOKEN");
</script>
</body>
</html>

Support mode

You can use podchatweb as support mode module with this simple config.

import {PodchatJSX} from "podchatweb";

class MyApp extends Component {
  render() {
    const {token} = this.props;
    return <PodchatJSX supportMode={8543}
                       token={token}/>
  }
}

Props

PropUsageType
supportMode Mentioned earlier Boolean
smallLook like loading podchatweb on mobile deviceBoolean
disableNotificationNo notificationBoolean
routerLessNo changes on browser route by chatBoolean
onRetryHookWhile retrying for a new connection if you set this prop chat will call your function and wait for a Promise return. Resolve that promise with a fresh token Func
onSignOutHookClick on sign out button and this props will make you a decision maker to what to do after that.Func
onTypingHookWhile typing in a thread you will get the contentFunc
onNotificationClickHookYou can make yourself notify when a user click on a browser default notification that generated by chat.Func

License

This project is open-sourced software licensed under the MIT license.

Releases

No releases published

Packages

No packages published