Skip to content

Conversation

johnny-hsiao
Copy link
Contributor

We have plugins in the sidebar that needs to receive events from the backend to refresh on changes made.

To verify this change, you can make these changes:
app/models/conversation.rb
include Syncable

app/services/message_apis/inbox_sections/presenter.rb

def initialization_hook
    ...
          definitions: [
            {
              type: "content",
              events: ["new_item_received"]
            }
          ]
    ...
end

in rails console:
Conversation.last.notify_events_subscribers(, 'new_item_received',
{ conversation_key: })

michelson and others added 30 commits June 5, 2021 12:44
* adding missing translation + switch

* snack will dissapear after 2.5 secs

* New translations en.yml (Catalan)

* New translations en.yml (Ukrainian)

* New translations en.yml (Turkish)

* New translations en.yml (Chinese Simplified)

* New translations en.yml (Vietnamese)

* New translations en.yml (English)

* New translations en.yml (Romanian)

* New translations en.yml (Greek)

* New translations en.yml (Korean)

* New translations en.yml (Japanese)

* New translations en.yml (Italian)

* New translations en.yml (Hungarian)

* New translations en.yml (Hebrew)

* New translations en.yml (Finnish)

* New translations en.yml (German)

* New translations en.yml (Norwegian)

* New translations en.yml (Danish)

* New translations en.yml (Czech)

* New translations en.yml (Arabic)

* New translations en.yml (Afrikaans)

* New translations en.yml (Spanish)

* New translations en.yml (French)

* New translations en.yml (Dutch)

* New translations en.yml (Polish)

* New translations en.yml (Swedish)

* New translations en.yml (Portuguese)

* New translations en.yml (Serbian (Cyrillic))

* New translations en.yml (Russian)

* bots translations fix
* rubocoped , rubocop-rails

* provisory revert

* editor fix, avoid deep nesting of schema controls + task for clean

* cy bot tasks fix

* adding missing translation + switch

* snack will dissapear after 2.5 secs

* New translations en.yml (Catalan)

* New translations en.yml (Ukrainian)

* New translations en.yml (Turkish)

* New translations en.yml (Chinese Simplified)

* New translations en.yml (Vietnamese)

* New translations en.yml (English)

* New translations en.yml (Romanian)

* New translations en.yml (Greek)

* New translations en.yml (Korean)

* New translations en.yml (Japanese)

* New translations en.yml (Italian)

* New translations en.yml (Hungarian)

* New translations en.yml (Hebrew)

* New translations en.yml (Finnish)

* New translations en.yml (German)

* New translations en.yml (Norwegian)

* New translations en.yml (Danish)

* New translations en.yml (Czech)

* New translations en.yml (Arabic)

* New translations en.yml (Afrikaans)

* New translations en.yml (Spanish)

* New translations en.yml (French)

* New translations en.yml (Dutch)

* New translations en.yml (Polish)

* New translations en.yml (Swedish)

* New translations en.yml (Portuguese)

* New translations en.yml (Serbian (Cyrillic))

* New translations en.yml (Russian)

* bots translations fix
* New translations en.yml (Catalan)

* New translations en.yml (Polish)

* New translations en.yml (Portuguese)

* New translations en.yml (Russian)

* New translations en.yml (Serbian (Cyrillic))

* New translations en.yml (Korean)

* New translations en.yml (Dutch)

* New translations en.yml (Norwegian)

* New translations en.yml (Chinese Simplified)

* New translations en.yml (Vietnamese)

* New translations en.yml (Swedish)

* New translations en.yml (Turkish)

* New translations en.yml (Ukrainian)

* New translations en.yml (Japanese)

* New translations en.yml (Afrikaans)

* New translations en.yml (Arabic)

* New translations en.yml (Czech)

* New translations en.yml (Romanian)

* New translations en.yml (French)

* New translations en.yml (Spanish)

* New translations en.yml (Danish)

* New translations en.yml (Hebrew)

