diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index cd874b84..ce7b4cb1 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -240,11 +240,13 @@ export class GBConversationalService { public async sendAudio(min: GBMinInstance, step: GBDialogStep, url: string): Promise { const mobile = step.context.activity.from.id; + GBLog.info(`Sending audio to ${mobile} in URL: ${url}.`); await min.whatsAppDirectLine.sendAudioToDevice(mobile, url); } public async sendEvent(min: GBMinInstance, step: GBDialogStep, name: string, value: Object): Promise { if (step.context.activity.channelId === 'webchat') { + GBLog.info(`Sending event ${name}:${typeof value === 'object' ? JSON.stringify(value) : value} to client...`); const msg = MessageFactory.text(''); msg.value = value; msg.type = 'event'; @@ -256,6 +258,7 @@ export class GBConversationalService { // tslint:disable:no-unsafe-any due to Nexmo. public async sendSms(min: GBMinInstance, mobile: string, text: string): Promise { + GBLog.info(`Sending SMS to ${mobile} with text: '${text}'.`); return new Promise((resolve: any, reject: any): any => { const nexmo = new Nexmo({ apiKey: min.instance.smsKey, @@ -575,8 +578,10 @@ export class GBConversationalService { } if (currentText !== '') { if (!mobile) { + GBLog.info(`Sending .MD file to Web.`); await step.context.sendActivity(currentText); } else { + GBLog.info(`Sending .MD file to mobile: ${mobile}.`); await this.sendToMobile(min, mobile, currentText); } } diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index cc52a928..438e42c1 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -795,11 +795,11 @@ export class GBDeployer implements IGBDeployer { // Clean up node_modules folder as it is only needed during compile time. - const nodeModules = urlJoin(root, 'node_modules'); - if (Fs.existsSync(nodeModules)) { - rimraf.sync(nodeModules); - GBLog.info(`Cleaning default.gbui node_modules...`); - } + // const nodeModules = urlJoin(root, 'node_modules'); + // if (Fs.existsSync(nodeModules)) { + // rimraf.sync(nodeModules); + // GBLog.info(`Cleaning default.gbui node_modules...`); + // } } /** diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index f28fbcdd..1a113abe 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -442,7 +442,7 @@ export class GBMinService { instance.marketplacePassword, async (err, token) => { if (err) { - const msg = `Error acquiring token: ${err}`; + const msg = `handleOAuthTokenRequests: Error acquiring token: ${err}`; GBLog.error(msg); res.send(msg); } else { @@ -476,6 +476,7 @@ export class GBMinService { ); authorizationUrl = `${authorizationUrl}?response_type=code&client_id=${min.instance.marketplaceId }&redirect_uri=${urlJoin(min.instance.botEndpoint, min.instance.botId, 'token')}`; + GBLog.info(`HandleOAuthRequests: ${authorizationUrl}.`); res.redirect(authorizationUrl); }); } @@ -487,16 +488,18 @@ export class GBMinService { // Translates the requested botId. - let id = req.params.botId; - if (id === '[default]' || id === undefined) { - id = GBConfigService.get('BOT_ID'); + let botId = req.params.botId; + if (botId === '[default]' || botId === undefined) { + botId = GBConfigService.get('BOT_ID'); } + GBLog.info(`Client requested instance for: ${botId}.`); + // Loads by the botId itself or by the activationCode field. - let instance = await this.core.loadInstanceByBotId(id); + let instance = await this.core.loadInstanceByBotId(botId); if (instance === null) { - instance = await this.core.loadInstanceByActivationCode(id); + instance = await this.core.loadInstanceByActivationCode(botId); } if (instance !== null) { @@ -515,7 +518,7 @@ export class GBMinService { res.send( JSON.stringify({ instanceId: instance.instanceId, - botId: id, + botId: botId, theme: theme, webchatToken: webchatTokenContainer.token, speechToken: speechToken, @@ -530,7 +533,7 @@ export class GBMinService { }) ); } else { - const error = `Instance not found while retrieving from .gbui web client: ${id}.`; + const error = `Instance not found while retrieving from .gbui web client: ${botId}.`; res.sendStatus(error); GBLog.error(error); } @@ -668,7 +671,7 @@ export class GBMinService { min.dialogs.add( new OAuthPrompt('oAuthPrompt', { connectionName: 'OAuth2', - text: 'Please sign in.', + text: 'Please sign in to General Bots.', title: 'Sign in', timeout: 300000 }) diff --git a/packages/default.gbui/src/GBUIApp.js b/packages/default.gbui/src/GBUIApp.js index 8eb87bf3..356ad195 100644 --- a/packages/default.gbui/src/GBUIApp.js +++ b/packages/default.gbui/src/GBUIApp.js @@ -34,6 +34,7 @@ import React from 'react'; import GBMarkdownPlayer from './players/GBMarkdownPlayer.js'; import GBImagePlayer from './players/GBImagePlayer.js'; import GBVideoPlayer from './players/GBVideoPlayer.js'; +import GBUrlPlayer from './players/GBUrlPlayer.js'; import GBLoginPlayer from './players/GBLoginPlayer.js'; import GBBulletPlayer from './players/GBBulletPlayer.js'; import SidebarMenu from './components/SidebarMenu.js'; @@ -261,6 +262,16 @@ class GBUIApp extends React.Component { /> ); break; + case 'url': + playerComponent = ( + { + this.player = player; + }} + /> + ); + break; case 'image': playerComponent = ( ; let gbCss =
; + let seo=
; let sideBar = (
@@ -308,6 +320,7 @@ class GBUIApp extends React.Component { if (this.state.line && this.state.instance) { gbCss = ; + seo = ; // let speechOptions; // let token = this.state.instanceClient.speechToken; @@ -345,7 +358,7 @@ class GBUIApp extends React.Component { return ( - + {seo}
{gbCss} {sideBar} diff --git a/packages/default.gbui/src/components/SEO.js b/packages/default.gbui/src/components/SEO.js index e103f5bb..509a1f56 100644 --- a/packages/default.gbui/src/components/SEO.js +++ b/packages/default.gbui/src/components/SEO.js @@ -33,26 +33,37 @@ import React from "react" import { SuperSEO } from 'react-super-seo'; -const footer = () => ( - ); -export default footer \ No newline at end of file +class SEO extends React.Component { + render() { + let output = ""; + if (this.props.instance) { + output = ( + ); + } else { + output =
; + } + return output; + } +} + +export default SEO \ No newline at end of file diff --git a/packages/default.gbui/src/players/GBUrlPlayer.js b/packages/default.gbui/src/players/GBUrlPlayer.js new file mode 100644 index 00000000..68ebca14 --- /dev/null +++ b/packages/default.gbui/src/players/GBUrlPlayer.js @@ -0,0 +1,64 @@ +/*****************************************************************************\ +| ( )_ _ | +| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | +| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | +| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | +| | | ( )_) | | +| (_) \___/' | +| | +| General Bots Copyright (c) Pragmatismo.io. All rights reserved. | +| Licensed under the AGPL-3.0. | +| | +| According to our dual licensing model, this program can be used either | +| under the terms of the GNU Affero General Public License, version 3, | +| or under a proprietary license. | +| | +| The texts of the GNU Affero General Public License with an additional | +| permission and of our proprietary license can be found at and | +| in the LICENSE file you have received along with this program. | +| | +| This program is distributed in the hope that it will be useful, | +| but WITHOUT ANY WARRANTY; without even the implied warranty of | +| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | +| GNU Affero General Public License for more details. | +| | +| "General Bots" is a registered trademark of Pragmatismo.io. | +| The licensing of the program under the AGPLv3 does not imply a | +| trademark license. Therefore any rights, title and interest in | +| our trademarks remain entirely with us. | +| | +\*****************************************************************************/ + +import React, { Component } from "react"; + +class GBUrlPlayer extends Component { + constructor() { + super(); + this.state = { + src: "" + }; + } + + play(url) { + this.setState({ src: url }); + } + + stop() { + this.setState({ src: "" }); + } + render() { + return ( +
+