@subiz/widget-v4 4.1.198 → 4.1.200
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/img/default_avatar.png +0 -0
- package/assets/img/default_logo.png +0 -0
- package/assets/img/default_logo.svg +5 -0
- package/assets/less/avatar.less +2 -2
- package/assets/less/message.less +6 -1
- package/assets/less/widget.less +1 -1
- package/assets/less/widget_header.less +2 -1
- package/compiled_src/bot.js +3 -18
- package/compiled_src/chatbox/Event.js +1 -1
- package/compiled_src/chatbox/Events.js +3 -1
- package/compiled_src/chatbox/Header.js +2 -2
- package/compiled_src/chatbox/QuickReplies.js +2 -1
- package/compiled_src/chatbox/Widget.js +2 -1
- package/compiled_src/lib.js +2 -1
- package/compiled_src/plugin.js +1 -0
- package/compiled_src/store/store.js +26 -18
- package/compiled_src/util/common.js +27 -14
- package/compiled_src/util/common.test.js +43 -133
- package/dist/132.js +21 -21
- package/dist/185.js +49 -49
- package/dist/{19bbfd5aa77.132.js → 19c2dd58182.132.js} +1 -1
- package/dist/19c2dd58182.185.js +1 -0
- package/dist/19c2dd58182.278.js +1 -0
- package/dist/19c2dd58182.339.js +1 -0
- package/dist/19c2dd58182.459.js +1 -0
- package/dist/19c2dd58182.app.js +1 -0
- package/dist/{19bbfd5aa77.chat.html → 19c2dd58182.chat.html} +1 -1
- package/dist/19c2dd58182.chat.js +1 -0
- package/dist/{19bbfd5aa77.form.html → 19c2dd58182.form.html} +1 -1
- package/dist/19c2dd58182.form.js +1 -0
- package/dist/{19bbfd5aa77.index.html → 19c2dd58182.index.html} +1 -1
- package/dist/{19bbfd5aa77.library.html → 19c2dd58182.library.html} +1 -1
- package/dist/19c2dd58182.library.js +1 -0
- package/dist/{19bbfd5aa77.preview.html → 19c2dd58182.preview.html} +1 -1
- package/dist/19c2dd58182.preview.js +1 -0
- package/dist/19c2dd58182.webview.js +1 -0
- package/dist/459.js +11 -11
- package/dist/74.js +1 -0
- package/dist/HASH +1 -1
- package/dist/assets/img/default_avatar.e449b04.png +0 -0
- package/dist/assets/img/default_logo.dd13a2b.svg +5 -0
- package/dist/screenshoot.js +3053 -3038
- package/package.json +13 -12
- package/src/bot.js +4 -14
- package/src/chatbox/Event.js +1 -1
- package/src/chatbox/Events.js +3 -2
- package/src/chatbox/Header.js +2 -2
- package/src/chatbox/QuickReplies.js +10 -10
- package/src/chatbox/Widget.js +3 -2
- package/src/lib.js +3 -1
- package/src/plugin.js +1 -0
- package/src/store/store.js +23 -13
- package/src/util/common.js +31 -16
- package/src/util/common.test.js +108 -193
- package/dist/19bbfd5aa77.185.js +0 -1
- package/dist/19bbfd5aa77.278.js +0 -1
- package/dist/19bbfd5aa77.339.js +0 -1
- package/dist/19bbfd5aa77.459.js +0 -1
- package/dist/19bbfd5aa77.app.js +0 -1
- package/dist/19bbfd5aa77.chat.js +0 -1
- package/dist/19bbfd5aa77.form.js +0 -1
- package/dist/19bbfd5aa77.library.js +0 -1
- package/dist/19bbfd5aa77.preview.js +0 -1
- package/dist/19bbfd5aa77.webview.js +0 -1
- package/dist/assets/img/default_avatar.5b74dc1.png +0 -0
- /package/dist/{19bbfd5aa77.127.js → 19c2dd58182.127.js} +0 -0
- /package/dist/{19bbfd5aa77.27.js → 19c2dd58182.27.js} +0 -0
- /package/dist/{19bbfd5aa77.490.js → 19c2dd58182.490.js} +0 -0
- /package/dist/{19bbfd5aa77.74.js → 19c2dd58182.74.js} +0 -0
- /package/dist/{19bbfd5aa77.997.js → 19c2dd58182.997.js} +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="200" height="200" fill="#002662"/>
|
|
3
|
+
<path d="M93 35C93 30.5817 96.5817 27 101 27H131C160.271 27 184 50.7289 184 80V200H93V35Z" fill="white" fill-opacity="0.1"/>
|
|
4
|
+
<path d="M22 147C22 119.386 44.3858 97 72 97H115C124.941 97 133 105.059 133 115V200H22V147Z" fill="white" fill-opacity="0.2"/>
|
|
5
|
+
</svg>
|
package/assets/less/avatar.less
CHANGED
package/assets/less/message.less
CHANGED
|
@@ -821,7 +821,7 @@ a.product_attachment__title {
|
|
|
821
821
|
z-index: 10;
|
|
822
822
|
|
|
823
823
|
&.ended {
|
|
824
|
-
bottom:
|
|
824
|
+
bottom: -10px;
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
|
|
@@ -1066,3 +1066,8 @@ a.product_attachment__title {
|
|
|
1066
1066
|
.file-attachment.just-focused {
|
|
1067
1067
|
box-shadow: 0 0 0 2px #000;
|
|
1068
1068
|
}
|
|
1069
|
+
|
|
1070
|
+
.widget_body_empty_img {
|
|
1071
|
+
max-width: 150px;
|
|
1072
|
+
max-height: 150px;
|
|
1073
|
+
}
|
package/assets/less/widget.less
CHANGED
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
.color(@text-color);
|
|
51
51
|
margin-top: 2.5px;
|
|
52
52
|
position: relative;
|
|
53
|
+
line-height: 1.5;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -84,7 +85,6 @@
|
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
.widget-header--description {
|
|
87
|
-
color: red;
|
|
88
88
|
position: relative; // for tooltip
|
|
89
89
|
text-align: center;
|
|
90
90
|
margin-top: 15px;
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
-webkit-box-orient: vertical;
|
|
94
94
|
-webkit-line-clamp: 2;
|
|
95
95
|
overflow: hidden;
|
|
96
|
+
line-height: 1.5;
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
|
package/compiled_src/bot.js
CHANGED
|
@@ -17,28 +17,13 @@ function _default(store) {
|
|
|
17
17
|
run = () => true;
|
|
18
18
|
let match = _index.default.checkRunConditions(bot.initiative_frequency, bot.conditions, store.matchLastBotRun(bot.id), store);
|
|
19
19
|
if (!match) return;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
let welcomMessages = bot.welcome_messages;
|
|
21
|
+
if (_index.default.size(welcomMessages)) {
|
|
22
22
|
let {
|
|
23
23
|
error
|
|
24
|
-
} = await store.startLightConvo(bot.id, bot.
|
|
25
|
-
if (error) return console.error(error);
|
|
24
|
+
} = await store.startLightConvo(bot.id, bot.welcome_messages, common.getLocale(bot, _index.default.detectLang()), false);
|
|
26
25
|
store.logBotRun(bot.id);
|
|
27
|
-
return;
|
|
28
26
|
}
|
|
29
|
-
let {
|
|
30
|
-
error
|
|
31
|
-
} = await store.startConvo({
|
|
32
|
-
initial_by: bot.id,
|
|
33
|
-
locale: common.getLocale(bot, _index.default.detectLang()),
|
|
34
|
-
state: 'active',
|
|
35
|
-
members: [{
|
|
36
|
-
type: 'bot',
|
|
37
|
-
id: bot.id
|
|
38
|
-
}]
|
|
39
|
-
});
|
|
40
|
-
if (error) return console.error(error);
|
|
41
|
-
store.logBotRun(bot.id);
|
|
42
27
|
};
|
|
43
28
|
let triggers = _index.default.get(bot, 'triggers') || [];
|
|
44
29
|
for (let tr of triggers) {
|
|
@@ -490,7 +490,7 @@ class Event extends _common.Com {
|
|
|
490
490
|
onClick: () => this.onSendReaction(hasDislike ? 'remove_dislike' : 'dislike')
|
|
491
491
|
}, (0, _preact.h)("div", {
|
|
492
492
|
class: "message-event-action-btn-svg dislike"
|
|
493
|
-
}))), _index.default.get(this.props.event, 'is_end') && (0, _preact.h)("div", {
|
|
493
|
+
}))), _index.default.get(this.props.event, 'is_end') && !this.props.isConvoEnded && (0, _preact.h)("div", {
|
|
494
494
|
class: "message-event-actions-static"
|
|
495
495
|
}, (0, _preact.h)("div", {
|
|
496
496
|
class: likecls,
|
|
@@ -151,7 +151,7 @@ class Events extends _common.Com {
|
|
|
151
151
|
processEvents(convo, events);
|
|
152
152
|
events.push(fakeev);
|
|
153
153
|
let $events = _index.default.map(events, ev => {
|
|
154
|
-
let isLast = ev.is_last_message_send;
|
|
154
|
+
let isLast = ev.is_last_message_send && _index.default.get(convo, 'state') !== 'ended';
|
|
155
155
|
return (0, _preact.h)(_Event.default, {
|
|
156
156
|
isLast: isLast,
|
|
157
157
|
chatbox: this.props.chatbox,
|
|
@@ -162,6 +162,7 @@ class Events extends _common.Com {
|
|
|
162
162
|
onPostback: this.props.onPostback,
|
|
163
163
|
onFocusSourceEventFromQuote: this.onFocusSourceEventFromQuote,
|
|
164
164
|
ref: ele => this.setEventChildRef(ele, ev.ev.id),
|
|
165
|
+
isConvoEnded: _index.default.get(convo, 'state') === 'ended',
|
|
165
166
|
event: ev,
|
|
166
167
|
t: this.props.t,
|
|
167
168
|
key: ev.ev.id
|
|
@@ -213,6 +214,7 @@ class Events extends _common.Com {
|
|
|
213
214
|
class: "widget-body--events-container widget-body--events-container__error"
|
|
214
215
|
}, (0, _preact.h)("img", {
|
|
215
216
|
alt: "empty",
|
|
217
|
+
class: "widget_body_empty_img",
|
|
216
218
|
src: convoemptyimg
|
|
217
219
|
}), (0, _preact.h)("div", {
|
|
218
220
|
class: "widget_body__events__error_msg"
|
|
@@ -26,7 +26,7 @@ class Header extends _common.Com {
|
|
|
26
26
|
width: 38,
|
|
27
27
|
height: 38,
|
|
28
28
|
class: "avatar avatar__account",
|
|
29
|
-
src: this.props.store.replaceFileUrl(logoUrl) || require('../../assets/img/
|
|
29
|
+
src: this.props.store.replaceFileUrl(logoUrl) || require('../../assets/img/default_logo.svg')
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -40,7 +40,7 @@ class Header extends _common.Com {
|
|
|
40
40
|
height: 38,
|
|
41
41
|
alt: acc.name,
|
|
42
42
|
class: "avatar avatar__account",
|
|
43
|
-
src: this.props.store.replaceFileUrl(logo_url) || require('../../assets/img/
|
|
43
|
+
src: this.props.store.replaceFileUrl(logo_url) || require('../../assets/img/default_logo.svg')
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
render() {
|
|
@@ -40,7 +40,8 @@ class QuickReplies extends _common.Com {
|
|
|
40
40
|
}
|
|
41
41
|
let $replies = _index.default.map(quickreplies, r => (0, _preact.h)("div", {
|
|
42
42
|
class: "message_quick_reply",
|
|
43
|
-
onClick: e => this.props.onSelect(r)
|
|
43
|
+
onClick: e => this.props.onSelect(r),
|
|
44
|
+
title: r.title
|
|
44
45
|
}, r.title));
|
|
45
46
|
return (0, _preact.h)("div", {
|
|
46
47
|
class: "message_quick_replies"
|
|
@@ -117,7 +117,7 @@ class Widget extends _common.Com {
|
|
|
117
117
|
id: botid,
|
|
118
118
|
bot_version: oldconvo.bot_version
|
|
119
119
|
}],
|
|
120
|
-
initial_by:
|
|
120
|
+
initial_by: botid,
|
|
121
121
|
is_testing: oldconvo.is_testing,
|
|
122
122
|
greeting_message: greeting_msg
|
|
123
123
|
});
|
|
@@ -815,6 +815,7 @@ class Widget extends _common.Com {
|
|
|
815
815
|
}, (0, _preact.h)("div", {
|
|
816
816
|
class: "empty-container"
|
|
817
817
|
}, (0, _preact.h)("img", {
|
|
818
|
+
class: "widget_body_empty_img",
|
|
818
819
|
alt: "empty",
|
|
819
820
|
src: empty
|
|
820
821
|
}), (0, _preact.h)("div", {
|
package/compiled_src/lib.js
CHANGED
|
@@ -77,6 +77,7 @@ class Widget {
|
|
|
77
77
|
let accid = param.account_id;
|
|
78
78
|
let ref = param.ref;
|
|
79
79
|
let user = await this.store.init(accid, undefined, ref, param);
|
|
80
|
+
if (this.store.isDead()) return user;
|
|
80
81
|
_index.default.setTimeout(() => window.postMessage({
|
|
81
82
|
type: 'widget_loaded',
|
|
82
83
|
account_id: accid
|
|
@@ -260,7 +261,7 @@ class Widget {
|
|
|
260
261
|
startConvo(req) {
|
|
261
262
|
req = _index.default.cloneDeep(req) || {};
|
|
262
263
|
if (req.welcome_message) {
|
|
263
|
-
return this.store.startLightConvo(req.bot_id, req.welcome_message, req.locale, req.is_testing, req.bot_version);
|
|
264
|
+
return this.store.startLightConvo(req.bot_id, [req.welcome_message], req.locale, req.is_testing, req.bot_version);
|
|
264
265
|
}
|
|
265
266
|
let members = req.members || [];
|
|
266
267
|
if (req.bot_id) {
|
package/compiled_src/plugin.js
CHANGED
|
@@ -17,6 +17,7 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
17
17
|
if (!$container) throw '$div must is a valid html node';
|
|
18
18
|
var $div = document.createElement('div');
|
|
19
19
|
$div.id = plugin.id;
|
|
20
|
+
if (store.isDead()) return;
|
|
20
21
|
let acc = store.matchAccount();
|
|
21
22
|
$div.setAttribute('sbz-plugin-type', plugin.type);
|
|
22
23
|
$div.setAttribute('sbz-plugin-account-id', acc.id);
|
|
@@ -744,7 +744,7 @@ class Store {
|
|
|
744
744
|
setting = _index.default.cloneDeep(setting) || {};
|
|
745
745
|
setting.account = Object.assign({}, setting.account, this.forceAcc);
|
|
746
746
|
if (!setting.account.logo_url) {
|
|
747
|
-
setting.account.logo_url = 'https://vcdn.subiz-cdn.com/
|
|
747
|
+
setting.account.logo_url = 'https://vcdn.subiz-cdn.com/widget-v4/public/assets/img/default_logo.dd13a2b.svg';
|
|
748
748
|
}
|
|
749
749
|
if (setting.user) {
|
|
750
750
|
setting.user.account_id = setting.account.id;
|
|
@@ -952,7 +952,7 @@ class Store {
|
|
|
952
952
|
delete this.lightConvos[id];
|
|
953
953
|
this.kv.put('light_convos', this.lightConvos);
|
|
954
954
|
}
|
|
955
|
-
startLightConvo(botid,
|
|
955
|
+
startLightConvo(botid, messages, locale, is_testing, botversion) {
|
|
956
956
|
let convoid = 'cslight' + botid + '_' + this.now();
|
|
957
957
|
let user = this.cache.match('user') || {};
|
|
958
958
|
let old = this.lightConvos[convoid];
|
|
@@ -960,26 +960,31 @@ class Store {
|
|
|
960
960
|
convo: old
|
|
961
961
|
};
|
|
962
962
|
let now = this.now();
|
|
963
|
-
let
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
963
|
+
let lastev = {};
|
|
964
|
+
let newevs = _index.default.map(messages, (message, idx) => {
|
|
965
|
+
let ev = {};
|
|
966
|
+
ev.created = now;
|
|
967
|
+
ev.event_time = now;
|
|
968
|
+
ev.id = 'evfake' + now + idx;
|
|
969
|
+
ev.type = 'message_sent';
|
|
970
|
+
ev.by = {
|
|
971
|
+
id: botid,
|
|
972
|
+
type: 'bot'
|
|
973
|
+
};
|
|
974
|
+
ev.data = {
|
|
975
|
+
message: message
|
|
976
|
+
};
|
|
977
|
+
ev.data.message.conversation_id = convoid;
|
|
978
|
+
lastev = ev;
|
|
979
|
+
return ev;
|
|
980
|
+
});
|
|
976
981
|
let newconvo = {
|
|
977
982
|
id: convoid,
|
|
978
983
|
locale: locale,
|
|
979
984
|
initial_by: botid,
|
|
980
985
|
created: now,
|
|
981
986
|
actived: now,
|
|
982
|
-
last_message_sent:
|
|
987
|
+
last_message_sent: lastev,
|
|
983
988
|
members: [{
|
|
984
989
|
type: 'user',
|
|
985
990
|
id: user.id
|
|
@@ -995,13 +1000,13 @@ class Store {
|
|
|
995
1000
|
source: 'web'
|
|
996
1001
|
},
|
|
997
1002
|
traffic_source: 'direct',
|
|
998
|
-
events:
|
|
1003
|
+
events: newevs,
|
|
999
1004
|
is_testing: is_testing,
|
|
1000
1005
|
bot_versio: botversion
|
|
1001
1006
|
};
|
|
1002
1007
|
this.lightConvos[convoid] = newconvo;
|
|
1003
1008
|
this.kv.put('light_convos', this.lightConvos);
|
|
1004
|
-
this.pubsub.publish('events',
|
|
1009
|
+
this.pubsub.publish('events', lastev);
|
|
1005
1010
|
return {
|
|
1006
1011
|
convo: newconvo
|
|
1007
1012
|
};
|
|
@@ -1277,6 +1282,9 @@ class Store {
|
|
|
1277
1282
|
if (this.cache) this.cache.destroy();
|
|
1278
1283
|
this.pubsub.publish('destroy');
|
|
1279
1284
|
}
|
|
1285
|
+
isDead() {
|
|
1286
|
+
return this._die;
|
|
1287
|
+
}
|
|
1280
1288
|
destroy() {
|
|
1281
1289
|
this._die = true;
|
|
1282
1290
|
this.clearBrowserData();
|
|
@@ -7,6 +7,7 @@ exports.XMLHttpRequest = exports.Date = exports.DEF_CHAT_BUTTON_BACKGROUND_IMAGE
|
|
|
7
7
|
exports.agentsOfConvo = agentsOfConvo;
|
|
8
8
|
exports.blockToText = blockToText;
|
|
9
9
|
exports.checkRunConditions = checkRunConditions;
|
|
10
|
+
exports.checkUrlCondition = checkUrlCondition;
|
|
10
11
|
exports.clearTimeout = exports.clearInterval = void 0;
|
|
11
12
|
exports.cloneDeep = cloneDeep;
|
|
12
13
|
exports.convoOfEv = convoOfEv;
|
|
@@ -832,20 +833,7 @@ function checkRunConditions(freq, conds, lastrun, store) {
|
|
|
832
833
|
var cond = conds[i];
|
|
833
834
|
switch (cond.key) {
|
|
834
835
|
case 'url':
|
|
835
|
-
|
|
836
|
-
if (size(exclude_urls) > 0) {
|
|
837
|
-
let found = find(exclude_urls, url => {
|
|
838
|
-
return norm(window.location.href).indexOf(norm(url)) > -1;
|
|
839
|
-
});
|
|
840
|
-
if (found) return false;
|
|
841
|
-
}
|
|
842
|
-
let urls = filter(cond.urls, url => norm(url));
|
|
843
|
-
if (size(urls) > 0) {
|
|
844
|
-
let found = find(urls, url => {
|
|
845
|
-
return norm(window.location.href).indexOf(norm(url)) > -1;
|
|
846
|
-
});
|
|
847
|
-
if (!found) return false;
|
|
848
|
-
}
|
|
836
|
+
if (!checkUrlCondition(cond, window.location.href)) return false;
|
|
849
837
|
break;
|
|
850
838
|
case 'url_path':
|
|
851
839
|
let excludePaths = filter(cond.exclude_url_paths, url => norm(url));
|
|
@@ -1343,4 +1331,29 @@ function isEmptyAttachment(msg) {
|
|
|
1343
1331
|
}
|
|
1344
1332
|
return true;
|
|
1345
1333
|
})) == 0;
|
|
1334
|
+
}
|
|
1335
|
+
function checkUrlCondition(cond, href) {
|
|
1336
|
+
let exclude_urls = filter(cond.exclude_urls, url => norm(url));
|
|
1337
|
+
let foundExclude = false;
|
|
1338
|
+
let excludeLen = 0;
|
|
1339
|
+
map(exclude_urls, url => {
|
|
1340
|
+
if (norm(href).indexOf(url) > -1) {
|
|
1341
|
+
if (excludeLen < size(url)) excludeLen = size(url);
|
|
1342
|
+
foundExclude = true;
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
let includeLen = 0;
|
|
1346
|
+
let urls = filter(cond.urls, url => norm(url));
|
|
1347
|
+
let foundInclude = size(urls) == 0;
|
|
1348
|
+
map(urls, url => {
|
|
1349
|
+
if (norm(href).indexOf(url) > -1) {
|
|
1350
|
+
if (includeLen < size(url)) includeLen = size(url);
|
|
1351
|
+
foundInclude = true;
|
|
1352
|
+
}
|
|
1353
|
+
});
|
|
1354
|
+
if (foundExclude) {
|
|
1355
|
+
if (excludeLen >= includeLen) return false;
|
|
1356
|
+
}
|
|
1357
|
+
if (!foundInclude) return false;
|
|
1358
|
+
return true;
|
|
1346
1359
|
}
|
|
@@ -1,137 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
text: 'sent an email'
|
|
29
|
-
}, {
|
|
30
|
-
desc: 'empty msg',
|
|
31
|
-
event: {},
|
|
32
|
-
text: ''
|
|
33
|
-
}, {
|
|
34
|
-
desc: 'markdown',
|
|
35
|
-
event: {
|
|
36
|
-
type: 'message_sent',
|
|
37
|
-
data: {
|
|
38
|
-
message: {
|
|
39
|
-
format: 'markdown',
|
|
40
|
-
text: 'xin chao'
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
text: 'sent a message'
|
|
45
|
-
}, {
|
|
46
|
-
desc: 'html',
|
|
47
|
-
event: {
|
|
48
|
-
type: 'message_sent',
|
|
49
|
-
data: {
|
|
50
|
-
message: {
|
|
51
|
-
format: 'html',
|
|
52
|
-
text: '<b>xin chao</b>'
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
text: 'sent a message'
|
|
57
|
-
}, {
|
|
58
|
-
desc: 'multiple attachemnts',
|
|
59
|
-
event: {
|
|
60
|
-
type: 'message_sent',
|
|
61
|
-
data: {
|
|
62
|
-
message: {
|
|
63
|
-
attachments: [{}, {}, {}]
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
text: 'sent a message with 3 attachments'
|
|
68
|
-
}, {
|
|
69
|
-
desc: 'text with attachment',
|
|
70
|
-
event: {
|
|
71
|
-
type: 'message_sent',
|
|
72
|
-
data: {
|
|
73
|
-
message: {
|
|
74
|
-
type: 'text',
|
|
75
|
-
text: 'xin chao',
|
|
76
|
-
attachments: [{}]
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
text: 'sent a message with 1 attachments'
|
|
81
|
-
}, {
|
|
82
|
-
desc: '1 attachment no type',
|
|
83
|
-
event: {
|
|
84
|
-
type: 'message_sent',
|
|
85
|
-
data: {
|
|
86
|
-
message: {
|
|
87
|
-
attachments: [{}]
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
text: 'sent an attachment'
|
|
92
|
-
}, {
|
|
93
|
-
desc: 'audio ',
|
|
94
|
-
event: {
|
|
95
|
-
type: 'message_sent',
|
|
96
|
-
data: {
|
|
97
|
-
message: {
|
|
98
|
-
attachments: [{
|
|
99
|
-
mimetype: 'audio/mp3'
|
|
100
|
-
}]
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
text: 'sent an audio'
|
|
105
|
-
}, {
|
|
106
|
-
desc: 'video',
|
|
107
|
-
event: {
|
|
108
|
-
type: 'message_sent',
|
|
109
|
-
data: {
|
|
110
|
-
message: {
|
|
111
|
-
attachments: [{
|
|
112
|
-
mimetype: 'video/ogg'
|
|
113
|
-
}]
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
text: 'sent a video'
|
|
118
|
-
}, {
|
|
119
|
-
desc: 'image',
|
|
120
|
-
event: {
|
|
121
|
-
type: 'message_sent',
|
|
122
|
-
data: {
|
|
123
|
-
message: {
|
|
124
|
-
attachments: [{
|
|
125
|
-
mimetype: 'image/jpeg'
|
|
126
|
-
}]
|
|
127
|
-
}
|
|
3
|
+
var _module = require("module");
|
|
4
|
+
const _require = (0, _module.createRequire)(import.meta.url);
|
|
5
|
+
global.require = _require;
|
|
6
|
+
global.XMLHttpRequest = {
|
|
7
|
+
prototype: {
|
|
8
|
+
open: function () {}
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
global.document = {
|
|
12
|
+
JSON: JSON,
|
|
13
|
+
body: {
|
|
14
|
+
appendChild: function () {}
|
|
15
|
+
},
|
|
16
|
+
documentElement: {
|
|
17
|
+
appendChild: function () {}
|
|
18
|
+
},
|
|
19
|
+
createElement: function () {
|
|
20
|
+
return {
|
|
21
|
+
contentWindow: global,
|
|
22
|
+
contentDocument: global.document,
|
|
23
|
+
style: {
|
|
24
|
+
display: false
|
|
128
25
|
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const test = _require('tape');
|
|
30
|
+
const util = _require('./common.js');
|
|
31
|
+
test('util.checkUrlCondition', t => {
|
|
32
|
+
var tcs = [{
|
|
33
|
+
name: 'minvoice',
|
|
34
|
+
cond: {
|
|
35
|
+
key: 'url',
|
|
36
|
+
urls: ['qlhd.minvoice.com.vn'],
|
|
37
|
+
exclude_urls: ['minvoice.com.vn', 'minvoice.net', 'hdt.minvoice.com.vn']
|
|
129
38
|
},
|
|
130
|
-
|
|
39
|
+
href: 'https://qlhd.minvoice.com.vn/#/login',
|
|
40
|
+
pass: true
|
|
131
41
|
}];
|
|
132
42
|
tcs.map(tc => {
|
|
133
|
-
var out = util.
|
|
134
|
-
t.equal(out, tc.
|
|
43
|
+
var out = util.checkUrlCondition(tc.cond, tc.href);
|
|
44
|
+
t.equal(out, tc.pass);
|
|
135
45
|
});
|
|
136
46
|
t.end();
|
|
137
47
|
});
|
|
@@ -361,17 +271,17 @@ test('test insert message', t => {
|
|
|
361
271
|
});
|
|
362
272
|
test('mapizeDeep a map', t => {
|
|
363
273
|
var topicM = {
|
|
364
|
-
|
|
274
|
+
0: {
|
|
365
275
|
topic: 'account.acqcsmrppbftadjzxnvo.conversation.csqlxnairroppcktrg',
|
|
366
276
|
read: false,
|
|
367
277
|
updated: 1570586074000
|
|
368
278
|
},
|
|
369
|
-
|
|
279
|
+
1: {
|
|
370
280
|
topic: 'account.acqcsmrppbftadjzxnvo.conversation.csqlxmkozwryrgjvag',
|
|
371
281
|
read: false,
|
|
372
282
|
updated: 1570551305000
|
|
373
283
|
},
|
|
374
|
-
|
|
284
|
+
2: {
|
|
375
285
|
topic: 'account.acqcsmrppbftadjzxnvo.conversation.csqlvkqgspihkfzsnm',
|
|
376
286
|
read: false,
|
|
377
287
|
updated: 1570289320000
|
|
@@ -400,11 +310,11 @@ test('mapizeDeep a map', t => {
|
|
|
400
310
|
});
|
|
401
311
|
test('mapize a map', t => {
|
|
402
312
|
var topicM = {
|
|
403
|
-
|
|
313
|
+
0: {
|
|
404
314
|
topic: 't1',
|
|
405
315
|
updated: 157
|
|
406
316
|
},
|
|
407
|
-
|
|
317
|
+
1: {
|
|
408
318
|
topic: 't2',
|
|
409
319
|
updated: 158
|
|
410
320
|
}
|
package/dist/132.js
CHANGED
|
@@ -2509,27 +2509,6 @@ class Popup extends common/* Com */.Mw {
|
|
|
2509
2509
|
|
|
2510
2510
|
/***/ },
|
|
2511
2511
|
|
|
2512
|
-
/***/ 2931
|
|
2513
|
-
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2514
|
-
|
|
2515
|
-
module.exports = __webpack_require__.p + "assets/img/Zalo.6845707.png";
|
|
2516
|
-
|
|
2517
|
-
/***/ },
|
|
2518
|
-
|
|
2519
|
-
/***/ 4707
|
|
2520
|
-
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2521
|
-
|
|
2522
|
-
module.exports = __webpack_require__.p + "assets/img/Facebook.64607ec.png";
|
|
2523
|
-
|
|
2524
|
-
/***/ },
|
|
2525
|
-
|
|
2526
|
-
/***/ 8271
|
|
2527
|
-
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2528
|
-
|
|
2529
|
-
module.exports = __webpack_require__.p + "assets/img/fb_inverse_circle.36c2cfc.png";
|
|
2530
|
-
|
|
2531
|
-
/***/ },
|
|
2532
|
-
|
|
2533
2512
|
/***/ 9459
|
|
2534
2513
|
(module) {
|
|
2535
2514
|
|
|
@@ -2797,6 +2776,27 @@ module.exports = function () {
|
|
|
2797
2776
|
return module.exports;
|
|
2798
2777
|
}();
|
|
2799
2778
|
|
|
2779
|
+
/***/ },
|
|
2780
|
+
|
|
2781
|
+
/***/ 4707
|
|
2782
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2783
|
+
|
|
2784
|
+
module.exports = __webpack_require__.p + "assets/img/Facebook.64607ec.png";
|
|
2785
|
+
|
|
2786
|
+
/***/ },
|
|
2787
|
+
|
|
2788
|
+
/***/ 2931
|
|
2789
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2790
|
+
|
|
2791
|
+
module.exports = __webpack_require__.p + "assets/img/Zalo.6845707.png";
|
|
2792
|
+
|
|
2793
|
+
/***/ },
|
|
2794
|
+
|
|
2795
|
+
/***/ 8271
|
|
2796
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2797
|
+
|
|
2798
|
+
module.exports = __webpack_require__.p + "assets/img/fb_inverse_circle.36c2cfc.png";
|
|
2799
|
+
|
|
2800
2800
|
/***/ }
|
|
2801
2801
|
|
|
2802
2802
|
}]);
|