* New translations en.yml (Hungarian)

* New translations en.yml (Italian)

* New translations en.yml (German)

* New translations en.yml (Greek)

* New translations en.yml (Finnish)

* New translations en.yml (Spanish)
* New translations en.yml (Catalan)

* New translations en.yml (Polish)

* New translations en.yml (Portuguese)

* New translations en.yml (Russian)

* New translations en.yml (Serbian (Cyrillic))

* New translations en.yml (Korean)

* New translations en.yml (Dutch)

* New translations en.yml (Norwegian)

* New translations en.yml (Chinese Simplified)

* New translations en.yml (Vietnamese)

* New translations en.yml (Swedish)

* New translations en.yml (Turkish)

* New translations en.yml (Ukrainian)

* New translations en.yml (Japanese)

* New translations en.yml (Afrikaans)

* New translations en.yml (Arabic)

* New translations en.yml (Czech)

* New translations en.yml (Romanian)

* New translations en.yml (French)

* New translations en.yml (Spanish)

* New translations en.yml (Danish)

* New translations en.yml (Hebrew)

* New translations en.yml (Hungarian)

* New translations en.yml (Italian)

* New translations en.yml (German)

* New translations en.yml (Greek)

* New translations en.yml (Finnish)
* dark mode ready

* cy specs fix, use data-cy

* format

* conversation buttons
* New translations en.yml (Catalan)

* New translations en.yml (Polish)

* New translations en.yml (Portuguese)

* New translations en.yml (Russian)

* New translations en.yml (Serbian (Cyrillic))

* New translations en.yml (Korean)

* New translations en.yml (Dutch)

* New translations en.yml (Norwegian)

* New translations en.yml (Chinese Simplified)

* New translations en.yml (Vietnamese)

* New translations en.yml (Swedish)

* New translations en.yml (Turkish)

* New translations en.yml (Ukrainian)

* New translations en.yml (Japanese)

* New translations en.yml (Afrikaans)

* New translations en.yml (Arabic)

* New translations en.yml (Czech)

* New translations en.yml (Romanian)

* New translations en.yml (French)

* New translations en.yml (Spanish)

* New translations en.yml (Danish)

* New translations en.yml (Hebrew)

* New translations en.yml (Hungarian)

* New translations en.yml (Italian)

* New translations en.yml (German)

* New translations en.yml (Greek)

* New translations en.yml (Finnish)
* monorepo, components / docs / messenger

* packages set

* hints + prettier

* shared components into component

* shared code

* store + conversation port

* components reference single file

* store decoupled

* editor decouple

* update dante
* sliping away, fixes chaskiq#415

* change campaign name , tackles chaskiq#416

* field renderer fix
* campaign inbound email, disable reply from

* quick replies fixes
* editor video less on mailing + phone attribute missing
* package validation phase

* article update mutation permit null content

* dialogflow integration event

* peer deps on packages

* issue template
* remove jsrassign

* Remove hard coded email address

* dialogflow query-params

* days_ago translations

* user state

Co-authored-by: Kips <patrickjdavenport@gmail.com>
* New translations en.yml (Romanian)

* New translations en.yml (Polish)

* New translations en.yml (Portuguese)

* New translations en.yml (Russian)

* New translations en.yml (Serbian (Cyrillic))

* New translations en.yml (Korean)

* New translations en.yml (Dutch)

* New translations en.yml (Norwegian)

* New translations en.yml (Chinese Simplified)

* New translations en.yml (Vietnamese)

* New translations en.yml (Swedish)

* New translations en.yml (Turkish)

* New translations en.yml (Ukrainian)

* New translations en.yml (Japanese)

* New translations en.yml (Arabic)

* New translations en.yml (Catalan)

* New translations en.yml (Czech)

* New translations en.yml (Afrikaans)

* New translations en.yml (Danish)

* New translations en.yml (Hebrew)

* New translations en.yml (Hungarian)

* New translations en.yml (Italian)

