9.0.1 • Published 10 months ago

@financial-times/n-live-chat v9.0.1

Weekly downloads
93
License
ISC
Repository
github
Last release
10 months ago

n-live-chat

Customer Services live chat component for FT.com

Usage

Installation

npm install -S @financial-times/n-live-chat

JSX Component

import LiveChat from '@financial-times/n-live-chat';

<LiveChat style='popup' salesforceConfig={configObject} />
<LiveChat style='inline' salesforceConfig={configObject} />

Migration from Handlebars

With other ongoing work to move away from n-ui / Handlebars - this component from v3 no longer has any handlebars partials. If you require the handlebars template, please use the v2 release.

However, you may be able to register a custom Handlebars helper if you're feeling more adventurous. Without any testing (caveat emptor) it could be something akin to:

const React = require('react')
const ReactDOMServer = require('react-dom/server')
module.exports = function({ hash }) {
  const component = require(hash.component)
  const props = { ...this, ...hash }
  return ReactDOMServer.renderToString(
    React.createElement(component, props)
  )
}
<div>{{{#jsx component="@financial-times/n-component-here" someprop="goeshere" }}}</div>

Salesforce configuration

const configObject = {
  deploymentId: "string",
  organisationId: "string",
  buttonReference: "string",
  host: "string"
};

Styles

@import "@financial-times/n-live-chat/main";

Popup component

@include nLiveChatPopup();

Popup chat component

Inline component

@include nLiveChatInline();

Inline chat component

Client-side initialisation

import { LiveChatPopup, LiveChatInline } from '@financial-times/n-live-chat';
// basic setup for popup component with no tracking
new LiveChatPopup().init();

// basic setup for inline component with no tracking
new LiveChatInline().init();
// specify one or more callbacks
// e.g. for custom tracking events
const callbacks = {
  online: () => {
    /* agent online, chat available */
  },
  offline: () => {
    /* agents offline, chat unavailable */
  },
  open: () => {
    /* user clicked button to open chat */
  },
  // popup mode:
  dismiss: () => {
    /* user clicked button to dismiss popup */
  }
};

const options = {
  // wait 10 seconds before initialising component
  // (defaults to 1 second)
  displayDelay: 10000
};

new LiveChatPopup().init(callbacks, options);

chatterBox Feature Flag

n-live-chat will connect to the latest Customer Care Live Chat app , when this feature flag is on. The apps consuming n-live-chat can enable this feature by passing in the flag state for chatterboxChat as an option to the init function call.

const options = {
  chatterBox: flags.get(chatterboxChat)
};

new LiveChatPopup().init(null, options);

Demos

make install .env demo
9.0.1

10 months ago

9.0.0

1 year ago

8.0.5

1 year ago

8.0.6

1 year ago

8.0.4

1 year ago

8.0.1

1 year ago

8.0.3

1 year ago

8.0.2

1 year ago

7.0.0

1 year ago

7.0.1

1 year ago

8.0.0

1 year ago

6.0.0

2 years ago

6.0.0-beta.1

2 years ago

6.0.0-beta.2

2 years ago

5.0.0

2 years ago

4.1.1-beta.0

4 years ago

4.1.0

4 years ago

4.0.0

4 years ago

3.0.6

4 years ago

3.0.5

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

1.0.10

4 years ago

2.0.0-beta.4

4 years ago

1.0.9

4 years ago

2.0.0-beta.2

4 years ago

2.0.0-beta.3

4 years ago

2.0.0-beta.1

4 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago