Code Monkey home page Code Monkey logo

embeddedchat's Introduction

Embedded chat: A staple in excellent customer service

image

An easy to use full-stack component (ReactJS + backend behaviors) embedding Rocket.Chat into your webapp.

EmbeddedChat is a full-stack React component node module of the RocketChat application that is fully configurable, extensible, and flexible for use. It is tightly bound with the RocketChat server using Rocket.Chat nodejs SDK and its UI using RocketChat's Fuselage Design System.

embeddedchatwall

Installation and Usage

Installation and usage documentation could be found here EmbeddedChat installation and usage

Development

Local Setup

To develop and test EmbeddedChat, a local instance of Rocket.Chat server is necessary. For setting up a Rocket.Chat development environment, follow the guide provided at Rocket.Chat GitHub Repository.

Prerequisites

  • Node.js: Version 16.19.0 is required. Use Node Version Manager (NVM) for easy switching between Node.js versions.

    To install and use the correct Node.js version, execute:

    nvm install
    nvm use
  • Yarn Workspaces: Ensure Yarn workspaces are enabled. If not, run:

    corepack enable

Install Dependencies

Install all necessary dependencies and build the packages (auth, api, and react) with:

yarn

Starting Storybook for React

Navigate to the react package and start Storybook:

cd packages/react
yarn storybook

Storybook should now be operational. Experiment with EmbeddedChat and its components, observing real-time changes in Storybook.

Note: Please make sure the "Enable CORS" option is ON in your Rocket.Chat server. It can be found in Administration > Settings > General > REST API > Enable CORS. It has to enabled to access the functionality of the app.

Custom Rocket Chat Server Configuration

By default, Storybook connects to http://localhost:3000. To use a different Rocket Chat server:

  • Create a .env file in the packages/react directory.

  • Set the STORYBOOK_RC_HOST variable:

    STORYBOOK_RC_HOST=<your-custom-url>

    Alternatively, run this command in the packages/react directory:

    STORYBOOK_RC_HOST=<your-custom-url> yarn storybook

Working with API and Auth Packages

Auth Package Development

To develop and test changes in the auth package:

  1. Navigate to the auth package directory.

  2. Start the playground server:

    cd packages/auth
    yarn dev

API Package Development

For development in the api package:

  1. Navigate to the api package directory.

  2. Start the playground server:

    cd packages/api
    yarn dev

Note: The react package depends on the api package. After making changes to api, rebuild it with yarn build in package/api, and then restart the react projects.

Similarly, the api package depends on the auth package. After changes to auth, rebuild it with yarn build in package/auth, and then restart the api development environment.

Conclusion

This setup provides a comprehensive environment for developing and testing the EmbeddedChat component, along with its associated api and auth packages. Enjoy exploring and enhancing the capabilities of EmbeddedChat!

Contributors

embeddedchat's People

Contributors

abhinavkrin avatar akshun-01 avatar ayush3160 avatar coderboy-yash avatar culturalprofessor avatar imf-ali avatar jeffreythecoder avatar kamlesh72 avatar komaldewnani avatar kushalsr avatar mdahsanfaraz avatar rahulnavneeth avatar rec0il99 avatar ronlek avatar sahilsekr42 avatar samad-yar-khan avatar sayan4444 avatar shivang-16 avatar sidmohanty11 avatar sing-li avatar skb231 avatar spiral-memory avatar sumitwarrior7 avatar tanu-chahal avatar thesynthax avatar umangutkarsh avatar venomfate-619 avatar vipindevelops avatar vishakha-aggarwal avatar yashraj7890 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  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  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  avatar  avatar  avatar  avatar  avatar

embeddedchat's Issues

Add a divider for messages belonging to same date

As an EmbedChat developer

I need to: add divider for messages date wise

So That: Message list looks more cleaner and date wise message can be readable

Acceptance Criteria

  • Add a divider for messages date wise. (Messages belonging to same date should have one divider)
  • Remove date for individual messages.
  • Show time for each message.

Setup Linting

As an EmbedChat developer

I need to: setup linting

So That: my code is clean and readable

Acceptance Criteria

  • make use of industry-standard linting (airbnb)

Add options to send messages in different formatted style

As an EmbedChat developer

I need to: Different options available while sending a message.
This will consist of following options:

  1. Bold
  2. Italic
  3. Strike
  4. Code
  5. Multiline

So That: I can send in specified way as mention above

Acceptance Criteria

  • Able to make message bold
  • Able to italic text
  • Able to strike text
  • Able to include code
  • Able to new line

Test out starring and pinning of messages on RC v5+

Description: Users don't join the channel when they get authenticated using Google SSO.

Steps to reproduce:

  1. Login into EmbeddedChat using Google SSO
  2. Notice that you are able to message
  3. Message in the channel
  4. Go to the RC server and see that the user isn't a member of that channel

Expected behavior:

User should automatically become a member of the channel when he/she messages into the channel

Actual behavior:

It isn't the case, but user can still message

Size getting large on sending long links

Description:

Steps to reproduce:

  1. Send a long link in the chat

Expected behavior:

The chat window should maintain its constant width

Actual behavior:

On sending longer links, the chat window gets enlarged

image

Providing real-time chat functionality using RocketChat node.js SDK.

As an EmbedChat developer
I Need to: use Rocket.Chat Node.Js SDK
So That: real-time chat functionality can be achieved with my component and the RC server

Acceptance Criteria

  • Install Node.js SDK
  • Initialize an RC Instance and connect to RC Server.
  • Create websockets on RC server.

Create a demo github page

As an EmbedChat developer

I need to: Create a Demo webpage

So That: Potential developers or companies can try out EmbeddedChat.

Acceptance Criteria

  • Create a gh-pages branch
  • Deploy the web app on root
  • Automate the process for every push
  • add a /demo to showcase the tech.co site

Parse Emojis inside the MessageBox

As an EmbedChat Developer
I need to: Show emojis within the message box as they are typed
So That: Users get instant feedback on selecting emojis

Acceptance Criteria

  • Render emojis within the message box.

A discrepancy of message parsing between RC and EmbeddedChat

Description: In the current approach for EmbeddedChat we are going with the legacy Markdown Component of RC which is made with markedjs and dompurify, but RC has moved into its own custom parser which causes markdown to conflict.

Steps to reproduce:

  1. Send # h1
  2. It should be a heading
  3. It shows as a heading in the EmbeddedChat but in RC -> # h1

Expected behavior:

Markdown should work universally.

Actual behavior:

It doesn't.

alignment of emoji with text

Description:

The alignment of emoji and text is a little bit off

Steps to reproduce:

  1. write a message with emoji

Expected behavior:

image

Actual behavior:

image

Logout user if cookies invalid

Description:

  • Remove the /me endpoint hit
  • Logout the user when cookies are invalid and the user performs an action

RC authToken doesn't have an expiry, so without checking for the cookies validation in each refresh we need to check if the token is valid when something errors out (like sending a message).

Expected behavior:

/me API call decreases the performance of the app and is not needed

Actual behavior:

A way to validate requests without worrying about the client side fiddle.

Support for message reactions

As an EmbedChat developer

I need to: Create functionality to react to any message

So That: UX of users increases significantly

Acceptance Criteria

  • API integration to send reactions
  • List all reactions and count of reactions under the message
  • Clicking on the reaction again should un-react the message

Installation errors with packages not found in registry.

Description:

When we clone the project and followed the steps in the README file. It is throwing errors that some packages are not found in the registry.

Steps to reproduce:

  1. git clone the EmbeddedChat project.
  2. npm i (at root) or (any command regarding node js)

Expected behavior:

Completed Installation of the node_modules.

Actual behavior:

image

`legacy contextAPI` warning using emoji-picker-reactv2 (Update emoji-picker-react to v3)

Tech-debt:

We are currently using JoyPixels emoji set which is also used in RocketChat.

But,

We are using v2 of emoji-picker-react, which is no longer maintained. It warns us showing that legacy contextAPI is not recommended to use in React.StrictMode environment.

