diff --git a/.env.tpl b/.env.tpl index 2ea22e4..c72c32e 100644 --- a/.env.tpl +++ b/.env.tpl @@ -2,4 +2,5 @@ PORT=8080 AGENT_USERNAME=agent AGENT_PASSWORD=password REALMQ_TOKEN= -REALMQ_HOST= +REALMQ_HOST=realmq.com +REALMQ_LOCAL_HOST_IP= diff --git a/.gitignore b/.gitignore index 86399cb..6c19884 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ yarn-error.log public/* !public/.gitkeep .db +.parcel-cache diff --git a/README.md b/README.md index d735791..34abc84 100644 --- a/README.md +++ b/README.md @@ -23,19 +23,19 @@ You can do that by sending an email to service@realmq.com. First install dependencies: ```bash -$ yarn +$ npm i ``` Build the vue apps (agent & chat-widget) ```bash -$ yarn dist +$ npm run dist ``` Start the express app ```bash -$ yarn start +$ npm run start ``` ## Configuration @@ -46,13 +46,14 @@ The app can be configured via environment variables and/or `.env` file. $ cp .env.tpl .env ``` -| Env Var | Description | Default | -|---------|---|---| -| `REALMQ_TOKEN` | Realmq admin token for setup and managing clients, channels, messaging.
:point_right: This configuration variable is **REQUIRED** | - | -| `REALMQ_HOST` | Can be set to custom realmq deployment. | - | -| `PORT` | http port the server will listen to | **8080** | -| `AGENT_USERNAME` | Username required to access `/agent` | **agent** | -| `AGENT_PASSWORD` | Password of the agent user | **password** | +| Env Var | Description | Default | +|------------------------|--------------------------------------------------------------------------------------------------------------------------------------|--------------| +| `REALMQ_TOKEN` | Realmq admin token for setup and managing clients, channels, messaging.
:point_right: This configuration variable is **REQUIRED** | - | +| `REALMQ_HOST` | Can be set to custom realmq deployment. | realmq.com | +| `PORT` | http port the server will listen to | **8080** | +| `AGENT_USERNAME` | Username required to access `/agent` | **agent** | +| `AGENT_PASSWORD` | Password of the agent user | **password** | +| `REALMQ_LOCAL_HOST_IP` | IP address of the realmq local host. This allows for using this repo against local realmq platform instance. | - | --- diff --git a/assets/js/agent.js b/assets/js/agent.js deleted file mode 100644 index 024880f..0000000 --- a/assets/js/agent.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -var Vue = require('vue'); -var VueChatScroll = require('vue-chat-scroll'); -var RealMQ = require('@realmq/web-sdk/lib/realmq'); -var App = require('./agent/app.vue'); - -var VueApp = Vue.extend(App); -var appNode = document.getElementById('app'); - -var realmq = new RealMQ(appNode.dataset.authToken, { - host: process.env.REALMQ_HOST, - autoSubscribe: true -}); - -Vue.use(VueChatScroll); - -module.exports = new VueApp({ - el: appNode, - propsData: { - realmq: realmq - } -}); diff --git a/assets/js/agent.mjs b/assets/js/agent.mjs new file mode 100644 index 0000000..286f403 --- /dev/null +++ b/assets/js/agent.mjs @@ -0,0 +1,19 @@ +'use strict'; + +import {createApp} from 'vue'; +import ChatScroll from 'vue3-chat-scroll'; +import RealMQ from '@realmq/web-sdk'; +import App from './agent/app.vue'; + +const appNode = document.getElementById('app'); +const realmq = new RealMQ(appNode.dataset.authToken, { + host: process.env.REALMQ_HOST, + autoSubscribe: true +}); +const app = createApp(App, { + realmq, +}); + +app.use(ChatScroll); +app.mount(appNode); + diff --git a/assets/js/agent/app.vue b/assets/js/agent/app.vue index dda2d4d..015950a 100644 --- a/assets/js/agent/app.vue +++ b/assets/js/agent/app.vue @@ -33,10 +33,10 @@