Socket
Socket
Sign inDemoInstall

@papercups-io/chat-widget

Package Overview
Dependencies
Maintainers
2
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@papercups-io/chat-widget - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

dist/components/ChatWidget.d.ts

7

dist/components/ChatMessage.d.ts
/// <reference types="react" />
declare type Message = {
sender: string;
body: string;
created_at: string;
customer_id: string;
};
import { Message } from '../utils';
declare type Props = {

@@ -9,0 +4,0 @@ message: Message;

import React from 'react';
declare type Message = {
sender: string;
body: string;
created_at: string;
customer_id: string;
};
import { Message } from '../utils';
declare type Props = {

@@ -13,2 +8,3 @@ accountId: string;

baseUrl?: string;
greeting?: string;
};

@@ -28,2 +24,3 @@ declare type State = {

componentWillUnmount(): void;
getDefaultGreeting: () => Array<Message>;
fetchLatestConversation: (customerId: string) => Promise<void> | undefined;

@@ -30,0 +27,0 @@ createNewCustomerId: (accountId: string) => Promise<any>;

@@ -8,5 +8,6 @@ /// <reference types="react" />

baseUrl?: string;
greeting?: string;
defaultIsOpen?: boolean;
};
declare const EmbeddableWidget: ({ accountId, title, subtitle, primaryColor, baseUrl, defaultIsOpen, }: Props) => JSX.Element;
declare const EmbeddableWidget: ({ accountId, title, subtitle, primaryColor, baseUrl, greeting, defaultIsOpen, }: Props) => JSX.Element;
export default EmbeddableWidget;

@@ -263,4 +263,22 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

_this.getDefaultGreeting = function () {
var greeting = _this.props.greeting;
if (!greeting) {
return [];
}
return [{
sender: 'agent',
body: greeting,
created_at: now().toString()
}];
};
_this.fetchLatestConversation = function (customerId) {
if (!customerId) {
_this.setState({
messages: [].concat(_this.getDefaultGreeting())
});
return;

@@ -277,2 +295,6 @@ }

if (!conversations || !conversations.length) {
_this.setState({
messages: [].concat(_this.getDefaultGreeting())
});
return;

@@ -285,12 +307,13 @@ }

messages = _latest$messages === void 0 ? [] : _latest$messages;
var formattedMessages = messages.map(function (msg) {
return _extends({}, msg, {
sender: msg.customer_id ? 'customer' : 'agent'
});
}).sort(function (a, b) {
return +new Date(a.created_at) - +new Date(b.created_at);
});
_this.setState({
conversationId: conversationId,
messages: messages.map(function (msg) {
return _extends({}, msg, {
sender: msg.customer_id ? 'customer' : 'agent'
});
}).sort(function (a, b) {
return +new Date(a.created_at) - +new Date(b.created_at);
})
messages: [].concat(_this.getDefaultGreeting(), formattedMessages)
});

@@ -328,4 +351,3 @@

customerId: customerId,
conversationId: conversationId,
messages: []
conversationId: conversationId
});

@@ -836,2 +858,3 @@

baseUrl = _ref.baseUrl,
greeting = _ref.greeting,
_ref$defaultIsOpen = _ref.defaultIsOpen,

@@ -887,2 +910,3 @@ defaultIsOpen = _ref$defaultIsOpen === void 0 ? false : _ref$defaultIsOpen;

accountId: accountId,
greeting: greeting,
baseUrl: baseUrl

@@ -889,0 +913,0 @@ })), React.createElement(framerMotion.motion.div, {

@@ -261,4 +261,22 @@ import React from 'react';

_this.getDefaultGreeting = function () {
var greeting = _this.props.greeting;
if (!greeting) {
return [];
}
return [{
sender: 'agent',
body: greeting,
created_at: now().toString()
}];
};
_this.fetchLatestConversation = function (customerId) {
if (!customerId) {
_this.setState({
messages: [].concat(_this.getDefaultGreeting())
});
return;

@@ -275,2 +293,6 @@ }

if (!conversations || !conversations.length) {
_this.setState({
messages: [].concat(_this.getDefaultGreeting())
});
return;

@@ -283,12 +305,13 @@ }

messages = _latest$messages === void 0 ? [] : _latest$messages;
var formattedMessages = messages.map(function (msg) {
return _extends({}, msg, {
sender: msg.customer_id ? 'customer' : 'agent'
});
}).sort(function (a, b) {
return +new Date(a.created_at) - +new Date(b.created_at);
});
_this.setState({
conversationId: conversationId,
messages: messages.map(function (msg) {
return _extends({}, msg, {
sender: msg.customer_id ? 'customer' : 'agent'
});
}).sort(function (a, b) {
return +new Date(a.created_at) - +new Date(b.created_at);
})
messages: [].concat(_this.getDefaultGreeting(), formattedMessages)
});

@@ -326,4 +349,3 @@

customerId: customerId,
conversationId: conversationId,
messages: []
conversationId: conversationId
});

@@ -834,2 +856,3 @@

baseUrl = _ref.baseUrl,
greeting = _ref.greeting,
_ref$defaultIsOpen = _ref.defaultIsOpen,

@@ -885,2 +908,3 @@ defaultIsOpen = _ref$defaultIsOpen === void 0 ? false : _ref$defaultIsOpen;

accountId: accountId,
greeting: greeting,
baseUrl: baseUrl

@@ -887,0 +911,0 @@ })), React.createElement(motion.div, {

{
"name": "@papercups-io/chat-widget",
"version": "1.0.7",
"version": "1.0.8",
"description": "Papercups chat widget",

@@ -5,0 +5,0 @@ "author": "reichert621",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc