GithubHelp home page GithubHelp logo

livechat / react-livechat Goto Github PK

View Code? Open in Web Editor NEW
36.0 6.0 24.0 85 KB

⚠️ DEPRECATED ⚠️ Package no longer supported. Please use @livechat/widget-react instead.

License: MIT License

JavaScript 100.00%
deprecated obsolete archived

react-livechat's Introduction

⚠️ DEPRECATED ⚠️

We have created a new project called Chat Widget Adapters. It contains a set of packages which support more frontend frameworks integration with LiveChat Chat Widget in a modern way aligned with each framework specificity in mind.

From now on it will be the official, actively maintained repository for each framework-specific package that allows easy integration of LiveChat Chat Widget. The React package @livechat/widget-react is one of available optoions. You can read more about it here.

LiveChat for React

This is a React component to easily add LiveChat widget to your application.

Getting Started

Prerequisites

To use LiveChat in your React application, you will need LiveChat license ID.

If you already have a LiveChat account, get your license_id here.

LiveChat license ID

If you don't have an account, you can create one here.

Installation

To import LiveChat for React, run the following command:

npm install react-livechat --save

User Guide

Start

Having imported LiveChat for React, put it in your render method:

import LiveChat from 'react-livechat'

...

<LiveChat license={your_license_id} />

Group

You can set up group directly in LiveChat component prop. Thanks to this, all chats will be routed to the specified group:

<LiveChat license={your_license_id} group={3} />

Here you can learn more about groups: Dividing live chat by group.

Separated chat sessions

You can separate chat sessions between groups by using chatBetweenGroups prop:

<LiveChat license={your_license_id} group={3} chatBetweenGroups={false} />

Here is an article about it.

Visitor's details

If you already know who your visitor is, you can set up his/her name and/or email:

<LiveChat license={your_license_id} visitor={{name: 'John', email: '[email protected]'}} />

Custom variables

Custom variables are additional details that you can pass to LiveChat from the code (i.e., login or profile link). Here is how to make it:

const params = [
  { name: 'Login', value: 'joe_public' },
  { name: 'Account ID', value: 'ABCD1234' },
  { name: 'Total order value', value: '$123' }
];

<LiveChat license={your_license_id} params={params} />

Customization

You can change the look and feel of your chat widget in Settings > Chat window section.

Methods

This module uses LiveChat JS API.

Get your chat reference using onChatLoaded callback:

<LiveChat 
  onChatLoaded={ ref => this.livechat = ref }
  license={your_license_id} 
/>

You have access to all methods and variables of LiveChat JS API with your livechat reference or window.LC_API.

Example:

this.livechat.hide_chat_window();
// is the same as:
window.LC_API.hide_chat_window();

LC_Invite exception

Sometimes it can happen that LC_Invite is is still being loaded when onChatLoaded is called. To ensure that LC_Invite is loaded you can give additional check to onChatLoaded function:

onChatLoaded = (ref) => {
 ref.on_after_load = function ()  {
    //here you can use any method you want!
  }		
}

Available methods

Name Note
close_chat Closes the ongoing chat.
disable_sounds Mutes all sounds in the chat window on visitor's side (not supported with the pop-up chat window).
open_chat_window Maximizes the chat window (when using the embedded chat window) or opens the chat window (when using the pop-up window).
minimize_chat_window Minimizes the chat window (not supported with the pop-up chat window).
hide_chat_window Hides the chat window (not supported with the pop-up chat window).
agents_are_available Returns true if your agents are available to chat, otherwise it returns false.
chat_window_maximized Returns true if the chat window is maximized, returns false otherwise.
chat_window_minimized Returns true if the chat window is minimized, returns false otherwise.
chat_window_hidden Returns true if the chat window is hidden, returns false otherwise.
visitor_queued Returns true if the visitor is currently waiting in the queue, returns false otherwise.
chat_running Returns true if the visitor is currently chatting with an agent, returns false otherwise.
visitor_engaged Returns true if the visitor is currently chatting, waiting in the queue or the greeting is displayed to them. Returns false otherwise.
get_window_type Returns embedded if the chat window is embedded on the website or popup if the chat window opens in a new window.
set_custom_variables You can set custom variables that the LiveChat agents will see in their apps. Custom variables will be saved in the chat transcript, so you will see them in the Archives even after the chat has been finished.

Callbacks

LiveChat React component gives you the option to control chat callbacks.

