visual-buried-point-platform-uni 1.0.0-alpha.9 → 2.0.1-alpha.1
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 +36 -36
- package/dist/cjs/buried-point-uni.js +1 -0
- package/dist/esm/buried-point-uni.js +1 -0
- package/dist/umd/buried-point-uni.js +1 -0
- package/package.json +22 -7
- package/bpstorage.js +0 -29
- package/cache.js +0 -28
- package/config.js +0 -25
- package/index.js +0 -305
- package/lsi-md5.js +0 -20
- package/tools.js +0 -198
- package/webpack.config.js +0 -17
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
##
|
|
1
|
+
## 微信小程序及uni端埋点SDK集成文档
|
|
2
2
|
|
|
3
3
|
### SDK更新日志
|
|
4
|
-
-
|
|
5
|
-
-
|
|
4
|
+
- v1.0.0-alpha.07 最新uni、终端通用埋点sdk;
|
|
5
|
+
- v1.0.0-alpha.08 自定义上报数据结构删除path字段;
|
|
6
|
+
- v1.0.0-alpha.35 调整SDK内部PVUV采集模式,分原有start方法采集及自动采集,支持获取埋点sdk内的跟踪id;
|
|
7
|
+
- v2.0.0 调整SDK内部PVUV采集模式,分原有start方法采集及自动采集,支持获取埋点sdk内的跟踪ID;
|
|
6
8
|
|
|
7
9
|
### 1、引入方式
|
|
8
10
|
|
|
@@ -20,7 +22,9 @@ onLaunch: function() {
|
|
|
20
22
|
init({
|
|
21
23
|
env: 'test', //环境变量 test production
|
|
22
24
|
token: '3212414516342554624', //热果平台-可视化埋点管理端-创建对应的项目生成.
|
|
23
|
-
|
|
25
|
+
domain: 'com.gzdzswy.onetravel', // 必填,访问来源域名,取优先级:单次调用上报值 > 全局初始化值
|
|
26
|
+
isCompatible: true, // 是否兼容老方案埋点,默认兼容true
|
|
27
|
+
signTrackArray: [], // 自动采集但需要单独埋点的页面path
|
|
24
28
|
})
|
|
25
29
|
}
|
|
26
30
|
});
|
|
@@ -42,17 +46,23 @@ import { setUserId } from 'visual-buried-point-platform-uni'
|
|
|
42
46
|
setUserId(123456);
|
|
43
47
|
```
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
**注:为保持数据统计精确,在退出登录的时候调用一次清空:**
|
|
46
50
|
|
|
47
51
|
```js
|
|
48
52
|
setUserId("");
|
|
49
53
|
```
|
|
54
|
+
## 4.获取埋点SDK内跟踪ID
|
|
50
55
|
|
|
51
|
-
|
|
56
|
+
```js
|
|
57
|
+
import { getTrackId } from 'visual-buried-point-platform-uni'
|
|
58
|
+
getTrackId()
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 5、自定义事件上报
|
|
52
62
|
|
|
53
63
|
- sdk初始化后,可通过 ***setCustomEvent()*** 方法上报自定义埋点事件,并为事件添加属性值:
|
|
54
64
|
|
|
55
|
-
####
|
|
65
|
+
#### 5.1 事件类型:
|
|
56
66
|
|
|
57
67
|
- 仅能选择埋点提供的事件类型,各事件类型的触发、上报由各业务平台埋点自行确认。事件类型如下:
|
|
58
68
|
- **搜索事件【 search 】**
|
|
@@ -73,6 +83,7 @@ setCustomEvent(data)
|
|
|
73
83
|
| $extend_param | 否 | 扩展字段,建议根据业务需求填上 |
|
|
74
84
|
| $busSegment | 否 | 业务板块 【表1】各自业务板块 |
|
|
75
85
|
| $module | 否 | 业务模块【表1】各自业务模块 |
|
|
86
|
+
| $event_code | 是 | 对应创建的事件标识符 |
|
|
76
87
|
|
|
77
88
|
表1
|
|
78
89
|
|
|
@@ -95,36 +106,34 @@ data: JSON字符串
|
|
|
95
106
|
$extend_param: 扩展参数(JSON字符串) 【非必填字段,建议根据业务需求填上】
|
|
96
107
|
$busSegment: 业务板块 【非必填字段,建议业务填上, 否则数据统计可能出现缺失】
|
|
97
108
|
$module: 业务模块 【非必填字段,建议根据业务填上, 否则数据统计可能出现缺失】
|
|
98
|
-
$
|
|
109
|
+
$event_code: 渠道推广编码 【非必填字段,建议根据业务填上, 否则数据统计可能出现缺失】
|
|
99
110
|
$duration: 停留时长 【非必填字段】
|
|
100
111
|
$event_code: 事件标识符 【必填字段,建议根据业务填上, 否则数据统计可能出现缺失】
|
|
101
112
|
$page: 当前页对象 【非必填字段,建议根据业务填上, 否则数据统计可能出现缺失】
|
|
102
|
-
$path: 埋点组件的路径 【必填字段,建议根据业务填上, 否则数据统计可能出现缺失】
|
|
103
113
|
}
|
|
114
|
+
import { setCustomEvent } from 'visual-buried-point-platform-uni'
|
|
104
115
|
// 参考:【点击事件】
|
|
105
116
|
const params = {
|
|
106
117
|
$event_id: "3213106620739878912",
|
|
118
|
+
$event_code: "2139oNf0te6kf0DvltL",
|
|
107
119
|
$busSegment: 1,
|
|
108
120
|
$module: 1,
|
|
109
|
-
$ctk: "",
|
|
110
121
|
$extend_param: {
|
|
111
122
|
title: "自定义[点击事件]上报-点击_密码登录按钮",
|
|
112
123
|
clickContent: "密码登录",
|
|
113
124
|
....
|
|
114
125
|
....
|
|
115
126
|
},
|
|
116
|
-
$event_code: "",
|
|
117
127
|
$page: {
|
|
118
128
|
domain: "",
|
|
119
129
|
path: "",
|
|
120
130
|
title: "",
|
|
121
131
|
},
|
|
122
|
-
$path: "",
|
|
123
132
|
}
|
|
124
133
|
setCustomEvent(params)
|
|
125
134
|
```
|
|
126
135
|
|
|
127
|
-
|
|
136
|
+
## 6、流量上报
|
|
128
137
|
|
|
129
138
|
- sdk初始化后,可通过**onStartTrack(params)** 方法注册上报流量,并为上报添加属性值:
|
|
130
139
|
|
|
@@ -132,26 +141,20 @@ setCustomEvent(params)
|
|
|
132
141
|
|
|
133
142
|
**配置:**【以下配置参数建议上报】
|
|
134
143
|
|
|
135
|
-
| 参数 | 必填 | 类型
|
|
136
|
-
| ------------ | ---- |
|
|
137
|
-
| domain |
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
| extend_param | 否 | JSON对象 {} | 扩展参数 |
|
|
145
|
-
| sourceDomain | 否 | string | 访问来源域名 |
|
|
146
|
-
| sourceUrl | 否 | string | 访问来源url |
|
|
147
|
-
| title | 否 | string | 页面名称 |
|
|
148
|
-
| traceId | 否 | string | 追踪id |
|
|
149
|
-
| visitPage | 否 | number | 访问深度 |
|
|
150
|
-
| visitTime | 否 | yyyy-MM-dd HH:mm:ss | 访问时间 |
|
|
144
|
+
| 参数 | 必填 | 类型 | 描述 |
|
|
145
|
+
| ------------ | ---- | ----------- | ---------------- |
|
|
146
|
+
| domain | 否 | string | 域名 |
|
|
147
|
+
| busSegment | 否 | string | 业务板块 【表1】 |
|
|
148
|
+
| module | 否 | string | 业务模块 【表1】 |
|
|
149
|
+
| extend_param | 否 | JSON对象 {} | 扩展参数 |
|
|
150
|
+
| sourceDomain | 否 | string | 访问来源域名 |
|
|
151
|
+
| sourceUrl | 否 | string | 访问来源url |
|
|
152
|
+
| title | 否 | string | 页面名称 |
|
|
151
153
|
|
|
152
154
|
**示例:**
|
|
153
155
|
|
|
154
156
|
```js
|
|
157
|
+
import { onStartTrack } from 'visual-buried-point-platform-uni'
|
|
155
158
|
// 注:
|
|
156
159
|
data: JSON对象
|
|
157
160
|
const params = {
|
|
@@ -169,27 +172,24 @@ const params = {
|
|
|
169
172
|
onStartTrack(params)
|
|
170
173
|
```
|
|
171
174
|
|
|
172
|
-
|
|
175
|
+
**销毁流量上报:调用onDestroyTrack()进行销毁**
|
|
173
176
|
|
|
174
177
|
**示例:**
|
|
175
178
|
|
|
176
179
|
```js
|
|
180
|
+
import { onDestroyTrack } from 'visual-buried-point-platform-uni'
|
|
177
181
|
onDestroyTrack()
|
|
178
182
|
```
|
|
179
183
|
|
|
180
184
|
注: 上报数据是否成功可查看NetWork栏,调用流量上报 **track 接口** 和 自定义上报 **event 接口**的 response
|
|
181
185
|
|
|
182
|
-
|
|
186
|
+
## 7、埋点后台管理系统
|
|
183
187
|
|
|
184
188
|
##### 云测管理端地址
|
|
185
189
|
|
|
186
190
|
- chameleon.gcongo.com.cn
|
|
187
191
|
|
|
188
|
-
|
|
192
|
+
## 8、SDK 文档
|
|
189
193
|
|
|
190
194
|
http://verdaccio.gogdev.cn/-/web/detail/visual-buried-point-platform-uni
|
|
191
195
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0});var name="visual-buried-point-platform-uni",version="2.0.1-alpha.01",lsi="bfb44ddca5cf736ad2de14240a8d52a1#2.0.1-alpha.01",description="To make it easy for you to get started with GitLab, here's a list of recommended next steps.",main="dist/cjs/buried-point-uni.js",module$1="dist/esm/buried-point-uni.js",scripts={build:"rimraf dist && rollup -c --environment INCLUDE_DEPS,BUILD:production && node lsi-md5.cjs"},type="module",files=["dist"],repository={type:"git",url:""},keywords=[],author="",license="MIT",dependencies={md5:"^2.3.0"},devDependencies={rimraf:"^6.0.1",webpack:"^5.72.1","webpack-cli":"^6.0.1","@babel/core":"^7.26.10","@babel/preset-env":"^7.26.9","@rollup/plugin-json":"^6.0.1","babel-loader":"^10.0.0","babel-preset-es2015":"^6.24.1",rollup:"^1.20.2","rollup-plugin-babel":"^4.3.3","rollup-plugin-commonjs":"^10.0.2","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-replace":"^2.2.0","rollup-plugin-uglify":"^6.0.2"},pk={name:name,version:version,lsi:lsi,description:description,main:main,module:module$1,"umd:main":"dist/umd/buried-point-uni.js",scripts:scripts,type:type,files:files,repository:repository,keywords:keywords,author:author,license:license,dependencies:dependencies,devDependencies:devDependencies};let usrIdKey="v_userId",anonIdKey="v_anonId";function getWxMiniInfo(){var e=wx.getAccountInfoSync().miniProgram;return{name:"",packageName:e?e.appId:"",version:e?e.envVersion+e.version:"",carrier:"mini",ecology:"mini"}}function getWxMiniDeviceInfo(){var e=wx.getSystemInfoSync();let t={lang:e.language,brand:e.brand+" "+e.model,os:e.platform,osVersion:e.system,resolution:e.screenWidth+"x"+e.screenHeight,browser:"",browserVersion:"",color:"",deviceId:"",deviceType:getWxMiniDeviceType(e.system),network:""};return wx.getNetworkType({success(e){t.network=e.networkType}}),t}function getWxMiniDeviceType(t){return["Windows","Linux","macOS"].every(e=>t.includes(e))?1:2}function randomUUID$1(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function getWxMiniUserId(){return wx.getStorageSync(usrIdKey)?wx.getStorageSync(usrIdKey):""}function getWxMiniAnonyMousId(){let e=wx.getStorageSync(anonIdKey);return e||(e=randomUUID$1(),wx.setStorageSync(anonIdKey,e)),e}let AUTOTRACKTYPE={ENTER:"enter",LOOP:"loop",LEAVE:"leave"},BPNPVUV="UNIBPNPVUVSrcData",BPNPVUVFail="UNIBPNPVUVFailData",wxMini="wxMini",usrIdKey$1="v_userId",anonIdKey$1="v_anonId",Global={env:"",domain:"",busSegment:"",module:"",flushInterval:"",pageInterval:"",token:"",appData:null,deviceData:null,distinctId:"",anonymousId:"",version:"",trackId:"",platform:"",uAgent:"",upEventUrl:"",upTrackUrl:"",isCompatible:!0,signTrackArray:[]},pagesArray=[],visPagesArr=[];function isWXMiniProgram(){return wx.env&&wx.canIUse}function initGetTrackId(){var e=Date.now().toString();Global.trackId=e,visPagesArr=[]}let sdkTrackIdVal=()=>{var e;return Global.trackId||(e=Date.now().toString(),Global.trackId=e,visPagesArr=[],e)};function randomUUID$2(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function timeToStr(e){e=new Date(e);return e.getFullYear()+`-${e.getMonth()+1<10?"0"+(e.getMonth()+1):e.getMonth()+1}-${e.getDate()<10?"0"+e.getDate():e.getDate()} ${e.getHours()<10?"0"+e.getHours():e.getHours()}:${e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes()}:`+(e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds())}function getUniWebH5Info(e){var e=e.ua.toLowerCase(),t=window.location.hostname,n=document.title;/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e);return e.includes("alipay")||e.includes("unionPay")||e.includes("onbuygz")||e.includes("onetravel"),e.includes("micromessenger")&&e.includes("miniprogram"),{name:n||"",packageName:t||"",version:"",carrier:"H5",ecology:"h5"}}function getUniWXInfo(){var e=uni.getAccountInfoSync(),t=uni.getAppBaseInfo();return{name:t.appName||"",packageName:e?e.miniProgram.appId:"",version:e?e.miniProgram.envVersion+e.miniProgram.version:"",carrier:"mini",ecology:"mini"}}function getUniAppInfo(t){var n=plus.runtime.version,n={name:t.appName,version:n||"",carrier:"unknown",packageName:"",ecology:""};if("android"===t.platform){let e=n.carrier="Android";var r=plus.android.runtimeMainActivity().getPackageName();t.romName.includes("HarmonyOS")&&(e="Harmony OS",n.carrier="Harmony OS"),n.packageName=r||"",n.ecology=e}else"ios"===t.platform?(r=plus.ios.importClass("NSBundle").mainBundle().bundleIdentifier(),n.packageName=r||"",n.carrier="iOS",n.ecology="iOS"):n.ecology="unknown";return n}function getCurDeviceType(e){var t;return"web"===Global.platform?(t=e.ua.toLowerCase(),/(windows|win32|win64|wow64)/.test(t)?1:(/(linux|android)/.test(t)||/(macintosh|mac os x|iphone|ipad|ipod)/.test(t),2)):"pc"===e.deviceType?1:2}function getDeviceInfo(e){return{lang:e.osLanguage||e.hostLanguage,brand:e.deviceBrand+" "+e.deviceModel,os:e.osName,osVersion:e.osVersion,resolution:e.screenWidth+"x"+e.screenHeight,browser:e.browserName,browserVersion:e.browserVersion,color:"",deviceId:e.deviceId,deviceType:getCurDeviceType(e),network:""}}function getDeviceInfoError(){return{lang:"",brand:"",os:"",osVersion:"",resolution:"",browser:"",browserVersion:"",color:"",deviceId:"",deviceType:"",network:""}}function getTrackObj(e){var t=getCurrentPages(),n=t[t.length-1],r=Global.platform;let o="",a="",i="",l="";if("web"===r||"h5"===r?(o=window.location.href,a=window.location.hostname,document.referrer&&(r=new URL(document.referrer),i=r||"",l=r.hostname||"")):(o=n.route,i=(1<t.length?t[t.length-2]:n).route,a=Global.domain||n.route),n)return{path:n.route,busSegment:e.busSegment||"",module:e.module||"",properties:e.extend_param?JSON.stringify(e.extend_param):"",title:e.title||"",domain:a,url:o,visitPage:t.length,sourceDomain:l,sourceUrl:i}}function uUpdatePageExtraArray(e){var t=getCurrentPages();let n=t[t.length-1];t=pagesArray.findIndex(e=>e.path===n.route),e={path:n.route,properties:e.properties?JSON.stringify(e.properties):"",busSegment:e.busSegment||"",module:e.module||"",title:e.title||""};-1!==t?pagesArray[t]=e:pagesArray.push(e)}function isValidURL(e){return/^(https?:\/\/[^\s$.?#].[^\s]*)$/i.test(e)}function getUtmObj(){if("web"===Global.platform){var e=window.location.href;if(e&&!e.includes("file://")&&isValidURL(e)){var e=window.location.href.split("?")[1];if(e)return{utmSource:(e=new URLSearchParams(e)).get("utmSource")||"",utmCampaign:e.get("utmCampaign")||"",utmTerm:e.get("utmTerm")||"",utmContent:e.get("utmContent")||"",ctk:e.get("ctk")||""}}}return null}function insertPVUVData(e,t){let n=null;var r,o=(n=(Global.platform===wxMini?wx:uni).getStorageSync(BPNPVUV))?JSON.parse(n):[];0<o.length&&-1!==(r=o.findIndex(e=>e.uid===t))?o[r]={...o[r],...e}:o.push(e),(Global.platform===wxMini?wx:uni).setStorageSync(BPNPVUV,JSON.stringify(o))}function getBaseicInfo(){isWXMiniProgram()?(Global.platform=wxMini,Global.appData=getWxMiniInfo(),Global.deviceData=getWxMiniDeviceInfo(),Global.distinctId=getWxMiniUserId(),Global.anonymousId=getWxMiniAnonyMousId()):(uni.getSystemInfo({success:function(e){Global.uAgent=e.ua;var t,n=e.uniPlatform;n.includes("app")?(Global.platform=e.osName,Global.appData=getUniAppInfo(e)):n.includes("web")||n.includes("h5")?(Global.platform="web",t=getUniWebH5Info(e),Global.appData={...t,version:Global.version||"unknown"}):n.includes("weixin")&&(Global.platform="weixin",Global.appData=getUniWXInfo()),Global.deviceData=getDeviceInfo(e)},fail:function(e){Global.deviceData=getDeviceInfoError()},complete:function(){uni.getNetworkType({success(e){Global.deviceData.network=e.networkType}})}}),Global.distinctId=uni.getStorageSync(usrIdKey$1)||"",Global.anonymousId=uni.getStorageSync(anonIdKey$1),Global.anonymousId||(Global.anonymousId=randomUUID$2()),uni.setStorageSync(anonIdKey$1,Global.anonymousId))}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var crypt=createCommonjsModule(function(e){var a,n;a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];0<e;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var t=[],n=0;n<e.length;n+=3)for(var r=e[n]<<16|e[n+1]<<8|e[n+2],o=0;o<4;o++)8*n+6*o<=8*e.length?t.push(a.charAt(r>>>6*(3-o)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,r=0;n<e.length;r=++n%4)0!=r&&t.push((a.indexOf(e.charAt(n-1))&Math.pow(2,-2*r+8)-1)<<2*r|a.indexOf(e.charAt(n))>>>6-2*r);return t}},e.exports=n}),charenc={utf8:{stringToBytes:function(e){return charenc.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(charenc.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},charenc_1=charenc,isBuffer_1=function(e){return null!=e&&(isBuffer(e)||isSlowBuffer(e)||!!e._isBuffer)};function isBuffer(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function isSlowBuffer(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&isBuffer(e.slice(0,0))}var md5=createCommonjsModule(function(e){function v(e,t){e.constructor==String?e=(t&&"binary"===t.encoding?S:y).stringToBytes(e):T(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=b.bytesToWords(e),t=8*e.length,r=1732584193,o=-271733879,a=-1732584194,i=271733878,l=0;l<n.length;l++)n[l]=16711935&(n[l]<<8|n[l]>>>24)|4278255360&(n[l]<<24|n[l]>>>8);n[t>>>5]|=128<<t%32,n[14+(64+t>>>9<<4)]=t;for(var u=v._ff,s=v._gg,c=v._hh,p=v._ii,l=0;l<n.length;l+=16){var g=r,d=o,m=a,f=i,r=u(r,o,a,i,n[l+0],7,-680876936),i=u(i,r,o,a,n[l+1],12,-389564586),a=u(a,i,r,o,n[l+2],17,606105819),o=u(o,a,i,r,n[l+3],22,-1044525330);r=u(r,o,a,i,n[l+4],7,-176418897),i=u(i,r,o,a,n[l+5],12,1200080426),a=u(a,i,r,o,n[l+6],17,-1473231341),o=u(o,a,i,r,n[l+7],22,-45705983),r=u(r,o,a,i,n[l+8],7,1770035416),i=u(i,r,o,a,n[l+9],12,-1958414417),a=u(a,i,r,o,n[l+10],17,-42063),o=u(o,a,i,r,n[l+11],22,-1990404162),r=u(r,o,a,i,n[l+12],7,1804603682),i=u(i,r,o,a,n[l+13],12,-40341101),a=u(a,i,r,o,n[l+14],17,-1502002290),r=s(r,o=u(o,a,i,r,n[l+15],22,1236535329),a,i,n[l+1],5,-165796510),i=s(i,r,o,a,n[l+6],9,-1069501632),a=s(a,i,r,o,n[l+11],14,643717713),o=s(o,a,i,r,n[l+0],20,-373897302),r=s(r,o,a,i,n[l+5],5,-701558691),i=s(i,r,o,a,n[l+10],9,38016083),a=s(a,i,r,o,n[l+15],14,-660478335),o=s(o,a,i,r,n[l+4],20,-405537848),r=s(r,o,a,i,n[l+9],5,568446438),i=s(i,r,o,a,n[l+14],9,-1019803690),a=s(a,i,r,o,n[l+3],14,-187363961),o=s(o,a,i,r,n[l+8],20,1163531501),r=s(r,o,a,i,n[l+13],5,-1444681467),i=s(i,r,o,a,n[l+2],9,-51403784),a=s(a,i,r,o,n[l+7],14,1735328473),r=c(r,o=s(o,a,i,r,n[l+12],20,-1926607734),a,i,n[l+5],4,-378558),i=c(i,r,o,a,n[l+8],11,-2022574463),a=c(a,i,r,o,n[l+11],16,1839030562),o=c(o,a,i,r,n[l+14],23,-35309556),r=c(r,o,a,i,n[l+1],4,-1530992060),i=c(i,r,o,a,n[l+4],11,1272893353),a=c(a,i,r,o,n[l+7],16,-155497632),o=c(o,a,i,r,n[l+10],23,-1094730640),r=c(r,o,a,i,n[l+13],4,681279174),i=c(i,r,o,a,n[l+0],11,-358537222),a=c(a,i,r,o,n[l+3],16,-722521979),o=c(o,a,i,r,n[l+6],23,76029189),r=c(r,o,a,i,n[l+9],4,-640364487),i=c(i,r,o,a,n[l+12],11,-421815835),a=c(a,i,r,o,n[l+15],16,530742520),r=p(r,o=c(o,a,i,r,n[l+2],23,-995338651),a,i,n[l+0],6,-198630844),i=p(i,r,o,a,n[l+7],10,1126891415),a=p(a,i,r,o,n[l+14],15,-1416354905),o=p(o,a,i,r,n[l+5],21,-57434055),r=p(r,o,a,i,n[l+12],6,1700485571),i=p(i,r,o,a,n[l+3],10,-1894986606),a=p(a,i,r,o,n[l+10],15,-1051523),o=p(o,a,i,r,n[l+1],21,-2054922799),r=p(r,o,a,i,n[l+8],6,1873313359),i=p(i,r,o,a,n[l+15],10,-30611744),a=p(a,i,r,o,n[l+6],15,-1560198380),o=p(o,a,i,r,n[l+13],21,1309151649),r=p(r,o,a,i,n[l+4],6,-145523070),i=p(i,r,o,a,n[l+11],10,-1120210379),a=p(a,i,r,o,n[l+2],15,718787259),o=p(o,a,i,r,n[l+9],21,-343485551),r=r+g>>>0,o=o+d>>>0,a=a+m>>>0,i=i+f>>>0}return b.endian([r,o,a,i])}var b,y,T,S;b=crypt,y=charenc_1.utf8,T=isBuffer_1,S=charenc_1.bin,v._ff=function(e,t,n,r,o,a,i){e=e+(t&n|~t&r)+(o>>>0)+i;return(e<<a|e>>>32-a)+t},v._gg=function(e,t,n,r,o,a,i){e=e+(t&r|n&~r)+(o>>>0)+i;return(e<<a|e>>>32-a)+t},v._hh=function(e,t,n,r,o,a,i){e=e+(t^n^r)+(o>>>0)+i;return(e<<a|e>>>32-a)+t},v._ii=function(e,t,n,r,o,a,i){e=e+(n^(t|~r))+(o>>>0)+i;return(e<<a|e>>>32-a)+t},v._blocksize=16,v._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);e=b.wordsToBytes(v(e,t));return t&&t.asBytes?e:t&&t.asString?S.bytesToString(e):b.bytesToHex(e)}});let localLsi=pk.lsi;function commonData(e){return{app:Global.appData,data:e,device:Global.deviceData,lsi:localLsi,projectId:Global.token,userAgent:Global.uAgent||"",anonymousId:Global.anonymousId,userId:Global.distinctId}}function reportTrackEventServer(e,t,n){var r;e?(r={...r=commonData(t),dataAbstract:md5(JSON.stringify(r))},Global.platform===wxMini?wx.request({url:"event"===e?Global.upEventUrl:Global.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:Global.token,projectId:Global.token},data:r,success:function(e){e&&e.data?wx.setStorageSync(n,JSON.stringify(t)):wx.setStorageSync(n,"")},fail:function(e){console.error(e),wx.setStorageSync(n,JSON.stringify(t))}}):uni.request({url:"event"===e?Global.upEventUrl:Global.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:Global.token,projectId:Global.token},data:r,success:function(e){e&&e.data?uni.setStorageSync(n,JSON.stringify(t)):uni.setStorageSync(n,"")},fail:function(e){console.log("error: ",e),uni.setStorageSync(n,JSON.stringify(t))}})):console.error("please set upload data upType")}let atDuration,atEnterTimeLong,atLoopTimeLong,cirtemp,atObj,atInterval,uid;function clearData(){clearInterval(atInterval),atInterval=null,uid=0,atObj=null,atEnterTimeLong=0,atLoopTimeLong=0}let uAutoStartTrackPVData=e=>{clearData(),atObj=e,autoTrackData(AUTOTRACKTYPE.ENTER),atInterval=setInterval(()=>{autoTrackData(AUTOTRACKTYPE.LOOP)},15e3)},uAutoStopTrackPVData=()=>{atObj&&autoTrackData(AUTOTRACKTYPE.LEAVE),clearData()};function autoTrackData(e){e===AUTOTRACKTYPE.ENTER?(cirtemp=1,atDuration=0,uid=randomUUID(),atEnterTimeLong=Date.now(),atLoopTimeLong=atEnterTimeLong):e===AUTOTRACKTYPE.LOOP?(cirtemp=2,atDuration=15,atLoopTimeLong=Date.now()):e===AUTOTRACKTYPE.LEAVE&&(cirtemp=3,e=Math.max(1,(Date.now()-atLoopTimeLong)/1e3),atDuration=Math.ceil(e));e={busSegment:atObj.busSegment||"",circulation:cirtemp,domain:atObj.domain,duration:atDuration,module:atObj.module||"",path:atObj.path,url:atObj.url,sourceDomain:atObj.sourceDomain,sourceUrl:atObj.sourceUrl,properties:atObj.properties,title:atObj.title,traceId:"",trackId:sdkTrackIdVal(),visitPage:atObj.visitPage,visitTime:timeToStr(atEnterTimeLong),uid:uid};insertPVUVData(e,uid)}function autoPageObj(t,e,n){var r=pagesArray.find(e=>e.path===t),o=Global.platform;let a="",i="",l="",u="";return o&&("web"===o||"h5"===o?(a=window.location.href,i=window.location.hostname,document.referrer&&(o=new URL(document.referrer),l=o||"",u=o.hostname||"")):(a=t,1<e&&(o=n[e-2],l=o.route),i=Global.domain||t)),{path:r&&r.path?r.path:t,busSegment:r&&r.busSegment?r.busSegment:Global.busSegment||"",module:r&&r.module?r.module:Global.module||"",properties:r&&r.properties?r.properties:"",domain:i,url:a,visitPage:e,sourceDomain:u,sourceUrl:l,title:r&&r.title?r.title:""}}function queryTrackDataUpload(){let e=null,t=null;var n=[],r=(t=(Global.platform===wxMini?(e=wx.getStorageSync(BPNPVUV),wx.setStorageSync(BPNPVUV,""),wx):(e=uni.getStorageSync(BPNPVUV),uni.setStorageSync(BPNPVUV,""),uni)).getStorageSync(BPNPVUVFail),e?JSON.parse(e):[]),o=t?JSON.parse(t):[];r.length&&n.push(...r),o.length&&(n.push(...o),n.forEach(e=>{delete e.pageUUId})),n&&n.length&&reportTrackEventServer("track",n,BPNPVUVFail)}function setReportUrl(e){return"test"!==e?{upEventApi:"https://buryingpoint.onebuygz.com/client/api/event",upTrackApi:"https://buryingpoint.onebuygz.com/client/api/track",eventListApi:"https://buryingpoint.onebuygz.com/api/event/query/eventList"}:{upEventApi:"https://buryingpoint.gcongo.com.cn/client/api/event",upTrackApi:"https://buryingpoint.gcongo.com.cn/client/api/track",eventListApi:"https://buryingpoint.gcongo.com.cn/api/event/query/eventList"}}let BPNEvent="UNIBPNEventSrcData",BPNEventFail="UNIBPNEventFailData";function getCurPath(){var e=getCurrentPages(),e=e[e.length-1];return e?e.route:"/"}function eventCommonStore(e){var t=e.$page||"",n=t.path||getCurPath(),t={utm:e.$utm||getUtmObj(),duration:"",element:e.$element||null,eventId:e.$event_id||"",event:e.$event_code||"",groupId:"",busSegment:e.$busSegment||"",module:e.$module||"",page:{domain:t.domain||"",pageId:md5(n),path:n||"",title:t.title||"",url:n||""},properties:e.$extend_param?JSON.stringify(e.$extend_param):"",traceId:"",trackId:sdkTrackIdVal(),triggerTime:timeToStr(Date.now())};insertEventData(t)}function insertEventData(e){let t;var n=(t=(Global.platform===wxMini?wx:uni).getStorageSync(BPNEvent))?JSON.parse(t):[];n.push(e),(Global.platform===wxMini?wx:uni).setStorageSync(BPNEvent,JSON.stringify(n))}function queryEventDataUpload(){let e=null,t=null;var n=[],r=(t=(Global.platform===wxMini?(e=wx.getStorageSync(BPNEvent),wx.setStorageSync(BPNEvent,""),wx):(e=uni.getStorageSync(BPNEvent),uni.setStorageSync(BPNEvent,""),uni)).getStorageSync(BPNEventFail),e?JSON.parse(e):[]),o=t?JSON.parse(t):[];r.length&&n.push(...r),o.length&&n.push(...o),n&&n.length&&reportTrackEventServer("event",n,BPNEventFail)}let startTime,enterTimeLong,loopTimeLong,umlInterval,cirtemp$1,mObj,cPUUId;function uStartTrackPVData(e){umlInterval&&uDestoryTrackPVData(),e&&(clearInterval(umlInterval),uTrackPVData(AUTOTRACKTYPE.ENTER,e),umlInterval=setInterval(()=>{uTrackPVData(AUTOTRACKTYPE.LOOP,null)},15e3))}function uDestoryTrackPVData(){mObj&&uTrackPVData(AUTOTRACKTYPE.LEAVE,null),clearInterval(umlInterval),umlInterval=null}function uTrackPVData(e,t){e===AUTOTRACKTYPE.ENTER?(mObj=null,cPUUId=0,cirtemp$1=1,startTime=0,enterTimeLong=-1,loopTimeLong=-1,enterTimeLong=Date.now(),loopTimeLong=enterTimeLong,cPUUId=randomUUID$2(),mObj=getTrackObj(t),visPagesArr.push(mObj.path)):e===AUTOTRACKTYPE.LOOP?(cirtemp$1=2,startTime=15,loopTimeLong=Date.now()):e===AUTOTRACKTYPE.LEAVE&&(cirtemp$1=3,t=Math.max(1,(Date.now()-loopTimeLong)/1e3),startTime=Math.ceil(t));e={busSegment:mObj.busSegment,circulation:cirtemp$1,domain:mObj.domain,duration:startTime,module:mObj.module,path:mObj.path,properties:mObj.properties,sourceDomain:mObj.sourceDomain,sourceUrl:mObj.sourceUrl,title:mObj.title,traceId:"",trackId:sdkTrackIdVal(),url:mObj.url,visitPage:visPagesArr.length,visitTime:timeToStr(enterTimeLong),utm:getUtmObj(),uid:cPUUId};insertPVUVData(e,cPUUId)}function uniInterceptorListener(){uni.addInterceptor("navigateTo",{invoke(e){routerMsgHandler("leave")},success(e){routerMsgHandler("pv")}}),uni.addInterceptor("switchTab",{invoke(e){routerMsgHandler("leave")},success(e){routerMsgHandler("pv")}}),uni.addInterceptor("navigateBack",{invoke(e){routerMsgHandler("leave")},success(e){routerMsgHandler("pv")}})}let pathExist=!1;function routerMsgHandler(e){if(!Global.isCompatible)if("pv"===e){var n=getCurrentPages();let t=n[n.length-1];Global.signTrackArray&&Global.signTrackArray.length&&(pathExist=Global.signTrackArray.find(e=>e===t.route))?pathExist=!0:(pathExist=!1,n=autoPageObj(t.route,n.length,n),uAutoStartTrackPVData(n))}else"leave"!==e||pathExist||uAutoStopTrackPVData()}let uglInterval=null;function init(e){var t;e?(t=setReportUrl(e.env),Global.upEventUrl=t.upEventApi,Global.upTrackUrl=t.upTrackApi,initGetTrackId(),Object.assign(Global,e),getBaseicInfo(),startGlobalTime(),Global.platform!==wxMini&&uniInterceptorListener()):console.log("init config error, please check config!")}function startGlobalTime(){clearInterval(uglInterval),uglInterval=null,uglInterval=setInterval(()=>{queryEventDataUpload(),queryTrackDataUpload()},15e3)}function setUserId(e){e?(Global.distinctId=e,(Global.platform===wxMini?wx:uni).setStorageSync(usrIdKey$1,e)):(Global.distinctId="",Global.platform===wxMini?wx.setStorageSync(usrIdKey$1,e):uni.setStorageSync(usrIdKey$1,""))}function setCustomEvent(e){e&&eventCommonStore(e)}function onStartTrack(e){uStartTrackPVData(e)}function onDestroyTrack(){uDestoryTrackPVData()}function setPageExtraObj(e){uUpdatePageExtraArray(e)}exports.init=init,exports.onDestroyTrack=onDestroyTrack,exports.onStartTrack=onStartTrack,exports.setCustomEvent=setCustomEvent,exports.setPageExtraObj=setPageExtraObj,exports.setUserId=setUserId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var name="visual-buried-point-platform-uni",version="2.0.1-alpha.01",lsi="bfb44ddca5cf736ad2de14240a8d52a1#2.0.1-alpha.01",description="To make it easy for you to get started with GitLab, here's a list of recommended next steps.",main="dist/cjs/buried-point-uni.js",module="dist/esm/buried-point-uni.js",scripts={build:"rimraf dist && rollup -c --environment INCLUDE_DEPS,BUILD:production && node lsi-md5.cjs"},type="module",files=["dist"],repository={type:"git",url:""},keywords=[],author="",license="MIT",dependencies={md5:"^2.3.0"},devDependencies={rimraf:"^6.0.1",webpack:"^5.72.1","webpack-cli":"^6.0.1","@babel/core":"^7.26.10","@babel/preset-env":"^7.26.9","@rollup/plugin-json":"^6.0.1","babel-loader":"^10.0.0","babel-preset-es2015":"^6.24.1",rollup:"^1.20.2","rollup-plugin-babel":"^4.3.3","rollup-plugin-commonjs":"^10.0.2","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-replace":"^2.2.0","rollup-plugin-uglify":"^6.0.2"},pk={name:name,version:version,lsi:lsi,description:description,main:main,module:module,"umd:main":"dist/umd/buried-point-uni.js",scripts:scripts,type:type,files:files,repository:repository,keywords:keywords,author:author,license:license,dependencies:dependencies,devDependencies:devDependencies};let usrIdKey="v_userId",anonIdKey="v_anonId";function getWxMiniInfo(){var e=wx.getAccountInfoSync().miniProgram;return{name:"",packageName:e?e.appId:"",version:e?e.envVersion+e.version:"",carrier:"mini",ecology:"mini"}}function getWxMiniDeviceInfo(){var e=wx.getSystemInfoSync();let t={lang:e.language,brand:e.brand+" "+e.model,os:e.platform,osVersion:e.system,resolution:e.screenWidth+"x"+e.screenHeight,browser:"",browserVersion:"",color:"",deviceId:"",deviceType:getWxMiniDeviceType(e.system),network:""};return wx.getNetworkType({success(e){t.network=e.networkType}}),t}function getWxMiniDeviceType(t){return["Windows","Linux","macOS"].every(e=>t.includes(e))?1:2}function randomUUID$1(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function getWxMiniUserId(){return wx.getStorageSync(usrIdKey)?wx.getStorageSync(usrIdKey):""}function getWxMiniAnonyMousId(){let e=wx.getStorageSync(anonIdKey);return e||(e=randomUUID$1(),wx.setStorageSync(anonIdKey,e)),e}let AUTOTRACKTYPE={ENTER:"enter",LOOP:"loop",LEAVE:"leave"},BPNPVUV="UNIBPNPVUVSrcData",BPNPVUVFail="UNIBPNPVUVFailData",wxMini="wxMini",usrIdKey$1="v_userId",anonIdKey$1="v_anonId",Global={env:"",domain:"",busSegment:"",module:"",flushInterval:"",pageInterval:"",token:"",appData:null,deviceData:null,distinctId:"",anonymousId:"",version:"",trackId:"",platform:"",uAgent:"",upEventUrl:"",upTrackUrl:"",isCompatible:!0,signTrackArray:[]},pagesArray=[],visPagesArr=[];function isWXMiniProgram(){return wx.env&&wx.canIUse}function initGetTrackId(){var e=Date.now().toString();Global.trackId=e,visPagesArr=[]}let sdkTrackIdVal=()=>{var e;return Global.trackId||(e=Date.now().toString(),Global.trackId=e,visPagesArr=[],e)};function randomUUID$2(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function timeToStr(e){e=new Date(e);return e.getFullYear()+`-${e.getMonth()+1<10?"0"+(e.getMonth()+1):e.getMonth()+1}-${e.getDate()<10?"0"+e.getDate():e.getDate()} ${e.getHours()<10?"0"+e.getHours():e.getHours()}:${e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes()}:`+(e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds())}function getUniWebH5Info(e){var e=e.ua.toLowerCase(),t=window.location.hostname,n=document.title;/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e);return e.includes("alipay")||e.includes("unionPay")||e.includes("onbuygz")||e.includes("onetravel"),e.includes("micromessenger")&&e.includes("miniprogram"),{name:n||"",packageName:t||"",version:"",carrier:"H5",ecology:"h5"}}function getUniWXInfo(){var e=uni.getAccountInfoSync(),t=uni.getAppBaseInfo();return{name:t.appName||"",packageName:e?e.miniProgram.appId:"",version:e?e.miniProgram.envVersion+e.miniProgram.version:"",carrier:"mini",ecology:"mini"}}function getUniAppInfo(t){var n=plus.runtime.version,n={name:t.appName,version:n||"",carrier:"unknown",packageName:"",ecology:""};if("android"===t.platform){let e=n.carrier="Android";var r=plus.android.runtimeMainActivity().getPackageName();t.romName.includes("HarmonyOS")&&(e="Harmony OS",n.carrier="Harmony OS"),n.packageName=r||"",n.ecology=e}else"ios"===t.platform?(r=plus.ios.importClass("NSBundle").mainBundle().bundleIdentifier(),n.packageName=r||"",n.carrier="iOS",n.ecology="iOS"):n.ecology="unknown";return n}function getCurDeviceType(e){var t;return"web"===Global.platform?(t=e.ua.toLowerCase(),/(windows|win32|win64|wow64)/.test(t)?1:(/(linux|android)/.test(t)||/(macintosh|mac os x|iphone|ipad|ipod)/.test(t),2)):"pc"===e.deviceType?1:2}function getDeviceInfo(e){return{lang:e.osLanguage||e.hostLanguage,brand:e.deviceBrand+" "+e.deviceModel,os:e.osName,osVersion:e.osVersion,resolution:e.screenWidth+"x"+e.screenHeight,browser:e.browserName,browserVersion:e.browserVersion,color:"",deviceId:e.deviceId,deviceType:getCurDeviceType(e),network:""}}function getDeviceInfoError(){return{lang:"",brand:"",os:"",osVersion:"",resolution:"",browser:"",browserVersion:"",color:"",deviceId:"",deviceType:"",network:""}}function getTrackObj(e){var t=getCurrentPages(),n=t[t.length-1],r=Global.platform;let a="",o="",i="",l="";if("web"===r||"h5"===r?(a=window.location.href,o=window.location.hostname,document.referrer&&(r=new URL(document.referrer),i=r||"",l=r.hostname||"")):(a=n.route,i=(1<t.length?t[t.length-2]:n).route,o=Global.domain||n.route),n)return{path:n.route,busSegment:e.busSegment||"",module:e.module||"",properties:e.extend_param?JSON.stringify(e.extend_param):"",title:e.title||"",domain:o,url:a,visitPage:t.length,sourceDomain:l,sourceUrl:i}}function uUpdatePageExtraArray(e){var t=getCurrentPages();let n=t[t.length-1];t=pagesArray.findIndex(e=>e.path===n.route),e={path:n.route,properties:e.properties?JSON.stringify(e.properties):"",busSegment:e.busSegment||"",module:e.module||"",title:e.title||""};-1!==t?pagesArray[t]=e:pagesArray.push(e)}function isValidURL(e){return/^(https?:\/\/[^\s$.?#].[^\s]*)$/i.test(e)}function getUtmObj(){if("web"===Global.platform){var e=window.location.href;if(e&&!e.includes("file://")&&isValidURL(e)){var e=window.location.href.split("?")[1];if(e)return{utmSource:(e=new URLSearchParams(e)).get("utmSource")||"",utmCampaign:e.get("utmCampaign")||"",utmTerm:e.get("utmTerm")||"",utmContent:e.get("utmContent")||"",ctk:e.get("ctk")||""}}}return null}function insertPVUVData(e,t){let n=null;var r,a=(n=(Global.platform===wxMini?wx:uni).getStorageSync(BPNPVUV))?JSON.parse(n):[];0<a.length&&-1!==(r=a.findIndex(e=>e.uid===t))?a[r]={...a[r],...e}:a.push(e),(Global.platform===wxMini?wx:uni).setStorageSync(BPNPVUV,JSON.stringify(a))}function getBaseicInfo(){isWXMiniProgram()?(Global.platform=wxMini,Global.appData=getWxMiniInfo(),Global.deviceData=getWxMiniDeviceInfo(),Global.distinctId=getWxMiniUserId(),Global.anonymousId=getWxMiniAnonyMousId()):(uni.getSystemInfo({success:function(e){Global.uAgent=e.ua;var t,n=e.uniPlatform;n.includes("app")?(Global.platform=e.osName,Global.appData=getUniAppInfo(e)):n.includes("web")||n.includes("h5")?(Global.platform="web",t=getUniWebH5Info(e),Global.appData={...t,version:Global.version||"unknown"}):n.includes("weixin")&&(Global.platform="weixin",Global.appData=getUniWXInfo()),Global.deviceData=getDeviceInfo(e)},fail:function(e){Global.deviceData=getDeviceInfoError()},complete:function(){uni.getNetworkType({success(e){Global.deviceData.network=e.networkType}})}}),Global.distinctId=uni.getStorageSync(usrIdKey$1)||"",Global.anonymousId=uni.getStorageSync(anonIdKey$1),Global.anonymousId||(Global.anonymousId=randomUUID$2()),uni.setStorageSync(anonIdKey$1,Global.anonymousId))}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var crypt=createCommonjsModule(function(e){var o,n;o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];0<e;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var t=[],n=0;n<e.length;n+=3)for(var r=e[n]<<16|e[n+1]<<8|e[n+2],a=0;a<4;a++)8*n+6*a<=8*e.length?t.push(o.charAt(r>>>6*(3-a)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,r=0;n<e.length;r=++n%4)0!=r&&t.push((o.indexOf(e.charAt(n-1))&Math.pow(2,-2*r+8)-1)<<2*r|o.indexOf(e.charAt(n))>>>6-2*r);return t}},e.exports=n}),charenc={utf8:{stringToBytes:function(e){return charenc.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(charenc.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},charenc_1=charenc,isBuffer_1=function(e){return null!=e&&(isBuffer(e)||isSlowBuffer(e)||!!e._isBuffer)};function isBuffer(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function isSlowBuffer(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&isBuffer(e.slice(0,0))}var md5=createCommonjsModule(function(e){function v(e,t){e.constructor==String?e=(t&&"binary"===t.encoding?S:y).stringToBytes(e):T(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=b.bytesToWords(e),t=8*e.length,r=1732584193,a=-271733879,o=-1732584194,i=271733878,l=0;l<n.length;l++)n[l]=16711935&(n[l]<<8|n[l]>>>24)|4278255360&(n[l]<<24|n[l]>>>8);n[t>>>5]|=128<<t%32,n[14+(64+t>>>9<<4)]=t;for(var u=v._ff,s=v._gg,c=v._hh,p=v._ii,l=0;l<n.length;l+=16){var g=r,d=a,m=o,f=i,r=u(r,a,o,i,n[l+0],7,-680876936),i=u(i,r,a,o,n[l+1],12,-389564586),o=u(o,i,r,a,n[l+2],17,606105819),a=u(a,o,i,r,n[l+3],22,-1044525330);r=u(r,a,o,i,n[l+4],7,-176418897),i=u(i,r,a,o,n[l+5],12,1200080426),o=u(o,i,r,a,n[l+6],17,-1473231341),a=u(a,o,i,r,n[l+7],22,-45705983),r=u(r,a,o,i,n[l+8],7,1770035416),i=u(i,r,a,o,n[l+9],12,-1958414417),o=u(o,i,r,a,n[l+10],17,-42063),a=u(a,o,i,r,n[l+11],22,-1990404162),r=u(r,a,o,i,n[l+12],7,1804603682),i=u(i,r,a,o,n[l+13],12,-40341101),o=u(o,i,r,a,n[l+14],17,-1502002290),r=s(r,a=u(a,o,i,r,n[l+15],22,1236535329),o,i,n[l+1],5,-165796510),i=s(i,r,a,o,n[l+6],9,-1069501632),o=s(o,i,r,a,n[l+11],14,643717713),a=s(a,o,i,r,n[l+0],20,-373897302),r=s(r,a,o,i,n[l+5],5,-701558691),i=s(i,r,a,o,n[l+10],9,38016083),o=s(o,i,r,a,n[l+15],14,-660478335),a=s(a,o,i,r,n[l+4],20,-405537848),r=s(r,a,o,i,n[l+9],5,568446438),i=s(i,r,a,o,n[l+14],9,-1019803690),o=s(o,i,r,a,n[l+3],14,-187363961),a=s(a,o,i,r,n[l+8],20,1163531501),r=s(r,a,o,i,n[l+13],5,-1444681467),i=s(i,r,a,o,n[l+2],9,-51403784),o=s(o,i,r,a,n[l+7],14,1735328473),r=c(r,a=s(a,o,i,r,n[l+12],20,-1926607734),o,i,n[l+5],4,-378558),i=c(i,r,a,o,n[l+8],11,-2022574463),o=c(o,i,r,a,n[l+11],16,1839030562),a=c(a,o,i,r,n[l+14],23,-35309556),r=c(r,a,o,i,n[l+1],4,-1530992060),i=c(i,r,a,o,n[l+4],11,1272893353),o=c(o,i,r,a,n[l+7],16,-155497632),a=c(a,o,i,r,n[l+10],23,-1094730640),r=c(r,a,o,i,n[l+13],4,681279174),i=c(i,r,a,o,n[l+0],11,-358537222),o=c(o,i,r,a,n[l+3],16,-722521979),a=c(a,o,i,r,n[l+6],23,76029189),r=c(r,a,o,i,n[l+9],4,-640364487),i=c(i,r,a,o,n[l+12],11,-421815835),o=c(o,i,r,a,n[l+15],16,530742520),r=p(r,a=c(a,o,i,r,n[l+2],23,-995338651),o,i,n[l+0],6,-198630844),i=p(i,r,a,o,n[l+7],10,1126891415),o=p(o,i,r,a,n[l+14],15,-1416354905),a=p(a,o,i,r,n[l+5],21,-57434055),r=p(r,a,o,i,n[l+12],6,1700485571),i=p(i,r,a,o,n[l+3],10,-1894986606),o=p(o,i,r,a,n[l+10],15,-1051523),a=p(a,o,i,r,n[l+1],21,-2054922799),r=p(r,a,o,i,n[l+8],6,1873313359),i=p(i,r,a,o,n[l+15],10,-30611744),o=p(o,i,r,a,n[l+6],15,-1560198380),a=p(a,o,i,r,n[l+13],21,1309151649),r=p(r,a,o,i,n[l+4],6,-145523070),i=p(i,r,a,o,n[l+11],10,-1120210379),o=p(o,i,r,a,n[l+2],15,718787259),a=p(a,o,i,r,n[l+9],21,-343485551),r=r+g>>>0,a=a+d>>>0,o=o+m>>>0,i=i+f>>>0}return b.endian([r,a,o,i])}var b,y,T,S;b=crypt,y=charenc_1.utf8,T=isBuffer_1,S=charenc_1.bin,v._ff=function(e,t,n,r,a,o,i){e=e+(t&n|~t&r)+(a>>>0)+i;return(e<<o|e>>>32-o)+t},v._gg=function(e,t,n,r,a,o,i){e=e+(t&r|n&~r)+(a>>>0)+i;return(e<<o|e>>>32-o)+t},v._hh=function(e,t,n,r,a,o,i){e=e+(t^n^r)+(a>>>0)+i;return(e<<o|e>>>32-o)+t},v._ii=function(e,t,n,r,a,o,i){e=e+(n^(t|~r))+(a>>>0)+i;return(e<<o|e>>>32-o)+t},v._blocksize=16,v._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);e=b.wordsToBytes(v(e,t));return t&&t.asBytes?e:t&&t.asString?S.bytesToString(e):b.bytesToHex(e)}});let localLsi=pk.lsi;function commonData(e){return{app:Global.appData,data:e,device:Global.deviceData,lsi:localLsi,projectId:Global.token,userAgent:Global.uAgent||"",anonymousId:Global.anonymousId,userId:Global.distinctId}}function reportTrackEventServer(e,t,n){var r;e?(r={...r=commonData(t),dataAbstract:md5(JSON.stringify(r))},Global.platform===wxMini?wx.request({url:"event"===e?Global.upEventUrl:Global.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:Global.token,projectId:Global.token},data:r,success:function(e){e&&e.data?wx.setStorageSync(n,JSON.stringify(t)):wx.setStorageSync(n,"")},fail:function(e){console.error(e),wx.setStorageSync(n,JSON.stringify(t))}}):uni.request({url:"event"===e?Global.upEventUrl:Global.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:Global.token,projectId:Global.token},data:r,success:function(e){e&&e.data?uni.setStorageSync(n,JSON.stringify(t)):uni.setStorageSync(n,"")},fail:function(e){console.log("error: ",e),uni.setStorageSync(n,JSON.stringify(t))}})):console.error("please set upload data upType")}let atDuration,atEnterTimeLong,atLoopTimeLong,cirtemp,atObj,atInterval,uid;function clearData(){clearInterval(atInterval),atInterval=null,uid=0,atObj=null,atEnterTimeLong=0,atLoopTimeLong=0}let uAutoStartTrackPVData=e=>{clearData(),atObj=e,autoTrackData(AUTOTRACKTYPE.ENTER),atInterval=setInterval(()=>{autoTrackData(AUTOTRACKTYPE.LOOP)},15e3)},uAutoStopTrackPVData=()=>{atObj&&autoTrackData(AUTOTRACKTYPE.LEAVE),clearData()};function autoTrackData(e){e===AUTOTRACKTYPE.ENTER?(cirtemp=1,atDuration=0,uid=randomUUID(),atEnterTimeLong=Date.now(),atLoopTimeLong=atEnterTimeLong):e===AUTOTRACKTYPE.LOOP?(cirtemp=2,atDuration=15,atLoopTimeLong=Date.now()):e===AUTOTRACKTYPE.LEAVE&&(cirtemp=3,e=Math.max(1,(Date.now()-atLoopTimeLong)/1e3),atDuration=Math.ceil(e));e={busSegment:atObj.busSegment||"",circulation:cirtemp,domain:atObj.domain,duration:atDuration,module:atObj.module||"",path:atObj.path,url:atObj.url,sourceDomain:atObj.sourceDomain,sourceUrl:atObj.sourceUrl,properties:atObj.properties,title:atObj.title,traceId:"",trackId:sdkTrackIdVal(),visitPage:atObj.visitPage,visitTime:timeToStr(atEnterTimeLong),uid:uid};insertPVUVData(e,uid)}function autoPageObj(t,e,n){var r=pagesArray.find(e=>e.path===t),a=Global.platform;let o="",i="",l="",u="";return a&&("web"===a||"h5"===a?(o=window.location.href,i=window.location.hostname,document.referrer&&(a=new URL(document.referrer),l=a||"",u=a.hostname||"")):(o=t,1<e&&(a=n[e-2],l=a.route),i=Global.domain||t)),{path:r&&r.path?r.path:t,busSegment:r&&r.busSegment?r.busSegment:Global.busSegment||"",module:r&&r.module?r.module:Global.module||"",properties:r&&r.properties?r.properties:"",domain:i,url:o,visitPage:e,sourceDomain:u,sourceUrl:l,title:r&&r.title?r.title:""}}function queryTrackDataUpload(){let e=null,t=null;var n=[],r=(t=(Global.platform===wxMini?(e=wx.getStorageSync(BPNPVUV),wx.setStorageSync(BPNPVUV,""),wx):(e=uni.getStorageSync(BPNPVUV),uni.setStorageSync(BPNPVUV,""),uni)).getStorageSync(BPNPVUVFail),e?JSON.parse(e):[]),a=t?JSON.parse(t):[];r.length&&n.push(...r),a.length&&(n.push(...a),n.forEach(e=>{delete e.pageUUId})),n&&n.length&&reportTrackEventServer("track",n,BPNPVUVFail)}function setReportUrl(e){return"test"!==e?{upEventApi:"https://buryingpoint.onebuygz.com/client/api/event",upTrackApi:"https://buryingpoint.onebuygz.com/client/api/track",eventListApi:"https://buryingpoint.onebuygz.com/api/event/query/eventList"}:{upEventApi:"https://buryingpoint.gcongo.com.cn/client/api/event",upTrackApi:"https://buryingpoint.gcongo.com.cn/client/api/track",eventListApi:"https://buryingpoint.gcongo.com.cn/api/event/query/eventList"}}let BPNEvent="UNIBPNEventSrcData",BPNEventFail="UNIBPNEventFailData";function getCurPath(){var e=getCurrentPages(),e=e[e.length-1];return e?e.route:"/"}function eventCommonStore(e){var t=e.$page||"",n=t.path||getCurPath(),t={utm:e.$utm||getUtmObj(),duration:"",element:e.$element||null,eventId:e.$event_id||"",event:e.$event_code||"",groupId:"",busSegment:e.$busSegment||"",module:e.$module||"",page:{domain:t.domain||"",pageId:md5(n),path:n||"",title:t.title||"",url:n||""},properties:e.$extend_param?JSON.stringify(e.$extend_param):"",traceId:"",trackId:sdkTrackIdVal(),triggerTime:timeToStr(Date.now())};insertEventData(t)}function insertEventData(e){let t;var n=(t=(Global.platform===wxMini?wx:uni).getStorageSync(BPNEvent))?JSON.parse(t):[];n.push(e),(Global.platform===wxMini?wx:uni).setStorageSync(BPNEvent,JSON.stringify(n))}function queryEventDataUpload(){let e=null,t=null;var n=[],r=(t=(Global.platform===wxMini?(e=wx.getStorageSync(BPNEvent),wx.setStorageSync(BPNEvent,""),wx):(e=uni.getStorageSync(BPNEvent),uni.setStorageSync(BPNEvent,""),uni)).getStorageSync(BPNEventFail),e?JSON.parse(e):[]),a=t?JSON.parse(t):[];r.length&&n.push(...r),a.length&&n.push(...a),n&&n.length&&reportTrackEventServer("event",n,BPNEventFail)}let startTime,enterTimeLong,loopTimeLong,umlInterval,cirtemp$1,mObj,cPUUId;function uStartTrackPVData(e){umlInterval&&uDestoryTrackPVData(),e&&(clearInterval(umlInterval),uTrackPVData(AUTOTRACKTYPE.ENTER,e),umlInterval=setInterval(()=>{uTrackPVData(AUTOTRACKTYPE.LOOP,null)},15e3))}function uDestoryTrackPVData(){mObj&&uTrackPVData(AUTOTRACKTYPE.LEAVE,null),clearInterval(umlInterval),umlInterval=null}function uTrackPVData(e,t){e===AUTOTRACKTYPE.ENTER?(mObj=null,cPUUId=0,cirtemp$1=1,startTime=0,enterTimeLong=-1,loopTimeLong=-1,enterTimeLong=Date.now(),loopTimeLong=enterTimeLong,cPUUId=randomUUID$2(),mObj=getTrackObj(t),visPagesArr.push(mObj.path)):e===AUTOTRACKTYPE.LOOP?(cirtemp$1=2,startTime=15,loopTimeLong=Date.now()):e===AUTOTRACKTYPE.LEAVE&&(cirtemp$1=3,t=Math.max(1,(Date.now()-loopTimeLong)/1e3),startTime=Math.ceil(t));e={busSegment:mObj.busSegment,circulation:cirtemp$1,domain:mObj.domain,duration:startTime,module:mObj.module,path:mObj.path,properties:mObj.properties,sourceDomain:mObj.sourceDomain,sourceUrl:mObj.sourceUrl,title:mObj.title,traceId:"",trackId:sdkTrackIdVal(),url:mObj.url,visitPage:visPagesArr.length,visitTime:timeToStr(enterTimeLong),utm:getUtmObj(),uid:cPUUId};insertPVUVData(e,cPUUId)}function uniInterceptorListener(){uni.addInterceptor("navigateTo",{invoke(e){routerMsgHandler("leave")},success(e){routerMsgHandler("pv")}}),uni.addInterceptor("switchTab",{invoke(e){routerMsgHandler("leave")},success(e){routerMsgHandler("pv")}}),uni.addInterceptor("navigateBack",{invoke(e){routerMsgHandler("leave")},success(e){routerMsgHandler("pv")}})}let pathExist=!1;function routerMsgHandler(e){if(!Global.isCompatible)if("pv"===e){var n=getCurrentPages();let t=n[n.length-1];Global.signTrackArray&&Global.signTrackArray.length&&(pathExist=Global.signTrackArray.find(e=>e===t.route))?pathExist=!0:(pathExist=!1,n=autoPageObj(t.route,n.length,n),uAutoStartTrackPVData(n))}else"leave"!==e||pathExist||uAutoStopTrackPVData()}let uglInterval=null;function init(e){var t;e?(t=setReportUrl(e.env),Global.upEventUrl=t.upEventApi,Global.upTrackUrl=t.upTrackApi,initGetTrackId(),Object.assign(Global,e),getBaseicInfo(),startGlobalTime(),Global.platform!==wxMini&&uniInterceptorListener()):console.log("init config error, please check config!")}function startGlobalTime(){clearInterval(uglInterval),uglInterval=null,uglInterval=setInterval(()=>{queryEventDataUpload(),queryTrackDataUpload()},15e3)}function setUserId(e){e?(Global.distinctId=e,(Global.platform===wxMini?wx:uni).setStorageSync(usrIdKey$1,e)):(Global.distinctId="",Global.platform===wxMini?wx.setStorageSync(usrIdKey$1,e):uni.setStorageSync(usrIdKey$1,""))}function setCustomEvent(e){e&&eventCommonStore(e)}function onStartTrack(e){uStartTrackPVData(e)}function onDestroyTrack(){uDestoryTrackPVData()}function setPageExtraObj(e){uUpdatePageExtraArray(e)}export{init,onDestroyTrack,onStartTrack,setCustomEvent,setPageExtraObj,setUserId};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).BuriedPointUni={})})(this,function(e){var C="bfb44ddca5cf736ad2de14240a8d52a1#2.0.1-alpha.01";let t="v_userId",n="v_anonId";function M(){let e=wx.getStorageSync(n);return e||(e="xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),wx.setStorageSync(n,e)),e}let r={ENTER:"enter",LOOP:"loop",LEAVE:"leave"},a="UNIBPNPVUVSrcData",i="UNIBPNPVUVFailData",u="wxMini",o="v_userId",s="v_anonId",c={env:"",domain:"",busSegment:"",module:"",flushInterval:"",pageInterval:"",token:"",appData:null,deviceData:null,distinctId:"",anonymousId:"",version:"",trackId:"",platform:"",uAgent:"",upEventUrl:"",upTrackUrl:"",isCompatible:!0,signTrackArray:[]},l=[],p=[];let g=()=>{var e;return c.trackId||(e=Date.now().toString(),c.trackId=e,p=[],e)};function d(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function m(e){e=new Date(e);return e.getFullYear()+`-${e.getMonth()+1<10?"0"+(e.getMonth()+1):e.getMonth()+1}-${e.getDate()<10?"0"+e.getDate():e.getDate()} ${e.getHours()<10?"0"+e.getHours():e.getHours()}:${e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes()}:`+(e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds())}function V(e){var t;return{lang:e.osLanguage||e.hostLanguage,brand:e.deviceBrand+" "+e.deviceModel,os:e.osName,osVersion:e.osVersion,resolution:e.screenWidth+"x"+e.screenHeight,browser:e.browserName,browserVersion:e.browserVersion,color:"",deviceId:e.deviceId,deviceType:(e=e,"web"===c.platform?(t=e.ua.toLowerCase(),/(windows|win32|win64|wow64)/.test(t)?1:(/(linux|android)/.test(t)||/(macintosh|mac os x|iphone|ipad|ipod)/.test(t),2)):"pc"===e.deviceType?1:2),network:""}}function J(){if("web"===c.platform){var e=window.location.href;if(e&&!e.includes("file://")&&/^(https?:\/\/[^\s$.?#].[^\s]*)$/i.test(e)){var e=window.location.href.split("?")[1];if(e)return{utmSource:(e=new URLSearchParams(e)).get("utmSource")||"",utmCampaign:e.get("utmCampaign")||"",utmTerm:e.get("utmTerm")||"",utmContent:e.get("utmContent")||"",ctk:e.get("ctk")||""}}}return null}function $(e,t){let n=null;var r,o=(n=(c.platform===u?wx:uni).getStorageSync(a))?JSON.parse(n):[];0<o.length&&-1!==(r=o.findIndex(e=>e.uid===t))?o[r]={...o[r],...e}:o.push(e),(c.platform===u?wx:uni).setStorageSync(a,JSON.stringify(o))}function j(){var e;wx.env&&wx.canIUse?(c.platform=u,c.appData={name:"",packageName:(e=wx.getAccountInfoSync().miniProgram)?e.appId:"",version:e?e.envVersion+e.version:"",carrier:"mini",ecology:"mini"},c.deviceData=(()=>{var t,e=wx.getSystemInfoSync();let n={lang:e.language,brand:e.brand+" "+e.model,os:e.platform,osVersion:e.system,resolution:e.screenWidth+"x"+e.screenHeight,browser:"",browserVersion:"",color:"",deviceId:"",deviceType:(t=e.system,["Windows","Linux","macOS"].every(e=>t.includes(e))?1:2),network:""};return wx.getNetworkType({success(e){n.network=e.networkType}}),n})(),c.distinctId=wx.getStorageSync(t)?wx.getStorageSync(t):"",c.anonymousId=M()):(uni.getSystemInfo({success:function(e){c.uAgent=e.ua;var t,n,r,o=e.uniPlatform;o.includes("app")?(c.platform=e.osName,c.appData=(t=>{var n=plus.runtime.version,n={name:t.appName,version:n||"",carrier:"unknown",packageName:"",ecology:""};if("android"===t.platform){let e=n.carrier="Android";var r=plus.android.runtimeMainActivity().getPackageName();t.romName.includes("HarmonyOS")&&(e="Harmony OS",n.carrier="Harmony OS"),n.packageName=r||"",n.ecology=e}else"ios"===t.platform?(r=plus.ios.importClass("NSBundle").mainBundle().bundleIdentifier(),n.packageName=r||"",n.carrier="iOS",n.ecology="iOS"):n.ecology="unknown";return n})(e)):o.includes("web")||o.includes("h5")?(c.platform="web",t=(t=e).ua.toLowerCase(),n=window.location.hostname,r=document.title,/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t),t.includes("alipay")||t.includes("unionPay")||t.includes("onbuygz")||t.includes("onetravel"),t.includes("micromessenger")&&t.includes("miniprogram"),t={name:r||"",packageName:n||"",version:"",carrier:"H5",ecology:"h5"},c.appData={...t,version:c.version||"unknown"}):o.includes("weixin")&&(c.platform="weixin",c.appData=(r=uni.getAccountInfoSync(),{name:uni.getAppBaseInfo().appName||"",packageName:r?r.miniProgram.appId:"",version:r?r.miniProgram.envVersion+r.miniProgram.version:"",carrier:"mini",ecology:"mini"})),c.deviceData=V(e)},fail:function(e){c.deviceData={lang:"",brand:"",os:"",osVersion:"",resolution:"",browser:"",browserVersion:"",color:"",deviceId:"",deviceType:"",network:""}},complete:function(){uni.getNetworkType({success(e){c.deviceData.network=e.networkType}})}}),c.distinctId=uni.getStorageSync(o)||"",c.anonymousId=uni.getStorageSync(s),c.anonymousId||(c.anonymousId=d()),uni.setStorageSync(s,c.anonymousId))}function H(e,t){return e(t={exports:{}},t.exports),t.exports}function R(e){return null!=e&&(q(e)||"function"==typeof(t=e).readFloatLE&&"function"==typeof t.slice&&q(t.slice(0,0))||!!e._isBuffer);var t}var z=H(function(e){var a,n;a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];0<e;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var t=[],n=0;n<e.length;n+=3)for(var r=e[n]<<16|e[n+1]<<8|e[n+2],o=0;o<4;o++)8*n+6*o<=8*e.length?t.push(a.charAt(r>>>6*(3-o)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,r=0;n<e.length;r=++n%4)0!=r&&t.push((a.indexOf(e.charAt(n-1))&Math.pow(2,-2*r+8)-1)<<2*r|a.indexOf(e.charAt(n))>>>6-2*r);return t}},e.exports=n}),f={utf8:{stringToBytes:function(e){return f.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(f.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},W=f;function q(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var F=H(function(e){function y(e,t){e.constructor==String?e=(t&&"binary"===t.encoding?w:S).stringToBytes(e):h(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=v.bytesToWords(e),t=8*e.length,r=1732584193,o=-271733879,a=-1732584194,i=271733878,u=0;u<n.length;u++)n[u]=16711935&(n[u]<<8|n[u]>>>24)|4278255360&(n[u]<<24|n[u]>>>8);n[t>>>5]|=128<<t%32,n[14+(64+t>>>9<<4)]=t;for(var s=y._ff,c=y._gg,l=y._hh,p=y._ii,u=0;u<n.length;u+=16){var g=r,d=o,m=a,f=i,r=s(r,o,a,i,n[u+0],7,-680876936),i=s(i,r,o,a,n[u+1],12,-389564586),a=s(a,i,r,o,n[u+2],17,606105819),o=s(o,a,i,r,n[u+3],22,-1044525330);r=s(r,o,a,i,n[u+4],7,-176418897),i=s(i,r,o,a,n[u+5],12,1200080426),a=s(a,i,r,o,n[u+6],17,-1473231341),o=s(o,a,i,r,n[u+7],22,-45705983),r=s(r,o,a,i,n[u+8],7,1770035416),i=s(i,r,o,a,n[u+9],12,-1958414417),a=s(a,i,r,o,n[u+10],17,-42063),o=s(o,a,i,r,n[u+11],22,-1990404162),r=s(r,o,a,i,n[u+12],7,1804603682),i=s(i,r,o,a,n[u+13],12,-40341101),a=s(a,i,r,o,n[u+14],17,-1502002290),r=c(r,o=s(o,a,i,r,n[u+15],22,1236535329),a,i,n[u+1],5,-165796510),i=c(i,r,o,a,n[u+6],9,-1069501632),a=c(a,i,r,o,n[u+11],14,643717713),o=c(o,a,i,r,n[u+0],20,-373897302),r=c(r,o,a,i,n[u+5],5,-701558691),i=c(i,r,o,a,n[u+10],9,38016083),a=c(a,i,r,o,n[u+15],14,-660478335),o=c(o,a,i,r,n[u+4],20,-405537848),r=c(r,o,a,i,n[u+9],5,568446438),i=c(i,r,o,a,n[u+14],9,-1019803690),a=c(a,i,r,o,n[u+3],14,-187363961),o=c(o,a,i,r,n[u+8],20,1163531501),r=c(r,o,a,i,n[u+13],5,-1444681467),i=c(i,r,o,a,n[u+2],9,-51403784),a=c(a,i,r,o,n[u+7],14,1735328473),r=l(r,o=c(o,a,i,r,n[u+12],20,-1926607734),a,i,n[u+5],4,-378558),i=l(i,r,o,a,n[u+8],11,-2022574463),a=l(a,i,r,o,n[u+11],16,1839030562),o=l(o,a,i,r,n[u+14],23,-35309556),r=l(r,o,a,i,n[u+1],4,-1530992060),i=l(i,r,o,a,n[u+4],11,1272893353),a=l(a,i,r,o,n[u+7],16,-155497632),o=l(o,a,i,r,n[u+10],23,-1094730640),r=l(r,o,a,i,n[u+13],4,681279174),i=l(i,r,o,a,n[u+0],11,-358537222),a=l(a,i,r,o,n[u+3],16,-722521979),o=l(o,a,i,r,n[u+6],23,76029189),r=l(r,o,a,i,n[u+9],4,-640364487),i=l(i,r,o,a,n[u+12],11,-421815835),a=l(a,i,r,o,n[u+15],16,530742520),r=p(r,o=l(o,a,i,r,n[u+2],23,-995338651),a,i,n[u+0],6,-198630844),i=p(i,r,o,a,n[u+7],10,1126891415),a=p(a,i,r,o,n[u+14],15,-1416354905),o=p(o,a,i,r,n[u+5],21,-57434055),r=p(r,o,a,i,n[u+12],6,1700485571),i=p(i,r,o,a,n[u+3],10,-1894986606),a=p(a,i,r,o,n[u+10],15,-1051523),o=p(o,a,i,r,n[u+1],21,-2054922799),r=p(r,o,a,i,n[u+8],6,1873313359),i=p(i,r,o,a,n[u+15],10,-30611744),a=p(a,i,r,o,n[u+6],15,-1560198380),o=p(o,a,i,r,n[u+13],21,1309151649),r=p(r,o,a,i,n[u+4],6,-145523070),i=p(i,r,o,a,n[u+11],10,-1120210379),a=p(a,i,r,o,n[u+2],15,718787259),o=p(o,a,i,r,n[u+9],21,-343485551),r=r+g>>>0,o=o+d>>>0,a=a+m>>>0,i=i+f>>>0}return v.endian([r,o,a,i])}var v,S,h,w;v=z,S=W.utf8,h=R,w=W.bin,y._ff=function(e,t,n,r,o,a,i){e=e+(t&n|~t&r)+(o>>>0)+i;return(e<<a|e>>>32-a)+t},y._gg=function(e,t,n,r,o,a,i){e=e+(t&r|n&~r)+(o>>>0)+i;return(e<<a|e>>>32-a)+t},y._hh=function(e,t,n,r,o,a,i){e=e+(t^n^r)+(o>>>0)+i;return(e<<a|e>>>32-a)+t},y._ii=function(e,t,n,r,o,a,i){e=e+(n^(t|~r))+(o>>>0)+i;return(e<<a|e>>>32-a)+t},y._blocksize=16,y._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);e=v.wordsToBytes(y(e,t));return t&&t.asBytes?e:t&&t.asString?w.bytesToString(e):v.bytesToHex(e)}});let K=C;function Y(e,t,n){var r;e?(r=t,r={...r={app:c.appData,data:r,device:c.deviceData,lsi:K,projectId:c.token,userAgent:c.uAgent||"",anonymousId:c.anonymousId,userId:c.distinctId},dataAbstract:F(JSON.stringify(r))},c.platform===u?wx.request({url:"event"===e?c.upEventUrl:c.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:c.token,projectId:c.token},data:r,success:function(e){e&&e.data?wx.setStorageSync(n,JSON.stringify(t)):wx.setStorageSync(n,"")},fail:function(e){console.error(e),wx.setStorageSync(n,JSON.stringify(t))}}):uni.request({url:"event"===e?c.upEventUrl:c.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:c.token,projectId:c.token},data:r,success:function(e){e&&e.data?uni.setStorageSync(n,JSON.stringify(t)):uni.setStorageSync(n,"")},fail:function(e){console.log("error: ",e),uni.setStorageSync(n,JSON.stringify(t))}})):console.error("please set upload data upType")}let y,v,S,h,w,x,b;function Z(){clearInterval(x),x=null,b=0,w=null,v=0,S=0}let G=e=>{Z(),w=e,I(r.ENTER),x=setInterval(()=>{I(r.LOOP)},15e3)},Q=()=>{w&&I(r.LEAVE),Z()};function I(e){e===r.ENTER?(h=1,y=0,b=randomUUID(),v=Date.now(),S=v):e===r.LOOP?(h=2,y=15,S=Date.now()):e===r.LEAVE&&(h=3,e=Math.max(1,(Date.now()-S)/1e3),y=Math.ceil(e));e={busSegment:w.busSegment||"",circulation:h,domain:w.domain,duration:y,module:w.module||"",path:w.path,url:w.url,sourceDomain:w.sourceDomain,sourceUrl:w.sourceUrl,properties:w.properties,title:w.title,traceId:"",trackId:g(),visitPage:w.visitPage,visitTime:m(v),uid:b};$(e,b)}let k="UNIBPNEventSrcData",X="UNIBPNEventFailData";function ee(t){var n=t.$page||"",e=n.path||((e=(e=getCurrentPages())[e.length-1])?e.route:"/"),n={utm:t.$utm||J(),duration:"",element:t.$element||null,eventId:t.$event_id||"",event:t.$event_code||"",groupId:"",busSegment:t.$busSegment||"",module:t.$module||"",page:{domain:n.domain||"",pageId:F(e),path:e||"",title:n.title||"",url:e||""},properties:t.$extend_param?JSON.stringify(t.$extend_param):"",traceId:"",trackId:g(),triggerTime:m(Date.now())};{t=n;let e;n=(e=(c.platform===u?wx:uni).getStorageSync(k))?JSON.parse(e):[];n.push(t),(c.platform===u?wx:uni).setStorageSync(k,JSON.stringify(n));return}}let T,N,O,A,D,P,E;function te(){P&&U(r.LEAVE,null),clearInterval(A),A=null}function U(e,t){e===r.ENTER?(P=null,E=0,D=1,T=0,N=-1,O=-1,N=Date.now(),O=N,E=d(),P=(e=>{var t=getCurrentPages(),n=t[t.length-1],r=c.platform;let o="",a="",i="",u="";if("web"===r||"h5"===r?(o=window.location.href,a=window.location.hostname,document.referrer&&(r=new URL(document.referrer),i=r||"",u=r.hostname||"")):(o=n.route,i=(1<t.length?t[t.length-2]:n).route,a=c.domain||n.route),n)return{path:n.route,busSegment:e.busSegment||"",module:e.module||"",properties:e.extend_param?JSON.stringify(e.extend_param):"",title:e.title||"",domain:a,url:o,visitPage:t.length,sourceDomain:u,sourceUrl:i}})(t),p.push(P.path)):e===r.LOOP?(D=2,T=15,O=Date.now()):e===r.LEAVE&&(D=3,t=Math.max(1,(Date.now()-O)/1e3),T=Math.ceil(t));e={busSegment:P.busSegment,circulation:D,domain:P.domain,duration:T,module:P.module,path:P.path,properties:P.properties,sourceDomain:P.sourceDomain,sourceUrl:P.sourceUrl,title:P.title,traceId:"",trackId:g(),url:P.url,visitPage:p.length,visitTime:m(N),utm:J(),uid:E};$(e,E)}let B=!1;function L(e){if(!c.isCompatible)if("pv"===e){var n=getCurrentPages();let t=n[n.length-1];c.signTrackArray&&c.signTrackArray.length&&(B=c.signTrackArray.find(e=>e===t.route))?B=!0:(B=!1,n=((t,e,n)=>{var r=l.find(e=>e.path===t),o=c.platform;let a="",i="",u="",s="";return o&&("web"===o||"h5"===o?(a=window.location.href,i=window.location.hostname,document.referrer&&(o=new URL(document.referrer),u=o||"",s=o.hostname||"")):(a=t,1<e&&(o=n[e-2],u=o.route),i=c.domain||t)),{path:r&&r.path?r.path:t,busSegment:r&&r.busSegment?r.busSegment:c.busSegment||"",module:r&&r.module?r.module:c.module||"",properties:r&&r.properties?r.properties:"",domain:i,url:a,visitPage:e,sourceDomain:s,sourceUrl:u,title:r&&r.title?r.title:""}})(t.route,n.length,n),G(n))}else"leave"!==e||B||Q()}let _=null;e.init=function(e){var t;e?(t="test"!==e.env?{upEventApi:"https://buryingpoint.onebuygz.com/client/api/event",upTrackApi:"https://buryingpoint.onebuygz.com/client/api/track",eventListApi:"https://buryingpoint.onebuygz.com/api/event/query/eventList"}:{upEventApi:"https://buryingpoint.gcongo.com.cn/client/api/event",upTrackApi:"https://buryingpoint.gcongo.com.cn/client/api/track",eventListApi:"https://buryingpoint.gcongo.com.cn/api/event/query/eventList"},c.upEventUrl=t.upEventApi,c.upTrackUrl=t.upTrackApi,t=Date.now().toString(),c.trackId=t,p=[],Object.assign(c,e),j(),clearInterval(_),_=null,_=setInterval(()=>{{let e=null,t=null;var n=[],r=(t=(c.platform===u?(e=wx.getStorageSync(k),wx.setStorageSync(k,""),wx):(e=uni.getStorageSync(k),uni.setStorageSync(k,""),uni)).getStorageSync(X),e?JSON.parse(e):[]),o=t?JSON.parse(t):[];r.length&&n.push(...r),o.length&&n.push(...o),n&&n.length&&Y("event",n,X)}{let e=null,t=null;r=[],t=(c.platform===u?(e=wx.getStorageSync(a),wx.setStorageSync(a,""),wx):(e=uni.getStorageSync(a),uni.setStorageSync(a,""),uni)).getStorageSync(i),o=e?JSON.parse(e):[],n=t?JSON.parse(t):[],o.length&&r.push(...o),n.length&&(r.push(...n),r.forEach(e=>{delete e.pageUUId})),r&&r.length&&Y("track",r,i)}},15e3),c.platform!==u&&(uni.addInterceptor("navigateTo",{invoke(e){L("leave")},success(e){L("pv")}}),uni.addInterceptor("switchTab",{invoke(e){L("leave")},success(e){L("pv")}}),uni.addInterceptor("navigateBack",{invoke(e){L("leave")},success(e){L("pv")}}))):console.log("init config error, please check config!")},e.onDestroyTrack=function(){te()},e.onStartTrack=function(e){e=e,A&&te(),e&&(clearInterval(A),U(r.ENTER,e),A=setInterval(()=>{U(r.LOOP,null)},15e3))},e.setCustomEvent=function(e){e&&ee(e)},e.setPageExtraObj=function(e){{var n=getCurrentPages();let t=n[n.length-1];n=l.findIndex(e=>e.path===t.route),e={path:t.route,properties:e.properties?JSON.stringify(e.properties):"",busSegment:e.busSegment||"",module:e.module||"",title:e.title||""},-1!==n?l[n]=e:l.push(e)}},e.setUserId=function(e){e?(c.distinctId=e,(c.platform===u?wx:uni).setStorageSync(o,e)):(c.distinctId="",c.platform===u?wx.setStorageSync(o,e):uni.setStorageSync(o,""))},Object.defineProperty(e,"__esModule",{value:!0})});
|
package/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visual-buried-point-platform-uni",
|
|
3
|
-
"version": "
|
|
4
|
-
"lsi": "
|
|
3
|
+
"version": "2.0.1-alpha.01",
|
|
4
|
+
"lsi": "bfb44ddca5cf736ad2de14240a8d52a1#2.0.1-alpha.01",
|
|
5
5
|
"description": "To make it easy for you to get started with GitLab, here's a list of recommended next steps.",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "dist/cjs/buried-point-uni.js",
|
|
7
|
+
"module": "dist/esm/buried-point-uni.js",
|
|
8
|
+
"umd:main": "dist/umd/buried-point-uni.js",
|
|
7
9
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"build": "webpack --mode production && npm run lsi-md5",
|
|
10
|
-
"lsi-md5": "node lsi-md5.js"
|
|
10
|
+
"build": "rimraf dist && rollup -c --environment INCLUDE_DEPS,BUILD:production && node lsi-md5.cjs"
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
13
16
|
"repository": {
|
|
14
17
|
"type": "git",
|
|
15
18
|
"url": ""
|
|
@@ -21,7 +24,19 @@
|
|
|
21
24
|
"md5": "^2.3.0"
|
|
22
25
|
},
|
|
23
26
|
"devDependencies": {
|
|
27
|
+
"rimraf": "^6.0.1",
|
|
24
28
|
"webpack": "^5.72.1",
|
|
25
|
-
"webpack-cli": "
|
|
29
|
+
"webpack-cli": "^6.0.1",
|
|
30
|
+
"@babel/core": "^7.26.10",
|
|
31
|
+
"@babel/preset-env": "^7.26.9",
|
|
32
|
+
"@rollup/plugin-json": "^6.0.1",
|
|
33
|
+
"babel-loader": "^10.0.0",
|
|
34
|
+
"babel-preset-es2015": "^6.24.1",
|
|
35
|
+
"rollup": "^1.20.2",
|
|
36
|
+
"rollup-plugin-babel": "^4.3.3",
|
|
37
|
+
"rollup-plugin-commonjs": "^10.0.2",
|
|
38
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
|
39
|
+
"rollup-plugin-replace": "^2.2.0",
|
|
40
|
+
"rollup-plugin-uglify": "^6.0.2"
|
|
26
41
|
}
|
|
27
42
|
}
|
package/bpstorage.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const storgkeyName = "buriedPointKey";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 新增数据
|
|
5
|
-
*/
|
|
6
|
-
export function addSData(data) {
|
|
7
|
-
if (data) {
|
|
8
|
-
uni.setStorageSync(storgkeyName, JSON.stringify(data));
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 读取数据
|
|
14
|
-
*/
|
|
15
|
-
export function getSData() {
|
|
16
|
-
let allData = uni.getStorageSync(storgkeyName);
|
|
17
|
-
if (allData) {
|
|
18
|
-
return JSON.parse(allData);
|
|
19
|
-
} else {
|
|
20
|
-
return "";
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 删除数据
|
|
26
|
-
*/
|
|
27
|
-
export function delSData() {
|
|
28
|
-
uni.setStorageSync(storgkeyName, "");
|
|
29
|
-
}
|
package/cache.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const deepCopy = (target) => {
|
|
2
|
-
if (typeof target === "object") {
|
|
3
|
-
const result = Array.isArray(target) ? [] : {};
|
|
4
|
-
for (const key in target) {
|
|
5
|
-
if (typeof target[key] == "object") {
|
|
6
|
-
result[key] = deepCopy(target[key]);
|
|
7
|
-
} else {
|
|
8
|
-
result[key] = target[key];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return result;
|
|
12
|
-
}
|
|
13
|
-
return target;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const cacheData = [];
|
|
17
|
-
|
|
18
|
-
export const addCache = (data) => {
|
|
19
|
-
cacheData.push(data);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const getCache = () => {
|
|
23
|
-
return deepCopy(cacheData);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const clearCache = () => {
|
|
27
|
-
cacheData.length = 0;
|
|
28
|
-
};
|
package/config.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export function setReportUrl(env) {
|
|
2
|
-
switch (env) {
|
|
3
|
-
case "test":
|
|
4
|
-
return {
|
|
5
|
-
reportUrl: "https://buryingpoint.gcongo.com.cn/client/api/event",
|
|
6
|
-
reportTrackUrl: "https://buryingpoint.gcongo.com.cn/client/api/track",
|
|
7
|
-
eventListUrl:
|
|
8
|
-
"https://buryingpoint.gcongo.com.cn/api/event/query/eventList",
|
|
9
|
-
};
|
|
10
|
-
case "production":
|
|
11
|
-
return {
|
|
12
|
-
reportUrl: "https://buryingpoint.onebuygz.com/client/api/event",
|
|
13
|
-
reportTrackUrl: "https://buryingpoint.onebuygz.com/client/api/track",
|
|
14
|
-
eventListUrl:
|
|
15
|
-
"https://buryingpoint.onebuygz.com/api/event/query/eventList",
|
|
16
|
-
};
|
|
17
|
-
default:
|
|
18
|
-
return {
|
|
19
|
-
reportUrl: "https://buryingpoint.onebuygz.com/client/api/event",
|
|
20
|
-
reportTrackUrl: "https://buryingpoint.onebuygz.com/client/api/track",
|
|
21
|
-
eventListUrl:
|
|
22
|
-
"https://buryingpoint.onebuygz.com/api/event/query/eventList",
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
package/index.js
DELETED
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import MD5 from "md5";
|
|
2
|
-
import pk from "./package.json";
|
|
3
|
-
import { addCache, getCache, clearCache } from "./cache.js";
|
|
4
|
-
import { addSData, getSData, delSData } from "./bpstorage.js";
|
|
5
|
-
import {
|
|
6
|
-
randomUUID,
|
|
7
|
-
webH5Info,
|
|
8
|
-
wxInfo,
|
|
9
|
-
getAppInfo,
|
|
10
|
-
getDeviceInfo,
|
|
11
|
-
getDeviceInfoError,
|
|
12
|
-
timeToStr,
|
|
13
|
-
getTrackObj,
|
|
14
|
-
getCurPath,
|
|
15
|
-
getUrl,
|
|
16
|
-
} from "./tools.js";
|
|
17
|
-
import { setReportUrl } from "./config.js";
|
|
18
|
-
|
|
19
|
-
const localLsi = pk.lsi;
|
|
20
|
-
let platform = "";
|
|
21
|
-
let uAgent = "";
|
|
22
|
-
let reportUrl = "";
|
|
23
|
-
let reportTrackUrl = "";
|
|
24
|
-
let trackId = "";
|
|
25
|
-
let _comInfo = { distinctId: "", anonymousId: "" };
|
|
26
|
-
let appData = {};
|
|
27
|
-
let deviceData = {};
|
|
28
|
-
let _config = {
|
|
29
|
-
env: "production",
|
|
30
|
-
token: "",
|
|
31
|
-
srcDomain: "",
|
|
32
|
-
flushInterval: 15,
|
|
33
|
-
};
|
|
34
|
-
//custom
|
|
35
|
-
let timer = null;
|
|
36
|
-
//track upload interval
|
|
37
|
-
let tInterval = null;
|
|
38
|
-
let busObj = null;
|
|
39
|
-
let startTime = 0;
|
|
40
|
-
let startTimeLong = 0;
|
|
41
|
-
|
|
42
|
-
//common global upload interval
|
|
43
|
-
let cInterval = null;
|
|
44
|
-
|
|
45
|
-
export function init(config) {
|
|
46
|
-
if (config) {
|
|
47
|
-
let _cf = setReportUrl(config.env ? config.env : "");
|
|
48
|
-
reportUrl = _cf.reportUrl;
|
|
49
|
-
reportTrackUrl = _cf.reportTrackUrl;
|
|
50
|
-
if (config.flushInterval) {
|
|
51
|
-
if (config.flushInterval < 5) {
|
|
52
|
-
config.flushInterval = 15;
|
|
53
|
-
}
|
|
54
|
-
} else {
|
|
55
|
-
config.flushInterval = 15;
|
|
56
|
-
}
|
|
57
|
-
_config = {
|
|
58
|
-
env: config.env,
|
|
59
|
-
token: config.token ? config.token : "",
|
|
60
|
-
srcDomain: config.sourceDomain ? config.sourceDomain : "",
|
|
61
|
-
flushInterval: config.flushInterval,
|
|
62
|
-
};
|
|
63
|
-
getBaseicInfo();
|
|
64
|
-
_comInfo.distinctId = uni.getStorageSync("v_userId")
|
|
65
|
-
? uni.getStorageSync("v_userId")
|
|
66
|
-
: "";
|
|
67
|
-
_comInfo.anonymousId = uni.getStorageSync("v_anonId");
|
|
68
|
-
if (!_comInfo.anonymousId) {
|
|
69
|
-
_comInfo.anonymousId = randomUUID();
|
|
70
|
-
uni.setStorageSync("v_anonId", _comInfo.anonymousId);
|
|
71
|
-
}
|
|
72
|
-
if (!trackId) {
|
|
73
|
-
trackId = Date.now().toString();
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
console.log("init config error, please check config!");
|
|
77
|
-
}
|
|
78
|
-
startGlobalTime();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
//the general custom reportCustom interval is enabled
|
|
82
|
-
function startGlobalTime() {
|
|
83
|
-
clearInterval(cInterval);
|
|
84
|
-
cInterval = setInterval(() => {
|
|
85
|
-
let cData = getSData();
|
|
86
|
-
if (cData) {
|
|
87
|
-
reportCustom(cData);
|
|
88
|
-
delSData();
|
|
89
|
-
}
|
|
90
|
-
}, _config.flushInterval * 1000);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
//bind userID
|
|
94
|
-
export function setUserId(userId) {
|
|
95
|
-
if (userId) {
|
|
96
|
-
_comInfo.distinctId = userId;
|
|
97
|
-
uni.setStorageSync("v_userId", userId);
|
|
98
|
-
} else {
|
|
99
|
-
_comInfo.distinctId = "";
|
|
100
|
-
uni.setStorageSync("v_userId", "");
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
//set custom event
|
|
105
|
-
export function setCustomEvent(data) {
|
|
106
|
-
let reportData = null;
|
|
107
|
-
const _page = data.$page ? data.$page : "";
|
|
108
|
-
const _path = _page.path ? _page.path : getCurPath();
|
|
109
|
-
reportData = {
|
|
110
|
-
ctk: data.$ctk ? data.$ctk : "",
|
|
111
|
-
duration: "",
|
|
112
|
-
element: data.$element ? data.$element : null,
|
|
113
|
-
eventId: data.$event_id ? data.$event_id : "",
|
|
114
|
-
event: data.$event_code ? data.$event_code : "",
|
|
115
|
-
groupId: "",
|
|
116
|
-
busSegment: data.$busSegment,
|
|
117
|
-
module: data.$module,
|
|
118
|
-
page: {
|
|
119
|
-
domain: _page.domain ? _page.domain : "",
|
|
120
|
-
pageId: MD5(_path),
|
|
121
|
-
path: _path,
|
|
122
|
-
title: _page.title ? _page.title : "",
|
|
123
|
-
url: _path ? _path : getUrl(platform),
|
|
124
|
-
},
|
|
125
|
-
properties: data.$extend_param ? JSON.stringify(data.$extend_param) : "",
|
|
126
|
-
traceId: "",
|
|
127
|
-
trackId: trackId,
|
|
128
|
-
triggerTime: timeToStr(Date.now()),
|
|
129
|
-
};
|
|
130
|
-
if (reportData) {
|
|
131
|
-
addCache(reportData);
|
|
132
|
-
clearTimeout(timer);
|
|
133
|
-
timer = setTimeout(() => {
|
|
134
|
-
const data = getCache();
|
|
135
|
-
if (data.length) {
|
|
136
|
-
addSData(data);
|
|
137
|
-
clearCache();
|
|
138
|
-
}
|
|
139
|
-
}, 1000);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function reportCustom(data) {
|
|
144
|
-
if (!reportUrl) {
|
|
145
|
-
console.error("please set upload data reportUrl");
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
const comData = commonData(data);
|
|
149
|
-
const reportData = {
|
|
150
|
-
...comData,
|
|
151
|
-
dataAbstract: MD5(JSON.stringify(comData)),
|
|
152
|
-
};
|
|
153
|
-
uni.request({
|
|
154
|
-
url: reportUrl,
|
|
155
|
-
method: "POST",
|
|
156
|
-
header: {
|
|
157
|
-
"Content-Type": "application/json",
|
|
158
|
-
appKey: _config.token,
|
|
159
|
-
projectId: _config.token,
|
|
160
|
-
},
|
|
161
|
-
data: reportData,
|
|
162
|
-
success: function (res) {},
|
|
163
|
-
fail: function (error) {
|
|
164
|
-
console.error(error);
|
|
165
|
-
},
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
//track upload-registry
|
|
170
|
-
export function onStartTrack(tData) {
|
|
171
|
-
busObj = null;
|
|
172
|
-
startTime = 0;
|
|
173
|
-
startTimeLong = Date.now();
|
|
174
|
-
busObj = tData;
|
|
175
|
-
clearInterval(tInterval);
|
|
176
|
-
assemblyTrackData("start");
|
|
177
|
-
tInterval = setInterval(() => {
|
|
178
|
-
startTime += 15;
|
|
179
|
-
startTimeLong = Date.now();
|
|
180
|
-
assemblyTrackData("start");
|
|
181
|
-
}, 15 * 1000);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
//track upload-销毁
|
|
185
|
-
export function onDestroyTrack() {
|
|
186
|
-
assemblyTrackData("destroy");
|
|
187
|
-
clearInterval(tInterval);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function assemblyTrackData(type) {
|
|
191
|
-
if (busObj) {
|
|
192
|
-
let obj = getTrackObj(busObj, platform);
|
|
193
|
-
let trackData = null;
|
|
194
|
-
let cirtemp;
|
|
195
|
-
if (type === "destroy") {
|
|
196
|
-
cirtemp = 3;
|
|
197
|
-
startTime = (Date.now() - startTimeLong) / 1000;
|
|
198
|
-
} else {
|
|
199
|
-
if (startTime === 0) {
|
|
200
|
-
startTime === 0;
|
|
201
|
-
cirtemp = 1;
|
|
202
|
-
} else {
|
|
203
|
-
startTime = 15;
|
|
204
|
-
cirtemp = 2;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
trackData = {
|
|
208
|
-
busSegment: busObj.busSegment,
|
|
209
|
-
circulation: cirtemp,
|
|
210
|
-
ctk: busObj.ctk ? busObj.ctk : "",
|
|
211
|
-
domain: obj.domain,
|
|
212
|
-
duration: startTime,
|
|
213
|
-
module: busObj.module,
|
|
214
|
-
path: obj.path,
|
|
215
|
-
properties: busObj.extend_param
|
|
216
|
-
? JSON.stringify(busObj.extend_param)
|
|
217
|
-
: "",
|
|
218
|
-
sourceDomain: obj.sourceDomain ? obj.sourceDomain : _config.srcDomain,
|
|
219
|
-
sourceUrl: obj.sourceUrl,
|
|
220
|
-
title: obj.title,
|
|
221
|
-
traceId: busObj.traceId ? busObj.traceId : "",
|
|
222
|
-
trackId: trackId,
|
|
223
|
-
url: obj.url,
|
|
224
|
-
visitPage: obj.visitPage,
|
|
225
|
-
visitTime: busObj.visitTime ? busObj.visitTime : timeToStr(Date.now()),
|
|
226
|
-
};
|
|
227
|
-
if (trackData) {
|
|
228
|
-
reportTrack([trackData]);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// track upload data
|
|
234
|
-
function reportTrack(data) {
|
|
235
|
-
if (!reportTrackUrl) {
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
const comData = commonData(data);
|
|
239
|
-
const reportTrackData = {
|
|
240
|
-
...comData,
|
|
241
|
-
dataAbstract: MD5(JSON.stringify(comData)),
|
|
242
|
-
};
|
|
243
|
-
uni.request({
|
|
244
|
-
url: reportTrackUrl,
|
|
245
|
-
method: "POST",
|
|
246
|
-
header: {
|
|
247
|
-
"Content-Type": "application/json",
|
|
248
|
-
appKey: _config.token,
|
|
249
|
-
projectId: _config.token,
|
|
250
|
-
},
|
|
251
|
-
data: reportTrackData,
|
|
252
|
-
success: function (res) {},
|
|
253
|
-
fail: function (error) {
|
|
254
|
-
console.error(error);
|
|
255
|
-
},
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function commonData(allData) {
|
|
260
|
-
return {
|
|
261
|
-
app: appData,
|
|
262
|
-
data: allData,
|
|
263
|
-
device: deviceData,
|
|
264
|
-
lsi: localLsi,
|
|
265
|
-
projectId: _config.token,
|
|
266
|
-
userAgent: uAgent ? uAgent : "",
|
|
267
|
-
anonymousId: _comInfo.anonymousId,
|
|
268
|
-
userId: _comInfo.distinctId,
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
//获取基本信息
|
|
273
|
-
function getBaseicInfo() {
|
|
274
|
-
uni.getSystemInfo({
|
|
275
|
-
success: function (res) {
|
|
276
|
-
uAgent = res.ua;
|
|
277
|
-
let uniPlatform = res.uniPlatform;
|
|
278
|
-
if (uniPlatform.includes("app")) {
|
|
279
|
-
platform = res.osName;
|
|
280
|
-
appData = getAppInfo(res);
|
|
281
|
-
} else if (uniPlatform.includes("web") || uniPlatform.includes("h5")) {
|
|
282
|
-
platform = uniPlatform;
|
|
283
|
-
let wh5Info = webH5Info(res);
|
|
284
|
-
appData = {
|
|
285
|
-
...wh5Info,
|
|
286
|
-
version: _config.version ? _config.version : "unknown",
|
|
287
|
-
};
|
|
288
|
-
} else if (uniPlatform.includes("weixin")) {
|
|
289
|
-
platform = "wx";
|
|
290
|
-
appData = wxInfo();
|
|
291
|
-
}
|
|
292
|
-
deviceData = getDeviceInfo(res, platform);
|
|
293
|
-
},
|
|
294
|
-
fail: function (error) {
|
|
295
|
-
deviceData = getDeviceInfoError();
|
|
296
|
-
},
|
|
297
|
-
complete: function () {
|
|
298
|
-
uni.getNetworkType({
|
|
299
|
-
success(res) {
|
|
300
|
-
deviceData.network = res.networkType;
|
|
301
|
-
},
|
|
302
|
-
});
|
|
303
|
-
},
|
|
304
|
-
});
|
|
305
|
-
}
|
package/lsi-md5.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// 此js在npm build,根据name + version + md5后会自动修改package.json中的lsi
|
|
2
|
-
// 注:发给后端,作为标识依据和上报字段lsi值
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import MD5 from "md5";
|
|
5
|
-
const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
|
|
6
|
-
|
|
7
|
-
const { name, version } = packageJson;
|
|
8
|
-
// MD5
|
|
9
|
-
const combinedString = name + "-" + version;
|
|
10
|
-
const md5Str = MD5(combinedString);
|
|
11
|
-
packageJson.lsi = md5Str + "#" + version;
|
|
12
|
-
//base64
|
|
13
|
-
// const combinedString = name.substring(0, 16) + "v" + version;
|
|
14
|
-
// const base64Str = btoa(combinedString);
|
|
15
|
-
// packageJson.lsi = base64Str;
|
|
16
|
-
|
|
17
|
-
const updatedPackageJson = JSON.stringify(packageJson, null, 2);
|
|
18
|
-
fs.writeFileSync("./package.json", updatedPackageJson, "utf8");
|
|
19
|
-
|
|
20
|
-
console.log('write package.json "lsi" value success ');
|
package/tools.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
export function randomUUID() {
|
|
2
|
-
let uuid = "xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function (c) {
|
|
3
|
-
let r = (Math.random() * 16) | 0,
|
|
4
|
-
v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
5
|
-
return v.toString(16);
|
|
6
|
-
});
|
|
7
|
-
return uuid;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function timeToStr(timestamp) {
|
|
11
|
-
const date = new Date(timestamp);
|
|
12
|
-
const year = date.getFullYear();
|
|
13
|
-
const month =
|
|
14
|
-
date.getMonth() + 1 < 10
|
|
15
|
-
? "0" + (date.getMonth() + 1)
|
|
16
|
-
: date.getMonth() + 1;
|
|
17
|
-
const day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
|
18
|
-
const hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
|
19
|
-
const minute =
|
|
20
|
-
date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
|
21
|
-
const second =
|
|
22
|
-
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
|
23
|
-
const formattedDate = `${year}-${month}-${day} ${hour}:${minute}:${second}`;
|
|
24
|
-
return formattedDate;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//web或者h5的appInfo
|
|
28
|
-
export function webH5Info(result) {
|
|
29
|
-
let ecology = "unknown";
|
|
30
|
-
let ua = result.ua.toLowerCase();
|
|
31
|
-
let hostname = window.location.hostname;
|
|
32
|
-
let titleName = document.title;
|
|
33
|
-
let isMobile =
|
|
34
|
-
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua);
|
|
35
|
-
if (isMobile) {
|
|
36
|
-
ecology = "app";
|
|
37
|
-
} else {
|
|
38
|
-
ecology = "brower";
|
|
39
|
-
}
|
|
40
|
-
if (ua.includes("alipay")) {
|
|
41
|
-
ecology = "alipay";
|
|
42
|
-
} else if (ua.includes("unionPay")) {
|
|
43
|
-
ecology = "unionPay";
|
|
44
|
-
} else if (ua.includes("onbuygz")) {
|
|
45
|
-
ecology = "onbuygz";
|
|
46
|
-
} else if (ua.includes("onetravel")) {
|
|
47
|
-
ecology = "onetravel";
|
|
48
|
-
}
|
|
49
|
-
if (ua.includes("micromessenger")) {
|
|
50
|
-
if (ua.includes("miniprogram")) {
|
|
51
|
-
ecology = "wechat";
|
|
52
|
-
} else {
|
|
53
|
-
ecology = "brower";
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
name: titleName ? titleName : "",
|
|
58
|
-
packageName: hostname ? hostname : "",
|
|
59
|
-
version: "",
|
|
60
|
-
carrier: "h5",
|
|
61
|
-
ecology: ecology,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
//微信的appInfo
|
|
66
|
-
export function wxInfo() {
|
|
67
|
-
const accInfo = uni.getAccountInfoSync();
|
|
68
|
-
const bInfo = uni.getAppBaseInfo();
|
|
69
|
-
return {
|
|
70
|
-
name: bInfo.appName ? bInfo.appName : "",
|
|
71
|
-
packageName: accInfo ? accInfo.miniProgram.appId : "",
|
|
72
|
-
version: accInfo
|
|
73
|
-
? accInfo.miniProgram.envVersion + accInfo.miniProgram.version
|
|
74
|
-
: "",
|
|
75
|
-
carrier: "mini",
|
|
76
|
-
ecology: "wechat",
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
//app的appInfo
|
|
81
|
-
export function getAppInfo(result) {
|
|
82
|
-
let version = plus.runtime.version;
|
|
83
|
-
let app = {
|
|
84
|
-
name: result.appName,
|
|
85
|
-
version: version ? version : "",
|
|
86
|
-
carrier: "app",
|
|
87
|
-
packageName: "",
|
|
88
|
-
ecology: "",
|
|
89
|
-
};
|
|
90
|
-
if (result.platform === "android") {
|
|
91
|
-
let osName = "android";
|
|
92
|
-
let pkName = plus.android.runtimeMainActivity().getPackageName();
|
|
93
|
-
if (result.romName.includes("HarmonyOS")) {
|
|
94
|
-
osName = "harmonyOS";
|
|
95
|
-
}
|
|
96
|
-
app.packageName = pkName ? pkName : "";
|
|
97
|
-
app.ecology = osName;
|
|
98
|
-
} else if (result.platform === "ios") {
|
|
99
|
-
let pkName = plus.ios
|
|
100
|
-
.importClass("NSBundle")
|
|
101
|
-
.mainBundle()
|
|
102
|
-
.bundleIdentifier();
|
|
103
|
-
app.packageName = pkName ? pkName : "";
|
|
104
|
-
app.ecology = "ios";
|
|
105
|
-
} else {
|
|
106
|
-
app.ecology = "unknown";
|
|
107
|
-
}
|
|
108
|
-
return app;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function getCurDeviceType(res, platform) {
|
|
112
|
-
if (platform !== "wx") {
|
|
113
|
-
const userAgent = res.ua.toLowerCase();
|
|
114
|
-
if (/(windows|win32|win64|wow64)/.test(userAgent)) {
|
|
115
|
-
return 1;
|
|
116
|
-
} else if (/(linux|android)/.test(userAgent)) {
|
|
117
|
-
return 2;
|
|
118
|
-
} else if (/(macintosh|mac os x|iphone|ipad|ipod)/.test(userAgent)) {
|
|
119
|
-
return 2;
|
|
120
|
-
} else {
|
|
121
|
-
return 2;
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
if (res.deviceType === "pc") {
|
|
125
|
-
return 2;
|
|
126
|
-
} else {
|
|
127
|
-
return 1;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
//获取设备信息
|
|
133
|
-
export function getDeviceInfo(res, platform) {
|
|
134
|
-
let device = {
|
|
135
|
-
lang: res.osLanguage ? res.osLanguage : res.hostLanguage,
|
|
136
|
-
brand: res.deviceBrand + " " + res.deviceModel,
|
|
137
|
-
os: res.os,
|
|
138
|
-
osVersion: res.osVersion,
|
|
139
|
-
resolution: res.screenWidth + "x" + res.screenHeight,
|
|
140
|
-
browser: res.browserName,
|
|
141
|
-
browserVersion: res.browserVersion,
|
|
142
|
-
color: "",
|
|
143
|
-
deviceId: res.deviceId,
|
|
144
|
-
deviceType: getCurDeviceType(res, platform),
|
|
145
|
-
network: "",
|
|
146
|
-
};
|
|
147
|
-
return device;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
//error默认获取设备信息
|
|
151
|
-
export function getDeviceInfoError() {
|
|
152
|
-
return {
|
|
153
|
-
lang: "",
|
|
154
|
-
brand: "",
|
|
155
|
-
os: "",
|
|
156
|
-
osVersion: "",
|
|
157
|
-
resolution: "",
|
|
158
|
-
browser: "",
|
|
159
|
-
browserVersion: "",
|
|
160
|
-
color: "",
|
|
161
|
-
deviceId: "",
|
|
162
|
-
deviceType: "",
|
|
163
|
-
network: "",
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
//uni 通用h5、app、wx拿到当前路由栈
|
|
168
|
-
export function getTrackObj(busObj, platform) {
|
|
169
|
-
const pages = getCurrentPages();
|
|
170
|
-
const gcp = pages[pages.length - 1];
|
|
171
|
-
if (gcp) {
|
|
172
|
-
return {
|
|
173
|
-
path: gcp.route,
|
|
174
|
-
domain: busObj.domain ? busObj.domain : "",
|
|
175
|
-
url: busObj.url ? busObj.url : getUrl(platform),
|
|
176
|
-
circulation: pages.length > 1 ? 2 : 1,
|
|
177
|
-
visitPage: pages.length,
|
|
178
|
-
sourceDomain: busObj.sourceDomain ? busObj.sourceDomain : "",
|
|
179
|
-
sourceUrl: busObj.sourceUrl ? busObj.sourceUrl : "",
|
|
180
|
-
title: busObj.title ? busObj.title : "",
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export function getCurPath() {
|
|
186
|
-
const pages = getCurrentPages();
|
|
187
|
-
const gcp = pages[pages.length - 1];
|
|
188
|
-
return gcp ? gcp.route : "/";
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export function getUrl(platform) {
|
|
192
|
-
if (!platform) return "";
|
|
193
|
-
if (platform === "web" || platform === "h5") {
|
|
194
|
-
return window.location.href;
|
|
195
|
-
} else {
|
|
196
|
-
return "";
|
|
197
|
-
}
|
|
198
|
-
}
|
package/webpack.config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
4
|
-
const __dirname = path.dirname(__filename);
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
entry: "./index.js",
|
|
8
|
-
output: {
|
|
9
|
-
path: path.resolve(__dirname, "dist"),
|
|
10
|
-
filename: "buried-point-uni.js",
|
|
11
|
-
libraryTarget: "umd",
|
|
12
|
-
},
|
|
13
|
-
resolve: {
|
|
14
|
-
extensions: [".js"],
|
|
15
|
-
},
|
|
16
|
-
mode: "production",
|
|
17
|
-
};
|