Possible Approaches:

  • We can upgrade to v3 which uses the latest React but it doesn't serve us with joypixel emojis (this would mean the user will choose a native emoji but when it will be rendered it will come out to be different - JOYPIXELS)
  • or, We can stick with the current approach

Support to send and receive attachments

As an EmbedChat developer

I need to: Create functionality to send and receive attachments

So That: Users can send and receive attachments

Acceptance Criteria

  • API integration to send an attachment
  • Parse different types of attachments while receiving them in the <Message> component

Support to show Sender Avatar

As an EmbedChat developer

I need to: Add the avatar of the sender next to the message in the EmbedChat

So That: Users can easily identify who sent the message and improve the overall chat experience.

Acceptance Criteria

  • The avatar of the sender is displayed next to the message in the chat
  • The avatar is pulled from the user's profile, if available
  • The implementation does not impact the performance of the chat

Expected behavior
image

Actual behavior
image

[BUG] Overflown Message View

Description:

A long message (typically a link or a code line) greater than the Embedded Chat width overflows out of the container instead of getting line wraps.

Steps to reproduce:

  1. In the Embedded Chat, Send a long message with a link or an inline code (something like this) greater than the total width of the chat window.
    E.g.
    Send this message,
[ #17 ](https://github.com/RocketChat/Apps.Github22/issues/17) *Pull Request Review : Merge And  Comment on Pull Requests* : https://github.com/RocketChat/Apps.Github22/issues/17
  1. See the error

Expected behavior:

The messages should have line breaks and fit into the Chat window width.

Actual behavior:

image

image

(Message sent from the embedded chat was ffffffffvnnnnnnnnnnkkkkkkkkpllllllllllllpppppppppppppppppllllllllllllppppppppppppppnllnlj)

Additional Details

The Embedded Chat component

<RCComponent
              moreOpts={true}
              isClosable={true}
              setClosableState={setOpen}
              width={"auto"}
              height={isSmallScreen ? "30vh" : "55vh"}
              GOOGLE_CLIENT_ID={process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID}
              host={process.env.NEXT_PUBLIC_RC_URL}
              roomId={
                process.env.NEXT_PUBLIC_RC_ROOM_ID
                  ? process.env.NEXT_PUBLIC_RC_ROOM_ID
                  : "GENERAL"
              }
              channelName="General"
              anonymousMode={true}
              isFullScreenFromStart={false}
            />

Thank you!

Handle names as per RC core

Description: handling of username fails sometimes

Steps to reproduce:

  1. Issue that occurred at the demo page

Expected behavior:

Usernames should have been handled gracefully.

Actual behavior:

It broke

Fullscreen should occupy the entire window

Description: Full screen should not mean 100vh height but it should mean that the chat takes the total height of the window.

Steps to reproduce:

  1. set isFullScreenFromStart = true
  2. Observe it doesn't take complete height

Expected behavior:

Should take the complete height of the window - full screen

Actual behavior:

Doesn't do so

Support for thread messages

As an EmbedChat developer

I need to: Create the functionality to view and write in threads

So That: Users can use the thread functionality of RC and messages don't get cluttered in EmbeddedChat

Acceptance Criteria

  • UI for threads
  • List all thread messages of a thread
  • Writing a message inside that thread should trigger sendMessage to that specific thread

EmbeddedChat npm package cannot be accessed

Description:

When i try to install the package from npm it says not found.
Then if i try to install and use it manually, error pops up and doesn't work

Steps to reproduce:

  1. install from npm i @rocket.chat/embeddedchat
  2. We can see the npm errors
  3. Install directly from github still throws error

Expected behavior:

It should get install normally without a hassle

Actual behavior:

As it is not registered with npm cannot download it, neither the manual install works

Authentication using Google SSO

As an EmbedChat developer

I need to: Make use of google sso
So That: I can sign in or sign-up for EmbeddedChat
Acceptance Criteria

  • Create users if they do not exist
  • Change the username using RC token
  • fetch content upon sign-in/sign-up
  • show toast when login fails
  • Read-only for users which are not logged in (use anonymous mode)
  • logout functionality (user friendly logout message)

Support to see who all are present in the channel

As an EmbedChat developer

I need to: Add an option for the users to see all the members of that channel

So That: People know who all are there on the channel

Acceptance Criteria

  • Create an option in more options called "members" to check out all members of the channel

Delete Message Feature

As an EmbedChat developer

I need to: Add an option to delete a message if the message belongs to that user.

So That: EmbedChat Users can delete their own messages.

Acceptance Criteria

  • Implement the Delete functionality and the messages should be updated in realtime.

Differences between EmbeddedChat and iFrame

As an EmbedChat developer

I need to: Document the differences between EmbeddedChat and iFrame

So That: The scope and features for both are distinct and clear

Acceptance Criteria

  • Difference in features (one channel vs multichannel)
  • UI improvements (UI breaks happening in iframe)
  • Usecases!

Support for pinned and starred messages

As an EmbedChat developer

I need to: Create functionalities for pinning and starring messages

So That: Users can pin and star messages and view them in EmbeddedChat UI as well as re-visit them on RC

Acceptance Criteria

  • API integration for pinning messages
  • API integration for starring messages
  • UI to show both of them
  • Handle pinning functionality of messages for admins only (as per RC)

Display Toastbar according to user preference

Description: Fuselage's toast bar cannot be used to stick within the context of a component as it behaves like a portal.

Figure out a way to:

  • Show toast bar according to user preference

Better Responsiveness across screens of different sizes

As an EmbedChat developer
I Need to: Make the EmbedChat component Responsive
So That: It fits best on screens of all sizes and gives users usage options based on screen size

Acceptance Criteria

  • Emoji picker responsiveness.
  • Defaults
    • width = 100%
    • height = 1/4 of the screen size
  • Full-screen button on top right to expand the component to occupy the entire screen.
    • Show/hide features based on current size of the component.

Can't share images in embedded chat

Description:

Shared images in embedded chat can't be opened. The uploaded files point to localhost.

Steps to reproduce:

  1. Upload a screenshot in the chat
  2. Click on the link

Expected behavior:

The image opens in a new tab

Actual behavior:

image

Pinned Messages Not Displaying

Description:

When any user of a room pins a message, it is not displayed. Instead an icon is shown for indicating a pinned message.

Steps to reproduce:

  1. Pin any message
  2. The pinned message should be displayed in a suitable format.
  3. Pinned message should consist of who has pinned the message and which message has been pinned

Expected behavior:

Message should get pinned and displayed in Embedded chat

Actual behavior:

An icon is displayed instead.
image

Make parent iframe

As an EmbedChat developer

I need to: be able to load my component from within an iframe

So That:

  • it doesn't inherit parent css
  • fullscreen works
  • toast remains within the iframe container

Acceptance Criteria

  • Create a GitHub repo and embed the component
  • Host it using GitHub pages
  • Take the URL and make the /demo page with EmbeddedChat as an iframe

Write CI to publish on jsDelivr and npm registry

As an EmbedChat developer

I need to: Publish the package in npm registry and jsDelivr

So That:Any developer can use EC in their apps

Acceptance Criteria

  • Publish the package to both jsDelivr and npm

Messages do not display after clicking on back oprion from starred/pinned messages.

Description:

Messages does not display after we click back oprion from starred or pinned messages.

Steps to reproduce:

  1. Click on pinned/starred messages at the chat header
  2. Once the pinned/starred messages come, click on Go Back
  3. All the messages should come successfully on clicking back

Expected behavior:

All the messages should display on clicking Go back.

Actual behavior:

Empty chat body

screen-capture.webm

Store user's info if not present or if not same user

Description:

#51 solves it partially by adding a me call to the API when there is no user info stored in our localstorage but if the user changed its cookies into a new user's cookies he will still get his user profile image as the previous one and also the app would show indeterministic UI.

Steps to reproduce:

Note: During development only!

  1. Login into EmbeddedChat
  2. Login into some other account in RC
  3. Come back to see in EC that you have the same profile image as before but you message with the user you logged in with in RC.

Expected behavior:

User details should get updated

Actual behavior:

They don't.

Extra

You can take help of this PR to get everything working if user's info is missing and add into it a functionality to check if the user has been changed midway! This could be possible if we add a check to user_id cookie to a stored version at localstorage or if you have an amazing way, please feel free to post it here!

Add headerColor attribute

As an EmbedChat developer

I need to: Create a headerColor prop

So That: Use headerColor to set header text color, header background color, and description color.

Acceptance Criteria

  • create a headerColor prop
  • using headerColor determine the background, text, description colors

Edit Message Feature

As an EmbedChat developer

I need to: Add an option to edit a message if the message belongs to that user.

So That: EmbeddedChat Users can edit their own messages.

Acceptance Criteria

  • Implement the Editing Message functionality and the messages should be updated in realtime.

Not displaying joining or leaving message properly

Description:

Whenever a user leave or join a channel or removed by someone from the channel, then the message is not displaying properly.

Steps to reproduce:

  1. Join/Leave the channel through the RC server.
  2. Login in embedded chat through any account.
  3. See the joining/leaving message.

Expected behavior:

The message should be something like this:

  • In case of joining - @username joined the channel
  • In case of leaving - @username left the channel
  • In case of removing by admin/owner - @adminUsername removed @username

Actual behavior:

Only the username is printing on the screen with no clear message either the user has joined the channel or left the channel.

Update README

I had some Readme changes in mind, please feel free to add them and modify the README into a cool one if you are willing to.

  • Addition of a link to the Wiki/FAQs page for videos,
  • Link to Roots of EmbeddedChat wiki with a link to this that will help people get a better sense of understanding of its internals.
  • A cool screenshot maybe! You can refer this
  • Add headerColor, toastBarPosition to the props list and update its description, refer this

Feel free to add more to this list if you think something else needs to be changed. This will be a significant contribution!

Originally posted by @sidmohanty11 in #65 (review)

Explore TOTP compatibility

As an EmbedChat developer

I need to: Research upon TOTP

So That: EmbeddedChat works with TOTP enabled as well as disabled.

Acceptance Criteria

  • Add TOTP capabilities!

Add a report user feature

As an EmbedChat developer

I need to: Allow users to be able:

  • Click the report button next to a chat.
  • Add a description, stating the report reason
  • Click a button to confirm.

So That: Users can report messages from the Embeded Chat window, instead of having to do it from the main Rocket.Chat host.

Acceptance Criteria

  • Add a report button, when A user hovers over the chat message.
  • Upon cliking the report button, a small pop-up would appear asking why they would like to report it. This contains: A report description, cancel, and send Report.
  • Make an API call to send the user's report message to server.

Proposed changes
Screen Shot 2023-01-23 at 4 02 53 PM

Support to show which user is typing

As an EmbedChat developer

I need to: Add a feature to show the username of the user that are typing.

So That: Embedded Chat users can see which user's are typing.

Acceptance Criteria

  • Show the username's of user's that are typing like Rocket Chat shows.

Screenshot 2023-01-14 055111

Add user profile pictures on the left of each chat

As a user of Embeded Chat user,
I want to be able to add a profile picture to my account so that it displays next to my username in the chat,
while still maintaining the lightweight nature of the application.

Acceptance Criteria

  • The profile picture should be displayed next to the username in their chats, or attached files.
  • Only load the required number of profile pictures, since the user will only be looking at 20-30 chat messages at a time.

image not visible in chat on file upload

Description:

The image is not visible on the chat screen, it is visible as a link instead of an image.
The image uploaded from the Embedded chat is coming as a file.

Steps to reproduce:

  1. Click on + icon to add image
  2. Hit enter to send the image
  3. The image would come as a file in the application
  4. That image would also come as a file in the rocket chat server

Expected behaviour:

image

Actual behaviour:

image

Warning of `using eval statements is highly discouraged` from the RC Node.js SDK

Description: The current Rocket.Chat Nodejs SDK has js-sha256 as its dependency which is showing the warning message.

Rocket.Chat Nodejs SDK v1.0.0-alpha.42

LINKED ISSUE IN RC Node.js SDK: issue

Steps to reproduce:

  1. npm run build and you will see it in the terminal

Expected behavior:

Not to show any warning message.

Actual behavior:

Shows a warning message.

image

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.