* New translations en.yml (Greek)

* New translations en.yml (Finnish)
* New translations en.yml (Chinese Simplified)

* New translations en.yml (Chinese Simplified)

* New translations en.yml (Chinese Simplified)

* New translations definitions.en.yml (Chinese Simplified)

* New translations doorkeeper.en.yml (Chinese Simplified)

* New translations hints.en.yml (Chinese Simplified)

* New translations subscriptions.en.yml (Chinese Simplified)

* New translations en.yml (Chinese Simplified)

* New translations definitions.en.yml (Chinese Simplified)

* New translations doorkeeper.en.yml (Chinese Simplified)

* New translations definitions.en.yml (Chinese Simplified)

* New translations doorkeeper.en.yml (Chinese Simplified)

* New translations devise_invitable.en.yml (Chinese Simplified)

* New translations hints.en.yml (Chinese Simplified)
* New translations devise.en.yml (Chinese Simplified)

* New translations doorkeeper.en.yml (Chinese Simplified)

* New translations devise_invitable.en.yml (Chinese Simplified)

* New translations subscriptions.en.yml (Chinese Simplified)

* postcss 8, tailwind 2.1

* modal translations

* New translations en.yml (Italian)

* New translations en.yml (Italian)

* New translations en.yml (Italian)

* New translations en.yml (Italian)

* New translations en.yml (Italian)

* complete missing translations

* more on translations

* more missing translations

* google fonts support on banners

* chinesse two letters change

* closed at and allow replies on closed conversation settings

* specs on inbound

* inbound settings refactor, other tweaks

* update gemfile

* contact manager cc issue fix

* button tab switch refactor

* esm remove package

* handle state change on conversation

* conversation part delegate broadcast key
* New translations devise.en.yml (Chinese Simplified)

* New translations doorkeeper.en.yml (Chinese Simplified)

* New translations devise_invitable.en.yml (Chinese Simplified)

* New translations subscriptions.en.yml (Chinese Simplified)

* New translations en.yml (Italian)

* New translations en.yml (Italian)

* New translations en.yml (Italian)

* New translations en.yml (Italian)

* New translations en.yml (Italian)

* New translations en.yml (Romanian)

* New translations definitions.en.yml (Finnish)

* New translations definitions.en.yml (Hebrew)

* New translations en.yml (Hebrew)

* New translations en.yml (Finnish)

* New translations en.yml (Hungarian)

* New translations definitions.en.yml (Greek)

* New translations en.yml (Greek)

* New translations definitions.en.yml (Hungarian)

* New translations definitions.en.yml (German)

* New translations definitions.en.yml (Japanese)

* New translations definitions.en.yml (Korean)

* New translations en.yml (Korean)

* New translations definitions.en.yml (Romanian)

* New translations definitions.en.yml (Italian)

* New translations en.yml (Italian)

* New translations en.yml (Japanese)

* New translations en.yml (German)

* New translations en.yml (Spanish)

* New translations definitions.en.yml (Afrikaans)

* New translations en.yml (Afrikaans)

* New translations definitions.en.yml (Spanish)

* New translations en.yml (French)

* New translations definitions.en.yml (French)

* New translations en.yml (Arabic)

* New translations definitions.en.yml (Czech)

* New translations definitions.en.yml (Arabic)

* New translations en.yml (Danish)

* New translations definitions.en.yml (Danish)

* New translations en.yml (Czech)

* New translations en.yml (Catalan)

* New translations definitions.en.yml (Catalan)

* New translations definitions.en.yml (Ukrainian)

* New translations en.yml (Ukrainian)

* New translations definitions.en.yml (Turkish)

* New translations en.yml (Turkish)

* New translations en.yml (Chinese Simplified)

* New translations en.yml (Swedish)

* New translations definitions.en.yml (Vietnamese)

* New translations en.yml (Vietnamese)

* New translations definitions.en.yml (Chinese Simplified)

