sorun-conversation

1.0.14 • Public • Published

sorun-conversation

SOR'UN company conversation component

NPM JavaScript Style Guide

Important release notes

1.0.14: Fixing auto initalize bug in Native mode
1.0.13: Fixing auto initalize bug
1.0.12: Adding callback function for last message
1.0.9: Adding show end conversation input parameter
1.0.8: Adding additional props to SorunJS
1.0.7: Adding authFailed output function
1.0.6: Waiting until company obj fetched and call fetching it in componentDidMount, and remove it from componentWillReceiveProps, and pass this company to Sorun-js
1.0.1: Adding the new conversation duration parameter
1.0.0: The first stable version of SOR'UN conversation component

Install

npm install --save sorun-conversation

Usage

This component is a container component that needs a view component in order to function well, you can use sorun-web-conversation for ReactJS applications or sorun-native-conversation for React Native applications. Also this component can works in two modes, auto initialize mode and manual initialize mode. In the first one the authentication is being done inside the component using a token prop, and with manual initialization it expects that the authentication will happened outside, the token will be get inside SorunJS library and just this component will need a variable to tell if the user is authenticated or not and the authenticate output action if the component needs to authenticate the user.
1- Auto initialize example:

import React, { Component } from 'react'
import WebConversation from 'sorun-web-conversation'
import Conversation from 'sorun-conversation'

class Example extends Component {
  render () {
    return (
      <Conversation
        lang={lang_variable}
        language={the_target_language} // en, tr, ar or de
        companyId={the_company_id}
        company= {the_company_object}
        logout= {logout_output_action}
        showHeader= {true}
        Layout= {WebConversation}
        autoInit= {true}
        token={the_token_variable}
        api={the_BE_path_variable}
        authFailed={authentication_failed_output_action}
      />
    )
  }
}

1- Manual initialize example:

import React, { Component } from 'react'
import WebConversation from 'sorun-web-conversation'
import Conversation from 'sorun-conversation'

class Example extends Component {
  render () {
    return (
      <Conversation
        lang={lang_variable}
        language={the_target_language} // en, tr, ar or de
        companyId= {the_company_id}
        company= {the_company_object}
        logout= {logout_output_action}
        showHeader= {true}
        Layout= {WebConversation}
        autoInit= {false}
        isAuthenticated={user_auth_state}
        core={core_variable}
        authenticate={authenticate_output_action}
      />
    )
  }
}

Props

Prop Description
core The SORUN JS instance the project is working on.
lang The language keys values map for displayed test inside the component, if its not set the component will use its default maps stored inside it.
language The target interface language en, tr, ar or de.
companyId The company Id to get the component working on that company.
company The company object if its already exists so the component will not fetch it again.
logout The logout output action.
showHeader Boolean to show or hide the header.
Layout The chosen layout if its for web or native applications.
autoInit true for auto initialization, and false for manual initialization.
token In auto initialization the token used for authorization the back-end calls.
api The back-end path.
server 'test', 'prod' or 'local' for auto choose the back-end path with default SORUN company servers.
isAuthenticated Boolean about the authentication state of the user.
authenticate Output action that will be called if authentication failed or the isAuthenticated is equal to false.

License

MIT © [Ahmad Mhaish](https://github.com/Ahmad Mhaish)

Readme

Keywords

none

Package Sidebar

Install

npm i sorun-conversation

Weekly Downloads

19

Version

1.0.14

License

MIT

Unpacked Size

339 kB

Total Files

6

Last publish

Collaborators

  • ozgur_sorun
  • amhaish
  • ozanknskl
  • yilmes
  • ozanbozkurt