stellar-ui-v2 1.38.2 → 1.38.4
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/README.md +8 -8
- package/common/sensors/common-api.js +175 -0
- package/common/sensors/index.js +91 -0
- package/common/sensors/jssdk/alipay.js +2072 -0
- package/common/sensors/jssdk/baidu.js +1 -0
- package/common/sensors/jssdk/heatmap.min.js +5 -0
- package/common/sensors/jssdk/toutiao.js +1 -0
- package/common/sensors/jssdk/vapph5define.min.js +1 -0
- package/common/sensors/jssdk/vtrack.min.js +4 -0
- package/common/sensors/jssdk/web.js +1 -0
- package/common/sensors/jssdk/weixin.js +2827 -0
- package/common/sensors/middle/alipay.js +41 -0
- package/common/sensors/middle/app.js +188 -0
- package/common/sensors/middle/baidu.js +42 -0
- package/common/sensors/middle/toutiao.js +46 -0
- package/common/sensors/middle/web.js +48 -0
- package/common/sensors/middle/weixin.js +44 -0
- package/common/sensors/plugin/get-location/index.esm.js +61 -0
- package/common/sensors/plugin/report-network/index.cmd.js +252 -0
- package/common/sensors/plugin/report-network/index.esm.js +278 -0
- package/common/sensors/plugin/report-network/readme.md +13 -0
- package/common/sensors/vue3-mpclick.js +155 -0
- package/components/ste-animate/animate.scss +247 -247
- package/components/ste-animate/ste-animate.vue +200 -200
- package/components/ste-barcode/ste-barcode.vue +213 -213
- package/components/ste-checkbox/README.md +17 -17
- package/components/ste-code-input/ste-code-input.vue +302 -302
- package/components/ste-drag/ste-drag.vue +202 -202
- package/components/ste-dropdown-menu/ste-dropdown-menu.vue +405 -405
- package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +176 -176
- package/components/ste-image/ste-image.vue +218 -218
- package/components/ste-index-list/README.md +6 -6
- package/components/ste-message-box/ste-message-box.js +72 -72
- package/components/ste-popup/ste-popup.vue +341 -341
- package/components/ste-price/ste-price.vue +258 -258
- package/components/ste-qrcode/README.md +17 -17
- package/components/ste-qrcode/uqrcode.js +33 -33
- package/components/ste-rate/README.md +14 -14
- package/components/ste-read-more/ste-read-more.vue +133 -133
- package/components/ste-select/README.md +2 -1
- package/components/ste-select/datetime.vue +106 -106
- package/components/ste-signature/ste-signature.vue +220 -220
- package/components/ste-swipe-action-group/ste-swipe-action-group.vue +104 -104
- package/components/ste-swiper/ste-swiper.vue +462 -462
- package/components/ste-table/ste-table.vue +666 -666
- package/components/ste-table-column/checkbox-icon.vue +65 -65
- package/components/ste-table-column/common.scss +65 -65
- package/components/ste-table-column/radio-icon.vue +110 -110
- package/components/ste-table-column/ste-table-column.vue +255 -255
- package/components/ste-table-column/sub-table.vue +116 -116
- package/components/ste-table-column/var.scss +1 -1
- package/components/ste-tabs/props.js +212 -212
- package/components/ste-text/ste-text.vue +72 -72
- package/components/ste-toast/ste-toast.js +69 -69
- package/components/ste-toast/ste-toast.vue +231 -231
- package/components/ste-touch-swipe/ste-touch-swipe.vue +327 -327
- package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +33 -33
- package/components/ste-upload/ReadFile.js +229 -229
- package/components/ste-video/ste-video.vue +649 -649
- package/package.json +1 -1
- package/utils/utils.js +641 -634
|
@@ -0,0 +1,2072 @@
|
|
|
1
|
+
var sa = {
|
|
2
|
+
is_first_launch: !1,
|
|
3
|
+
launched: !1,
|
|
4
|
+
_queue: [],
|
|
5
|
+
mpshow_time: null,
|
|
6
|
+
sa_referrer: '\u76f4\u63a5\u6253\u5f00',
|
|
7
|
+
query_share_depth: 0,
|
|
8
|
+
share_distinct_id: '',
|
|
9
|
+
share_method: '',
|
|
10
|
+
current_scene: '',
|
|
11
|
+
inited: !1,
|
|
12
|
+
para: {
|
|
13
|
+
server_url: '',
|
|
14
|
+
send_timeout: 1e3,
|
|
15
|
+
show_log: !1,
|
|
16
|
+
allow_amend_share_path: !0,
|
|
17
|
+
max_string_length: 500,
|
|
18
|
+
datasend_timeout: 3e3,
|
|
19
|
+
source_channel: [],
|
|
20
|
+
batch_send: { send_timeout: 6e3, max_length: 6 },
|
|
21
|
+
preset_properties: {},
|
|
22
|
+
},
|
|
23
|
+
platform: '',
|
|
24
|
+
lib: { version: '0.9.0', name: 'MiniGame', method: 'code' },
|
|
25
|
+
properties: { $lib: 'MiniGame', $lib_version: '0.9.0' },
|
|
26
|
+
currentProps: {},
|
|
27
|
+
};
|
|
28
|
+
const _toString = Object.prototype.toString,
|
|
29
|
+
_hasOwnProperty = Object.prototype.hasOwnProperty,
|
|
30
|
+
indexOf = Array.prototype.indexOf,
|
|
31
|
+
slice = Array.prototype.slice,
|
|
32
|
+
_isArray = Array.prototype.isArray,
|
|
33
|
+
forEach = Array.prototype.forEach,
|
|
34
|
+
bind = Function.prototype.bind;
|
|
35
|
+
function isUndefined(e) {
|
|
36
|
+
return void 0 === e;
|
|
37
|
+
}
|
|
38
|
+
function isString(e) {
|
|
39
|
+
return '[object String]' == _toString.call(e);
|
|
40
|
+
}
|
|
41
|
+
function isDate(e) {
|
|
42
|
+
return '[object Date]' == _toString.call(e);
|
|
43
|
+
}
|
|
44
|
+
function isBoolean(e) {
|
|
45
|
+
return '[object Boolean]' == _toString.call(e);
|
|
46
|
+
}
|
|
47
|
+
function isNumber(e) {
|
|
48
|
+
return '[object Number]' == _toString.call(e) && /[\d\\.]+/.test(String(e));
|
|
49
|
+
}
|
|
50
|
+
function isJSONString(e) {
|
|
51
|
+
try {
|
|
52
|
+
JSON.parse(e);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
return !1;
|
|
55
|
+
}
|
|
56
|
+
return !0;
|
|
57
|
+
}
|
|
58
|
+
function isObject(e) {
|
|
59
|
+
return null != e && '[object Object]' === _toString.call(e);
|
|
60
|
+
}
|
|
61
|
+
function isPlainObject(e) {
|
|
62
|
+
return '[object Object]' === _toString.call(e);
|
|
63
|
+
}
|
|
64
|
+
function isArray(e) {
|
|
65
|
+
return _isArray || '[object Array]' === _toString.call(e);
|
|
66
|
+
}
|
|
67
|
+
function isFuction(e) {
|
|
68
|
+
try {
|
|
69
|
+
return /^\s*\bfunction\b/.test(e);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
return !1;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function isArguments(e) {
|
|
75
|
+
return !(!e || !_hasOwnProperty.call(e, 'callee'));
|
|
76
|
+
}
|
|
77
|
+
function toString(e) {
|
|
78
|
+
return null == e
|
|
79
|
+
? ''
|
|
80
|
+
: isArray(e) || (isPlainObject(e) && e.toString === _toString)
|
|
81
|
+
? JSON.stringify(e, null, 2)
|
|
82
|
+
: String(e);
|
|
83
|
+
}
|
|
84
|
+
function each(e, t, n) {
|
|
85
|
+
if (null == e) return !1;
|
|
86
|
+
if (forEach && e.forEach === forEach) e.forEach(t, n);
|
|
87
|
+
else if (e.length === +e.length) {
|
|
88
|
+
for (var s = 0, r = e.length; s < r; s++) if (s in e && t.call(n, e[s], s, e) === {}) return !1;
|
|
89
|
+
} else for (var a in e) if (_hasOwnProperty.call(e, a) && t.call(n, e[a], a, e) === {}) return !1;
|
|
90
|
+
}
|
|
91
|
+
function toArray(e, t) {
|
|
92
|
+
if (!e) return [];
|
|
93
|
+
var n = [];
|
|
94
|
+
return (
|
|
95
|
+
e.toArray && (n = e.toArray()),
|
|
96
|
+
isArray(e) && (n = slice.call(e)),
|
|
97
|
+
isArguments(e) && (n = slice.call(e)),
|
|
98
|
+
(n = values(e)),
|
|
99
|
+
t && isNumber(t) && (n = n.slice(t)),
|
|
100
|
+
n
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function values(e) {
|
|
104
|
+
var t = [];
|
|
105
|
+
return null == e
|
|
106
|
+
? t
|
|
107
|
+
: (each(e, function (e) {
|
|
108
|
+
t[t.length] = e;
|
|
109
|
+
}),
|
|
110
|
+
t);
|
|
111
|
+
}
|
|
112
|
+
function include(e, t) {
|
|
113
|
+
var n = !1;
|
|
114
|
+
return null == e
|
|
115
|
+
? n
|
|
116
|
+
: indexOf && e.indexOf === indexOf
|
|
117
|
+
? -1 != e.indexOf(t)
|
|
118
|
+
: (each(e, function (e) {
|
|
119
|
+
if (n || (n = e === t)) return {};
|
|
120
|
+
}),
|
|
121
|
+
n);
|
|
122
|
+
}
|
|
123
|
+
function unique(e) {
|
|
124
|
+
for (var t, n = [], s = {}, r = 0; r < e.length; r++) s[(t = e[r])] || ((s[t] = !0), n.push(t));
|
|
125
|
+
return n;
|
|
126
|
+
}
|
|
127
|
+
function formatDate(e) {
|
|
128
|
+
function t(e) {
|
|
129
|
+
return e < 10 ? '0' + e : e;
|
|
130
|
+
}
|
|
131
|
+
return (
|
|
132
|
+
e.getFullYear() +
|
|
133
|
+
'-' +
|
|
134
|
+
t(e.getMonth() + 1) +
|
|
135
|
+
'-' +
|
|
136
|
+
t(e.getDate()) +
|
|
137
|
+
' ' +
|
|
138
|
+
t(e.getHours()) +
|
|
139
|
+
':' +
|
|
140
|
+
t(e.getMinutes()) +
|
|
141
|
+
':' +
|
|
142
|
+
t(e.getSeconds()) +
|
|
143
|
+
'.' +
|
|
144
|
+
t(e.getMilliseconds())
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
function searchObjDate(e) {
|
|
148
|
+
(isObject(e) || isArray(e)) &&
|
|
149
|
+
each(e, function (t, n) {
|
|
150
|
+
isObject(t) || isArray(t) ? searchObjDate(e[n]) : isDate(t) && (e[n] = formatDate(t));
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function trim(e) {
|
|
154
|
+
return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
155
|
+
}
|
|
156
|
+
function isFunction(e) {
|
|
157
|
+
if (!e) return !1;
|
|
158
|
+
var t = Object.prototype.toString.call(e);
|
|
159
|
+
return '[object Function]' == t || '[object AsyncFunction]' == t || '[object GeneratorFunction]' == t;
|
|
160
|
+
}
|
|
161
|
+
function extend(e) {
|
|
162
|
+
return (
|
|
163
|
+
each(slice.call(arguments, 1), function (t) {
|
|
164
|
+
for (var n in t) void 0 !== t[n] && (e[n] = t[n]);
|
|
165
|
+
}),
|
|
166
|
+
e
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
function extend2Lev(e) {
|
|
170
|
+
return (
|
|
171
|
+
each(slice.call(arguments, 1), function (t) {
|
|
172
|
+
for (var n in t)
|
|
173
|
+
void 0 !== t[n] && null !== t[n] && (isObject(t[n]) && isObject(e[n]) ? extend(e[n], t[n]) : (e[n] = t[n]));
|
|
174
|
+
}),
|
|
175
|
+
e
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
function isEmptyObject(e) {
|
|
179
|
+
if (isObject(e)) {
|
|
180
|
+
for (var t in e) if (_hasOwnProperty.call(e, t)) return !1;
|
|
181
|
+
return !0;
|
|
182
|
+
}
|
|
183
|
+
return !1;
|
|
184
|
+
}
|
|
185
|
+
function deepCopy(e) {
|
|
186
|
+
var t = {};
|
|
187
|
+
return (
|
|
188
|
+
(function e(t, n) {
|
|
189
|
+
for (var s in n) {
|
|
190
|
+
var r = n[s];
|
|
191
|
+
isArray(r) ? ((t[s] = []), e(t[s], r)) : isObject(r) ? ((t[s] = {}), e(t[s], r)) : (t[s] = r);
|
|
192
|
+
}
|
|
193
|
+
})(t, e),
|
|
194
|
+
t
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
function formatString(e) {
|
|
198
|
+
return e.length > sa.para.max_string_length
|
|
199
|
+
? (sa.log('\u5b57\u7b26\u4e32\u957f\u5ea6\u8d85\u8fc7\u9650\u5236\uff0c\u5df2\u7ecf\u505a\u622a\u53d6--' + e),
|
|
200
|
+
e.slice(0, sa.para.max_string_length))
|
|
201
|
+
: e;
|
|
202
|
+
}
|
|
203
|
+
function searchObjString(e) {
|
|
204
|
+
isObject(e) &&
|
|
205
|
+
each(e, function (t, n) {
|
|
206
|
+
isObject(t) ? searchObjString(e[n]) : isString(t) && (e[n] = formatString(t));
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function encodeDates(e) {
|
|
210
|
+
return (
|
|
211
|
+
each(e, function (t, n) {
|
|
212
|
+
isDate(t) ? (e[n] = formatDate(t)) : isObject(t) && (e[n] = encodeDates(t));
|
|
213
|
+
}),
|
|
214
|
+
e
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
function utf8Encode(e) {
|
|
218
|
+
var t,
|
|
219
|
+
n,
|
|
220
|
+
s,
|
|
221
|
+
r,
|
|
222
|
+
a = '';
|
|
223
|
+
for (t = n = 0, s = (e = (e + '').replace(/\r\n/g, '\n').replace(/\r/g, '\n')).length, r = 0; r < s; r++) {
|
|
224
|
+
var i = e.charCodeAt(r),
|
|
225
|
+
o = null;
|
|
226
|
+
i < 128
|
|
227
|
+
? n++
|
|
228
|
+
: (o =
|
|
229
|
+
i > 127 && i < 2048
|
|
230
|
+
? String.fromCharCode((i >> 6) | 192, (63 & i) | 128)
|
|
231
|
+
: String.fromCharCode((i >> 12) | 224, ((i >> 6) & 63) | 128, (63 & i) | 128)),
|
|
232
|
+
null !== o && (n > t && (a += e.substring(t, n)), (a += o), (t = n = r + 1));
|
|
233
|
+
}
|
|
234
|
+
return n > t && (a += e.substring(t, e.length)), a;
|
|
235
|
+
}
|
|
236
|
+
function base64Encode(e) {
|
|
237
|
+
var t,
|
|
238
|
+
n,
|
|
239
|
+
s,
|
|
240
|
+
r,
|
|
241
|
+
a,
|
|
242
|
+
i = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
|
243
|
+
o = 0,
|
|
244
|
+
c = 0,
|
|
245
|
+
u = '',
|
|
246
|
+
l = [];
|
|
247
|
+
if (!e) return e;
|
|
248
|
+
e = utf8Encode(e);
|
|
249
|
+
do {
|
|
250
|
+
(t = ((a = (e.charCodeAt(o++) << 16) | (e.charCodeAt(o++) << 8) | e.charCodeAt(o++)) >> 18) & 63),
|
|
251
|
+
(n = (a >> 12) & 63),
|
|
252
|
+
(s = (a >> 6) & 63),
|
|
253
|
+
(r = 63 & a),
|
|
254
|
+
(l[c++] = i.charAt(t) + i.charAt(n) + i.charAt(s) + i.charAt(r));
|
|
255
|
+
} while (o < e.length);
|
|
256
|
+
switch (((u = l.join('')), e.length % 3)) {
|
|
257
|
+
case 1:
|
|
258
|
+
u = u.slice(0, -2) + '==';
|
|
259
|
+
break;
|
|
260
|
+
case 2:
|
|
261
|
+
u = u.slice(0, -1) + '=';
|
|
262
|
+
}
|
|
263
|
+
return u;
|
|
264
|
+
}
|
|
265
|
+
function _decodeURIComponent(e) {
|
|
266
|
+
var t = '';
|
|
267
|
+
try {
|
|
268
|
+
t = decodeURIComponent(e);
|
|
269
|
+
} catch (n) {
|
|
270
|
+
t = e;
|
|
271
|
+
}
|
|
272
|
+
return t;
|
|
273
|
+
}
|
|
274
|
+
var SOURCE_CHANNEL_STANDARD = 'utm_source utm_medium utm_campaign utm_content utm_term',
|
|
275
|
+
LATEST_SOURCE_CHANNEL = [
|
|
276
|
+
'$latest_utm_source',
|
|
277
|
+
'$latest_utm_medium',
|
|
278
|
+
'$latest_utm_campaign',
|
|
279
|
+
'$latest_utm_content',
|
|
280
|
+
'$latest_utm_term',
|
|
281
|
+
'$latest_sa_utm',
|
|
282
|
+
],
|
|
283
|
+
LATEST_SHARE_INFO = [
|
|
284
|
+
'$latest_share_distinct_id',
|
|
285
|
+
'$latest_share_url_path',
|
|
286
|
+
'$latest_share_depth',
|
|
287
|
+
'$latest_share_method',
|
|
288
|
+
],
|
|
289
|
+
IDENTITY_KEY = { EMAIL: '$identity_email', MOBILE: '$identity_mobile', LOGIN: '$identity_login_id' },
|
|
290
|
+
IDENTITIES = {},
|
|
291
|
+
RESERVE_CHANNEL = ' utm_source utm_medium utm_campaign utm_content utm_term sa_utm ',
|
|
292
|
+
meta = {
|
|
293
|
+
lib_version: '',
|
|
294
|
+
launched: !1,
|
|
295
|
+
lib_name: '',
|
|
296
|
+
query_share_depth: 0,
|
|
297
|
+
page_show_time: Date.now(),
|
|
298
|
+
mp_show_time: null,
|
|
299
|
+
promise_list: [],
|
|
300
|
+
current_scene: '',
|
|
301
|
+
is_first_launch: !1,
|
|
302
|
+
_queue: [],
|
|
303
|
+
inited: !1,
|
|
304
|
+
hasExeInit: !1,
|
|
305
|
+
scene_prefix: '',
|
|
306
|
+
share_distinct_id: '',
|
|
307
|
+
sa_referrer: '\u76f4\u63a5\u6253\u5f00',
|
|
308
|
+
source_channel_standard: SOURCE_CHANNEL_STANDARD,
|
|
309
|
+
latest_source_channel: LATEST_SOURCE_CHANNEL,
|
|
310
|
+
latest_share_info: LATEST_SHARE_INFO,
|
|
311
|
+
};
|
|
312
|
+
function getAppId() {
|
|
313
|
+
var e = sa.system_api.getAppInfoSync();
|
|
314
|
+
return e && e.appId ? e.appId : '';
|
|
315
|
+
}
|
|
316
|
+
function getObjFromQuery(e) {
|
|
317
|
+
var t = e.split('?'),
|
|
318
|
+
n = [],
|
|
319
|
+
s = {};
|
|
320
|
+
return t && t[1]
|
|
321
|
+
? (each(t[1].split('&'), function (e) {
|
|
322
|
+
(n = e.split('='))[0] && n[1] && (s[n[0]] = n[1]);
|
|
323
|
+
}),
|
|
324
|
+
s)
|
|
325
|
+
: {};
|
|
326
|
+
}
|
|
327
|
+
function getMixedQuery(e) {
|
|
328
|
+
var t = detectOptionQuery(e),
|
|
329
|
+
n = t.scene,
|
|
330
|
+
s = t.q,
|
|
331
|
+
r = t.query;
|
|
332
|
+
for (var a in r) r[a] = _decodeURIComponent(r[a]);
|
|
333
|
+
return (
|
|
334
|
+
n &&
|
|
335
|
+
extend(
|
|
336
|
+
r,
|
|
337
|
+
getObjFromQuery((n = -1 !== (n = _decodeURIComponent(n)).indexOf('?') ? '?' + n.replace(/\?/g, '') : '?' + n))
|
|
338
|
+
),
|
|
339
|
+
s && extend(r, getObjFromQuery(_decodeURIComponent(s))),
|
|
340
|
+
r
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
function detectOptionQuery(e) {
|
|
344
|
+
if (!e || !isObject(e.query)) return {};
|
|
345
|
+
var t,
|
|
346
|
+
n,
|
|
347
|
+
s,
|
|
348
|
+
r,
|
|
349
|
+
a = {};
|
|
350
|
+
return (
|
|
351
|
+
(a.query = extend({}, e.query)),
|
|
352
|
+
isString(a.query.scene) &&
|
|
353
|
+
((t = a.query),
|
|
354
|
+
(n = ['utm_source', 'utm_content', 'utm_medium', 'utm_campaign', 'utm_term', 'sa_utm'].concat(
|
|
355
|
+
sa.para.source_channel
|
|
356
|
+
)),
|
|
357
|
+
(s = new RegExp('(' + n.join('|') + ')%3D', 'i')),
|
|
358
|
+
1 === (r = Object.keys(t)).length && 'scene' === r[0] && s.test(t.scene)) &&
|
|
359
|
+
((a.scene = a.query.scene), delete a.query.scene),
|
|
360
|
+
e.query.q &&
|
|
361
|
+
e.query.scancode_time &&
|
|
362
|
+
'101' === String(e.scene).slice(0, 3) &&
|
|
363
|
+
((a.q = String(a.query.q)), delete a.query.q, delete a.query.scancode_time),
|
|
364
|
+
a
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
function setUtm(e, t) {
|
|
368
|
+
var n = {},
|
|
369
|
+
s = getMixedQuery(e),
|
|
370
|
+
r = getCustomUtmFromQuery(s, '$', '_', '$'),
|
|
371
|
+
a = getCustomUtmFromQuery(s, '$latest_', '_latest_', '$latest_');
|
|
372
|
+
return (n.pre1 = r), (n.pre2 = a), extend(t, r), n;
|
|
373
|
+
}
|
|
374
|
+
function setLatestChannel(e) {
|
|
375
|
+
isEmptyObject(e) ||
|
|
376
|
+
((function (e, t) {
|
|
377
|
+
var n = !1;
|
|
378
|
+
for (var s in t) e[t[s]] && (n = !0);
|
|
379
|
+
return n;
|
|
380
|
+
})(e, LATEST_SOURCE_CHANNEL) && sa.clearAppRegister(LATEST_SOURCE_CHANNEL),
|
|
381
|
+
sa.registerApp(e));
|
|
382
|
+
}
|
|
383
|
+
function getCustomUtmFromQuery(e, t, n, s) {
|
|
384
|
+
if (!isObject(e)) return {};
|
|
385
|
+
var r = {};
|
|
386
|
+
if (e.sa_utm)
|
|
387
|
+
for (var a in e) 'sa_utm' !== a ? include(sa.para.source_channel, a) && (r[n + a] = e[a]) : (r[s + a] = e[a]);
|
|
388
|
+
else
|
|
389
|
+
for (var i in e)
|
|
390
|
+
-1 === (' ' + SOURCE_CHANNEL_STANDARD + ' ').indexOf(' ' + i + ' ')
|
|
391
|
+
? include(sa.para.source_channel, i) && (r[n + i] = e[i])
|
|
392
|
+
: (r[t + i] = e[i]);
|
|
393
|
+
return r;
|
|
394
|
+
}
|
|
395
|
+
function existLatestUtm() {
|
|
396
|
+
var e = !1;
|
|
397
|
+
return (
|
|
398
|
+
each(LATEST_SOURCE_CHANNEL, function (t) {
|
|
399
|
+
sa.properties[t] && (e = !0);
|
|
400
|
+
}),
|
|
401
|
+
e
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
function setQuery(e, t) {
|
|
405
|
+
if (e && isObject(e) && !isEmptyObject(e)) {
|
|
406
|
+
var n = [];
|
|
407
|
+
return (
|
|
408
|
+
each(e, function (e, s) {
|
|
409
|
+
('q' === s && isString(e) && 0 === e.indexOf('http')) ||
|
|
410
|
+
(t ? n.push(s + '=' + e) : n.push(s + '=' + _decodeURIComponent(e)));
|
|
411
|
+
}),
|
|
412
|
+
n.join('&')
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
return '';
|
|
416
|
+
}
|
|
417
|
+
function getCurrentPage() {
|
|
418
|
+
var e = {};
|
|
419
|
+
try {
|
|
420
|
+
var t = isFunction(sa.system_api.getCurrentPages) ? sa.system_api.getCurrentPages() : getCurrentPages();
|
|
421
|
+
e = t[t.length - 1];
|
|
422
|
+
} catch (e) {
|
|
423
|
+
sa.log('getCurrentPage:' + e);
|
|
424
|
+
}
|
|
425
|
+
return e;
|
|
426
|
+
}
|
|
427
|
+
function getCurrentPath() {
|
|
428
|
+
var e = '\u672a\u53d6\u5230';
|
|
429
|
+
try {
|
|
430
|
+
var t = getCurrentPage();
|
|
431
|
+
e = t ? t.route : e;
|
|
432
|
+
} catch (e) {
|
|
433
|
+
sa.log('getCurrentPath:' + e);
|
|
434
|
+
}
|
|
435
|
+
return e;
|
|
436
|
+
}
|
|
437
|
+
function isPresetIdKeys(e, t) {
|
|
438
|
+
var n = ['$identity_anonymous_id'];
|
|
439
|
+
for (var s of (isArray(t) && (n = n.concat(t)), n)) if (s === e) return !0;
|
|
440
|
+
return !1;
|
|
441
|
+
}
|
|
442
|
+
var isSafeInteger =
|
|
443
|
+
Number.isSafeInteger ||
|
|
444
|
+
function (e) {
|
|
445
|
+
return isInteger(e) && Math.abs(e) <= Math.pow(2, 53) - 1;
|
|
446
|
+
},
|
|
447
|
+
isInteger =
|
|
448
|
+
Number.isInteger ||
|
|
449
|
+
function (e) {
|
|
450
|
+
return 'number' == typeof e && isFinite(e) && Math.floor(e) === e;
|
|
451
|
+
},
|
|
452
|
+
check = {
|
|
453
|
+
checkKeyword: function (e) {
|
|
454
|
+
return /^((?!^distinct_id$|^original_id$|^device_id$|^time$|^properties$|^id$|^first_id$|^second_id$|^users$|^events$|^event$|^user_id$|^date$|^datetime$|^user_group|^user_tag)[a-zA-Z_$][a-zA-Z\d_$]{0,99})$/i.test(
|
|
455
|
+
e
|
|
456
|
+
);
|
|
457
|
+
},
|
|
458
|
+
checkIdLength: function (e) {
|
|
459
|
+
return !(String(e).length > 255) || (sa.log('id \u957f\u5ea6\u8d85\u8fc7 255 \u4e2a\u5b57\u7b26\uff01'), !1);
|
|
460
|
+
},
|
|
461
|
+
};
|
|
462
|
+
function getOpenidNameByAppid(e) {
|
|
463
|
+
if ('' == e || !isString(e)) return sa.log('error: \u53c2\u6570\u5fc5\u987b\u662f\u6709\u6548\u503c'), !1;
|
|
464
|
+
var t = getAppId(),
|
|
465
|
+
n = '$identity_' + e + '_openid';
|
|
466
|
+
return t && (n = '$identity_' + e + '_' + t + '_openid'), n;
|
|
467
|
+
}
|
|
468
|
+
function validId(e) {
|
|
469
|
+
return (!isString(e) && !isNumber(e)) || '' === e
|
|
470
|
+
? (sa.log('\u8f93\u5165 ID \u7c7b\u578b\u9519\u8bef'), !1)
|
|
471
|
+
: isNumber(e) && ((e = String(e)), !/^\d+$/.test(e))
|
|
472
|
+
? (sa.log('\u8f93\u5165 ID \u7c7b\u578b\u9519\u8bef'), !1)
|
|
473
|
+
: !!check.checkIdLength(e) && e;
|
|
474
|
+
}
|
|
475
|
+
function isNewLoginId(e, t) {
|
|
476
|
+
return e !== sa.store._state.history_login_id.name || sa.store._state.history_login_id.value !== t;
|
|
477
|
+
}
|
|
478
|
+
function isSameAndAnonymousID(e) {
|
|
479
|
+
var t = sa.store.getFirstId(),
|
|
480
|
+
n = sa.store.getDistinctId();
|
|
481
|
+
return t ? e === t : e === n;
|
|
482
|
+
}
|
|
483
|
+
function setUpperCase(e) {
|
|
484
|
+
return isString(e) ? e.toLocaleUpperCase() : e;
|
|
485
|
+
}
|
|
486
|
+
function getIsFirstDay() {
|
|
487
|
+
return !!(
|
|
488
|
+
'object' == typeof sa.store._state &&
|
|
489
|
+
isNumber(sa.store._state.first_visit_day_time) &&
|
|
490
|
+
sa.store._state.first_visit_day_time > new Date().getTime()
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
function getPresetProperties() {
|
|
494
|
+
if (sa.properties && sa.properties.$lib) {
|
|
495
|
+
var e = {};
|
|
496
|
+
each(sa.properties, function (t, n) {
|
|
497
|
+
0 === n.indexOf('$') && (e[n] = t);
|
|
498
|
+
});
|
|
499
|
+
var t = { $url_path: getCurrentPath(), $is_first_day: getIsFirstDay(), $is_first_time: meta.is_first_launch },
|
|
500
|
+
n = extend(e, t, sa.properties, sa.store.getProps());
|
|
501
|
+
return delete n.$lib, n;
|
|
502
|
+
}
|
|
503
|
+
return {};
|
|
504
|
+
}
|
|
505
|
+
function getAnonymousID() {
|
|
506
|
+
if (!isEmptyObject(sa.store._state))
|
|
507
|
+
return (
|
|
508
|
+
sa.store._state._first_id ||
|
|
509
|
+
sa.store._state.first_id ||
|
|
510
|
+
sa.store._state._distinct_id ||
|
|
511
|
+
sa.store._state.distinct_id
|
|
512
|
+
);
|
|
513
|
+
sa.log('\u8bf7\u5148\u521d\u59cb\u5316SDK');
|
|
514
|
+
}
|
|
515
|
+
function rot13defs(e) {
|
|
516
|
+
return rot13obfs((e = String(e)), 113);
|
|
517
|
+
}
|
|
518
|
+
function rot13obfs(e, t) {
|
|
519
|
+
t = 'number' == typeof t ? t : 13;
|
|
520
|
+
for (var n = (e = String(e)).split(''), s = 0, r = n.length; s < r; s++) {
|
|
521
|
+
n[s].charCodeAt(0) < 126 && (n[s] = String.fromCharCode((n[s].charCodeAt(0) + t) % 126));
|
|
522
|
+
}
|
|
523
|
+
return n.join('');
|
|
524
|
+
}
|
|
525
|
+
var decodeURIComponent$1 = _decodeURIComponent;
|
|
526
|
+
function formatSystem(e) {
|
|
527
|
+
var t = e.toLowerCase();
|
|
528
|
+
return 'ios' === t ? 'iOS' : 'android' === t ? 'Android' : e;
|
|
529
|
+
}
|
|
530
|
+
var getRandomBasic = (function () {
|
|
531
|
+
var e = new Date().getTime();
|
|
532
|
+
return function (t) {
|
|
533
|
+
return Math.ceil(((e = (9301 * e + 49297) % 233280) / 233280) * t);
|
|
534
|
+
};
|
|
535
|
+
})();
|
|
536
|
+
function getRandom() {
|
|
537
|
+
if ('function' == typeof Uint32Array) {
|
|
538
|
+
var e = '';
|
|
539
|
+
if (
|
|
540
|
+
('undefined' != typeof crypto ? (e = crypto) : 'undefined' != typeof msCrypto && (e = msCrypto),
|
|
541
|
+
isObject(e) && e.getRandomValues)
|
|
542
|
+
) {
|
|
543
|
+
var t = new Uint32Array(1);
|
|
544
|
+
return e.getRandomValues(t)[0] / Math.pow(2, 32);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return getRandomBasic(1e19) / 1e19;
|
|
548
|
+
}
|
|
549
|
+
function getUUID() {
|
|
550
|
+
return (
|
|
551
|
+
Date.now() +
|
|
552
|
+
'-' +
|
|
553
|
+
Math.floor(1e7 * getRandom()) +
|
|
554
|
+
'-' +
|
|
555
|
+
getRandom().toString(16).replace('.', '') +
|
|
556
|
+
'-' +
|
|
557
|
+
String(31242 * getRandom())
|
|
558
|
+
.replace('.', '')
|
|
559
|
+
.slice(0, 8)
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
const _ = {
|
|
563
|
+
getUUID: getUUID,
|
|
564
|
+
formatSystem: formatSystem,
|
|
565
|
+
indexOf: indexOf,
|
|
566
|
+
slice: slice,
|
|
567
|
+
forEach: forEach,
|
|
568
|
+
bind: bind,
|
|
569
|
+
_hasOwnProperty: _hasOwnProperty,
|
|
570
|
+
_toString: _toString,
|
|
571
|
+
isUndefined: isUndefined,
|
|
572
|
+
isString: isString,
|
|
573
|
+
isDate: isDate,
|
|
574
|
+
isBoolean: isBoolean,
|
|
575
|
+
isNumber: isNumber,
|
|
576
|
+
isJSONString: isJSONString,
|
|
577
|
+
isObject: isObject,
|
|
578
|
+
isPlainObject: isPlainObject,
|
|
579
|
+
isArray: isArray,
|
|
580
|
+
isFuction: isFuction,
|
|
581
|
+
isArguments: isArguments,
|
|
582
|
+
toString: toString,
|
|
583
|
+
unique: unique,
|
|
584
|
+
include: include,
|
|
585
|
+
values: values,
|
|
586
|
+
toArray: toArray,
|
|
587
|
+
each: each,
|
|
588
|
+
formatDate: formatDate,
|
|
589
|
+
searchObjDate: searchObjDate,
|
|
590
|
+
utf8Encode: utf8Encode,
|
|
591
|
+
decodeURIComponent: decodeURIComponent$1,
|
|
592
|
+
encodeDates: encodeDates,
|
|
593
|
+
base64Encode: base64Encode,
|
|
594
|
+
trim: trim,
|
|
595
|
+
isFunction: isFunction,
|
|
596
|
+
extend: extend,
|
|
597
|
+
extend2Lev: extend2Lev,
|
|
598
|
+
isEmptyObject: isEmptyObject,
|
|
599
|
+
searchObjString: searchObjString,
|
|
600
|
+
formatString: formatString,
|
|
601
|
+
setLatestChannel: setLatestChannel,
|
|
602
|
+
getObjFromQuery: getObjFromQuery,
|
|
603
|
+
getMixedQuery: getMixedQuery,
|
|
604
|
+
detectOptionQuery: detectOptionQuery,
|
|
605
|
+
setUtm: setUtm,
|
|
606
|
+
getCustomUtmFromQuery: getCustomUtmFromQuery,
|
|
607
|
+
existLatestUtm: existLatestUtm,
|
|
608
|
+
setQuery: setQuery,
|
|
609
|
+
getCurrentPage: getCurrentPage,
|
|
610
|
+
getCurrentPath: getCurrentPath,
|
|
611
|
+
rot13defs: rot13defs,
|
|
612
|
+
rot13obfs: rot13obfs,
|
|
613
|
+
isSafeInteger: isSafeInteger,
|
|
614
|
+
isInteger: isInteger,
|
|
615
|
+
isPresetIdKeys: isPresetIdKeys,
|
|
616
|
+
deepCopy: deepCopy,
|
|
617
|
+
check: check,
|
|
618
|
+
getOpenidNameByAppid: getOpenidNameByAppid,
|
|
619
|
+
validId: validId,
|
|
620
|
+
isNewLoginId: isNewLoginId,
|
|
621
|
+
isSameAndAnonymousID: isSameAndAnonymousID,
|
|
622
|
+
setUpperCase: setUpperCase,
|
|
623
|
+
getIsFirstDay: getIsFirstDay,
|
|
624
|
+
};
|
|
625
|
+
function request(e) {
|
|
626
|
+
var t;
|
|
627
|
+
e.timeout && ((t = e.timeout), delete e.timeout);
|
|
628
|
+
var n = sa.platform_obj.request(e);
|
|
629
|
+
setTimeout(function () {
|
|
630
|
+
try {
|
|
631
|
+
isObject(n) && isFunction(n.abort) && n.abort();
|
|
632
|
+
} catch (e) {
|
|
633
|
+
sa.log(e);
|
|
634
|
+
}
|
|
635
|
+
}, t);
|
|
636
|
+
}
|
|
637
|
+
function getStorage(e, t) {
|
|
638
|
+
try {
|
|
639
|
+
sa.platform_obj.getStorage({ key: e, success: n, fail: n });
|
|
640
|
+
} catch (t) {
|
|
641
|
+
try {
|
|
642
|
+
sa.platform_obj.getStorage({ key: e, success: n, fail: n });
|
|
643
|
+
} catch (e) {
|
|
644
|
+
sa.log('\u83b7\u53d6 storage \u5931\u8d25\uff01', e);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
function n(e) {
|
|
648
|
+
if (e && e.data && isJSONString(e.data))
|
|
649
|
+
try {
|
|
650
|
+
var n = JSON.parse(e.data);
|
|
651
|
+
e.data = n;
|
|
652
|
+
} catch (e) {
|
|
653
|
+
sa.log('parse res.data \u5931\u8d25\uff01', e);
|
|
654
|
+
}
|
|
655
|
+
t(e);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
function setStorage(e, t) {
|
|
659
|
+
var n;
|
|
660
|
+
try {
|
|
661
|
+
n = JSON.stringify(t);
|
|
662
|
+
} catch (e) {
|
|
663
|
+
sa.log('\u5e8f\u5217\u5316\u7f13\u5b58\u5bf9\u8c61\u5931\u8d25\uff01', e);
|
|
664
|
+
}
|
|
665
|
+
try {
|
|
666
|
+
sa.platform_obj.setStorage({ key: e, data: n });
|
|
667
|
+
} catch (t) {
|
|
668
|
+
try {
|
|
669
|
+
sa.platform_obj.setStorage({ key: e, data: n });
|
|
670
|
+
} catch (e) {
|
|
671
|
+
sa.log('\u8bbe\u7f6e storage \u5931\u8d25: ', e);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
function getStorageSync(e) {
|
|
676
|
+
var t = '';
|
|
677
|
+
try {
|
|
678
|
+
t = sa.platform_obj.getStorageSync(e);
|
|
679
|
+
} catch (n) {
|
|
680
|
+
try {
|
|
681
|
+
t = sa.platform_obj.getStorageSync(e);
|
|
682
|
+
} catch (e) {
|
|
683
|
+
sa.log('\u83b7\u53d6 storage \u5931\u8d25\uff01');
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
return isJSONString(t) && (t = JSON.parse(t)), t;
|
|
687
|
+
}
|
|
688
|
+
function setStorageSync(e, t) {
|
|
689
|
+
var n;
|
|
690
|
+
try {
|
|
691
|
+
n = JSON.stringify(t);
|
|
692
|
+
} catch (e) {
|
|
693
|
+
sa.log('\u5e8f\u5217\u5316\u7f13\u5b58\u5bf9\u8c61\u5931\u8d25\uff01', e);
|
|
694
|
+
}
|
|
695
|
+
var s = function () {
|
|
696
|
+
sa.platform_obj.setStorageSync(e, n);
|
|
697
|
+
};
|
|
698
|
+
try {
|
|
699
|
+
s();
|
|
700
|
+
} catch (e) {
|
|
701
|
+
sa.log('set Storage fail --', e);
|
|
702
|
+
try {
|
|
703
|
+
s();
|
|
704
|
+
} catch (e) {
|
|
705
|
+
sa.log('set Storage fail again --', e);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
function getNetworkType() {
|
|
710
|
+
return sa.platform_obj.getNetworkType.apply(null, arguments);
|
|
711
|
+
}
|
|
712
|
+
function getSystemInfo() {
|
|
713
|
+
return sa.platform_obj.getSystemInfo.apply(null, arguments);
|
|
714
|
+
}
|
|
715
|
+
function getAppId$1() {
|
|
716
|
+
var e;
|
|
717
|
+
if (
|
|
718
|
+
(sa.platform_obj.getAccountInfoSync && (e = sa.platform_obj.getAccountInfoSync()),
|
|
719
|
+
isObject(e) && isObject(e.miniProgram))
|
|
720
|
+
)
|
|
721
|
+
return e.miniProgram;
|
|
722
|
+
}
|
|
723
|
+
var compose = {
|
|
724
|
+
request: request,
|
|
725
|
+
getStorage: getStorage,
|
|
726
|
+
setStorage: setStorage,
|
|
727
|
+
getStorageSync: getStorageSync,
|
|
728
|
+
setStorageSync: setStorageSync,
|
|
729
|
+
getAppInfoSync: getAppId$1,
|
|
730
|
+
getNetworkType: getNetworkType,
|
|
731
|
+
getSystemInfo: getSystemInfo,
|
|
732
|
+
};
|
|
733
|
+
function setStorageSync$1(e, t) {
|
|
734
|
+
return my.setStorageSync({ key: e, data: t });
|
|
735
|
+
}
|
|
736
|
+
function getStorageSync$1(e) {
|
|
737
|
+
var t = my.getStorageSync({ key: e });
|
|
738
|
+
return null !== t.data ? t.data : '';
|
|
739
|
+
}
|
|
740
|
+
function getAppInfoSync() {
|
|
741
|
+
if (my.getAppIdSync) {
|
|
742
|
+
var e = my.getAppIdSync();
|
|
743
|
+
return { appId: e && e.appId ? e.appId : '', appEnv: '', appVersion: '' };
|
|
744
|
+
}
|
|
745
|
+
return {};
|
|
746
|
+
}
|
|
747
|
+
var compose$1 = {
|
|
748
|
+
getStorageSync: getStorageSync$1,
|
|
749
|
+
setStorageSync: setStorageSync$1,
|
|
750
|
+
getAppInfoSync: getAppInfoSync,
|
|
751
|
+
onNetworkStatusChange: my.onNetworkStatusChange,
|
|
752
|
+
};
|
|
753
|
+
function request$1(e) {
|
|
754
|
+
var t, n;
|
|
755
|
+
if (!e || isEmptyObject(e)) return !1;
|
|
756
|
+
(e.complete = function () {
|
|
757
|
+
n && clearTimeout(n);
|
|
758
|
+
}),
|
|
759
|
+
(t = my.canIUse('request') ? my.request(e) : my.httpRequest(e)),
|
|
760
|
+
(n = setTimeout(function () {
|
|
761
|
+
isObject(t) && isFunction(t.abort) && t.abort();
|
|
762
|
+
}, sa.para.datasend_timeout));
|
|
763
|
+
}
|
|
764
|
+
var compose$2 = { request: request$1 };
|
|
765
|
+
function getNetwork() {
|
|
766
|
+
return new Promise(function (e) {
|
|
767
|
+
sa.system_api.getNetworkType({
|
|
768
|
+
success(e) {
|
|
769
|
+
sa.properties.$network_type = setUpperCase(e.networkType);
|
|
770
|
+
},
|
|
771
|
+
fail(e) {
|
|
772
|
+
sa.log('\u83b7\u53d6\u7f51\u7edc\u72b6\u6001\u4fe1\u606f\u5931\u8d25\uff1a ', e);
|
|
773
|
+
},
|
|
774
|
+
complete() {
|
|
775
|
+
e();
|
|
776
|
+
},
|
|
777
|
+
});
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
function getSystemInfo$1() {
|
|
781
|
+
return new Promise((e) => {
|
|
782
|
+
sa.system_api.getSystemInfo({
|
|
783
|
+
success(e) {
|
|
784
|
+
var t = sa.properties;
|
|
785
|
+
if (isObject(e)) {
|
|
786
|
+
(t.$manufacturer = e.brand),
|
|
787
|
+
(t.$model = e.model),
|
|
788
|
+
(t.$brand = setUpperCase(e.brand) || ''),
|
|
789
|
+
(t.$screen_width = Number(e.screenWidth)),
|
|
790
|
+
(t.$screen_height = Number(e.screenHeight)),
|
|
791
|
+
(t.$os = formatSystem(e.platform)),
|
|
792
|
+
(t.$os_version = e.system.indexOf(' ') > -1 ? e.system.split(' ')[1] : e.system),
|
|
793
|
+
(t.$mp_client_app_version = e.version || '');
|
|
794
|
+
var n = e.SDKVersion || '';
|
|
795
|
+
n && (t.$mp_client_basic_library_version = n);
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
fail(e) {
|
|
799
|
+
sa.log('\u83b7\u53d6\u7cfb\u7edf\u4fe1\u606f\u5931\u8d25: ', e);
|
|
800
|
+
},
|
|
801
|
+
complete() {
|
|
802
|
+
e();
|
|
803
|
+
},
|
|
804
|
+
});
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
var system = {
|
|
808
|
+
inited: !1,
|
|
809
|
+
init: function () {
|
|
810
|
+
var e = new Date().getTimezoneOffset();
|
|
811
|
+
isNumber(e) && (sa.properties.$timezone_offset = e);
|
|
812
|
+
var t = getAppId() || sa.para.app_id || sa.para.appid;
|
|
813
|
+
t && (sa.properties.$app_id = t);
|
|
814
|
+
var n = getNetwork(),
|
|
815
|
+
s = getSystemInfo$1();
|
|
816
|
+
Promise.all([n, s]).then(function () {
|
|
817
|
+
(sa.system.inited = !0), sa.checkInit();
|
|
818
|
+
});
|
|
819
|
+
},
|
|
820
|
+
},
|
|
821
|
+
identity_id = '$identity_ali_mp_id';
|
|
822
|
+
function stripProperties(e) {
|
|
823
|
+
return isObject(e)
|
|
824
|
+
? (each(e, function (t, n) {
|
|
825
|
+
if (isArray(t)) {
|
|
826
|
+
var s = [];
|
|
827
|
+
each(t, function (e) {
|
|
828
|
+
if (isString(e)) s.push(e);
|
|
829
|
+
else if (isUndefined(e)) s.push('null');
|
|
830
|
+
else
|
|
831
|
+
try {
|
|
832
|
+
s.push(JSON.stringify(e));
|
|
833
|
+
} catch (e) {
|
|
834
|
+
sa.log(
|
|
835
|
+
'\u60a8\u7684\u6570\u636e - ' +
|
|
836
|
+
n +
|
|
837
|
+
':' +
|
|
838
|
+
t +
|
|
839
|
+
' - \u7684\u6570\u7ec4\u91cc\u7684\u503c\u6709\u9519\u8bef,\u5df2\u7ecf\u5c06\u5176\u5220\u9664'
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
}),
|
|
843
|
+
(e[n] = s);
|
|
844
|
+
}
|
|
845
|
+
if (isObject(t))
|
|
846
|
+
try {
|
|
847
|
+
e[n] = JSON.stringify(t);
|
|
848
|
+
} catch (s) {
|
|
849
|
+
delete e[n],
|
|
850
|
+
sa.log(
|
|
851
|
+
'\u60a8\u7684\u6570\u636e - ' +
|
|
852
|
+
n +
|
|
853
|
+
':' +
|
|
854
|
+
t +
|
|
855
|
+
' - \u7684\u6570\u636e\u503c\u6709\u9519\u8bef,\u5df2\u7ecf\u5c06\u5176\u5220\u9664'
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
else
|
|
859
|
+
isString(t) ||
|
|
860
|
+
isNumber(t) ||
|
|
861
|
+
isDate(t) ||
|
|
862
|
+
isBoolean(t) ||
|
|
863
|
+
isArray(t) ||
|
|
864
|
+
(sa.log(
|
|
865
|
+
'\u60a8\u7684\u6570\u636e - ',
|
|
866
|
+
t,
|
|
867
|
+
'-\u683c\u5f0f\u4e0d\u6ee1\u8db3\u8981\u6c42\uff0c\u6211\u4eec\u5df2\u7ecf\u5c06\u5176\u5220\u9664'
|
|
868
|
+
),
|
|
869
|
+
delete e[n]);
|
|
870
|
+
}),
|
|
871
|
+
e)
|
|
872
|
+
: e;
|
|
873
|
+
}
|
|
874
|
+
function parseSuperProperties(e) {
|
|
875
|
+
isObject(e) &&
|
|
876
|
+
each(e, function (t, n) {
|
|
877
|
+
if (isFunction(t))
|
|
878
|
+
try {
|
|
879
|
+
(e[n] = t()),
|
|
880
|
+
isFunction(e[n]) &&
|
|
881
|
+
(sa.log(
|
|
882
|
+
'\u60a8\u7684\u5c5e\u6027 - ' +
|
|
883
|
+
n +
|
|
884
|
+
' \u683c\u5f0f\u4e0d\u6ee1\u8db3\u8981\u6c42\uff0c\u6211\u4eec\u5df2\u7ecf\u5c06\u5176\u5220\u9664'
|
|
885
|
+
),
|
|
886
|
+
delete e[n]);
|
|
887
|
+
} catch (t) {
|
|
888
|
+
delete e[n],
|
|
889
|
+
sa.log(
|
|
890
|
+
'\u60a8\u7684\u5c5e\u6027 - ' +
|
|
891
|
+
n +
|
|
892
|
+
' \u629b\u51fa\u4e86\u5f02\u5e38\uff0c\u6211\u4eec\u5df2\u7ecf\u5c06\u5176\u5220\u9664'
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
function batchRequest(e) {
|
|
898
|
+
if (isArray(e.data) && e.data.length > 0) {
|
|
899
|
+
var t = Date.now(),
|
|
900
|
+
n = sa.para.datasend_timeout;
|
|
901
|
+
e.data.forEach(function (e) {
|
|
902
|
+
e._flush_time = t;
|
|
903
|
+
}),
|
|
904
|
+
(e.data = JSON.stringify(e.data));
|
|
905
|
+
let s = {
|
|
906
|
+
url: sa.para.server_url,
|
|
907
|
+
method: 'POST',
|
|
908
|
+
dataType: 'text',
|
|
909
|
+
data: 'data_list=' + encodeURIComponent(base64Encode(e.data)),
|
|
910
|
+
timeout: n,
|
|
911
|
+
headers: { 'content-type': 'text/plain' },
|
|
912
|
+
success: function () {
|
|
913
|
+
e.success(e.len);
|
|
914
|
+
},
|
|
915
|
+
fail: function () {
|
|
916
|
+
e.fail();
|
|
917
|
+
},
|
|
918
|
+
};
|
|
919
|
+
sa.system_api.request(s);
|
|
920
|
+
} else e.success(e.len);
|
|
921
|
+
}
|
|
922
|
+
function onceSend(e) {
|
|
923
|
+
e._flush_time = Date.now();
|
|
924
|
+
var t = '',
|
|
925
|
+
n = JSON.stringify(e);
|
|
926
|
+
t =
|
|
927
|
+
-1 !== sa.para.server_url.indexOf('?')
|
|
928
|
+
? sa.para.server_url + '&data=' + encodeURIComponent(base64Encode(n))
|
|
929
|
+
: sa.para.server_url + '?data=' + encodeURIComponent(base64Encode(n));
|
|
930
|
+
var s = sa.para.datasend_timeout;
|
|
931
|
+
sa.system_api.request({ url: t, dataType: 'text', method: 'GET', timeout: s });
|
|
932
|
+
}
|
|
933
|
+
(IDENTITIES.identity_unionid = ''),
|
|
934
|
+
(IDENTITIES.identity_id = identity_id),
|
|
935
|
+
(IDENTITIES.openid_name = 'ali'),
|
|
936
|
+
(IDENTITIES.bind_preset_id = [identity_id]),
|
|
937
|
+
(IDENTITIES.unbind_without_check = [identity_id]),
|
|
938
|
+
(IDENTITIES.login_preset_id = [identity_id]);
|
|
939
|
+
var kit = { batchRequest: batchRequest, onceSend: onceSend };
|
|
940
|
+
function batchSend() {
|
|
941
|
+
if (sa.batch_state.sended) {
|
|
942
|
+
var e,
|
|
943
|
+
t,
|
|
944
|
+
n = sa.batch_state.mem;
|
|
945
|
+
(t = (e = n.length >= 100 ? n.slice(0, 100) : n).length) > 0 &&
|
|
946
|
+
((sa.batch_state.sended = !1), kit.batchRequest({ data: e, len: t, success: batchRemove, fail: sendFail }));
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
function sendFail() {
|
|
950
|
+
(sa.batch_state.sended = !0), sa.batch_state.failTime++;
|
|
951
|
+
}
|
|
952
|
+
function batchRemove(e) {
|
|
953
|
+
sa.batch_state.clear(e),
|
|
954
|
+
(sa.batch_state.sended = !0),
|
|
955
|
+
(sa.batch_state.changed = !0),
|
|
956
|
+
batchWrite(),
|
|
957
|
+
(sa.batch_state.failTime = 0);
|
|
958
|
+
}
|
|
959
|
+
function batchWrite() {
|
|
960
|
+
sa.batch_state.changed &&
|
|
961
|
+
(sa.batch_state.is_first_batch_write &&
|
|
962
|
+
((sa.batch_state.is_first_batch_write = !1),
|
|
963
|
+
setTimeout(function () {
|
|
964
|
+
batchSend();
|
|
965
|
+
}, 1e3)),
|
|
966
|
+
sa.batch_state.syncStorage &&
|
|
967
|
+
(sa.system_api.setStorageSync('sensors_prepare_data', sa.batch_state.mem), (sa.batch_state.changed = !1)));
|
|
968
|
+
}
|
|
969
|
+
function batchInterval() {
|
|
970
|
+
!(function e() {
|
|
971
|
+
setTimeout(function () {
|
|
972
|
+
batchWrite(), e();
|
|
973
|
+
}, 1e3);
|
|
974
|
+
})(),
|
|
975
|
+
(function e() {
|
|
976
|
+
setTimeout(function () {
|
|
977
|
+
batchSend(), e();
|
|
978
|
+
}, sa.para.batch_send.send_timeout * Math.pow(2, sa.batch_state.failTime));
|
|
979
|
+
})();
|
|
980
|
+
}
|
|
981
|
+
function reportEvent(e) {
|
|
982
|
+
var t = '';
|
|
983
|
+
(e._flush_time = Date.now()),
|
|
984
|
+
(t = e.event ? 'sensors_' + e.event : 'sensors_' + e.type),
|
|
985
|
+
(e.dataSource = 'sensors'),
|
|
986
|
+
sa.log('report_event, name: ', t, '-- key: ', e),
|
|
987
|
+
__mp_private_api__.reportEvent(t, e);
|
|
988
|
+
}
|
|
989
|
+
(sa.batch_state = {
|
|
990
|
+
mem: [],
|
|
991
|
+
changed: !1,
|
|
992
|
+
sended: !0,
|
|
993
|
+
is_first_batch_write: !0,
|
|
994
|
+
sync_storage: !1,
|
|
995
|
+
failTime: 0,
|
|
996
|
+
getLength: function () {
|
|
997
|
+
return this.mem.length;
|
|
998
|
+
},
|
|
999
|
+
add: function (e) {
|
|
1000
|
+
this.mem.push(e);
|
|
1001
|
+
},
|
|
1002
|
+
clear: function (e) {
|
|
1003
|
+
this.mem.splice(0, e);
|
|
1004
|
+
},
|
|
1005
|
+
}),
|
|
1006
|
+
(sa.prepareData = function (e) {
|
|
1007
|
+
var t = {
|
|
1008
|
+
distinct_id: sa.store.getDistinctId(),
|
|
1009
|
+
lib: { $lib: sa.lib.name, $lib_method: sa.lib.method, $lib_version: String(sa.lib.version) },
|
|
1010
|
+
properties: {},
|
|
1011
|
+
};
|
|
1012
|
+
if (
|
|
1013
|
+
(isObject(sa.store._state.identities) && (t.identities = sa.store._state.identities),
|
|
1014
|
+
'track_id_unbind' === e.type &&
|
|
1015
|
+
'$UnbindID' === e.event &&
|
|
1016
|
+
((t.identities = deepCopy(e.unbind_value)), delete e.unbind_value),
|
|
1017
|
+
(t = extend(t, sa.store.getUnionId(), e)),
|
|
1018
|
+
isObject(e.properties) && !isEmptyObject(e.properties) && (t.properties = extend(t.properties, e.properties)),
|
|
1019
|
+
(e.type && 'profile' === e.type.slice(0, 7)) ||
|
|
1020
|
+
((t._track_id = Number(
|
|
1021
|
+
String(getRandom()).slice(2, 5) + String(getRandom()).slice(2, 4) + String(Date.now()).slice(-4)
|
|
1022
|
+
)),
|
|
1023
|
+
(t.properties = extend({}, sa.properties, sa.store.getProps(), sa.currentProps, t.properties)),
|
|
1024
|
+
'track' === e.type && (t.properties.$is_first_day = getIsFirstDay())),
|
|
1025
|
+
t.properties.$time && isDate(t.properties.$time)
|
|
1026
|
+
? ((t.time = 1 * t.properties.$time), delete t.properties.$time)
|
|
1027
|
+
: (t.time = 1 * new Date()),
|
|
1028
|
+
sa.ee.data.emit('beforeBuildCheck', t),
|
|
1029
|
+
parseSuperProperties(t.properties),
|
|
1030
|
+
searchObjDate(t),
|
|
1031
|
+
stripProperties(t.properties),
|
|
1032
|
+
searchObjString(t),
|
|
1033
|
+
!sa.para.server_url)
|
|
1034
|
+
)
|
|
1035
|
+
return !1;
|
|
1036
|
+
sa.log(t), sa.send(t);
|
|
1037
|
+
}),
|
|
1038
|
+
(sa.send = function (e) {
|
|
1039
|
+
if (
|
|
1040
|
+
((e._nocache = (String(getRandom()) + String(getRandom()) + String(getRandom())).slice(2, 15)),
|
|
1041
|
+
'sensorsdata2015_binance' === sa.storageName && 'native' === sa.para.data_report_type)
|
|
1042
|
+
)
|
|
1043
|
+
return reportEvent(e), !1;
|
|
1044
|
+
sa.para.batch_send
|
|
1045
|
+
? (sa.batch_state.getLength() >= 500 &&
|
|
1046
|
+
(sa.log('\u6570\u636e\u91cf\u5b58\u50a8\u8fc7\u5927\uff0c\u6709\u5f02\u5e38'), sa.batch_state.mem.shift()),
|
|
1047
|
+
sa.batch_state.add(e),
|
|
1048
|
+
(sa.batch_state.changed = !0),
|
|
1049
|
+
sa.batch_state.getLength() >= sa.para.batch_send.max_length && batchSend())
|
|
1050
|
+
: kit.onceSend(e);
|
|
1051
|
+
}),
|
|
1052
|
+
(sa.log = function () {
|
|
1053
|
+
if (sa.para.show_log && 'object' == typeof console && console.log)
|
|
1054
|
+
try {
|
|
1055
|
+
var e = Array.prototype.slice.call(arguments);
|
|
1056
|
+
return console.log.apply(console, e);
|
|
1057
|
+
} catch (e) {
|
|
1058
|
+
console.log(arguments[0]);
|
|
1059
|
+
}
|
|
1060
|
+
}),
|
|
1061
|
+
(sa.track = function (e, t, n) {
|
|
1062
|
+
sa.prepareData({ type: 'track', event: e, properties: t }, n);
|
|
1063
|
+
}),
|
|
1064
|
+
(sa.setProfile = function (e) {
|
|
1065
|
+
sa.prepareData({ type: 'profile_set', properties: e });
|
|
1066
|
+
}),
|
|
1067
|
+
(sa.setOnceProfile = function (e, t) {
|
|
1068
|
+
sa.prepareData({ type: 'profile_set_once', properties: e }, t);
|
|
1069
|
+
}),
|
|
1070
|
+
(sa.login = function (e) {
|
|
1071
|
+
var t = sa.store.getFirstId(),
|
|
1072
|
+
n = sa.store.getDistinctId();
|
|
1073
|
+
e !== n && (t ? sa.trackSignup(e, '$SignUp') : (sa.store.set('first_id', n), sa.trackSignup(e, '$SignUp')));
|
|
1074
|
+
}),
|
|
1075
|
+
(sa.logout = function (e) {
|
|
1076
|
+
var t = sa.store.getFirstId();
|
|
1077
|
+
t
|
|
1078
|
+
? (sa.store.set('first_id', ''),
|
|
1079
|
+
!0 === e ? sa.store.set('distinct_id', getUUID()) : sa.store.set('distinct_id', t))
|
|
1080
|
+
: sa.log('\u6ca1\u6709first_id\uff0clogout\u5931\u8d25');
|
|
1081
|
+
}),
|
|
1082
|
+
(sa.identify = function (e) {
|
|
1083
|
+
if ('number' == typeof e) e = String(e);
|
|
1084
|
+
else if ('string' != typeof e) return !1;
|
|
1085
|
+
sa.store.getFirstId() ? sa.store.set('first_id', e) : sa.store.set('distinct_id', e);
|
|
1086
|
+
}),
|
|
1087
|
+
(sa.trackSignup = function (e, t, n) {
|
|
1088
|
+
var s, r, a, i, o;
|
|
1089
|
+
isObject(e) ? ((s = e.id), (r = e.event_name), (a = e.id_name)) : ((s = e), (r = t)),
|
|
1090
|
+
sa.store.set('distinct_id', s),
|
|
1091
|
+
(i = a && a !== IDENTITY_KEY.LOGIN ? a + '+' + s : s),
|
|
1092
|
+
(o = sa.store.getFirstId() || sa.store.getDistinctId()),
|
|
1093
|
+
sa.prepareData({ original_id: o, distinct_id: i, type: 'track_signup', event: r, properties: n });
|
|
1094
|
+
}),
|
|
1095
|
+
(sa.registerApp = function (e) {
|
|
1096
|
+
isObject(e) && !isEmptyObject(e) && (sa.currentProps = extend(sa.currentProps, e));
|
|
1097
|
+
}),
|
|
1098
|
+
(sa.clearAppRegister = function (e) {
|
|
1099
|
+
isArray(e) &&
|
|
1100
|
+
each(sa.currentProps, function (t, n) {
|
|
1101
|
+
include(e, n) && delete sa.currentProps[n];
|
|
1102
|
+
});
|
|
1103
|
+
}),
|
|
1104
|
+
(sa.register = function (e) {
|
|
1105
|
+
isObject(e) && !isEmptyObject(e) && sa.store.setProps(e);
|
|
1106
|
+
}),
|
|
1107
|
+
(sa.clearAllRegister = function () {
|
|
1108
|
+
sa.store.setProps({}, !0);
|
|
1109
|
+
}),
|
|
1110
|
+
(sa.use = function (e) {
|
|
1111
|
+
const t = this._installedPlugins || (this._installedPlugins = []);
|
|
1112
|
+
if (t.indexOf(e) > -1) return this;
|
|
1113
|
+
const n = toArray(arguments, 1);
|
|
1114
|
+
return (
|
|
1115
|
+
n.unshift(this),
|
|
1116
|
+
e && e.name && (isObject(sa.modules) || (sa.modules = {}), (sa.modules[e.name] = e)),
|
|
1117
|
+
'function' == typeof e.init ? e.init.apply(e, n) : 'function' == typeof e && e.apply(null, n),
|
|
1118
|
+
t.push(e),
|
|
1119
|
+
this
|
|
1120
|
+
);
|
|
1121
|
+
}),
|
|
1122
|
+
(sa.usePlugin = sa.use),
|
|
1123
|
+
(sa.getServerUrl = function () {
|
|
1124
|
+
return sa.para.server_url;
|
|
1125
|
+
});
|
|
1126
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty,
|
|
1127
|
+
store = {
|
|
1128
|
+
inited: !0,
|
|
1129
|
+
storageInfo: null,
|
|
1130
|
+
store_queue: [],
|
|
1131
|
+
getStorage: function () {
|
|
1132
|
+
return this.storageInfo
|
|
1133
|
+
? this.storageInfo
|
|
1134
|
+
: ((this.storageInfo = sa.system_api.getStorageSync(sa.storageName) || ''), this.storageInfo);
|
|
1135
|
+
},
|
|
1136
|
+
_state: {},
|
|
1137
|
+
toState: function (e) {
|
|
1138
|
+
var t = null,
|
|
1139
|
+
n = this;
|
|
1140
|
+
function s() {
|
|
1141
|
+
t.distinct_id ? (n._state = t) : n.set('distinct_id', getUUID());
|
|
1142
|
+
}
|
|
1143
|
+
isJSONString(e) ? ((t = JSON.parse(e)), s()) : isObject(e) ? ((t = e), s()) : this.set('distinct_id', getUUID());
|
|
1144
|
+
var r = this._state._first_id || this._state.first_id,
|
|
1145
|
+
a = this._state._distinct_id || this._state.distinct_id,
|
|
1146
|
+
i = this._state.openid,
|
|
1147
|
+
o = (this._state.history_login_id ? this._state.history_login_id : {}).name;
|
|
1148
|
+
if (this._state.identities && isString(this._state.identities)) {
|
|
1149
|
+
var c = JSON.parse(rot13defs(this._state.identities));
|
|
1150
|
+
this._state.identities = c;
|
|
1151
|
+
}
|
|
1152
|
+
var u = getOpenidNameByAppid(IDENTITIES.openid_name);
|
|
1153
|
+
function l(e) {
|
|
1154
|
+
for (var t in store._state.identities)
|
|
1155
|
+
hasOwnProperty$1.call(store._state.identities, t) &&
|
|
1156
|
+
t !== IDENTITIES.identity_id &&
|
|
1157
|
+
t !== e &&
|
|
1158
|
+
delete store._state.identities[t];
|
|
1159
|
+
}
|
|
1160
|
+
(this._state.identities && isObject(this._state.identities) && !isEmptyObject(this._state.identities)) ||
|
|
1161
|
+
((this._state.identities = {}), (this._state.identities[IDENTITIES.identity_id] = getUUID())),
|
|
1162
|
+
i && (this._state.identities[u] = i),
|
|
1163
|
+
r
|
|
1164
|
+
? o && hasOwnProperty$1.call(this._state.identities, o)
|
|
1165
|
+
? this._state.identities[o] !== a &&
|
|
1166
|
+
((this._state.identities[o] = a), l(o), (this._state.history_login_id.value = a))
|
|
1167
|
+
: ((this._state.identities[IDENTITY_KEY.LOGIN] = a),
|
|
1168
|
+
l(IDENTITY_KEY.LOGIN),
|
|
1169
|
+
(this._state.history_login_id = { name: IDENTITY_KEY.LOGIN, value: a }))
|
|
1170
|
+
: (this._state.history_login_id = { name: '', value: '' }),
|
|
1171
|
+
this.save();
|
|
1172
|
+
},
|
|
1173
|
+
getFirstId: function () {
|
|
1174
|
+
return this._state._first_id || this._state.first_id;
|
|
1175
|
+
},
|
|
1176
|
+
getDistinctId: function () {
|
|
1177
|
+
var e = this.getLoginDistinctId();
|
|
1178
|
+
return e || this._state._distinct_id || this._state.distinct_id;
|
|
1179
|
+
},
|
|
1180
|
+
getUnionId: function () {
|
|
1181
|
+
var e = {},
|
|
1182
|
+
t = this._state._first_id || this._state.first_id,
|
|
1183
|
+
n = this.getDistinctId();
|
|
1184
|
+
return t && n ? ((e.login_id = n), (e.anonymous_id = t)) : (e.anonymous_id = n), e;
|
|
1185
|
+
},
|
|
1186
|
+
getHistoryLoginId: function () {
|
|
1187
|
+
return isObject(this._state.history_login_id) ? this._state.history_login_id : null;
|
|
1188
|
+
},
|
|
1189
|
+
getLoginDistinctId: function () {
|
|
1190
|
+
var e = this.getHistoryLoginId();
|
|
1191
|
+
return isObject(e) && e.value ? (e.name !== IDENTITY_KEY.LOGIN ? e.name + '+' + e.value : e.value) : null;
|
|
1192
|
+
},
|
|
1193
|
+
getProps: function () {
|
|
1194
|
+
return this._state.props || {};
|
|
1195
|
+
},
|
|
1196
|
+
setProps: function (e, t) {
|
|
1197
|
+
var n = this._state.props || {};
|
|
1198
|
+
t ? this.set('props', e) : (extend(n, e), this.set('props', n));
|
|
1199
|
+
},
|
|
1200
|
+
set: function (e, t) {
|
|
1201
|
+
var n = {};
|
|
1202
|
+
for (var s in ('string' == typeof e ? (n[e] = t) : 'object' == typeof e && (n = e),
|
|
1203
|
+
(this._state = this._state || {}),
|
|
1204
|
+
n))
|
|
1205
|
+
(this._state[s] = n[s]),
|
|
1206
|
+
'first_id' === s
|
|
1207
|
+
? delete this._state._first_id
|
|
1208
|
+
: 'distinct_id' === s && (delete this._state._distinct_id, sa.events.emit('changeDistinctId'));
|
|
1209
|
+
this.save();
|
|
1210
|
+
},
|
|
1211
|
+
identitiesSet: function (e) {
|
|
1212
|
+
var t = {};
|
|
1213
|
+
switch (e.type) {
|
|
1214
|
+
case 'login':
|
|
1215
|
+
(t[IDENTITIES.identity_id] = this._state.identities[IDENTITIES.identity_id]), (t[e.id_name] = e.id);
|
|
1216
|
+
break;
|
|
1217
|
+
case 'logout':
|
|
1218
|
+
t[IDENTITIES.identity_id] = this._state.identities[IDENTITIES.identity_id];
|
|
1219
|
+
}
|
|
1220
|
+
this.set('identities', t);
|
|
1221
|
+
},
|
|
1222
|
+
change: function (e, t) {
|
|
1223
|
+
this._state['_' + e] = t;
|
|
1224
|
+
},
|
|
1225
|
+
encryptStorage: function () {
|
|
1226
|
+
var e = this.getStorage(),
|
|
1227
|
+
t = 'data:enc;';
|
|
1228
|
+
isObject(e)
|
|
1229
|
+
? (e = t + rot13obfs(JSON.stringify(e)))
|
|
1230
|
+
: isString(e) && -1 === e.indexOf(t) && (e = t + rot13obfs(e)),
|
|
1231
|
+
sa.system_api.setStorageSync(sa.storageName, e);
|
|
1232
|
+
},
|
|
1233
|
+
save: function () {
|
|
1234
|
+
var e = deepCopy(this._state),
|
|
1235
|
+
t = rot13obfs(JSON.stringify(e.identities));
|
|
1236
|
+
if (((e.identities = t), delete e._first_id, delete e._distinct_id, sa.para.encrypt_storage)) {
|
|
1237
|
+
e = 'data:enc;' + rot13obfs(JSON.stringify(e));
|
|
1238
|
+
}
|
|
1239
|
+
sa.system_api.setStorageSync(sa.storageName, e);
|
|
1240
|
+
},
|
|
1241
|
+
init: function () {
|
|
1242
|
+
var e = this.getStorage(),
|
|
1243
|
+
t = getUUID();
|
|
1244
|
+
if (e)
|
|
1245
|
+
isString(e) &&
|
|
1246
|
+
-1 !== e.indexOf('data:enc;') &&
|
|
1247
|
+
((e = e.substring('data:enc;'.length)), (e = JSON.parse(rot13defs(e)))),
|
|
1248
|
+
this.toState(e);
|
|
1249
|
+
else {
|
|
1250
|
+
meta.is_first_launch = !0;
|
|
1251
|
+
var n = new Date(),
|
|
1252
|
+
s = n.getTime();
|
|
1253
|
+
n.setHours(23),
|
|
1254
|
+
n.setMinutes(59),
|
|
1255
|
+
n.setSeconds(60),
|
|
1256
|
+
this.set({
|
|
1257
|
+
distinct_id: t,
|
|
1258
|
+
first_visit_time: s,
|
|
1259
|
+
first_visit_day_time: n.getTime(),
|
|
1260
|
+
identities: { [IDENTITIES.identity_id]: t },
|
|
1261
|
+
history_login_id: { name: '', value: '' },
|
|
1262
|
+
}),
|
|
1263
|
+
sa.setOnceProfile({ $first_visit_time: n });
|
|
1264
|
+
}
|
|
1265
|
+
this.checkStoreInit && this.checkStoreInit();
|
|
1266
|
+
},
|
|
1267
|
+
};
|
|
1268
|
+
function identify(e, t) {
|
|
1269
|
+
if ((e = _.validId(e))) {
|
|
1270
|
+
var n = store.getFirstId();
|
|
1271
|
+
!0 === t
|
|
1272
|
+
? n
|
|
1273
|
+
? store.set('first_id', e)
|
|
1274
|
+
: store.set('distinct_id', e)
|
|
1275
|
+
: n
|
|
1276
|
+
? store.change('first_id', e)
|
|
1277
|
+
: store.change('distinct_id', e);
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
function trackSignup(e, t, n) {
|
|
1281
|
+
var s, r, a, i;
|
|
1282
|
+
_.isObject(e) ? ((s = e.id), (r = e.event_name), (a = e.id_name)) : ((s = e), (r = t)),
|
|
1283
|
+
store.set('distinct_id', s),
|
|
1284
|
+
(i = a && a !== IDENTITY_KEY.LOGIN ? a + '+' + s : s);
|
|
1285
|
+
var o = store.getFirstId() || store.getDistinctId();
|
|
1286
|
+
sa.prepareData({ original_id: o, distinct_id: i, type: 'track_signup', event: r, properties: n });
|
|
1287
|
+
}
|
|
1288
|
+
function bindWithoutCheck(e, t) {
|
|
1289
|
+
(store._state.identities[e] = t), store.save(), sa.prepareData({ type: 'track_id_bind', event: '$BindID' });
|
|
1290
|
+
}
|
|
1291
|
+
function bind$1(e, t) {
|
|
1292
|
+
var n = '';
|
|
1293
|
+
if (_.isNumber(t)) {
|
|
1294
|
+
if (_.isInteger(t) && !1 === _.isSafeInteger(t)) return sa.log('Value must be String'), !1;
|
|
1295
|
+
t = String(t);
|
|
1296
|
+
}
|
|
1297
|
+
if (!_.isString(e)) return sa.log('Key must be String'), !1;
|
|
1298
|
+
var s = store.getHistoryLoginId(),
|
|
1299
|
+
r = s ? s.name : '',
|
|
1300
|
+
a = [IDENTITY_KEY.LOGIN, r];
|
|
1301
|
+
return (
|
|
1302
|
+
_.isArray(IDENTITIES.bind_preset_id) && (a = [IDENTITY_KEY.LOGIN, r].concat(IDENTITIES.bind_preset_id)),
|
|
1303
|
+
!_.check.checkKeyword(e) || _.isPresetIdKeys(e, a)
|
|
1304
|
+
? ((n = 'Key [' + e + '] is invalid'), sa.log(n), !1)
|
|
1305
|
+
: t && '' !== t
|
|
1306
|
+
? _.isString(t)
|
|
1307
|
+
? !!_.check.checkIdLength(t) && void bindWithoutCheck(e, t)
|
|
1308
|
+
: (sa.log('Value must be String'), !1)
|
|
1309
|
+
: (sa.log('Value is empty or null'), !1)
|
|
1310
|
+
);
|
|
1311
|
+
}
|
|
1312
|
+
function unbindWithoutCheck(e, t) {
|
|
1313
|
+
hasOwnProperty.call(store._state.identities, e) &&
|
|
1314
|
+
t === store._state.identities[e] &&
|
|
1315
|
+
(IDENTITIES.unbind_without_check &&
|
|
1316
|
+
IDENTITIES.unbind_without_check.indexOf(e) < 0 &&
|
|
1317
|
+
delete store._state.identities[e],
|
|
1318
|
+
store.save());
|
|
1319
|
+
var n = store.getDistinctId(),
|
|
1320
|
+
s = store.getFirstId();
|
|
1321
|
+
n === e + '+' + t &&
|
|
1322
|
+
(store.set('first_id', ''), store.set('distinct_id', s), store.set('history_login_id', { name: '', value: '' }));
|
|
1323
|
+
var r = {};
|
|
1324
|
+
(r[e] = t), sa.prepareData({ type: 'track_id_unbind', event: '$UnbindID', unbind_value: r });
|
|
1325
|
+
}
|
|
1326
|
+
function unbind(e, t) {
|
|
1327
|
+
var n = '';
|
|
1328
|
+
if (_.isNumber(t)) {
|
|
1329
|
+
if (_.isInteger(t) && !1 === _.isSafeInteger(t)) return sa.log('Value must be String'), !1;
|
|
1330
|
+
t = String(t);
|
|
1331
|
+
}
|
|
1332
|
+
return _.isString(e)
|
|
1333
|
+
? !_.check.checkKeyword(e) || _.isPresetIdKeys(e, [IDENTITY_KEY.LOGIN])
|
|
1334
|
+
? ((n = 'Key [' + e + '] is invalid'), sa.log(n), !1)
|
|
1335
|
+
: t && '' !== t
|
|
1336
|
+
? _.isString(t)
|
|
1337
|
+
? !!_.check.checkIdLength(t) && void unbindWithoutCheck(e, t)
|
|
1338
|
+
: (sa.log('Value must be String'), !1)
|
|
1339
|
+
: (sa.log('Value is empty or null'), !1)
|
|
1340
|
+
: (sa.log('Key must be String'), !1);
|
|
1341
|
+
}
|
|
1342
|
+
function loginWithKey(e, t) {
|
|
1343
|
+
if (!_.isString(e)) return sa.log('Key must be String'), !1;
|
|
1344
|
+
var n = '';
|
|
1345
|
+
if (!_.check.checkKeyword(e) && e.length > 100) (n = 'Key [' + e + '] is invalid'), sa.log(n);
|
|
1346
|
+
else if (!_.check.checkKeyword(e)) return (n = 'Key [' + e + '] is invalid'), sa.log(n), !1;
|
|
1347
|
+
if (_.isPresetIdKeys(e, IDENTITIES.login_preset_id)) return (n = 'Key [' + e + '] is invalid'), sa.log(n), !1;
|
|
1348
|
+
if (!(t = _.validId(t))) return !1;
|
|
1349
|
+
if (_.isSameAndAnonymousID(t)) return !1;
|
|
1350
|
+
var s = store.getFirstId(),
|
|
1351
|
+
r = store.getDistinctId();
|
|
1352
|
+
_.isNewLoginId(e, t) &&
|
|
1353
|
+
((store._state.identities[e] = t),
|
|
1354
|
+
store.set('history_login_id', { name: e, value: t }),
|
|
1355
|
+
s || store.set('first_id', r),
|
|
1356
|
+
sa.trackSignup({ id: t, event_name: '$SignUp', id_name: e }),
|
|
1357
|
+
store.identitiesSet({ type: 'login', id: t, id_name: e }));
|
|
1358
|
+
}
|
|
1359
|
+
function login(e) {
|
|
1360
|
+
if (!(e = _.validId(e))) return !1;
|
|
1361
|
+
if (_.isSameAndAnonymousID(e)) return !1;
|
|
1362
|
+
var t = store.getFirstId(),
|
|
1363
|
+
n = store.getDistinctId(),
|
|
1364
|
+
s = IDENTITY_KEY.LOGIN;
|
|
1365
|
+
_.isNewLoginId(s, e) &&
|
|
1366
|
+
(store._state.identities && (store._state.identities[s] = e),
|
|
1367
|
+
store.set('history_login_id', { name: s, value: e }),
|
|
1368
|
+
t || store.set('first_id', n),
|
|
1369
|
+
sa.trackSignup({ id: e, event_name: '$SignUp' }),
|
|
1370
|
+
store.identitiesSet({ type: 'login', id: e, id_name: s }));
|
|
1371
|
+
}
|
|
1372
|
+
function logout() {
|
|
1373
|
+
var e = store.getFirstId();
|
|
1374
|
+
store.identitiesSet({ type: 'logout' }),
|
|
1375
|
+
store.set('history_login_id', { name: '', value: '' }),
|
|
1376
|
+
e
|
|
1377
|
+
? (store.set('first_id', ''), store.set('distinct_id', e))
|
|
1378
|
+
: sa.log('\u6ca1\u6709first_id\uff0clogout\u5931\u8d25');
|
|
1379
|
+
}
|
|
1380
|
+
function bindOpenid(e) {
|
|
1381
|
+
if (!(e = _.validId(e))) return !1;
|
|
1382
|
+
bind$1(_.getOpenidNameByAppid(IDENTITIES.openid_name), e);
|
|
1383
|
+
}
|
|
1384
|
+
function unbindOpenid(e) {
|
|
1385
|
+
if (!_.validId(e)) return !1;
|
|
1386
|
+
unbind(_.getOpenidNameByAppid(IDENTITIES.openid_name), e);
|
|
1387
|
+
}
|
|
1388
|
+
sa.store = store;
|
|
1389
|
+
var functions = Object.freeze({
|
|
1390
|
+
__proto__: null,
|
|
1391
|
+
identify: identify,
|
|
1392
|
+
trackSignup: trackSignup,
|
|
1393
|
+
bindWithoutCheck: bindWithoutCheck,
|
|
1394
|
+
bind: bind$1,
|
|
1395
|
+
unbindWithoutCheck: unbindWithoutCheck,
|
|
1396
|
+
unbind: unbind,
|
|
1397
|
+
loginWithKey: loginWithKey,
|
|
1398
|
+
login: login,
|
|
1399
|
+
logout: logout,
|
|
1400
|
+
bindOpenid: bindOpenid,
|
|
1401
|
+
unbindOpenid: unbindOpenid,
|
|
1402
|
+
});
|
|
1403
|
+
for (var f in functions) sa[f] = functions[f];
|
|
1404
|
+
function isValidListener(e) {
|
|
1405
|
+
return 'function' == typeof e || (!(!e || 'object' != typeof e) && isValidListener(e.listener));
|
|
1406
|
+
}
|
|
1407
|
+
(sa.getPresetProperties = getPresetProperties),
|
|
1408
|
+
(sa.getAnonymousID = getAnonymousID),
|
|
1409
|
+
(sa.getLocation = function () {
|
|
1410
|
+
my.getSetting({
|
|
1411
|
+
success: function (e) {
|
|
1412
|
+
if (!e.authSetting.location) return !1;
|
|
1413
|
+
my.getLocation({
|
|
1414
|
+
success: function (e) {
|
|
1415
|
+
sa.registerApp({ $latitude: e.latitude * Math.pow(10, 6), $longitude: e.longitude * Math.pow(10, 6) });
|
|
1416
|
+
},
|
|
1417
|
+
fail: function (e) {
|
|
1418
|
+
sa.log('\u83b7\u53d6\u4f4d\u7f6e\u5931\u8d25\uff1a', e);
|
|
1419
|
+
},
|
|
1420
|
+
});
|
|
1421
|
+
},
|
|
1422
|
+
});
|
|
1423
|
+
}),
|
|
1424
|
+
(sa.quick = function () {
|
|
1425
|
+
var e = arguments[0],
|
|
1426
|
+
t = arguments[1],
|
|
1427
|
+
n = arguments[2],
|
|
1428
|
+
s = _.isObject(n) ? n : {};
|
|
1429
|
+
'appLaunch' === e || 'appShow' === e
|
|
1430
|
+
? t
|
|
1431
|
+
? sa[e](t, s)
|
|
1432
|
+
: sa.log(
|
|
1433
|
+
'App\u7684launch\u548cshow\uff0c\u5728sensors.quick\u7b2c\u4e8c\u4e2a\u53c2\u6570\u5fc5\u987b\u4f20\u5165App\u7684options\u53c2\u6570'
|
|
1434
|
+
)
|
|
1435
|
+
: 'appHide' === e && ((s = _.isObject(t) ? t : {}), sa[e](s));
|
|
1436
|
+
});
|
|
1437
|
+
class EventEmitterBase {
|
|
1438
|
+
constructor() {
|
|
1439
|
+
this._events = {};
|
|
1440
|
+
}
|
|
1441
|
+
on(e, t) {
|
|
1442
|
+
if (!e || !t) return !1;
|
|
1443
|
+
if (!isValidListener(t)) throw new Error('listener must be a function');
|
|
1444
|
+
this._events[e] = this._events[e] || [];
|
|
1445
|
+
var n = 'object' == typeof t;
|
|
1446
|
+
return this._events[e].push(n ? t : { listener: t, once: !1 }), this;
|
|
1447
|
+
}
|
|
1448
|
+
prepend(e, t) {
|
|
1449
|
+
if (!e || !t) return !1;
|
|
1450
|
+
if (!isValidListener(t)) throw new Error('listener must be a function');
|
|
1451
|
+
this._events[e] = this._events[e] || [];
|
|
1452
|
+
var n = 'object' == typeof t;
|
|
1453
|
+
return this._events[e].unshift(n ? t : { listener: t, once: !1 }), this;
|
|
1454
|
+
}
|
|
1455
|
+
prependOnce(e, t) {
|
|
1456
|
+
return this.prepend(e, { listener: t, once: !0 });
|
|
1457
|
+
}
|
|
1458
|
+
once(e, t) {
|
|
1459
|
+
return this.on(e, { listener: t, once: !0 });
|
|
1460
|
+
}
|
|
1461
|
+
off(e, t) {
|
|
1462
|
+
var n = this._events[e];
|
|
1463
|
+
if (!n) return !1;
|
|
1464
|
+
if ('number' == typeof t) n.splice(t, 1);
|
|
1465
|
+
else if ('function' == typeof t)
|
|
1466
|
+
for (var s = 0, r = n.length; s < r; s++) n[s] && n[s].listener === t && n.splice(s, 1);
|
|
1467
|
+
return this;
|
|
1468
|
+
}
|
|
1469
|
+
emit(e, t) {
|
|
1470
|
+
var n = this._events[e];
|
|
1471
|
+
if (!n) return !1;
|
|
1472
|
+
for (var s = 0; s < n.length; s++) {
|
|
1473
|
+
var r = n[s];
|
|
1474
|
+
r && (r.listener.call(this, t || {}), r.once && this.off(e, s));
|
|
1475
|
+
}
|
|
1476
|
+
return this;
|
|
1477
|
+
}
|
|
1478
|
+
removeAllListeners(e) {
|
|
1479
|
+
e && this._events[e] ? (this._events[e] = []) : (this._events = {});
|
|
1480
|
+
}
|
|
1481
|
+
listeners(e) {
|
|
1482
|
+
return e && 'string' == typeof e ? this._events[e] : this._events;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
class EventEmitterEx extends EventEmitterBase {
|
|
1486
|
+
constructor() {
|
|
1487
|
+
super(), (this.cacheEvents = []), (this.maxLen = 20);
|
|
1488
|
+
}
|
|
1489
|
+
replay(e, t) {
|
|
1490
|
+
this.on(e, t),
|
|
1491
|
+
this.cacheEvents.length > 0 &&
|
|
1492
|
+
this.cacheEvents.forEach(function (n) {
|
|
1493
|
+
n.type === e && t.call(null, n.data);
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
emit(e, t) {
|
|
1497
|
+
super.emit.apply(this, arguments),
|
|
1498
|
+
this.cacheEvents.push({ type: e, data: t }),
|
|
1499
|
+
this.cacheEvents.length > this.maxLen && this.cacheEvents.shift();
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
var ee = {};
|
|
1503
|
+
(ee.sdk = new EventEmitterEx()), (ee.data = new EventEmitterEx());
|
|
1504
|
+
var eventEmitter = function () {
|
|
1505
|
+
this.sub = [];
|
|
1506
|
+
};
|
|
1507
|
+
eventEmitter.prototype = {
|
|
1508
|
+
add: function (e) {
|
|
1509
|
+
this.sub.push(e);
|
|
1510
|
+
},
|
|
1511
|
+
emit: function (e, t) {
|
|
1512
|
+
this.sub.forEach(function (n) {
|
|
1513
|
+
n.on(e, t);
|
|
1514
|
+
});
|
|
1515
|
+
},
|
|
1516
|
+
};
|
|
1517
|
+
var eventSub = function (e) {
|
|
1518
|
+
sa.events.add(this), (this._events = []), (this.handle = e), (this.ready = !1);
|
|
1519
|
+
};
|
|
1520
|
+
(eventSub.prototype = {
|
|
1521
|
+
on: function (e, t) {
|
|
1522
|
+
if (this.ready) {
|
|
1523
|
+
if (isFunction(this.handle))
|
|
1524
|
+
try {
|
|
1525
|
+
this.handle(e, t);
|
|
1526
|
+
} catch (e) {
|
|
1527
|
+
sa.log(e);
|
|
1528
|
+
}
|
|
1529
|
+
} else this._events.push({ event: e, data: t });
|
|
1530
|
+
},
|
|
1531
|
+
isReady: function () {
|
|
1532
|
+
var e = this;
|
|
1533
|
+
(e.ready = !0),
|
|
1534
|
+
e._events.forEach(function (t) {
|
|
1535
|
+
if (isFunction(e.handle))
|
|
1536
|
+
try {
|
|
1537
|
+
e.handle(t.event, t.data);
|
|
1538
|
+
} catch (e) {
|
|
1539
|
+
sa.log(e);
|
|
1540
|
+
}
|
|
1541
|
+
});
|
|
1542
|
+
},
|
|
1543
|
+
}),
|
|
1544
|
+
(sa.ee = ee),
|
|
1545
|
+
(sa.meta = meta),
|
|
1546
|
+
(sa.kit = kit),
|
|
1547
|
+
(sa.modules = {}),
|
|
1548
|
+
(sa.eventSub = eventSub),
|
|
1549
|
+
(sa.events = new eventEmitter()),
|
|
1550
|
+
(sa.init = function () {
|
|
1551
|
+
if (!0 === meta.hasExeInit) return !1;
|
|
1552
|
+
(meta.hasExeInit = !0),
|
|
1553
|
+
sa.store.init(),
|
|
1554
|
+
sa.system.init(),
|
|
1555
|
+
sa.para.batch_send &&
|
|
1556
|
+
(sa.system_api.getStorage('sensors_prepare_data', function (e) {
|
|
1557
|
+
var t = [];
|
|
1558
|
+
e && e.data && isArray(e.data) && ((t = e.data), (sa.batch_state.mem = t.concat(sa.batch_state.mem))),
|
|
1559
|
+
(sa.batch_state.syncStorage = !0);
|
|
1560
|
+
}),
|
|
1561
|
+
batchInterval());
|
|
1562
|
+
}),
|
|
1563
|
+
(sa.setPara = function (e) {
|
|
1564
|
+
sa.para = extend2Lev(sa.para, e);
|
|
1565
|
+
var t = [];
|
|
1566
|
+
if (isArray(sa.para.source_channel))
|
|
1567
|
+
for (var n = sa.para.source_channel.length, s = 0; s < n; s++)
|
|
1568
|
+
-1 === RESERVE_CHANNEL.indexOf(' ' + sa.para.source_channel[s] + ' ') && t.push(sa.para.source_channel[s]);
|
|
1569
|
+
(sa.para.source_channel = t), 'number' != typeof sa.para.send_timeout && (sa.para.send_timeout = 1e3);
|
|
1570
|
+
var r = { send_timeout: 6e3, max_length: 6 };
|
|
1571
|
+
(e && e.datasend_timeout) || (sa.para.batch_send && (sa.para.datasend_timeout = 1e4)),
|
|
1572
|
+
!0 === sa.para.batch_send
|
|
1573
|
+
? (sa.para.batch_send = extend({}, r))
|
|
1574
|
+
: isObject(sa.para.batch_send) && (sa.para.batch_send = extend({}, r, sa.para.batch_send)),
|
|
1575
|
+
sa.para.server_url
|
|
1576
|
+
? ((sa.para.preset_properties = isObject(sa.para.preset_properties) ? sa.para.preset_properties : {}),
|
|
1577
|
+
ee.sdk.emit('afterInitPara'))
|
|
1578
|
+
: sa.log(
|
|
1579
|
+
'\u8bf7\u4f7f\u7528 setPara() \u65b9\u6cd5\u8bbe\u7f6e server_url \u6570\u636e\u63a5\u6536\u5730\u5740,\u8be6\u60c5\u53ef\u67e5\u770bhttps://www.sensorsdata.cn/manual/mp_sdk_new.html#112-%E5%BC%95%E5%85%A5%E5%B9%B6%E9%85%8D%E7%BD%AE%E5%8F%82%E6%95%B0'
|
|
1580
|
+
);
|
|
1581
|
+
}),
|
|
1582
|
+
(sa.checkInit = function () {
|
|
1583
|
+
!0 === sa.system.inited &&
|
|
1584
|
+
!0 === sa.store.inited &&
|
|
1585
|
+
((sa.inited = !0),
|
|
1586
|
+
sa._queue.length > 0 &&
|
|
1587
|
+
(each(sa._queue, function (e) {
|
|
1588
|
+
sa[e[0]].apply(sa, slice.call(e[1]));
|
|
1589
|
+
}),
|
|
1590
|
+
(sa._queue = [])));
|
|
1591
|
+
}),
|
|
1592
|
+
each(
|
|
1593
|
+
['setProfile', 'setOnceProfile', 'track', 'login', 'logout', 'identify', 'registerApp', 'clearAppRegister'],
|
|
1594
|
+
function (e) {
|
|
1595
|
+
var t = sa[e];
|
|
1596
|
+
sa[e] = function () {
|
|
1597
|
+
sa.inited ? t.apply(sa, arguments) : sa._queue.push([e, arguments]);
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
);
|
|
1601
|
+
const forEach$1 = Array.prototype.forEach,
|
|
1602
|
+
slice$1 = Array.prototype.slice,
|
|
1603
|
+
_hasOwnProperty$1 = Object.prototype.hasOwnProperty,
|
|
1604
|
+
_toString$1 = Object.prototype.toString;
|
|
1605
|
+
function extend$1(e) {
|
|
1606
|
+
return (
|
|
1607
|
+
each$1(slice$1.call(arguments, 1), function (t) {
|
|
1608
|
+
for (var n in t) void 0 !== t[n] && (e[n] = t[n]);
|
|
1609
|
+
}),
|
|
1610
|
+
e
|
|
1611
|
+
);
|
|
1612
|
+
}
|
|
1613
|
+
function isObject$1(e) {
|
|
1614
|
+
return null !== e && 'object' == typeof e;
|
|
1615
|
+
}
|
|
1616
|
+
function isFunction$1(e) {
|
|
1617
|
+
if (!e) return !1;
|
|
1618
|
+
var t = Object.prototype.toString.call(e);
|
|
1619
|
+
return '[object Function]' == t || '[object AsyncFunction]' == t || '[object GeneratorFunction]' == t;
|
|
1620
|
+
}
|
|
1621
|
+
function isString$1(e) {
|
|
1622
|
+
return '[object String]' == _toString$1.call(e);
|
|
1623
|
+
}
|
|
1624
|
+
function each$1(e, t, n) {
|
|
1625
|
+
if (null == e) return !1;
|
|
1626
|
+
if (forEach$1 && e.forEach === forEach$1) e.forEach(t, n);
|
|
1627
|
+
else if (e.length === +e.length) {
|
|
1628
|
+
for (var s = 0, r = e.length; s < r; s++) if (s in e && t.call(n, e[s], s, e) === {}) return !1;
|
|
1629
|
+
} else for (var a in e) if (_hasOwnProperty$1.call(e, a) && t.call(n, e[a], a, e) === {}) return !1;
|
|
1630
|
+
}
|
|
1631
|
+
var global = {},
|
|
1632
|
+
lifeCycleHook = ['appOnLaunch', 'appOnShow', 'appOnHide', 'pageOnShow', 'pageOnLoad'],
|
|
1633
|
+
miniLifeCycleAPI = {};
|
|
1634
|
+
function registerLifeCycleHook(e) {
|
|
1635
|
+
Object.assign(miniLifeCycleAPI, e);
|
|
1636
|
+
}
|
|
1637
|
+
function getScene(e, t) {
|
|
1638
|
+
if (!isObject$1(t)) return !1;
|
|
1639
|
+
var n = t.meta.scene_prefix;
|
|
1640
|
+
return (
|
|
1641
|
+
!(!n || !isString$1(n)) &&
|
|
1642
|
+
('number' == typeof e || ('string' == typeof e && '' !== e) ? (e = n + String(e)) : '\u672a\u53d6\u5230\u503c')
|
|
1643
|
+
);
|
|
1644
|
+
}
|
|
1645
|
+
function hookFunc(e, t, n) {
|
|
1646
|
+
if (e[t] && isFunction$1(n)) {
|
|
1647
|
+
var s = e[t];
|
|
1648
|
+
e[t] = function (e) {
|
|
1649
|
+
n.call(this, e), s && isFunction$1(s) && s.call(this, e);
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
function hookAppFunc(e) {
|
|
1654
|
+
hookFunc(e, 'onLaunch', miniLifeCycleAPI.appOnLaunch),
|
|
1655
|
+
hookFunc(e, 'onShow', miniLifeCycleAPI.appOnShow),
|
|
1656
|
+
hookFunc(e, 'onHide', miniLifeCycleAPI.appOnHide);
|
|
1657
|
+
}
|
|
1658
|
+
function proxyApp(e, t) {
|
|
1659
|
+
function n(e) {
|
|
1660
|
+
var n = App;
|
|
1661
|
+
App = function (s) {
|
|
1662
|
+
try {
|
|
1663
|
+
e && e(s), (s[t.para.name] = t), n.apply(this, arguments);
|
|
1664
|
+
} catch (e) {
|
|
1665
|
+
n.apply(this, arguments), global.sensors.log('App:' + e);
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
isObject$1(t) && isFunction$1(t.platform_obj.onAppShow) && isFunction$1(t.platform_obj.onAppHide)
|
|
1670
|
+
? (n(),
|
|
1671
|
+
t.platform_obj.onAppShow(function (e) {
|
|
1672
|
+
if (!t.para.launched && isFunction$1(t.platform_obj.getLaunchOptionsSync)) {
|
|
1673
|
+
var n = t.platform_obj.getLaunchOptionsSync() || {};
|
|
1674
|
+
miniLifeCycleAPI.appOnLaunch(n), (t.para.launched = !0);
|
|
1675
|
+
}
|
|
1676
|
+
miniLifeCycleAPI.appOnShow(e);
|
|
1677
|
+
}),
|
|
1678
|
+
t.platform_obj.onAppHide(function () {
|
|
1679
|
+
miniLifeCycleAPI.appOnHide();
|
|
1680
|
+
}))
|
|
1681
|
+
: n(e);
|
|
1682
|
+
}
|
|
1683
|
+
function getPath(e) {
|
|
1684
|
+
return (e = isString$1(e) ? e.replace(/^\//, '') : '\u53d6\u503c\u5f02\u5e38');
|
|
1685
|
+
}
|
|
1686
|
+
function getCurrentPath$1(e) {
|
|
1687
|
+
var t = '\u672a\u53d6\u5230',
|
|
1688
|
+
n = getCurrentPage$1(e);
|
|
1689
|
+
return n && n.route && (t = n.route), t;
|
|
1690
|
+
}
|
|
1691
|
+
function getCurrentPage$1(e) {
|
|
1692
|
+
var t,
|
|
1693
|
+
n = {};
|
|
1694
|
+
if (e)
|
|
1695
|
+
try {
|
|
1696
|
+
n = (t = isFunction$1(e.platform_obj.getCurrentPages) ? e.platform_obj.getCurrentPages() : getCurrentPages())[
|
|
1697
|
+
t.length - 1
|
|
1698
|
+
];
|
|
1699
|
+
} catch (t) {
|
|
1700
|
+
e.log(t);
|
|
1701
|
+
}
|
|
1702
|
+
else console.log('getCurrentPage:\u8bf7\u4f20\u5165 sa \u5bf9\u8c61');
|
|
1703
|
+
return n;
|
|
1704
|
+
}
|
|
1705
|
+
function appOnLaunch(e, t) {
|
|
1706
|
+
if (isObject$1(e)) {
|
|
1707
|
+
var n = {};
|
|
1708
|
+
if ((e && e.path && (n.$url_path = getPath(e.path)), e && e.scene)) {
|
|
1709
|
+
var s = getScene(e.scene, global.sensors);
|
|
1710
|
+
s && ((n.$scene = s), (global.sensors.meta.current_scene = s), global.sensors.registerApp({ $latest_scene: s }));
|
|
1711
|
+
} else n.$scene = '\u672a\u53d6\u5230\u503c';
|
|
1712
|
+
var r = global.sensors._.setUtm(e, n);
|
|
1713
|
+
global.sensors.meta.is_first_launch
|
|
1714
|
+
? ((n.$is_first_time = !0), global.sensors._.isEmptyObject(r.pre1) || global.sensors.setOnceProfile(r.pre1))
|
|
1715
|
+
: (n.$is_first_time = !1),
|
|
1716
|
+
global.sensors._.isEmptyObject(r.pre2) || global.sensors._.setLatestChannel(r.pre2),
|
|
1717
|
+
(n.$url_query = global.sensors._.setQuery(e.query)),
|
|
1718
|
+
isObject$1(t) && (n = extend$1(n, t)),
|
|
1719
|
+
global.sensors.para &&
|
|
1720
|
+
global.sensors.para.autoTrack &&
|
|
1721
|
+
global.sensors.para.autoTrack.appLaunch &&
|
|
1722
|
+
global.sensors.track('$MPLaunch', n);
|
|
1723
|
+
} else global.sensors.log('appOnLaunch:\u8bf7\u4f20\u5165\u6b63\u786e\u7684\u53c2\u6570');
|
|
1724
|
+
}
|
|
1725
|
+
function appOnShow(e, t) {
|
|
1726
|
+
var n = {};
|
|
1727
|
+
(global.sensors.meta.mp_show_time = new Date().getTime()), e && e.path && (n.$url_path = getPath(e.path));
|
|
1728
|
+
var s = global.sensors._.setUtm(e, n);
|
|
1729
|
+
if (
|
|
1730
|
+
(global.sensors._.isEmptyObject(s.pre2) || global.sensors._.setLatestChannel(s.pre2),
|
|
1731
|
+
(n.$url_query = global.sensors._.setQuery(e.query)),
|
|
1732
|
+
e && e.scene)
|
|
1733
|
+
) {
|
|
1734
|
+
var r = getScene(e.scene, global.sensors);
|
|
1735
|
+
r && ((n.$scene = r), global.sensors.registerApp({ $latest_scene: r }));
|
|
1736
|
+
}
|
|
1737
|
+
isObject$1(t) && (n = extend$1(n, t)),
|
|
1738
|
+
global.sensors.para &&
|
|
1739
|
+
global.sensors.para.autoTrack &&
|
|
1740
|
+
global.sensors.para.autoTrack.appShow &&
|
|
1741
|
+
global.sensors.track('$MPShow', n);
|
|
1742
|
+
}
|
|
1743
|
+
function appOnHide(e, t = !0) {
|
|
1744
|
+
var n = new Date().getTime(),
|
|
1745
|
+
s = {};
|
|
1746
|
+
isObject$1(e) && (s = extend$1(s, e)), (s.$url_path = getCurrentPath$1(global.sensors));
|
|
1747
|
+
var r = global.sensors.meta.mp_show_time;
|
|
1748
|
+
r && n - r > 0 && (n - r) / 36e5 < 24 && (s.event_duration = (n - r) / 1e3),
|
|
1749
|
+
(!t || (global.sensors.para && global.sensors.para.autoTrack && global.sensors.para.autoTrack.appHide)) &&
|
|
1750
|
+
global.sensors.track('$MPHide', s);
|
|
1751
|
+
}
|
|
1752
|
+
lifeCycleHook.forEach(function (e) {
|
|
1753
|
+
miniLifeCycleAPI[e] = function () {
|
|
1754
|
+
throw new Error(`\u9700\u8981\u5148\u5b9a\u4e49 '${e}' \u624d\u80fd\u4f7f\u7528`);
|
|
1755
|
+
};
|
|
1756
|
+
});
|
|
1757
|
+
var presetEvents = { appLaunch: !0, appShow: !0, appHide: !0 },
|
|
1758
|
+
AutoTrackApp = { name: 'AutoTrackApp' };
|
|
1759
|
+
function getMixedQuery$1(e) {
|
|
1760
|
+
var t = {};
|
|
1761
|
+
if (
|
|
1762
|
+
(e &&
|
|
1763
|
+
global.sensors._.isObject(e.query) &&
|
|
1764
|
+
((t = global.sensors._.extend({}, e.query)),
|
|
1765
|
+
e.query.qrCode &&
|
|
1766
|
+
global.sensors._.extend(
|
|
1767
|
+
t,
|
|
1768
|
+
global.sensors._.getObjFromQuery(global.sensors._.decodeURIComponent(e.query.qrCode))
|
|
1769
|
+
)),
|
|
1770
|
+
e && global.sensors._.isObject(e.referrerInfo) && e.referrerInfo.extraData)
|
|
1771
|
+
) {
|
|
1772
|
+
var n = {};
|
|
1773
|
+
global.sensors._.isObject(e.referrerInfo.extraData) && !global.sensors._.isEmptyObject(e.referrerInfo.extraData)
|
|
1774
|
+
? (n = e.referrerInfo.extraData)
|
|
1775
|
+
: global.sensors._.isJSONString(e.referrerInfo.extraData) && (n = JSON.parse(e.referrerInfo.extraData)),
|
|
1776
|
+
global.sensors._.extend(t, n);
|
|
1777
|
+
}
|
|
1778
|
+
return t;
|
|
1779
|
+
}
|
|
1780
|
+
function setUtm$1(e, t) {
|
|
1781
|
+
var n = {},
|
|
1782
|
+
s = getMixedQuery$1(e),
|
|
1783
|
+
r = global.sensors._.getCustomUtmFromQuery(s, '$', '_', '$'),
|
|
1784
|
+
a = global.sensors._.getCustomUtmFromQuery(s, '$latest_', '_latest_', '$latest_');
|
|
1785
|
+
return (n.pre1 = r), (n.pre2 = a), global.sensors._.extend(t, r), n;
|
|
1786
|
+
}
|
|
1787
|
+
function appOnLaunch$1(e, t, n = !0) {
|
|
1788
|
+
if (isObject$1(e)) {
|
|
1789
|
+
var s = {};
|
|
1790
|
+
if ((e && e.path && (s.$url_path = getPath(e.path)), e && e.scene)) {
|
|
1791
|
+
var r = getScene(e.scene, global.sensors);
|
|
1792
|
+
r && ((s.$scene = r), (global.sensors.meta.current_scene = r), global.sensors.registerApp({ $latest_scene: r }));
|
|
1793
|
+
} else s.$scene = '\u672a\u53d6\u5230\u503c';
|
|
1794
|
+
var a = global.sensors.para && global.sensors.para.autoTrack && global.sensors.para.autoTrack.appLaunch;
|
|
1795
|
+
!0 === global.sensors.para.preset_properties.location && global.sensors.getLocation();
|
|
1796
|
+
var i = setUtm$1(e, s);
|
|
1797
|
+
global.sensors.meta.is_first_launch
|
|
1798
|
+
? ((s.$is_first_time = !0),
|
|
1799
|
+
global.sensors._.isEmptyObject(i.pre1) || (n && !a) || global.sensors.setOnceProfile(i.pre1))
|
|
1800
|
+
: (s.$is_first_time = !1),
|
|
1801
|
+
global.sensors._.isEmptyObject(i.pre2) || global.sensors._.setLatestChannel(i.pre2),
|
|
1802
|
+
(s.$url_query = global.sensors._.setQuery(e.query)),
|
|
1803
|
+
isObject$1(t) && (s = extend$1(s, t)),
|
|
1804
|
+
(n && !a) || global.sensors.track('$MPLaunch', s);
|
|
1805
|
+
} else global.sensors.log('appOnLaunch:\u8bf7\u4f20\u5165\u6b63\u786e\u7684\u53c2\u6570');
|
|
1806
|
+
}
|
|
1807
|
+
function appOnShow$1(e, t, n = !0) {
|
|
1808
|
+
var s = {};
|
|
1809
|
+
(global.sensors.meta.mp_show_time = new Date().getTime()), e && e.path && (s.$url_path = getPath(e.path));
|
|
1810
|
+
var r = setUtm$1(e, s);
|
|
1811
|
+
if (
|
|
1812
|
+
(global.sensors._.isEmptyObject(r.pre2) || global.sensors._.setLatestChannel(r.pre2),
|
|
1813
|
+
!0 === global.sensors.para.preset_properties.location && global.sensors.getLocation(),
|
|
1814
|
+
(s.$url_query = global.sensors._.setQuery(e.query)),
|
|
1815
|
+
e && e.scene)
|
|
1816
|
+
) {
|
|
1817
|
+
var a = getScene(e.scene, global.sensors);
|
|
1818
|
+
a && ((s.$scene = a), global.sensors.registerApp({ $latest_scene: a }));
|
|
1819
|
+
}
|
|
1820
|
+
isObject$1(t) && (s = extend$1(s, t)),
|
|
1821
|
+
(!n || (global.sensors.para && global.sensors.para.autoTrack && global.sensors.para.autoTrack.appShow)) &&
|
|
1822
|
+
global.sensors.track('$MPShow', s);
|
|
1823
|
+
}
|
|
1824
|
+
(AutoTrackApp.init = function (e, t) {
|
|
1825
|
+
if (!e)
|
|
1826
|
+
return (
|
|
1827
|
+
console.log('\u8bf7\u6b63\u786e\u521d\u59cb\u5316 sensorsdata\uff0c\u624d\u80fd\u4f7f\u7528\u63d2\u4ef6'), !1
|
|
1828
|
+
);
|
|
1829
|
+
(global.sensors = e),
|
|
1830
|
+
(global.sensors.para.autoTrack = extend$1(presetEvents, t)),
|
|
1831
|
+
AutoTrackApp.lifeCycleAPI(),
|
|
1832
|
+
AutoTrackApp.proxyFrameworkInterface();
|
|
1833
|
+
}),
|
|
1834
|
+
(AutoTrackApp.lifeCycleAPI = function () {
|
|
1835
|
+
var e = {};
|
|
1836
|
+
(e.appOnLaunch = appOnLaunch), (e.appOnShow = appOnShow), (e.appOnHide = appOnHide), registerLifeCycleHook(e);
|
|
1837
|
+
}),
|
|
1838
|
+
(AutoTrackApp.proxyFrameworkInterface = function () {
|
|
1839
|
+
proxyApp(hookAppFunc, global.sensors);
|
|
1840
|
+
}),
|
|
1841
|
+
(AutoTrackApp.lifeCycleAPI = function () {
|
|
1842
|
+
var e = {};
|
|
1843
|
+
(e.appOnLaunch = appOnLaunch$1), (e.appOnShow = appOnShow$1), (e.appOnHide = appOnHide), registerLifeCycleHook(e);
|
|
1844
|
+
});
|
|
1845
|
+
var global$1 = {};
|
|
1846
|
+
function isClick(e) {
|
|
1847
|
+
return !!{ tap: 1, longtap: 1, longpress: 1 }[e];
|
|
1848
|
+
}
|
|
1849
|
+
function createClickData(e) {
|
|
1850
|
+
var t = {},
|
|
1851
|
+
n = {},
|
|
1852
|
+
s = e.currentTarget || {},
|
|
1853
|
+
r = s.dataset || {};
|
|
1854
|
+
return (
|
|
1855
|
+
(t.$element_id = s.id),
|
|
1856
|
+
(t.$element_type = r.type),
|
|
1857
|
+
(t.$element_content = r.content),
|
|
1858
|
+
(t.$element_name = r.name),
|
|
1859
|
+
isObject$1(e.event_prop) && (n = e.event_prop),
|
|
1860
|
+
(t.$url_path = getCurrentPath$1(global$1.sensors)),
|
|
1861
|
+
(t = extend$1(t, n))
|
|
1862
|
+
);
|
|
1863
|
+
}
|
|
1864
|
+
var ClickTrack = {
|
|
1865
|
+
track: function (e) {
|
|
1866
|
+
var t = createClickData(e),
|
|
1867
|
+
n = e.currentTarget || {},
|
|
1868
|
+
s = e.target || {},
|
|
1869
|
+
r = e.type,
|
|
1870
|
+
a = global$1.sensors.para;
|
|
1871
|
+
if (
|
|
1872
|
+
isObject$1(a.framework) &&
|
|
1873
|
+
isObject$1(a.framework.taro) &&
|
|
1874
|
+
!a.framework.taro.createApp &&
|
|
1875
|
+
s.id &&
|
|
1876
|
+
n.id &&
|
|
1877
|
+
s.id !== n.id
|
|
1878
|
+
)
|
|
1879
|
+
return !1;
|
|
1880
|
+
if (isObject$1(t) && r && isClick(r)) {
|
|
1881
|
+
if (a.preset_events && a.preset_events.collect_element && !1 === a.preset_events.collect_element(arguments[0]))
|
|
1882
|
+
return !1;
|
|
1883
|
+
global$1.sensors.track('$MPClick', t);
|
|
1884
|
+
}
|
|
1885
|
+
},
|
|
1886
|
+
},
|
|
1887
|
+
MP_HOOKS = {
|
|
1888
|
+
data: 1,
|
|
1889
|
+
onLoad: 1,
|
|
1890
|
+
onShow: 1,
|
|
1891
|
+
onReady: 1,
|
|
1892
|
+
onPullDownRefresh: 1,
|
|
1893
|
+
onReachBottom: 1,
|
|
1894
|
+
onShareAppMessage: 1,
|
|
1895
|
+
onPageScroll: 1,
|
|
1896
|
+
onResize: 1,
|
|
1897
|
+
onTabItemTap: 1,
|
|
1898
|
+
onHide: 1,
|
|
1899
|
+
onUnload: 1,
|
|
1900
|
+
};
|
|
1901
|
+
function clickProxy(e, t) {
|
|
1902
|
+
var n = e[t];
|
|
1903
|
+
e[t] = function () {
|
|
1904
|
+
var e = n.apply(this, arguments),
|
|
1905
|
+
t = arguments[0];
|
|
1906
|
+
return isObject$1(t) && ClickTrack.track(t), e;
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1909
|
+
function monitorClick(e) {
|
|
1910
|
+
var t = [],
|
|
1911
|
+
n = global$1.sensors.para.autoTrack;
|
|
1912
|
+
if (n && n.mpClick) {
|
|
1913
|
+
(t = getMethods(e)), tabProxy(e);
|
|
1914
|
+
for (var s = t.length, r = 0; r < s; r++) clickProxy(e, t[r]);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function tabProxy(e) {
|
|
1918
|
+
var t = e.onTabItemTap;
|
|
1919
|
+
e.onTabItemTap = function (e) {
|
|
1920
|
+
t && t.apply(this, arguments);
|
|
1921
|
+
var n = {};
|
|
1922
|
+
e && (n.$element_content = e.text || ''),
|
|
1923
|
+
(n.$element_type = 'tabBar'),
|
|
1924
|
+
(n.$url_path = e.pagePath ? e.pagePath : global$1.sensors._.getCurrentPath()),
|
|
1925
|
+
global$1.sensors.track('$MPClick', n);
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
function getMethods(e) {
|
|
1929
|
+
var t = [];
|
|
1930
|
+
for (var n in e) 'function' != typeof e[n] || MP_HOOKS[n] || t.push(n);
|
|
1931
|
+
return t;
|
|
1932
|
+
}
|
|
1933
|
+
function hookPageFunc(e) {
|
|
1934
|
+
hookFunc(e, 'onShow', miniLifeCycleAPI.pageOnShow),
|
|
1935
|
+
hookFunc(e, 'onLoad', miniLifeCycleAPI.pageOnLoad),
|
|
1936
|
+
hookFunc(e, 'onUnload', miniLifeCycleAPI.pageOnUnload),
|
|
1937
|
+
hookFunc(e, 'onHide', miniLifeCycleAPI.pageOnHide);
|
|
1938
|
+
}
|
|
1939
|
+
function proxyPage(e, t) {
|
|
1940
|
+
var n = Page;
|
|
1941
|
+
Page = function (s) {
|
|
1942
|
+
try {
|
|
1943
|
+
s || (s = {}), isFunction$1(e) && e(s), isFunction$1(t) && t(s), n.apply(this, arguments);
|
|
1944
|
+
} catch (e) {
|
|
1945
|
+
n.apply(this, arguments), console.log('Page:' + e);
|
|
1946
|
+
}
|
|
1947
|
+
};
|
|
1948
|
+
var s = Component;
|
|
1949
|
+
Component = function (n) {
|
|
1950
|
+
try {
|
|
1951
|
+
n || (n = {}),
|
|
1952
|
+
n.methods || (n.methods = {}),
|
|
1953
|
+
isFunction$1(e) && e(n.methods),
|
|
1954
|
+
isFunction$1(t) && t(n.methods),
|
|
1955
|
+
s.apply(this, arguments);
|
|
1956
|
+
} catch (e) {
|
|
1957
|
+
s.apply(this, arguments), console.log('Component:' + e);
|
|
1958
|
+
}
|
|
1959
|
+
};
|
|
1960
|
+
}
|
|
1961
|
+
var pageLeave = function () {
|
|
1962
|
+
if (global$1.sensors.para.autoTrack && global$1.sensors.para.autoTrack.pageLeave) {
|
|
1963
|
+
var e = {},
|
|
1964
|
+
t = '';
|
|
1965
|
+
try {
|
|
1966
|
+
t = (e = getCurrentPage$1(global$1.sensors)) ? e.route : '';
|
|
1967
|
+
} catch (e) {
|
|
1968
|
+
global$1.sensors.log(e);
|
|
1969
|
+
}
|
|
1970
|
+
if (global$1.sensors.meta.page_show_time >= 0 && '' !== t) {
|
|
1971
|
+
var n = {},
|
|
1972
|
+
s = (Date.now() - global$1.sensors.meta.page_show_time) / 1e3;
|
|
1973
|
+
(isNaN(s) || s < 0) && (s = 0),
|
|
1974
|
+
(n.$url_query = e.sensors_mp_url_query ? e.sensors_mp_url_query : ''),
|
|
1975
|
+
(n.$url_path = t),
|
|
1976
|
+
(n.event_duration = s),
|
|
1977
|
+
global$1.sensors.track('$MPPageLeave', n),
|
|
1978
|
+
(global$1.sensors.meta.page_show_time = -1);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
function pageOnLoad(e) {
|
|
1983
|
+
var t = this;
|
|
1984
|
+
if (global$1.sensors._.isObject(e)) {
|
|
1985
|
+
try {
|
|
1986
|
+
t = getCurrentPage$1(global$1.sensors);
|
|
1987
|
+
} catch (e) {
|
|
1988
|
+
global$1.sensors.log('pageOnLoad:' + e);
|
|
1989
|
+
}
|
|
1990
|
+
(t.sensors_mp_url_query = global$1.sensors._.setQuery(e)),
|
|
1991
|
+
(t.sensors_mp_encode_url_query = global$1.sensors._.setQuery(e, !0));
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
function pageOnShow(e, t = !0) {
|
|
1995
|
+
global$1.sensors.meta.page_show_time = Date.now();
|
|
1996
|
+
var n = {},
|
|
1997
|
+
s = '';
|
|
1998
|
+
try {
|
|
1999
|
+
var r = getCurrentPage$1(global$1.sensors);
|
|
2000
|
+
s = r ? r.route : '';
|
|
2001
|
+
} catch (e) {
|
|
2002
|
+
global$1.sensors.log('pageOnShow:' + e);
|
|
2003
|
+
}
|
|
2004
|
+
r && (n.$url_query = r.sensors_mp_url_query ? r.sensors_mp_url_query : ''),
|
|
2005
|
+
(n.$url_path = s),
|
|
2006
|
+
(n.$referrer = global$1.sensors.meta.sa_referrer),
|
|
2007
|
+
isObject$1(e) && (n = extend$1(n, e)),
|
|
2008
|
+
(!t || (global$1.sensors.para && global$1.sensors.para.autoTrack && global$1.sensors.para.autoTrack.pageShow)) &&
|
|
2009
|
+
global$1.sensors.track('$MPViewScreen', n),
|
|
2010
|
+
(global$1.sensors.meta.sa_referrer = s);
|
|
2011
|
+
}
|
|
2012
|
+
function pageOnUnload() {
|
|
2013
|
+
pageLeave();
|
|
2014
|
+
}
|
|
2015
|
+
function pageOnHide() {
|
|
2016
|
+
pageLeave();
|
|
2017
|
+
}
|
|
2018
|
+
var presetEvents$1 = { pageShow: !0, mpClick: !0, pageLeave: !1 },
|
|
2019
|
+
AutoTrackPage = {
|
|
2020
|
+
name: 'AutoTrackPage',
|
|
2021
|
+
init: function (e, t) {
|
|
2022
|
+
if (!e)
|
|
2023
|
+
return (
|
|
2024
|
+
console.log('\u8bf7\u6b63\u786e\u521d\u59cb\u5316 sensorsdata\uff0c\u624d\u80fd\u4f7f\u7528\u63d2\u4ef6'), !1
|
|
2025
|
+
);
|
|
2026
|
+
(global$1.sensors = e),
|
|
2027
|
+
(global$1.sensors.para.autoTrack = extend$1(presetEvents$1, t)),
|
|
2028
|
+
AutoTrackPage.lifeCycleAPI(),
|
|
2029
|
+
AutoTrackPage.proxyFrameworkInterface();
|
|
2030
|
+
},
|
|
2031
|
+
lifeCycleAPI: function () {
|
|
2032
|
+
var e = {};
|
|
2033
|
+
(e.pageOnShow = pageOnShow),
|
|
2034
|
+
(e.pageOnLoad = pageOnLoad),
|
|
2035
|
+
(e.pageOnUnload = pageOnUnload),
|
|
2036
|
+
(e.pageOnHide = pageOnHide),
|
|
2037
|
+
registerLifeCycleHook(e);
|
|
2038
|
+
},
|
|
2039
|
+
proxyFrameworkInterface: function () {
|
|
2040
|
+
proxyPage(hookPageFunc, monitorClick);
|
|
2041
|
+
},
|
|
2042
|
+
},
|
|
2043
|
+
presetEvents$2 = { appLaunch: !0, appShow: !0, appHide: !0, pageShow: !0, mpClick: !0, pageLeave: !1 },
|
|
2044
|
+
AutoTrack = {
|
|
2045
|
+
name: 'AutoTrack',
|
|
2046
|
+
init: function (e, t) {
|
|
2047
|
+
if (!e)
|
|
2048
|
+
return (
|
|
2049
|
+
console.log('\u8bf7\u6b63\u786e\u521d\u59cb\u5316 sensorsdata\uff0c\u624d\u80fd\u4f7f\u7528\u63d2\u4ef6'), !1
|
|
2050
|
+
);
|
|
2051
|
+
e.ee.sdk.on('afterInitPara', function () {
|
|
2052
|
+
var n = extend$1(presetEvents$2, e.para.autoTrack, t);
|
|
2053
|
+
e.use(AutoTrackApp, n),
|
|
2054
|
+
e.use(AutoTrackPage, n),
|
|
2055
|
+
(e.appLaunch = miniLifeCycleAPI.appOnLaunch),
|
|
2056
|
+
(e.appShow = miniLifeCycleAPI.appOnShow),
|
|
2057
|
+
(e.appHide = miniLifeCycleAPI.appOnHide),
|
|
2058
|
+
(e.pageShow = miniLifeCycleAPI.pageOnShow),
|
|
2059
|
+
(e.pageLoad = miniLifeCycleAPI.pageOnLoad);
|
|
2060
|
+
});
|
|
2061
|
+
},
|
|
2062
|
+
};
|
|
2063
|
+
(sa.platform_obj = my),
|
|
2064
|
+
(sa._ = _),
|
|
2065
|
+
(sa.system = system),
|
|
2066
|
+
(sa.system_api = Object.assign(compose, compose$1, compose$2)),
|
|
2067
|
+
(sa.lib.name = 'AlipayMini'),
|
|
2068
|
+
(sa.properties.$lib = 'AlipayMini'),
|
|
2069
|
+
(sa.storageName = 'sensorsdata2015_zfb'),
|
|
2070
|
+
(sa.meta.scene_prefix = 'ali-'),
|
|
2071
|
+
sa.use(AutoTrack);
|
|
2072
|
+
export default sa;
|