@subiz/widget-v4 4.1.172 → 4.1.173
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/chat.js +18 -1
- package/compiled_src/lib.js +3 -0
- package/compiled_src/store/api.js +4 -1
- package/compiled_src/store/store.js +8 -1
- package/compiled_src/util/common.js +1 -1
- package/dist/198c50be7a7.app.js +1 -0
- package/dist/{198b082f7d0.chat.html → 198c50be7a7.chat.html} +1 -1
- package/dist/198c50be7a7.chat.js +1 -0
- package/dist/{198b082f7d0.form.html → 198c50be7a7.form.html} +1 -1
- package/dist/198c50be7a7.form.js +1 -0
- package/dist/{198b082f7d0.index.html → 198c50be7a7.index.html} +1 -1
- package/dist/{198b082f7d0.library.html → 198c50be7a7.library.html} +1 -1
- package/dist/198c50be7a7.library.js +1 -0
- package/dist/{198b082f7d0.preview.html → 198c50be7a7.preview.html} +1 -1
- package/dist/198c50be7a7.preview.js +1 -0
- package/dist/{198b082f7d0.chat.js → 198c50be7a7.webview.js} +1 -1
- package/dist/HASH +1 -1
- package/dist/screenshoot.js +41 -16
- package/package.json +1 -1
- package/src/lib.js +4 -0
- package/src/store/api.js +4 -1
- package/src/store/store.js +8 -1
- package/src/util/common.js +1 -1
- package/dist/198b082f7d0.app.js +0 -1
- package/dist/198b082f7d0.form.js +0 -1
- package/dist/198b082f7d0.library.js +0 -1
- package/dist/198b082f7d0.preview.js +0 -1
- package/dist/198b082f7d0.webview.js +0 -1
- /package/dist/{198b082f7d0.127.js → 198c50be7a7.127.js} +0 -0
- /package/dist/{198b082f7d0.132.js → 198c50be7a7.132.js} +0 -0
- /package/dist/{198b082f7d0.185.js → 198c50be7a7.185.js} +0 -0
- /package/dist/{198b082f7d0.27.js → 198c50be7a7.27.js} +0 -0
- /package/dist/{198b082f7d0.278.js → 198c50be7a7.278.js} +0 -0
- /package/dist/{198b082f7d0.339.js → 198c50be7a7.339.js} +0 -0
- /package/dist/{198b082f7d0.459.js → 198c50be7a7.459.js} +0 -0
- /package/dist/{198b082f7d0.490.js → 198c50be7a7.490.js} +0 -0
- /package/dist/{198b082f7d0.74.js → 198c50be7a7.74.js} +0 -0
- /package/dist/{198b082f7d0.997.js → 198c50be7a7.997.js} +0 -0
package/dist/HASH
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
198c50be7a7
|
package/dist/screenshoot.js
CHANGED
|
@@ -2470,7 +2470,7 @@ XMLHttpRequest.prototype.send = function (body) {
|
|
|
2470
2470
|
response: this.responseText
|
|
2471
2471
|
});
|
|
2472
2472
|
}
|
|
2473
|
-
old(a, b, c);
|
|
2473
|
+
if (typeof old == 'function') old(a, b, c);
|
|
2474
2474
|
};
|
|
2475
2475
|
return _originalSend.apply(this, arguments);
|
|
2476
2476
|
};
|
|
@@ -3896,8 +3896,11 @@ function jsonifyTextPlain(param, done) {
|
|
|
3896
3896
|
_defineProperty(this, "time", _ => ajax.setBaseUrl(this.ApiURL).withCredentials(true).setParser('json').get('/time'));
|
|
3897
3897
|
_defineProperty(this, "updateUser", data => this.apireq.post(`/accounts/${this.accid}/users/${this.uid}`, data));
|
|
3898
3898
|
_defineProperty(this, "getUser", _ => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}`));
|
|
3899
|
-
_defineProperty(this, "getAccountSetting",
|
|
3899
|
+
_defineProperty(this, "getAccountSetting", p => {
|
|
3900
3900
|
let href = util/* default */.A.get(document, 'location.href');
|
|
3901
|
+
if (p && p.bot_id) {
|
|
3902
|
+
return this.apireq.addQuery('url', href).addQuery('bot_id', p.bot_id).get(`/accounts/${this.accid}/settings`);
|
|
3903
|
+
}
|
|
3901
3904
|
return this.apireq.addQuery('url', href).get(`/accounts/${this.accid}/settings`);
|
|
3902
3905
|
});
|
|
3903
3906
|
_defineProperty(this, "sendImpression", impression => this.apireq.post(`/accounts/${this.accid}/campaigns/${impression.campaign_id}/impressions`, impression));
|
|
@@ -5187,6 +5190,10 @@ class Store {
|
|
|
5187
5190
|
await this.readyGate.entry();
|
|
5188
5191
|
this.reconnect();
|
|
5189
5192
|
}
|
|
5193
|
+
async overrideBotId(botid) {
|
|
5194
|
+
this.forceBotId = botid;
|
|
5195
|
+
await this.readyGate.entry();
|
|
5196
|
+
}
|
|
5190
5197
|
async overrideChatbox(chatbox) {
|
|
5191
5198
|
this.forceChatbox = chatbox;
|
|
5192
5199
|
await this.readyGate.entry();
|
|
@@ -5431,7 +5438,9 @@ class Store {
|
|
|
5431
5438
|
let fetchuser = p && p.user ? Promise.resolve({
|
|
5432
5439
|
body: p.user
|
|
5433
5440
|
}) : this.api.getUser();
|
|
5434
|
-
let outs = await Promise.all([fetchuser, this.api.getAccountSetting(
|
|
5441
|
+
let outs = await Promise.all([fetchuser, this.api.getAccountSetting({
|
|
5442
|
+
bot_id: this.forceBotId
|
|
5443
|
+
})]);
|
|
5435
5444
|
let error = util/* default */.A.find(outs, out => out.error);
|
|
5436
5445
|
if (error) return console.error(error);
|
|
5437
5446
|
let set = outs[1].body;
|
|
@@ -5670,17 +5679,17 @@ class Store {
|
|
|
5670
5679
|
this.chain.put(cid, oldev.id, util/* default */.A.getMs(oldev.created), oldev);
|
|
5671
5680
|
this.pubsub.publish('events', oldev);
|
|
5672
5681
|
}
|
|
5673
|
-
if (ev.type === 'message_sent') {
|
|
5674
|
-
let idemkey = util/* default */.A.get(ev, 'data.message.idempotency_key');
|
|
5675
|
-
let found = util/* default */.A.find(this.listEvents(cid), oldev => oldev.id === idemkey);
|
|
5676
|
-
if (found) {
|
|
5677
|
-
this.chain.del(cid, found.id);
|
|
5678
|
-
ev.created = found.created;
|
|
5679
|
-
}
|
|
5680
|
-
convo.last_message_sent = ev;
|
|
5681
|
-
}
|
|
5682
5682
|
if (ev.type !== 'message_pong' && ev.type !== 'conversation_typing') {
|
|
5683
5683
|
this.chain.put(cid, ev.id, util/* default */.A.getMs(ev.created), ev);
|
|
5684
|
+
if (ev.type === 'message_sent') {
|
|
5685
|
+
let idemkey = util/* default */.A.get(ev, 'data.message.idempotency_key');
|
|
5686
|
+
let found = util/* default */.A.find(this.listEvents(cid), oldev => oldev.id === idemkey);
|
|
5687
|
+
if (found) {
|
|
5688
|
+
this.chain.del(cid, found.id);
|
|
5689
|
+
ev.created = found.created;
|
|
5690
|
+
}
|
|
5691
|
+
convo.last_message_sent = ev;
|
|
5692
|
+
}
|
|
5684
5693
|
}
|
|
5685
5694
|
this._setConvo(convo);
|
|
5686
5695
|
this.pubsub.publish('account');
|
|
@@ -6009,7 +6018,9 @@ class Store {
|
|
|
6009
6018
|
src = src.replace('http://file.subiz.com/', this.FileURL);
|
|
6010
6019
|
src = src.replace('https://file.mysubiz.com/', this.FileURL);
|
|
6011
6020
|
src = src.replace('http://file.mysubiz.com/', this.FileURL);
|
|
6012
|
-
return src
|
|
6021
|
+
return src;
|
|
6022
|
+
// removed by dead control flow
|
|
6023
|
+
{}
|
|
6013
6024
|
}
|
|
6014
6025
|
clearBrowserData() {
|
|
6015
6026
|
util/* default */.A.each(this.cookie.all(), (v, k) => {
|
|
@@ -6463,6 +6474,7 @@ class ChatButton extends common/* Com */.Mw {
|
|
|
6463
6474
|
this._buttonLoaded = true;
|
|
6464
6475
|
}
|
|
6465
6476
|
renderButton() {
|
|
6477
|
+
if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_button = util/* default */.A.Date.now();
|
|
6466
6478
|
let accountSetting = this.props.plugin.chatbox;
|
|
6467
6479
|
accountSetting = this.fixMissingSetting(accountSetting);
|
|
6468
6480
|
let imgsrc = util/* default */.A.get(accountSetting, 'desktop_button.background_image_url') || util/* default */.A.get(accountSetting, 'desktop_button.background_mask_url') || defaultBubble;
|
|
@@ -11139,9 +11151,19 @@ class Main extends common/* Com */.Mw {
|
|
|
11139
11151
|
}
|
|
11140
11152
|
}
|
|
11141
11153
|
render() {
|
|
11142
|
-
if (!this.state.cssready)
|
|
11143
|
-
|
|
11144
|
-
|
|
11154
|
+
if (!this.state.cssready) {
|
|
11155
|
+
if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_css_not_ready = util/* default */.A.Date.now();
|
|
11156
|
+
return null;
|
|
11157
|
+
}
|
|
11158
|
+
if (util/* default */.A.isUserBanned(this.props.store.matchUser())) {
|
|
11159
|
+
if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_user_is_banned = util/* default */.A.Date.now();
|
|
11160
|
+
return null;
|
|
11161
|
+
}
|
|
11162
|
+
if (!this.props.t) {
|
|
11163
|
+
if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_no_t = util/* default */.A.Date.now();
|
|
11164
|
+
return null;
|
|
11165
|
+
}
|
|
11166
|
+
if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_main = util/* default */.A.Date.now();
|
|
11145
11167
|
return (0,preact_module.h)("div", {
|
|
11146
11168
|
class: this.props.store.isMobile() ? 'mobile' : 'desktop'
|
|
11147
11169
|
}, (0,preact_module.h)(ChatButton, {
|
|
@@ -11650,6 +11672,9 @@ class lib_Widget {
|
|
|
11650
11672
|
logout(userref) {
|
|
11651
11673
|
return this.store.logout(userref);
|
|
11652
11674
|
}
|
|
11675
|
+
overrideBotId(botid) {
|
|
11676
|
+
this.store.overrideBotId(botid);
|
|
11677
|
+
}
|
|
11653
11678
|
async init(param, $container) {
|
|
11654
11679
|
param = param || {};
|
|
11655
11680
|
let accid = param.account_id;
|
package/package.json
CHANGED
package/src/lib.js
CHANGED
package/src/store/api.js
CHANGED
|
@@ -357,8 +357,11 @@ export default class {
|
|
|
357
357
|
updateUser = (data) => this.apireq.post(`/accounts/${this.accid}/users/${this.uid}`, data)
|
|
358
358
|
|
|
359
359
|
getUser = (_) => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}`)
|
|
360
|
-
getAccountSetting = () => {
|
|
360
|
+
getAccountSetting = (p) => {
|
|
361
361
|
let href = sb.get(document, 'location.href') // send full href, this could be used to select which bot (ai-agent) should be returned
|
|
362
|
+
if (p && p.bot_id) {
|
|
363
|
+
return this.apireq.addQuery('url', href).addQuery('bot_id', p.bot_id).get(`/accounts/${this.accid}/settings`)
|
|
364
|
+
}
|
|
362
365
|
return this.apireq.addQuery('url', href).get(`/accounts/${this.accid}/settings`)
|
|
363
366
|
}
|
|
364
367
|
|
package/src/store/store.js
CHANGED
|
@@ -220,6 +220,12 @@ export default class Store {
|
|
|
220
220
|
this.reconnect()
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
async overrideBotId(botid) {
|
|
224
|
+
this.forceBotId = botid
|
|
225
|
+
await this.readyGate.entry()
|
|
226
|
+
//this.reconnect()
|
|
227
|
+
}
|
|
228
|
+
|
|
223
229
|
async overrideChatbox(chatbox) {
|
|
224
230
|
this.forceChatbox = chatbox
|
|
225
231
|
await this.readyGate.entry()
|
|
@@ -689,7 +695,7 @@ export default class Store {
|
|
|
689
695
|
this.markSync('account')
|
|
690
696
|
|
|
691
697
|
let fetchuser = p && p.user ? Promise.resolve({body: p.user}) : this.api.getUser()
|
|
692
|
-
let outs = await Promise.all([fetchuser, this.api.getAccountSetting()])
|
|
698
|
+
let outs = await Promise.all([fetchuser, this.api.getAccountSetting({bot_id: this.forceBotId})])
|
|
693
699
|
|
|
694
700
|
let error = sb.find(outs, (out) => out.error)
|
|
695
701
|
if (error) return console.error(error)
|
|
@@ -1343,6 +1349,7 @@ export default class Store {
|
|
|
1343
1349
|
|
|
1344
1350
|
src = src.replace('https://file.mysubiz.com/', this.FileURL)
|
|
1345
1351
|
src = src.replace('http://file.mysubiz.com/', this.FileURL)
|
|
1352
|
+
return src
|
|
1346
1353
|
return src.replace('vcdn.subiz-cdn.com', 'cdn.subiz.net')
|
|
1347
1354
|
}
|
|
1348
1355
|
|
package/src/util/common.js
CHANGED