@subiz/widget-v4 4.1.71 → 4.1.73
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/app.js +0 -42
- package/assets/less/widget.less +6 -5
- package/assets/less/widget_header.less +5 -3
- package/compiled_src/chatbox/AudioAttachments.js +25 -32
- package/compiled_src/chatbox/Event.js +19 -3
- package/compiled_src/chatbox/InfoMessage.js +2 -1
- package/compiled_src/chatbox/OrderAttachments.js +102 -6
- package/compiled_src/chatbox/PoweredBy.js +20 -27
- package/compiled_src/chatbox/TextMessage.js +0 -14
- package/compiled_src/chatbox/VideoAttachments.js +1 -0
- package/compiled_src/chatbox/Widget.js +21 -21
- package/compiled_src/chatbox/time.js +46 -28
- package/compiled_src/lib.js +2 -2
- package/compiled_src/order/icon.js +2 -2
- package/compiled_src/order/index.js +2 -2
- package/compiled_src/plugin.js +2 -4
- package/compiled_src/store/api.js +1 -16
- package/compiled_src/store/store.js +2 -5
- package/compiled_src/util/common.js +12 -494
- package/compiled_src/util/index.js +0 -2
- package/dist/127.js +273 -0
- package/dist/132.js +2 -2
- package/dist/185.js +1885 -0
- package/dist/18eaf7ad0c6.127.js +1 -0
- package/dist/{18e74ca84ff.132.js → 18eaf7ad0c6.132.js} +1 -1
- package/dist/18eaf7ad0c6.185.js +1 -0
- package/dist/18eaf7ad0c6.278.js +1 -0
- package/dist/{18e74ca84ff.490.js → 18eaf7ad0c6.490.js} +1 -1
- package/dist/{18e74ca84ff.74.js → 18eaf7ad0c6.74.js} +1 -1
- package/dist/18eaf7ad0c6.app.js +1 -0
- package/dist/{18e74ca84ff.index.html → 18eaf7ad0c6.index.html} +1 -1
- package/dist/{18e74ca84ff.library.html → 18eaf7ad0c6.library.html} +1 -1
- package/dist/18eaf7ad0c6.library.js +1 -0
- package/dist/{18e74ca84ff.preview.html → 18eaf7ad0c6.preview.html} +1 -1
- package/dist/18eaf7ad0c6.preview.js +1 -0
- package/dist/18eaf7ad0c6.screenshoot.js +1 -0
- package/dist/18eaf7ad0c6.webview.js +1 -0
- package/dist/18ed1c3d33e.127.js +1 -0
- package/dist/18ed1c3d33e.132.js +1 -0
- package/dist/18ed1c3d33e.185.js +1 -0
- package/dist/18ed1c3d33e.27.js +1 -0
- package/dist/18ed1c3d33e.278.js +1 -0
- package/dist/18ed1c3d33e.459.js +1 -0
- package/dist/18ed1c3d33e.490.js +1 -0
- package/dist/18ed1c3d33e.74.js +1 -0
- package/dist/18ed1c3d33e.997.js +1 -0
- package/dist/18ed1c3d33e.app.js +1 -0
- package/dist/18ed1c3d33e.index.html +33 -0
- package/dist/18ed1c3d33e.library.html +33 -0
- package/dist/18ed1c3d33e.library.js +1 -0
- package/dist/18ed1c3d33e.preview.html +759 -0
- package/dist/18ed1c3d33e.preview.js +1 -0
- package/dist/18ed1c3d33e.screenshoot.js +1 -0
- package/dist/18ed1c3d33e.webview.js +1 -0
- package/dist/278.js +1 -1
- package/dist/490.js +1 -1
- package/dist/74.js +1 -1
- package/dist/HASH +1 -1
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +4740 -627
- package/inject.js +3 -3
- package/package.json +6 -6
- package/src/chatbox/AudioAttachments.js +19 -26
- package/src/chatbox/Event.js +22 -3
- package/src/chatbox/InfoMessage.js +11 -11
- package/src/chatbox/OrderAttachments.js +118 -5
- package/src/chatbox/PoweredBy.js +14 -22
- package/src/chatbox/TextMessage.js +0 -14
- package/src/chatbox/VideoAttachments.js +1 -1
- package/src/chatbox/Widget.js +16 -20
- package/src/chatbox/time.js +54 -24
- package/src/lib.js +2 -2
- package/src/order/icon.js +2 -2
- package/src/order/index.js +2 -2
- package/src/plugin.js +4 -3
- package/src/store/api.js +1 -14
- package/src/store/store.js +3 -11
- package/src/util/common.js +13 -215
- package/src/util/index.js +0 -3
- package/compiled_src/util/order.js +0 -112
- package/dist/18e74ca84ff.278.js +0 -1
- package/dist/18e74ca84ff.497.js +0 -1
- package/dist/18e74ca84ff.app.js +0 -1
- package/dist/18e74ca84ff.library.js +0 -1
- package/dist/18e74ca84ff.preview.js +0 -1
- package/dist/18e74ca84ff.screenshoot.js +0 -1
- package/dist/18e74ca84ff.webview.js +0 -1
- package/dist/497.js +0 -6721
- package/src/util/order.js +0 -120
- /package/dist/{18e74ca84ff.27.js → 18eaf7ad0c6.27.js} +0 -0
- /package/dist/{18e74ca84ff.459.js → 18eaf7ad0c6.459.js} +0 -0
- /package/dist/{18e74ca84ff.997.js → 18eaf7ad0c6.997.js} +0 -0
|
@@ -20,21 +20,16 @@ class Time extends _common.Com {
|
|
|
20
20
|
}
|
|
21
21
|
updateTime() {
|
|
22
22
|
var t = '';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
let tzyear = tim.getFullYear();
|
|
28
|
-
let locale = _index.default.get(navigator, 'languages.0', 'en-US');
|
|
29
|
-
let tzmonthname = tim.toLocaleDateString(locale, {
|
|
30
|
-
month: 'short'
|
|
31
|
-
});
|
|
32
|
-
let tzdate = tim.getDate();
|
|
33
|
-
t = tzdate + ' ' + tzmonthname + ' ' + tzyear;
|
|
34
|
-
}
|
|
23
|
+
let forceLocale = '';
|
|
24
|
+
if (this.props.t) {
|
|
25
|
+
if (this.props.t.locale && typeof this.props.t.locale === 'function') {
|
|
26
|
+
forceLocale = this.props.t.locale();
|
|
35
27
|
}
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
}
|
|
29
|
+
if (this.props.ago) {
|
|
30
|
+
if (this.props.short) {}
|
|
31
|
+
if (!t && this.props.time > 0) t = ago(this.props.time, new _index.default.Date().getTime(), this.props.t);
|
|
32
|
+
} else t = _index.default.shortTime(this.props.time, this.props.tzoffset, Date.now(), forceLocale);
|
|
38
33
|
if (this.props.uppercase) t = t.toUpperCase();
|
|
39
34
|
if (t === this.state.t) return;
|
|
40
35
|
this.setState({
|
|
@@ -46,26 +41,49 @@ class Time extends _common.Com {
|
|
|
46
41
|
this.updateTime();
|
|
47
42
|
}
|
|
48
43
|
render() {
|
|
44
|
+
let locale = _index.default.get(navigator, 'languages.0', 'en-US');
|
|
45
|
+
if (this.props.t) {
|
|
46
|
+
if (this.props.t.locale && typeof this.props.t.locale === 'function') {
|
|
47
|
+
locale = this.props.t.locale();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
let title = new Date(this.props.time).toLocaleString(locale);
|
|
49
51
|
return (0, _preact.h)("span", {
|
|
50
|
-
style: this.props.style
|
|
52
|
+
style: this.props.style,
|
|
53
|
+
title: title
|
|
51
54
|
}, this.state.t);
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
exports.default = Time;
|
|
55
|
-
function ago(timeA, timeB) {
|
|
56
|
-
|
|
57
|
-
s: '%d
|
|
58
|
-
m: '
|
|
59
|
-
mm: '%
|
|
60
|
-
h: '
|
|
61
|
-
hh: '%
|
|
62
|
-
d: '
|
|
63
|
-
dd: '%
|
|
64
|
-
M: '
|
|
65
|
-
MM: '%
|
|
66
|
-
y: '
|
|
67
|
-
yy: '%
|
|
58
|
+
function ago(timeA, timeB, t) {
|
|
59
|
+
let relObj = {
|
|
60
|
+
s: '%d sec',
|
|
61
|
+
m: '1 min',
|
|
62
|
+
mm: '%d mins',
|
|
63
|
+
h: '1 hour',
|
|
64
|
+
hh: '%d hours',
|
|
65
|
+
d: '1 day',
|
|
66
|
+
dd: '%d days',
|
|
67
|
+
M: '1 month',
|
|
68
|
+
MM: '%d months',
|
|
69
|
+
y: '1 year',
|
|
70
|
+
yy: '%d years'
|
|
68
71
|
};
|
|
72
|
+
if (t) {
|
|
73
|
+
relObj = {
|
|
74
|
+
s: `%d ${t('second_short')}`,
|
|
75
|
+
m: `1 ${t('minute_short')}`,
|
|
76
|
+
mm: `%d ${t('minutes_short')}`,
|
|
77
|
+
h: `1 ${t('hour_short')}`,
|
|
78
|
+
hh: `%d ${t('hours_short')}`,
|
|
79
|
+
d: `1 ${t('day_short')}`,
|
|
80
|
+
dd: `%d ${t('days_short')}`,
|
|
81
|
+
M: `1 ${t('month_short')}`,
|
|
82
|
+
MM: `%d ${t('months_short')}`,
|
|
83
|
+
y: `1 ${t('year_short')}`,
|
|
84
|
+
yy: `%d ${t('years_short')}`
|
|
85
|
+
};
|
|
86
|
+
}
|
|
69
87
|
const loc = relObj;
|
|
70
88
|
const T = [{
|
|
71
89
|
l: 's',
|
package/compiled_src/lib.js
CHANGED
|
@@ -12,10 +12,10 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
12
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
13
13
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
14
|
var $link = document.createElement('link');
|
|
15
|
-
$link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500
|
|
15
|
+
$link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
|
|
16
16
|
$link.rel = 'stylesheet';
|
|
17
17
|
document.head.append($link);
|
|
18
|
-
_index.default.preloadWebfonts(['Inter'], [400, 500
|
|
18
|
+
_index.default.preloadWebfonts(['Inter'], [400, 500]);
|
|
19
19
|
class Widget {
|
|
20
20
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fake) {
|
|
21
21
|
_defineProperty(this, "version", () => '4.5');
|
|
@@ -14,10 +14,10 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
15
|
let promiseMainCSS = (() => Promise.resolve().then(() => _interopRequireWildcard(require('../chatbox/css.js'))))();
|
|
16
16
|
var $link = document.createElement('link');
|
|
17
|
-
$link.href = 'https://fonts.googleapis.com/css2?family=
|
|
17
|
+
$link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
|
|
18
18
|
$link.rel = 'stylesheet';
|
|
19
19
|
document.head.append($link);
|
|
20
|
-
_index.default.preloadWebfonts(['
|
|
20
|
+
_index.default.preloadWebfonts(['Inter'], [400, 500]);
|
|
21
21
|
let defaultAvatar = require('../../assets/img/default_avatar.png');
|
|
22
22
|
class Icon extends common.Com {
|
|
23
23
|
render() {
|
|
@@ -26,10 +26,10 @@ function getUrlParameter(name) {
|
|
|
26
26
|
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
27
27
|
}
|
|
28
28
|
var $link = document.createElement('link');
|
|
29
|
-
$link.href = 'https://fonts.googleapis.com/css2?family=
|
|
29
|
+
$link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
|
|
30
30
|
$link.rel = 'stylesheet';
|
|
31
31
|
document.head.append($link);
|
|
32
|
-
_index.default.preloadWebfonts(['
|
|
32
|
+
_index.default.preloadWebfonts(['Inter'], [400, 500]);
|
|
33
33
|
async function load() {
|
|
34
34
|
let store = new _store.default(config.ApiURL, config.FileURL, config.RealtimeURL, true);
|
|
35
35
|
let signkey = getUrlParameter('x-signed-key');
|
package/compiled_src/plugin.js
CHANGED
|
@@ -7,10 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
var _index = _interopRequireDefault(require("./util/index.js"));
|
|
8
8
|
var common = _interopRequireWildcard(require("./common.js"));
|
|
9
9
|
var _preact = require("preact");
|
|
10
|
+
var _main = _interopRequireDefault(require("./chatbox/main.js"));
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
const LoadChatbox = () => Promise.resolve().then(() => _interopRequireWildcard(require('./chatbox/main.js')));
|
|
14
14
|
const LoadContact = () => Promise.resolve().then(() => _interopRequireWildcard(require('./contact/contact.js')));
|
|
15
15
|
const LoadPopup = () => Promise.resolve().then(() => _interopRequireWildcard(require('./popup/popup.js')));
|
|
16
16
|
const LoadNotif = () => Promise.resolve().then(() => _interopRequireWildcard(require('./notif/notif.js')));
|
|
@@ -49,7 +49,6 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
var _ref = (0, _preact.createRef)();
|
|
52
|
-
let Chatbox = null;
|
|
53
52
|
let Popup = null;
|
|
54
53
|
let Contact = null;
|
|
55
54
|
let Notif = null;
|
|
@@ -62,8 +61,7 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
62
61
|
if (_destroy) return;
|
|
63
62
|
if (!$div) return;
|
|
64
63
|
if (plugin.type === 'chatbox') {
|
|
65
|
-
|
|
66
|
-
(0, _preact.render)((0, _preact.h)(Chatbox, {
|
|
64
|
+
(0, _preact.render)((0, _preact.h)(_main.default, {
|
|
67
65
|
destroy: _destroy,
|
|
68
66
|
plugin: plugin,
|
|
69
67
|
store: store,
|
|
@@ -58,22 +58,7 @@ class _default {
|
|
|
58
58
|
}
|
|
59
59
|
}));
|
|
60
60
|
_defineProperty(this, "sendTyping", cid => this.apireq.post(`/accounts/${this.accid}/conversations/${cid}/typing`));
|
|
61
|
-
_defineProperty(this, "sendLostFocus", (
|
|
62
|
-
by: {
|
|
63
|
-
id: this.uid,
|
|
64
|
-
device: device
|
|
65
|
-
},
|
|
66
|
-
type: 'presence_updated',
|
|
67
|
-
data: {
|
|
68
|
-
presence: {
|
|
69
|
-
viewing_product_sku: sku,
|
|
70
|
-
viewing_product_source_id: source_id,
|
|
71
|
-
viewing_product_id: productid,
|
|
72
|
-
pinged: _index.default.Date.now(),
|
|
73
|
-
is_focused: false
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}));
|
|
61
|
+
_defineProperty(this, "sendLostFocus", () => this.apireq.post(`/accounts/${this.accid}/focuses/${this.uid}/delete`));
|
|
77
62
|
_defineProperty(this, "uploadToS3", async file => {
|
|
78
63
|
let {
|
|
79
64
|
body: signed,
|
|
@@ -126,10 +126,7 @@ class Store {
|
|
|
126
126
|
if (_index.default.isUserBanned(this.cache.match('user'))) return;
|
|
127
127
|
if (!this._track_page_view) return;
|
|
128
128
|
let hasfocus = this.browserVisibility === 'visible' && document.hasFocus();
|
|
129
|
-
if (!hasfocus)
|
|
130
|
-
this.api.sendLostFocus(this.device, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
129
|
+
if (!hasfocus) return this.api.sendLostFocus();
|
|
133
130
|
this.api.sendContentView(this.device, location.href, document.title, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
|
|
134
131
|
}, 1000, {
|
|
135
132
|
leading: false
|
|
@@ -206,7 +203,7 @@ class Store {
|
|
|
206
203
|
}, 20000);
|
|
207
204
|
this._presenceInterval2 = _index.default.setInterval(() => {
|
|
208
205
|
if (this._die) return _index.default.clearInterval(this._presenceInterval2);
|
|
209
|
-
if (this.browserVisibility !== 'visible' || document.hasFocus()) this.sendPresence();
|
|
206
|
+
if (this.browserVisibility !== 'visible' || !document.hasFocus()) this.sendPresence();
|
|
210
207
|
}, 60000);
|
|
211
208
|
onVisibilityChange(val => {
|
|
212
209
|
if (this._die) return;
|