@subiz/widget-v4 4.1.119 → 4.1.120
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.
- package/assets/less/widget.less +3 -2
- package/compiled_src/chatbox/Event.js +24 -5
- package/compiled_src/chatbox/Events.js +22 -24
- package/compiled_src/chatbox/Widget.js +6 -2
- package/package.json +1 -1
- package/src/chatbox/Event.js +18 -5
- package/src/chatbox/Events.js +12 -15
- package/src/chatbox/Widget.js +3 -2
package/assets/less/widget.less
CHANGED
|
@@ -248,7 +248,9 @@
|
|
|
248
248
|
|
|
249
249
|
.btn--start-convo {
|
|
250
250
|
border-radius: 7px;
|
|
251
|
-
display:
|
|
251
|
+
display: flex;
|
|
252
|
+
align-items: center;
|
|
253
|
+
justify-content: center;
|
|
252
254
|
padding-left: 32px;
|
|
253
255
|
padding-right: 32px;
|
|
254
256
|
height: 40px;
|
|
@@ -306,7 +308,6 @@
|
|
|
306
308
|
}
|
|
307
309
|
|
|
308
310
|
.poweredby {
|
|
309
|
-
margin-top: @spacer3;
|
|
310
311
|
margin-bottom: @spacer2;
|
|
311
312
|
text-align: center;
|
|
312
313
|
|
|
@@ -155,7 +155,22 @@ class Event extends _common.Com {
|
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
renderTyping() {
|
|
158
|
-
|
|
158
|
+
if (!this.props.event.is_show) {
|
|
159
|
+
return (0, _preact.h)("div", {
|
|
160
|
+
key: 'container',
|
|
161
|
+
class: "convo-event agent-message",
|
|
162
|
+
style: "opacity: 0 !important"
|
|
163
|
+
}, (0, _preact.h)("div", {
|
|
164
|
+
class: "agent-convo-event-wrapper"
|
|
165
|
+
}, (0, _preact.h)("div", {
|
|
166
|
+
class: "agent-convo-event-inner"
|
|
167
|
+
}, (0, _preact.h)("div", {
|
|
168
|
+
class: "message-agent message-text--agent",
|
|
169
|
+
style: "opacity: 0.6 !important"
|
|
170
|
+
}, (0, _preact.h)("div", {
|
|
171
|
+
style: "height: 20px !important; width: 35px !important"
|
|
172
|
+
})))));
|
|
173
|
+
}
|
|
159
174
|
var html = `
|
|
160
175
|
<html>
|
|
161
176
|
<head>
|
|
@@ -204,14 +219,15 @@ class Event extends _common.Com {
|
|
|
204
219
|
`;
|
|
205
220
|
let src = 'data:text/html,' + encodeURIComponent(html);
|
|
206
221
|
return (0, _preact.h)("div", {
|
|
207
|
-
|
|
222
|
+
key: 'container',
|
|
223
|
+
class: "convo-event agent-message",
|
|
224
|
+
style: "opacity: 0.6 !important"
|
|
208
225
|
}, (0, _preact.h)("div", {
|
|
209
226
|
class: "agent-convo-event-wrapper"
|
|
210
227
|
}, (0, _preact.h)("div", {
|
|
211
|
-
class:
|
|
228
|
+
class: "agent-convo-event-inner"
|
|
212
229
|
}, (0, _preact.h)("div", {
|
|
213
|
-
class: "message-agent message-text--agent"
|
|
214
|
-
style: "opacity: 0.6 !important"
|
|
230
|
+
class: "message-agent message-text--agent"
|
|
215
231
|
}, (0, _preact.h)("iframe", {
|
|
216
232
|
src: src,
|
|
217
233
|
style: "width: 35px !important; height: 20px !important; display: block !important; overflow: hidden !important; padding: 0 !important "
|
|
@@ -298,6 +314,9 @@ class Event extends _common.Com {
|
|
|
298
314
|
});
|
|
299
315
|
}
|
|
300
316
|
let $sender = null;
|
|
317
|
+
if (this.props.event.mode === 'lead') $sender = (0, _preact.h)("div", {
|
|
318
|
+
class: "pt-2"
|
|
319
|
+
});
|
|
301
320
|
let $error = null;
|
|
302
321
|
if (ev._error && ev.type === 'message_sent') {
|
|
303
322
|
let msg = this.props.t('error_send_message');
|
|
@@ -106,33 +106,31 @@ class Events extends _common.Com {
|
|
|
106
106
|
events = _index.default.map(events, ev => ({
|
|
107
107
|
ev: ev
|
|
108
108
|
}));
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
109
|
+
let ev = this.state.typing_event || {
|
|
110
|
+
id: 'evzz' + _index.default.Date.now(),
|
|
111
|
+
created: _index.default.Date.now(),
|
|
112
|
+
by: {
|
|
113
|
+
type: 'agent'
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
let fakeev = {
|
|
117
|
+
is_typing: true,
|
|
118
|
+
is_show: this.state.isShowTyping,
|
|
119
|
+
id: ev.id,
|
|
120
|
+
ev: {
|
|
119
121
|
id: ev.id,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
text: '...',
|
|
128
|
-
conversation_id: this.props.cid
|
|
129
|
-
}
|
|
122
|
+
created: ev.created,
|
|
123
|
+
by: ev.by,
|
|
124
|
+
type: 'message_sent',
|
|
125
|
+
data: {
|
|
126
|
+
message: {
|
|
127
|
+
text: '...',
|
|
128
|
+
conversation_id: this.props.cid
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
events.push(fakeev);
|
|
136
134
|
processEvents(convo, events);
|
|
137
135
|
let $events = _index.default.map(events, ev => {
|
|
138
136
|
let isLast = ev.ev.id === _index.default.get(convo, 'last_message_sent.id');
|
|
@@ -652,7 +652,9 @@ class Widget extends _common.Com {
|
|
|
652
652
|
class: "flex-grow-1"
|
|
653
653
|
}, (0, _preact.h)("div", {
|
|
654
654
|
class: "form mt-3 pl-3 pr-3 pt-3 pb-3 d-flex flex-column"
|
|
655
|
-
}, (0, _preact.h)("div", null, title), this.renderFields(form, formName))), (0, _preact.h)(
|
|
655
|
+
}, (0, _preact.h)("div", null, title), this.renderFields(form, formName))), (0, _preact.h)("div", {
|
|
656
|
+
class: "mt-2"
|
|
657
|
+
}), (0, _preact.h)(_PoweredBy.default, {
|
|
656
658
|
store: this.props.store,
|
|
657
659
|
t: this.props.t
|
|
658
660
|
})), (0, _preact.h)("div", {
|
|
@@ -724,7 +726,9 @@ class Widget extends _common.Com {
|
|
|
724
726
|
alt: "send button",
|
|
725
727
|
width: "26",
|
|
726
728
|
height: "26"
|
|
727
|
-
})), (0, _preact.h)(
|
|
729
|
+
})), (0, _preact.h)("div", {
|
|
730
|
+
class: "mt-2"
|
|
731
|
+
}), (0, _preact.h)(_PoweredBy.default, {
|
|
728
732
|
store: this.props.store
|
|
729
733
|
})));
|
|
730
734
|
}
|
package/package.json
CHANGED
package/src/chatbox/Event.js
CHANGED
|
@@ -153,7 +153,20 @@ export default class Event extends Com {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
renderTyping() {
|
|
156
|
-
|
|
156
|
+
if (!this.props.event.is_show) {
|
|
157
|
+
return (
|
|
158
|
+
<div key={'container'} class='convo-event agent-message' style='opacity: 0 !important'>
|
|
159
|
+
<div class='agent-convo-event-wrapper'>
|
|
160
|
+
<div class='agent-convo-event-inner'>
|
|
161
|
+
<div class='message-agent message-text--agent' style='opacity: 0.6 !important'>
|
|
162
|
+
<div style='height: 20px !important; width: 35px !important'></div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
157
170
|
var html = `
|
|
158
171
|
<html>
|
|
159
172
|
<head>
|
|
@@ -202,10 +215,10 @@ export default class Event extends Com {
|
|
|
202
215
|
`
|
|
203
216
|
let src = 'data:text/html,' + encodeURIComponent(html)
|
|
204
217
|
return (
|
|
205
|
-
<div class='convo-event agent-message'>
|
|
218
|
+
<div key={'container'} class='convo-event agent-message' style='opacity: 0.6 !important'>
|
|
206
219
|
<div class='agent-convo-event-wrapper'>
|
|
207
|
-
<div class=
|
|
208
|
-
<div class='message-agent message-text--agent'
|
|
220
|
+
<div class='agent-convo-event-inner'>
|
|
221
|
+
<div class='message-agent message-text--agent'>
|
|
209
222
|
<iframe
|
|
210
223
|
src={src}
|
|
211
224
|
style='width: 35px !important; height: 20px !important; display: block !important; overflow: hidden !important; padding: 0 !important '
|
|
@@ -286,7 +299,7 @@ export default class Event extends Com {
|
|
|
286
299
|
}
|
|
287
300
|
|
|
288
301
|
let $sender = null
|
|
289
|
-
|
|
302
|
+
if (this.props.event.mode === 'lead') $sender = <div class='pt-2'></div>
|
|
290
303
|
|
|
291
304
|
let $error = null
|
|
292
305
|
if (ev._error && ev.type === 'message_sent') {
|
package/src/chatbox/Events.js
CHANGED
|
@@ -111,23 +111,20 @@ export default class Events extends Com {
|
|
|
111
111
|
events = sb.map(events, (ev) => ({ev: ev}))
|
|
112
112
|
|
|
113
113
|
// console.log('-----------', this.state.isShowTyping, this.state.typing_event)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
let ev = this.state.typing_event || {id: 'evzz' + sb.Date.now(), created: sb.Date.now(), by: {type: 'agent'}}
|
|
115
|
+
let fakeev = {
|
|
116
|
+
is_typing: true,
|
|
117
|
+
is_show: this.state.isShowTyping,
|
|
118
|
+
id: ev.id,
|
|
119
|
+
ev: {
|
|
118
120
|
id: ev.id,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
data: {message: {text: '...', conversation_id: this.props.cid}},
|
|
125
|
-
},
|
|
126
|
-
}
|
|
127
|
-
console.log('FA', fakeev)
|
|
128
|
-
events.push(fakeev)
|
|
121
|
+
created: ev.created,
|
|
122
|
+
by: ev.by,
|
|
123
|
+
type: 'message_sent',
|
|
124
|
+
data: {message: {text: '...', conversation_id: this.props.cid}},
|
|
125
|
+
},
|
|
129
126
|
}
|
|
130
|
-
|
|
127
|
+
events.push(fakeev)
|
|
131
128
|
processEvents(convo, events)
|
|
132
129
|
|
|
133
130
|
let $events = sb.map(events, (ev) => {
|
package/src/chatbox/Widget.js
CHANGED
|
@@ -624,8 +624,8 @@ export default class Widget extends Com {
|
|
|
624
624
|
<div>{title}</div>
|
|
625
625
|
{this.renderFields(form, formName)}
|
|
626
626
|
</div>
|
|
627
|
-
|
|
628
|
-
|
|
627
|
+
</div>
|
|
628
|
+
<div class="mt-2"></div>
|
|
629
629
|
<PoweredBy store={this.props.store} t={this.props.t} />
|
|
630
630
|
</div>
|
|
631
631
|
|
|
@@ -698,6 +698,7 @@ export default class Widget extends Com {
|
|
|
698
698
|
<span>{this.props.t('start_conversation')}</span>
|
|
699
699
|
<img src={send} alt='send button' width='26' height='26' />
|
|
700
700
|
</button>
|
|
701
|
+
<div class="mt-2"></div>
|
|
701
702
|
<PoweredBy store={this.props.store} />
|
|
702
703
|
</div>
|
|
703
704
|
</div>
|