@subiz/widget-v4 4.0.92 → 4.0.93
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/bot.js +0 -11
- package/compiled_src/call/call.js +0 -61
- package/compiled_src/call/css.js +0 -2
- package/compiled_src/chatbox/AgentsAvatar.js +0 -16
- package/compiled_src/chatbox/AudioAttachments.js +0 -14
- package/compiled_src/chatbox/ButtonAttachments.js +1 -14
- package/compiled_src/chatbox/Buttons.js +0 -13
- package/compiled_src/chatbox/ChatButton.js +1 -78
- package/compiled_src/chatbox/DropdownSelect.js +3 -44
- package/compiled_src/chatbox/Emoji.js +0 -7
- package/compiled_src/chatbox/Event.js +0 -59
- package/compiled_src/chatbox/Events.js +4 -44
- package/compiled_src/chatbox/FileAttachments.js +0 -14
- package/compiled_src/chatbox/FormAttachment.js +1 -52
- package/compiled_src/chatbox/FormAttachments.js +0 -14
- package/compiled_src/chatbox/FormSubmitAttachments.js +0 -11
- package/compiled_src/chatbox/GenericTemplateAttachments.js +1 -20
- package/compiled_src/chatbox/Header.js +1 -46
- package/compiled_src/chatbox/ImageAttachments.js +0 -16
- package/compiled_src/chatbox/InfoMessage.js +0 -13
- package/compiled_src/chatbox/ListField.js +0 -16
- package/compiled_src/chatbox/MessageInput.js +1 -47
- package/compiled_src/chatbox/Order.js +0 -35
- package/compiled_src/chatbox/OrderAttachments.js +1 -23
- package/compiled_src/chatbox/PoweredBy.js +0 -7
- package/compiled_src/chatbox/ProductAttachments.js +0 -19
- package/compiled_src/chatbox/QuickReplies.js +0 -18
- package/compiled_src/chatbox/Rating.js +0 -37
- package/compiled_src/chatbox/ShadowDomRoot.js +0 -9
- package/compiled_src/chatbox/TextMessage.js +0 -64
- package/compiled_src/chatbox/Typing.js +0 -15
- package/compiled_src/chatbox/VideoAttachments.js +0 -14
- package/compiled_src/chatbox/Widget.js +6 -167
- package/compiled_src/chatbox/css.js +0 -2
- package/compiled_src/chatbox/dragscroll.js +1 -5
- package/compiled_src/chatbox/main.js +1 -40
- package/compiled_src/chatbox/releaseAnimation.js +0 -11
- package/compiled_src/chatbox/spinner.js +0 -10
- package/compiled_src/chatbox/time.js +0 -22
- package/compiled_src/chatbox/touchscroll.js +0 -7
- package/compiled_src/common.js +0 -22
- package/compiled_src/contact/contact.js +2 -52
- package/compiled_src/contact/css.js +0 -2
- package/compiled_src/lib.js +19 -46
- package/compiled_src/notif/css.js +0 -2
- package/compiled_src/notif/notif.js +0 -63
- package/compiled_src/order/address_picker.js +4 -38
- package/compiled_src/order/icon.js +0 -16
- package/compiled_src/order/index.js +1 -34
- package/compiled_src/order/order.js +2 -156
- package/compiled_src/plugin.js +1 -77
- package/compiled_src/popup/countdown.js +2 -33
- package/compiled_src/popup/css.js +0 -2
- package/compiled_src/popup/popup.js +2 -165
- package/compiled_src/popup/tick.core.commonjs.js +72 -222
- package/compiled_src/popup/tick.view.flip.commonjs.js +23 -31
- package/compiled_src/store/api.js +99 -65
- package/compiled_src/store/api_fake.js +3 -39
- package/compiled_src/store/realtime_fake.js +0 -6
- package/compiled_src/store/store.js +42 -248
- package/compiled_src/util/campaign.js +0 -13
- package/compiled_src/util/common.js +15 -185
- package/compiled_src/util/common.test.js +0 -4
- package/compiled_src/util/extractor.js +1 -21
- package/compiled_src/util/extractor.test.js +0 -3
- package/compiled_src/util/gate.js +0 -7
- package/compiled_src/util/gate.test.js +1 -2
- package/compiled_src/util/index.js +1 -7
- package/compiled_src/util/mutex.js +31 -0
- package/compiled_src/util/op.js +1 -14
- package/compiled_src/util/pubsub.js +0 -6
- package/compiled_src/util/pubsub.test.js +0 -2
- package/package.json +11 -11
- package/src/lib.js +24 -2
- package/src/store/api.js +110 -21
- package/src/store/api_fake.js +5 -6
- package/src/store/store.js +31 -5
- package/src/util/index.js +1 -0
- package/src/util/mutex.js +27 -0
- package/dist/132.js +0 -7092
- package/dist/178.js +0 -406
- package/dist/18364d15f37.132.js +0 -1
- package/dist/18364d15f37.178.js +0 -1
- package/dist/18364d15f37.213.js +0 -1
- package/dist/18364d15f37.335.js +0 -1
- package/dist/18364d15f37.362.js +0 -1
- package/dist/18364d15f37.441.js +0 -1
- package/dist/18364d15f37.605.js +0 -1
- package/dist/18364d15f37.678.js +0 -1
- package/dist/18364d15f37.782.js +0 -1
- package/dist/18364d15f37.app.js +0 -1
- package/dist/18364d15f37.index.html +0 -26
- package/dist/18364d15f37.library.html +0 -26
- package/dist/18364d15f37.library.js +0 -1
- package/dist/18364d15f37.preview.html +0 -759
- package/dist/18364d15f37.preview.js +0 -1
- package/dist/18364d15f37.screenshoot.js +0 -1
- package/dist/213.js +0 -3215
- package/dist/335.js +0 -411
- package/dist/362.js +0 -107
- package/dist/441.js +0 -2834
- package/dist/605.js +0 -328
- package/dist/678.js +0 -107
- package/dist/782.js +0 -107
- package/dist/HASH +0 -1
- package/dist/assets/img/Facebook.64607ec.png +0 -0
- package/dist/assets/img/Zalo.6845707.png +0 -0
- 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/bubble_default.7d5e4ab.svg +0 -20
- package/dist/assets/img/caret.998eb8f.svg +0 -1
- package/dist/assets/img/convos_empty.2353007.svg +0 -72
- package/dist/assets/img/default.06e6ee0.jpg +0 -0
- package/dist/assets/img/default_avatar.5b74dc1.png +0 -0
- package/dist/assets/img/done_gray.d7e8203.svg +0 -4
- package/dist/assets/img/done_green.b817fd4.svg +0 -4
- package/dist/assets/img/emoji/messenger/sub_23.529_58.824.d5faf14.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_23.529_60.784.1420241.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_25.490_0.000.1e6b2c0.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_25.490_45.098.3dfbc08.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_25.490_5.882.4b49e94.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_27.451_72.549.7114f58.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_27.451_84.314.231e2b7.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_27.451_96.078.ddbb008.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_29.412_5.882.61f3359.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_58.824_100.000.6df72bc.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_58.824_45.098.3d7a7ad.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_58.824_47.059.0f4d6e2.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_58.824_54.902.65724c1.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_58.824_64.706.9da3cba.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_58.824_72.549.edca5cf.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_58.824_78.431.f910f2a.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_58.824_88.235.def4e71.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_60.784_11.765.49c03d0.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_60.784_27.451.46b54e5.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_60.784_29.412.e36d284.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_60.784_3.922.bb191b0.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_60.784_35.294.af7b927.png +0 -0
- package/dist/assets/img/emoji/messenger/sub_60.784_7.843.98f2a99.png +0 -0
- package/dist/assets/img/empty.29bed2d.svg +0 -23
- package/dist/assets/img/empty_1.0b98af0.svg +0 -11
- package/dist/assets/img/examplte_logo.f86535f.svg +0 -1
- package/dist/assets/img/external-link.90577cc.svg +0 -1
- package/dist/assets/img/fb_inverse_circle.36c2cfc.png +0 -0
- package/dist/assets/img/ghn.070f8e3.svg +0 -17
- package/dist/assets/img/ghtk.326eac1.svg +0 -18
- package/dist/assets/img/image_default.be0698b.png +0 -0
- package/dist/assets/img/info.ebce7ea.svg +0 -1
- package/dist/assets/img/loader.37000a7.svg +0 -1
- package/dist/assets/img/loading_static.8f403ae.svg +0 -10
- package/dist/assets/img/main-service1.d536cc2.png +0 -0
- package/dist/assets/img/main-service2.9b99549.png +0 -0
- package/dist/assets/img/not_found_search.2ddb8d1.png +0 -0
- package/dist/assets/img/package.8d37d0f.svg +0 -5
- package/dist/assets/img/package_fade.763c001.svg +0 -1
- package/dist/assets/img/rating--average.1ea492c.svg +0 -12
- package/dist/assets/img/rating--great.e3d712e.svg +0 -16
- package/dist/assets/img/rating--poor.2938a25.svg +0 -12
- package/dist/assets/img/search.f9705ff.svg +0 -1
- package/dist/assets/img/send.6db52a9.svg +0 -3
- package/dist/assets/img/shop.f7dc7d8.svg +0 -1
- package/dist/assets/img/shop_faded.df7845a.svg +0 -1
- package/dist/assets/img/subiz-mono.877e9f5.svg +0 -3
- package/dist/assets/img/x.26fdfa3.svg +0 -5
- package/dist/malicious-app.js +0 -13
- package/dist/screenshoot.html +0 -7
- package/dist/screenshoot.js +0 -5953
|
@@ -4,27 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _index = _interopRequireDefault(require("../util/index.js"));
|
|
9
|
-
|
|
10
8
|
var _preact = require("preact");
|
|
11
|
-
|
|
12
9
|
var _common = require("../common.js");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
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; }
|
|
17
|
-
|
|
18
12
|
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); }
|
|
19
|
-
|
|
20
13
|
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; }
|
|
21
|
-
|
|
22
14
|
let notifCSS = (() => Promise.resolve().then(() => _interopRequireWildcard(require('./css.js'))))();
|
|
23
15
|
|
|
24
16
|
class Notif extends _common.Com {
|
|
25
17
|
constructor(props) {
|
|
26
18
|
super(props);
|
|
27
|
-
|
|
28
19
|
_defineProperty(this, "state", {
|
|
29
20
|
close: true,
|
|
30
21
|
cssready: false,
|
|
@@ -36,15 +27,12 @@ class Notif extends _common.Com {
|
|
|
36
27
|
title: '',
|
|
37
28
|
last_show: 0
|
|
38
29
|
});
|
|
39
|
-
|
|
40
30
|
setTimeout(async () => {
|
|
41
31
|
let {
|
|
42
32
|
body: impression
|
|
43
33
|
} = await this.props.store.sendImpression(this.props.plugin.id);
|
|
44
34
|
this.impressionToken = _index.default.get(impression, 'impression_token') || '';
|
|
45
|
-
|
|
46
35
|
let image = _index.default.get(this.props, 'plugin.notification.background_url');
|
|
47
|
-
|
|
48
36
|
_index.default.preloadImg(image, () => this.setState({
|
|
49
37
|
imageReady: true
|
|
50
38
|
}));
|
|
@@ -54,7 +42,6 @@ class Notif extends _common.Com {
|
|
|
54
42
|
setOver(over) {
|
|
55
43
|
if (!over) this.mouse_leave = _index.default.Date.now();else this.mouse_leave = 0;
|
|
56
44
|
}
|
|
57
|
-
|
|
58
45
|
randomTimestampt() {
|
|
59
46
|
let random = Math.floor(Math.random() * 5);
|
|
60
47
|
if (random == 0) return this.props.t('just_now');
|
|
@@ -63,29 +50,22 @@ class Notif extends _common.Com {
|
|
|
63
50
|
if (random == 3) return '3 ' + this.props.t('minutes_ago');
|
|
64
51
|
return '4 ' + this.props.t('minutes_ago');
|
|
65
52
|
}
|
|
66
|
-
|
|
67
53
|
onClick(e) {
|
|
68
54
|
e.stopPropagation();
|
|
69
55
|
if (this.props.plugin._dont_follow) return;
|
|
70
56
|
this.props.store.sendConversion(this.props.plugin.id, null, this.impressionToken);
|
|
71
|
-
|
|
72
57
|
let url = _index.default.get(this.props, 'plugin.notification.url');
|
|
73
|
-
|
|
74
58
|
if (!url) return;
|
|
75
59
|
if (!url.startsWith('http://') && !url.startsWith('https://')) url = '//' + url;
|
|
76
|
-
|
|
77
60
|
let new_tab = _index.default.get(this.props, 'plugin.notification.new_tab', false);
|
|
78
|
-
|
|
79
61
|
if (new_tab) return window.open(url);
|
|
80
62
|
window.location.href = url;
|
|
81
63
|
}
|
|
82
|
-
|
|
83
64
|
onCloseButtonClick(e) {
|
|
84
65
|
e.preventDefault();
|
|
85
66
|
e.stopPropagation();
|
|
86
67
|
this.setClose(true);
|
|
87
68
|
}
|
|
88
|
-
|
|
89
69
|
renderCloseButton() {
|
|
90
70
|
return (0, _preact.h)("div", {
|
|
91
71
|
class: "btn_close",
|
|
@@ -112,32 +92,25 @@ class Notif extends _common.Com {
|
|
|
112
92
|
style: "stroke-width: 3 !important;"
|
|
113
93
|
})));
|
|
114
94
|
}
|
|
115
|
-
|
|
116
95
|
async waitForT() {
|
|
117
96
|
if (this.props.t) return;
|
|
118
97
|
await _index.default.sleep(100);
|
|
119
98
|
return this.waitForT();
|
|
120
99
|
}
|
|
121
|
-
|
|
122
100
|
async setClose(close) {
|
|
123
101
|
await this.waitForT();
|
|
124
102
|
if (!this.props.t) return;
|
|
125
|
-
|
|
126
103
|
if (!close) {
|
|
127
104
|
clearTimeout(this.lastCloseTimeout);
|
|
128
105
|
this.setState({
|
|
129
106
|
closeAnimation: false
|
|
130
107
|
});
|
|
131
108
|
let timestamp = this.randomTimestampt();
|
|
132
|
-
|
|
133
109
|
let profiles = _index.default.get(this.props, 'plugin.notification.profiles', []);
|
|
134
|
-
|
|
135
110
|
let user = profiles[Math.floor(Math.random() * _index.default.size(profiles))] || {};
|
|
136
|
-
|
|
137
111
|
if (user.avatar_url && user.avatar_url.startsWith('http')) {
|
|
138
112
|
await _index.default.preloadImg(user.avatar_url);
|
|
139
113
|
}
|
|
140
|
-
|
|
141
114
|
_index.default.map(_index.default.get(this.props.plugin, 'notification.custom_avatar_urls'), url => {
|
|
142
115
|
profiles.push({
|
|
143
116
|
type: 'person',
|
|
@@ -149,17 +122,11 @@ class Notif extends _common.Com {
|
|
|
149
122
|
age: randomAge()
|
|
150
123
|
});
|
|
151
124
|
});
|
|
152
|
-
|
|
153
125
|
let i18n_messages = _index.default.get(this.props, 'plugin.notification.i18n_message_quill_deltas', []);
|
|
154
|
-
|
|
155
126
|
let i18n_message = i18n_messages[Math.floor(Math.random() * _index.default.size(i18n_messages))];
|
|
156
|
-
|
|
157
127
|
let fallbackmsgs = _index.default.get(this.props, 'plugin.notification.message_quill_deltas', []);
|
|
158
|
-
|
|
159
128
|
let fallbackmessage = fallbackmsgs[Math.floor(Math.random() * _index.default.size(fallbackmsgs))];
|
|
160
|
-
|
|
161
129
|
let i18n_title = _index.default.get(this.props, 'plugin.notification.i18n_title_quill_delta');
|
|
162
|
-
|
|
163
130
|
return this.setState({
|
|
164
131
|
close: false,
|
|
165
132
|
last_show: _index.default.Date.now(),
|
|
@@ -169,7 +136,6 @@ class Notif extends _common.Com {
|
|
|
169
136
|
message: this.props.t.i18n(i18n_message) || fallbackmessage
|
|
170
137
|
});
|
|
171
138
|
}
|
|
172
|
-
|
|
173
139
|
this.setState({
|
|
174
140
|
closeAnimation: true
|
|
175
141
|
});
|
|
@@ -183,39 +149,29 @@ class Notif extends _common.Com {
|
|
|
183
149
|
close: false
|
|
184
150
|
}), 1000);
|
|
185
151
|
}
|
|
186
|
-
|
|
187
152
|
async refreshCSS() {
|
|
188
153
|
let plugins = this.props.store.matchPlugin();
|
|
189
|
-
|
|
190
154
|
let found = _index.default.find(plugins, plugin => plugin.id === this.props.plugin.id);
|
|
191
|
-
|
|
192
155
|
if (!found) return;
|
|
193
156
|
let css = (await notifCSS).default.default.toString();
|
|
194
|
-
|
|
195
157
|
_index.default.setCss(this.props.plugin.id, this.$cssStyleDiv, css);
|
|
196
|
-
|
|
197
158
|
this.setClose(this.state.close);
|
|
198
159
|
}
|
|
199
|
-
|
|
200
160
|
componentWillUnmount() {
|
|
201
161
|
clearInterval(this.interval);
|
|
202
|
-
|
|
203
162
|
_index.default.setCss(this.props.plugin.id, this.$cssStyleDiv, '');
|
|
204
163
|
}
|
|
205
|
-
|
|
206
164
|
async componentDidMount() {
|
|
207
165
|
this.setState({
|
|
208
166
|
last_show: _index.default.Date.now()
|
|
209
167
|
});
|
|
210
168
|
this.$cssStyleDiv = document.getElementById('subiz-style-for-' + this.props.plugin.id);
|
|
211
|
-
|
|
212
169
|
if (!this.$cssStyleDiv) {
|
|
213
170
|
this.$cssStyleDiv = document.createElement('style');
|
|
214
171
|
document.head.appendChild(this.$cssStyleDiv);
|
|
215
172
|
this.$cssStyleDiv.type = 'text/css';
|
|
216
173
|
this.$cssStyleDiv.id = 'subiz-style-for-' + this.props.plugin.id;
|
|
217
174
|
}
|
|
218
|
-
|
|
219
175
|
this.props.store.onResetCSS(this, () => this.refreshCSS());
|
|
220
176
|
await this.refreshCSS();
|
|
221
177
|
this.interval = setInterval(() => {
|
|
@@ -223,12 +179,10 @@ class Notif extends _common.Com {
|
|
|
223
179
|
let mouseleave = this.mouse_leave;
|
|
224
180
|
if (mouseleave === 0) mouseleave = _index.default.Date.now();
|
|
225
181
|
if (_index.default.Date.now() - mouseleave < 1000) return;
|
|
226
|
-
|
|
227
182
|
if (!this.state.close && !this.props.plugin._dont_close) {
|
|
228
183
|
if (_index.default.Date.now() - this.state.last_show > 8000) return this.setClose(true);
|
|
229
184
|
return;
|
|
230
185
|
}
|
|
231
|
-
|
|
232
186
|
if (_index.default.Date.now() - this.state.last_show > this.props.plugin.notification.interval_sec) {
|
|
233
187
|
return this.setClose(false);
|
|
234
188
|
}
|
|
@@ -240,45 +194,35 @@ class Notif extends _common.Com {
|
|
|
240
194
|
this.setClose(false);
|
|
241
195
|
}, 50);
|
|
242
196
|
}
|
|
243
|
-
|
|
244
197
|
renderTextFromQuillDelta(quilldelta, profile) {
|
|
245
198
|
let qd = _index.default.parseJSON(quilldelta);
|
|
246
|
-
|
|
247
199
|
if (!qd || !qd.ops) return null;
|
|
248
200
|
return _index.default.map(qd.ops, op => {
|
|
249
201
|
let out = null;
|
|
250
202
|
if (!op.insert) return null;
|
|
251
203
|
if (typeof op.insert == 'string') out = op.insert;
|
|
252
|
-
|
|
253
204
|
if (_index.default.get(op, 'insert.dynamicField')) {
|
|
254
205
|
let key = _index.default.get(op, 'insert.dynamicField.key');
|
|
255
|
-
|
|
256
206
|
if (key === 'user.fullname') out = profile.fullname;
|
|
257
207
|
if (key === 'user.email') out = profile.email;
|
|
258
208
|
if (key === 'user.address') out = profile.address;
|
|
259
209
|
if (key === 'user.phone') out = profile.phone;
|
|
260
210
|
}
|
|
261
|
-
|
|
262
211
|
if (_index.default.get(op, 'attributes.bold')) out = (0, _preact.h)("b", null, out);
|
|
263
212
|
if (_index.default.get(op, 'attributes.italic')) out = (0, _preact.h)("b", null, out);
|
|
264
213
|
return out;
|
|
265
214
|
});
|
|
266
215
|
}
|
|
267
|
-
|
|
268
216
|
render() {
|
|
269
217
|
if (!this.props.t) return null;
|
|
270
218
|
if (!this.state.cssready) return null;
|
|
271
219
|
if (!this.state.imageReady) return null;
|
|
272
220
|
if (this.state.close) return null;
|
|
273
221
|
if (!this.state.message) return null;
|
|
274
|
-
|
|
275
222
|
let notif = _index.default.get(this.props.plugin, 'notification', {});
|
|
276
|
-
|
|
277
223
|
if (!notif) return null;
|
|
278
224
|
let animation = '';
|
|
279
|
-
|
|
280
225
|
let pos = _index.default.get(notif, 'position', 'bottom-left');
|
|
281
|
-
|
|
282
226
|
if (this.props.mobile) pos = _index.default.get(notif, 'mobile_position', pos);
|
|
283
227
|
if (pos === 'top-left' || pos === 'top-right') animation = 'fadeInDown';else if (pos === 'top-center') animation = 'fadeInDownCenter';else if (pos === 'bottom-center') animation = 'fadeInUpCenter';else if (pos === 'bottom-right') {
|
|
284
228
|
animation = 'fadeInUpBig';
|
|
@@ -325,28 +269,21 @@ class Notif extends _common.Com {
|
|
|
325
269
|
style: _index.default.js2css(notif.subtext_style)
|
|
326
270
|
}, this.state.timestamp))));
|
|
327
271
|
}
|
|
328
|
-
|
|
329
272
|
}
|
|
330
|
-
|
|
331
273
|
exports.default = Notif;
|
|
332
|
-
|
|
333
274
|
function randomName() {
|
|
334
275
|
let db = ['Kiều Thanh', 'Phương Anh', 'Lê Thùy Linh', 'Trang Nguyễn', 'Thanh Hoa', 'Hoài Đức', 'Huơng Giang'];
|
|
335
276
|
return db[Math.floor(Math.random() * db.length)];
|
|
336
277
|
}
|
|
337
|
-
|
|
338
278
|
function randomAge() {
|
|
339
279
|
return 15 + Math.floor(Math.random() * 20);
|
|
340
280
|
}
|
|
341
|
-
|
|
342
281
|
function ramdomPhone() {
|
|
343
282
|
return '+84' + Math.floor(Math.random() * 10) + Math.floor(Math.random() * 10) + Math.floor(Math.random() * 10) + Math.floor(Math.random() * 10) + Math.floor(Math.random() * 10) + Math.floor(Math.random() * 10) + 'xxxx';
|
|
344
283
|
}
|
|
345
|
-
|
|
346
284
|
function randomEmail() {
|
|
347
285
|
return randomName().split(' ').join('.').toLowerCase() + '@gmail.com';
|
|
348
286
|
}
|
|
349
|
-
|
|
350
287
|
function randomAddress() {
|
|
351
288
|
let db = ['Dịch Vọng Hậu, Cầu Giấy', 'Quận 1, TP Hồ Chí Minh', 'Ngõ 34 Tôn Thất Thuyết', '87 Phạm Hùng', 'Đống Đa, Hà Nội'];
|
|
352
289
|
return db[Math.floor(Math.random() * db.length)];
|
|
@@ -4,47 +4,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _index = _interopRequireDefault(require("../util/index.js"));
|
|
9
|
-
|
|
10
8
|
var _common = require("../common.js");
|
|
11
|
-
|
|
12
9
|
var _preact = require("preact");
|
|
13
|
-
|
|
14
10
|
var _spinner = _interopRequireDefault(require("../chatbox/spinner.js"));
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
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; }
|
|
19
|
-
|
|
20
13
|
class AddressPicker extends _common.Com {
|
|
21
14
|
constructor(props) {
|
|
22
15
|
super(props);
|
|
23
|
-
|
|
24
16
|
_defineProperty(this, "state", {
|
|
25
17
|
show: false,
|
|
26
18
|
searchValue: '',
|
|
27
19
|
addresses: []
|
|
28
20
|
});
|
|
29
|
-
|
|
30
21
|
_defineProperty(this, "filterRef", (0, _preact.createRef)());
|
|
31
|
-
|
|
32
22
|
_defineProperty(this, "overlayRef", (0, _preact.createRef)());
|
|
33
|
-
|
|
34
23
|
_defineProperty(this, "onTouchMove", e => {
|
|
35
24
|
if (e.target === this.overlayRef.current) {
|
|
36
25
|
e.preventDefault();
|
|
37
26
|
e.stopPropagation();
|
|
38
27
|
}
|
|
39
28
|
});
|
|
40
|
-
|
|
41
29
|
_defineProperty(this, "hideDropdown", () => {
|
|
42
30
|
this.setState({
|
|
43
31
|
show: false,
|
|
44
32
|
searchValue: ''
|
|
45
33
|
});
|
|
46
34
|
});
|
|
47
|
-
|
|
48
35
|
_defineProperty(this, "onKeydown", e => {
|
|
49
36
|
if (e.key === 'Escape') {
|
|
50
37
|
if (!this.state.show) return;
|
|
@@ -54,20 +41,18 @@ class AddressPicker extends _common.Com {
|
|
|
54
41
|
e.preventDefault();
|
|
55
42
|
e.stopPropagation();
|
|
56
43
|
}
|
|
57
|
-
|
|
58
44
|
if (e.key == 'Enter') {}
|
|
59
45
|
});
|
|
60
|
-
|
|
61
46
|
_defineProperty(this, "doSearch", _index.default.throttle(async () => {
|
|
62
47
|
let requestId = Date.now();
|
|
63
48
|
this.requestId = requestId;
|
|
64
49
|
let res = await this.props.store.suggest_addresses(this.state.searchValue);
|
|
50
|
+
|
|
65
51
|
if (this.requestId !== requestId) return;
|
|
66
52
|
this.setState({
|
|
67
53
|
addresses: _index.default.get(res, 'body.addresses', [])
|
|
68
54
|
});
|
|
69
55
|
}, 100));
|
|
70
|
-
|
|
71
56
|
_defineProperty(this, "onChangeSearchValue", e => {
|
|
72
57
|
this.setState({
|
|
73
58
|
searchValue: e.target.value
|
|
@@ -75,7 +60,6 @@ class AddressPicker extends _common.Com {
|
|
|
75
60
|
this.props.onChangeAddress(e.target.value);
|
|
76
61
|
this.doSearch();
|
|
77
62
|
});
|
|
78
|
-
|
|
79
63
|
_defineProperty(this, "toogleDropdown", async () => {
|
|
80
64
|
await this.setState({
|
|
81
65
|
show: true,
|
|
@@ -83,27 +67,24 @@ class AddressPicker extends _common.Com {
|
|
|
83
67
|
});
|
|
84
68
|
this.focusFilter();
|
|
85
69
|
});
|
|
86
|
-
|
|
87
70
|
_defineProperty(this, "onSelect", item => {
|
|
88
71
|
this.props.onSelect(item);
|
|
89
72
|
this.hideDropdown();
|
|
90
73
|
});
|
|
91
|
-
|
|
92
74
|
_defineProperty(this, "onBackgroundScroll", e => {
|
|
93
75
|
console.log('EEEEEEE', e);
|
|
94
76
|
});
|
|
95
|
-
|
|
96
|
-
|
|
77
|
+
document.addEventListener('touchmove', function (e) {
|
|
78
|
+
}
|
|
79
|
+
);
|
|
97
80
|
}
|
|
98
81
|
|
|
99
82
|
componentDidMount() {
|
|
100
83
|
window.addEventListener('keydown', this.onKeydown);
|
|
101
84
|
}
|
|
102
|
-
|
|
103
85
|
componentWillUnmount() {
|
|
104
86
|
window.removeEventListener('keydown', this.onKeydown);
|
|
105
87
|
}
|
|
106
|
-
|
|
107
88
|
renderEmpty() {
|
|
108
89
|
return (0, _preact.h)("div", {
|
|
109
90
|
class: "dropdown_select_filter__empty"
|
|
@@ -115,7 +96,6 @@ class AddressPicker extends _common.Com {
|
|
|
115
96
|
style: "text-align: center !important;"
|
|
116
97
|
}, "Kh\xF4ng c\xF3 k\u1EBFt qu\u1EA3"));
|
|
117
98
|
}
|
|
118
|
-
|
|
119
99
|
renderLoading() {
|
|
120
100
|
return (0, _preact.h)("div", {
|
|
121
101
|
class: "dropdown_select_filter__empty pt-3"
|
|
@@ -127,7 +107,6 @@ class AddressPicker extends _common.Com {
|
|
|
127
107
|
style: "text-align: center !important;"
|
|
128
108
|
}, "\u0110ang t\u1EA3i d\u1EEF li\u1EC7u"));
|
|
129
109
|
}
|
|
130
|
-
|
|
131
110
|
focusFilter() {
|
|
132
111
|
if (!this.filterRef.current) return;
|
|
133
112
|
this.filterRef.current.focus();
|
|
@@ -136,10 +115,8 @@ class AddressPicker extends _common.Com {
|
|
|
136
115
|
this.filterRef.current.focus();
|
|
137
116
|
}, 100);
|
|
138
117
|
}
|
|
139
|
-
|
|
140
118
|
renderDropdown() {
|
|
141
119
|
if (!this.state.show) return null;
|
|
142
|
-
|
|
143
120
|
let $items = _index.default.map(this.state.addresses, (addr, i) => {
|
|
144
121
|
let label = [((addr.address || '') + ' ' + normalize(addr.street)).trim()].join(', ');
|
|
145
122
|
let desc = [normalize(addr.ward), normalize(addr.district), normalize(addr.province)].join(', ');
|
|
@@ -151,20 +128,17 @@ class AddressPicker extends _common.Com {
|
|
|
151
128
|
style: "opacity: 0.7 !important;"
|
|
152
129
|
}, desc));
|
|
153
130
|
});
|
|
154
|
-
|
|
155
131
|
let $filter = null;
|
|
156
132
|
let $img = (0, _preact.h)("img", {
|
|
157
133
|
class: "dropdown_select_filter__icon",
|
|
158
134
|
src: require('../../assets/img/search.svg')
|
|
159
135
|
});
|
|
160
|
-
|
|
161
136
|
if (this.props.loading) {
|
|
162
137
|
$img = (0, _preact.h)("img", {
|
|
163
138
|
class: "dropdown_select_filter__icon",
|
|
164
139
|
src: require('../../assets/img/loader.svg')
|
|
165
140
|
});
|
|
166
141
|
}
|
|
167
|
-
|
|
168
142
|
$filter = (0, _preact.h)("div", {
|
|
169
143
|
class: "dropdown_select_filter"
|
|
170
144
|
}, $img, (0, _preact.h)("input", {
|
|
@@ -177,7 +151,6 @@ class AddressPicker extends _common.Com {
|
|
|
177
151
|
if ($items.length == 0) $items = this.renderEmpty();
|
|
178
152
|
if (this.props.loading) $items = this.renderLoading();
|
|
179
153
|
let style = `width: ${this.props.width || '150px'} !important;`;
|
|
180
|
-
|
|
181
154
|
if (this.props.full) {
|
|
182
155
|
style = ` top: 20px !important; left: 20px !important; right: 20px !important; width: unset !important; `;
|
|
183
156
|
return (0, _preact.h)("div", {
|
|
@@ -196,7 +169,6 @@ class AddressPicker extends _common.Com {
|
|
|
196
169
|
class: "dropdown_select__items"
|
|
197
170
|
}, $items)));
|
|
198
171
|
}
|
|
199
|
-
|
|
200
172
|
return (0, _preact.h)("div", {
|
|
201
173
|
class: "dropdown_select",
|
|
202
174
|
style: style
|
|
@@ -204,18 +176,15 @@ class AddressPicker extends _common.Com {
|
|
|
204
176
|
class: "dropdown_select__items"
|
|
205
177
|
}, $items));
|
|
206
178
|
}
|
|
207
|
-
|
|
208
179
|
render() {
|
|
209
180
|
let $name = (0, _preact.h)("div", {
|
|
210
181
|
class: "text-truncate",
|
|
211
182
|
style: "flex: 1 !important;"
|
|
212
183
|
}, this.props.initAddress);
|
|
213
184
|
let style = 'position: relative !important;';
|
|
214
|
-
|
|
215
185
|
if (this.props.full) {
|
|
216
186
|
style = '';
|
|
217
187
|
}
|
|
218
|
-
|
|
219
188
|
return (0, _preact.h)("div", {
|
|
220
189
|
style: style
|
|
221
190
|
}, (0, _preact.h)(_common.Clickaway, {
|
|
@@ -226,11 +195,8 @@ class AddressPicker extends _common.Com {
|
|
|
226
195
|
onClick: this.toogleDropdown
|
|
227
196
|
}, $name), this.renderDropdown()));
|
|
228
197
|
}
|
|
229
|
-
|
|
230
198
|
}
|
|
231
|
-
|
|
232
199
|
exports.default = AddressPicker;
|
|
233
|
-
|
|
234
200
|
function normalize(s) {
|
|
235
201
|
let ls = (s + '').toLowerCase();
|
|
236
202
|
if (ls.startsWith('tp ')) return s.substr(3);
|
|
@@ -4,34 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _index = _interopRequireDefault(require("../util/index.js"));
|
|
9
|
-
|
|
10
8
|
var _time = _interopRequireDefault(require("../chatbox/time.js"));
|
|
11
|
-
|
|
12
9
|
var common = _interopRequireWildcard(require("../common.js"));
|
|
13
|
-
|
|
14
10
|
var _DropdownSelect = _interopRequireDefault(require("../chatbox/DropdownSelect.js"));
|
|
15
|
-
|
|
16
11
|
var _preact = require("preact");
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
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); }
|
|
21
|
-
|
|
22
14
|
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; }
|
|
23
|
-
|
|
24
15
|
let promiseMainCSS = (() => Promise.resolve().then(() => _interopRequireWildcard(require('../chatbox/css.js'))))();
|
|
25
|
-
|
|
26
16
|
var $link = document.createElement('link');
|
|
27
17
|
$link.href = 'https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap';
|
|
28
18
|
$link.rel = 'stylesheet';
|
|
29
19
|
document.head.append($link);
|
|
30
|
-
|
|
31
20
|
_index.default.preloadWebfonts(['Roboto'], [400, 500]);
|
|
32
|
-
|
|
33
21
|
let defaultAvatar = require('../../assets/img/default_avatar.png');
|
|
34
|
-
|
|
35
22
|
class Icon extends common.Com {
|
|
36
23
|
render() {
|
|
37
24
|
if (this.props.name == 'package') {
|
|
@@ -44,7 +31,6 @@ class Icon extends common.Com {
|
|
|
44
31
|
src: require('../../assets/img/package_fade.svg')
|
|
45
32
|
});
|
|
46
33
|
}
|
|
47
|
-
|
|
48
34
|
if (this.props.name === 'shop') {
|
|
49
35
|
if (this.props.active) return (0, _preact.h)("img", {
|
|
50
36
|
style: "width: 18px !important;",
|
|
@@ -56,7 +42,5 @@ class Icon extends common.Com {
|
|
|
56
42
|
});
|
|
57
43
|
}
|
|
58
44
|
}
|
|
59
|
-
|
|
60
45
|
}
|
|
61
|
-
|
|
62
46
|
exports.default = Icon;
|
|
@@ -1,52 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _store = _interopRequireDefault(require("../store/store.js"));
|
|
4
|
-
|
|
5
4
|
var common = _interopRequireWildcard(require("../common.js"));
|
|
6
|
-
|
|
7
5
|
var _index = _interopRequireDefault(require("../util/index.js"));
|
|
8
|
-
|
|
9
6
|
var _preact = require("preact");
|
|
10
|
-
|
|
11
7
|
var _order = _interopRequireDefault(require("./order.js"));
|
|
12
|
-
|
|
13
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
9
|
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); }
|
|
16
|
-
|
|
17
10
|
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; }
|
|
18
|
-
|
|
19
11
|
let promiseMainCSS = (() => Promise.resolve().then(() => _interopRequireWildcard(require('../chatbox/css.js'))))();
|
|
20
|
-
|
|
21
12
|
var config = require('../../config.js');
|
|
22
|
-
|
|
23
13
|
function findChatbox(store) {
|
|
24
14
|
var pluginM = store.matchPlugin();
|
|
25
|
-
|
|
26
15
|
let chatboxs = _index.default.filter(pluginM, plugin => plugin.type === 'chatbox');
|
|
27
|
-
|
|
28
16
|
if (_index.default.size(chatboxs) === 0) {
|
|
29
17
|
console.error('no chatbox found.');
|
|
30
18
|
return;
|
|
31
19
|
}
|
|
32
|
-
|
|
33
20
|
return chatboxs[0];
|
|
34
21
|
}
|
|
35
|
-
|
|
36
22
|
function getUrlParameter(name) {
|
|
37
23
|
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
|
38
24
|
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
|
39
25
|
var results = regex.exec(location.search);
|
|
40
26
|
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
41
27
|
}
|
|
42
|
-
|
|
43
28
|
var $link = document.createElement('link');
|
|
44
29
|
$link.href = 'https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap';
|
|
45
30
|
$link.rel = 'stylesheet';
|
|
46
31
|
document.head.append($link);
|
|
47
|
-
|
|
48
32
|
_index.default.preloadWebfonts(['Roboto'], [400, 500]);
|
|
49
|
-
|
|
50
33
|
async function load() {
|
|
51
34
|
let store = new _store.default(config.ApiURL, config.FileURL, config.RealtimeURL, true);
|
|
52
35
|
let signkey = getUrlParameter('x-signed-key');
|
|
@@ -55,52 +38,37 @@ async function load() {
|
|
|
55
38
|
error
|
|
56
39
|
} = await store.lookupOrder(signkey);
|
|
57
40
|
let order = body;
|
|
58
|
-
|
|
59
41
|
let accid = _index.default.get(order, 'ctx.credential.account_id');
|
|
60
|
-
|
|
61
42
|
let user_id = _index.default.get(order, 'ctx.credential.issuer');
|
|
62
|
-
|
|
63
43
|
let mask = accid + '@' + user_id;
|
|
64
44
|
await store.init(accid, mask);
|
|
65
45
|
window.store = store;
|
|
66
|
-
|
|
67
46
|
let t = key => {
|
|
68
47
|
if (_locale === 'debug') return `{{${key}}}`;
|
|
69
|
-
|
|
70
48
|
let messages = _index.default.get(common.langMessages, _locale, []);
|
|
71
|
-
|
|
72
49
|
let message = _index.default.find(messages, message => message.key === key);
|
|
73
|
-
|
|
74
50
|
return _index.default.get(message, 'message', key);
|
|
75
51
|
};
|
|
76
|
-
|
|
77
52
|
let acc = store.matchAccount();
|
|
78
53
|
let plugin = findChatbox(store);
|
|
79
|
-
let css = (await promiseMainCSS).default.default.toString();
|
|
80
54
|
|
|
55
|
+
let css = (await promiseMainCSS).default.default.toString();
|
|
81
56
|
var outcss = _index.default.replaceCssVariable(css, plugin.chatbox);
|
|
82
|
-
|
|
83
57
|
let $cssStyleDiv = document.createElement('style');
|
|
84
58
|
document.head.appendChild($cssStyleDiv);
|
|
85
59
|
$cssStyleDiv.type = 'text/css';
|
|
86
60
|
$cssStyleDiv.id = 'subiz-style-for-order';
|
|
87
|
-
|
|
88
61
|
_index.default.setCss('order', $cssStyleDiv, outcss);
|
|
89
62
|
|
|
90
63
|
let _locale = plugin.locale || acc.locale || 'vi-VN';
|
|
91
|
-
|
|
92
64
|
t.i18n = i18nText => {
|
|
93
65
|
if (!i18nText) return '';
|
|
94
66
|
let fallbackLocale = plugin.locale || acc.locale || 'vi-VN';
|
|
95
67
|
fallbackLocale = fallbackLocale.replace('-', '_');
|
|
96
|
-
|
|
97
68
|
let locale = _locale.replace('-', '_');
|
|
98
|
-
|
|
99
69
|
return i18nText[locale] || i18nText[fallbackLocale];
|
|
100
70
|
};
|
|
101
|
-
|
|
102
71
|
t.locale = () => _locale;
|
|
103
|
-
|
|
104
72
|
common.downloadLanguage(store, _locale).then(() => {
|
|
105
73
|
(0, _preact.render)((0, _preact.h)(_order.default, {
|
|
106
74
|
store: store,
|
|
@@ -109,5 +77,4 @@ async function load() {
|
|
|
109
77
|
}), document.getElementById('order'));
|
|
110
78
|
});
|
|
111
79
|
}
|
|
112
|
-
|
|
113
80
|
load();
|