Skip to content

Commit 27c5ea9

Browse files
add: commits from another branch that was done (#197)
* add: commits from another branch that was done * fix: remove consoles * fix(docu): two typos errors and two broken links * refactor: reduction code with same functionality && area of the button bigger * chore(deps): bump node-nlp from 3.4.0 to 3.6.0 (#200) Bumps [node-nlp](https://github.com/axa-group/nlp.js) from 3.4.0 to 3.6.0. - [Release notes](https://github.com/axa-group/nlp.js/releases) - [Commits](https://github.com/axa-group/nlp.js/commits) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * chore(deps): bump aws-sdk from 2.513.0 to 2.517.0 (#201) Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.513.0 to 2.517.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](aws/aws-sdk-js@v2.513.0...v2.517.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * chore(deps-dev): bump eslint-plugin-jest from 22.15.0 to 22.15.2 (#195) Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 22.15.0 to 22.15.2. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md) - [Commits](jest-community/eslint-plugin-jest@v22.15.0...v22.15.2) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * chore(deps): bump @types/jest from 24.0.17 to 24.0.18 (#193) Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 24.0.17 to 24.0.18. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * chore(deps-dev): bump @types/node from 12.7.1 to 12.7.2 (#185) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.7.1 to 12.7.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * chore(deps-dev): bump core-js from 3.2.0 to 3.2.1 (#179) Bumps [core-js](https://github.com/zloirock/core-js) from 3.2.0 to 3.2.1. - [Release notes](https://github.com/zloirock/core-js/releases) - [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md) - [Commits](zloirock/core-js@v3.2.0...v3.2.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * chore(deps-dev): bump react-hot-loader from 4.12.10 to 4.12.11 (#176) Bumps [react-hot-loader](https://github.com/gaearon/react-hot-loader) from 4.12.10 to 4.12.11. - [Release notes](https://github.com/gaearon/react-hot-loader/releases) - [Changelog](https://github.com/gaearon/react-hot-loader/blob/master/CHANGELOG.md) - [Commits](gaearon/react-hot-loader@v4.12.10...v4.12.11) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Contentful/fix reply buttons (#149) * fix(contentful): replies format was different than expected by botonic react * chore(contentful): improvements in eslint config * chore(core/react): improve typing for CoreBot and add for NodeApp * chore(core/react) bump to 0.9.0-alpha.7 * chore(contentful): release 0.9.13 with sdk-capabilities lint fixes * chore(dynamo): release 0.9.11 with sdk-capabilities * feature(contenful): 0.9.14 support keywords with only 1 stopword * chore(contenful): prepare for using Spanish snowball stemmer * chore(contenful): hola/hi added as stopword * chore(contenful): 0.9.15 test search when 2 contents share the same keyword * refactor: sendInput function refactorized for not repeating code * feat: change variable name of the map * feat: change persistent menu on render in dev-app * fix: second parameter of map deleted * add: commits from another branch that was done * fix: remove consoles * refactor: reduction code with same functionality && area of the button bigger * fix: remove isRegex variable, never used * fix: remove function that was created only for testing * add: commits from another branch that was done * fix: remove consoles * refactor: reduction code with same functionality && area of the button bigger * add: commits from another branch that was done * fix: remove consoles * add: commits from another branch that was done * fix: remove consoles * refactor: reduction code with same functionality && area of the button bigger * add: commits from another branch that was done * fix: remove consoles * fix: remove isRegex variable, never used * add: commits from another branch that was done * add: commits from another branch that was done * fix: remove consoles * fix: remove consoles
1 parent 73e2e4a commit 27c5ea9

File tree

3 files changed

+30
-44
lines changed

3 files changed

+30
-44
lines changed

packages/botonic-react/src/components/button.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const Button = props => {
3737
else if (props.path) sendPayload(`__PATH_PAYLOAD__${props.path}`)
3838
else if (props.payload) sendPayload(props.payload)
3939
else if (props.url) window.open(props.url)
40+
else if (props.onClick) props.onClick()
4041
}
4142

4243
const renderBrowser = () => {

packages/botonic-react/src/components/persistentMenu.jsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
import React from 'react'
2-
import { isBrowser } from '@botonic/core'
3-
import { Message } from './message'
42
export const PersistentMenu = props => {
53
return (
64
<div
75
style={{
86
position: 'absolute',
9-
width: '120px',
10-
top: '288px',
11-
backgroundColor: 'red',
12-
textAlign: 'center',
13-
left: '10px',
14-
borderRadius: '20px'
7+
width: '100%',
8+
bottom: 0,
9+
textAlign: 'center'
1510
}}
1611
>
1712
{props.children}

packages/botonic-react/src/webchat/webchat.jsx

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { isDev, msgToBotonic } from '../utils'
2626
import Logo from './botonic_react_logo100x100.png'
2727
import EmojiPicker from 'emoji-picker-react'
2828
import LogoMenu from './menuButton.svg'
29+
import { Button } from '../components/button'
2930

3031
const getScriptBaseURL = () => {
3132
let scriptBaseURL = document
@@ -172,6 +173,9 @@ export const Webchat = forwardRef((props, ref) => {
172173
}
173174
}
174175
}
176+
const closeMenu = () => {
177+
setMenuIsOpened(false)
178+
}
175179

176180
const sendInput = async input => {
177181
let inputMessage = null
@@ -397,59 +401,44 @@ export const Webchat = forwardRef((props, ref) => {
397401
<PersistentMenu>
398402
{Object.values(props.persistentMenu).map((e, i) => {
399403
return (
400-
<p key={i} onClick={() => sendPayload(e.payload)}>
404+
<Button payload={e.payload} key={i}>
401405
{Object.values(e.label)}
402-
</p>
406+
</Button>
403407
)
404408
})}
409+
<Button onClick={closeMenu}>Cancel</Button>
405410
</PersistentMenu>
406411
)}
407-
{!webchatState.handoff &&
408-
Object.keys(props.persistentMenu).length != 0 && (
409-
<>
412+
{!webchatState.handoff && (
413+
<div
414+
style={{
415+
display: 'flex',
416+
borderTop: '1px solid rgba(0, 0, 0, 0.4)'
417+
}}
418+
>
419+
{Object.keys(props.persistentMenu).length != 0 && (
410420
<div
411421
style={{
412422
display: 'flex',
413-
414-
borderTop: '1px solid rgba(0, 0, 0, 0.4)'
423+
flex: 'none',
424+
width: 50
415425
}}
416426
>
417427
<div style={{ width: 50 }}>
418428
<img
419429
style={{
420-
paddingTop: '14px',
430+
paddingTop: '20px',
431+
paddingBottom: '15px',
421432
marginLeft: '18px',
422-
marginRight: '8px'
433+
marginRight: '8px',
434+
cursor: 'pointer'
423435
}}
424436
src={LogoMenu}
425437
onClick={() => handleMenu()}
426438
/>
427439
</div>
428-
<Textarea
429-
name='text'
430-
minRows={2}
431-
maxRows={4}
432-
wrap='soft'
433-
maxLength='1000'
434-
placeholder={webchatState.theme.textPlaceholder}
435-
autoFocus={location.hostname === 'localhost'}
436-
inputRef={textArea}
437-
onKeyDown={e => onKeyDown(e)}
438-
style={{
439-
display: 'flex',
440-
padding: '8px 10px',
441-
fontSize: 14,
442-
border: 'none',
443-
resize: 'none',
444-
overflow: 'auto',
445-
outline: 'none'
446-
}}
447-
/>
448440
</div>
449-
</>
450-
)}
451-
{!webchatState.handoff &&
452-
Object.keys(props.persistentMenu).length === 0 && (
441+
)}
453442
<Textarea
454443
name='text'
455444
minRows={2}
@@ -462,16 +451,17 @@ export const Webchat = forwardRef((props, ref) => {
462451
onKeyDown={e => onKeyDown(e)}
463452
style={{
464453
display: 'flex',
465-
padding: '8px 10px',
454+
paddingLeft: '10px',
466455
fontSize: 14,
467456
border: 'none',
468457
resize: 'none',
469458
overflow: 'auto',
470459
outline: 'none',
471-
borderTop: '1px solid rgba(0, 0, 0, 0.4)'
460+
marginTop: '13px'
472461
}}
473462
/>
474-
)}
463+
</div>
464+
)}
475465
{webchatState.webview && (
476466
<RequestContext.Provider value={webviewRequestContext}>
477467
<WebviewContainer

0 commit comments

Comments
 (0)