@subiz/widget-v4 4.0.99 → 4.1.1
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/compiled_src/call/call.js +3 -3
- package/compiled_src/chatbox/AgentsAvatar.js +0 -3
- package/compiled_src/chatbox/ButtonAttachments.js +0 -1
- package/compiled_src/chatbox/ChatButton.js +0 -5
- package/compiled_src/chatbox/DropdownSelect.js +4 -5
- package/compiled_src/chatbox/Event.js +0 -2
- package/compiled_src/chatbox/Events.js +1 -9
- package/compiled_src/chatbox/FormAttachment.js +0 -1
- package/compiled_src/chatbox/GenericTemplateAttachments.js +0 -3
- package/compiled_src/chatbox/Header.js +5 -2
- package/compiled_src/chatbox/InfoMessage.js +0 -1
- package/compiled_src/chatbox/MessageInput.js +3 -3
- package/compiled_src/chatbox/Order.js +3 -1
- package/compiled_src/chatbox/OrderAttachments.js +0 -1
- package/compiled_src/chatbox/QuickReplies.js +0 -1
- package/compiled_src/chatbox/Rating.js +3 -1
- package/compiled_src/chatbox/TextMessage.js +0 -2
- package/compiled_src/chatbox/Typing.js +0 -1
- package/compiled_src/chatbox/Widget.js +4 -18
- package/compiled_src/chatbox/main.js +0 -1
- package/compiled_src/chatbox/releaseAnimation.js +0 -1
- package/compiled_src/contact/contact.js +3 -7
- package/compiled_src/lib.js +7 -18
- package/compiled_src/notif/notif.js +3 -3
- package/compiled_src/order/address_picker.js +4 -6
- package/compiled_src/order/index.js +0 -2
- package/compiled_src/order/order.js +4 -7
- package/compiled_src/plugin.js +0 -9
- package/compiled_src/popup/countdown.js +3 -5
- package/compiled_src/popup/popup.js +3 -8
- package/compiled_src/popup/tick.core.commonjs.js +16 -158
- package/compiled_src/popup/tick.view.flip.commonjs.js +0 -25
- package/compiled_src/store/api.js +3 -9
- package/compiled_src/store/api_fake.js +3 -3
- package/compiled_src/store/store.js +5 -48
- package/compiled_src/util/campaign.js +0 -5
- package/compiled_src/util/common.js +0 -27
- package/compiled_src/util/extractor.js +0 -1
- package/compiled_src/util/gate.test.js +0 -1
- package/compiled_src/util/index.js +0 -1
- package/compiled_src/util/op.js +0 -1
- package/compiled_src/util/order.js +0 -4
- package/dist/132.js +26 -89
- package/dist/184d8eee275.132.js +1 -0
- package/dist/184d8eee275.178.js +1 -0
- package/dist/184d8eee275.213.js +1 -0
- package/dist/184d8eee275.335.js +1 -0
- package/dist/184d8eee275.362.js +1 -0
- package/dist/184d8eee275.441.js +1 -0
- package/dist/184d8eee275.605.js +1 -0
- package/dist/184d8eee275.678.js +1 -0
- package/dist/184d8eee275.782.js +1 -0
- package/dist/184d8eee275.app.js +1 -0
- package/dist/184d8eee275.index.html +26 -0
- package/dist/184d8eee275.library.html +26 -0
- package/dist/184d8eee275.library.js +1 -0
- package/dist/184d8eee275.preview.html +759 -0
- package/dist/184d8eee275.preview.js +1 -0
- package/dist/184d8eee275.screenshoot.js +1 -0
- package/dist/213.js +22 -198
- package/dist/335.js +3 -7
- package/dist/605.js +3 -3
- package/dist/HASH +1 -1
- package/dist/assets/img/award1a.1a58e10.png +0 -0
- package/dist/assets/img/award3a.3b74423.png +0 -0
- package/dist/assets/img/award4a.ed6ccd4.png +0 -0
- package/dist/assets/img/award5.39eb7ae.png +0 -0
- package/dist/assets/img/examplte_logo.f86535f.svg +1 -0
- package/dist/assets/img/main-service1.d536cc2.png +0 -0
- package/dist/assets/img/main-service2.9b99549.png +0 -0
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +14 -130
- package/package.json +4 -4
- package/src/chatbox/Header.js +9 -3
- package/src/lib.js +5 -15
|
@@ -8,11 +8,12 @@ var _index = _interopRequireDefault(require("../util/index.js"));
|
|
|
8
8
|
var _preact = require("preact");
|
|
9
9
|
var _common = require("../common.js");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
16
|
let notifCSS = (() => Promise.resolve().then(() => _interopRequireWildcard(require('./css.js'))))();
|
|
15
|
-
|
|
16
17
|
class Notif extends _common.Com {
|
|
17
18
|
constructor(props) {
|
|
18
19
|
super(props);
|
|
@@ -38,7 +39,6 @@ class Notif extends _common.Com {
|
|
|
38
39
|
}));
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
|
|
42
42
|
setOver(over) {
|
|
43
43
|
if (!over) this.mouse_leave = _index.default.Date.now();else this.mouse_leave = 0;
|
|
44
44
|
}
|
|
@@ -59,7 +59,6 @@ class AgentsAvatar extends _common.Com {
|
|
|
59
59
|
src: this.props.store.replaceFileUrl(acc.logo_url) || require('../../assets/img/image_default.png')
|
|
60
60
|
})));
|
|
61
61
|
}
|
|
62
|
-
|
|
63
62
|
if (agents.length === 1) {
|
|
64
63
|
var agent = agents[0];
|
|
65
64
|
var groupClass = mode === 'primary' ? 'group-avatar--agent-middle' : 'group-avatar--agent-left';
|
|
@@ -77,7 +76,6 @@ class AgentsAvatar extends _common.Com {
|
|
|
77
76
|
src: this.props.store.replaceFileUrl(agent.avatar_url) || require('../../assets/img/default_avatar.png')
|
|
78
77
|
})));
|
|
79
78
|
}
|
|
80
|
-
|
|
81
79
|
if (agents.length === 2) {
|
|
82
80
|
let leftAgent = agents[0];
|
|
83
81
|
let rightAgent = agents[1];
|
|
@@ -105,7 +103,6 @@ class AgentsAvatar extends _common.Com {
|
|
|
105
103
|
src: this.props.store.replaceFileUrl(rightAgent.avatar_url) || require('../../assets/img/default_avatar.png')
|
|
106
104
|
})));
|
|
107
105
|
}
|
|
108
|
-
|
|
109
106
|
let leftAgent = agents[0];
|
|
110
107
|
let middleAgent = agents[1];
|
|
111
108
|
let rightAgent = agents[2];
|
|
@@ -16,7 +16,6 @@ class ButtonAttachments extends _common.Com {
|
|
|
16
16
|
render() {
|
|
17
17
|
let byType = _index.default.get(this.props.ev, 'by.type');
|
|
18
18
|
if (byType === 'user') return null;
|
|
19
|
-
|
|
20
19
|
let buttons = [];
|
|
21
20
|
let attachments = _index.default.get(this.props.ev, 'data.message.attachments', []);
|
|
22
21
|
_index.default.each(attachments, (att, i) => {
|
|
@@ -76,13 +76,11 @@ class ChatButton extends _common.Com {
|
|
|
76
76
|
style: 'opacity: ' + opacity + ' !important'
|
|
77
77
|
}, this.renderPreview(), this.renderButton());
|
|
78
78
|
}
|
|
79
|
-
|
|
80
79
|
ClearPreview() {
|
|
81
80
|
this.setState({
|
|
82
81
|
previewEvent: {}
|
|
83
82
|
});
|
|
84
83
|
}
|
|
85
|
-
|
|
86
84
|
ShowGreeting() {
|
|
87
85
|
let greeting = _index.default.get(this.props.plugin, 'chatbox.greeting', {});
|
|
88
86
|
let agentM = this.props.store.matchAgent('*');
|
|
@@ -132,7 +130,6 @@ class ChatButton extends _common.Com {
|
|
|
132
130
|
}));
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
|
-
|
|
136
133
|
return this.onPreviewClick();
|
|
137
134
|
}
|
|
138
135
|
onPreviewClick(e) {
|
|
@@ -280,7 +277,6 @@ class ChatButton extends _common.Com {
|
|
|
280
277
|
`;
|
|
281
278
|
}
|
|
282
279
|
let cls = 'chat-button chat-button--' + position;
|
|
283
|
-
|
|
284
280
|
return (0, _preact.h)("div", {
|
|
285
281
|
class: cls,
|
|
286
282
|
onClick: e => this.onClick(e)
|
|
@@ -314,7 +310,6 @@ class ChatButton extends _common.Com {
|
|
|
314
310
|
defmsg = defmsg || 'Sent you a message';
|
|
315
311
|
let message = _index.default.get(ev, 'data.message.text');
|
|
316
312
|
var format = _index.default.get(ev, 'data.message.format');
|
|
317
|
-
|
|
318
313
|
if (format && format !== 'plaintext') message = defmsg;
|
|
319
314
|
if (!message && _index.default.size(_index.default.get(ev, 'data.message.attachments')) > 0) message = defmsg;
|
|
320
315
|
if (!message) return null;
|
|
@@ -9,7 +9,9 @@ var _common = require("../common.js");
|
|
|
9
9
|
var _preact = require("preact");
|
|
10
10
|
var _spinner = _interopRequireDefault(require("./spinner.js"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
15
|
class DropdownSelect extends _common.Com {
|
|
14
16
|
constructor(props) {
|
|
15
17
|
super(props);
|
|
@@ -77,11 +79,8 @@ class DropdownSelect extends _common.Com {
|
|
|
77
79
|
console.log('EEEEEEE', e);
|
|
78
80
|
alert('y');
|
|
79
81
|
});
|
|
80
|
-
document.addEventListener('touchmove', function (e) {
|
|
81
|
-
}
|
|
82
|
-
);
|
|
82
|
+
document.addEventListener('touchmove', function (e) {});
|
|
83
83
|
}
|
|
84
|
-
|
|
85
84
|
componentDidMount() {
|
|
86
85
|
window.addEventListener('keydown', this.onKeydown);
|
|
87
86
|
}
|
|
@@ -22,7 +22,6 @@ var _time = _interopRequireDefault(require("./time.js"));
|
|
|
22
22
|
var _common = require("../common.js");
|
|
23
23
|
var _preact = require("preact");
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
25
|
class Event extends _common.Com {
|
|
27
26
|
constructor(props) {
|
|
28
27
|
super(props);
|
|
@@ -188,7 +187,6 @@ class Event extends _common.Com {
|
|
|
188
187
|
refresh: this.state.refresh
|
|
189
188
|
}), 1000);
|
|
190
189
|
}
|
|
191
|
-
|
|
192
190
|
let $dot = (0, _preact.h)("div", {
|
|
193
191
|
class: "sending_dot"
|
|
194
192
|
});
|
|
@@ -129,9 +129,7 @@ class Events extends _common.Com {
|
|
|
129
129
|
if (convo.state === 'ended') return false;
|
|
130
130
|
return true;
|
|
131
131
|
});
|
|
132
|
-
|
|
133
132
|
}
|
|
134
|
-
|
|
135
133
|
onEvent(newev) {
|
|
136
134
|
if (_index.default.convoOfEv(newev) !== this.props.cid) return;
|
|
137
135
|
let isBottom = this.isBottom();
|
|
@@ -195,12 +193,10 @@ class Events extends _common.Com {
|
|
|
195
193
|
}
|
|
196
194
|
}
|
|
197
195
|
}
|
|
198
|
-
|
|
199
196
|
exports.default = Events;
|
|
200
197
|
function processEvents(convo, events) {
|
|
201
198
|
events = events.filter(event => visibleEvent(event.ev));
|
|
202
199
|
if (events.length < 1) return;
|
|
203
|
-
|
|
204
200
|
for (var i = 1; i < events.length; i++) {
|
|
205
201
|
let curEvent = events[i];
|
|
206
202
|
let lastEvent = events[i - 1];
|
|
@@ -209,7 +205,6 @@ function processEvents(convo, events) {
|
|
|
209
205
|
if (elapsedSec > 120) curEvent.show_time = true;
|
|
210
206
|
}
|
|
211
207
|
}
|
|
212
|
-
|
|
213
208
|
for (var i = 0; i < events.length; i++) {
|
|
214
209
|
let curEvent = events[i];
|
|
215
210
|
if (_index.default.get(curEvent, 'ev.type') === 'message_sent') {
|
|
@@ -217,7 +212,6 @@ function processEvents(convo, events) {
|
|
|
217
212
|
break;
|
|
218
213
|
}
|
|
219
214
|
}
|
|
220
|
-
|
|
221
215
|
for (var i = 0; i < events.length; i++) {
|
|
222
216
|
let curEvent = events[i];
|
|
223
217
|
let prevEvent = events[i - 1];
|
|
@@ -232,9 +226,7 @@ function processEvents(convo, events) {
|
|
|
232
226
|
}
|
|
233
227
|
function visibleEvent(ev) {
|
|
234
228
|
let type = _index.default.get(ev, 'type');
|
|
235
|
-
return
|
|
236
|
-
type === 'message_sent' || type === 'conversation_state_updated'
|
|
237
|
-
);
|
|
229
|
+
return type === 'message_sent' || type === 'conversation_state_updated';
|
|
238
230
|
}
|
|
239
231
|
function isSummited(form) {
|
|
240
232
|
let fields = _index.default.get(form, 'fields') || [];
|
|
@@ -16,7 +16,6 @@ class GenericTemplateAttachments extends _common.Com {
|
|
|
16
16
|
this.state = {
|
|
17
17
|
focusing: 0
|
|
18
18
|
};
|
|
19
|
-
|
|
20
19
|
this.galleryRef = (0, _preact.createRef)();
|
|
21
20
|
}
|
|
22
21
|
componentDidMount() {
|
|
@@ -31,11 +30,9 @@ class GenericTemplateAttachments extends _common.Com {
|
|
|
31
30
|
behavior: 'smooth'
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
|
-
|
|
35
33
|
render() {
|
|
36
34
|
let byType = _index.default.get(this.props.ev, 'by.type');
|
|
37
35
|
if (byType === 'user') return null;
|
|
38
|
-
|
|
39
36
|
let attachments = _index.default.get(this.props.ev, 'data.message.attachments', []);
|
|
40
37
|
let generics = _index.default.filter(attachments, att => _index.default.get(att, 'type') === 'generic');
|
|
41
38
|
if (generics.length === 0) return null;
|
|
@@ -20,7 +20,6 @@ class Header extends _common.Com {
|
|
|
20
20
|
let renderSocial = false;
|
|
21
21
|
let renderTeam = false;
|
|
22
22
|
let renderCollapsed = this.props.view !== 'list' && headerMode === 'collapsed';
|
|
23
|
-
|
|
24
23
|
let accSetting = this.props.plugin.chatbox || {};
|
|
25
24
|
let layout = _index.default.get(accSetting, 'header.layout');
|
|
26
25
|
if (renderCollapsed) {
|
|
@@ -210,4 +209,8 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
|
|
|
210
209
|
}
|
|
211
210
|
}
|
|
212
211
|
exports.default = Header;
|
|
213
|
-
let getJoinedNameMember = agents =>
|
|
212
|
+
let getJoinedNameMember = agents => {
|
|
213
|
+
agents = _index.default.filter(agents, agent => _index.default.trim(agent.fullname));
|
|
214
|
+
if (!agents.length) return null;
|
|
215
|
+
return _index.default.map(agents, agent => agent.fullname).join(', ');
|
|
216
|
+
};
|
|
@@ -9,7 +9,9 @@ var _common = require("../common.js");
|
|
|
9
9
|
var _preact = require("preact");
|
|
10
10
|
var _Emoji = _interopRequireDefault(require("./Emoji.js"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
15
|
class MessageInput extends _common.Com {
|
|
14
16
|
constructor(props) {
|
|
15
17
|
super(props);
|
|
@@ -93,7 +95,6 @@ class MessageInput extends _common.Com {
|
|
|
93
95
|
let attachments = _index.default.get(events[0], 'data.message.attachments', []);
|
|
94
96
|
let lock = _index.default.find(attachments, att => _index.default.get(att, 'lock_input'));
|
|
95
97
|
if (lock) return true;
|
|
96
|
-
|
|
97
98
|
var last_agent_sent;
|
|
98
99
|
for (let ev of events) {
|
|
99
100
|
if (_index.default.get(ev, 'by.type') === 'user') continue;
|
|
@@ -283,7 +284,6 @@ class MessageInput extends _common.Com {
|
|
|
283
284
|
attachments
|
|
284
285
|
});
|
|
285
286
|
}
|
|
286
|
-
|
|
287
287
|
async submitMessage(msg) {
|
|
288
288
|
msg = msg || _index.default.trim(this.refMessageInput.current.value) || '';
|
|
289
289
|
if (!msg) return;
|
|
@@ -11,7 +11,9 @@ var _common = require("../common.js");
|
|
|
11
11
|
var _preact = require("preact");
|
|
12
12
|
var _order = _interopRequireDefault(require("../order/order.js"));
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
17
|
const POPUP_MAX_HEIGHT = 400;
|
|
16
18
|
const POPUP_HARD_MAX_HEIGHT = 500;
|
|
17
19
|
const POPUP_MIN_HEIGHT = 0;
|
|
@@ -12,7 +12,6 @@ class ProductAttachments extends _common.Com {
|
|
|
12
12
|
render() {
|
|
13
13
|
let byType = _index.default.get(this.props.ev, 'by.type');
|
|
14
14
|
if (byType === 'user') return null;
|
|
15
|
-
|
|
16
15
|
let acc = this.props.store.matchAccount();
|
|
17
16
|
var attachments = _index.default.get(this.props.ev, 'data.message.attachments', []);
|
|
18
17
|
let orders = _index.default.filter(attachments, att => att.type === 'order' && att.order).map(att => att.order);
|
|
@@ -26,7 +26,6 @@ class QuickReplies extends _common.Com {
|
|
|
26
26
|
let cid = _index.default.convoOfEv(this.props.ev);
|
|
27
27
|
let convo = this.props.store.matchConvo(cid);
|
|
28
28
|
if (_index.default.get(convo, 'state') === 'ended') return null;
|
|
29
|
-
|
|
30
29
|
let events = _index.default.map(this.props.store.listEvents(cid));
|
|
31
30
|
events = _index.default.orderBy(events, 'created', 'asc').filter(ev => ev.type === 'message_sent');
|
|
32
31
|
let evindex = 0;
|
|
@@ -9,7 +9,9 @@ var _releaseAnimation = _interopRequireDefault(require("./releaseAnimation.js"))
|
|
|
9
9
|
var _common = require("../common.js");
|
|
10
10
|
var _preact = require("preact");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
15
|
const POPUP_MAX_HEIGHT = 400;
|
|
14
16
|
const POPUP_HARD_MAX_HEIGHT = 500;
|
|
15
17
|
const POPUP_MIN_HEIGHT = 0;
|
|
@@ -20,7 +20,9 @@ var _time = _interopRequireDefault(require("./time.js"));
|
|
|
20
20
|
var _common = require("../common.js");
|
|
21
21
|
var _preact = require("preact");
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
25
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
24
26
|
var send = require('../../assets/img/send.svg');
|
|
25
27
|
var checkedimg = require('../../assets/img/done_gray.svg');
|
|
26
28
|
var empty = require('../../assets/img/empty.svg');
|
|
@@ -47,9 +49,7 @@ class Widget extends _common.Com {
|
|
|
47
49
|
message: text,
|
|
48
50
|
initial_by: this.props.store.matchUser().id
|
|
49
51
|
});
|
|
50
|
-
if (error) {
|
|
51
|
-
}
|
|
52
|
-
|
|
52
|
+
if (error) {}
|
|
53
53
|
this.creating = false;
|
|
54
54
|
this.props.store.sendConvoEvent(convo.id, 'message_sent', {
|
|
55
55
|
message
|
|
@@ -187,7 +187,6 @@ class Widget extends _common.Com {
|
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
189
|
if (hasError) return this.forceUpdate();
|
|
190
|
-
|
|
191
190
|
let data = _index.default.cloneDeep(this.state.formData);
|
|
192
191
|
let user = _index.default.cloneDeep(this.props.store.matchUser());
|
|
193
192
|
let is_lead = false;
|
|
@@ -225,15 +224,12 @@ class Widget extends _common.Com {
|
|
|
225
224
|
attachments: this.state.quickReplyMessage.attachments
|
|
226
225
|
}
|
|
227
226
|
});
|
|
228
|
-
|
|
229
227
|
this.setState({
|
|
230
228
|
quickReplyMessage: {}
|
|
231
229
|
});
|
|
232
|
-
|
|
233
230
|
if (form.end_conversation_after_submit) await this.props.store.endConvo(this.props.cid);
|
|
234
231
|
return;
|
|
235
232
|
}
|
|
236
|
-
|
|
237
233
|
this.setState({
|
|
238
234
|
creating: true
|
|
239
235
|
});
|
|
@@ -650,7 +646,6 @@ class Widget extends _common.Com {
|
|
|
650
646
|
setTimeout(() => $input && $input.blur());
|
|
651
647
|
setTimeout(() => $input && $input.blur(), 300);
|
|
652
648
|
}
|
|
653
|
-
|
|
654
649
|
focusInput() {
|
|
655
650
|
if (this.props.store.isPreview) return;
|
|
656
651
|
if (this.shouldShowForm()) {
|
|
@@ -672,7 +667,6 @@ class Widget extends _common.Com {
|
|
|
672
667
|
setTimeout(() => $input.focus());
|
|
673
668
|
setTimeout(() => $input.focus(), 300);
|
|
674
669
|
}
|
|
675
|
-
|
|
676
670
|
onRate(rating) {
|
|
677
671
|
if (!this.props.cid) return;
|
|
678
672
|
this.props.store.sendConvoEvent(this.props.cid, 'conversation_rated', {
|
|
@@ -771,21 +765,17 @@ class Widget extends _common.Com {
|
|
|
771
765
|
if (!this.props.store.isMobile()) this.focusInput();
|
|
772
766
|
}
|
|
773
767
|
isFormRequired() {
|
|
774
|
-
|
|
775
768
|
let form;
|
|
776
769
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
777
770
|
let acc = this.props.store.matchAccount() || {};
|
|
778
771
|
if (_index.default.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
|
|
779
|
-
|
|
780
772
|
let offlineEnabled = _index.default.get(accountSetting, 'offline_form.enabled');
|
|
781
773
|
if (this.isOffline(acc, accountSetting) && offlineEnabled) form = accountSetting.offline_form;
|
|
782
774
|
if (!form) return false;
|
|
783
775
|
let formData = this.fillForm(form);
|
|
784
|
-
|
|
785
776
|
let convo = this.props.store.matchConvo(this.props.cid) || {};
|
|
786
777
|
if (convo.state === 'ended') return true;
|
|
787
778
|
if (convo.state && convo.state !== 'pending') delete formData.group;
|
|
788
|
-
|
|
789
779
|
let isAllFiledEmpty = true;
|
|
790
780
|
_index.default.each(formData, field => {
|
|
791
781
|
if (field.value) isAllFiledEmpty = false;
|
|
@@ -857,7 +847,6 @@ class Widget extends _common.Com {
|
|
|
857
847
|
let defmsg = this.props.t('sent_you_a_message');
|
|
858
848
|
let message = _index.default.get(ev, 'data.message.text');
|
|
859
849
|
var format = _index.default.get(ev, 'data.message.format');
|
|
860
|
-
|
|
861
850
|
if (format !== 'plaintext') message = defmsg;
|
|
862
851
|
if (!message && _index.default.size(_index.default.get(ev, 'data.message.attachments')) > 0) message = defmsg;
|
|
863
852
|
if (!message) return null;
|
|
@@ -894,7 +883,6 @@ class Widget extends _common.Com {
|
|
|
894
883
|
if (enableWhen === 'out_of_bussiness_hour') isonline = acc.is_in_business_hour;
|
|
895
884
|
return !isonline;
|
|
896
885
|
}
|
|
897
|
-
|
|
898
886
|
updateFormDataFields() {
|
|
899
887
|
let form;
|
|
900
888
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
@@ -914,7 +902,6 @@ class Widget extends _common.Com {
|
|
|
914
902
|
var data = {};
|
|
915
903
|
_index.default.each(form.fields, f => {
|
|
916
904
|
var newf = Object.assign({}, f);
|
|
917
|
-
|
|
918
905
|
if (f.type === 'list') {
|
|
919
906
|
newf.list = f.list;
|
|
920
907
|
}
|
|
@@ -933,7 +920,6 @@ class Widget extends _common.Com {
|
|
|
933
920
|
}))
|
|
934
921
|
};
|
|
935
922
|
}
|
|
936
|
-
|
|
937
923
|
data['question'] = {
|
|
938
924
|
key: 'question',
|
|
939
925
|
is_required: true,
|
|
@@ -9,12 +9,12 @@ var _index = _interopRequireDefault(require("../util/index.js"));
|
|
|
9
9
|
var _preact = require("preact");
|
|
10
10
|
var _common = require("../common.js");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
17
|
let CSS = (() => Promise.resolve().then(() => _interopRequireWildcard(require('./css.js'))))();
|
|
17
|
-
|
|
18
18
|
class Contact extends _common.Com {
|
|
19
19
|
constructor(props) {
|
|
20
20
|
super(props);
|
|
@@ -197,7 +197,6 @@ class Contact extends _common.Com {
|
|
|
197
197
|
}));
|
|
198
198
|
return (0, _preact.h)("div", null, icon);
|
|
199
199
|
}
|
|
200
|
-
|
|
201
200
|
renderButtons(buttons) {
|
|
202
201
|
if (_index.default.size(buttons) === 0) return null;
|
|
203
202
|
return _index.default.map(buttons, button => {
|
|
@@ -323,7 +322,6 @@ async function runCampaign(byTrigger) {
|
|
|
323
322
|
ran = true;
|
|
324
323
|
pageIndex = 0;
|
|
325
324
|
let page = _index.default.get(camp, `pages.${pageIndex}`) || {};
|
|
326
|
-
|
|
327
325
|
showPage(page);
|
|
328
326
|
triggerType = byTrigger;
|
|
329
327
|
let {
|
|
@@ -336,7 +334,6 @@ function eq(a, b) {
|
|
|
336
334
|
}
|
|
337
335
|
function replaceCssVariable(css, setting) {
|
|
338
336
|
var tokens = [css];
|
|
339
|
-
|
|
340
337
|
tokens = _index.default.tokenize(tokens, "'@font_family'");
|
|
341
338
|
tokens = _index.default.tokenize(tokens, "'@font_size'");
|
|
342
339
|
tokens = _index.default.tokenize(tokens, "'@text_color'");
|
|
@@ -353,7 +350,6 @@ function replaceCssVariable(css, setting) {
|
|
|
353
350
|
ret.push(item);
|
|
354
351
|
continue;
|
|
355
352
|
}
|
|
356
|
-
|
|
357
353
|
var path = item.type.substr(2, item.type.length - 3);
|
|
358
354
|
var val = _index.default.get(setting, path) || _index.default.get(DEFVAL, path) || '';
|
|
359
355
|
ret.push(val);
|
package/compiled_src/lib.js
CHANGED
|
@@ -8,7 +8,9 @@ var _store = _interopRequireDefault(require("./store/store.js"));
|
|
|
8
8
|
var _index = _interopRequireDefault(require("./util/index.js"));
|
|
9
9
|
var _plugin = _interopRequireDefault(require("./plugin.js"));
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
14
|
var $link = document.createElement('link');
|
|
13
15
|
$link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap';
|
|
14
16
|
$link.rel = 'stylesheet';
|
|
@@ -20,32 +22,18 @@ class Widget {
|
|
|
20
22
|
_defineProperty(this, "setSetting", setting => this.store.setSetting({
|
|
21
23
|
account_setting: setting
|
|
22
24
|
}));
|
|
23
|
-
_defineProperty(this, "getSetting", _ => ({
|
|
24
|
-
account_setting: _index.default.cloneDeep(this.store.matchAccountSetting())
|
|
25
|
-
}));
|
|
26
25
|
_defineProperty(this, "getUser", () => _index.default.parseJSON(_index.default.stringify(this.store.matchUser())));
|
|
27
26
|
_defineProperty(this, "setViewingProduct", p => this.store.linkProduct(p));
|
|
28
27
|
_defineProperty(this, "getViewingProduct", () => this.store.getLinkedProduct());
|
|
29
28
|
_defineProperty(this, "track", () => this.store.track());
|
|
30
29
|
this.domGate = new _index.default.Gate();
|
|
31
30
|
this.store = new _store.default(ApiURL, FileURL, RealtimeURL, inmem, fake);
|
|
32
|
-
|
|
33
31
|
window.sbz_store = this.store;
|
|
34
32
|
this.subs = [];
|
|
35
33
|
this.store.onConvoEvent({
|
|
36
34
|
_isMounted: true
|
|
37
35
|
}, ev => _index.default.map(this.subs, sub => sub(ev)));
|
|
38
36
|
}
|
|
39
|
-
setLang(obj) {
|
|
40
|
-
var xhttp = new XMLHttpRequest();
|
|
41
|
-
xhttp.open('GET', 'https://api.sbz.vn/4.0/oldlang', true);
|
|
42
|
-
xhttp.send();
|
|
43
|
-
}
|
|
44
|
-
toggleLangDebugMode() {
|
|
45
|
-
var xhttp = new XMLHttpRequest();
|
|
46
|
-
xhttp.open('GET', 'https://api.sbz.vn/4.0/oldlangdebug', true);
|
|
47
|
-
xhttp.send();
|
|
48
|
-
}
|
|
49
37
|
async waitReady(cb) {
|
|
50
38
|
await this.store.readyGate.entry();
|
|
51
39
|
cb();
|
|
@@ -79,7 +67,6 @@ class Widget {
|
|
|
79
67
|
cb && cb(outmask);
|
|
80
68
|
return outmask;
|
|
81
69
|
}
|
|
82
|
-
|
|
83
70
|
_setAccount(id, $con) {
|
|
84
71
|
return this.setAccount(id, $con);
|
|
85
72
|
}
|
|
@@ -134,7 +121,6 @@ class Widget {
|
|
|
134
121
|
await this.domGate.entry();
|
|
135
122
|
this.pluginMgr.hideCurrentGreeting();
|
|
136
123
|
}
|
|
137
|
-
|
|
138
124
|
async showWidget(view, cid) {
|
|
139
125
|
await this.domGate.entry();
|
|
140
126
|
this.pluginMgr.showCurrentChatbox({
|
|
@@ -150,6 +136,10 @@ class Widget {
|
|
|
150
136
|
await this.domGate.entry();
|
|
151
137
|
return this.pluginMgr.setCurrentChatboxLocale(locale);
|
|
152
138
|
}
|
|
139
|
+
async setLanguage(locale) {
|
|
140
|
+
await this.domGate.entry();
|
|
141
|
+
return this.pluginMgr.setCurrentChatboxLocale(locale);
|
|
142
|
+
}
|
|
153
143
|
async setPluginLocale(id, locale) {
|
|
154
144
|
await this.domGate.entry();
|
|
155
145
|
return this.pluginMgr.setPluginLocale(id, locale);
|
|
@@ -190,7 +180,6 @@ class Widget {
|
|
|
190
180
|
}
|
|
191
181
|
}
|
|
192
182
|
}
|
|
193
|
-
|
|
194
183
|
window.__sbz_WIDGET = Widget;
|
|
195
184
|
var _default = Widget;
|
|
196
185
|
exports.default = _default;
|
|
@@ -8,11 +8,12 @@ var _index = _interopRequireDefault(require("../util/index.js"));
|
|
|
8
8
|
var _preact = require("preact");
|
|
9
9
|
var _common = require("../common.js");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
16
|
let notifCSS = (() => Promise.resolve().then(() => _interopRequireWildcard(require('./css.js'))))();
|
|
15
|
-
|
|
16
17
|
class Notif extends _common.Com {
|
|
17
18
|
constructor(props) {
|
|
18
19
|
super(props);
|
|
@@ -38,7 +39,6 @@ class Notif extends _common.Com {
|
|
|
38
39
|
}));
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
|
|
42
42
|
setOver(over) {
|
|
43
43
|
if (!over) this.mouse_leave = _index.default.Date.now();else this.mouse_leave = 0;
|
|
44
44
|
}
|