React-Crisp

React implementation for the messaging application Crisp

Install

npm add react-crisp
or
yarn add react-crisp
Shell

Usage

/* Import the component */
import Crisp from 'react-crisp';

/* Insert the componenent */
<Crisp crispWebsiteId="the-website-id-given-by-crisp" />
JavaScript

Identify the user and assign attributes

<Crisp
    crispWebsiteId="the-website-id-given-by-crisp" // Required
    crispTokenId="a-unique-token-for-the-user"
    attributes={{
        "user:email": ["foo@bar.com"],
        "user:nickname": ["foo42"],
    }}
/>
JavaScript

For a complete list of attributes please see the Crisp's Docs.

Configuration

<Crisp
    crispWebsiteId="the-website-id-given-by-crisp" // Required
    crispTokenId="a-unique-token-for-the-user"
    configuration={{
        "position:reverse": [true],
    }}
/>
JavaScript

For a complete list of parameters please see the Crisp's Docs.

Safe mode

To prevent Crisp to emit errors when an exception occurs, you may enable the Safe Mode (see Crisp's Docs. With react-crisp it's done like this:

<Crisp
    crispWebsiteId="the-website-id-given-by-crisp" // Required
    safeMode
/>
JavaScript

Set CRISP_RUNTIME_CONFIG

<Crisp
    crispWebsiteId="the-website-id-given-by-crisp" // Required
    crispRuntimeConfig={{
      session_merge: true,
    }}
/>
JavaScript

For more details about the variable CRISP_RUNTIME_CONFIG see Crisp's Docs.

GitHub

https://github.com/Mergifyio/react-crisp