* New translations definitions.en.yml (English)

* New translations en.yml (English)

* New translations definitions.en.yml (Swedish)

* New translations en.yml (Polish)

* New translations definitions.en.yml (Norwegian)

* New translations definitions.en.yml (Polish)

* New translations en.yml (Norwegian)

* New translations definitions.en.yml (Dutch)

* New translations en.yml (Dutch)

* New translations definitions.en.yml (Serbian (Cyrillic))

* New translations en.yml (Serbian (Cyrillic))

* New translations en.yml (Portuguese)

* New translations definitions.en.yml (Russian)

* New translations en.yml (Russian)

* New translations definitions.en.yml (Portuguese)

* fix translations
* playground components

* reports sections + new dashboard view

* adjust dark colors

* disable renderer app package on agent conversation (chat)

* new switch control on sidebar / sidebar toggle children

* csat package + reports

* fix specs + rubocop
Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/sporkmonger/addressable/releases)
- [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md)
- [Commits](sporkmonger/addressable@addressable-2.7.0...addressable-2.8.0)

---
updated-dependencies:
- dependency-name: addressable
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
michelson and others added 14 commits May 16, 2022 16:55
* put some packages on dev

* updated yarn deps

* internal package socket

* put on hold event, kredis access simplification

* handlers api, on hold behavior

* Update app/services/message_apis/twilio_phone/api.rb
* Twilio thread slicing

* start conversation from the inbox

* initiator channel on start conversation, handle fail on Graphql client,

* clean editor EEDropdown

* handle errors on email hook and action trigger

* new conversation state refactor
* use ruby 2.7.5

* revert hash syntax on cop

* remove borales yarn

* bundler version and uri fix
Co-authored-by: Johnny Hsiao <johnny.hsiao@thinkresearch.com>
@CLAassistant
Copy link

CLAassistant commented Jun 28, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 7 committers have signed the CLA.

✅ michelson
✅ menfs-at-think
❌ dependabot[bot]
❌ marcbest
❌ marinaxkonsta
❌ johnny-hsiao
❌ johnnythinks
You have signed the CLA already but the status is still pending? Let us recheck it.

@@ -12,6 +12,7 @@ import I18n from '../../shared/FakeI18n';
import RestrictedArea, {
allowedAccessTo,
} from '@chaskiq/components/src/components/AccessDenied';
import { useEventBroker } from '../../shared/EventBroker';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use the messages from cableApp in Appcontainer.tsx?

| 'PresenceChannel'
| 'AgentChannel';

export function useEventBroker(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function useEventBroker has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.

@johnny-hsiao johnny-hsiao force-pushed the eventing-to-sidebar branch from 07c132b to b8ee42f Compare June 29, 2022 19:49
@@ -19,14 +19,43 @@ function localeDate(date) {
return new Date(date).toLocaleString();
}

export const eventsSubscriber = (appId, cableApp, callback) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @johnny-hsiao I still not sure why is there is a new subscription to cable instead of leveraging the events provided on AppContainer.tsx.

@johnny-hsiao johnny-hsiao force-pushed the eventing-to-sidebar branch from b261976 to e844eb0 Compare June 30, 2022 21:44
@johnny-hsiao johnny-hsiao force-pushed the eventing-to-sidebar branch from e844eb0 to 428b61c Compare June 30, 2022 21:48
@@ -83,6 +84,7 @@ export const eventsSubscriber = (appId, cableApp, dispatch, fetchApp) => {
?.contentWindow;
popup && popup.postMessage(data, '*');
default:
dispatch(appEventReceived(data))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to add a specific type of handling for this, appEvent is too general, if this event is intended for AppPackages let's name this AppPackage event, and handle this with app_package on the data.type

@johnny-hsiao johnny-hsiao force-pushed the eventing-to-sidebar branch from 6512dcb to c599188 Compare July 4, 2022 14:04
@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 7652ed4 and detected 0 issues on this pull request.

View more on Code Climate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.