Remove LIvechat global variable from RC namespace (#13378)

* Remove some dependencies inside rocketchat-lib/client  (#13210)

* Move function to rc-utils

* Change import from to export directly

* Removing duplicated dependency and remove old code

* Import some variables to remove dependency of RC namespace

* Remove some dependencies inside rocketchat-lib/lib (#13212)

* Move some functions from lib to rc-ui-utils

* Move some functions from lib ro rc-utils

* Remove hostname from RC namespace

* Import variables to remove dependency of RC namespace

* Remove some dependencies inside rocketchat-lib/server/functions (#13214)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Remove some dependencies inside rocketchat-lib/server/lib (#13217)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Remove some dependencies inside rocketchat-lib/server/methods (#13218)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Remove some dependencies inside rocketchat-lib/server/startup, publications... (#13222)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings (#13223)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

*  Export functions and lib function of rc-lib but keep it inside RC namespace (#13225)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Fix missed exports and re-add some functions to RC namespace

*  Import variables from functions and lib to remove RC namespace dependency (#13226)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

*  Remove dependency of RC namespace in rc-sandstorm (#13227)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

*  Remove dependency of RC namespace in chatpal-search (#13231)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

*  Remove dependency of RC namespace in meteor saml (#13233)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

*  Remove dependency of RC namespace in rc-theme (#13234)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

*  Remove dependency of RC namespace in rc-2fa (#13235)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

*  Remove dependency of RC namespace in rc-action-links (#13236)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

*  Remove dependency of RC namespace in rc-analytics and rc-assets (#13237)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Rename Assets variable to avoid conflicts

* Fix rename Assets

*  Remove dependency of RC namespace in rc-markdown, rc-autolinker and rc-autotranslate (#13240)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Fix wrong imports

*  Remove dependency of RC namespace in rc-blockstack, bot-helpers and cas (#13246)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-settings (#13251)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* readd saveRoomName to RC namespace

*  Remove dependency of RC namespace in rc-channel-mail-messages and cloud (#13254)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

*  Remove dependency of RC namespace in rc-colors, cors, crowd and dolphin (#13255)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

* Remove dependency of RC namespace in rc-colors

* Remove dependency of RC namespace in rc-cors

* Remove dependency of RC namespace in rc-crowd

* Remove dependency of RC namespace in rc-dolphin

*  Remove dependency of RC namespace in rc-emoji-custom and drupal (#13256)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

* Remove dependency of RC namespace in rc-colors

* Remove dependency of RC namespace in rc-cors

* Remove dependency of RC namespace in rc-crowd

* Remove dependency of RC namespace in rc-dolphin

* Remove dependency of RC namespace in rc-drupal

* Move Emoji custom server and client models to rc-models

* Remove dependency of RC namespace in rc-emoji-custom

* Remove dependency of RC namespace in rc-emojione, error-handler, gh-enterprise and gitlab (#13257)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

* Remove dependency of RC namespace in rc-colors

* Remove dependency of RC namespace in rc-cors

* Remove dependency of RC namespace in rc-crowd

* Remove dependency of RC namespace in rc-dolphin

* Remove dependency of RC namespace in rc-drupal

* Move Emoji custom server and client models to rc-models

* Remove dependency of RC namespace in rc-emoji-custom

* Remove dependency of RC namespace in rc-emojione

* Remove dependency of RC namespace in rc-error-handler

* Remove dependency of RC namespace in rc-gh-enterprise

* Remove dependency of RC namespace in rc-gitlab

* Remove dependency of RC namespace in rc-google-natural-language, grant, google-vision and highlight-words (#13258)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

* Remove dependency of RC namespace in rc-colors

* Remove dependency of RC namespace in rc-cors

* Remove dependency of RC namespace in rc-crowd

* Remove dependency of RC namespace in rc-dolphin

* Remove dependency of RC namespace in rc-drupal

* Move Emoji custom server and client models to rc-models

* Remove dependency of RC namespace in rc-emoji-custom

* Remove dependency of RC namespace in rc-emojione

* Remove dependency of RC namespace in rc-error-handler

* Remove dependency of RC namespace in rc-gh-enterprise

* Remove dependency of RC namespace in rc-gitlab

* Remove dependency of RC namespace in rc-google-natural-language

* Remove dependency of RC namespace in rc-grant

* Remove dependency of RC namespace in rc-highlight-words

* Remove dependency of RC namespace in rc-google-vision

* Fix lint

*  Remove dependency of RC namespace in rc-iframe-login and all imports, except hipchat-enterprise (#13259)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

* Remove dependency of RC namespace in rc-colors

* Remove dependency of RC namespace in rc-cors

* Remove dependency of RC namespace in rc-crowd

* Remove dependency of RC namespace in rc-dolphin

* Remove dependency of RC namespace in rc-drupal

* Move Emoji custom server and client models to rc-models

* Remove dependency of RC namespace in rc-emoji-custom

* Remove dependency of RC namespace in rc-emojione

* Remove dependency of RC namespace in rc-error-handler

* Remove dependency of RC namespace in rc-gh-enterprise

* Remove dependency of RC namespace in rc-gitlab

* Remove dependency of RC namespace in rc-google-natural-language

* Remove dependency of RC namespace in rc-grant

* Remove dependency of RC namespace in rc-highlight-words

* Remove dependency of RC namespace in rc-google-vision

* Fix lint

* Remove dependency of RC namespace in rc-iframe-login

* Remove dependency of RC namespace in all importes, except hipchat-enterprise

* Move RestAPI client to rc-api package

* Remove dependency of RC namespace in rc-api/helpers and api.js

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

* import API where it was being used by the RC namespace

* Move processWebhookMessage function to rc-lib package

* Remove API from RC namespace and import missing function that was being used with namespace

* Remove dependency of RC namespace in rc-graphql

* Fix import from wrong package

* Remove dependency of RC namespace in rc-importer

* Remove dependency of RC namespace in rc-issue-links

* Remove dependency of RC namespace in rc-katex

* Move templateVarHandler fn to rc-utils

* Remove dependency of RC namespace in rc-ldap

* Remove dependency of RC namespace in rc-livestream

* Remove dependency of RC namespace in rc-mail-messages

* Remove dependency of RC namespace in rc-mapview

* Remove dependency of RC namespace in rc-mentions

* Remove dependency of RC namespace in rc-mentions-flextab

* Remove depedency of RC namespace in rc-message-attachements

* Remove dependdency of RC namespace in rc-message-mark-as-unread

* Remove dependency of RC namespace in rc-message-pin

* Fix templateVarHandler that was in wrong folder

* Remove namespace in the new livechat endpoint

* Remove dependency of RC namespace in rc-message-snippet

* Remove dependency of RC namespace in rc-message-star

* Remove dependency of RC namespace in rc-oauth2

* Remove dependency of RC namespace in rc-oembed

* Remove dependency of RC namespace in rc-otr

* Remove dependency of RC namespace in rc-reactions

* Remove dependency of RC namespace in rc-retention-policy

* Remove dependency of RC namespace in rc-earch

* Remove dependency of RC namespace in rc-setup-wizard

* Remove dependency of RC namespace in rc-slackbridge

* Remove dependency of Rc namespace in slashcommands-asciiarts

* Remove depedency of RC namespace in rc-slash-archiveroom

* Remove dependency of RC namespace in rc-slash-create

* Remove dependency of RC namespace in rc-slash-help

* Remove dependency of RC namespace in rc-slash-hide

* Remove dependency of RC namespace in rc-slash-invite

* Remove dependency of RC namespace in rc-slash-inviteall

* Remove dependency of RC namespace in rc-slash-join

* Remove dependency of RC namespace in rc-slash-kick

* Remove dependency of RC namespace in rc-slash-leave

* Remove dependency of RC namespace in rc-slash-me

* Remove dependency of RC namespace in rc-slash-msg

* Remove dependency of RC namespace in rc-slash-mute

* Remove dependency of RC namespace in rc-slash-open

* Remove dependency of RC namespace in rc-slash-topic

* Remove dependency of RC namespace in rc-slash-unarchiveroom

* Remove dependency of RC namespace in rc-smarsh-connector

* Remove dependency of RC namespace in rc-sms

* Remove dependency of RC namespace in rc-spotify

* Remove dependency of RC namespace in rc-statistics

* Move tokenpass models methods to rc-models

* Remove dependency of RC namespace in rc-tokenpass

* import tokenpass inside rc-lib

* Remove dependency of RC namespace in rc-ui

* Move webdavAccounts models to rc-model

* Remove dependency of RC namespace in rc-ui-account

* Remove dependency of RC namespace in rc-ui-admin

* Remove dependency of RC namespace in rc-ui-clean-history

* Remove dependency of RC namespace in rc-ui-flextab

* Remove dependency of RC namespace in rc-ui-login

* Remove dependency of RC namespace in rc-ui-master

* Remove dependency of RC namespace in rc-ui-message

* REmove dependency of RC namespace in rc-user-data-download

* Remove dependency of RC namespace in rc-version-check

* Remove dependency of RC namespace in rc-videobridge

* Remove dependency of RC namespace in rc-webdav

* Remove dependency of RC namespace in rc-wordpress

* Remove some RC namespace use in chatpal-search

* Remove dependency of RC namespace in rc-irc

* Remove dependency of RC namespace in livechat/client

* Move methods in common livechat models to rc-models

* Remove dependency of RC namespace in rc-livechat/server/models

* Remove LIvechat global variable from RC namespace

*  Remove dependency of RC namespace in rc-api/helpers and api.js (#13273)

* Move RestAPI client to rc-api package

* Remove dependency of RC namespace in rc-api/helpers and api.js

*  Remove dependency of RC namespace on half of api files (#13275)

* Move RestAPI client to rc-api package

* Remove dependency of RC namespace in rc-api/helpers and api.js

* Remove dependency of RC namespace on half of api files

* Import missed functions in rc-irc

* Partial Remove dependency of RC namespace in rc-api (#13277)

* Move RestAPI client to rc-api package

* Remove dependency of RC namespace in rc-api/helpers and api.js

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

* Remove dependency of RC namespace in rc-api (#13278)

* Move RestAPI client to rc-api package

* Remove dependency of RC namespace in rc-api/helpers and api.js

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

* import API where it was being used by the RC namespace

* Move processWebhookMessage function to rc-lib package

* Remove API from RC namespace and import missing function that was being used with namespace

* Remove namespace in the new livechat endpoint

*  Remove dependency of RC namespace in rc-graphql (#13279)

* Move RestAPI client to rc-api package

* Remove dependency of RC namespace in rc-api/helpers and api.js

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

* import API where it was being used by the RC namespace

* Move processWebhookMessage function to rc-lib package

* Remove API from RC namespace and import missing function that was being used with namespace

* Remove dependency of RC namespace in rc-graphql

* Fix import from wrong package

* Remove namespace in the new livechat endpoint

* Remove dependency of RC namespace in rc-importer (#13280)

* Move RestAPI client to rc-api package

* Remove dependency of RC namespace in rc-api/helpers and api.js

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

* import API where it was being used by the RC namespace

* Move processWebhookMessage function to rc-lib package

* Remove API from RC namespace and import missing function that was being used with namespace

* Remove dependency of RC namespace in rc-graphql

* Fix import from wrong package

* Remove dependency of RC namespace in rc-importer

* Remove namespace in the new livechat endpoint

*  Remove dependency of RC namespace in rc-ldap, katex and issue-links (#13281)

* Move RestAPI client to rc-api package

* Remove dependency of RC namespace in rc-api/helpers and api.js

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

* import API where it was being used by the RC namespace

* Move processWebhookMessage function to rc-lib package

* Remove API from RC namespace and import missing function that was being used with namespace

* Remove dependency of RC namespace in rc-graphql

* Fix import from wrong package

* Remove dependency of RC namespace in rc-importer

* Remove dependency of RC namespace in rc-issue-links

* Remove dependency of RC namespace in rc-katex

* Move templateVarHandler fn to rc-utils

* Remove dependency of RC namespace in rc-ldap

* Fix templateVarHandler that was in wrong folder

* Remove namespace in the new livechat endpoint

*  Remove dependency of RC namespace in rc-livestream and rc-mail-messages (#13320)

* Move RestAPI client to rc-api package

* Remove dependency of RC namespace in rc-api/helpers and api.js

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

* import API where it was being used by the RC namespace

* Move processWebhookMessage function to rc-lib package

* Remove API from RC namespace and import missing function that was being used with namespace

* Remove dependency of RC namespace in rc-graphql

* Fix import from wrong package

* Remove dependency of RC namespace in rc-importer

* Remove dependency of RC namespace in rc-issue-links

* Remove dependency of RC namespace in rc-katex

* Move templateVarHandler fn to rc-utils

* Remove dependency of RC namespace in rc-ldap

* Remove dependency of RC namespace in rc-livestream

* Remove dependency of RC namespace in rc-mail-messages

* Fix templateVarHandler that was in wrong folder

* Remove namespace in the new livechat endpoint
pull/13379/head^2
Marcos Spessatto Defendi 7 years ago committed by Rodrigo Nascimento
parent ec1b7532f1
commit 62246ce97c
  1. 9
      packages/rocketchat-livechat/imports/server/rest/departments.js
  2. 5
      packages/rocketchat-livechat/imports/server/rest/facebook.js
  3. 5
      packages/rocketchat-livechat/imports/server/rest/sms.js
  4. 9
      packages/rocketchat-livechat/imports/server/rest/users.js
  5. 3
      packages/rocketchat-livechat/lib/messageTypes.js
  6. 3
      packages/rocketchat-livechat/server/agentStatus.js
  7. 5
      packages/rocketchat-livechat/server/api/lib/livechat.js
  8. 6
      packages/rocketchat-livechat/server/api/v1/agent.js
  9. 6
      packages/rocketchat-livechat/server/api/v1/customField.js
  10. 11
      packages/rocketchat-livechat/server/api/v1/message.js
  11. 4
      packages/rocketchat-livechat/server/api/v1/offlineMessage.js
  12. 4
      packages/rocketchat-livechat/server/api/v1/pageVisited.js
  13. 5
      packages/rocketchat-livechat/server/api/v1/room.js
  14. 4
      packages/rocketchat-livechat/server/api/v1/transcript.js
  15. 9
      packages/rocketchat-livechat/server/api/v1/visitor.js
  16. 3
      packages/rocketchat-livechat/server/hooks/RDStation.js
  17. 3
      packages/rocketchat-livechat/server/hooks/offlineMessage.js
  18. 5
      packages/rocketchat-livechat/server/hooks/sendToCRM.js
  19. 2
      packages/rocketchat-livechat/server/index.js
  20. 30
      packages/rocketchat-livechat/server/lib/Livechat.js
  21. 9
      packages/rocketchat-livechat/server/lib/QueueMethods.js
  22. 3
      packages/rocketchat-livechat/server/methods/addAgent.js
  23. 3
      packages/rocketchat-livechat/server/methods/addManager.js
  24. 3
      packages/rocketchat-livechat/server/methods/closeByVisitor.js
  25. 3
      packages/rocketchat-livechat/server/methods/closeRoom.js
  26. 3
      packages/rocketchat-livechat/server/methods/getAgentOverviewData.js
  27. 3
      packages/rocketchat-livechat/server/methods/getAnalyticsChartData.js
  28. 3
      packages/rocketchat-livechat/server/methods/getAnalyticsOverviewData.js
  29. 3
      packages/rocketchat-livechat/server/methods/getInitialData.js
  30. 5
      packages/rocketchat-livechat/server/methods/getNextAgent.js
  31. 4
      packages/rocketchat-livechat/server/methods/pageVisited.js
  32. 5
      packages/rocketchat-livechat/server/methods/registerGuest.js
  33. 3
      packages/rocketchat-livechat/server/methods/removeAgent.js
  34. 3
      packages/rocketchat-livechat/server/methods/removeDepartment.js
  35. 3
      packages/rocketchat-livechat/server/methods/removeManager.js
  36. 3
      packages/rocketchat-livechat/server/methods/returnAsInquiry.js
  37. 3
      packages/rocketchat-livechat/server/methods/saveDepartment.js
  38. 3
      packages/rocketchat-livechat/server/methods/saveInfo.js
  39. 4
      packages/rocketchat-livechat/server/methods/sendMessageLivechat.js
  40. 4
      packages/rocketchat-livechat/server/methods/sendOfflineMessage.js
  41. 4
      packages/rocketchat-livechat/server/methods/sendTranscript.js
  42. 3
      packages/rocketchat-livechat/server/methods/setDepartmentForVisitor.js
  43. 4
      packages/rocketchat-livechat/server/methods/startFileUploadRoom.js
  44. 3
      packages/rocketchat-livechat/server/methods/startVideoCall.js
  45. 3
      packages/rocketchat-livechat/server/methods/takeInquiry.js
  46. 3
      packages/rocketchat-livechat/server/methods/transfer.js
  47. 4
      packages/rocketchat-livechat/server/visitorStatus.js

@ -1,7 +1,8 @@
import { check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { LivechatDepartment, LivechatDepartmentAgents } from '../../../server/models';
import { API } from 'meteor/rocketchat:api';
import { LivechatDepartment, LivechatDepartmentAgents } from '../../../server/models';
import { Livechat } from '../../../server/lib/Livechat';
API.v1.addRoute('livechat/department', { authRequired: true }, {
get() {
@ -24,7 +25,7 @@ API.v1.addRoute('livechat/department', { authRequired: true }, {
agents: Array,
});
const department = RocketChat.Livechat.saveDepartment(null, this.bodyParams.department, this.bodyParams.agents);
const department = Livechat.saveDepartment(null, this.bodyParams.department, this.bodyParams.agents);
if (department) {
return API.v1.success({
@ -74,7 +75,7 @@ API.v1.addRoute('livechat/department/:_id', { authRequired: true }, {
agents: Array,
});
if (RocketChat.Livechat.saveDepartment(this.urlParams._id, this.bodyParams.department, this.bodyParams.agents)) {
if (Livechat.saveDepartment(this.urlParams._id, this.bodyParams.department, this.bodyParams.agents)) {
return API.v1.success({
department: LivechatDepartment.findOneById(this.urlParams._id),
agents: LivechatDepartmentAgents.find({ departmentId: this.urlParams._id }).fetch(),
@ -96,7 +97,7 @@ API.v1.addRoute('livechat/department/:_id', { authRequired: true }, {
_id: String,
});
if (RocketChat.Livechat.removeDepartment(this.urlParams._id)) {
if (Livechat.removeDepartment(this.urlParams._id)) {
return API.v1.success();
}

@ -4,6 +4,7 @@ import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import LivechatVisitors from '../../../server/models/LivechatVisitors';
import { Livechat } from '../../../server/lib/Livechat';
/**
* @api {post} /livechat/facebook Send Facebook message
@ -71,7 +72,7 @@ API.v1.addRoute('livechat/facebook', {
sendMessage.message.rid = Random.id();
sendMessage.message.token = this.bodyParams.token;
const userId = RocketChat.Livechat.registerGuest({
const userId = Livechat.registerGuest({
token: sendMessage.message.token,
name: `${ this.bodyParams.first_name } ${ this.bodyParams.last_name }`,
});
@ -85,7 +86,7 @@ API.v1.addRoute('livechat/facebook', {
try {
return {
sucess: true,
message: RocketChat.Livechat.sendMessage(sendMessage),
message: Livechat.sendMessage(sendMessage),
};
} catch (e) {
console.error('Error using Facebook ->', e);

@ -4,6 +4,7 @@ import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import { SMS } from 'meteor/rocketchat:sms';
import LivechatVisitors from '../../../server/models/LivechatVisitors';
import { Livechat } from '../../../server/lib/Livechat';
API.v1.addRoute('livechat/sms-incoming/:service', {
post() {
@ -37,7 +38,7 @@ API.v1.addRoute('livechat/sms-incoming/:service', {
sendMessage.message.rid = Random.id();
sendMessage.message.token = Random.id();
const visitorId = RocketChat.Livechat.registerGuest({
const visitorId = Livechat.registerGuest({
username: sms.from.replace(/[^0-9]/g, ''),
token: sendMessage.message.token,
phone: {
@ -73,7 +74,7 @@ API.v1.addRoute('livechat/sms-incoming/:service', {
});
try {
const message = SMSService.response.call(this, RocketChat.Livechat.sendMessage(sendMessage));
const message = SMSService.response.call(this, Livechat.sendMessage(sendMessage));
Meteor.defer(() => {
if (sms.extra) {

@ -1,6 +1,7 @@
import { check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import { Livechat } from '../../../server/lib/Livechat';
import _ from 'underscore';
API.v1.addRoute('livechat/users/:type', { authRequired: true }, {
@ -46,12 +47,12 @@ API.v1.addRoute('livechat/users/:type', { authRequired: true }, {
});
if (this.urlParams.type === 'agent') {
const user = RocketChat.Livechat.addAgent(this.bodyParams.username);
const user = Livechat.addAgent(this.bodyParams.username);
if (user) {
return API.v1.success({ user });
}
} else if (this.urlParams.type === 'manager') {
const user = RocketChat.Livechat.addManager(this.bodyParams.username);
const user = Livechat.addManager(this.bodyParams.username);
if (user) {
return API.v1.success({ user });
}
@ -125,11 +126,11 @@ API.v1.addRoute('livechat/users/:type/:_id', { authRequired: true }, {
}
if (this.urlParams.type === 'agent') {
if (RocketChat.Livechat.removeAgent(user.username)) {
if (Livechat.removeAgent(user.username)) {
return API.v1.success();
}
} else if (this.urlParams.type === 'manager') {
if (RocketChat.Livechat.removeManager(user.username)) {
if (Livechat.removeManager(user.username)) {
return API.v1.success();
}
} else {

@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from 'meteor/rocketchat:livechat';
RocketChat.MessageTypes.registerType({
id: 'livechat_navigation_history',
@ -37,7 +38,7 @@ RocketChat.actionLinks.register('denyLivechatCall', function(message/* , params*
const language = user.language || RocketChat.settings.get('Language') || 'en';
RocketChat.Livechat.closeRoom({
Livechat.closeRoom({
user,
room: RocketChat.models.Rooms.findOneById(message.rid),
comment: TAPi18n.__('Videocall_declined', { lng: language }),

@ -1,8 +1,9 @@
import { RocketChat } from 'meteor/rocketchat:lib';
import { UserPresenceMonitor } from 'meteor/konecty:user-presence';
import { Livechat } from './lib/Livechat';
UserPresenceMonitor.onSetUserStatus((user, status) => {
if (RocketChat.authz.hasRole(user._id, 'livechat-manager') || RocketChat.authz.hasRole(user._id, 'livechat-agent')) {
RocketChat.Livechat.notifyAgentStatusChanged(user._id, status);
Livechat.notifyAgentStatusChanged(user._id, status);
}
});

@ -4,6 +4,7 @@ import { RocketChat } from 'meteor/rocketchat:lib';
import { LivechatDepartment, LivechatTrigger } from '../../models';
import _ from 'underscore';
import LivechatVisitors from '../../models/LivechatVisitors';
import { Livechat } from '../../lib/Livechat';
export function online() {
return RocketChat.models.Users.findOnlineAgents().count() > 0;
@ -72,7 +73,7 @@ export function getRoom(guest, rid, roomInfo) {
ts: new Date(),
};
return RocketChat.Livechat.getRoom(guest, message, roomInfo);
return Livechat.getRoom(guest, message, roomInfo);
}
export function findAgent(agentId) {
@ -80,7 +81,7 @@ export function findAgent(agentId) {
}
export function settings() {
const initSettings = RocketChat.Livechat.getInitSettings();
const initSettings = Livechat.getInitSettings();
const triggers = findTriggers();
const departments = findDepartments();
const sound = `${ Meteor.absoluteUrl() }sounds/chime.mp3`;

@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import { findRoom, findGuest, findAgent, findOpenRoom } from '../lib/livechat';
import { Livechat } from '../../lib/Livechat';
API.v1.addRoute('livechat/agent.info/:rid/:token', {
get() {
@ -53,13 +53,13 @@ API.v1.addRoute('livechat/agent.next/:token', {
let { department } = this.queryParams;
if (!department) {
const requireDeparment = RocketChat.Livechat.getRequiredDepartment();
const requireDeparment = Livechat.getRequiredDepartment();
if (requireDeparment) {
department = requireDeparment._id;
}
}
const agentData = RocketChat.Livechat.getNextAgent(department);
const agentData = Livechat.getNextAgent(department);
if (!agentData) {
throw new Meteor.Error('agent-not-found');
}

@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import { findGuest } from '../lib/livechat';
import { Livechat } from '../../lib/Livechat';
API.v1.addRoute('livechat/custom.field', {
post() {
@ -21,7 +21,7 @@ API.v1.addRoute('livechat/custom.field', {
throw new Meteor.Error('invalid-token');
}
if (!RocketChat.Livechat.setCustomFields({ token, key, value, overwrite })) {
if (!Livechat.setCustomFields({ token, key, value, overwrite })) {
return API.v1.failure();
}
@ -53,7 +53,7 @@ API.v1.addRoute('livechat/custom.fields', {
const fields = this.bodyParams.customFields.map((customField) => {
const data = Object.assign({ token }, customField);
if (!RocketChat.Livechat.setCustomFields(data)) {
if (!Livechat.setCustomFields(data)) {
return API.v1.failure();
}

@ -5,6 +5,7 @@ import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import LivechatVisitors from '../../../server/models/LivechatVisitors';
import { findGuest, findRoom } from '../lib/livechat';
import { Livechat } from '../../lib/Livechat';
API.v1.addRoute('livechat/message', {
post() {
@ -45,7 +46,7 @@ API.v1.addRoute('livechat/message', {
agent,
};
const result = RocketChat.Livechat.sendMessage(sendMessage);
const result = Livechat.sendMessage(sendMessage);
if (result) {
const message = { _id: result._id, rid: result.rid, msg: result.msg, u: result.u, ts: result.ts };
return API.v1.success({ message });
@ -91,7 +92,7 @@ API.v1.addRoute('livechat/message/:_id', {
const message = { _id: msg._id, msg: this.bodyParams.msg };
const result = RocketChat.Livechat.updateMessage({ guest, message });
const result = Livechat.updateMessage({ guest, message });
if (result) {
const data = RocketChat.models.Messages.findOneById(_id);
return API.v1.success({
@ -133,7 +134,7 @@ API.v1.addRoute('livechat/message/:_id', {
throw new Meteor.Error('invalid-message');
}
const result = RocketChat.Livechat.deleteMessage({ guest, message });
const result = Livechat.deleteMessage({ guest, message });
if (result) {
return API.v1.success({
message: {
@ -232,7 +233,7 @@ API.v1.addRoute('livechat/messages', { authRequired: true }, {
}
} else {
rid = Random.id();
const visitorId = RocketChat.Livechat.registerGuest(this.bodyParams.visitor);
const visitorId = Livechat.registerGuest(this.bodyParams.visitor);
visitor = LivechatVisitors.findOneById(visitorId);
}
@ -246,7 +247,7 @@ API.v1.addRoute('livechat/messages', { authRequired: true }, {
msg: message.msg,
},
};
const sentMessage = RocketChat.Livechat.sendMessage(sendMessage);
const sentMessage = Livechat.sendMessage(sendMessage);
return {
username: sentMessage.u.username,
msg: sentMessage.msg,

@ -1,7 +1,7 @@
import { check } from 'meteor/check';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import { Livechat } from '../../lib/Livechat';
API.v1.addRoute('livechat/offline.message', {
post() {
@ -13,7 +13,7 @@ API.v1.addRoute('livechat/offline.message', {
});
const { name, email, message } = this.bodyParams;
if (!RocketChat.Livechat.sendOfflineMessage({ name, email, message })) {
if (!Livechat.sendOfflineMessage({ name, email, message })) {
return API.v1.failure({ message: TAPi18n.__('Error_sending_livechat_offline_message') });
}

@ -1,9 +1,9 @@
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import _ from 'underscore';
import { findGuest, findRoom } from '../lib/livechat';
import { Livechat } from '../../lib/Livechat';
API.v1.addRoute('livechat/page.visited', {
post() {
@ -32,7 +32,7 @@ API.v1.addRoute('livechat/page.visited', {
throw new Meteor.Error('invalid-room');
}
const obj = RocketChat.Livechat.savePageHistory(token, rid, pageInfo);
const obj = Livechat.savePageHistory(token, rid, pageInfo);
if (obj) {
const page = _.pick(obj, 'msg', 'navigation');
return API.v1.success({ page });

@ -5,6 +5,7 @@ import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import { findGuest, findRoom, getRoom, settings } from '../lib/livechat';
import { Livechat } from '../../lib/Livechat';
API.v1.addRoute('livechat/room', {
get() {
@ -57,7 +58,7 @@ API.v1.addRoute('livechat/room.close', {
const language = RocketChat.settings.get('Language') || 'en';
const comment = TAPi18n.__('Closed_by_visitor', { lng: language });
if (!RocketChat.Livechat.closeRoom({ visitor, room, comment })) {
if (!Livechat.closeRoom({ visitor, room, comment })) {
return API.v1.failure();
}
@ -92,7 +93,7 @@ API.v1.addRoute('livechat/room.transfer', {
// update visited page history to not expire
RocketChat.models.Messages.keepHistoryForToken(token);
if (!RocketChat.Livechat.transfer(room, guest, { roomId: rid, departmentId: department })) {
if (!Livechat.transfer(room, guest, { roomId: rid, departmentId: department })) {
return API.v1.failure();
}

@ -1,7 +1,7 @@
import { check } from 'meteor/check';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import { Livechat } from '../../lib/Livechat';
API.v1.addRoute('livechat/transcript', {
post() {
@ -13,7 +13,7 @@ API.v1.addRoute('livechat/transcript', {
});
const { token, rid, email } = this.bodyParams;
if (!RocketChat.Livechat.sendTranscript({ token, rid, email })) {
if (!Livechat.sendTranscript({ token, rid, email })) {
return API.v1.failure({ message: TAPi18n.__('Error_sending_livechat_transcript') });
}

@ -5,6 +5,7 @@ import { API } from 'meteor/rocketchat:api';
import LivechatVisitors from '../../../server/models/LivechatVisitors';
import { findGuest } from '../lib/livechat';
import { LivechatCustomField } from '../../models';
import { Livechat } from '../../lib/Livechat';
API.v1.addRoute('livechat/visitor', {
post() {
@ -34,13 +35,13 @@ API.v1.addRoute('livechat/visitor', {
guest.phone = { number: this.bodyParams.visitor.phone };
}
const visitorId = RocketChat.Livechat.registerGuest(guest);
const visitorId = Livechat.registerGuest(guest);
let visitor = LivechatVisitors.getVisitorByToken(token);
// If it's updating an existing visitor, it must also update the roomInfo
const cursor = RocketChat.models.Rooms.findOpenByVisitorToken(token);
cursor.forEach((room) => {
RocketChat.Livechat.saveRoomInfo(room, visitor);
Livechat.saveRoomInfo(room, visitor);
});
if (customFields && customFields instanceof Array) {
@ -89,7 +90,7 @@ API.v1.addRoute('livechat/visitor/:token', {
}
const { _id } = visitor;
const result = RocketChat.Livechat.removeGuest(_id);
const result = Livechat.removeGuest(_id);
if (result) {
return API.v1.success({
visitor: {
@ -141,7 +142,7 @@ API.v1.addRoute('livechat/visitor.status', {
throw new Meteor.Error('invalid-token');
}
RocketChat.Livechat.notifyGuestStatusChanged(token, status);
Livechat.notifyGuestStatusChanged(token, status);
return API.v1.success({ token, status });
} catch (e) {

@ -1,12 +1,13 @@
import { HTTP } from 'meteor/http';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
function sendToRDStation(room) {
if (!RocketChat.settings.get('Livechat_RDStation_Token')) {
return room;
}
const livechatData = RocketChat.Livechat.getLivechatRoomGuestInfo(room);
const livechatData = Livechat.getLivechatRoomGuestInfo(room);
if (!livechatData.visitor.email) {
return room;

@ -1,4 +1,5 @@
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
RocketChat.callbacks.add('livechat.offlineMessage', (data) => {
if (!RocketChat.settings.get('Livechat_webhook_on_offline_msg')) {
@ -15,5 +16,5 @@ RocketChat.callbacks.add('livechat.offlineMessage', (data) => {
message: data.message,
};
RocketChat.Livechat.sendRequest(postData);
Livechat.sendRequest(postData);
}, RocketChat.callbacks.priority.MEDIUM, 'livechat-send-email-offline-message');

@ -1,4 +1,5 @@
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
const msgNavType = 'livechat_navigation_history';
@ -19,7 +20,7 @@ function sendToCRM(type, room, includeMessages = true) {
return room;
}
const postData = RocketChat.Livechat.getLivechatRoomGuestInfo(room);
const postData = Livechat.getLivechatRoomGuestInfo(room);
postData.type = type;
@ -57,7 +58,7 @@ function sendToCRM(type, room, includeMessages = true) {
});
}
const response = RocketChat.Livechat.sendRequest(postData);
const response = Livechat.sendRequest(postData);
if (response && response.data && response.data.data) {
RocketChat.models.Rooms.saveCRMDataByRoomId(room._id, response.data.data);

@ -66,7 +66,7 @@ import './models/LivechatPageVisited';
import './models/LivechatTrigger';
import '../lib/LivechatInquiry';
import './models/LivechatOfficeHour';
import './lib/Livechat';
export { Livechat } from './lib/Livechat';
import './lib/Analytics';
import './lib/QueueMethods';
import './lib/OfficeClock';

@ -17,7 +17,7 @@ import { LivechatInquiry } from '../../lib/LivechatInquiry';
import LivechatVisitors from '../models/LivechatVisitors';
import { Analytics } from './Analytics';
RocketChat.Livechat = {
export const Livechat = {
Analytics,
historyMonitorType: 'url',
@ -414,7 +414,7 @@ RocketChat.Livechat = {
},
savePageHistory(token, roomId, pageInfo) {
if (pageInfo.change === RocketChat.Livechat.historyMonitorType) {
if (pageInfo.change === Livechat.historyMonitorType) {
const user = RocketChat.models.Users.findOneById('rocket.cat');
@ -455,9 +455,9 @@ RocketChat.Livechat = {
const { _id: agentId, username } = user;
agent = Object.assign({}, { agentId, username });
} else if (RocketChat.settings.get('Livechat_Routing_Method') !== 'Guest_Pool') {
agent = RocketChat.Livechat.getNextAgent(transferData.departmentId);
agent = Livechat.getNextAgent(transferData.departmentId);
} else {
return RocketChat.Livechat.returnRoomAsInquiry(room._id, transferData.departmentId);
return Livechat.returnRoomAsInquiry(room._id, transferData.departmentId);
}
const { servedBy } = room;
@ -502,7 +502,7 @@ RocketChat.Livechat = {
this.setDepartmentForGuest(guestData);
const data = RocketChat.models.Users.getAgentInfo(agent.agentId);
RocketChat.Livechat.stream.emit(room._id, {
Livechat.stream.emit(room._id, {
type: 'agentData',
data,
});
@ -531,10 +531,10 @@ RocketChat.Livechat = {
const agentIds = [];
// get the agents of the department
if (departmentId) {
let agents = RocketChat.Livechat.getOnlineAgents(departmentId);
let agents = Livechat.getOnlineAgents(departmentId);
if (agents.count() === 0 && RocketChat.settings.get('Livechat_guest_pool_with_no_agents')) {
agents = RocketChat.Livechat.getAgents(departmentId);
agents = Livechat.getAgents(departmentId);
}
if (agents.count() === 0) {
@ -571,7 +571,7 @@ RocketChat.Livechat = {
if (openInq) {
RocketChat.models.Messages.createUserLeaveWithRoomIdAndUser(rid, { _id: room.servedBy._id, username: room.servedBy.username });
RocketChat.Livechat.stream.emit(rid, {
Livechat.stream.emit(rid, {
type: 'agentData',
data: null,
});
@ -590,13 +590,13 @@ RocketChat.Livechat = {
};
return HTTP.post(RocketChat.settings.get('Livechat_webhookUrl'), options);
} catch (e) {
RocketChat.Livechat.logger.webhook.error(`Response error on ${ trying } try ->`, e);
Livechat.logger.webhook.error(`Response error on ${ trying } try ->`, e);
// try 10 times after 10 seconds each
if (trying < 10) {
RocketChat.Livechat.logger.webhook.warn('Will try again in 10 seconds ...');
Livechat.logger.webhook.warn('Will try again in 10 seconds ...');
trying++;
setTimeout(Meteor.bindEnvironment(() => {
RocketChat.Livechat.sendRequest(postData, callback, trying);
Livechat.sendRequest(postData, callback, trying);
}), 10000);
}
}
@ -919,7 +919,7 @@ RocketChat.Livechat = {
notifyAgentStatusChanged(userId, status) {
RocketChat.models.Rooms.findOpenByAgent(userId).forEach((room) => {
RocketChat.Livechat.stream.emit(room._id, {
Livechat.stream.emit(room._id, {
type: 'agentStatus',
status,
});
@ -927,9 +927,9 @@ RocketChat.Livechat = {
},
};
RocketChat.Livechat.stream = new Meteor.Streamer('livechat-room');
Livechat.stream = new Meteor.Streamer('livechat-room');
RocketChat.Livechat.stream.allowRead((roomId, extraData) => {
Livechat.stream.allowRead((roomId, extraData) => {
const room = RocketChat.models.Rooms.findOneById(roomId);
if (!room) {
@ -944,5 +944,5 @@ RocketChat.Livechat.stream.allowRead((roomId, extraData) => {
});
RocketChat.settings.get('Livechat_history_monitor_type', (key, value) => {
RocketChat.Livechat.historyMonitorType = value;
Livechat.historyMonitorType = value;
});

@ -4,6 +4,7 @@ import { RocketChat } from 'meteor/rocketchat:lib';
import _ from 'underscore';
import { sendNotification } from 'meteor/rocketchat:lib';
import { LivechatInquiry } from '../../lib/LivechatInquiry';
import { Livechat } from './Livechat';
RocketChat.QueueMethods = {
/* Least Amount Queuing method:
@ -13,7 +14,7 @@ RocketChat.QueueMethods = {
*/
'Least_Amount'(guest, message, roomInfo, agent) {
if (!agent) {
agent = RocketChat.Livechat.getNextAgent(guest.department);
agent = Livechat.getNextAgent(guest.department);
if (!agent) {
throw new Meteor.Error('no-agent-online', 'Sorry, no online agents');
}
@ -72,7 +73,7 @@ RocketChat.QueueMethods = {
RocketChat.models.Subscriptions.insert(subscriptionData);
RocketChat.Livechat.stream.emit(room._id, {
Livechat.stream.emit(room._id, {
type: 'agentData',
data: RocketChat.models.Users.getAgentInfo(agent.agentId),
});
@ -89,10 +90,10 @@ RocketChat.QueueMethods = {
* only the client until paired with an agent
*/
'Guest_Pool'(guest, message, roomInfo) {
let agents = RocketChat.Livechat.getOnlineAgents(guest.department);
let agents = Livechat.getOnlineAgents(guest.department);
if (agents.count() === 0 && RocketChat.settings.get('Livechat_guest_pool_with_no_agents')) {
agents = RocketChat.Livechat.getAgents(guest.department);
agents = Livechat.getAgents(guest.department);
}
if (agents.count() === 0) {

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:addAgent'(username) {
@ -7,6 +8,6 @@ Meteor.methods({
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:addAgent' });
}
return RocketChat.Livechat.addAgent(username);
return Livechat.addAgent(username);
},
});

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:addManager'(username) {
@ -7,6 +8,6 @@ Meteor.methods({
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:addManager' });
}
return RocketChat.Livechat.addManager(username);
return Livechat.addManager(username);
},
});

@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import LivechatVisitors from '../models/LivechatVisitors';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:closeByVisitor'({ roomId, token }) {
@ -9,7 +10,7 @@ Meteor.methods({
const language = (visitor && visitor.language) || RocketChat.settings.get('Language') || 'en';
return RocketChat.Livechat.closeRoom({
return Livechat.closeRoom({
visitor,
room: RocketChat.models.Rooms.findOneOpenByRoomIdAndVisitorToken(roomId, token),
comment: TAPi18n.__('Closed_by_visitor', { lng: language }),

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:closeRoom'(roomId, comment) {
@ -15,7 +16,7 @@ Meteor.methods({
throw new Meteor.Error('error-not-authorized', 'Not authorized', { method: 'livechat:closeRoom' });
}
return RocketChat.Livechat.closeRoom({
return Livechat.closeRoom({
user,
room: RocketChat.models.Rooms.findOneById(roomId),
comment,

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:getAgentOverviewData'(options) {
@ -14,6 +15,6 @@ Meteor.methods({
return;
}
return RocketChat.Livechat.Analytics.getAgentOverviewData(options);
return Livechat.Analytics.getAgentOverviewData(options);
},
});

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:getAnalyticsChartData'(options) {
@ -14,6 +15,6 @@ Meteor.methods({
return;
}
return RocketChat.Livechat.Analytics.getAnalyticsChartData(options);
return Livechat.Analytics.getAnalyticsChartData(options);
},
});

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:getAnalyticsOverviewData'(options) {
@ -14,6 +15,6 @@ Meteor.methods({
return;
}
return RocketChat.Livechat.Analytics.getAnalyticsOverviewData(options);
return Livechat.Analytics.getAnalyticsOverviewData(options);
},
});

@ -3,6 +3,7 @@ import { RocketChat } from 'meteor/rocketchat:lib';
import _ from 'underscore';
import { LivechatDepartment, LivechatTrigger } from '../models';
import LivechatVisitors from '../models/LivechatVisitors';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:getInitialData'(visitorToken, departmentId) {
@ -60,7 +61,7 @@ Meteor.methods({
info.visitor = visitor;
}
const initSettings = RocketChat.Livechat.getInitSettings();
const initSettings = Livechat.getInitSettings();
info.title = initSettings.Livechat_title;
info.color = initSettings.Livechat_title_color;

@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:getNextAgent'({ token, department }) {
@ -13,13 +14,13 @@ Meteor.methods({
}
if (!department) {
const requireDeparment = RocketChat.Livechat.getRequiredDepartment();
const requireDeparment = Livechat.getRequiredDepartment();
if (requireDeparment) {
department = requireDeparment._id;
}
}
const agent = RocketChat.Livechat.getNextAgent(department);
const agent = Livechat.getNextAgent(department);
if (!agent) {
return;
}

@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:pageVisited'(token, room, pageInfo) {
RocketChat.Livechat.savePageHistory(token, room, pageInfo);
Livechat.savePageHistory(token, room, pageInfo);
},
});

@ -1,10 +1,11 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import LivechatVisitors from '../models/LivechatVisitors';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:registerGuest'({ token, name, email, department, customFields } = {}) {
const userId = RocketChat.Livechat.registerGuest.call(this, {
const userId = Livechat.registerGuest.call(this, {
token,
name,
email,
@ -27,7 +28,7 @@ Meteor.methods({
// If it's updating an existing visitor, it must also update the roomInfo
const cursor = RocketChat.models.Rooms.findOpenByVisitorToken(token);
cursor.forEach((room) => {
RocketChat.Livechat.saveRoomInfo(room, visitor);
Livechat.saveRoomInfo(room, visitor);
});
if (customFields && customFields instanceof Array) {

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:removeAgent'(username) {
@ -7,6 +8,6 @@ Meteor.methods({
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:removeAgent' });
}
return RocketChat.Livechat.removeAgent(username);
return Livechat.removeAgent(username);
},
});

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:removeDepartment'(_id) {
@ -7,6 +8,6 @@ Meteor.methods({
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:removeDepartment' });
}
return RocketChat.Livechat.removeDepartment(_id);
return Livechat.removeDepartment(_id);
},
});

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:removeManager'(username) {
@ -7,6 +8,6 @@ Meteor.methods({
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:removeManager' });
}
return RocketChat.Livechat.removeManager(username);
return Livechat.removeManager(username);
},
});

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:returnAsInquiry'(rid, departmentId) {
@ -7,6 +8,6 @@ Meteor.methods({
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:saveDepartment' });
}
return RocketChat.Livechat.returnRoomAsInquiry(rid, departmentId);
return Livechat.returnRoomAsInquiry(rid, departmentId);
},
});

@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:saveDepartment'(_id, departmentData, departmentAgents) {
@ -7,6 +8,6 @@ Meteor.methods({
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:saveDepartment' });
}
return RocketChat.Livechat.saveDepartment(_id, departmentData, departmentAgents);
return Livechat.saveDepartment(_id, departmentData, departmentAgents);
},
});

@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:saveInfo'(guestData, roomData) {
@ -31,7 +32,7 @@ Meteor.methods({
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:saveInfo' });
}
const ret = RocketChat.Livechat.saveGuest(guestData) && RocketChat.Livechat.saveRoomInfo(roomData, guestData);
const ret = Livechat.saveGuest(guestData) && Livechat.saveRoomInfo(roomData, guestData);
Meteor.defer(() => {
RocketChat.callbacks.run('livechat.saveInfo', RocketChat.models.Rooms.findOneById(roomData._id));

@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import LivechatVisitors from '../models/LivechatVisitors';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
sendMessageLivechat({ token, _id, rid, msg, attachments }, agent) {
@ -28,7 +28,7 @@ Meteor.methods({
throw new Meteor.Error('invalid-token');
}
return RocketChat.Livechat.sendMessage({
return Livechat.sendMessage({
guest,
message: {
_id,

@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { DDPRateLimiter } from 'meteor/ddp-rate-limiter';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:sendOfflineMessage'(data) {
@ -11,7 +11,7 @@ Meteor.methods({
message: String,
});
return RocketChat.Livechat.sendOfflineMessage(data);
return Livechat.sendOfflineMessage(data);
},
});

@ -1,14 +1,14 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { DDPRateLimiter } from 'meteor/ddp-rate-limiter';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:sendTranscript'(token, rid, email) {
check(rid, String);
check(email, String);
return RocketChat.Livechat.sendTranscript({ token, rid, email });
return Livechat.sendTranscript({ token, rid, email });
},
});

@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import LivechatVisitors from '../models/LivechatVisitors';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:setDepartmentForVisitor'({ roomId, visitorToken, departmentId } = {}) {
@ -24,6 +25,6 @@ Meteor.methods({
departmentId,
};
return RocketChat.Livechat.transfer(room, visitor, transferData);
return Livechat.transfer(room, visitor, transferData);
},
});

@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { RocketChat } from 'meteor/rocketchat:lib';
import LivechatVisitors from '../models/LivechatVisitors';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:startFileUploadRoom'(roomId, token) {
@ -15,6 +15,6 @@ Meteor.methods({
token: guest.token,
};
return RocketChat.Livechat.getRoom(guest, message);
return Livechat.getRoom(guest, message);
},
});

@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:startVideoCall'(roomId) {
@ -17,7 +18,7 @@ Meteor.methods({
ts: new Date(),
};
const { room } = RocketChat.Livechat.getRoom(guest, message, { jitsiTimeout: new Date(Date.now() + 3600 * 1000) });
const { room } = Livechat.getRoom(guest, message, { jitsiTimeout: new Date(Date.now() + 3600 * 1000) });
message.rid = room._id;
RocketChat.models.Messages.createWithTypeRoomIdMessageAndUser('livechat_video_call', room._id, '', guest, {

@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { LivechatInquiry } from '../../lib/LivechatInquiry';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:takeInquiry'(inquiryId) {
@ -63,7 +64,7 @@ Meteor.methods({
// and inquiry being taken, message would not be switched off.
RocketChat.models.Messages.createCommandWithRoomIdAndUser('connected', room._id, user);
RocketChat.Livechat.stream.emit(room._id, {
Livechat.stream.emit(room._id, {
type: 'agentData',
data: RocketChat.models.Users.getAgentInfo(agent.agentId),
});

@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import LivechatVisitors from '../models/LivechatVisitors';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:transfer'(transferData) {
@ -27,6 +28,6 @@ Meteor.methods({
const guest = LivechatVisitors.findOneById(room.v && room.v._id);
return RocketChat.Livechat.transfer(room, guest, transferData);
return Livechat.transfer(room, guest, transferData);
},
});

@ -1,11 +1,11 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { UserPresenceEvents } from 'meteor/konecty:user-presence';
import { Livechat } from './lib/Livechat';
Meteor.startup(() => {
UserPresenceEvents.on('setStatus', (session, status, metadata) => {
if (metadata && metadata.visitor) {
RocketChat.Livechat.notifyGuestStatusChanged(metadata.visitor, status);
Livechat.notifyGuestStatusChanged(metadata.visitor, status);
}
});
});

Loading…
Cancel
Save