GithubHelp home page GithubHelp logo

Comments (4)

mvshmakov avatar mvshmakov commented on July 1, 2024

And in general, there is currently no way to get the default functionality of the papercups-io/chat-widget, e.g., file uploading is absent, several options are impossible to pass like isClosable and etc. Would be great if we can get all the default things present in the base widget to work with the builder and make only some necessary visual corrections.

from chat-builder.

reichert621 avatar reichert621 commented on July 1, 2024

hey @mvshmakov! just curious, what do you mean by adding a "message counter"? (if all you need is to customize the toggle and add one other thing, it might be easier for us to just add support to the chat-widget library instead, because this library is more for complete customization)

from chat-builder.

mvshmakov avatar mvshmakov commented on July 1, 2024

Hey, @reichert621!

I have a Chat button and I want to dynamically change the numeric badge inside it depending on how many unread messages the user has. This should be dynamically changed on any new message coming to the client.

The chat-builder library exposes this functionality in state, which can be used to properly render things I want. There is no such exposed information in the chat-widget library. The onMessageReceived method is not sufficient enough, because we can't really identify how many messages came to the client before the page was rendered and we started to listen for new messages.

There are still ugly ways of implementing what I want to achieve, e.g., intercepting /api/conversations/customer in the service worker and postMessage into the main JS loop, but I do not want to complicate things right now ;) The only simple option I see is to copy-paste the components from chat-widget into the chat-builder render functions, which is not a great thing in terms of maintenance.

All in all, would be great to see the exact chat-widget implementation in the chat-builder library by default if no configuration is passed and default components are rendered. Otherwise, some way to expose the actual messages count would be good enough, e.g., dispatching messages:count event with unseen messages count on the chat init, messages read, and new incoming message. This way I'd be able to listen for it and process the data in a convenient way. Currently, the messages:unseen and messages:seen are not reliable in that sense, because, for instance, the messages:unseen is fired only once on init with only the first unread message. If there are more unread messages, there is no way to discover them.

from chat-builder.

mvshmakov avatar mvshmakov commented on July 1, 2024

Hey, @reichert621! Are there any plans to support this?

from chat-builder.

Related Issues (6)

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.