@botpress/webchat 0.3.0 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -0,0 +1,128 @@
1
+ /* cyrillic-ext */
2
+ @font-face {
3
+ font-family: 'Roboto';
4
+ font-style: normal;
5
+ font-weight: 400;
6
+ font-display: swap;
7
+ src: local('Roboto'), local('Roboto-Regular'), url(roboto/roboto.woff2) format('woff2');
8
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
9
+ }
10
+ /* cyrillic */
11
+ @font-face {
12
+ font-family: 'Roboto';
13
+ font-style: normal;
14
+ font-weight: 400;
15
+ font-display: swap;
16
+ src: local('Roboto'), local('Roboto-Regular'), url(roboto/roboto.woff2) format('woff2');
17
+ unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
18
+ }
19
+ /* greek-ext */
20
+ @font-face {
21
+ font-family: 'Roboto';
22
+ font-style: normal;
23
+ font-weight: 400;
24
+ font-display: swap;
25
+ src: local('Roboto'), local('Roboto-Regular'), url(roboto/roboto.woff2) format('woff2');
26
+ unicode-range: U+1F00-1FFF;
27
+ }
28
+ /* greek */
29
+ @font-face {
30
+ font-family: 'Roboto';
31
+ font-style: normal;
32
+ font-weight: 400;
33
+ font-display: swap;
34
+ src: local('Roboto'), local('Roboto-Regular'), url(roboto/roboto.woff2) format('woff2');
35
+ unicode-range: U+0370-03FF;
36
+ }
37
+ /* vietnamese */
38
+ @font-face {
39
+ font-family: 'Roboto';
40
+ font-style: normal;
41
+ font-weight: 400;
42
+ font-display: swap;
43
+ src: local('Roboto'), local('Roboto-Regular'), url(roboto/roboto.woff2) format('woff2');
44
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
45
+ }
46
+ /* latin-ext */
47
+ @font-face {
48
+ font-family: 'Roboto';
49
+ font-style: normal;
50
+ font-weight: 400;
51
+ font-display: swap;
52
+ src: local('Roboto'), local('Roboto-Regular'), url(roboto/roboto.woff2) format('woff2');
53
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
54
+ }
55
+ /* latin */
56
+ @font-face {
57
+ font-family: 'Roboto';
58
+ font-style: normal;
59
+ font-weight: 400;
60
+ font-display: swap;
61
+ src: local('Roboto'), local('Roboto-Regular'), url(roboto/roboto.woff2) format('woff2');
62
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
63
+ U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
64
+ }
65
+ /* cyrillic-ext */
66
+ @font-face {
67
+ font-family: 'Roboto';
68
+ font-style: normal;
69
+ font-weight: 500;
70
+ font-display: swap;
71
+ src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/roboto500.woff2) format('woff2');
72
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
73
+ }
74
+ /* cyrillic */
75
+ @font-face {
76
+ font-family: 'Roboto';
77
+ font-style: normal;
78
+ font-weight: 500;
79
+ font-display: swap;
80
+ src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/roboto500.woff2) format('woff2');
81
+ unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
82
+ }
83
+ /* greek-ext */
84
+ @font-face {
85
+ font-family: 'Roboto';
86
+ font-style: normal;
87
+ font-weight: 500;
88
+ font-display: swap;
89
+ src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/roboto500.woff2) format('woff2');
90
+ unicode-range: U+1F00-1FFF;
91
+ }
92
+ /* greek */
93
+ @font-face {
94
+ font-family: 'Roboto';
95
+ font-style: normal;
96
+ font-weight: 500;
97
+ font-display: swap;
98
+ src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/roboto500.woff2) format('woff2');
99
+ unicode-range: U+0370-03FF;
100
+ }
101
+ /* vietnamese */
102
+ @font-face {
103
+ font-family: 'Roboto';
104
+ font-style: normal;
105
+ font-weight: 500;
106
+ font-display: swap;
107
+ src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/roboto500.woff2) format('woff2');
108
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
109
+ }
110
+ /* latin-ext */
111
+ @font-face {
112
+ font-family: 'Roboto';
113
+ font-style: normal;
114
+ font-weight: 500;
115
+ font-display: swap;
116
+ src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/roboto500.woff2) format('woff2');
117
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
118
+ }
119
+ /* latin */
120
+ @font-face {
121
+ font-family: 'Roboto';
122
+ font-style: normal;
123
+ font-weight: 500;
124
+ font-display: swap;
125
+ src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/roboto500.woff2) format('woff2');
126
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
127
+ U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
128
+ }
Binary file
@@ -21,6 +21,12 @@ const VoiceRecorder_1 = __importDefault(require("./VoiceRecorder"));
21
21
  class Composer extends react_1.default.Component {
22
22
  constructor(props) {
23
23
  super(props);
24
+ this.focus = () => {
25
+ setTimeout(() => {
26
+ var _a;
27
+ (_a = this.textInput.current) === null || _a === void 0 ? void 0 : _a.focus();
28
+ }, 50);
29
+ };
24
30
  this.handleKeyPress = (e) => __awaiter(this, void 0, void 0, function* () {
25
31
  if (e.key === 'Enter') {
26
32
  e.preventDefault();
@@ -51,13 +57,18 @@ class Composer extends react_1.default.Component {
51
57
  this.state = { isRecording: false };
52
58
  }
53
59
  componentDidMount() {
54
- setTimeout(() => {
55
- this.textInput.current.focus();
56
- }, 50);
60
+ this.focus();
57
61
  (0, mobx_1.observe)(this.props.focusedArea, (focus) => {
58
- focus.newValue === 'input' && this.textInput.current.focus();
62
+ var _a;
63
+ focus.newValue === 'input' && ((_a = this.textInput.current) === null || _a === void 0 ? void 0 : _a.focus());
59
64
  });
60
65
  }
66
+ componentWillReceiveProps(newProps) {
67
+ // Focus on the composer when it's unlocked
68
+ if (this.props.composerLocked === true && newProps.composerLocked === false) {
69
+ this.focus();
70
+ }
71
+ }
61
72
  render() {
62
73
  if (this.props.composerHidden) {
63
74
  return null;
@@ -0,0 +1,88 @@
1
+ // TODO: This seems completely outdated. Does not match classes used by the component
2
+
3
+ @mixin bottomBorder() {
4
+ border-bottom: solid 1px rgba(0, 0, 0, 0.1);
5
+ }
6
+
7
+ $charcoal: #1e1e1e;
8
+
9
+ // Fix for IE which has trouble with the max-width property
10
+ @media only screen and (min-width: 800px) {
11
+ .bot-info-container {
12
+ width: 800px;
13
+ }
14
+ }
15
+
16
+ .bot-info-container {
17
+ margin: 0 auto;
18
+ max-width: 800px;
19
+ text-align: center;
20
+ color: $charcoal;
21
+ overflow-y: auto;
22
+ svg {
23
+ fill: $charcoal;
24
+ }
25
+ & > img {
26
+ width: 100%;
27
+ }
28
+ p,
29
+ a,
30
+ button {
31
+ font-size: 0.9em;
32
+ color: rgb(102, 102, 102);
33
+ text-decoration: none;
34
+ }
35
+ }
36
+
37
+ .summary {
38
+ margin-top: -32px;
39
+ @include bottomBorder();
40
+ box-shadow: 0px 4px 5px -5px #ccc;
41
+ h3 {
42
+ margin: 0;
43
+ }
44
+ p {
45
+ margin-top: 0.4em;
46
+ margin-block-end: 1em;
47
+ }
48
+ }
49
+
50
+ .links {
51
+ @include bottomBorder();
52
+ }
53
+
54
+ .icon-link {
55
+ padding-left: 25%;
56
+ display: flex;
57
+ margin: 20px 0;
58
+ i {
59
+ margin-right: 10px;
60
+ }
61
+ }
62
+
63
+ .terms {
64
+ padding: 0px 20px;
65
+ text-align: left;
66
+ a {
67
+ display: inline-block;
68
+ width: 100%;
69
+ line-height: 2.5;
70
+ @include bottomBorder();
71
+ }
72
+ }
73
+
74
+ .startBtn {
75
+ font: inherit;
76
+ color: inherit;
77
+ background-color: transparent;
78
+ cursor: pointer;
79
+ border-radius: 20px;
80
+ line-height: 24px;
81
+ padding: 5px 10px;
82
+ margin-top: 25px;
83
+ border: 1px solid rgb(100, 100, 100);
84
+ &:focus {
85
+ border: 1px solid black;
86
+ color: black;
87
+ }
88
+ }
@@ -0,0 +1,48 @@
1
+ @import '../variables.scss';
2
+
3
+ .ConfirmDialogContainer > div {
4
+ z-index: 9999;
5
+
6
+ :global {
7
+ .bp3-button-text {
8
+ font-size: 12px !important;
9
+ }
10
+
11
+ .bp3-dialog-body {
12
+ display: flex;
13
+ }
14
+
15
+ .bp3-button {
16
+ box-shadow: unset !important;
17
+ background-image: unset !important;
18
+ border-radius: 5px !important;
19
+ padding-top: 6px;
20
+ }
21
+
22
+ .bp3-button.bp3-intent-warning {
23
+ background-color: var(--lighthouse);
24
+
25
+ &:hover {
26
+ background-color: var(--hover-lighthouse);
27
+ }
28
+
29
+ &:focus {
30
+ background-color: var(--focus-lighthouse);
31
+ }
32
+ }
33
+
34
+ .bp3-button:not([class*='bp3-intent']) {
35
+ background-color: white;
36
+
37
+ &:hover,
38
+ &:focus {
39
+ background-color: var(--seashell);
40
+ }
41
+ }
42
+ }
43
+ }
44
+
45
+ .icon {
46
+ margin-right: 16px;
47
+ color: var(--lighthouse) !important;
48
+ }
@@ -0,0 +1,29 @@
1
+ :global(.bp3-dialog-container) {
2
+ height: 100%;
3
+ }
4
+
5
+ .dialog {
6
+ max-height: 90%;
7
+ background-color: white !important;
8
+ overflow-y: auto;
9
+
10
+ .form,
11
+ :global(.bp3-dialog-body) {
12
+ overflow: auto;
13
+ height: calc(100% - 34px);
14
+ }
15
+
16
+ :global {
17
+ .bp3-button {
18
+ transition: color 0.3s, background 0.3s;
19
+ }
20
+ }
21
+ }
22
+
23
+ .dialogBody {
24
+ position: relative;
25
+ margin: 0 !important;
26
+ padding: 20px !important;
27
+ padding-bottom: 6px !important;
28
+ overflow: auto;
29
+ }
@@ -0,0 +1,108 @@
1
+ @import '../variables.scss';
2
+
3
+ .tooltip {
4
+ position: fixed;
5
+ font-style: normal;
6
+ font-weight: 400;
7
+ letter-spacing: normal;
8
+ line-height: 1.25;
9
+ text-align: left;
10
+ text-shadow: none;
11
+ text-transform: none;
12
+ white-space: normal;
13
+ word-break: normal;
14
+ word-spacing: normal;
15
+ word-wrap: normal;
16
+ font-size: 12px;
17
+ opacity: 0;
18
+ visibility: hidden;
19
+ z-index: 99999999;
20
+ transition: opacity 0.3s, visibility 0.3s;
21
+
22
+ &.visible {
23
+ opacity: 1;
24
+ visibility: visible;
25
+ }
26
+
27
+ &.hidden {
28
+ opacity: 0;
29
+ visibility: hidden;
30
+ }
31
+
32
+ &:global {
33
+ &.right:not(.top):not(.bottom) {
34
+ margin-left: 5px;
35
+
36
+ .tooltipArrow {
37
+ top: 50%;
38
+ left: auto;
39
+ margin-left: -5px;
40
+ border-width: 5px 5px 5px 0;
41
+ border-right-color: var(--reef);
42
+ }
43
+ }
44
+
45
+ &.left:not(.top):not(.bottom) {
46
+ margin-left: -5px;
47
+
48
+ .tooltipArrow {
49
+ top: 50%;
50
+ margin-top: -5px;
51
+ border-width: 5px 0 5px 5px;
52
+ border-left-color: var(--reef);
53
+ right: -5px;
54
+ left: auto;
55
+ }
56
+ }
57
+
58
+ &.top {
59
+ margin-top: -5px;
60
+
61
+ .tooltipArrow {
62
+ top: auto;
63
+ bottom: -5px;
64
+ left: 50%;
65
+ margin-left: -5px;
66
+ border-width: 5px 5px 0;
67
+ border-top-color: var(--reef);
68
+ }
69
+ }
70
+
71
+ &.bottom {
72
+ margin-top: 5px;
73
+
74
+ .tooltipArrow {
75
+ top: 0;
76
+ left: 50%;
77
+ margin-left: -5px;
78
+ border-width: 0 5px 5px;
79
+ border-bottom-color: var(--reef);
80
+ }
81
+ }
82
+ }
83
+ :global {
84
+ .tooltipArrow {
85
+ top: 50%;
86
+ left: 0;
87
+ margin-top: -5px;
88
+ border-width: 5px 5px 5px 0;
89
+ border-right-color: var(--reef);
90
+ position: absolute;
91
+ width: 0;
92
+ height: 0;
93
+ border-color: transparent;
94
+ border-right-color: transparent;
95
+ border-style: solid;
96
+ }
97
+
98
+ .tooltipInner {
99
+ background: var(--reef);
100
+ border-radius: 3px;
101
+ color: #fff;
102
+ max-width: 400px;
103
+ padding: 5px 8px !important;
104
+ text-align: center;
105
+ white-space: nowrap;
106
+ }
107
+ }
108
+ }
@@ -0,0 +1,38 @@
1
+ :root {
2
+ --main-bg-color: #ffffff;
3
+ --main-bg-color-hover: rgba(255, 255, 255, 0.9);
4
+ --main-fg-color: #000000;
5
+ --main-fg-color-hover: rgba(0, 0, 0, 0.07);
6
+
7
+ --white: #ffffff;
8
+ --bg: #f5f6f8;
9
+ --seashell: #e2e2e2;
10
+ --gray: #bec5c9;
11
+ --reef: #5c7080;
12
+ --shark: #1a1e22;
13
+ --overlay: rgba(26, 30, 34, 0.8);
14
+ --success: #019d90;
15
+ --say: #a4ded0;
16
+ --trigger: #ffe5b4;
17
+ --execute: #b0c4de;
18
+ --listen: #ffe699;
19
+ --prompt: #e2c7e0;
20
+ --standard: #000000;
21
+ --skill-call: #0000ff;
22
+ --if-else: #febbad;
23
+ --lighthouse: #f66f48;
24
+ --focus-lighthouse: #e06542;
25
+ --hover-lighthouse: #f39c82;
26
+ --hover-lighthouse-30: #f9ddd5;
27
+ --ocean: #3276ea;
28
+ --hover-ocean: #cad7f5;
29
+
30
+ --spacing-x-small: 2px;
31
+ --spacing-small: 4px;
32
+ --spacing-medium: 8px;
33
+ --spacing-large: 12px;
34
+ --spacing-x-large: 16px;
35
+ --spacing-xx-large: 20px;
36
+ --spacing-xxx-large: 24px;
37
+ --spacing-xxxx-large: 28px;
38
+ }
@@ -63,7 +63,8 @@ class Message extends react_1.Component {
63
63
  shouldPlay: this.props.shouldPlay,
64
64
  intl: this.props.store.intl,
65
65
  escapeHTML: true,
66
- showTimestamp: this.props.store.config.showTimestamp
66
+ showTimestamp: this.props.store.config.showTimestamp,
67
+ googleMapsAPIKey: this.props.store.config.googleMapsAPIKey
67
68
  } }));
68
69
  if (rendered === null) {
69
70
  return null;
@@ -18,6 +18,7 @@ class BpSocket {
18
18
  };
19
19
  this.chatId = config.chatId;
20
20
  this.socket = new messaging_socket_1.MessagingSocket({ url: config.messagingUrl, clientId: config.clientId });
21
+ window.websocket = this.socket;
21
22
  }
22
23
  setup() {
23
24
  this.socket.on('message', this.onMessage);
@@ -0,0 +1 @@
1
+ declare module '*.scss';
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,7 @@
1
+ import { MessagingSocket } from '@botpress/messaging-socket';
2
+ declare global {
3
+ interface Window {
4
+ websocket: MessagingSocket;
5
+ }
6
+ }
7
+ declare module '*.scss';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -56,7 +56,7 @@ class ComposerStore {
56
56
  this._sentHistoryIndex = newIndex;
57
57
  }
58
58
  setLocked(locked) {
59
- this.locked = locked;
59
+ this.locked = !!locked;
60
60
  }
61
61
  setHidden(hidden) {
62
62
  this.hidden = hidden;
package/dist/typings.d.ts CHANGED
@@ -268,9 +268,15 @@ export interface Config {
268
268
  chatId?: string;
269
269
  /**
270
270
  * CSS class to be applied to iframe
271
- * @default '''
271
+ * @default ''
272
272
  */
273
273
  className?: string;
274
+ /**
275
+ * Google Maps API Key required to display the map.
276
+ * Will display a link to Google Maps otherwise
277
+ * @default ''
278
+ */
279
+ googleMapsAPIKey?: string;
274
280
  }
275
281
  export interface BotDetails {
276
282
  website?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/webchat",
3
- "version": "0.3.0",
3
+ "version": "0.3.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "source": "src/index.tsx",
@@ -8,10 +8,13 @@
8
8
  "scripts": {
9
9
  "build": "yarn && yarn run -T tsc --build",
10
10
  "watch": "yarn && yarn run -T tsc --build --watch",
11
- "prepublish": "yarn run -T rimraf dist && yarn --immutable && yarn run -T tsc --build && yarn run -T rimraf dist/.tsbuildinfo"
11
+ "dev": "yarn run -T parcel test/index.html",
12
+ "copy:scss": "yarn run -T copyfiles -u 1 ./src/**/*.scss dist",
13
+ "prepublish": "yarn run -T rimraf dist && yarn --immutable && yarn run -T tsc --build && yarn run -T rimraf dist/.tsbuildinfo && yarn copy:scss"
12
14
  },
13
15
  "files": [
14
- "dist"
16
+ "dist",
17
+ "assets"
15
18
  ],
16
19
  "devDependencies": {
17
20
  "@types/crypto-js": "^4.1.1",
@@ -27,7 +30,7 @@
27
30
  "dependencies": {
28
31
  "@blueprintjs/core": "^3.23.1",
29
32
  "@botpress/messaging-components": "0.3.0",
30
- "@botpress/messaging-socket": "1.1.0",
33
+ "@botpress/messaging-socket": "1.1.1",
31
34
  "@formatjs/intl-pluralrules": "^4.1.6",
32
35
  "@formatjs/intl-utils": "^3.8.4",
33
36
  "@juggle/resize-observer": "^3.0.2",