npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

transform-bold-chat

v0.0.6

Published

A function to transform a Bold360 chat payload to a Livechat equivalent.

Downloads

1

Readme

Transform Bold360 to Livechat

Transform Bold360 chat payload to Livechat chat payload.

Install

$ yarn install transform-bold-chat

Usage

const { transform } = require('transform-bold-chat');

const chat = transform(bold360ChatPayload);

Expected Bold 360 Chat Payload input

{
	RegionCode: 'Central Macedonia',
	Secured: 0,
	WindowClosed: null,
	UserStatusID: null,
	InvitationTemplateVariantID: null,
	VisitorMessageCount: 1,
	VisitInfo: null,
	VideoSessionStatus: null,
	ResponseMessageCount: 0,
	ExternalCrmType: null,
	SurveyComments: 'post chat comments',
	Embedded: 1,
	AutoTranslate: 0,
	InitialDepartmentID: '107972173855710031',
	LastAssignedByOperatorID: null,
	DeletedBy: null,
	Load: null,
	VisitCreated: '2020-02-20T08:42:41.000Z',
	VisitRef: null,
	IP: '94.69.228.151',
	Disconnected: '2020-02-20T09:03:21.000Z',
	RedirectStatus: null,
	ChatStatusType: 6,
	EndedReasonType: 1,
	BlockedBy: null,
	LastAssignedAnswered: '2020-02-20T09:02:32.000Z',
	VisitEmailAddress: '[email protected]',
	ClientType: 0,
	SurveyResponsiveness: 3,
	Started: '2020-02-20T09:02:27.000Z',
	ExternalCrmListID: null,
	FolderID: '107904642304297496',
	UnavailableEmailBody: null,
	Experiments: null,
	LastVideoSessionID: null,
	ChatAPISettingsID: null,
	WebsiteDefID: '107972174773185283',
	Created: '2020-02-20T08:50:23.390Z',
	CustomField1ID: null,
	ActiveAssistStatus: 0,
	ChatType: 0,
	LastMessagePersonType: 1,
	OperatorMessageCount: 0,
	UnavailableEmailSubject: null,
	Deleted: null,
	VisitorID: '107990978786743687',
	AutoAnswerQuestionCount: null,
	AccountID: '106562681705387893',
	ACDReassignCount: 0,
	UserCategoryID: null,
	LastOperatorLanguageCode: null,
	Ended: '2020-02-20T09:03:04.000Z',
	XmppUserID: null,
	RequestedOperatorID: null,
	RelatedToItemID: null,
	AssignedByAPI: 0,
	ExternalCrmItemID: null,
	ChatButtonDefID: '107972796068666730',
	ScheduleHistoryToEmailAddress: '[email protected]',
	ChatWindowDefID: '107972174903445584',
	SurveyOverall: 4,
	VisitID: '107990978204302548',
	PostChatCustomFieldAnswerStatus: 4,
	LanguageCode: 'en-US',
	ChatUrl: 'https://thechatshop.com/dev/test-chat.html',
	OperatorCustomFields: {
		primary_tag: 'Lead',
		secondary_tag: 'escalate',
	},
	CustomField2ID: null,
	XmppClientID: null,
	LastACDStarted: '2020-02-20T09:02:27.000Z',
	PageType: 10,
	ActiveAssistDisabled: 0,
	CustomUrl: null,
	XmppUser: null,
	Availability: 0,
	MaxQueuePosition: 0,
	SurveyKnowledge: 3,
	Updated: '2020-02-20T09:04:04.180Z',
	Priority: null,
	ChatName: 'first name',
	City: 'Thessaloniki',
	ChatID: '107990982891167447',
	OperatorLanguageCode: null,
	CustomFields: {
		prechat_survey_field1: 'pre chat field 1',
		postchat_survey_field1: 'post chat field 1',
	},
	ExperimentDate: null,
	AreaCode: null,
	LastName: 'last name',
	TotalResponseTime: 0,
	FlaggedBy: null,
	ACDAssignmentExpires: null,
	OperatorID: '107905455413102470',
	LastVisitorMessageSent: '2020-02-20T09:02:50.000Z',
	VisitorClientID: '8894617890582013061',
	IncidentID: null,
	SurveyProfessionalism: 4,
	UnrespondedMessageCount: 1,
	TotalReassignCount: 1,
	SurveyNps: 7,
	RelatedToItemType: 0,
	XmppThread: null,
	DepartmentID: '107972173855710031',
	DueDate: null,
	CountryCode: 'GR',
	InitialQuestion: null,
	ReverseIP: 'ppp-94-69-228-151.home.otenet.gr',
	VisitPhone: '6978791292',
	EndedBy: '107905455413102470',
	Answered: '2020-02-20T09:02:32.000Z',
	AutoTranslateAllowOriginal: 1,
	Closed: '2020-02-20T09:04:04.000Z',
	Flagged: null,
	transcript: [
		{
			SystemMessage: null,
			AccountID: '106562681705387893',
			CannedMessageID: null,
			ChatMessageID: '76194622379610583',
			VisitorFacing: null,
			PersonType: 1,
			Text: 'hi',
			Name: 'first name',
			ChatID: '107990982891167447',
			Created: '2020-02-20T09:02:50.950Z',
			LanguageCode: 'en-US',
			MessageKey: null,
			PersonID: '107990978786743687',
			Hidden: null,
			HasAutoTranslationError: null,
			Deleted: null,
			OriginalMessageID: null,
		},
		{
			SystemMessage: null,
			AccountID: '106562681705387893',
			CannedMessageID: null,
			ChatMessageID: '1663901027497522887',
			VisitorFacing: null,
			PersonType: 0,
			Text: '<p>bye</p>',
			Name: 'Tasos',
			ChatID: '107990918110291483',
			Created: '2020-02-20T07:01:41.947Z',
			LanguageCode: 'en-US',
			MessageKey: null,
			PersonID: '107905457743453281',
			Hidden: null,
			HasAutoTranslationError: null,
			Deleted: null,
			OriginalMessageID: null,
		},
	],
	agent: [
		{
			email: '[email protected]',
			displayName: 'Thanos',
		},
	],
};

Expected Livechat Chat Payload output

 {
	id: '107990982891167447',
	tags: [ 'Lead', 'escalate' ],
	duration: 37,
	source: 'bold360',
	postchatSurvey: [ { key: 'survey_field1', value: 'post chat field 1' } ],
	prechatSurvey: [ { key: 'survey_field1', value: 'pre chat field 1' } ],
	events: [
		{
			authorName: 'first name',
			text: 'hi',
			date: '2020-02-20T09:02:50.950Z',
			userType: 'visitor',
			type: 'message',
			timestamp: 1582189371,
			agentId: null
		},
		{
			authorName: 'Tasos',
			text: 'bye',
			date: '2020-02-20T07:01:41.947Z',
			userType: 'agent',
			type: 'message',
			timestamp: 1582182102,
			agentId: '107905457743453281'
		}
	],
	endedTimestamp: 1582189384,
	engagement: 'immediate_start',
	chatStartUrl: 'https://thechatshop.com/dev/test-chat.html',
	rate: 'rated_good',
	startedTimestamp: 1582189347,
	visitor: {
		id: '8894617890582013061',
		name: 'first name',
		ip: '94.69.228.151',
		city: 'Thessaloniki',
		countryCode: 'GR',
		region: 'Central Macedonia'
	}
}