Let's say that you want display a received or sent message somewhere else. You can get new messages using the code below:

<LiveChat
  ...
  onMessage={ data => console.log(data) } 
/>

Available callbacks

Name Note
onChatLoaded Executed when LC_API object is loaded and ready to use. Returns reference to your LC_API object.
onBeforeLoad Executed before the chat window has been rendered (not supported with the pop-up chat window).
onAfterLoad Executed right after the chat window has been rendered (not supported with the pop-up chat window).
onChatWindowOpened Executed when the chat window is opened.
onChatWindowMinimized Executed when the chat window is minimized (not supported with the pop-up chat window).
onChatWindowHidden Executed when the chat window is hidden (not supported with the pop-up chat window).
onChatStateChanged Executed when the chat state is changed. You can find more information here.
onChatStarted Executed when the chat is started.
onChatEnded Executed when the chat is ended.
onMessage Executed when the message has been sent or received. You can find more information here.
onTicketCreated Executed when the ticket form has been filled in by the visitor. You can find more information here.
onPrechatSurveySubmitted Executed when the pre-chat survey has been submitted by visitor.
onPostchatSurveySubmitted Executed when the post-chat survey has been submitted by visitor.
onRatingSubmitted Executed when the chat rating is submitted. The only argument, data, can have three values: good, bad or none.
onRatingCommentSubmitted Executed when a chat rating comment is submitted. The only argument, data, contains the message entered by the visitor.

Support

If you need any help, you can chat with us via email or on chat.

I hope you will find this module useful. Happy coding!

react-livechat's People

Contributors

amiadsoto avatar quarties avatar venits avatar vivgman avatar walaszczykm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

react-livechat's Issues

Performance Issues

Hi.

We are using LiveChat on a clients website. Unfortunately, the performance hit is quite significant. Livechat causes numerous red flags to be raised by Chrome developer tools - examples are below.

These performance issues are causing the site to not function as smoothly as we'd like. I am not sure what the solution is exactly - but I think it's worth looking into these problems and trying to improve the performance of the code base.

screen shot 2018-09-20 at 09 17 48

onAfterLoad prop is not passed to LC_API correctly

currently the prop function is called directly, not bound like other methods.

window.LC_API.on_after_load = this.props.onAfterLoad();
should be
window.LC_API.on_after_load = this.props.onAfterLoad.bind(this);
or just
window.LC_API.on_after_load = this.props.onAfterLoad.

LiveChat makes ping even after unmounting

Hi. I have faced with a problem.
On my site I have a lot of routes: site.com/home, site.com/game, site.com/about and so on.
I want to render LiveChat wherever but not on site.com/game.
I tried to use conditional render in my root component like this:

{showChat && (<LiveChatWrapper license={1234} />)}

In LiveChatWrapper component I am hiding chat window in componentWillUnmount():

componentWillUnmount() {
  if (this.chatRef) {
    this.chatRef.close_chat();
    this.chatRef.hide_chat_window();
  }
}

This works. But even if the chat is hidden I see a lot of requests to https://secure.livechatinc.com/licence/1234/v2/ping.
I want to be sure that if LiveChat is unmounted there is no network activity.

How can I achieve this?

LiveChat widget not wrking on ipad

I am using the LiveChat Widget for my react app. I noticed that when I switch my user agent to ipad the widget is not showing up correctly.

Normally the icon looks like this:
screen shot 2019-01-18 at 11 59 50 am

But when I am on an ipad It looks like this:
screen shot 2019-01-18 at 11 59 59 am

What can I do to keep the original look instead of it changing on ipad?

Is this really React?

Reading the source code, I see that it does nothing but loading another js file (tracking.js) as a script to the page, and then this script adds html elements to the page to show the chat stuff. But this direct manipulation of the DOM is somehow against the react principal (?!). To make it really react, the whole chat frontend stuff (including the element generating code in tracking.js) should either become a react component, or a web component (that renders into the shadow DOM). The present implementation is not react.

Cannot resolve prop-types in react-livechat

Hi, I'm currently having build issues with react-livechat in the following environments for 1.0.22:

Node: 8.9.4
NPM: 6.0.1

Getting the error Cannot resolve prop-types in react-livechat. I'm think this may be an issue that the package.json is missing the prop-types package as a dependency?

Can't resolve 'react' (create-react-app)

Hi,

I get

Module not found: Can't resolve 'react' in ...

React 16.4.2 with create-react-app 2

Of course I'm importing React...

import React from 'react'

Any idea?

Can't hide visibility of Chat Window BEFORE its loaded in page

There is similiar solved issue [Can't hide visibility of Chat Window once its loaded in page #18] but the solution is to use on_after_load, but if we do not want to show chat window by default, this solution is not perfect because of short blinking (window apear for a moment and than disapear). If we using on_before_load, chat window does not disapear (why?). Best if it will be some property, for example "hide_on_startup", which do the job. Or maybe you know beter/simpler solution.

React-Livechat: cannot update params when re-render

I want to update params if user logged, get user info to update params. If user info not found then set params default.
Issue: params cannot update when user logged, in widget live chat show info default.
My code:
render () {
return ({
(user.dataUser)
? <LiveChat license = {} params={[{name: "Email", value: user.dataUser.email}]} />
: <LiveChat license = {
} params = {[{name: "Email", value: "[email protected]"}]} /
})
}

LiveChat in React site drops license

Hi...I'm trying to install LiveChat on my react site. I'm using the react-livechat component. It works in my development environment (i.e. localhost) but it doesn't work in my staging or production environments. In those environments, I get the following error:

GET https://secure.livechatinc.com/licence/null/v2/get_dynamic_config.js?t=1567016999765&referrer=http%3A%2F%2Fredwavetech.com%2Fproducts%2Fthreatid&url=http%3A%2F%2Fredwavetech.com%2Fproducts%2Fthreatid&params=&channel_type=code&jsonp=__lc_data_480459 net::ERR_ABORTED 400 (Bad Request).

While it seems pretty clear to me that the license is not being passed correctly, it doesn't explain why it's being passed on my localhost and not in my staging/production environments. I've also tried installing LiveChat via the conventional way (i.e. the JS code snippet recommended by LiveChat during account creation) but I get the same error.

Any help would be appreciated.

Thanks.

Reassigning params in functions is not a good practice

In the documentation to allow chat to get access to API methods, the sample code demostrates

onChatLoaded = (ref) => {
 ref.on_after_load = function ()  {
    //here you can use any method you want!
  }		
}

This is not a good practice according to ES standards, you should not reassign ref within the function scope because ref is considered a constant that's passed in as a parameter. please update the documentation to reduce the confusion.

onChatLoaded is only called the first time LiveChat loads

Here's my use case:

export default class LiveChatApi extends Component {
  componentWillMount() {
    if (window.LC_API) {
      this.liveChat = window.LC_API;
      if (this.liveChat.chat_window_hidden()) {
        this.liveChat.minimize_chat_window();
      }
    }
  }

  componentWillUnmount() {
    if (this.liveChat && !this.liveChat.visitor_engaged()) {
      this.liveChat.hide_chat_window();
    }
  }

  render() {
    return (
      <LiveChat onChatLoaded={ref => this.liveChat = ref} license={12345} />
    );
  }
}

LiveChatApi will be rendered only on certain routes like "contact us". So it is typical for it to mount/unmount multiple times per session. In order to obtain a ref to LC_API on subsequent mounts, I had to look to the window object.

I propose that react-livechat should handle this and invoke onChatLoaded on mount if chat is already loaded.

SameSite attribute warning in Chrome

Hi,

I seem to get this warning in the console, What will I need to do to remove it? I suspect it may be a change on your side too.

Thanks in Advance

A cookie associated with a cross-site resource at http://livechatinc.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.

React Native : bundling failed: Error: While trying to resolve module `@livechat/mitt`

React Native : 0.56.0
@livechat/livechat-visitor-sdk : 0.35.2

Hi Guys,

I am trying to integrate livechat in my react-native application using livechat-visitor-sdk npm package . I am not using react-native-livechat npm package as I want the UI to be customisable.

But react-native packager throws the following error while bundling the latest version of livechat-visitor-sdk :


error: bundling failed: Error: While trying to resolve module `@livechat/mitt` from file `PROJECT_PATH/node_modules/@livechat/livechat-visitor-sdk/dist/index.cjs.js`, the package `PROJECT_PATH/node_modules/@livechat/mitt/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`PROJECT_PATH/node_modules/@livechat/mitt/dist/livechat-mitt.native.js`. Indeed, none of these files exist:

After looking into the node_modules/@livechat/ directory , I could see two directories : livechat-visitor-sdk and mitt . The package.json file inside the mitt directory has a field named react-native which references file named dist/livechat-mitt.native.js . But there is no file named livechat-mitt.native.js under dist directory which is inside the mitt directory.

Is the crash happening because of this ? Currently I am using version 0.0.23 version used in the following example project : https://github.com/livechat/chat-window-react-native-example

While using version 0.0.23 version, there is no mitt directory and the project runs successfully. But the SDK lacks some methods as it is quite old version.

Is there a way I can make the version 0.35.2 work in my react-native project ?

Please let me know if I am missing any information that might be needed to resolve this issue.

Thank You.

Wrong directory structure published on npm

In the package published on npm (Version 1.0.21) LiveChat.js is placed in the root directory but
index.js imports LiveChat.js from a subdirectory LiveChat - require('./LiveChat/LiveChat').

Please fix 🙂

Chat messages gets hidden when opening the keyboard on app

When i open the keyboard then the previous app gets hidden instead of floating upwards.

<KeyboardAwareScrollView style={{ backgroundColor: 'white' }} keyboardShouldPersistTaps={'always'}>
< LiveChat bubbleColor = '#E18C50'
license={} bubbleLeft={w * .75} onLoaded={ref => this.livechat = ref} style={{ height: h * .5 }}
bubbleTop={h * .8} bottomOffset={h * .5} />

screenshot_1533632254
screenshot_1533632441

User Params Not Visible in Admin Portal

I have implemented the plugin in our React application. I am only loading the component if our global user store has user data, however we are not seeing the info in our admin panel for livechat. here is my implementation:

import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import { BrowserRouter as Router, Route, Redirect, Switch, withRouter } from 'react-router-dom';
import { IUserStore, IDrawerStore } from './stores';
import LiveChat from 'react-livechat';

interface IAppProps {
  userStore?: IUserStore;
}

interface ILivechatParam {
  name?: string;
  value?: string | number;
}

interface IAppState {
  livechatParams: ILivechatParam[],
}

@inject('userStore')
@observer
export default class App extends Component<IAppProps, IAppState> {
  private userDatasetsString: string = '';
  
  constructor(props: any) {
    super(props);

    this.userDatasetsString = props.userStore.user.account!.datasets.map((ds: Dataset) => ds.name).join();
  }
  
  public state: IAppState = {
    livechatParams: [
      {
        name: 'Name',
        value: '',
      },
      {name: 'Email', value: ''},
      {name: 'Phone', value: ''},
      {name: 'Title', value: ''},
      {name: 'Account', value: ''},
      {name: 'Account Number', value: ''},
      {name: 'Communities', value: ''},
      {name: 'Sales Contact', value: ''},
    ],
  };

  public componentDidMount() {
    if (this.props.userStore) {
      const {
        profile: {
          firstName = '',
          lastName = '',
          email ='',
          phone = '',
          title = '',
        } = {},
        account: {
          id = '',
          name = '',
          accountContact: {
            firstName: accountContactFirstName = '',
            lastName: accountContactLastName = '',
          } = {},
        } = {},
      } = this.props.userStore.user;

      this.setState({
        livechatParams: [
          {
            name: 'Name',
            value: `${firstName} ${lastName}`,
          },
          {name: 'Email', value: email},
          {name: 'Phone', value: phone},
          {name: 'Title', value: title},
          {name: 'Account', value: name},
          {name: 'Account Number', value: id},
          {name: 'Communities', value: this.userDatasetsString},
          {name: 'Sales Contact', value: `${accountContactFirstName} ${accountContactLastName}`},
        ],
      });
    }
  }

  public componentDidUpdate(prevProps: IAppProps) {
    if (prevProps !== this.props && this.props.userStore) {
      const {
        profile: {
          firstName = '',
          lastName = '',
          email ='',
          phone = '',
          title = '',
        } = {},
        account: {
          id = '',
          name = '',
          accountContact: {
            firstName: accountContactFirstName = '',
            lastName: accountContactLastName = '',
          } = {},
        } = {},
      } = this.props.userStore.user;

      this.setState({
        livechatParams: [
          {
            name: 'Name',
            value: `${firstName} ${firstName}`,
          },
          {name: 'Email', value: email},
          {name: 'Phone', value: phone},
          {name: 'Title', value: title},
          {name: 'Account', value: name},
          {name: 'Account Number', value: id},
          {name: 'Communities', value: this.userDatasetsString},
          {name: 'Sales Contact', value: `${accountContactFirstName} ${accountContactLastName}`},
        ],
      });
    }
  }

  public render() {
    const {
      userStore: {
        user: {
          profile: {
            id: userId ='',
            email: userEmail = '',
          } = {},
        } = {},
        status: {
          isAuthenticated = false,
        } = {},
      } = {},
    } = this.props;

    const content = (
      <div id="app">
        {// Content Code}
        { process.env.REACT_APP_LIVECHAT_LICENSE && userId &&
          <LiveChat license={parseInt(process.env.REACT_APP_LIVECHAT_LICENSE, 10)} params={this.state.livechatParams} />
        }
        </div>
    );

    return (
      <Router>
        {// Router Code}
      </Router>
    );
  }
}

Any help trying to figure out why we're not seeing this param data in our admin panel is much appreciated.

User Params not Showing in Admin Panel

I have implemented the plugin in our React application. I am only loading the component if our global user store has user data, however we are not seeing the info in our admin panel for livechat. here is my implementation:

`
import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import { BrowserRouter as Router, Route, Redirect, Switch, withRouter } from 'react-router-dom';
import { IUserStore, IDrawerStore } from './stores';
import LiveChat from 'react-livechat';

interface IAppProps {
userStore?: IUserStore;
drawerStore?: IDrawerStore;
}

interface ILivechatParam {
name?: string;
value?: string | number;
}

interface IAppState {
livechatParams: ILivechatParam[],
}

@Inject('userStore', 'drawerStore')
@observer
export default class App extends Component<IAppProps, IAppState> {
private userDatasetsString: string = '';

constructor(props: any) {
super(props);

this.userDatasetsString = props.userStore.user.account!.datasets.map((ds: Dataset) => ds.name).join();

}

public state: IAppState = {
livechatParams: [
{
name: 'Name',
value: '',
},
{name: 'Email', value: ''},
{name: 'Phone', value: ''},
{name: 'Title', value: ''},
{name: 'Account', value: ''},
{name: 'Account Number', value: ''},
{name: 'Communities', value: ''},
{name: 'Sales Contact', value: ''},
],
};

public componentDidMount() {
if (this.props.userStore) {
const {
profile: {
firstName = '',
lastName = '',
email ='',
phone = '',
title = '',
} = {},
account: {
id = '',
name = '',
accountContact: {
firstName: accountContactFirstName = '',
lastName: accountContactLastName = '',
} = {},
} = {},
} = this.props.userStore.user;

  this.setState({
    livechatParams: [
      {
        name: 'Name',
        value: `${firstName} ${lastName}`,
      },
      {name: 'Email', value: email},
      {name: 'Phone', value: phone},
      {name: 'Title', value: title},
      {name: 'Account', value: name},
      {name: 'Account Number', value: id},
      {name: 'Communities', value: this.userDatasetsString},
      {name: 'Sales Contact', value: `${accountContactFirstName} ${accountContactLastName}`},
    ],
  });
}

}

public componentDidUpdate(prevProps: IAppProps) {
if (prevProps !== this.props && this.props.userStore) {
const {
profile: {
firstName = '',
lastName = '',
email ='',
phone = '',
title = '',
} = {},
account: {
id = '',
name = '',
accountContact: {
firstName: accountContactFirstName = '',
lastName: accountContactLastName = '',
} = {},
} = {},
} = this.props.userStore.user;

  this.setState({
    livechatParams: [
      {
        name: 'Name',
        value: `${firstName} ${firstName}`,
      },
      {name: 'Email', value: email},
      {name: 'Phone', value: phone},
      {name: 'Title', value: title},
      {name: 'Account', value: name},
      {name: 'Account Number', value: id},
      {name: 'Communities', value: this.userDatasetsString},
      {name: 'Sales Contact', value: `${accountContactFirstName} ${accountContactLastName}`},
    ],
  });
}

}

public render() {
const {
userStore: {
user: {
profile: {
id: userId ='',
email: userEmail = '',
} = {},
} = {},
status: {
isAuthenticated = false,
} = {},
} = {},
} = this.props;

const content = (
  <div id="app">
    {//...app code here...}
    { process.env.REACT_APP_LIVECHAT_LICENSE && userId &&
      <LiveChat license={parseInt(process.env.REACT_APP_LIVECHAT_LICENSE, 10)} params={this.state.livechatParams} />
    }
    </div>
);

return (
  <Router>
    {//...router code here...}
  </Router>
);

}
}

`

Any help trying to figure out why we're not seeing this param data in our admin panel is much appreciated.

Ticket Form not opening in Live Chat even when Agents are not Accepting Chats

We have integrated your Live Chat SDK with one of our mobile apps build on React Native. We notice that user is unable to send a chat to agent, when agents are logged off from the Live Chat Web Panel. In this case, user should ideally receive a Ticket Form but unfortunately that is also not happening. We tried to contact with your customer care and had a word with Lukasz who informed us that we have to make sure that all agents should not ACCEPT CHATS. We tried that also but couldn’t get through. Hence, reporting this as an issue here as suggested by your team. Looking forward for an early response.

Chat does not display before agent replies

Hi,

I have been facing this issue for sometime, I am using livechat default send implementation.

When a visitor types in a message and sends it, it doesn't appear until the agent replies (either if it automatic assign or manual assign)

if no agents online, then the visitor can't know if the messages are sent to the chat or not.

Also, I have noticed that when I implemented the sendPrechatForm, it automatic starts the chat, and that causes the messages to be re-rendered multiple times till I go back and forth.

Screenshot showing that the welcome message show'd before the visitor's message and also causing the duplication to happen
image

image

Conditional rendering of Livechat

Hello,

I would like at achieve a very simple task and have explored quite a bit around the methods of this API but was not successful.

Task: My site has many routes (e.g: mysite.com/about, mysite.com/work, etc ... )
The only route where i don't want to show the LiveChat component is on the home page (root url) due to design reasons. I have tried setting up a rule in chat settings which achieves what I am looking for, however requires a refresh after a url change.

how can ai achieve this?

Disable name and email on chat window

Is there a way to disable name and email text field. So the 2 fields won't be editable by the user because the visitor name and email is already passed as props?

Screenshot from 2019-08-06 17-32-56

ReferenceError: window is not defined

I'm using GatsbyJS.
With the basic setup, it works in gatsby develop but running gatsby build yield an error. Changing the import to require and conditionally importing it is bring back "Expected string but got object" error. Any advice?

LC_Invite is not defined on Mobile Version

Hi, I hope you are well.

I'm using your react component for Livechat on my application. The desktop version is running perfectly but when I switch to the mobile version I'm not be able to use it and open the chat window.

When I call window.LC_API.open_chat_window() It's throwing:
screenshot from 2018-10-18 18-05-28

Is it possible to use it on the mobile version or not ?

LC_Invite is not defined

Hi,
I have an issue where the component throws an error "LC_Invite is not defined". I use code below. I cut a bit in the code to hide the chatwindow on mobile:

onChatLoaded(ref) { this.livechat = ref; if ( matchMedia("only screen and (max-width: 768px)").matches ) { this.livechat.hide_chat_window(); } }

And later on i pass this to the component like usual:

<LiveChatInc license={livechat.license} onChatLoaded={this.onChatLoaded} />

Now, if i look at my rollbar error logging i see it throws error on LC_Invite, please see screenshots.
screen shot 2018-06-07 at 15 08 08
screen shot 2018-06-07 at 15 03 08

Code it's refering to:
screen shot 2018-06-07 at 15 39 29

It seems like not the whole library is loaded on this point in time, but how should this be done instead for the hidden mobile version? Or is this a bug?

Incompatible with SSR

Related to #19
This component is using componentWillMount hook which is a) deprecated and b) apparently called in Next.js server-side rendering

Switching to componentDidMount would fix this in my understanding. I can send a PR but this repo doesn't have the rollup config file so I cannot test the builds when iterating on the code.

If you'd publish your rollup.config.js and maybe other dev-related stuff I'd send a PR myself.

Warning: componentWillMount has been renamed, and is not recommended for use

Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

  • Move code with side effects to componentDidMount, and set initial state in the constructor.
  • Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run npx react-codemod rename-unsafe-lifecycles in your project source folder.

Please update the following components: LiveChat

Error: Couldn't find preset "es2015" relative to directory

This is solvable by excluding the node_modules path, but it can also be solved by using preset "env", which is now the standard. If I have time I can see if it's easy and create a pull request.

./node_modules/react-livechat/LiveChat.js
Module build failed: Error: Couldn't find preset "es2015" relative to directory

node v6.11.4
preact v8.2.7
webpack v3.10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.