zg-sdk-wechart 2.0.14 → 2.0.17
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 +1 -1
- package/dist/zhuge.es.min.js +1 -1
- package/dist/zhuge.min.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -370,4 +370,4 @@ export default Index;
|
|
|
370
370
|
|
|
371
371
|
|
|
372
372
|
#### 8. 如何新增或修改小程序可视化规则?
|
|
373
|
-
登录诸葛分析平台 - 顶部导航 - 数据管理 - 数据接入 - 微信小程序 - 可视化埋点 - 授权对应的小程序 - 启动可视化埋点 - 手机扫码小程序二维码 - 小程序通过scoket与分析平台进行连接 - 手机端进行点击或浏览操作 - 分析平台新增或修改可视化规则。(注:开发者在扫码后,需要在手机端打开小程序调试模式,这样避免微信官方的域名校验导致sckoet
|
|
373
|
+
登录诸葛分析平台 - 顶部导航 - 数据管理 - 数据接入 - 微信小程序 - 可视化埋点 - 授权对应的小程序 - 启动可视化埋点 - 手机扫码小程序二维码 - 小程序通过scoket与分析平台进行连接 - 手机端进行点击或浏览操作 - 分析平台新增或修改可视化规则。(注:开发者在扫码后,需要在手机端打开小程序调试模式,这样避免微信官方的域名校验导致sckoet连接失败的问题。)通过 socketUrl 可配置私有化的scoket连接。
|
package/dist/zhuge.es.min.js
CHANGED
|
@@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
function v(t,e,n,r){var i,o=arguments.length,u=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(u=(o<3?i(u):o>3?i(e,n,u):i(e,n))||u);return o>3&&u&&Object.defineProperty(e,n,u),u}function g(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{s(r.next(t))}catch(t){o(t)}}function a(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,a)}s((r=r.apply(t,e||[])).next())}))}var y,_={utmKeys:["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],isValid:function(t){return null==t},type:function(t){return Object.prototype.toString.call(t)},isObject:function(t){return"[object Object]"===this.type(t)},isArray:function(t){return"[object Array]"===this.type(t)},isString:function(t){return"[object String]"===this.type(t)},isNumber:function(t){return"[object Number]"===this.type(t)},isDate:function(t){return"[object Date]"===this.type(t)},isFunction:function(t){return"[object Function]"===this.type(t)},jsJSON:function(t){try{return JSON.parse(t),!0}catch(t){return!1}},isEmpty:function(t){return Array.isArray(t)||"string"==typeof t||t instanceof String?0===t.length:t instanceof Map||t instanceof Set?0===t.size:"[object Object]"===Object.prototype.toString.call(t)&&0===Object.keys(t).length},merge:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.reduce((function(e,n){return Object.keys(n).forEach((function(r){Array.isArray(e[r])&&Array.isArray(n[r])?e[r]=Array.from(new Set(e[r].concat(n[r]))):t.isObject(e[r])&&t.isObject(n[r])?e[r]=t.merge(e[r],n[r]):e[r]=n[r]})),e}),{})},UUID:function(){var t=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},clone:function(t){var n=function(t){var e=t.constructor;switch(r(t)){case"Boolean":case"Number":case"String":case"Error":case"Date":return new e(t);case"RegExp":return o(t);case"Symbol":return i(t);case"Function":return t;default:return null}},r=function(t){return Object.prototype.toString.call(t).slice(8,-1)},i=function(t){return Object(Symbol.prototype.valueOf.call(t))},o=function(t){var e=new t.constructor(t.source,/\w*$/.exec(t));return e.lastIndex=t.lastIndex,e},u=function(t,e){for(var n=-1,r=t.length;++n<r;)e(t[n],n);return t},a=function t(i){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if("object"!==e(i)||null===i)return i;var a=r(i),s=null;return o.get(i)?o.get(i):(o.set(i,s),"Set"!==a&&"Map"!==a&&"Array"!==a&&"Object"!==a?n(i):"Set"===a?(s=new Set,i.forEach((function(e){s.add(t(e,o))})),s):"Map"===a?(s=new Map,i.forEach((function(e,n){s.set(n,t(e,o))})),s):("Array"===a&&(s=new Array,u(i,(function(e,n){s[n]=t(e,o)}))),"Object"===a&&(s=new Object,u(Object.keys(i),(function(e){s[e]=t(i[e],o)}))),s))};return a(t)},parseQuery:function(t){if(this.isEmpty(t))return"";var e=[];for(var n in t)e.push("".concat(n,"=").concat(t[n]));return e.join("&")},getTimezone:function(t){return 6e4*-t.getTimezoneOffset()},encode:function(t){var e={};for(var n in t)e["_"+n]=t[n];return e},isEqual:function(t,e){if(this.type(t)!==this.type(e))return!1;var n=!0;for(var r in t)t[r]!==e[r]&&(n=!1);return n},getUtmByQuery:function(t){var e={};for(var n in t)this.utmKeys.includes(n)&&(e[n]=t[n]);return e},filterUtm:function(t){var e=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],n=!1,r={};for(var i in t)e.indexOf(i)>-1&&(n=!0,r[i]=t[i]);return n?r:null},deleteQueryParams:function(t,e){var n=t.split("&"),r=[];return n.forEach((function(t){var n=new RegExp(e+"=.*"),i="";n.test(t)?(i=t.replace(n,""))&&r.push(i):r.push(t)})),r.join("&")},addUrlParam:function(t,e){var n=t,r="";for(var i in e)r&&(r+="&"),n=this.deleteQueryParams(n,i),r+=i+"="+e[i];var o=n.split("?");return o.length>1?o[1]?o[1]=r+"&"+o[1]:o[1]=r:1===o.length&&o.push(r),o.join("?")},getCurrentPage:function(){var t=getCurrentPages();return t[t.length-1]},wxGetTitle:function(t){var e,n,r,i="";t.data&&t.data.title&&t.data.title.length>0&&(i=Array.isArray(t.data.title)?t.data.title.join(" "):t.data.title);try{if(!i.length&&__wxConfig&&(__wxConfig.tabBar&&__wxConfig.tabBar.list.forEach((function(e){e.pagePath==="".concat(t.route,".html")&&e.text&&(i=e.text)})),!i.length)){var o=__wxConfig.page[t.route]||__wxConfig.page["".concat(t.route,".html")];i=o?null===(e=o.window)||void 0===e?void 0:e.navigationBarTitleText:null===(r=null===(n=null===__wxConfig||void 0===__wxConfig?void 0:__wxConfig.global)||void 0===n?void 0:n.window)||void 0===r?void 0:r.navigationBarTitleText}}catch(t){}return i||t.route}},w=function(){function t(e,r){n(this,t),this.timeout=500,this.catch=[],this.fastTouch=[],this.clearFastTouchTimer=null,this.clearCatchTimer=null,this.tracker=r,this.url="".concat(r.config.serverUrl.normal,"/apipool"),this.timeout=r.config.timeout||this.timeout,this.requestTimeout=r.config.requestTimeout,this.debug=r.config.debug?1:0,this.appKey=r.appKey,this.did=r.storage.allData.did,this.sendLimit=r.config.sendLimit,this.requestFunction=e}return i(t,[{key:"generateRequestData",value:function(){var t=new Date,e={method:"web_event_sr.upload",event:JSON.stringify({sln:"itn",pl:"js",sdk:"sys",sdkv:"__sdkv__",owner:"zg",ut:"".concat(t.getFullYear(),"-").concat(t.getMonth()+1,"-").concat(t.getDate()," ").concat(t.getHours(),":").concat(t.getMinutes(),":").concat(t.getSeconds()),tz:_.getTimezone(t),debug:this.debug?1:0,ak:this.appKey,usr:{did:this.did},data:f(this.catch)}),_:t.getTime()+""};return this.catch=[],e}},{key:"clear",value:function(){if(this.catch.length){var t=this.generateRequestData();this.requestFunction(this.url,t,{timeout:this.requestTimeout})}}},{key:"send",value:function(t){var e=this;if(this.catch.push(t),this.clearCatchTimer&&clearTimeout(this.clearCatchTimer),this.clearCatchTimer=setTimeout((function(){e.clear()}),3e4),!(this.catch.length<this.sendLimit)){this.clearCatchTimer&&clearTimeout(this.clearCatchTimer);var n=this.generateRequestData();return new Promise((function(t,r){var i,o=!1;i=setTimeout((function(){o=!0,t(null)}),e.timeout),e.requestFunction(e.url,n,{timeout:e.requestTimeout}).then((function(e){o||(clearTimeout(i),t(e))})).catch((function(t){r(t)}))}))}}}]),t}(),k=function(){function e(t,r,i){n(this,e),this.storageFunction=t,this.allData=i||{},this.allData.did||this.set("did",r.config.did||_.UUID()),this.allData.cuid||this.set("cuid",void 0),_.isEmpty(r.config.utm)||this.set("utm",r.config.utm)}return i(e,[{key:"get",value:function(t){return this.allData[t]}},{key:"set",value:function(e,n){return g(this,void 0,void 0,t.mark((function r(){return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.allData[e]=n,t.next=3,this.storageFunction.set("zg",this.allData);case 3:case"end":return t.stop()}}),r,this)})))}}]),e}();!function(t){var e,n,r,i,o,u;(e=t.EventType||(t.EventType={})).connected="connected",e.disconnected="disconnected",e.error="error",e.offline="offline",e.exist="exist",e.online="online",(n=t.RequestType||(t.RequestType={}))[n.common=0]="common",n[n.ping=1]="ping",n[n.pong=2]="pong",n[n.normal=5]="normal",n[n.img=6]="img",(r=t.ResponseCode||(t.ResponseCode={}))[r.offline=109001]="offline",r[r.exist=109002]="exist",r[r.paramError=109005]="paramError",r[r.online=109006]="online",(i=t.SocketMsgOrigin||(t.SocketMsgOrigin={}))[i.xcx=1]="xcx",i[i.app=2]="app",i[i.web=3]="web",(o=t.VisualEndpointType||(t.VisualEndpointType={}))[o.xcx=1]="xcx",(u=t.SocketMessageType||(t.SocketMessageType={})).update="update",u.xcxLogin="xcxLogin",u.eventInfo="eventInfo"}(y||(y={}));var b,x,S,O=y,T=function(){function t(e,r){n(this,t),this.listeners={},this.catch=[],this.showLog=!1,this.url=e,this.params=r,this.open()}return i(t,[{key:"emit",value:function(t,e){var n;if(this.log("info","emit message",[t,e]),!this.client)return this.log("info","缓存消息",[t,e]),void this.catch.push([t,e]);switch(null===(n=this.client)||void 0===n?void 0:n.readyState){case WebSocket.CLOSED:case WebSocket.CLOSING:break;case WebSocket.CONNECTING:this.log("info","缓存消息",[t,e]),this.catch.push([t,e])}}},{key:"on",value:function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)}},{key:"onConnected",value:function(t){this.on(O.EventType.connected,t)}},{key:"onDisconnected",value:function(t){this.on(O.EventType.disconnected,t)}},{key:"onError",value:function(t){this.on(O.EventType.error,t)}},{key:"send",value:function(t){var e;null===(e=this.client)||void 0===e||e.send({data:JSON.stringify(t)})}},{key:"_onError",value:function(t){var e;this.log("error","socket连接异常",t),null===(e=this.listeners.error)||void 0===e||e.forEach((function(e){e.call(void 0,t)}))}},{key:"_onClose",value:function(t){var e;this.log("error","socket连接已关闭"),null===(e=this.listeners.disconnected)||void 0===e||e.forEach((function(t){t.call(void 0)})),clearInterval(this.pingTimer)}},{key:"_onOpen",value:function(t){var e,n=this;this.log("info","socket连接成功",t),null===(e=this.listeners.connected)||void 0===e||e.forEach((function(t){t.call(void 0)})),this.log("info","clear catch",this.catch),this.catch.forEach((function(t){var e=h(t,2),r=e[0],i=e[1];n.emit(r,i)})),this.catch=[],this.ping()}},{key:"onMessage",value:function(t){var e,n,r;if(""!==t.data){var i=JSON.parse(t.data);if(i.code)switch(Number(i.code)){case O.ResponseCode.offline:null===(e=this.listeners[O.EventType.offline])||void 0===e||e.forEach((function(t){t.call(void 0,i)}));break;case O.ResponseCode.online:null===(n=this.listeners[O.EventType.online])||void 0===n||n.forEach((function(t){t.call(void 0,i)}));break;case O.ResponseCode.exist:null===(r=this.listeners[O.EventType.exist])||void 0===r||r.forEach((function(t){t.call(void 0,i)}));break;case O.ResponseCode.paramError:this._onError(new Error("参数缺失或错误"))}else{if(i.type===O.RequestType.pong)return;var o=i.data;this.listeners[o.event]&&this.listeners[o.event].forEach((function(t){t.call(void 0,o.payload)}))}}}},{key:"ping",value:function(){var t=this;this.pingTimer=setInterval((function(){t.send({type:O.RequestType.ping})}),3e3)}},{key:"removeAllListeners",value:function(){this.listeners={}}},{key:"removeListener",value:function(t,e){var n=this;e?this.listeners[t].forEach((function(r,i){r===e&&n.listeners[t].splice(i,1)})):this.listeners[t]=[]}},{key:"open",value:function(){var t,e,n=this;this.client&&this.close();var r=wx.connectSocket({url:"".concat(this.url,"?socketToken=").concat(null===(t=this.params)||void 0===t?void 0:t.socketToken,"&appId=").concat(null===(e=this.params)||void 0===e?void 0:e.appId,"&origin=").concat(O.SocketMsgOrigin.xcx)});r.onMessage((function(t){n.onMessage(t)})),r.onError((function(t){n._onError(t)})),r.onClose((function(t){n._onClose(t)})),r.onOpen((function(t){n._onOpen(t)})),this.client=r}},{key:"close",value:function(){var t;null===(t=this.client)||void 0===t||t.close(),this.log("info","关闭socket连接")}},{key:"destroy",value:function(){this.removeAllListeners(),this.close(),this.client=void 0}},{key:"log",value:function(t){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];this.showLog&&(e=console).log.apply(e,["%c【socketClient】:".concat(t),"color: ".concat("error"===t?"red":"#1890ff")].concat(r))}},{key:"openLog",value:function(t){this.showLog=t}}]),t}(),P=function(t,e,n){return new Promise((function(r,i){var u;wx.request((o(u={url:t,data:e,method:"POST",timeout:null==n?void 0:n.timeout},"header",{"content-type":(null==n?void 0:n.contentType)||"application/x-www-form-urlencoded"}),o(u,"dataType","json"),o(u,"responseType","arraybuffer"),o(u,"success",(function(t){r(t)})),o(u,"fail",(function(t){i(t)})),u))}))},E=function(){function e(t){n(this,e),this.pagePathJudge=function(t,e){return-1!==e.pagePath.indexOf("*")?-1!==t.pr.$page_url.indexOf(e.pagePath.split("*")[0]):e.pagePath===t.pr.$page_url.split("?")[0]},this.tracker=t,this.vRQC="",this.visualData=[],this.socketUserInfo=null,this.socketState=!1}return i(e,[{key:"init",value:function(){var t=this;this.socket&&this.socket.destroy(),this.socket=new T(this.tracker.config.socketUrl,{socketToken:this.vRQC.split("*")[0],appId:this.vRQC.split("*")[1]}),this.socket.on("update",(function(){t.getVisualData()})),this.socket.on("connected",(function(){null===t.socketUserInfo?wx.getSystemInfo({success:function(e){var n=e.model,r=e.system,i=e.version;wx.getUserInfo({success:function(e){var o=e.userInfo.nickName,u=e.userInfo.avatarUrl,a={model:n,system:r,version:i,nickName:o,avatarUrl:u,programId:t.tracker.config.appId};t.socketUserInfo=a,t.sendUserInfo(a)}})}}):t.sendUserInfo(t.socketUserInfo)}))}},{key:"getVisualData",value:function(){var t=this;P("".concat(this.tracker.config.serverUrl.normal,"/zg/web/v2/tracking/view/miniProgram/event/list"),{endpointType:O.VisualEndpointType.xcx,endpointIdentity:this.tracker.config.appId},{contentType:"application/json"}).then((function(e){e.data&&e.data.data&&(t.visualData=e.data.data)}))}},{key:"sendUserInfo",value:function(t){var e;this.socketState=!0,null===(e=this.socket)||void 0===e||e.send({type:O.RequestType.normal,data:{event:O.SocketMessageType.xcxLogin,payload:{userInfo:t}}})}},{key:"send",value:function(t){var e;this.socketState&&(null===(e=this.socket)||void 0===e||e.send({type:O.RequestType.normal,data:{event:O.SocketMessageType.eventInfo,payload:t}}))}},{key:"event",value:function(e){var n;return g(this,void 0,void 0,t.mark((function r(){var i,o,u,a=this;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(n=this.tracker)||void 0===n?void 0:n.config.visual){t.next=2;break}return t.abrupt("return");case 2:"abp"!==e.dt||"pv"!==e.pr.$eid&&"click"!==e.pr.$eid?"evt"===e.dt&&this.vRQC&&this.send(Object.assign(Object.assign({},e),{eventType:"evt"})):(i=_.clone(e),o=!1,this.visualData.map((function(t){var n,r;if("click"===e.pr.$eid){var u=[],s=_.jsJSON(t.elementConditions)?JSON.parse(t.elementConditions):{};for(var c in s)u.push(s[c]===e.pr[c]);u.push(a.pagePathJudge(e,t)),-1===u.indexOf(!1)&&"click"===t.eventType&&(i.dt="evt",i.pr.$eid=t.eventName,o=!0,a.vRQC?a.send(Object.assign(Object.assign({},i),{visual:t})):null===(n=a.tracker)||void 0===n||n.send(i))}else"pv"===t.eventType&&a.pagePathJudge(e,t)&&(i.dt="evt",i.pr.$eid=t.eventName,o=!0,a.vRQC?a.send(Object.assign(Object.assign({},i),{visual:t})):null===(r=a.tracker)||void 0===r||r.send(i))})),this.vRQC&&!o&&(u="click"===e.pr.$eid?"click":"pv",this.send(Object.assign(Object.assign({},e),{eventType:u}))));case 3:case"end":return t.stop()}}),r,this)})))}}]),e}();function $(t,e,n){var r=n.value;return n.value=function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(this.pageReady&&this.loadReady)return r.apply(this,n);this.buffer.push({fnName:e,args:n})},n}var C=function(){function e(t,r,i){n(this,e),this.buffer=[],this.currentPage={queryObj:{},query:"",route:"",time:0,url:"",title:""},this.prevPage={queryObj:{},query:"",route:"",time:0,url:"",title:""},this.cn="",this.previousCountEvent={name:"",props:{}},this.count=0,this.countTimer=null,this.pageReady=!1,this.loadReady=!1,x=t,b=r,S=i,this.referrerDomain="miniprogram",this.appKey="",this.config={serverUrl:{normal:"https://u.zhugeapi.net",bac:"https://ubak.zhugeio.com"},socketUrl:"wss://u.zhugeapi.net/eventtracking/ws",debug:!1,pv:!1,click:!1,visual:!1,appName:"",timeout:18e5,requestTimeout:6e4,did:"",duration:!1,vn:"1.0",appId:"",sendLimit:1,superProperty:{},forwardShare:!1,beforeDuration:function(){},afterDuration:function(){},countDuration:3e3,parseScene:!0,utm:{},utmMode:"session",shareToUtm:{},exposure:!1},this.visual=new E(this)}return i(e,[{key:"load",value:function(e,n){return g(this,void 0,void 0,t.mark((function r(){var i;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.appKey=e,this.config=_.merge(this.config,n||{}),t.prev=2,t.next=5,b.get();case 5:if((i=t.sent)&&i.did){t.next=10;break}return t.next=9,b.getDid();case 9:i.did=t.sent;case 10:this.storage=new k(b,this,i),this.request=new w(x,this),this.loadReady=!0,this.updateSession("load"),this.freeBuffer(),t.next=20;break;case 17:t.prev=17,t.t0=t.catch(2),console.error("sdk初始化失败,缓存读取失败",t.t0);case 20:case"end":return t.stop()}}),r,this,[[2,17]])})))}},{key:"freeBuffer",value:function(){if(this.loadReady&&this.pageReady)for(;this.buffer.length;){var t=this.buffer.shift();if(t)(e.prototype[t.fnName]||this[t.fnName]).apply(this,t.args)}}},{key:"send",value:function(t){var e=this.storage.allData.utm;if(e)for(var n in e)e[n]&&(t.pr["$".concat(n)]=e[n]);return this.request.send(t)}},{key:"trackBaseData",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r,i;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new Date,t.t0=e,t.t1=r.getTime(),t.t2=this.storage.allData.sid,t.t3=this.storage.allData.cuid,t.t4=this.cn,t.t5=_.getTimezone(r),t.t6=this.currentPage.url,t.t7=this.prevPage.url,t.t8=S.os(),t.t9=S.ov(),t.t10=S.version(),t.next=14,S.mnet();case 14:return t.t11=t.sent,t.next=17,S.net();case 17:return t.t12=t.sent,t.t13=this.config.vn,t.t14=this.referrerDomain,t.t15=this.config.appId,t.t16={$eid:t.t0,$ct:t.t1,$sid:t.t2,$cuid:t.t3,$cn:t.t4,$tz:t.t5,$url:t.t6,$ref:t.t7,$os:t.t8,$ov:t.t9,$wv:t.t10,$mnet:t.t11,$net:t.t12,$vn:t.t13,$referrer_domain:t.t14,$wxeid:t.t15,$page_url:""},(i={dt:"evt",pr:t.t16}).pr=_.merge(i.pr,_.encode(this.config.superProperty)),t.abrupt("return",i);case 25:case"end":return t.stop()}}),n,this)})))}},{key:"environmentInfo",value:function(){var t=new Date,e={dt:"pl",pr:{$rs:"".concat(S.windowWidth(),"x").concat(S.windowHeight()),$tz:_.getTimezone(t),$ct:t.getTime(),$cuid:this.storage.allData.cuid,$sid:this.storage.allData.sid,$dv:void 0,$br:void 0}};if(wx.getSystemInfoSync){var n=wx.getSystemInfoSync();e.pr.$dv=n.model,e.pr.$br=n.brand}else delete e.pr.$dv,delete e.pr.$br;this.send(e)}},{key:"sessionEnd",value:function(t){var e=new Date,n=t.update-t.sid,r={dt:"se",pr:{$ct:t.update,$cn:this.cn,$tz:_.getTimezone(e),$dru:n,$sid:t.sid,$cuid:t.cuid,$referrer_domain:this.referrerDomain}};this.send(r)}},{key:"sessionStart",value:function(){return g(this,void 0,void 0,t.mark((function e(){var n,r,i,o,u;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new Date,r=this.storage.allData,i=r.sid,o=r.cuid,t.t0=i,t.t1=i,t.t2=o,t.t3=this.cn,t.t4=_.getTimezone(n),t.t5=this.currentPage.url,t.t6=this.prevPage.url,t.t7=S.os(),t.t8=S.ov(),t.t9=S.version(),t.next=14,S.mnet();case 14:return t.t10=t.sent,t.next=17,S.net();case 17:t.t11=t.sent,t.t12=this.config.vn,t.t13=this.referrerDomain,t.t14=this.config.appId,t.t15={$ct:t.t0,$sid:t.t1,$cuid:t.t2,$cn:t.t3,$tz:t.t4,$url:t.t5,$ref:t.t6,$os:t.t7,$ov:t.t8,$wv:t.t9,$mnet:t.t10,$net:t.t11,$vn:t.t12,$referrer_domain:t.t13,$wxeid:t.t14},u={dt:"ss",pr:t.t15},this.config.utm&&!_.isEmpty(this.config.utm)||!this.utmCatch||this.storage.set("utm",this.utmCatch),this.send(u),this.environmentInfo();case 26:case"end":return t.stop()}}),e,this)})))}},{key:"updateSession",value:function(t){var e=this.storage.allData,n=Date.now();if(e.sid&&e.update)if(n-e.update>this.config.timeout){var r=_.clone(e);this.storage.set("sid",n),this.storage.set("update",n),this.sessionEnd(r),this.sessionStart()}else this.storage.set("update",n);else this.storage.set("sid",n),this.storage.set("update",n),this.sessionStart()}},{key:"click",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r,i,o,u,a;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.config.click){t.next=2;break}return t.abrupt("return");case 2:return this.updateSession("click"),t.next=5,this.trackBaseData("click");case 5:for(u in r=t.sent,i={},o=["id","content","type","style","selector","link"],e.target.dataset)-1===o.indexOf(u)&&(i["_".concat(u)]=e.target.dataset[u]);return a=e.target,r.dt="abp",r.pr=_.merge(r.pr,{$page_url:this.currentPage.url,$page_title:this.currentPage.title},{$element_id:a.dataset.id||"",$element_content:a.dataset.content||"",$element_type:a.dataset.type||"",$element_style:a.dataset.style||"",$element_selector:a.dataset.selector||"",$element_link:a.dataset.link||""},i,""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),t.next=14,this.send(r);case 14:return t.next=16,this.visual.event(r);case 16:case"end":return t.stop()}}),n,this)})))}},{key:"pv",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.config.pv){t.next=2;break}return t.abrupt("return");case 2:return this.updateSession("pv"),t.next=5,this.trackBaseData("pv");case 5:return(r=t.sent).dt="abp",r.pr=_.merge(r.pr,{$page_url:this.currentPage.url.split("?")[0],$page_title:this.currentPage.title},e||{},""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),t.next=10,this.send(r);case 10:return t.next=12,this.visual.event(r);case 12:case"end":return t.stop()}}),n,this)})))}},{key:"duration",value:function(){return g(this,void 0,void 0,t.mark((function e(){var n,r;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.config.duration){t.next=2;break}return t.abrupt("return");case 2:return this.updateSession("duration"),_.isFunction(this.config.beforeDuration)&&this.config.beforeDuration(),n=this.currentPage.time-this.prevPage.time,t.next=7,this.trackBaseData("dr");case 7:return(r=t.sent).dt="abp",r.pr=_.merge(r.pr,{$dr:n,$url:this.prevPage.url,$title:this.prevPage.title}),t.next=12,this.send(r);case 12:_.isFunction(this.config.afterDuration)&&this.config.afterDuration();case 13:case"end":return t.stop()}}),e,this)})))}},{key:"track",value:function(e,n){return g(this,void 0,void 0,t.mark((function r(){var i;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.updateSession("track"),t.next=3,this.trackBaseData(e);case 3:return(i=t.sent).pr=_.merge(i.pr,_.encode(n),""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),t.next=7,this.send(i);case 7:return t.next=9,this.visual.event(i);case 9:case"end":return t.stop()}}),r,this)})))}},{key:"identify",value:function(e,n){return g(this,void 0,void 0,t.mark((function r(){var i,o;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.storage.set("cuid",e),this.updateSession("identify"),i=new Date,(o={dt:"usr",pr:{$ct:i.getTime(),$tz:_.getTimezone(i),$cuid:e,$sid:this.storage.allData.sid,$url:this.currentPage.url}}).pr=_.merge(o.pr,_.encode(n)),t.next=7,this.trackBaseData("usr");case 7:return t.next=9,this.send(o);case 9:case"end":return t.stop()}}),r,this)})))}},{key:"setPushClient",value:function(e,n){return g(this,void 0,void 0,t.mark((function r(){var i,o;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=new Date,o={dt:"um",pr:{$ct:i.getTime(),$tz:_.getTimezone(i),$push_ch:n||"getui",$push_id:e}},t.next=4,this.trackBaseData("usr");case 4:return t.next=6,this.send(o);case 6:case"end":return t.stop()}}),r,this)})))}},{key:"trackCount",value:function(t,e){var n=this;0===this.count&&(this.countStartTime=Date.now(),this.previousCountEvent.name=t,this.previousCountEvent.props=_.clone(e)),this.previousCountEvent.name===t&&_.isEqual(this.previousCountEvent.props,e)||(this.sendCountEvent(this.previousCountEvent.name,this.previousCountEvent.props,!1),this.previousCountEvent.name=t,this.previousCountEvent.props=_.clone(e),this.countStartTime=Date.now(),this.count=0),this.count+=1,this.countTimer&&clearTimeout(this.countTimer),this.countTimer=setTimeout((function(){n.sendCountEvent(t,e,!0)}),this.config.countDuration)}},{key:"sendCountEvent",value:function(e,n,r){return g(this,void 0,void 0,t.mark((function i(){var o,u,a,s;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.updateSession("track count"),o=Date.now()-this.countStartTime,r&&(o-=this.config.countDuration),u=this.count,this.count=r?0:1,t.next=7,this.trackBaseData(e);case 7:return a=t.sent,s={},_.isObject(n)&&(s=_.clone(n)),a.pr=_.merge(a.pr,_.encode(s),_.encode({count:u,countTime:o})),t.next=13,this.send(a);case 13:case"end":return t.stop()}}),i,this)})))}},{key:"trackRevenue",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r,i,o,u,a,s,c,m;return t.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=function(t,e){var n=0;try{t.toString().split(".")[1]&&(n+=t.toString().split(".")[1].length)}catch(t){console.error(t)}try{e.toString().split(".")[1]&&(n+=e.toString().split(".")[1].length)}catch(t){console.error(t)}return Number(t.toString().replace(".",""))*Number(e.toString().replace(".",""))/Math.pow(10,n)},this.updateSession("track revenue"),n.next=4,this.trackBaseData("revenue");case 4:(r=n.sent).dt="abp",(i=_.merge({price:0,total:0,productID:null,productQuantity:0,revenueType:null},e)).total=o(i.price,i.productQuantity),u=["productID","revenueType"],a=["price","total","productQuantity"],s={},n.t0=t.keys(i);case 12:if((n.t1=n.t0()).done){n.next=21;break}if(c=n.t1.value,-1!==u.indexOf(c)||-1!==a.indexOf(c)){n.next=16;break}return n.abrupt("continue",12);case 16:m=i[c],a.indexOf(c)>-1&&((m=Number(m))||(m=0)),s["$"+c]=m,n.next=12;break;case 21:return r.pr=_.merge(r.pr,s),n.next=24,this.send(r);case 24:case"end":return n.stop()}}),n,this)})))}},{key:"setUtm",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null!==(r=_.filterUtm(e))&&(this.storage.set("utm",r),this.updateSession("setUtm"));case 2:case"end":return t.stop()}}),n,this)})))}},{key:"setSuperProperty",value:function(t){_.isObject(t)&&(this.config.superProperty=t)}},{key:"extendSuperPropertys",value:function(t){_.isObject(t)&&(this.config.superProperty=_.merge(this.config.superProperty,t))}},{key:"removeSuperProperty",value:function(t){var e,n=function(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=p(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){a=!0,o=t},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;delete this.config.superProperty[r]}}catch(t){n.e(t)}finally{n.f()}}},{key:"getSuperProperty",value:function(){return this.config.superProperty}},{key:"flush",value:function(){this.request.clear()}}]),e}();v([$],C.prototype,"environmentInfo",null),v([$],C.prototype,"sessionEnd",null),v([$],C.prototype,"sessionStart",null),v([$],C.prototype,"updateSession",null),v([$],C.prototype,"click",null),v([$],C.prototype,"pv",null),v([$],C.prototype,"duration",null),v([$],C.prototype,"track",null),v([$],C.prototype,"identify",null),v([$],C.prototype,"setPushClient",null),v([$],C.prototype,"trackCount",null),v([$],C.prototype,"trackRevenue",null),v([$],C.prototype,"setUtm",null);var D=["onLaunch","onShow","onHide","onError","onPageNotFound","onUnhandledRejection","onThemeChange","onShareAppMessage","onLogin"],j=["onLoad","onShow","onReady","onHide","onUnload","onShareAppMessage","onReachBottom","onPageScroll","onPullDownRefresh","onTabItemTap","onInit","onShareTimeline","onAddToFavorites","onResize","onTitleClick","onOptionMenuClick","onPullIntercept","onURLQueryChange"],I=function(t){return _.wxGetTitle(t)},R={did:null,getDid:function(){return new Promise((function(t,e){wx.getStorage({key:"zg-did",success:function(e){t(e.data||""),wx.removeStorage({key:"zg-did"})},fail:function(e){t("")}})}))},get:function(){return new Promise((function(t,e){wx.getStorage({key:"zg",success:function(e){t(e.data||{})},fail:function(e){t({})}})}))},set:function(t,e){return new Promise((function(n,r){wx.setStorage({key:t,data:e,success:n,fail:r})}))}},L=!1,A=wx.getSystemInfoSync(),z=A.system.split(/\s/),N={os:z[0],ov:z[1],version:A.version,windowHeight:A.windowHeight,windowWidth:A.windowWidth,net:0,mnet:0};function U(t){var e=t.toLowerCase();"wifi"===e?(N.net=1,N.mnet=0):(N.net=0,N.mnet={"2g":1,"3g":3,"4g":13}[e]||0)}function q(t){return new Promise((function(e,n){if(L)return e(N[t]);wx.getNetworkType({success:function(n){L=!0,U(n.networkType),e(N[t])}})}))}wx.onNetworkStatusChange((function(t){U(t.networkType)}));var M,F,B={os:function(){return N.os},ov:function(){return N.ov},version:function(){return N.version},net:function(){return q("net")},mnet:function(){return q("mnet")},windowWidth:function(){return N.windowWidth},windowHeight:function(){return N.windowHeight}},Q=App,W=Page,H=Component,G=["eid","ct","tz","cuid","cn","sid","url","os","ov","wv","mnet","referrer_domain","net","vn","wxeid","uid","share_id","share_title","share_level","title","path"];function J(t,e,n){if(t[n]&&_.isFunction(t[n])){var r=t[n];t[n]=function(){r.apply(this,arguments),e[n].apply(this,arguments)}}else t[n]=function(){e[n].apply(this,arguments)}}function V(t,e,n){var r=t[e];t[e]=function(){var t=arguments[0];if(M===t||t&&M&&M.timeStamp===t.timeStamp)return r.apply(this,arguments);if(M=t,t){var e=t.type;"tap"===e&&n.click(t)}return r.apply(this,arguments)}}var K=function(e){u(o,C);var r=m(o);function o(t){var e;return n(this,o),(e=r.call(this,P,R,B)).openData={path:"",props:{}},e.shared=!1,e.semiAutoTrackEventCatch={},e.isShareOperation=!1,F=t,e.initLifeCycleHook(),e}return i(o,[{key:"initLifeCycleHook",value:function(){var t,e=this,n=(t=e,{App:{onLaunch:function(e){t.config.visual&&t.visual.getVisualData()},onShow:function(e){t.sceneToUtm(e),t.openOptions=e,t.updateSession("appOnShow")},onHide:function(){t.flush(),t.config.duration&&!t.isShareOperation&&(t.pageReady=!0,t.currentPage.time=Date.now(),t.duration().then((function(){t.pageReady=!1,t.prevPage={queryObj:{},query:"",route:"",time:0,url:"",title:""}})))}},Page:{onLoad:function(e){(null==e?void 0:e.scene)&&-1!==decodeURIComponent(e.scene).indexOf("vRQC")&&t.config.visual&&(t.visual.vRQC=decodeURIComponent(e.scene).split("vRQC=")[1],t.visual.init()),t.currentPage.query=_.parseQuery(e),t.currentPage.queryObj=e},onShow:function(){var e=getCurrentPages(),n=e[e.length-1];t.currentPage.route=n.__route__||n.route,t.currentPage.time=Date.now(),t.currentPage.url="".concat(t.currentPage.route);var r=I;if(t.currentPage.title="function"==typeof r?r(n):"",t.currentPage.query&&(t.currentPage.url+="?".concat(t.currentPage.query)),t.pageReady=!0,t.freeBuffer(),t.currentPage.url!==t.prevPage.url){""!==t.prevPage.url&&t.duration();try{t.trackOpenShare(t.openOptions)}catch(e){console.warn(e,"".concat(t.referrerDomain," ","zhuge"," sdk trackOpenShare error"))}t.pv()}t.startObserveMarkElement(n),t.openOptions=null,t.isShareOperation=!1},onHide:function(){t.semiAutoTrackEventCatch={},t.prevPage=_.clone(t.currentPage),t.pageReady=!1,t.flush()},onUnload:function(){t.semiAutoTrackEventCatch={},t.prevPage=_.clone(t.currentPage),t.pageReady=!1,t.flush()}}});this.lifecycle=n;var r=function(t){for(var r in n.App)J(t,n.App,r);for(var i in t)!D.includes(i)&&_.isFunction(t[i])&&V(t,i,e);return Q(t)};for(var i in App)r[i]=App[i];App=r;var o=function(t){for(var r in n.Page)J(t,n.Page,r);for(var i in t)!j.includes(i)&&_.isFunction(t[i])&&"onShareAppMessage"!==i&&V(t,i,e);var o=t.onShareAppMessage;return _.isFunction(o)&&(t.onShareAppMessage=e.onShareAppMessage(o)),W(t)};for(var u in Page)o[u]=Page[u];Page=o,Component=function(t){if(void 0!==t.methods)for(var n in t.methods)V(t.methods,n,e);return H(t)},global&&global.mpvue&&(global.App=App,global.Page=Page,global.Component=Component),App.zhuge=e}},{key:"load",value:function(t,e){return l(a(o.prototype),"load",this).call(this,t,e)}},{key:"pv",value:function(e){var n=this,r=Object.create(null,{pv:{get:function(){return l(a(o.prototype),"pv",n)}}});return g(this,void 0,void 0,t.mark((function e(){var n,i;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={},i=_.getCurrentPage(),this.config.forwardShare&&this.openOptions&&(n.$share_open_type=1008===this.openOptions.scene?"群聊":"聊天",this.openOptions.query&&this.openOptions.query.zg_share_level&&(n.$share_level=Number(this.openOptions.query.zg_share_level)),i.data&&i.data.zg_share_data&&(n=_.merge(n,_.encode(i.data.zg_share_data)))),t.next=5,r.pv.call(this,n);case 5:case"end":return t.stop()}}),e,this)})))}},{key:"click",value:function(e){var n=this,r=Object.create(null,{click:{get:function(){return l(a(o.prototype),"click",n)}}});return g(this,void 0,void 0,t.mark((function n(){return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.click.call(this,e);case 2:case"end":return t.stop()}}),n,this)})))}},{key:"sceneToUtm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=_.getUtmByQuery(t.query);if(this.config.parseScene&&t.scene&&F){var n=t.scene;this.cn=n+"";var r=F[n],i={},o=null,u=F.isShare(n);if(u&&t.referrerInfo&&(o=t.referrerInfo.appId),r){i={utm_source:r.utm_source,utm_medium:r.utm_medium,utm_campaign:o};var a=t.query||{};F.isCartShare(n)&&a.zg_uid&&a.zg_share_id&&(i.utm_term=a.zg_uid,i.utm_content=a.zg_share_id)}e=_.merge(i,e)}this.utmCatch=e,"fresh"===this.config.utmMode&&_.isEmpty(this.config.utm)&&this.storage.set("utm",e)}},{key:"trackOpenShare",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r,i,o,u,a,s,c,m,l,h,f;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e&&this.config.forwardShare){t.next=2;break}return t.abrupt("return");case 2:if(!this.shared){t.next=5;break}return this.shared=!1,t.abrupt("return");case 5:if(r=e.query||{},i=this.currentPage.route,!(F.isCartShare(e.scene)&&r.zg_uid&&r.zg_share_id)){t.next=24;break}for(a in o={$uid:r.zg_uid,$share_id:r.zg_share_id,$title:this.currentPage.title,$path:i,$share_open_type:1008===e.scene?"群聊":"聊天",$share_level:Number(r.zg_share_level)},this.shareId=r.zg_share_id,this.shareLevel=Number(r.zg_share_level),u={},r)s=a.replace(/^zg_/,""),-1===G.indexOf(s)&&/^zg_/.test(a)&&(u[s]=r[a]);if(c=this.config.shareToUtm,_.isObject(c)&&!_.isEmpty(c)){for(l in m={},c)null!==u[l]&&void 0!==u[l]&&(h=c[l],m[h]=u[l]);_.isEmpty(m)||(m.utm_campaign||(m.utm_campaign="分享打开"),this.setUtm(m))}return this.openData={path:i,props:u},o=_.merge(o,_.encode(u)),t.next=19,this.trackBaseData("wxsopen");case 19:return(f=t.sent).dt="abp",f.pr=_.merge(f.pr,o),t.next=24,this.send(f);case 24:case"end":return t.stop()}}),n,this)})))}},{key:"onShareAppMessage",value:function(t){var e=this;return function(){e.isShareOperation=!0;var n=t.apply(this,arguments)||{};if(!e.config.forwardShare)return n;n.path=n.path||e.currentPage.url;var r=n.title||e.currentPage.title,i=n.path.split("?")[0],o=this.data.zg_share_data,u=(new Date).getTime(),a=1;!this.data.newShare&&e.openData&&e.openData.path===i&&_.isEqual(o||{},e.openData.props)&&(u=e.shareId,a=e.shareLevel+1);var s={share_id:u,uid:e.storage.allData.cuid||e.storage.allData.did,share_level:a},c={$share_title:r,$title:e.currentPage.title||"",$path:i},m={};for(var l in s)c["$".concat(l)]=m["zg_".concat(l)]=s[l];for(var h in o)-1===G.indexOf(h)&&(c["_".concat(h)]=m["zg_".concat(h)]=o[h]);return n.path=_.addUrlParam(n.path,m),e.trackBaseData("wxshare").then((function(t){t.dt="abp",t.pr=_.merge(t.pr,c),e.request.send(t)})),e.shared=!0,n}}},{key:"startObserveMarkElement",value:function(t){var e=this;this.config.exposure&&(this.elementObserver&&this.elementObserver.disconnect(),t.isComponent?this.elementObserver=t.createIntersectionObserver({observeAll:!0}):this.elementObserver=wx.createIntersectionObserver(t,{observeAll:!0}),this.elementObserver.relativeToViewport().observe(".zhuge-expo-track",(function(t){if(t.intersectionRatio>0){var n,r=e.getEventDataFromDataset(t.dataset);(n=l(a(o.prototype),"track",e)).call.apply(n,[e].concat(f(r)))}})))}},{key:"getEventDataFromDataset",value:function(t){var e={},n="";for(var r in t){if(r.startsWith("expo"))if("expoName"===r)n=t[r];else e[r.replace(/^expo(.*)/,(function(t,e,n,r){return e.replace(e[0],e[0].toLocaleLowerCase())}))]=t[r]}return[n,e]}}]),o}();v([$],K.prototype,"sceneToUtm",null),v([$],K.prototype,"trackOpenShare",null);var Y={1e3:{utm_source:"其他",utm_medium:"其他"},1001:{utm_source:"微信主程序",utm_medium:"发现栏小程序主入口"},1005:{utm_source:"搜索",utm_medium:"顶部搜索框的搜索结果页"},1006:{utm_source:"搜索",utm_medium:"发现栏小程序主入口搜索框的搜索结果页"},1007:{utm_source:"分享",utm_medium:"单人聊天会话中的小程序消息卡片"},1008:{utm_source:"分享",utm_medium:"群聊会话中的小程序消息卡片"},1010:{utm_source:"收藏",utm_medium:"收藏夹"},1011:{utm_source:"扫码",utm_medium:"扫描二维码"},1012:{utm_source:"扫码",utm_medium:"长按图片识别二维码"},1013:{utm_source:"扫码",utm_medium:"手机相册选取二维码"},1014:{utm_source:"小程序模板消息",utm_medium:"小程序模板消息"},1017:{utm_source:"体验版",utm_medium:"前往体验版的入口页"},1019:{utm_source:"微信支付",utm_medium:"微信钱包"},1023:{utm_source:"桌面图标",utm_medium:"安卓系统桌面图标"},1024:{utm_source:"微信主程序",utm_medium:"小程序 profile 页"},1025:{utm_source:"扫码",utm_medium:"扫描一维码"},1026:{utm_source:"微信主程序",utm_medium:"附近小程序列表"},1027:{utm_source:"搜索",utm_medium:"顶部搜索框搜索结果页“使用过的小程序”列表"},1028:{utm_source:"微信卡券",utm_medium:"我的卡包"},1029:{utm_source:"微信卡券",utm_medium:"卡券详情页"},1030:{utm_source:"测试",utm_medium:"自动化测试下打开小程序"},1031:{utm_source:"扫码",utm_medium:"长按图片识别一维码"},1032:{utm_source:"扫码",utm_medium:"手机相册选取一维码"},1034:{utm_source:"微信支付",utm_medium:"微信支付完成页"},1035:{utm_source:"公众号",utm_medium:"公众号自定义菜单"},1036:{utm_source:"分享",utm_medium:"App分享消息卡片"},1037:{utm_source:"小程序",utm_medium:"小程序打开小程序"},1038:{utm_source:"小程序",utm_medium:"从另一个小程序返回"},1039:{utm_source:"摇电视",utm_medium:"摇电视"},1042:{utm_source:"搜索",utm_medium:"添加好友搜索框的搜索结果页"},1043:{utm_source:"公众号",utm_medium:"公众号模板消息"},1044:{utm_source:"分享",utm_medium:"带shareTicket的小程序消息卡片(详情)"},1045:{utm_source:"广告",utm_medium:"朋友圈广告"},1046:{utm_source:"广告",utm_medium:"朋友圈广告详情页"},1047:{utm_source:"扫码",utm_medium:"扫描小程序码"},1048:{utm_source:"扫码",utm_medium:"长按图片识别小程序码"},1049:{utm_source:"扫码",utm_medium:"手机相册选取小程序码"},1052:{utm_source:"微信卡券",utm_medium:"卡券的适用门店列表"},1053:{utm_source:"搜索",utm_medium:"搜一搜的结果页"},1056:{utm_source:"音乐播放器菜单",utm_medium:"音乐播放器菜单"},1057:{utm_source:"微信支付",utm_medium:"钱包中的银行卡详情页"},1058:{utm_source:"公众号",utm_medium:"公众号文章"},1059:{utm_source:"体验版",utm_medium:"体验版小程序绑定邀请页"},1060:{utm_source:"支付完成",utm_medium:"微信支付完成页"},1064:{utm_source:"微信WIFI",utm_medium:"微信连Wi-Fi状态栏"},1065:{utm_source:"scheme 详情",utm_medium:"URL scheme 详情"},1067:{utm_source:"广告",utm_medium:"公众号文章广告"},1069:{utm_source:"移动应用",utm_medium:"移动应用"},1071:{utm_source:"微信支付",utm_medium:"钱包中的银行卡列表页"},1072:{utm_source:"微信支付",utm_medium:"二维码收款页面"},1073:{utm_source:"客服消息",utm_medium:"客服消息列表下发的小程序消息卡片"},1074:{utm_source:"公众号会话",utm_medium:"公众号会话下发的小程序消息卡片"},1077:{utm_source:"摇周边",utm_medium:"摇周边"},1078:{utm_source:"微信WIFI",utm_medium:"连Wi-Fi成功页"},1079:{utm_source:"微信游戏中心",utm_medium:"微信游戏中心"},1081:{utm_source:"客服消息",utm_medium:"客服消息下发的文字链"},1082:{utm_source:"公众号",utm_medium:"公众号会话下发的文字链"},1084:{utm_source:"广告",utm_medium:"朋友圈广告原生页"},1088:{utm_source:"打开小程序",utm_medium:"会话中查看系统消息,打开小程序"},1089:{utm_source:"微信主程序",utm_medium:"微信聊天主界面下拉"},1090:{utm_source:"小程序",utm_medium:"长按小程序右上角菜单唤出最近使用历史"},1091:{utm_source:"公众号",utm_medium:"公众号文章商品卡片"},1092:{utm_source:"微信城市服务",utm_medium:"城市服务入口"},1095:{utm_source:"广告",utm_medium:"小程序广告组件"},1096:{utm_source:"分享",utm_medium:"聊天记录"},1097:{utm_source:"微信支付",utm_medium:"微信支付签约页"},1099:{utm_source:"小程序",utm_medium:"页面内嵌插件"},1100:{utm_source:"打开小程序",utm_medium:"红包封面详情页打开小程序"},1101:{utm_source:"调试",utm_medium:"远程调试热更新(开发者工具中,预览 -> 自动预览 -> 编译并预览)"},1102:{utm_source:"公众号",utm_medium:"公众号profile页服务预览"},1106:{utm_source:"打开小程序",utm_medium:"聊天主界面下拉,从顶部搜索结果页,打开小程序"},1107:{utm_source:"打开小程序",utm_medium:"订阅消息,打开小程序"},1113:{utm_source:"打开小程序",utm_medium:"安卓手机负一屏,打开小程序(三星)"},1114:{utm_source:"打开小程序",utm_medium:"安卓手机侧边栏,打开小程序(三星)"},1119:{utm_source:"打开小程序",utm_medium:"【企业微信】工作台内打开小程序"},1120:{utm_source:"打开小程序",utm_medium:"【企业微信】个人资料页内打开小程序"},1121:{utm_source:"打开小程序",utm_medium:"【企业微信】聊天加号附件框内打开小程序"},1124:{utm_source:"打开小程序",utm_medium:"扫“一物一码”打开小程序"},1125:{utm_source:"图片识别",utm_medium:"长按图片识别“一物一码”"},1126:{utm_source:"扫描手机相册",utm_medium:"扫描手机相册中选取的“一物一码”"},1129:{utm_source:"爬虫",utm_medium:"微信爬虫"},1131:{utm_source:"浮窗",utm_medium:"浮窗"},1133:{utm_source:"打开小程序详情",utm_medium:"硬件设备打开小程序详情"},1135:{utm_source:"打开小程序",utm_medium:"小程序 profile 页相关小程序列表,打开小程序"},1144:{utm_source:"视频贴片",utm_medium:"公众号文章 - 视频贴片"},1145:{utm_source:"发现小程序",utm_medium:"发现栏 - 发现小程序"},1146:{utm_source:"打开出行类小程序",utm_medium:"地理位置信息打开出行类小程序"},1148:{utm_source:"打开小程序",utm_medium:"卡包 - 交通卡,打开小程序"},1150:{utm_source:"扫一扫",utm_medium:"扫一扫商品条码结果页打开小程序"},1151:{utm_source:"我的订单",utm_medium:"发现栏 - 我的订单"},1152:{utm_source:"打开小程序",utm_medium:"订阅号视频打开小程序"},1153:{utm_source:"打开小程序",utm_medium:"“识物”结果页打开小程序"},1154:{utm_source:"打开“单页模式”",utm_medium:"朋友圈内打开“单页模式”"},1155:{utm_source:"打开小程序",utm_medium:"“单页模式”打开小程序"},1157:{utm_source:"打开小程序",utm_medium:"服务号会话页打开小程序"},1158:{utm_source:"打开小程序",utm_medium:"群工具打开小程序"},1160:{utm_source:"群待办",utm_medium:"群待办"},1167:{utm_source:"打开小程序详情",utm_medium:"H5 通过开放标签打开小程序详情"},1168:{utm_source:"运行小程序",utm_medium:"移动应用直接运行小程序"},1169:{utm_source:"小程序入口",utm_medium:"发现栏小程序主入口,各个生活服务入口"},1171:{utm_source:"微信运动记录",utm_medium:"微信运动记录"},1173:{utm_source:"打开小程序详情",utm_medium:"聊天素材用小程序打开详情"},1175:{utm_source:"商店入口",utm_medium:"视频号主页商店入口"},1176:{utm_source:"打开小程序",utm_medium:"视频号直播间主播打开小程序"},1177:{utm_source:"直播商品",utm_medium:"视频号直播商品"},1178:{utm_source:"打开小程序",utm_medium:"在电脑打开手机上打开的小程序"},1179:{utm_source:"打开小程序",utm_medium:"#话题页打开小程序"},1181:{utm_source:"打开 PC 小程序",utm_medium:"网站应用打开 PC 小程序"},1183:{utm_source:"搜索",utm_medium:"PC微信 - 小程序面板 - 发现小程序 - 搜索"},1184:{utm_source:"打开小程序",utm_medium:"视频号链接打开小程序"},1185:{utm_source:"群公告",utm_medium:"群公告"},1186:{utm_source:"收藏",utm_medium:"收藏 - 笔记"},1187:{utm_source:"浮窗",utm_medium:"浮窗"},1189:{utm_source:"表情雨广告",utm_medium:"表情雨广告"},1191:{utm_source:"视频号活动",utm_medium:"视频号活动"},1192:{utm_source:"企业微信联系人 profile 页",utm_medium:"企业微信联系人 profile 页"},1193:{utm_source:"打开小程序",utm_medium:"视频号主页服务菜单打开小程序"},1194:{utm_source:"URL Link 详情",utm_medium:"URL Link 详情"},1195:{utm_source:"主页商品tab",utm_medium:"视频号主页商品tab"},1196:{utm_source:"打开小程序",utm_medium:"个人状态打开小程序"},1197:{utm_source:"返回小游戏",utm_medium:"视频号主播从直播间返回小游戏"},1198:{utm_source:"打开小游戏",utm_medium:"视频号开播界面打开小游戏"},1201:{utm_source:"打开小程序",utm_medium:"视频号广告详情页打开小程序"},1202:{utm_source:"打开小程序卡片",utm_medium:"企微客服号会话打开小程序卡片"},1203:{utm_source:"压测工具的请求",utm_medium:"微信小程序压测工具的请求"},1206:{utm_source:"打开小游戏",utm_medium:"视频号小游戏直播间打开小游戏"},1207:{utm_source:"打开小程序文字链",utm_medium:"企微客服号会话打开小程序文字链"},1208:{utm_source:"打开商品卡片",utm_medium:"聊天打开商品卡片"},1212:{utm_source:"打开小程序",utm_medium:"青少年模式申请页打开小程序"},1215:{utm_source:"打开小程序",utm_medium:"广告预约打开小程序"},1216:{utm_source:"打开小程序",utm_medium:"视频号订单中心打开小程序"},isShare:function(t){return[1096].includes(t)},isCartShare:function(t){return[1007,1008,1036,1044].includes(t)}},X=new(function(t){u(r,K);var e=m(r);function r(){return n(this,r),e.call(this,Y)}return i(r,[{key:"load",value:function(t,e){var n=e||{};if(wx.getAccountInfoSync){var i=wx.getAccountInfoSync();i&&i.miniProgram&&i.miniProgram.appId&&(n.appId=i.miniProgram.appId)}return l(a(r.prototype),"load",this).call(this,t,n)}}]),r}());App.zhuge=X;export default X;
|
|
16
|
+
function v(t,e,n,r){var i,o=arguments.length,u=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(u=(o<3?i(u):o>3?i(e,n,u):i(e,n))||u);return o>3&&u&&Object.defineProperty(e,n,u),u}function g(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{s(r.next(t))}catch(t){o(t)}}function a(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,a)}s((r=r.apply(t,e||[])).next())}))}var y,_={utmKeys:["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],isValid:function(t){return null==t},type:function(t){return Object.prototype.toString.call(t)},isObject:function(t){return"[object Object]"===this.type(t)},isArray:function(t){return"[object Array]"===this.type(t)},isString:function(t){return"[object String]"===this.type(t)},isNumber:function(t){return"[object Number]"===this.type(t)},isDate:function(t){return"[object Date]"===this.type(t)},isFunction:function(t){return"[object Function]"===this.type(t)},jsJSON:function(t){try{return JSON.parse(t),!0}catch(t){return!1}},isEmpty:function(t){return Array.isArray(t)||"string"==typeof t||t instanceof String?0===t.length:t instanceof Map||t instanceof Set?0===t.size:"[object Object]"===Object.prototype.toString.call(t)&&0===Object.keys(t).length},merge:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.reduce((function(e,n){return Object.keys(n).forEach((function(r){Array.isArray(e[r])&&Array.isArray(n[r])?e[r]=Array.from(new Set(e[r].concat(n[r]))):t.isObject(e[r])&&t.isObject(n[r])?e[r]=t.merge(e[r],n[r]):e[r]=n[r]})),e}),{})},UUID:function(){var t=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},clone:function(t){var n=function(t){var e=t.constructor;switch(r(t)){case"Boolean":case"Number":case"String":case"Error":case"Date":return new e(t);case"RegExp":return o(t);case"Symbol":return i(t);case"Function":return t;default:return null}},r=function(t){return Object.prototype.toString.call(t).slice(8,-1)},i=function(t){return Object(Symbol.prototype.valueOf.call(t))},o=function(t){var e=new t.constructor(t.source,/\w*$/.exec(t));return e.lastIndex=t.lastIndex,e},u=function(t,e){for(var n=-1,r=t.length;++n<r;)e(t[n],n);return t},a=function t(i){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if("object"!==e(i)||null===i)return i;var a=r(i),s=null;return o.get(i)?o.get(i):(o.set(i,s),"Set"!==a&&"Map"!==a&&"Array"!==a&&"Object"!==a?n(i):"Set"===a?(s=new Set,i.forEach((function(e){s.add(t(e,o))})),s):"Map"===a?(s=new Map,i.forEach((function(e,n){s.set(n,t(e,o))})),s):("Array"===a&&(s=new Array,u(i,(function(e,n){s[n]=t(e,o)}))),"Object"===a&&(s=new Object,u(Object.keys(i),(function(e){s[e]=t(i[e],o)}))),s))};return a(t)},parseQuery:function(t){if(this.isEmpty(t))return"";var e=[];for(var n in t)e.push("".concat(n,"=").concat(decodeURIComponent(t[n])));return e.join("&")},getTimezone:function(t){return 6e4*-t.getTimezoneOffset()},encode:function(t){var e={};for(var n in t)e["_"+n]=t[n];return e},isEqual:function(t,e){if(this.type(t)!==this.type(e))return!1;var n=!0;for(var r in t)t[r]!==e[r]&&(n=!1);return n},getUtmByQuery:function(t){var e={};for(var n in t)this.utmKeys.includes(n)&&(e[n]=t[n]);return e},filterUtm:function(t){var e=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],n=!1,r={};for(var i in t)e.indexOf(i)>-1&&(n=!0,r[i]=t[i]);return n?r:null},deleteQueryParams:function(t,e){var n=t.split("&"),r=[];return n.forEach((function(t){var n=new RegExp(e+"=.*"),i="";n.test(t)?(i=t.replace(n,""))&&r.push(i):r.push(t)})),r.join("&")},addUrlParam:function(t,e){var n=t,r="";for(var i in e)r&&(r+="&"),n=this.deleteQueryParams(n,i),r+=i+"="+e[i];var o=n.split("?");return o.length>1?o[1]?o[1]=r+"&"+o[1]:o[1]=r:1===o.length&&o.push(r),o.join("?")},getCurrentPage:function(){var t=getCurrentPages();return t[t.length-1]},wxGetTitle:function(t){var e,n,r,i="";t.data&&t.data.title&&t.data.title.length>0&&(i=Array.isArray(t.data.title)?t.data.title.join(" "):t.data.title);try{if(!i.length&&__wxConfig&&(__wxConfig.tabBar&&__wxConfig.tabBar.list.forEach((function(e){e.pagePath==="".concat(t.route,".html")&&e.text&&(i=e.text)})),!i.length)){var o=__wxConfig.page[t.route]||__wxConfig.page["".concat(t.route,".html")];i=o?null===(e=o.window)||void 0===e?void 0:e.navigationBarTitleText:null===(r=null===(n=null===__wxConfig||void 0===__wxConfig?void 0:__wxConfig.global)||void 0===n?void 0:n.window)||void 0===r?void 0:r.navigationBarTitleText}}catch(t){}return i||t.route}},w=function(){function t(e,r){n(this,t),this.timeout=500,this.catch=[],this.fastTouch=[],this.clearFastTouchTimer=null,this.clearCatchTimer=null,this.tracker=r,this.url="".concat(r.config.serverUrl.normal,"/apipool"),this.timeout=r.config.timeout||this.timeout,this.requestTimeout=r.config.requestTimeout,this.debug=r.config.debug?1:0,this.appKey=r.appKey,this.did=r.storage.allData.did,this.sendLimit=r.config.sendLimit,this.requestFunction=e}return i(t,[{key:"generateRequestData",value:function(){var t=new Date,e={method:"web_event_sr.upload",event:JSON.stringify({sln:"itn",pl:"js",sdk:"sys",sdkv:"2.0.17",owner:"zg",ut:"".concat(t.getFullYear(),"-").concat(t.getMonth()+1,"-").concat(t.getDate()," ").concat(t.getHours(),":").concat(t.getMinutes(),":").concat(t.getSeconds()),tz:_.getTimezone(t),debug:this.debug?1:0,ak:this.appKey,usr:{did:this.did},data:f(this.catch)}),_:t.getTime()+""};return this.catch=[],e}},{key:"clear",value:function(){if(this.catch.length){var t=this.generateRequestData();this.requestFunction(this.url,t,{timeout:this.requestTimeout})}}},{key:"send",value:function(t){var e=this;if(this.catch.push(t),this.clearCatchTimer&&clearTimeout(this.clearCatchTimer),this.clearCatchTimer=setTimeout((function(){e.clear()}),3e4),!(this.catch.length<this.sendLimit)){this.clearCatchTimer&&clearTimeout(this.clearCatchTimer);var n=this.generateRequestData();return new Promise((function(t,r){var i,o=!1;i=setTimeout((function(){o=!0,t(null)}),e.timeout),e.requestFunction(e.url,n,{timeout:e.requestTimeout}).then((function(e){o||(clearTimeout(i),t(e))})).catch((function(t){r(t)}))}))}}}]),t}(),k=function(){function e(t,r,i){n(this,e),this.storageFunction=t,this.allData=i||{},this.allData.did||this.set("did",r.config.did||_.UUID()),this.allData.cuid||this.set("cuid",void 0),_.isEmpty(r.config.utm)||this.set("utm",r.config.utm)}return i(e,[{key:"get",value:function(t){return this.allData[t]}},{key:"set",value:function(e,n){return g(this,void 0,void 0,t.mark((function r(){return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.allData[e]=n,t.next=3,this.storageFunction.set("zg",this.allData);case 3:case"end":return t.stop()}}),r,this)})))}}]),e}();!function(t){var e,n,r,i,o,u;(e=t.EventType||(t.EventType={})).connected="connected",e.disconnected="disconnected",e.error="error",e.offline="offline",e.exist="exist",e.online="online",(n=t.RequestType||(t.RequestType={}))[n.common=0]="common",n[n.ping=1]="ping",n[n.pong=2]="pong",n[n.normal=5]="normal",n[n.img=6]="img",(r=t.ResponseCode||(t.ResponseCode={}))[r.offline=109001]="offline",r[r.exist=109002]="exist",r[r.paramError=109005]="paramError",r[r.online=109006]="online",(i=t.SocketMsgOrigin||(t.SocketMsgOrigin={}))[i.xcx=1]="xcx",i[i.app=2]="app",i[i.web=3]="web",(o=t.VisualEndpointType||(t.VisualEndpointType={}))[o.xcx=1]="xcx",(u=t.SocketMessageType||(t.SocketMessageType={})).update="update",u.xcxLogin="xcxLogin",u.eventInfo="eventInfo"}(y||(y={}));var b,x,S,O=y,T=function(){function t(e,r){n(this,t),this.listeners={},this.catch=[],this.showLog=!1,this.url=e,this.params=r,this.open()}return i(t,[{key:"emit",value:function(t,e){var n;if(this.log("info","emit message",[t,e]),!this.client)return this.log("info","缓存消息",[t,e]),void this.catch.push([t,e]);switch(null===(n=this.client)||void 0===n?void 0:n.readyState){case WebSocket.CLOSED:case WebSocket.CLOSING:break;case WebSocket.CONNECTING:this.log("info","缓存消息",[t,e]),this.catch.push([t,e])}}},{key:"on",value:function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)}},{key:"onConnected",value:function(t){this.on(O.EventType.connected,t)}},{key:"onDisconnected",value:function(t){this.on(O.EventType.disconnected,t)}},{key:"onError",value:function(t){this.on(O.EventType.error,t)}},{key:"send",value:function(t){var e;null===(e=this.client)||void 0===e||e.send({data:JSON.stringify(t)})}},{key:"_onError",value:function(t){var e;this.log("error","socket连接异常",t),null===(e=this.listeners.error)||void 0===e||e.forEach((function(e){e.call(void 0,t)}))}},{key:"_onClose",value:function(t){var e;this.log("error","socket连接已关闭"),null===(e=this.listeners.disconnected)||void 0===e||e.forEach((function(t){t.call(void 0)})),clearInterval(this.pingTimer)}},{key:"_onOpen",value:function(t){var e,n=this;this.log("info","socket连接成功",t),null===(e=this.listeners.connected)||void 0===e||e.forEach((function(t){t.call(void 0)})),this.log("info","clear catch",this.catch),this.catch.forEach((function(t){var e=h(t,2),r=e[0],i=e[1];n.emit(r,i)})),this.catch=[],this.ping()}},{key:"onMessage",value:function(t){var e,n,r;if(""!==t.data){var i=JSON.parse(t.data);if(i.code)switch(Number(i.code)){case O.ResponseCode.offline:null===(e=this.listeners[O.EventType.offline])||void 0===e||e.forEach((function(t){t.call(void 0,i)}));break;case O.ResponseCode.online:null===(n=this.listeners[O.EventType.online])||void 0===n||n.forEach((function(t){t.call(void 0,i)}));break;case O.ResponseCode.exist:null===(r=this.listeners[O.EventType.exist])||void 0===r||r.forEach((function(t){t.call(void 0,i)}));break;case O.ResponseCode.paramError:this._onError(new Error("参数缺失或错误"))}else{if(i.type===O.RequestType.pong)return;var o=i.data;this.listeners[o.event]&&this.listeners[o.event].forEach((function(t){t.call(void 0,o.payload)}))}}}},{key:"ping",value:function(){var t=this;this.pingTimer=setInterval((function(){t.send({type:O.RequestType.ping})}),3e3)}},{key:"removeAllListeners",value:function(){this.listeners={}}},{key:"removeListener",value:function(t,e){var n=this;e?this.listeners[t].forEach((function(r,i){r===e&&n.listeners[t].splice(i,1)})):this.listeners[t]=[]}},{key:"open",value:function(){var t,e,n=this;this.client&&this.close();var r=wx.connectSocket({url:"".concat(this.url,"?socketToken=").concat(null===(t=this.params)||void 0===t?void 0:t.socketToken,"&appId=").concat(null===(e=this.params)||void 0===e?void 0:e.appId,"&origin=").concat(O.SocketMsgOrigin.xcx)});r.onMessage((function(t){n.onMessage(t)})),r.onError((function(t){n._onError(t)})),r.onClose((function(t){n._onClose(t)})),r.onOpen((function(t){n._onOpen(t)})),this.client=r}},{key:"close",value:function(){var t;null===(t=this.client)||void 0===t||t.close(),this.log("info","关闭socket连接")}},{key:"destroy",value:function(){this.removeAllListeners(),this.close(),this.client=void 0}},{key:"log",value:function(t){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];this.showLog&&(e=console).log.apply(e,["%c【socketClient】:".concat(t),"color: ".concat("error"===t?"red":"#1890ff")].concat(r))}},{key:"openLog",value:function(t){this.showLog=t}}]),t}(),P=function(t,e,n){return new Promise((function(r,i){var u;wx.request((o(u={url:t,data:e,method:(null==n?void 0:n.method)||"POST",timeout:null==n?void 0:n.timeout},"header",{"content-type":(null==n?void 0:n.contentType)||"application/x-www-form-urlencoded"}),o(u,"dataType","json"),o(u,"responseType",null!=(null==n?void 0:n.responseType)?null==n?void 0:n.responseType:"arraybuffer"),o(u,"success",(function(t){r(t)})),o(u,"fail",(function(t){i(t)})),u))}))},E=function(){function e(t){n(this,e),this.pagePathJudge=function(t,e){return-1!==e.pagePath.indexOf("*")?-1!==t.pr.$page_url.indexOf(e.pagePath.split("*")[0]):e.pagePath===t.pr.$page_url.split("?")[0]},this.tracker=t,this.vRQC="",this.visualData=[],this.socketUserInfo=null,this.socketState=!1}return i(e,[{key:"init",value:function(){var t=this;this.socket&&this.socket.destroy(),this.socket=new T(this.tracker.config.socketUrl,{socketToken:this.vRQC.split("*")[0],appId:this.vRQC.split("*")[1]}),this.socket.on("update",(function(){t.getVisualData()})),this.socket.on("connected",(function(){null===t.socketUserInfo?wx.getSystemInfo({success:function(e){var n=e.model,r=e.system,i=e.version;wx.getUserInfo({success:function(e){var o=e.userInfo.nickName,u=e.userInfo.avatarUrl,a={model:n,system:r,version:i,nickName:o,avatarUrl:u,programId:t.tracker.config.appId};t.socketUserInfo=a,t.sendUserInfo(a)}})}}):t.sendUserInfo(t.socketUserInfo)}))}},{key:"getVisualData",value:function(){var t=this;P("".concat(this.tracker.config.serverUrl.normal,"/zg/web/v2/tracking/view/miniProgram/event/list"),{endpointType:O.VisualEndpointType.xcx,endpointIdentity:this.tracker.config.appId},{contentType:"application/json",responseType:""}).then((function(e){e.data&&e.data.data&&(t.visualData=e.data.data)}))}},{key:"sendUserInfo",value:function(t){var e;this.socketState=!0,null===(e=this.socket)||void 0===e||e.send({type:O.RequestType.normal,data:{event:O.SocketMessageType.xcxLogin,payload:{userInfo:t}}})}},{key:"send",value:function(t){var e;this.socketState&&(null===(e=this.socket)||void 0===e||e.send({type:O.RequestType.normal,data:{event:O.SocketMessageType.eventInfo,payload:t}}))}},{key:"event",value:function(e){var n;return g(this,void 0,void 0,t.mark((function r(){var i,o,u,a=this;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(n=this.tracker)||void 0===n?void 0:n.config.visual){t.next=2;break}return t.abrupt("return");case 2:"abp"!==e.dt||"pv"!==e.pr.$eid&&"click"!==e.pr.$eid?"evt"===e.dt&&this.vRQC&&this.send(Object.assign(Object.assign({},e),{eventType:"evt"})):(i=_.clone(e),o=!1,this.visualData.map((function(t){var n,r;if("click"===e.pr.$eid){var u=[],s=_.jsJSON(t.elementConditions)?JSON.parse(t.elementConditions):{};for(var c in s)u.push(s[c]===e.pr[c]);u.push(a.pagePathJudge(e,t)),-1===u.indexOf(!1)&&"click"===t.eventType&&(i.dt="evt",i.pr.$eid=t.eventName,o=!0,a.vRQC?a.send(Object.assign(Object.assign({},i),{visual:t})):null===(n=a.tracker)||void 0===n||n.send(i))}else"pv"===t.eventType&&a.pagePathJudge(e,t)&&(i.dt="evt",i.pr.$eid=t.eventName,o=!0,a.vRQC?a.send(Object.assign(Object.assign({},i),{visual:t})):null===(r=a.tracker)||void 0===r||r.send(i))})),this.vRQC&&!o&&(u="click"===e.pr.$eid?"click":"pv",this.send(Object.assign(Object.assign({},e),{eventType:u}))));case 3:case"end":return t.stop()}}),r,this)})))}}]),e}();function $(t,e,n){var r=n.value;return n.value=function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(this.pageReady&&this.loadReady)return r.apply(this,n);this.buffer.push({fnName:e,args:n})},n}var C=function(){function e(t,r,i){n(this,e),this.buffer=[],this.currentPage={queryObj:{},query:"",route:"",time:0,url:"",title:""},this.prevPage={queryObj:{},query:"",route:"",time:0,url:"",title:""},this.cn="",this.previousCountEvent={name:"",props:{}},this.count=0,this.countTimer=null,this.pageReady=!1,this.loadReady=!1,x=t,b=r,S=i,this.referrerDomain="miniprogram",this.appKey="",this.config={serverUrl:{normal:"https://u.zhugeapi.net",bac:"https://ubak.zhugeio.com"},socketUrl:"wss://u.zhugeapi.net/eventtracking/ws",debug:!1,pv:!1,click:!1,visual:!1,appName:"",timeout:18e5,requestTimeout:6e4,did:"",duration:!1,vn:"1.0",appId:"",sendLimit:1,superProperty:{},forwardShare:!1,beforeDuration:function(){},afterDuration:function(){},countDuration:3e3,parseScene:!0,utm:{},utmMode:"session",shareToUtm:{},exposure:!1},this.visual=new E(this)}return i(e,[{key:"load",value:function(e,n){return g(this,void 0,void 0,t.mark((function r(){var i;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.appKey=e,this.config=_.merge(this.config,n||{}),t.prev=2,t.next=5,b.get();case 5:if((i=t.sent)&&i.did){t.next=10;break}return t.next=9,b.getDid();case 9:i.did=t.sent;case 10:this.storage=new k(b,this,i),this.request=new w(x,this),this.loadReady=!0,this.updateSession("load"),this.freeBuffer(),t.next=20;break;case 17:t.prev=17,t.t0=t.catch(2),console.error("sdk初始化失败,缓存读取失败",t.t0);case 20:case"end":return t.stop()}}),r,this,[[2,17]])})))}},{key:"freeBuffer",value:function(){if(this.loadReady&&this.pageReady)for(;this.buffer.length;){var t=this.buffer.shift();if(t)(e.prototype[t.fnName]||this[t.fnName]).apply(this,t.args)}}},{key:"send",value:function(t){var e=this.storage.allData.utm;if(e)for(var n in e)e[n]&&(t.pr["$".concat(n)]=e[n]);return this.request.send(t)}},{key:"trackBaseData",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r,i;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new Date,t.t0=e,t.t1=r.getTime(),t.t2=this.storage.allData.sid,t.t3=this.storage.allData.cuid,t.t4=this.cn,t.t5=_.getTimezone(r),t.t6=this.currentPage.url,t.t7=this.prevPage.url,t.t8=S.os(),t.t9=S.ov(),t.t10=S.version(),t.next=14,S.mnet();case 14:return t.t11=t.sent,t.next=17,S.net();case 17:return t.t12=t.sent,t.t13=this.config.vn,t.t14=this.referrerDomain,t.t15=this.config.appId,t.t16={$eid:t.t0,$ct:t.t1,$sid:t.t2,$cuid:t.t3,$cn:t.t4,$tz:t.t5,$url:t.t6,$ref:t.t7,$os:t.t8,$ov:t.t9,$wv:t.t10,$mnet:t.t11,$net:t.t12,$vn:t.t13,$referrer_domain:t.t14,$wxeid:t.t15,$page_url:""},(i={dt:"evt",pr:t.t16}).pr=_.merge(i.pr,_.encode(this.config.superProperty)),t.abrupt("return",i);case 25:case"end":return t.stop()}}),n,this)})))}},{key:"environmentInfo",value:function(){var t=new Date,e={dt:"pl",pr:{$rs:"".concat(S.windowWidth(),"x").concat(S.windowHeight()),$tz:_.getTimezone(t),$ct:t.getTime(),$cuid:this.storage.allData.cuid,$sid:this.storage.allData.sid,$dv:void 0,$br:void 0}};if(wx.getSystemInfoSync){var n=wx.getSystemInfoSync();e.pr.$dv=n.model,e.pr.$br=n.brand}else delete e.pr.$dv,delete e.pr.$br;this.send(e)}},{key:"sessionEnd",value:function(t){var e=new Date,n=t.update-t.sid,r={dt:"se",pr:{$ct:t.update,$cn:this.cn,$tz:_.getTimezone(e),$dru:n,$sid:t.sid,$cuid:t.cuid,$referrer_domain:this.referrerDomain}};this.send(r)}},{key:"sessionStart",value:function(){return g(this,void 0,void 0,t.mark((function e(){var n,r,i,o,u;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new Date,r=this.storage.allData,i=r.sid,o=r.cuid,t.t0=i,t.t1=i,t.t2=o,t.t3=this.cn,t.t4=_.getTimezone(n),t.t5=this.currentPage.url,t.t6=this.prevPage.url,t.t7=S.os(),t.t8=S.ov(),t.t9=S.version(),t.next=14,S.mnet();case 14:return t.t10=t.sent,t.next=17,S.net();case 17:t.t11=t.sent,t.t12=this.config.vn,t.t13=this.referrerDomain,t.t14=this.config.appId,t.t15={$ct:t.t0,$sid:t.t1,$cuid:t.t2,$cn:t.t3,$tz:t.t4,$url:t.t5,$ref:t.t6,$os:t.t7,$ov:t.t8,$wv:t.t9,$mnet:t.t10,$net:t.t11,$vn:t.t12,$referrer_domain:t.t13,$wxeid:t.t14},u={dt:"ss",pr:t.t15},this.config.utm&&!_.isEmpty(this.config.utm)||!this.utmCatch||this.storage.set("utm",this.utmCatch),this.send(u),this.environmentInfo();case 26:case"end":return t.stop()}}),e,this)})))}},{key:"updateSession",value:function(t){var e=this.storage.allData,n=Date.now();if(e.sid&&e.update)if(n-e.update>this.config.timeout){var r=_.clone(e);this.storage.set("sid",n),this.storage.set("update",n),this.sessionEnd(r),this.sessionStart()}else this.storage.set("update",n);else this.storage.set("sid",n),this.storage.set("update",n),this.sessionStart()}},{key:"click",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r,i,o,u,a;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.config.click){t.next=2;break}return t.abrupt("return");case 2:return this.updateSession("click"),t.next=5,this.trackBaseData("click");case 5:for(u in r=t.sent,i={},o=["id","content","type","style","selector","link"],e.target.dataset)-1===o.indexOf(u)&&(i["_".concat(u)]=e.target.dataset[u]);return a=e.target,r.dt="abp",r.pr=_.merge(r.pr,{$page_url:this.currentPage.url,$page_title:this.currentPage.title},{$element_id:a.dataset.id||"",$element_content:a.dataset.content||"",$element_type:a.dataset.type||"",$element_style:a.dataset.style||"",$element_selector:a.dataset.selector||"",$element_link:a.dataset.link||""},i,""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),t.next=14,this.send(r);case 14:return t.next=16,this.visual.event(r);case 16:case"end":return t.stop()}}),n,this)})))}},{key:"pv",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.config.pv){t.next=2;break}return t.abrupt("return");case 2:return this.updateSession("pv"),t.next=5,this.trackBaseData("pv");case 5:return(r=t.sent).dt="abp",r.pr=_.merge(r.pr,{$page_url:this.currentPage.url.split("?")[0],$page_title:this.currentPage.title},e||{},""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),t.next=10,this.send(r);case 10:return t.next=12,this.visual.event(r);case 12:case"end":return t.stop()}}),n,this)})))}},{key:"duration",value:function(){return g(this,void 0,void 0,t.mark((function e(){var n,r;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.config.duration){t.next=2;break}return t.abrupt("return");case 2:return this.updateSession("duration"),_.isFunction(this.config.beforeDuration)&&this.config.beforeDuration(),n=this.currentPage.time-this.prevPage.time,t.next=7,this.trackBaseData("dr");case 7:return(r=t.sent).dt="abp",r.pr=_.merge(r.pr,{$dr:n,$url:this.prevPage.url,$title:this.prevPage.title}),t.next=12,this.send(r);case 12:_.isFunction(this.config.afterDuration)&&this.config.afterDuration();case 13:case"end":return t.stop()}}),e,this)})))}},{key:"track",value:function(e,n){return g(this,void 0,void 0,t.mark((function r(){var i;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.updateSession("track"),t.next=3,this.trackBaseData(e);case 3:return(i=t.sent).pr=_.merge(i.pr,_.encode(n),""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),t.next=7,this.send(i);case 7:return t.next=9,this.visual.event(i);case 9:case"end":return t.stop()}}),r,this)})))}},{key:"identify",value:function(e,n){return g(this,void 0,void 0,t.mark((function r(){var i,o;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.storage.set("cuid",e),this.updateSession("identify"),i=new Date,(o={dt:"usr",pr:{$ct:i.getTime(),$tz:_.getTimezone(i),$cuid:e,$sid:this.storage.allData.sid,$url:this.currentPage.url}}).pr=_.merge(o.pr,_.encode(n)),t.next=7,this.trackBaseData("usr");case 7:return t.next=9,this.send(o);case 9:case"end":return t.stop()}}),r,this)})))}},{key:"setPushClient",value:function(e,n){return g(this,void 0,void 0,t.mark((function r(){var i,o;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=new Date,o={dt:"um",pr:{$ct:i.getTime(),$tz:_.getTimezone(i),$push_ch:n||"getui",$push_id:e}},t.next=4,this.trackBaseData("usr");case 4:return t.next=6,this.send(o);case 6:case"end":return t.stop()}}),r,this)})))}},{key:"trackCount",value:function(t,e){var n=this;0===this.count&&(this.countStartTime=Date.now(),this.previousCountEvent.name=t,this.previousCountEvent.props=_.clone(e)),this.previousCountEvent.name===t&&_.isEqual(this.previousCountEvent.props,e)||(this.sendCountEvent(this.previousCountEvent.name,this.previousCountEvent.props,!1),this.previousCountEvent.name=t,this.previousCountEvent.props=_.clone(e),this.countStartTime=Date.now(),this.count=0),this.count+=1,this.countTimer&&clearTimeout(this.countTimer),this.countTimer=setTimeout((function(){n.sendCountEvent(t,e,!0)}),this.config.countDuration)}},{key:"sendCountEvent",value:function(e,n,r){return g(this,void 0,void 0,t.mark((function i(){var o,u,a,s;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.updateSession("track count"),o=Date.now()-this.countStartTime,r&&(o-=this.config.countDuration),u=this.count,this.count=r?0:1,t.next=7,this.trackBaseData(e);case 7:return a=t.sent,s={},_.isObject(n)&&(s=_.clone(n)),a.pr=_.merge(a.pr,_.encode(s),_.encode({count:u,countTime:o})),t.next=13,this.send(a);case 13:case"end":return t.stop()}}),i,this)})))}},{key:"trackRevenue",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r,i,o,u,a,s,c,m;return t.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=function(t,e){var n=0;try{t.toString().split(".")[1]&&(n+=t.toString().split(".")[1].length)}catch(t){console.error(t)}try{e.toString().split(".")[1]&&(n+=e.toString().split(".")[1].length)}catch(t){console.error(t)}return Number(t.toString().replace(".",""))*Number(e.toString().replace(".",""))/Math.pow(10,n)},this.updateSession("track revenue"),n.next=4,this.trackBaseData("revenue");case 4:(r=n.sent).dt="abp",(i=_.merge({price:0,total:0,productID:null,productQuantity:0,revenueType:null},e)).total=o(i.price,i.productQuantity),u=["productID","revenueType"],a=["price","total","productQuantity"],s={},n.t0=t.keys(i);case 12:if((n.t1=n.t0()).done){n.next=21;break}if(c=n.t1.value,-1!==u.indexOf(c)||-1!==a.indexOf(c)){n.next=16;break}return n.abrupt("continue",12);case 16:m=i[c],a.indexOf(c)>-1&&((m=Number(m))||(m=0)),s["$"+c]=m,n.next=12;break;case 21:return r.pr=_.merge(r.pr,s),n.next=24,this.send(r);case 24:case"end":return n.stop()}}),n,this)})))}},{key:"setUtm",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null!==(r=_.filterUtm(e))&&(this.storage.set("utm",r),this.updateSession("setUtm"));case 2:case"end":return t.stop()}}),n,this)})))}},{key:"setSuperProperty",value:function(t){_.isObject(t)&&(this.config.superProperty=t)}},{key:"extendSuperPropertys",value:function(t){_.isObject(t)&&(this.config.superProperty=_.merge(this.config.superProperty,t))}},{key:"removeSuperProperty",value:function(t){var e,n=function(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=p(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){a=!0,o=t},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;delete this.config.superProperty[r]}}catch(t){n.e(t)}finally{n.f()}}},{key:"getSuperProperty",value:function(){return this.config.superProperty}},{key:"flush",value:function(){this.request.clear()}}]),e}();v([$],C.prototype,"environmentInfo",null),v([$],C.prototype,"sessionEnd",null),v([$],C.prototype,"sessionStart",null),v([$],C.prototype,"updateSession",null),v([$],C.prototype,"click",null),v([$],C.prototype,"pv",null),v([$],C.prototype,"duration",null),v([$],C.prototype,"track",null),v([$],C.prototype,"identify",null),v([$],C.prototype,"setPushClient",null),v([$],C.prototype,"trackCount",null),v([$],C.prototype,"trackRevenue",null),v([$],C.prototype,"setUtm",null);var D=["onLaunch","onShow","onHide","onError","onPageNotFound","onUnhandledRejection","onThemeChange","onShareAppMessage","onLogin"],j=["onLoad","onShow","onReady","onHide","onUnload","onShareAppMessage","onReachBottom","onPageScroll","onPullDownRefresh","onTabItemTap","onInit","onShareTimeline","onAddToFavorites","onResize","onTitleClick","onOptionMenuClick","onPullIntercept","onURLQueryChange"],I=function(t){return _.wxGetTitle(t)},R={did:null,getDid:function(){return new Promise((function(t,e){wx.getStorage({key:"zg-did",success:function(e){t(e.data||""),wx.removeStorage({key:"zg-did"})},fail:function(e){t("")}})}))},get:function(){return new Promise((function(t,e){wx.getStorage({key:"zg",success:function(e){t(e.data||{})},fail:function(e){t({})}})}))},set:function(t,e){return new Promise((function(n,r){wx.setStorage({key:t,data:e,success:n,fail:r})}))}},L=!1,A=wx.getSystemInfoSync(),z=A.system.split(/\s/),N={os:z[0],ov:z[1],version:A.version,windowHeight:A.windowHeight,windowWidth:A.windowWidth,net:0,mnet:0};function U(t){var e=t.toLowerCase();"wifi"===e?(N.net=1,N.mnet=0):(N.net=0,N.mnet={"2g":1,"3g":3,"4g":13}[e]||0)}function q(t){return new Promise((function(e,n){if(L)return e(N[t]);wx.getNetworkType({success:function(n){L=!0,U(n.networkType),e(N[t])}})}))}wx.onNetworkStatusChange((function(t){U(t.networkType)}));var M,F,B={os:function(){return N.os},ov:function(){return N.ov},version:function(){return N.version},net:function(){return q("net")},mnet:function(){return q("mnet")},windowWidth:function(){return N.windowWidth},windowHeight:function(){return N.windowHeight}},Q=App,W=Page,H=Component,G=["eid","ct","tz","cuid","cn","sid","url","os","ov","wv","mnet","referrer_domain","net","vn","wxeid","uid","share_id","share_title","share_level","title","path"];function J(t,e,n){if(t[n]&&_.isFunction(t[n])){var r=t[n];t[n]=function(){r.apply(this,arguments),e[n].apply(this,arguments)}}else t[n]=function(){e[n].apply(this,arguments)}}function V(t,e,n){var r=t[e];t[e]=function(){var t=arguments[0];if(M===t||t&&M&&M.timeStamp===t.timeStamp)return r.apply(this,arguments);if(M=t,t){var e=t.type;"tap"===e&&n.click(t)}return r.apply(this,arguments)}}var K=function(e){u(o,C);var r=m(o);function o(t){var e;return n(this,o),(e=r.call(this,P,R,B)).openData={path:"",props:{}},e.shared=!1,e.semiAutoTrackEventCatch={},e.isShareOperation=!1,F=t,e.initLifeCycleHook(),e}return i(o,[{key:"initLifeCycleHook",value:function(){var t,e=this,n=(t=e,{App:{onLaunch:function(e){t.config.visual&&t.visual.getVisualData()},onShow:function(e){t.sceneToUtm(e),t.openOptions=e,t.updateSession("appOnShow")},onHide:function(){t.flush(),t.config.duration&&!t.isShareOperation&&(t.pageReady=!0,t.currentPage.time=Date.now(),t.duration().then((function(){t.pageReady=!1,t.prevPage={queryObj:{},query:"",route:"",time:0,url:"",title:""}})))}},Page:{onLoad:function(e){(null==e?void 0:e.scene)&&-1!==decodeURIComponent(e.scene).indexOf("vRQC")&&t.config.visual&&(t.visual.vRQC=decodeURIComponent(e.scene).split("vRQC=")[1],t.visual.init()),t.currentPage.query=_.parseQuery(e),t.currentPage.queryObj=e},onShow:function(){var e=getCurrentPages(),n=e[e.length-1];t.currentPage.route=n.__route__||n.route,t.currentPage.time=Date.now(),t.currentPage.url="".concat(t.currentPage.route);var r=I;if(t.currentPage.title="function"==typeof r?r(n):"",t.currentPage.query&&(t.currentPage.url+="?".concat(t.currentPage.query)),t.pageReady=!0,t.freeBuffer(),t.currentPage.url!==t.prevPage.url){""!==t.prevPage.url&&t.duration();try{t.trackOpenShare(t.openOptions)}catch(e){console.warn(e,"".concat(t.referrerDomain," ","zhuge"," sdk trackOpenShare error"))}t.pv()}t.startObserveMarkElement(n),t.openOptions=null,t.isShareOperation=!1},onHide:function(){t.semiAutoTrackEventCatch={},t.prevPage=_.clone(t.currentPage),t.pageReady=!1,t.flush()},onUnload:function(){t.semiAutoTrackEventCatch={},t.prevPage=_.clone(t.currentPage),t.pageReady=!1,t.flush()}}});this.lifecycle=n;var r=function(t){for(var r in n.App)J(t,n.App,r);for(var i in t)!D.includes(i)&&_.isFunction(t[i])&&V(t,i,e);return Q(t)};for(var i in App)r[i]=App[i];App=r;var o=function(t){for(var r in n.Page)J(t,n.Page,r);for(var i in t)!j.includes(i)&&_.isFunction(t[i])&&"onShareAppMessage"!==i&&V(t,i,e);var o=t.onShareAppMessage;return _.isFunction(o)&&(t.onShareAppMessage=e.onShareAppMessage(o)),W(t)};for(var u in Page)o[u]=Page[u];Page=o,Component=function(t){if(void 0!==t.methods)for(var n in t.methods)V(t.methods,n,e);return H(t)},global&&global.mpvue&&(global.App=App,global.Page=Page,global.Component=Component),App.zhuge=e}},{key:"load",value:function(t,e){return l(a(o.prototype),"load",this).call(this,t,e)}},{key:"pv",value:function(e){var n=this,r=Object.create(null,{pv:{get:function(){return l(a(o.prototype),"pv",n)}}});return g(this,void 0,void 0,t.mark((function e(){var n,i;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={},i=_.getCurrentPage(),this.config.forwardShare&&this.openOptions&&(n.$share_open_type=1008===this.openOptions.scene?"群聊":"聊天",this.openOptions.query&&this.openOptions.query.zg_share_level&&(n.$share_level=Number(this.openOptions.query.zg_share_level)),i.data&&i.data.zg_share_data&&(n=_.merge(n,_.encode(i.data.zg_share_data)))),t.next=5,r.pv.call(this,n);case 5:case"end":return t.stop()}}),e,this)})))}},{key:"click",value:function(e){var n=this,r=Object.create(null,{click:{get:function(){return l(a(o.prototype),"click",n)}}});return g(this,void 0,void 0,t.mark((function n(){return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.click.call(this,e);case 2:case"end":return t.stop()}}),n,this)})))}},{key:"sceneToUtm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=_.getUtmByQuery(t.query);if(this.config.parseScene&&t.scene&&F){var n=t.scene;this.cn=n+"";var r=F[n],i={},o=null,u=F.isShare(n);if(u&&t.referrerInfo&&(o=t.referrerInfo.appId),r){i={utm_source:r.utm_source,utm_medium:r.utm_medium,utm_campaign:o};var a=t.query||{};F.isCartShare(n)&&a.zg_uid&&a.zg_share_id&&(i.utm_term=a.zg_uid,i.utm_content=a.zg_share_id)}e=_.merge(i,e)}this.utmCatch=e,"fresh"===this.config.utmMode&&_.isEmpty(this.config.utm)&&this.storage.set("utm",e)}},{key:"trackOpenShare",value:function(e){return g(this,void 0,void 0,t.mark((function n(){var r,i,o,u,a,s,c,m,l,h,f;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e&&this.config.forwardShare){t.next=2;break}return t.abrupt("return");case 2:if(!this.shared){t.next=5;break}return this.shared=!1,t.abrupt("return");case 5:if(r=e.query||{},i=this.currentPage.route,!(F.isCartShare(e.scene)&&r.zg_uid&&r.zg_share_id)){t.next=24;break}for(a in o={$uid:r.zg_uid,$share_id:r.zg_share_id,$title:this.currentPage.title,$path:i,$share_open_type:1008===e.scene?"群聊":"聊天",$share_level:Number(r.zg_share_level)},this.shareId=r.zg_share_id,this.shareLevel=Number(r.zg_share_level),u={},r)s=a.replace(/^zg_/,""),-1===G.indexOf(s)&&/^zg_/.test(a)&&(u[s]=r[a]);if(c=this.config.shareToUtm,_.isObject(c)&&!_.isEmpty(c)){for(l in m={},c)null!==u[l]&&void 0!==u[l]&&(h=c[l],m[h]=u[l]);_.isEmpty(m)||(m.utm_campaign||(m.utm_campaign="分享打开"),this.setUtm(m))}return this.openData={path:i,props:u},o=_.merge(o,_.encode(u)),t.next=19,this.trackBaseData("wxsopen");case 19:return(f=t.sent).dt="abp",f.pr=_.merge(f.pr,o),t.next=24,this.send(f);case 24:case"end":return t.stop()}}),n,this)})))}},{key:"onShareAppMessage",value:function(t){var e=this;return function(){e.isShareOperation=!0;var n=t.apply(this,arguments)||{};if(!e.config.forwardShare)return n;n.path=n.path||e.currentPage.url;var r=n.title||e.currentPage.title,i=n.path.split("?")[0],o=this.data.zg_share_data,u=(new Date).getTime(),a=1;!this.data.newShare&&e.openData&&e.openData.path===i&&_.isEqual(o||{},e.openData.props)&&(u=e.shareId,a=e.shareLevel+1);var s={share_id:u,uid:e.storage.allData.cuid||e.storage.allData.did,share_level:a},c={$share_title:r,$title:e.currentPage.title||"",$path:i},m={};for(var l in s)c["$".concat(l)]=m["zg_".concat(l)]=s[l];for(var h in o)-1===G.indexOf(h)&&(c["_".concat(h)]=m["zg_".concat(h)]=o[h]);return n.path=_.addUrlParam(n.path,m),e.trackBaseData("wxshare").then((function(t){t.dt="abp",t.pr=_.merge(t.pr,c),e.request.send(t)})),e.shared=!0,n}}},{key:"startObserveMarkElement",value:function(t){var e=this;this.config.exposure&&(this.elementObserver&&this.elementObserver.disconnect(),t.isComponent?this.elementObserver=t.createIntersectionObserver({observeAll:!0}):this.elementObserver=wx.createIntersectionObserver(t,{observeAll:!0}),this.elementObserver.relativeToViewport().observe(".zhuge-expo-track",(function(t){if(t.intersectionRatio>0){var n,r=e.getEventDataFromDataset(t.dataset);(n=l(a(o.prototype),"track",e)).call.apply(n,[e].concat(f(r)))}})))}},{key:"getEventDataFromDataset",value:function(t){var e={},n="";for(var r in t){if(r.startsWith("expo"))if("expoName"===r)n=t[r];else e[r.replace(/^expo(.*)/,(function(t,e,n,r){return e.replace(e[0],e[0].toLocaleLowerCase())}))]=t[r]}return[n,e]}}]),o}();v([$],K.prototype,"sceneToUtm",null),v([$],K.prototype,"trackOpenShare",null);var Y={1e3:{utm_source:"其他",utm_medium:"其他"},1001:{utm_source:"微信主程序",utm_medium:"发现栏小程序主入口"},1005:{utm_source:"搜索",utm_medium:"顶部搜索框的搜索结果页"},1006:{utm_source:"搜索",utm_medium:"发现栏小程序主入口搜索框的搜索结果页"},1007:{utm_source:"分享",utm_medium:"单人聊天会话中的小程序消息卡片"},1008:{utm_source:"分享",utm_medium:"群聊会话中的小程序消息卡片"},1010:{utm_source:"收藏",utm_medium:"收藏夹"},1011:{utm_source:"扫码",utm_medium:"扫描二维码"},1012:{utm_source:"扫码",utm_medium:"长按图片识别二维码"},1013:{utm_source:"扫码",utm_medium:"手机相册选取二维码"},1014:{utm_source:"小程序模板消息",utm_medium:"小程序模板消息"},1017:{utm_source:"体验版",utm_medium:"前往体验版的入口页"},1019:{utm_source:"微信支付",utm_medium:"微信钱包"},1023:{utm_source:"桌面图标",utm_medium:"安卓系统桌面图标"},1024:{utm_source:"微信主程序",utm_medium:"小程序 profile 页"},1025:{utm_source:"扫码",utm_medium:"扫描一维码"},1026:{utm_source:"微信主程序",utm_medium:"附近小程序列表"},1027:{utm_source:"搜索",utm_medium:"顶部搜索框搜索结果页“使用过的小程序”列表"},1028:{utm_source:"微信卡券",utm_medium:"我的卡包"},1029:{utm_source:"微信卡券",utm_medium:"卡券详情页"},1030:{utm_source:"测试",utm_medium:"自动化测试下打开小程序"},1031:{utm_source:"扫码",utm_medium:"长按图片识别一维码"},1032:{utm_source:"扫码",utm_medium:"手机相册选取一维码"},1034:{utm_source:"微信支付",utm_medium:"微信支付完成页"},1035:{utm_source:"公众号",utm_medium:"公众号自定义菜单"},1036:{utm_source:"分享",utm_medium:"App分享消息卡片"},1037:{utm_source:"小程序",utm_medium:"小程序打开小程序"},1038:{utm_source:"小程序",utm_medium:"从另一个小程序返回"},1039:{utm_source:"摇电视",utm_medium:"摇电视"},1042:{utm_source:"搜索",utm_medium:"添加好友搜索框的搜索结果页"},1043:{utm_source:"公众号",utm_medium:"公众号模板消息"},1044:{utm_source:"分享",utm_medium:"带shareTicket的小程序消息卡片(详情)"},1045:{utm_source:"广告",utm_medium:"朋友圈广告"},1046:{utm_source:"广告",utm_medium:"朋友圈广告详情页"},1047:{utm_source:"扫码",utm_medium:"扫描小程序码"},1048:{utm_source:"扫码",utm_medium:"长按图片识别小程序码"},1049:{utm_source:"扫码",utm_medium:"手机相册选取小程序码"},1052:{utm_source:"微信卡券",utm_medium:"卡券的适用门店列表"},1053:{utm_source:"搜索",utm_medium:"搜一搜的结果页"},1056:{utm_source:"音乐播放器菜单",utm_medium:"音乐播放器菜单"},1057:{utm_source:"微信支付",utm_medium:"钱包中的银行卡详情页"},1058:{utm_source:"公众号",utm_medium:"公众号文章"},1059:{utm_source:"体验版",utm_medium:"体验版小程序绑定邀请页"},1060:{utm_source:"支付完成",utm_medium:"微信支付完成页"},1064:{utm_source:"微信WIFI",utm_medium:"微信连Wi-Fi状态栏"},1065:{utm_source:"scheme 详情",utm_medium:"URL scheme 详情"},1067:{utm_source:"广告",utm_medium:"公众号文章广告"},1069:{utm_source:"移动应用",utm_medium:"移动应用"},1071:{utm_source:"微信支付",utm_medium:"钱包中的银行卡列表页"},1072:{utm_source:"微信支付",utm_medium:"二维码收款页面"},1073:{utm_source:"客服消息",utm_medium:"客服消息列表下发的小程序消息卡片"},1074:{utm_source:"公众号会话",utm_medium:"公众号会话下发的小程序消息卡片"},1077:{utm_source:"摇周边",utm_medium:"摇周边"},1078:{utm_source:"微信WIFI",utm_medium:"连Wi-Fi成功页"},1079:{utm_source:"微信游戏中心",utm_medium:"微信游戏中心"},1081:{utm_source:"客服消息",utm_medium:"客服消息下发的文字链"},1082:{utm_source:"公众号",utm_medium:"公众号会话下发的文字链"},1084:{utm_source:"广告",utm_medium:"朋友圈广告原生页"},1088:{utm_source:"打开小程序",utm_medium:"会话中查看系统消息,打开小程序"},1089:{utm_source:"微信主程序",utm_medium:"微信聊天主界面下拉"},1090:{utm_source:"小程序",utm_medium:"长按小程序右上角菜单唤出最近使用历史"},1091:{utm_source:"公众号",utm_medium:"公众号文章商品卡片"},1092:{utm_source:"微信城市服务",utm_medium:"城市服务入口"},1095:{utm_source:"广告",utm_medium:"小程序广告组件"},1096:{utm_source:"分享",utm_medium:"聊天记录"},1097:{utm_source:"微信支付",utm_medium:"微信支付签约页"},1099:{utm_source:"小程序",utm_medium:"页面内嵌插件"},1100:{utm_source:"打开小程序",utm_medium:"红包封面详情页打开小程序"},1101:{utm_source:"调试",utm_medium:"远程调试热更新(开发者工具中,预览 -> 自动预览 -> 编译并预览)"},1102:{utm_source:"公众号",utm_medium:"公众号profile页服务预览"},1106:{utm_source:"打开小程序",utm_medium:"聊天主界面下拉,从顶部搜索结果页,打开小程序"},1107:{utm_source:"打开小程序",utm_medium:"订阅消息,打开小程序"},1113:{utm_source:"打开小程序",utm_medium:"安卓手机负一屏,打开小程序(三星)"},1114:{utm_source:"打开小程序",utm_medium:"安卓手机侧边栏,打开小程序(三星)"},1119:{utm_source:"打开小程序",utm_medium:"【企业微信】工作台内打开小程序"},1120:{utm_source:"打开小程序",utm_medium:"【企业微信】个人资料页内打开小程序"},1121:{utm_source:"打开小程序",utm_medium:"【企业微信】聊天加号附件框内打开小程序"},1124:{utm_source:"打开小程序",utm_medium:"扫“一物一码”打开小程序"},1125:{utm_source:"图片识别",utm_medium:"长按图片识别“一物一码”"},1126:{utm_source:"扫描手机相册",utm_medium:"扫描手机相册中选取的“一物一码”"},1129:{utm_source:"爬虫",utm_medium:"微信爬虫"},1131:{utm_source:"浮窗",utm_medium:"浮窗"},1133:{utm_source:"打开小程序详情",utm_medium:"硬件设备打开小程序详情"},1135:{utm_source:"打开小程序",utm_medium:"小程序 profile 页相关小程序列表,打开小程序"},1144:{utm_source:"视频贴片",utm_medium:"公众号文章 - 视频贴片"},1145:{utm_source:"发现小程序",utm_medium:"发现栏 - 发现小程序"},1146:{utm_source:"打开出行类小程序",utm_medium:"地理位置信息打开出行类小程序"},1148:{utm_source:"打开小程序",utm_medium:"卡包 - 交通卡,打开小程序"},1150:{utm_source:"扫一扫",utm_medium:"扫一扫商品条码结果页打开小程序"},1151:{utm_source:"我的订单",utm_medium:"发现栏 - 我的订单"},1152:{utm_source:"打开小程序",utm_medium:"订阅号视频打开小程序"},1153:{utm_source:"打开小程序",utm_medium:"“识物”结果页打开小程序"},1154:{utm_source:"打开“单页模式”",utm_medium:"朋友圈内打开“单页模式”"},1155:{utm_source:"打开小程序",utm_medium:"“单页模式”打开小程序"},1157:{utm_source:"打开小程序",utm_medium:"服务号会话页打开小程序"},1158:{utm_source:"打开小程序",utm_medium:"群工具打开小程序"},1160:{utm_source:"群待办",utm_medium:"群待办"},1167:{utm_source:"打开小程序详情",utm_medium:"H5 通过开放标签打开小程序详情"},1168:{utm_source:"运行小程序",utm_medium:"移动应用直接运行小程序"},1169:{utm_source:"小程序入口",utm_medium:"发现栏小程序主入口,各个生活服务入口"},1171:{utm_source:"微信运动记录",utm_medium:"微信运动记录"},1173:{utm_source:"打开小程序详情",utm_medium:"聊天素材用小程序打开详情"},1175:{utm_source:"商店入口",utm_medium:"视频号主页商店入口"},1176:{utm_source:"打开小程序",utm_medium:"视频号直播间主播打开小程序"},1177:{utm_source:"直播商品",utm_medium:"视频号直播商品"},1178:{utm_source:"打开小程序",utm_medium:"在电脑打开手机上打开的小程序"},1179:{utm_source:"打开小程序",utm_medium:"#话题页打开小程序"},1181:{utm_source:"打开 PC 小程序",utm_medium:"网站应用打开 PC 小程序"},1183:{utm_source:"搜索",utm_medium:"PC微信 - 小程序面板 - 发现小程序 - 搜索"},1184:{utm_source:"打开小程序",utm_medium:"视频号链接打开小程序"},1185:{utm_source:"群公告",utm_medium:"群公告"},1186:{utm_source:"收藏",utm_medium:"收藏 - 笔记"},1187:{utm_source:"浮窗",utm_medium:"浮窗"},1189:{utm_source:"表情雨广告",utm_medium:"表情雨广告"},1191:{utm_source:"视频号活动",utm_medium:"视频号活动"},1192:{utm_source:"企业微信联系人 profile 页",utm_medium:"企业微信联系人 profile 页"},1193:{utm_source:"打开小程序",utm_medium:"视频号主页服务菜单打开小程序"},1194:{utm_source:"URL Link 详情",utm_medium:"URL Link 详情"},1195:{utm_source:"主页商品tab",utm_medium:"视频号主页商品tab"},1196:{utm_source:"打开小程序",utm_medium:"个人状态打开小程序"},1197:{utm_source:"返回小游戏",utm_medium:"视频号主播从直播间返回小游戏"},1198:{utm_source:"打开小游戏",utm_medium:"视频号开播界面打开小游戏"},1201:{utm_source:"打开小程序",utm_medium:"视频号广告详情页打开小程序"},1202:{utm_source:"打开小程序卡片",utm_medium:"企微客服号会话打开小程序卡片"},1203:{utm_source:"压测工具的请求",utm_medium:"微信小程序压测工具的请求"},1206:{utm_source:"打开小游戏",utm_medium:"视频号小游戏直播间打开小游戏"},1207:{utm_source:"打开小程序文字链",utm_medium:"企微客服号会话打开小程序文字链"},1208:{utm_source:"打开商品卡片",utm_medium:"聊天打开商品卡片"},1212:{utm_source:"打开小程序",utm_medium:"青少年模式申请页打开小程序"},1215:{utm_source:"打开小程序",utm_medium:"广告预约打开小程序"},1216:{utm_source:"打开小程序",utm_medium:"视频号订单中心打开小程序"},isShare:function(t){return[1096].includes(t)},isCartShare:function(t){return[1007,1008,1036,1044].includes(t)}},X=new(function(t){u(r,K);var e=m(r);function r(){return n(this,r),e.call(this,Y)}return i(r,[{key:"load",value:function(t,e){var n=e||{};if(wx.getAccountInfoSync){var i=wx.getAccountInfoSync();i&&i.miniProgram&&i.miniProgram.appId&&(n.appId=i.miniProgram.appId)}return l(a(r.prototype),"load",this).call(this,t,n)}}]),r}());App.zhuge=X;export default X;
|
package/dist/zhuge.min.js
CHANGED
|
@@ -13,4 +13,4 @@ var regeneratorRuntime=function(e){"use strict";var t,r=Object.prototype,n=r.has
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
function d(e,t,r,n){var i,o=arguments.length,u=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(u=(o<3?i(u):o>3?i(t,r,u):i(t,r))||u);return o>3&&u&&Object.defineProperty(t,r,u),u}function v(e,t,r,n){return new(r||(r=Promise))((function(i,o){function u(e){try{s(n.next(e))}catch(e){o(e)}}function a(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(u,a)}s((n=n.apply(e,t||[])).next())}))}var g,y={utmKeys:["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],isValid:function(e){return null==e},type:function(e){return Object.prototype.toString.call(e)},isObject:function(e){return"[object Object]"===this.type(e)},isArray:function(e){return"[object Array]"===this.type(e)},isString:function(e){return"[object String]"===this.type(e)},isNumber:function(e){return"[object Number]"===this.type(e)},isDate:function(e){return"[object Date]"===this.type(e)},isFunction:function(e){return"[object Function]"===this.type(e)},jsJSON:function(e){try{return JSON.parse(e),!0}catch(e){return!1}},isEmpty:function(e){return Array.isArray(e)||"string"==typeof e||e instanceof String?0===e.length:e instanceof Map||e instanceof Set?0===e.size:"[object Object]"===Object.prototype.toString.call(e)&&0===Object.keys(e).length},merge:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.reduce((function(t,r){return Object.keys(r).forEach((function(n){Array.isArray(t[n])&&Array.isArray(r[n])?t[n]=Array.from(new Set(t[n].concat(r[n]))):e.isObject(t[n])&&e.isObject(r[n])?t[n]=e.merge(t[n],r[n]):t[n]=r[n]})),t}),{})},UUID:function(){var e=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},clone:function(t){var r=function(e){var t=e.constructor;switch(n(e)){case"Boolean":case"Number":case"String":case"Error":case"Date":return new t(e);case"RegExp":return o(e);case"Symbol":return i(e);case"Function":return e;default:return null}},n=function(e){return Object.prototype.toString.call(e).slice(8,-1)},i=function(e){return Object(Symbol.prototype.valueOf.call(e))},o=function(e){var t=new e.constructor(e.source,/\w*$/.exec(e));return t.lastIndex=e.lastIndex,t},u=function(e,t){for(var r=-1,n=e.length;++r<n;)t(e[r],r);return e},a=function t(i){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if("object"!==e(i)||null===i)return i;var a=n(i),s=null;return o.get(i)?o.get(i):(o.set(i,s),"Set"!==a&&"Map"!==a&&"Array"!==a&&"Object"!==a?r(i):"Set"===a?(s=new Set,i.forEach((function(e){s.add(t(e,o))})),s):"Map"===a?(s=new Map,i.forEach((function(e,r){s.set(r,t(e,o))})),s):("Array"===a&&(s=new Array,u(i,(function(e,r){s[r]=t(e,o)}))),"Object"===a&&(s=new Object,u(Object.keys(i),(function(e){s[e]=t(i[e],o)}))),s))};return a(t)},parseQuery:function(e){if(this.isEmpty(e))return"";var t=[];for(var r in e)t.push("".concat(r,"=").concat(e[r]));return t.join("&")},getTimezone:function(e){return 6e4*-e.getTimezoneOffset()},encode:function(e){var t={};for(var r in e)t["_"+r]=e[r];return t},isEqual:function(e,t){if(this.type(e)!==this.type(t))return!1;var r=!0;for(var n in e)e[n]!==t[n]&&(r=!1);return r},getUtmByQuery:function(e){var t={};for(var r in e)this.utmKeys.includes(r)&&(t[r]=e[r]);return t},filterUtm:function(e){var t=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],r=!1,n={};for(var i in e)t.indexOf(i)>-1&&(r=!0,n[i]=e[i]);return r?n:null},deleteQueryParams:function(e,t){var r=e.split("&"),n=[];return r.forEach((function(e){var r=new RegExp(t+"=.*"),i="";r.test(e)?(i=e.replace(r,""))&&n.push(i):n.push(e)})),n.join("&")},addUrlParam:function(e,t){var r=e,n="";for(var i in t)n&&(n+="&"),r=this.deleteQueryParams(r,i),n+=i+"="+t[i];var o=r.split("?");return o.length>1?o[1]?o[1]=n+"&"+o[1]:o[1]=n:1===o.length&&o.push(n),o.join("?")},getCurrentPage:function(){var e=getCurrentPages();return e[e.length-1]},wxGetTitle:function(e){var t,r,n,i="";e.data&&e.data.title&&e.data.title.length>0&&(i=Array.isArray(e.data.title)?e.data.title.join(" "):e.data.title);try{if(!i.length&&__wxConfig&&(__wxConfig.tabBar&&__wxConfig.tabBar.list.forEach((function(t){t.pagePath==="".concat(e.route,".html")&&t.text&&(i=t.text)})),!i.length)){var o=__wxConfig.page[e.route]||__wxConfig.page["".concat(e.route,".html")];i=o?null===(t=o.window)||void 0===t?void 0:t.navigationBarTitleText:null===(n=null===(r=null===__wxConfig||void 0===__wxConfig?void 0:__wxConfig.global)||void 0===r?void 0:r.window)||void 0===n?void 0:n.navigationBarTitleText}}catch(e){}return i||e.route}},_=function(){function e(r,n){t(this,e),this.timeout=500,this.catch=[],this.fastTouch=[],this.clearFastTouchTimer=null,this.clearCatchTimer=null,this.tracker=n,this.url="".concat(n.config.serverUrl.normal,"/apipool"),this.timeout=n.config.timeout||this.timeout,this.requestTimeout=n.config.requestTimeout,this.debug=n.config.debug?1:0,this.appKey=n.appKey,this.did=n.storage.allData.did,this.sendLimit=n.config.sendLimit,this.requestFunction=r}return n(e,[{key:"generateRequestData",value:function(){var e=new Date,t={method:"web_event_sr.upload",event:JSON.stringify({sln:"itn",pl:"js",sdk:"sys",sdkv:"__sdkv__",owner:"zg",ut:"".concat(e.getFullYear(),"-").concat(e.getMonth()+1,"-").concat(e.getDate()," ").concat(e.getHours(),":").concat(e.getMinutes(),":").concat(e.getSeconds()),tz:y.getTimezone(e),debug:this.debug?1:0,ak:this.appKey,usr:{did:this.did},data:h(this.catch)}),_:e.getTime()+""};return this.catch=[],t}},{key:"clear",value:function(){if(this.catch.length){var e=this.generateRequestData();this.requestFunction(this.url,e,{timeout:this.requestTimeout})}}},{key:"send",value:function(e){var t=this;if(this.catch.push(e),this.clearCatchTimer&&clearTimeout(this.clearCatchTimer),this.clearCatchTimer=setTimeout((function(){t.clear()}),3e4),!(this.catch.length<this.sendLimit)){this.clearCatchTimer&&clearTimeout(this.clearCatchTimer);var r=this.generateRequestData();return new Promise((function(e,n){var i,o=!1;i=setTimeout((function(){o=!0,e(null)}),t.timeout),t.requestFunction(t.url,r,{timeout:t.requestTimeout}).then((function(t){o||(clearTimeout(i),e(t))})).catch((function(e){n(e)}))}))}}}]),e}(),w=function(){function e(r,n,i){t(this,e),this.storageFunction=r,this.allData=i||{},this.allData.did||this.set("did",n.config.did||y.UUID()),this.allData.cuid||this.set("cuid",void 0),y.isEmpty(n.config.utm)||this.set("utm",n.config.utm)}return n(e,[{key:"get",value:function(e){return this.allData[e]}},{key:"set",value:function(e,t){return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.allData[e]=t,r.next=3,this.storageFunction.set("zg",this.allData);case 3:case"end":return r.stop()}}),r,this)})))}}]),e}();!function(e){var t,r,n,i,o,u;(t=e.EventType||(e.EventType={})).connected="connected",t.disconnected="disconnected",t.error="error",t.offline="offline",t.exist="exist",t.online="online",(r=e.RequestType||(e.RequestType={}))[r.common=0]="common",r[r.ping=1]="ping",r[r.pong=2]="pong",r[r.normal=5]="normal",r[r.img=6]="img",(n=e.ResponseCode||(e.ResponseCode={}))[n.offline=109001]="offline",n[n.exist=109002]="exist",n[n.paramError=109005]="paramError",n[n.online=109006]="online",(i=e.SocketMsgOrigin||(e.SocketMsgOrigin={}))[i.xcx=1]="xcx",i[i.app=2]="app",i[i.web=3]="web",(o=e.VisualEndpointType||(e.VisualEndpointType={}))[o.xcx=1]="xcx",(u=e.SocketMessageType||(e.SocketMessageType={})).update="update",u.xcxLogin="xcxLogin",u.eventInfo="eventInfo"}(g||(g={}));var k,b,x,S=g,O=function(){function e(r,n){t(this,e),this.listeners={},this.catch=[],this.showLog=!1,this.url=r,this.params=n,this.open()}return n(e,[{key:"emit",value:function(e,t){var r;if(this.log("info","emit message",[e,t]),!this.client)return this.log("info","缓存消息",[e,t]),void this.catch.push([e,t]);switch(null===(r=this.client)||void 0===r?void 0:r.readyState){case WebSocket.CLOSED:case WebSocket.CLOSING:break;case WebSocket.CONNECTING:this.log("info","缓存消息",[e,t]),this.catch.push([e,t])}}},{key:"on",value:function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}},{key:"onConnected",value:function(e){this.on(S.EventType.connected,e)}},{key:"onDisconnected",value:function(e){this.on(S.EventType.disconnected,e)}},{key:"onError",value:function(e){this.on(S.EventType.error,e)}},{key:"send",value:function(e){var t;null===(t=this.client)||void 0===t||t.send({data:JSON.stringify(e)})}},{key:"_onError",value:function(e){var t;this.log("error","socket连接异常",e),null===(t=this.listeners.error)||void 0===t||t.forEach((function(t){t.call(void 0,e)}))}},{key:"_onClose",value:function(e){var t;this.log("error","socket连接已关闭"),null===(t=this.listeners.disconnected)||void 0===t||t.forEach((function(e){e.call(void 0)})),clearInterval(this.pingTimer)}},{key:"_onOpen",value:function(e){var t,r=this;this.log("info","socket连接成功",e),null===(t=this.listeners.connected)||void 0===t||t.forEach((function(e){e.call(void 0)})),this.log("info","clear catch",this.catch),this.catch.forEach((function(e){var t=l(e,2),n=t[0],i=t[1];r.emit(n,i)})),this.catch=[],this.ping()}},{key:"onMessage",value:function(e){var t,r,n;if(""!==e.data){var i=JSON.parse(e.data);if(i.code)switch(Number(i.code)){case S.ResponseCode.offline:null===(t=this.listeners[S.EventType.offline])||void 0===t||t.forEach((function(e){e.call(void 0,i)}));break;case S.ResponseCode.online:null===(r=this.listeners[S.EventType.online])||void 0===r||r.forEach((function(e){e.call(void 0,i)}));break;case S.ResponseCode.exist:null===(n=this.listeners[S.EventType.exist])||void 0===n||n.forEach((function(e){e.call(void 0,i)}));break;case S.ResponseCode.paramError:this._onError(new Error("参数缺失或错误"))}else{if(i.type===S.RequestType.pong)return;var o=i.data;this.listeners[o.event]&&this.listeners[o.event].forEach((function(e){e.call(void 0,o.payload)}))}}}},{key:"ping",value:function(){var e=this;this.pingTimer=setInterval((function(){e.send({type:S.RequestType.ping})}),3e3)}},{key:"removeAllListeners",value:function(){this.listeners={}}},{key:"removeListener",value:function(e,t){var r=this;t?this.listeners[e].forEach((function(n,i){n===t&&r.listeners[e].splice(i,1)})):this.listeners[e]=[]}},{key:"open",value:function(){var e,t,r=this;this.client&&this.close();var n=wx.connectSocket({url:"".concat(this.url,"?socketToken=").concat(null===(e=this.params)||void 0===e?void 0:e.socketToken,"&appId=").concat(null===(t=this.params)||void 0===t?void 0:t.appId,"&origin=").concat(S.SocketMsgOrigin.xcx)});n.onMessage((function(e){r.onMessage(e)})),n.onError((function(e){r._onError(e)})),n.onClose((function(e){r._onClose(e)})),n.onOpen((function(e){r._onOpen(e)})),this.client=n}},{key:"close",value:function(){var e;null===(e=this.client)||void 0===e||e.close(),this.log("info","关闭socket连接")}},{key:"destroy",value:function(){this.removeAllListeners(),this.close(),this.client=void 0}},{key:"log",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this.showLog&&(t=console).log.apply(t,["%c【socketClient】:".concat(e),"color: ".concat("error"===e?"red":"#1890ff")].concat(n))}},{key:"openLog",value:function(e){this.showLog=e}}]),e}(),T=function(e,t,r){return new Promise((function(n,o){var u;wx.request((i(u={url:e,data:t,method:"POST",timeout:null==r?void 0:r.timeout},"header",{"content-type":(null==r?void 0:r.contentType)||"application/x-www-form-urlencoded"}),i(u,"dataType","json"),i(u,"responseType","arraybuffer"),i(u,"success",(function(e){n(e)})),i(u,"fail",(function(e){o(e)})),u))}))},P=function(){function e(r){t(this,e),this.pagePathJudge=function(e,t){return-1!==t.pagePath.indexOf("*")?-1!==e.pr.$page_url.indexOf(t.pagePath.split("*")[0]):t.pagePath===e.pr.$page_url.split("?")[0]},this.tracker=r,this.vRQC="",this.visualData=[],this.socketUserInfo=null,this.socketState=!1}return n(e,[{key:"init",value:function(){var e=this;this.socket&&this.socket.destroy(),this.socket=new O(this.tracker.config.socketUrl,{socketToken:this.vRQC.split("*")[0],appId:this.vRQC.split("*")[1]}),this.socket.on("update",(function(){e.getVisualData()})),this.socket.on("connected",(function(){null===e.socketUserInfo?wx.getSystemInfo({success:function(t){var r=t.model,n=t.system,i=t.version;wx.getUserInfo({success:function(t){var o=t.userInfo.nickName,u=t.userInfo.avatarUrl,a={model:r,system:n,version:i,nickName:o,avatarUrl:u,programId:e.tracker.config.appId};e.socketUserInfo=a,e.sendUserInfo(a)}})}}):e.sendUserInfo(e.socketUserInfo)}))}},{key:"getVisualData",value:function(){var e=this;T("".concat(this.tracker.config.serverUrl.normal,"/zg/web/v2/tracking/view/miniProgram/event/list"),{endpointType:S.VisualEndpointType.xcx,endpointIdentity:this.tracker.config.appId},{contentType:"application/json"}).then((function(t){t.data&&t.data.data&&(e.visualData=t.data.data)}))}},{key:"sendUserInfo",value:function(e){var t;this.socketState=!0,null===(t=this.socket)||void 0===t||t.send({type:S.RequestType.normal,data:{event:S.SocketMessageType.xcxLogin,payload:{userInfo:e}}})}},{key:"send",value:function(e){var t;this.socketState&&(null===(t=this.socket)||void 0===t||t.send({type:S.RequestType.normal,data:{event:S.SocketMessageType.eventInfo,payload:e}}))}},{key:"event",value:function(e){var t;return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n,i,o,u=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(null===(t=this.tracker)||void 0===t?void 0:t.config.visual){r.next=2;break}return r.abrupt("return");case 2:"abp"!==e.dt||"pv"!==e.pr.$eid&&"click"!==e.pr.$eid?"evt"===e.dt&&this.vRQC&&this.send(Object.assign(Object.assign({},e),{eventType:"evt"})):(n=y.clone(e),i=!1,this.visualData.map((function(t){var r,o;if("click"===e.pr.$eid){var a=[],s=y.jsJSON(t.elementConditions)?JSON.parse(t.elementConditions):{};for(var c in s)a.push(s[c]===e.pr[c]);a.push(u.pagePathJudge(e,t)),-1===a.indexOf(!1)&&"click"===t.eventType&&(n.dt="evt",n.pr.$eid=t.eventName,i=!0,u.vRQC?u.send(Object.assign(Object.assign({},n),{visual:t})):null===(r=u.tracker)||void 0===r||r.send(n))}else"pv"===t.eventType&&u.pagePathJudge(e,t)&&(n.dt="evt",n.pr.$eid=t.eventName,i=!0,u.vRQC?u.send(Object.assign(Object.assign({},n),{visual:t})):null===(o=u.tracker)||void 0===o||o.send(n))})),this.vRQC&&!i&&(o="click"===e.pr.$eid?"click":"pv",this.send(Object.assign(Object.assign({},e),{eventType:o}))));case 3:case"end":return r.stop()}}),r,this)})))}}]),e}();function R(e,t,r){var n=r.value;return r.value=function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];if(this.pageReady&&this.loadReady)return n.apply(this,r);this.buffer.push({fnName:t,args:r})},r}var E=function(){function e(r,n,i){t(this,e),this.buffer=[],this.currentPage={queryObj:{},query:"",route:"",time:0,url:"",title:""},this.prevPage={queryObj:{},query:"",route:"",time:0,url:"",title:""},this.cn="",this.previousCountEvent={name:"",props:{}},this.count=0,this.countTimer=null,this.pageReady=!1,this.loadReady=!1,b=r,k=n,x=i,this.referrerDomain="miniprogram",this.appKey="",this.config={serverUrl:{normal:"https://u.zhugeapi.net",bac:"https://ubak.zhugeio.com"},socketUrl:"wss://u.zhugeapi.net/eventtracking/ws",debug:!1,pv:!1,click:!1,visual:!1,appName:"",timeout:18e5,requestTimeout:6e4,did:"",duration:!1,vn:"1.0",appId:"",sendLimit:1,superProperty:{},forwardShare:!1,beforeDuration:function(){},afterDuration:function(){},countDuration:3e3,parseScene:!0,utm:{},utmMode:"session",shareToUtm:{},exposure:!1},this.visual=new P(this)}return n(e,[{key:"load",value:function(e,t){return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.appKey=e,this.config=y.merge(this.config,t||{}),r.prev=2,r.next=5,k.get();case 5:if((n=r.sent)&&n.did){r.next=10;break}return r.next=9,k.getDid();case 9:n.did=r.sent;case 10:this.storage=new w(k,this,n),this.request=new _(b,this),this.loadReady=!0,this.updateSession("load"),this.freeBuffer(),r.next=20;break;case 17:r.prev=17,r.t0=r.catch(2),console.error("sdk初始化失败,缓存读取失败",r.t0);case 20:case"end":return r.stop()}}),r,this,[[2,17]])})))}},{key:"freeBuffer",value:function(){if(this.loadReady&&this.pageReady)for(;this.buffer.length;){var t=this.buffer.shift();if(t)(e.prototype[t.fnName]||this[t.fnName]).apply(this,t.args)}}},{key:"send",value:function(e){var t=this.storage.allData.utm;if(t)for(var r in t)t[r]&&(e.pr["$".concat(r)]=t[r]);return this.request.send(e)}},{key:"trackBaseData",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new Date,t.t0=e,t.t1=r.getTime(),t.t2=this.storage.allData.sid,t.t3=this.storage.allData.cuid,t.t4=this.cn,t.t5=y.getTimezone(r),t.t6=this.currentPage.url,t.t7=this.prevPage.url,t.t8=x.os(),t.t9=x.ov(),t.t10=x.version(),t.next=14,x.mnet();case 14:return t.t11=t.sent,t.next=17,x.net();case 17:return t.t12=t.sent,t.t13=this.config.vn,t.t14=this.referrerDomain,t.t15=this.config.appId,t.t16={$eid:t.t0,$ct:t.t1,$sid:t.t2,$cuid:t.t3,$cn:t.t4,$tz:t.t5,$url:t.t6,$ref:t.t7,$os:t.t8,$ov:t.t9,$wv:t.t10,$mnet:t.t11,$net:t.t12,$vn:t.t13,$referrer_domain:t.t14,$wxeid:t.t15,$page_url:""},(n={dt:"evt",pr:t.t16}).pr=y.merge(n.pr,y.encode(this.config.superProperty)),t.abrupt("return",n);case 25:case"end":return t.stop()}}),t,this)})))}},{key:"environmentInfo",value:function(){var e=new Date,t={dt:"pl",pr:{$rs:"".concat(x.windowWidth(),"x").concat(x.windowHeight()),$tz:y.getTimezone(e),$ct:e.getTime(),$cuid:this.storage.allData.cuid,$sid:this.storage.allData.sid,$dv:void 0,$br:void 0}};if(wx.getSystemInfoSync){var r=wx.getSystemInfoSync();t.pr.$dv=r.model,t.pr.$br=r.brand}else delete t.pr.$dv,delete t.pr.$br;this.send(t)}},{key:"sessionEnd",value:function(e){var t=new Date,r=e.update-e.sid,n={dt:"se",pr:{$ct:e.update,$cn:this.cn,$tz:y.getTimezone(t),$dru:r,$sid:e.sid,$cuid:e.cuid,$referrer_domain:this.referrerDomain}};this.send(n)}},{key:"sessionStart",value:function(){return v(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Date,r=this.storage.allData,n=r.sid,i=r.cuid,e.t0=n,e.t1=n,e.t2=i,e.t3=this.cn,e.t4=y.getTimezone(t),e.t5=this.currentPage.url,e.t6=this.prevPage.url,e.t7=x.os(),e.t8=x.ov(),e.t9=x.version(),e.next=14,x.mnet();case 14:return e.t10=e.sent,e.next=17,x.net();case 17:e.t11=e.sent,e.t12=this.config.vn,e.t13=this.referrerDomain,e.t14=this.config.appId,e.t15={$ct:e.t0,$sid:e.t1,$cuid:e.t2,$cn:e.t3,$tz:e.t4,$url:e.t5,$ref:e.t6,$os:e.t7,$ov:e.t8,$wv:e.t9,$mnet:e.t10,$net:e.t11,$vn:e.t12,$referrer_domain:e.t13,$wxeid:e.t14},o={dt:"ss",pr:e.t15},this.config.utm&&!y.isEmpty(this.config.utm)||!this.utmCatch||this.storage.set("utm",this.utmCatch),this.send(o),this.environmentInfo();case 26:case"end":return e.stop()}}),e,this)})))}},{key:"updateSession",value:function(e){var t=this.storage.allData,r=Date.now();if(t.sid&&t.update)if(r-t.update>this.config.timeout){var n=y.clone(t);this.storage.set("sid",r),this.storage.set("update",r),this.sessionEnd(n),this.sessionStart()}else this.storage.set("update",r);else this.storage.set("sid",r),this.storage.set("update",r),this.sessionStart()}},{key:"click",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r,n,i,o,u;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.config.click){t.next=2;break}return t.abrupt("return");case 2:return this.updateSession("click"),t.next=5,this.trackBaseData("click");case 5:for(o in r=t.sent,n={},i=["id","content","type","style","selector","link"],e.target.dataset)-1===i.indexOf(o)&&(n["_".concat(o)]=e.target.dataset[o]);return u=e.target,r.dt="abp",r.pr=y.merge(r.pr,{$page_url:this.currentPage.url,$page_title:this.currentPage.title},{$element_id:u.dataset.id||"",$element_content:u.dataset.content||"",$element_type:u.dataset.type||"",$element_style:u.dataset.style||"",$element_selector:u.dataset.selector||"",$element_link:u.dataset.link||""},n,""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),t.next=14,this.send(r);case 14:return t.next=16,this.visual.event(r);case 16:case"end":return t.stop()}}),t,this)})))}},{key:"pv",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.config.pv){t.next=2;break}return t.abrupt("return");case 2:return this.updateSession("pv"),t.next=5,this.trackBaseData("pv");case 5:return(r=t.sent).dt="abp",r.pr=y.merge(r.pr,{$page_url:this.currentPage.url.split("?")[0],$page_title:this.currentPage.title},e||{},""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),t.next=10,this.send(r);case 10:return t.next=12,this.visual.event(r);case 12:case"end":return t.stop()}}),t,this)})))}},{key:"duration",value:function(){return v(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.config.duration){e.next=2;break}return e.abrupt("return");case 2:return this.updateSession("duration"),y.isFunction(this.config.beforeDuration)&&this.config.beforeDuration(),t=this.currentPage.time-this.prevPage.time,e.next=7,this.trackBaseData("dr");case 7:return(r=e.sent).dt="abp",r.pr=y.merge(r.pr,{$dr:t,$url:this.prevPage.url,$title:this.prevPage.title}),e.next=12,this.send(r);case 12:y.isFunction(this.config.afterDuration)&&this.config.afterDuration();case 13:case"end":return e.stop()}}),e,this)})))}},{key:"track",value:function(e,t){return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.updateSession("track"),r.next=3,this.trackBaseData(e);case 3:return(n=r.sent).pr=y.merge(n.pr,y.encode(t),""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),r.next=7,this.send(n);case 7:return r.next=9,this.visual.event(n);case 9:case"end":return r.stop()}}),r,this)})))}},{key:"identify",value:function(e,t){return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n,i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.storage.set("cuid",e),this.updateSession("identify"),n=new Date,(i={dt:"usr",pr:{$ct:n.getTime(),$tz:y.getTimezone(n),$cuid:e,$sid:this.storage.allData.sid,$url:this.currentPage.url}}).pr=y.merge(i.pr,y.encode(t)),r.next=7,this.trackBaseData("usr");case 7:return r.next=9,this.send(i);case 9:case"end":return r.stop()}}),r,this)})))}},{key:"setPushClient",value:function(e,t){return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n,i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=new Date,i={dt:"um",pr:{$ct:n.getTime(),$tz:y.getTimezone(n),$push_ch:t||"getui",$push_id:e}},r.next=4,this.trackBaseData("usr");case 4:return r.next=6,this.send(i);case 6:case"end":return r.stop()}}),r,this)})))}},{key:"trackCount",value:function(e,t){var r=this;0===this.count&&(this.countStartTime=Date.now(),this.previousCountEvent.name=e,this.previousCountEvent.props=y.clone(t)),this.previousCountEvent.name===e&&y.isEqual(this.previousCountEvent.props,t)||(this.sendCountEvent(this.previousCountEvent.name,this.previousCountEvent.props,!1),this.previousCountEvent.name=e,this.previousCountEvent.props=y.clone(t),this.countStartTime=Date.now(),this.count=0),this.count+=1,this.countTimer&&clearTimeout(this.countTimer),this.countTimer=setTimeout((function(){r.sendCountEvent(e,t,!0)}),this.config.countDuration)}},{key:"sendCountEvent",value:function(e,t,r){return v(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i,o,u,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.updateSession("track count"),i=Date.now()-this.countStartTime,r&&(i-=this.config.countDuration),o=this.count,this.count=r?0:1,n.next=7,this.trackBaseData(e);case 7:return u=n.sent,a={},y.isObject(t)&&(a=y.clone(t)),u.pr=y.merge(u.pr,y.encode(a),y.encode({count:o,countTime:i})),n.next=13,this.send(u);case 13:case"end":return n.stop()}}),n,this)})))}},{key:"trackRevenue",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r,n,i,o,u,a,s,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=function(e,t){var r=0;try{e.toString().split(".")[1]&&(r+=e.toString().split(".")[1].length)}catch(e){console.error(e)}try{t.toString().split(".")[1]&&(r+=t.toString().split(".")[1].length)}catch(e){console.error(e)}return Number(e.toString().replace(".",""))*Number(t.toString().replace(".",""))/Math.pow(10,r)},this.updateSession("track revenue"),t.next=4,this.trackBaseData("revenue");case 4:(r=t.sent).dt="abp",(n=y.merge({price:0,total:0,productID:null,productQuantity:0,revenueType:null},e)).total=i(n.price,n.productQuantity),o=["productID","revenueType"],u=["price","total","productQuantity"],a={},t.t0=regeneratorRuntime.keys(n);case 12:if((t.t1=t.t0()).done){t.next=21;break}if(s=t.t1.value,-1!==o.indexOf(s)||-1!==u.indexOf(s)){t.next=16;break}return t.abrupt("continue",12);case 16:c=n[s],u.indexOf(s)>-1&&((c=Number(c))||(c=0)),a["$"+s]=c,t.next=12;break;case 21:return r.pr=y.merge(r.pr,a),t.next=24,this.send(r);case 24:case"end":return t.stop()}}),t,this)})))}},{key:"setUtm",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null!==(r=y.filterUtm(e))&&(this.storage.set("utm",r),this.updateSession("setUtm"));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"setSuperProperty",value:function(e){y.isObject(e)&&(this.config.superProperty=e)}},{key:"extendSuperPropertys",value:function(e){y.isObject(e)&&(this.config.superProperty=y.merge(this.config.superProperty,e))}},{key:"removeSuperProperty",value:function(e){var t,r=function(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=f(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return u=e.done,e},e:function(e){a=!0,o=e},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw o}}}}(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;delete this.config.superProperty[n]}}catch(e){r.e(e)}finally{r.f()}}},{key:"getSuperProperty",value:function(){return this.config.superProperty}},{key:"flush",value:function(){this.request.clear()}}]),e}();d([R],E.prototype,"environmentInfo",null),d([R],E.prototype,"sessionEnd",null),d([R],E.prototype,"sessionStart",null),d([R],E.prototype,"updateSession",null),d([R],E.prototype,"click",null),d([R],E.prototype,"pv",null),d([R],E.prototype,"duration",null),d([R],E.prototype,"track",null),d([R],E.prototype,"identify",null),d([R],E.prototype,"setPushClient",null),d([R],E.prototype,"trackCount",null),d([R],E.prototype,"trackRevenue",null),d([R],E.prototype,"setUtm",null);var $=["onLaunch","onShow","onHide","onError","onPageNotFound","onUnhandledRejection","onThemeChange","onShareAppMessage","onLogin"],C=["onLoad","onShow","onReady","onHide","onUnload","onShareAppMessage","onReachBottom","onPageScroll","onPullDownRefresh","onTabItemTap","onInit","onShareTimeline","onAddToFavorites","onResize","onTitleClick","onOptionMenuClick","onPullIntercept","onURLQueryChange"],D=function(e){return y.wxGetTitle(e)},j={did:null,getDid:function(){return new Promise((function(e,t){wx.getStorage({key:"zg-did",success:function(t){e(t.data||""),wx.removeStorage({key:"zg-did"})},fail:function(t){e("")}})}))},get:function(){return new Promise((function(e,t){wx.getStorage({key:"zg",success:function(t){e(t.data||{})},fail:function(t){e({})}})}))},set:function(e,t){return new Promise((function(r,n){wx.setStorage({key:e,data:t,success:r,fail:n})}))}},I=!1,L=wx.getSystemInfoSync(),A=L.system.split(/\s/),z={os:A[0],ov:A[1],version:L.version,windowHeight:L.windowHeight,windowWidth:L.windowWidth,net:0,mnet:0};function N(e){var t=e.toLowerCase();"wifi"===t?(z.net=1,z.mnet=0):(z.net=0,z.mnet={"2g":1,"3g":3,"4g":13}[t]||0)}function U(e){return new Promise((function(t,r){if(I)return t(z[e]);wx.getNetworkType({success:function(r){I=!0,N(r.networkType),t(z[e])}})}))}wx.onNetworkStatusChange((function(e){N(e.networkType)}));var q,M,F={os:function(){return z.os},ov:function(){return z.ov},version:function(){return z.version},net:function(){return U("net")},mnet:function(){return U("mnet")},windowWidth:function(){return z.windowWidth},windowHeight:function(){return z.windowHeight}},B=App,Q=Page,W=Component,H=["eid","ct","tz","cuid","cn","sid","url","os","ov","wv","mnet","referrer_domain","net","vn","wxeid","uid","share_id","share_title","share_level","title","path"];function G(e,t,r){if(e[r]&&y.isFunction(e[r])){var n=e[r];e[r]=function(){n.apply(this,arguments),t[r].apply(this,arguments)}}else e[r]=function(){t[r].apply(this,arguments)}}function J(e,t,r){var n=e[t];e[t]=function(){var e=arguments[0];if(q===e||e&&q&&q.timeStamp===e.timeStamp)return n.apply(this,arguments);if(q=e,e){var t=e.type;"tap"===t&&r.click(e)}return n.apply(this,arguments)}}var V=function(e){o(i,e);var r=c(i);function i(e){var n;return t(this,i),(n=r.call(this,T,j,F)).openData={path:"",props:{}},n.shared=!1,n.semiAutoTrackEventCatch={},n.isShareOperation=!1,M=e,n.initLifeCycleHook(),n}return n(i,[{key:"initLifeCycleHook",value:function(){var e,t=this,r=(e=t,{App:{onLaunch:function(t){e.config.visual&&e.visual.getVisualData()},onShow:function(t){e.sceneToUtm(t),e.openOptions=t,e.updateSession("appOnShow")},onHide:function(){e.flush(),e.config.duration&&!e.isShareOperation&&(e.pageReady=!0,e.currentPage.time=Date.now(),e.duration().then((function(){e.pageReady=!1,e.prevPage={queryObj:{},query:"",route:"",time:0,url:"",title:""}})))}},Page:{onLoad:function(t){(null==t?void 0:t.scene)&&-1!==decodeURIComponent(t.scene).indexOf("vRQC")&&e.config.visual&&(e.visual.vRQC=decodeURIComponent(t.scene).split("vRQC=")[1],e.visual.init()),e.currentPage.query=y.parseQuery(t),e.currentPage.queryObj=t},onShow:function(){var t=getCurrentPages(),r=t[t.length-1];e.currentPage.route=r.__route__||r.route,e.currentPage.time=Date.now(),e.currentPage.url="".concat(e.currentPage.route);var n=D;if(e.currentPage.title="function"==typeof n?n(r):"",e.currentPage.query&&(e.currentPage.url+="?".concat(e.currentPage.query)),e.pageReady=!0,e.freeBuffer(),e.currentPage.url!==e.prevPage.url){""!==e.prevPage.url&&e.duration();try{e.trackOpenShare(e.openOptions)}catch(t){console.warn(t,"".concat(e.referrerDomain," ","zhuge"," sdk trackOpenShare error"))}e.pv()}e.startObserveMarkElement(r),e.openOptions=null,e.isShareOperation=!1},onHide:function(){e.semiAutoTrackEventCatch={},e.prevPage=y.clone(e.currentPage),e.pageReady=!1,e.flush()},onUnload:function(){e.semiAutoTrackEventCatch={},e.prevPage=y.clone(e.currentPage),e.pageReady=!1,e.flush()}}});this.lifecycle=r;var n=function(e){for(var n in r.App)G(e,r.App,n);for(var i in e)!$.includes(i)&&y.isFunction(e[i])&&J(e,i,t);return B(e)};for(var i in App)n[i]=App[i];App=n;var o=function(e){for(var n in r.Page)G(e,r.Page,n);for(var i in e)!C.includes(i)&&y.isFunction(e[i])&&"onShareAppMessage"!==i&&J(e,i,t);var o=e.onShareAppMessage;return y.isFunction(o)&&(e.onShareAppMessage=t.onShareAppMessage(o)),Q(e)};for(var u in Page)o[u]=Page[u];Page=o,Component=function(e){if(void 0!==e.methods)for(var r in e.methods)J(e.methods,r,t);return W(e)},global&&global.mpvue&&(global.App=App,global.Page=Page,global.Component=Component),App.zhuge=t}},{key:"load",value:function(e,t){return m(u(i.prototype),"load",this).call(this,e,t)}},{key:"pv",value:function(e){var t=this,r=Object.create(null,{pv:{get:function(){return m(u(i.prototype),"pv",t)}}});return v(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={},n=y.getCurrentPage(),this.config.forwardShare&&this.openOptions&&(t.$share_open_type=1008===this.openOptions.scene?"群聊":"聊天",this.openOptions.query&&this.openOptions.query.zg_share_level&&(t.$share_level=Number(this.openOptions.query.zg_share_level)),n.data&&n.data.zg_share_data&&(t=y.merge(t,y.encode(n.data.zg_share_data)))),e.next=5,r.pv.call(this,t);case 5:case"end":return e.stop()}}),e,this)})))}},{key:"click",value:function(e){var t=this,r=Object.create(null,{click:{get:function(){return m(u(i.prototype),"click",t)}}});return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.click.call(this,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"sceneToUtm",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=y.getUtmByQuery(e.query);if(this.config.parseScene&&e.scene&&M){var r=e.scene;this.cn=r+"";var n=M[r],i={},o=null,u=M.isShare(r);if(u&&e.referrerInfo&&(o=e.referrerInfo.appId),n){i={utm_source:n.utm_source,utm_medium:n.utm_medium,utm_campaign:o};var a=e.query||{};M.isCartShare(r)&&a.zg_uid&&a.zg_share_id&&(i.utm_term=a.zg_uid,i.utm_content=a.zg_share_id)}t=y.merge(i,t)}this.utmCatch=t,"fresh"===this.config.utmMode&&y.isEmpty(this.config.utm)&&this.storage.set("utm",t)}},{key:"trackOpenShare",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r,n,i,o,u,a,s,c,m,l,h;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e&&this.config.forwardShare){t.next=2;break}return t.abrupt("return");case 2:if(!this.shared){t.next=5;break}return this.shared=!1,t.abrupt("return");case 5:if(r=e.query||{},n=this.currentPage.route,!(M.isCartShare(e.scene)&&r.zg_uid&&r.zg_share_id)){t.next=24;break}for(u in i={$uid:r.zg_uid,$share_id:r.zg_share_id,$title:this.currentPage.title,$path:n,$share_open_type:1008===e.scene?"群聊":"聊天",$share_level:Number(r.zg_share_level)},this.shareId=r.zg_share_id,this.shareLevel=Number(r.zg_share_level),o={},r)a=u.replace(/^zg_/,""),-1===H.indexOf(a)&&/^zg_/.test(u)&&(o[a]=r[u]);if(s=this.config.shareToUtm,y.isObject(s)&&!y.isEmpty(s)){for(m in c={},s)null!==o[m]&&void 0!==o[m]&&(l=s[m],c[l]=o[m]);y.isEmpty(c)||(c.utm_campaign||(c.utm_campaign="分享打开"),this.setUtm(c))}return this.openData={path:n,props:o},i=y.merge(i,y.encode(o)),t.next=19,this.trackBaseData("wxsopen");case 19:return(h=t.sent).dt="abp",h.pr=y.merge(h.pr,i),t.next=24,this.send(h);case 24:case"end":return t.stop()}}),t,this)})))}},{key:"onShareAppMessage",value:function(e){var t=this;return function(){t.isShareOperation=!0;var r=e.apply(this,arguments)||{};if(!t.config.forwardShare)return r;r.path=r.path||t.currentPage.url;var n=r.title||t.currentPage.title,i=r.path.split("?")[0],o=this.data.zg_share_data,u=(new Date).getTime(),a=1;!this.data.newShare&&t.openData&&t.openData.path===i&&y.isEqual(o||{},t.openData.props)&&(u=t.shareId,a=t.shareLevel+1);var s={share_id:u,uid:t.storage.allData.cuid||t.storage.allData.did,share_level:a},c={$share_title:n,$title:t.currentPage.title||"",$path:i},m={};for(var l in s)c["$".concat(l)]=m["zg_".concat(l)]=s[l];for(var h in o)-1===H.indexOf(h)&&(c["_".concat(h)]=m["zg_".concat(h)]=o[h]);return r.path=y.addUrlParam(r.path,m),t.trackBaseData("wxshare").then((function(e){e.dt="abp",e.pr=y.merge(e.pr,c),t.request.send(e)})),t.shared=!0,r}}},{key:"startObserveMarkElement",value:function(e){var t=this;this.config.exposure&&(this.elementObserver&&this.elementObserver.disconnect(),e.isComponent?this.elementObserver=e.createIntersectionObserver({observeAll:!0}):this.elementObserver=wx.createIntersectionObserver(e,{observeAll:!0}),this.elementObserver.relativeToViewport().observe(".zhuge-expo-track",(function(e){if(e.intersectionRatio>0){var r,n=t.getEventDataFromDataset(e.dataset);(r=m(u(i.prototype),"track",t)).call.apply(r,[t].concat(h(n)))}})))}},{key:"getEventDataFromDataset",value:function(e){var t={},r="";for(var n in e){if(n.startsWith("expo"))if("expoName"===n)r=e[n];else t[n.replace(/^expo(.*)/,(function(e,t,r,n){return t.replace(t[0],t[0].toLocaleLowerCase())}))]=e[n]}return[r,t]}}]),i}(E);d([R],V.prototype,"sceneToUtm",null),d([R],V.prototype,"trackOpenShare",null);var K={1e3:{utm_source:"其他",utm_medium:"其他"},1001:{utm_source:"微信主程序",utm_medium:"发现栏小程序主入口"},1005:{utm_source:"搜索",utm_medium:"顶部搜索框的搜索结果页"},1006:{utm_source:"搜索",utm_medium:"发现栏小程序主入口搜索框的搜索结果页"},1007:{utm_source:"分享",utm_medium:"单人聊天会话中的小程序消息卡片"},1008:{utm_source:"分享",utm_medium:"群聊会话中的小程序消息卡片"},1010:{utm_source:"收藏",utm_medium:"收藏夹"},1011:{utm_source:"扫码",utm_medium:"扫描二维码"},1012:{utm_source:"扫码",utm_medium:"长按图片识别二维码"},1013:{utm_source:"扫码",utm_medium:"手机相册选取二维码"},1014:{utm_source:"小程序模板消息",utm_medium:"小程序模板消息"},1017:{utm_source:"体验版",utm_medium:"前往体验版的入口页"},1019:{utm_source:"微信支付",utm_medium:"微信钱包"},1023:{utm_source:"桌面图标",utm_medium:"安卓系统桌面图标"},1024:{utm_source:"微信主程序",utm_medium:"小程序 profile 页"},1025:{utm_source:"扫码",utm_medium:"扫描一维码"},1026:{utm_source:"微信主程序",utm_medium:"附近小程序列表"},1027:{utm_source:"搜索",utm_medium:"顶部搜索框搜索结果页“使用过的小程序”列表"},1028:{utm_source:"微信卡券",utm_medium:"我的卡包"},1029:{utm_source:"微信卡券",utm_medium:"卡券详情页"},1030:{utm_source:"测试",utm_medium:"自动化测试下打开小程序"},1031:{utm_source:"扫码",utm_medium:"长按图片识别一维码"},1032:{utm_source:"扫码",utm_medium:"手机相册选取一维码"},1034:{utm_source:"微信支付",utm_medium:"微信支付完成页"},1035:{utm_source:"公众号",utm_medium:"公众号自定义菜单"},1036:{utm_source:"分享",utm_medium:"App分享消息卡片"},1037:{utm_source:"小程序",utm_medium:"小程序打开小程序"},1038:{utm_source:"小程序",utm_medium:"从另一个小程序返回"},1039:{utm_source:"摇电视",utm_medium:"摇电视"},1042:{utm_source:"搜索",utm_medium:"添加好友搜索框的搜索结果页"},1043:{utm_source:"公众号",utm_medium:"公众号模板消息"},1044:{utm_source:"分享",utm_medium:"带shareTicket的小程序消息卡片(详情)"},1045:{utm_source:"广告",utm_medium:"朋友圈广告"},1046:{utm_source:"广告",utm_medium:"朋友圈广告详情页"},1047:{utm_source:"扫码",utm_medium:"扫描小程序码"},1048:{utm_source:"扫码",utm_medium:"长按图片识别小程序码"},1049:{utm_source:"扫码",utm_medium:"手机相册选取小程序码"},1052:{utm_source:"微信卡券",utm_medium:"卡券的适用门店列表"},1053:{utm_source:"搜索",utm_medium:"搜一搜的结果页"},1056:{utm_source:"音乐播放器菜单",utm_medium:"音乐播放器菜单"},1057:{utm_source:"微信支付",utm_medium:"钱包中的银行卡详情页"},1058:{utm_source:"公众号",utm_medium:"公众号文章"},1059:{utm_source:"体验版",utm_medium:"体验版小程序绑定邀请页"},1060:{utm_source:"支付完成",utm_medium:"微信支付完成页"},1064:{utm_source:"微信WIFI",utm_medium:"微信连Wi-Fi状态栏"},1065:{utm_source:"scheme 详情",utm_medium:"URL scheme 详情"},1067:{utm_source:"广告",utm_medium:"公众号文章广告"},1069:{utm_source:"移动应用",utm_medium:"移动应用"},1071:{utm_source:"微信支付",utm_medium:"钱包中的银行卡列表页"},1072:{utm_source:"微信支付",utm_medium:"二维码收款页面"},1073:{utm_source:"客服消息",utm_medium:"客服消息列表下发的小程序消息卡片"},1074:{utm_source:"公众号会话",utm_medium:"公众号会话下发的小程序消息卡片"},1077:{utm_source:"摇周边",utm_medium:"摇周边"},1078:{utm_source:"微信WIFI",utm_medium:"连Wi-Fi成功页"},1079:{utm_source:"微信游戏中心",utm_medium:"微信游戏中心"},1081:{utm_source:"客服消息",utm_medium:"客服消息下发的文字链"},1082:{utm_source:"公众号",utm_medium:"公众号会话下发的文字链"},1084:{utm_source:"广告",utm_medium:"朋友圈广告原生页"},1088:{utm_source:"打开小程序",utm_medium:"会话中查看系统消息,打开小程序"},1089:{utm_source:"微信主程序",utm_medium:"微信聊天主界面下拉"},1090:{utm_source:"小程序",utm_medium:"长按小程序右上角菜单唤出最近使用历史"},1091:{utm_source:"公众号",utm_medium:"公众号文章商品卡片"},1092:{utm_source:"微信城市服务",utm_medium:"城市服务入口"},1095:{utm_source:"广告",utm_medium:"小程序广告组件"},1096:{utm_source:"分享",utm_medium:"聊天记录"},1097:{utm_source:"微信支付",utm_medium:"微信支付签约页"},1099:{utm_source:"小程序",utm_medium:"页面内嵌插件"},1100:{utm_source:"打开小程序",utm_medium:"红包封面详情页打开小程序"},1101:{utm_source:"调试",utm_medium:"远程调试热更新(开发者工具中,预览 -> 自动预览 -> 编译并预览)"},1102:{utm_source:"公众号",utm_medium:"公众号profile页服务预览"},1106:{utm_source:"打开小程序",utm_medium:"聊天主界面下拉,从顶部搜索结果页,打开小程序"},1107:{utm_source:"打开小程序",utm_medium:"订阅消息,打开小程序"},1113:{utm_source:"打开小程序",utm_medium:"安卓手机负一屏,打开小程序(三星)"},1114:{utm_source:"打开小程序",utm_medium:"安卓手机侧边栏,打开小程序(三星)"},1119:{utm_source:"打开小程序",utm_medium:"【企业微信】工作台内打开小程序"},1120:{utm_source:"打开小程序",utm_medium:"【企业微信】个人资料页内打开小程序"},1121:{utm_source:"打开小程序",utm_medium:"【企业微信】聊天加号附件框内打开小程序"},1124:{utm_source:"打开小程序",utm_medium:"扫“一物一码”打开小程序"},1125:{utm_source:"图片识别",utm_medium:"长按图片识别“一物一码”"},1126:{utm_source:"扫描手机相册",utm_medium:"扫描手机相册中选取的“一物一码”"},1129:{utm_source:"爬虫",utm_medium:"微信爬虫"},1131:{utm_source:"浮窗",utm_medium:"浮窗"},1133:{utm_source:"打开小程序详情",utm_medium:"硬件设备打开小程序详情"},1135:{utm_source:"打开小程序",utm_medium:"小程序 profile 页相关小程序列表,打开小程序"},1144:{utm_source:"视频贴片",utm_medium:"公众号文章 - 视频贴片"},1145:{utm_source:"发现小程序",utm_medium:"发现栏 - 发现小程序"},1146:{utm_source:"打开出行类小程序",utm_medium:"地理位置信息打开出行类小程序"},1148:{utm_source:"打开小程序",utm_medium:"卡包 - 交通卡,打开小程序"},1150:{utm_source:"扫一扫",utm_medium:"扫一扫商品条码结果页打开小程序"},1151:{utm_source:"我的订单",utm_medium:"发现栏 - 我的订单"},1152:{utm_source:"打开小程序",utm_medium:"订阅号视频打开小程序"},1153:{utm_source:"打开小程序",utm_medium:"“识物”结果页打开小程序"},1154:{utm_source:"打开“单页模式”",utm_medium:"朋友圈内打开“单页模式”"},1155:{utm_source:"打开小程序",utm_medium:"“单页模式”打开小程序"},1157:{utm_source:"打开小程序",utm_medium:"服务号会话页打开小程序"},1158:{utm_source:"打开小程序",utm_medium:"群工具打开小程序"},1160:{utm_source:"群待办",utm_medium:"群待办"},1167:{utm_source:"打开小程序详情",utm_medium:"H5 通过开放标签打开小程序详情"},1168:{utm_source:"运行小程序",utm_medium:"移动应用直接运行小程序"},1169:{utm_source:"小程序入口",utm_medium:"发现栏小程序主入口,各个生活服务入口"},1171:{utm_source:"微信运动记录",utm_medium:"微信运动记录"},1173:{utm_source:"打开小程序详情",utm_medium:"聊天素材用小程序打开详情"},1175:{utm_source:"商店入口",utm_medium:"视频号主页商店入口"},1176:{utm_source:"打开小程序",utm_medium:"视频号直播间主播打开小程序"},1177:{utm_source:"直播商品",utm_medium:"视频号直播商品"},1178:{utm_source:"打开小程序",utm_medium:"在电脑打开手机上打开的小程序"},1179:{utm_source:"打开小程序",utm_medium:"#话题页打开小程序"},1181:{utm_source:"打开 PC 小程序",utm_medium:"网站应用打开 PC 小程序"},1183:{utm_source:"搜索",utm_medium:"PC微信 - 小程序面板 - 发现小程序 - 搜索"},1184:{utm_source:"打开小程序",utm_medium:"视频号链接打开小程序"},1185:{utm_source:"群公告",utm_medium:"群公告"},1186:{utm_source:"收藏",utm_medium:"收藏 - 笔记"},1187:{utm_source:"浮窗",utm_medium:"浮窗"},1189:{utm_source:"表情雨广告",utm_medium:"表情雨广告"},1191:{utm_source:"视频号活动",utm_medium:"视频号活动"},1192:{utm_source:"企业微信联系人 profile 页",utm_medium:"企业微信联系人 profile 页"},1193:{utm_source:"打开小程序",utm_medium:"视频号主页服务菜单打开小程序"},1194:{utm_source:"URL Link 详情",utm_medium:"URL Link 详情"},1195:{utm_source:"主页商品tab",utm_medium:"视频号主页商品tab"},1196:{utm_source:"打开小程序",utm_medium:"个人状态打开小程序"},1197:{utm_source:"返回小游戏",utm_medium:"视频号主播从直播间返回小游戏"},1198:{utm_source:"打开小游戏",utm_medium:"视频号开播界面打开小游戏"},1201:{utm_source:"打开小程序",utm_medium:"视频号广告详情页打开小程序"},1202:{utm_source:"打开小程序卡片",utm_medium:"企微客服号会话打开小程序卡片"},1203:{utm_source:"压测工具的请求",utm_medium:"微信小程序压测工具的请求"},1206:{utm_source:"打开小游戏",utm_medium:"视频号小游戏直播间打开小游戏"},1207:{utm_source:"打开小程序文字链",utm_medium:"企微客服号会话打开小程序文字链"},1208:{utm_source:"打开商品卡片",utm_medium:"聊天打开商品卡片"},1212:{utm_source:"打开小程序",utm_medium:"青少年模式申请页打开小程序"},1215:{utm_source:"打开小程序",utm_medium:"广告预约打开小程序"},1216:{utm_source:"打开小程序",utm_medium:"视频号订单中心打开小程序"},isShare:function(e){return[1096].includes(e)},isCartShare:function(e){return[1007,1008,1036,1044].includes(e)}},Y=new(function(e){o(i,e);var r=c(i);function i(){return t(this,i),r.call(this,K)}return n(i,[{key:"load",value:function(e,t){var r=t||{};if(wx.getAccountInfoSync){var n=wx.getAccountInfoSync();n&&n.miniProgram&&n.miniProgram.appId&&(r.appId=n.miniProgram.appId)}return m(u(i.prototype),"load",this).call(this,e,r)}}]),i}(V));return App.zhuge=Y,Y}));
|
|
16
|
+
function d(e,t,r,n){var i,o=arguments.length,u=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(u=(o<3?i(u):o>3?i(t,r,u):i(t,r))||u);return o>3&&u&&Object.defineProperty(t,r,u),u}function v(e,t,r,n){return new(r||(r=Promise))((function(i,o){function u(e){try{s(n.next(e))}catch(e){o(e)}}function a(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(u,a)}s((n=n.apply(e,t||[])).next())}))}var g,y={utmKeys:["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],isValid:function(e){return null==e},type:function(e){return Object.prototype.toString.call(e)},isObject:function(e){return"[object Object]"===this.type(e)},isArray:function(e){return"[object Array]"===this.type(e)},isString:function(e){return"[object String]"===this.type(e)},isNumber:function(e){return"[object Number]"===this.type(e)},isDate:function(e){return"[object Date]"===this.type(e)},isFunction:function(e){return"[object Function]"===this.type(e)},jsJSON:function(e){try{return JSON.parse(e),!0}catch(e){return!1}},isEmpty:function(e){return Array.isArray(e)||"string"==typeof e||e instanceof String?0===e.length:e instanceof Map||e instanceof Set?0===e.size:"[object Object]"===Object.prototype.toString.call(e)&&0===Object.keys(e).length},merge:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.reduce((function(t,r){return Object.keys(r).forEach((function(n){Array.isArray(t[n])&&Array.isArray(r[n])?t[n]=Array.from(new Set(t[n].concat(r[n]))):e.isObject(t[n])&&e.isObject(r[n])?t[n]=e.merge(t[n],r[n]):t[n]=r[n]})),t}),{})},UUID:function(){var e=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},clone:function(t){var r=function(e){var t=e.constructor;switch(n(e)){case"Boolean":case"Number":case"String":case"Error":case"Date":return new t(e);case"RegExp":return o(e);case"Symbol":return i(e);case"Function":return e;default:return null}},n=function(e){return Object.prototype.toString.call(e).slice(8,-1)},i=function(e){return Object(Symbol.prototype.valueOf.call(e))},o=function(e){var t=new e.constructor(e.source,/\w*$/.exec(e));return t.lastIndex=e.lastIndex,t},u=function(e,t){for(var r=-1,n=e.length;++r<n;)t(e[r],r);return e},a=function t(i){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if("object"!==e(i)||null===i)return i;var a=n(i),s=null;return o.get(i)?o.get(i):(o.set(i,s),"Set"!==a&&"Map"!==a&&"Array"!==a&&"Object"!==a?r(i):"Set"===a?(s=new Set,i.forEach((function(e){s.add(t(e,o))})),s):"Map"===a?(s=new Map,i.forEach((function(e,r){s.set(r,t(e,o))})),s):("Array"===a&&(s=new Array,u(i,(function(e,r){s[r]=t(e,o)}))),"Object"===a&&(s=new Object,u(Object.keys(i),(function(e){s[e]=t(i[e],o)}))),s))};return a(t)},parseQuery:function(e){if(this.isEmpty(e))return"";var t=[];for(var r in e)t.push("".concat(r,"=").concat(decodeURIComponent(e[r])));return t.join("&")},getTimezone:function(e){return 6e4*-e.getTimezoneOffset()},encode:function(e){var t={};for(var r in e)t["_"+r]=e[r];return t},isEqual:function(e,t){if(this.type(e)!==this.type(t))return!1;var r=!0;for(var n in e)e[n]!==t[n]&&(r=!1);return r},getUtmByQuery:function(e){var t={};for(var r in e)this.utmKeys.includes(r)&&(t[r]=e[r]);return t},filterUtm:function(e){var t=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],r=!1,n={};for(var i in e)t.indexOf(i)>-1&&(r=!0,n[i]=e[i]);return r?n:null},deleteQueryParams:function(e,t){var r=e.split("&"),n=[];return r.forEach((function(e){var r=new RegExp(t+"=.*"),i="";r.test(e)?(i=e.replace(r,""))&&n.push(i):n.push(e)})),n.join("&")},addUrlParam:function(e,t){var r=e,n="";for(var i in t)n&&(n+="&"),r=this.deleteQueryParams(r,i),n+=i+"="+t[i];var o=r.split("?");return o.length>1?o[1]?o[1]=n+"&"+o[1]:o[1]=n:1===o.length&&o.push(n),o.join("?")},getCurrentPage:function(){var e=getCurrentPages();return e[e.length-1]},wxGetTitle:function(e){var t,r,n,i="";e.data&&e.data.title&&e.data.title.length>0&&(i=Array.isArray(e.data.title)?e.data.title.join(" "):e.data.title);try{if(!i.length&&__wxConfig&&(__wxConfig.tabBar&&__wxConfig.tabBar.list.forEach((function(t){t.pagePath==="".concat(e.route,".html")&&t.text&&(i=t.text)})),!i.length)){var o=__wxConfig.page[e.route]||__wxConfig.page["".concat(e.route,".html")];i=o?null===(t=o.window)||void 0===t?void 0:t.navigationBarTitleText:null===(n=null===(r=null===__wxConfig||void 0===__wxConfig?void 0:__wxConfig.global)||void 0===r?void 0:r.window)||void 0===n?void 0:n.navigationBarTitleText}}catch(e){}return i||e.route}},_=function(){function e(r,n){t(this,e),this.timeout=500,this.catch=[],this.fastTouch=[],this.clearFastTouchTimer=null,this.clearCatchTimer=null,this.tracker=n,this.url="".concat(n.config.serverUrl.normal,"/apipool"),this.timeout=n.config.timeout||this.timeout,this.requestTimeout=n.config.requestTimeout,this.debug=n.config.debug?1:0,this.appKey=n.appKey,this.did=n.storage.allData.did,this.sendLimit=n.config.sendLimit,this.requestFunction=r}return n(e,[{key:"generateRequestData",value:function(){var e=new Date,t={method:"web_event_sr.upload",event:JSON.stringify({sln:"itn",pl:"js",sdk:"sys",sdkv:"2.0.17",owner:"zg",ut:"".concat(e.getFullYear(),"-").concat(e.getMonth()+1,"-").concat(e.getDate()," ").concat(e.getHours(),":").concat(e.getMinutes(),":").concat(e.getSeconds()),tz:y.getTimezone(e),debug:this.debug?1:0,ak:this.appKey,usr:{did:this.did},data:h(this.catch)}),_:e.getTime()+""};return this.catch=[],t}},{key:"clear",value:function(){if(this.catch.length){var e=this.generateRequestData();this.requestFunction(this.url,e,{timeout:this.requestTimeout})}}},{key:"send",value:function(e){var t=this;if(this.catch.push(e),this.clearCatchTimer&&clearTimeout(this.clearCatchTimer),this.clearCatchTimer=setTimeout((function(){t.clear()}),3e4),!(this.catch.length<this.sendLimit)){this.clearCatchTimer&&clearTimeout(this.clearCatchTimer);var r=this.generateRequestData();return new Promise((function(e,n){var i,o=!1;i=setTimeout((function(){o=!0,e(null)}),t.timeout),t.requestFunction(t.url,r,{timeout:t.requestTimeout}).then((function(t){o||(clearTimeout(i),e(t))})).catch((function(e){n(e)}))}))}}}]),e}(),w=function(){function e(r,n,i){t(this,e),this.storageFunction=r,this.allData=i||{},this.allData.did||this.set("did",n.config.did||y.UUID()),this.allData.cuid||this.set("cuid",void 0),y.isEmpty(n.config.utm)||this.set("utm",n.config.utm)}return n(e,[{key:"get",value:function(e){return this.allData[e]}},{key:"set",value:function(e,t){return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.allData[e]=t,r.next=3,this.storageFunction.set("zg",this.allData);case 3:case"end":return r.stop()}}),r,this)})))}}]),e}();!function(e){var t,r,n,i,o,u;(t=e.EventType||(e.EventType={})).connected="connected",t.disconnected="disconnected",t.error="error",t.offline="offline",t.exist="exist",t.online="online",(r=e.RequestType||(e.RequestType={}))[r.common=0]="common",r[r.ping=1]="ping",r[r.pong=2]="pong",r[r.normal=5]="normal",r[r.img=6]="img",(n=e.ResponseCode||(e.ResponseCode={}))[n.offline=109001]="offline",n[n.exist=109002]="exist",n[n.paramError=109005]="paramError",n[n.online=109006]="online",(i=e.SocketMsgOrigin||(e.SocketMsgOrigin={}))[i.xcx=1]="xcx",i[i.app=2]="app",i[i.web=3]="web",(o=e.VisualEndpointType||(e.VisualEndpointType={}))[o.xcx=1]="xcx",(u=e.SocketMessageType||(e.SocketMessageType={})).update="update",u.xcxLogin="xcxLogin",u.eventInfo="eventInfo"}(g||(g={}));var k,b,x,S=g,O=function(){function e(r,n){t(this,e),this.listeners={},this.catch=[],this.showLog=!1,this.url=r,this.params=n,this.open()}return n(e,[{key:"emit",value:function(e,t){var r;if(this.log("info","emit message",[e,t]),!this.client)return this.log("info","缓存消息",[e,t]),void this.catch.push([e,t]);switch(null===(r=this.client)||void 0===r?void 0:r.readyState){case WebSocket.CLOSED:case WebSocket.CLOSING:break;case WebSocket.CONNECTING:this.log("info","缓存消息",[e,t]),this.catch.push([e,t])}}},{key:"on",value:function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}},{key:"onConnected",value:function(e){this.on(S.EventType.connected,e)}},{key:"onDisconnected",value:function(e){this.on(S.EventType.disconnected,e)}},{key:"onError",value:function(e){this.on(S.EventType.error,e)}},{key:"send",value:function(e){var t;null===(t=this.client)||void 0===t||t.send({data:JSON.stringify(e)})}},{key:"_onError",value:function(e){var t;this.log("error","socket连接异常",e),null===(t=this.listeners.error)||void 0===t||t.forEach((function(t){t.call(void 0,e)}))}},{key:"_onClose",value:function(e){var t;this.log("error","socket连接已关闭"),null===(t=this.listeners.disconnected)||void 0===t||t.forEach((function(e){e.call(void 0)})),clearInterval(this.pingTimer)}},{key:"_onOpen",value:function(e){var t,r=this;this.log("info","socket连接成功",e),null===(t=this.listeners.connected)||void 0===t||t.forEach((function(e){e.call(void 0)})),this.log("info","clear catch",this.catch),this.catch.forEach((function(e){var t=l(e,2),n=t[0],i=t[1];r.emit(n,i)})),this.catch=[],this.ping()}},{key:"onMessage",value:function(e){var t,r,n;if(""!==e.data){var i=JSON.parse(e.data);if(i.code)switch(Number(i.code)){case S.ResponseCode.offline:null===(t=this.listeners[S.EventType.offline])||void 0===t||t.forEach((function(e){e.call(void 0,i)}));break;case S.ResponseCode.online:null===(r=this.listeners[S.EventType.online])||void 0===r||r.forEach((function(e){e.call(void 0,i)}));break;case S.ResponseCode.exist:null===(n=this.listeners[S.EventType.exist])||void 0===n||n.forEach((function(e){e.call(void 0,i)}));break;case S.ResponseCode.paramError:this._onError(new Error("参数缺失或错误"))}else{if(i.type===S.RequestType.pong)return;var o=i.data;this.listeners[o.event]&&this.listeners[o.event].forEach((function(e){e.call(void 0,o.payload)}))}}}},{key:"ping",value:function(){var e=this;this.pingTimer=setInterval((function(){e.send({type:S.RequestType.ping})}),3e3)}},{key:"removeAllListeners",value:function(){this.listeners={}}},{key:"removeListener",value:function(e,t){var r=this;t?this.listeners[e].forEach((function(n,i){n===t&&r.listeners[e].splice(i,1)})):this.listeners[e]=[]}},{key:"open",value:function(){var e,t,r=this;this.client&&this.close();var n=wx.connectSocket({url:"".concat(this.url,"?socketToken=").concat(null===(e=this.params)||void 0===e?void 0:e.socketToken,"&appId=").concat(null===(t=this.params)||void 0===t?void 0:t.appId,"&origin=").concat(S.SocketMsgOrigin.xcx)});n.onMessage((function(e){r.onMessage(e)})),n.onError((function(e){r._onError(e)})),n.onClose((function(e){r._onClose(e)})),n.onOpen((function(e){r._onOpen(e)})),this.client=n}},{key:"close",value:function(){var e;null===(e=this.client)||void 0===e||e.close(),this.log("info","关闭socket连接")}},{key:"destroy",value:function(){this.removeAllListeners(),this.close(),this.client=void 0}},{key:"log",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this.showLog&&(t=console).log.apply(t,["%c【socketClient】:".concat(e),"color: ".concat("error"===e?"red":"#1890ff")].concat(n))}},{key:"openLog",value:function(e){this.showLog=e}}]),e}(),T=function(e,t,r){return new Promise((function(n,o){var u;wx.request((i(u={url:e,data:t,method:(null==r?void 0:r.method)||"POST",timeout:null==r?void 0:r.timeout},"header",{"content-type":(null==r?void 0:r.contentType)||"application/x-www-form-urlencoded"}),i(u,"dataType","json"),i(u,"responseType",null!=(null==r?void 0:r.responseType)?null==r?void 0:r.responseType:"arraybuffer"),i(u,"success",(function(e){n(e)})),i(u,"fail",(function(e){o(e)})),u))}))},P=function(){function e(r){t(this,e),this.pagePathJudge=function(e,t){return-1!==t.pagePath.indexOf("*")?-1!==e.pr.$page_url.indexOf(t.pagePath.split("*")[0]):t.pagePath===e.pr.$page_url.split("?")[0]},this.tracker=r,this.vRQC="",this.visualData=[],this.socketUserInfo=null,this.socketState=!1}return n(e,[{key:"init",value:function(){var e=this;this.socket&&this.socket.destroy(),this.socket=new O(this.tracker.config.socketUrl,{socketToken:this.vRQC.split("*")[0],appId:this.vRQC.split("*")[1]}),this.socket.on("update",(function(){e.getVisualData()})),this.socket.on("connected",(function(){null===e.socketUserInfo?wx.getSystemInfo({success:function(t){var r=t.model,n=t.system,i=t.version;wx.getUserInfo({success:function(t){var o=t.userInfo.nickName,u=t.userInfo.avatarUrl,a={model:r,system:n,version:i,nickName:o,avatarUrl:u,programId:e.tracker.config.appId};e.socketUserInfo=a,e.sendUserInfo(a)}})}}):e.sendUserInfo(e.socketUserInfo)}))}},{key:"getVisualData",value:function(){var e=this;T("".concat(this.tracker.config.serverUrl.normal,"/zg/web/v2/tracking/view/miniProgram/event/list"),{endpointType:S.VisualEndpointType.xcx,endpointIdentity:this.tracker.config.appId},{contentType:"application/json",responseType:""}).then((function(t){t.data&&t.data.data&&(e.visualData=t.data.data)}))}},{key:"sendUserInfo",value:function(e){var t;this.socketState=!0,null===(t=this.socket)||void 0===t||t.send({type:S.RequestType.normal,data:{event:S.SocketMessageType.xcxLogin,payload:{userInfo:e}}})}},{key:"send",value:function(e){var t;this.socketState&&(null===(t=this.socket)||void 0===t||t.send({type:S.RequestType.normal,data:{event:S.SocketMessageType.eventInfo,payload:e}}))}},{key:"event",value:function(e){var t;return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n,i,o,u=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(null===(t=this.tracker)||void 0===t?void 0:t.config.visual){r.next=2;break}return r.abrupt("return");case 2:"abp"!==e.dt||"pv"!==e.pr.$eid&&"click"!==e.pr.$eid?"evt"===e.dt&&this.vRQC&&this.send(Object.assign(Object.assign({},e),{eventType:"evt"})):(n=y.clone(e),i=!1,this.visualData.map((function(t){var r,o;if("click"===e.pr.$eid){var a=[],s=y.jsJSON(t.elementConditions)?JSON.parse(t.elementConditions):{};for(var c in s)a.push(s[c]===e.pr[c]);a.push(u.pagePathJudge(e,t)),-1===a.indexOf(!1)&&"click"===t.eventType&&(n.dt="evt",n.pr.$eid=t.eventName,i=!0,u.vRQC?u.send(Object.assign(Object.assign({},n),{visual:t})):null===(r=u.tracker)||void 0===r||r.send(n))}else"pv"===t.eventType&&u.pagePathJudge(e,t)&&(n.dt="evt",n.pr.$eid=t.eventName,i=!0,u.vRQC?u.send(Object.assign(Object.assign({},n),{visual:t})):null===(o=u.tracker)||void 0===o||o.send(n))})),this.vRQC&&!i&&(o="click"===e.pr.$eid?"click":"pv",this.send(Object.assign(Object.assign({},e),{eventType:o}))));case 3:case"end":return r.stop()}}),r,this)})))}}]),e}();function R(e,t,r){var n=r.value;return r.value=function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];if(this.pageReady&&this.loadReady)return n.apply(this,r);this.buffer.push({fnName:t,args:r})},r}var E=function(){function e(r,n,i){t(this,e),this.buffer=[],this.currentPage={queryObj:{},query:"",route:"",time:0,url:"",title:""},this.prevPage={queryObj:{},query:"",route:"",time:0,url:"",title:""},this.cn="",this.previousCountEvent={name:"",props:{}},this.count=0,this.countTimer=null,this.pageReady=!1,this.loadReady=!1,b=r,k=n,x=i,this.referrerDomain="miniprogram",this.appKey="",this.config={serverUrl:{normal:"https://u.zhugeapi.net",bac:"https://ubak.zhugeio.com"},socketUrl:"wss://u.zhugeapi.net/eventtracking/ws",debug:!1,pv:!1,click:!1,visual:!1,appName:"",timeout:18e5,requestTimeout:6e4,did:"",duration:!1,vn:"1.0",appId:"",sendLimit:1,superProperty:{},forwardShare:!1,beforeDuration:function(){},afterDuration:function(){},countDuration:3e3,parseScene:!0,utm:{},utmMode:"session",shareToUtm:{},exposure:!1},this.visual=new P(this)}return n(e,[{key:"load",value:function(e,t){return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.appKey=e,this.config=y.merge(this.config,t||{}),r.prev=2,r.next=5,k.get();case 5:if((n=r.sent)&&n.did){r.next=10;break}return r.next=9,k.getDid();case 9:n.did=r.sent;case 10:this.storage=new w(k,this,n),this.request=new _(b,this),this.loadReady=!0,this.updateSession("load"),this.freeBuffer(),r.next=20;break;case 17:r.prev=17,r.t0=r.catch(2),console.error("sdk初始化失败,缓存读取失败",r.t0);case 20:case"end":return r.stop()}}),r,this,[[2,17]])})))}},{key:"freeBuffer",value:function(){if(this.loadReady&&this.pageReady)for(;this.buffer.length;){var t=this.buffer.shift();if(t)(e.prototype[t.fnName]||this[t.fnName]).apply(this,t.args)}}},{key:"send",value:function(e){var t=this.storage.allData.utm;if(t)for(var r in t)t[r]&&(e.pr["$".concat(r)]=t[r]);return this.request.send(e)}},{key:"trackBaseData",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new Date,t.t0=e,t.t1=r.getTime(),t.t2=this.storage.allData.sid,t.t3=this.storage.allData.cuid,t.t4=this.cn,t.t5=y.getTimezone(r),t.t6=this.currentPage.url,t.t7=this.prevPage.url,t.t8=x.os(),t.t9=x.ov(),t.t10=x.version(),t.next=14,x.mnet();case 14:return t.t11=t.sent,t.next=17,x.net();case 17:return t.t12=t.sent,t.t13=this.config.vn,t.t14=this.referrerDomain,t.t15=this.config.appId,t.t16={$eid:t.t0,$ct:t.t1,$sid:t.t2,$cuid:t.t3,$cn:t.t4,$tz:t.t5,$url:t.t6,$ref:t.t7,$os:t.t8,$ov:t.t9,$wv:t.t10,$mnet:t.t11,$net:t.t12,$vn:t.t13,$referrer_domain:t.t14,$wxeid:t.t15,$page_url:""},(n={dt:"evt",pr:t.t16}).pr=y.merge(n.pr,y.encode(this.config.superProperty)),t.abrupt("return",n);case 25:case"end":return t.stop()}}),t,this)})))}},{key:"environmentInfo",value:function(){var e=new Date,t={dt:"pl",pr:{$rs:"".concat(x.windowWidth(),"x").concat(x.windowHeight()),$tz:y.getTimezone(e),$ct:e.getTime(),$cuid:this.storage.allData.cuid,$sid:this.storage.allData.sid,$dv:void 0,$br:void 0}};if(wx.getSystemInfoSync){var r=wx.getSystemInfoSync();t.pr.$dv=r.model,t.pr.$br=r.brand}else delete t.pr.$dv,delete t.pr.$br;this.send(t)}},{key:"sessionEnd",value:function(e){var t=new Date,r=e.update-e.sid,n={dt:"se",pr:{$ct:e.update,$cn:this.cn,$tz:y.getTimezone(t),$dru:r,$sid:e.sid,$cuid:e.cuid,$referrer_domain:this.referrerDomain}};this.send(n)}},{key:"sessionStart",value:function(){return v(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Date,r=this.storage.allData,n=r.sid,i=r.cuid,e.t0=n,e.t1=n,e.t2=i,e.t3=this.cn,e.t4=y.getTimezone(t),e.t5=this.currentPage.url,e.t6=this.prevPage.url,e.t7=x.os(),e.t8=x.ov(),e.t9=x.version(),e.next=14,x.mnet();case 14:return e.t10=e.sent,e.next=17,x.net();case 17:e.t11=e.sent,e.t12=this.config.vn,e.t13=this.referrerDomain,e.t14=this.config.appId,e.t15={$ct:e.t0,$sid:e.t1,$cuid:e.t2,$cn:e.t3,$tz:e.t4,$url:e.t5,$ref:e.t6,$os:e.t7,$ov:e.t8,$wv:e.t9,$mnet:e.t10,$net:e.t11,$vn:e.t12,$referrer_domain:e.t13,$wxeid:e.t14},o={dt:"ss",pr:e.t15},this.config.utm&&!y.isEmpty(this.config.utm)||!this.utmCatch||this.storage.set("utm",this.utmCatch),this.send(o),this.environmentInfo();case 26:case"end":return e.stop()}}),e,this)})))}},{key:"updateSession",value:function(e){var t=this.storage.allData,r=Date.now();if(t.sid&&t.update)if(r-t.update>this.config.timeout){var n=y.clone(t);this.storage.set("sid",r),this.storage.set("update",r),this.sessionEnd(n),this.sessionStart()}else this.storage.set("update",r);else this.storage.set("sid",r),this.storage.set("update",r),this.sessionStart()}},{key:"click",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r,n,i,o,u;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.config.click){t.next=2;break}return t.abrupt("return");case 2:return this.updateSession("click"),t.next=5,this.trackBaseData("click");case 5:for(o in r=t.sent,n={},i=["id","content","type","style","selector","link"],e.target.dataset)-1===i.indexOf(o)&&(n["_".concat(o)]=e.target.dataset[o]);return u=e.target,r.dt="abp",r.pr=y.merge(r.pr,{$page_url:this.currentPage.url,$page_title:this.currentPage.title},{$element_id:u.dataset.id||"",$element_content:u.dataset.content||"",$element_type:u.dataset.type||"",$element_style:u.dataset.style||"",$element_selector:u.dataset.selector||"",$element_link:u.dataset.link||""},n,""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),t.next=14,this.send(r);case 14:return t.next=16,this.visual.event(r);case 16:case"end":return t.stop()}}),t,this)})))}},{key:"pv",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.config.pv){t.next=2;break}return t.abrupt("return");case 2:return this.updateSession("pv"),t.next=5,this.trackBaseData("pv");case 5:return(r=t.sent).dt="abp",r.pr=y.merge(r.pr,{$page_url:this.currentPage.url.split("?")[0],$page_title:this.currentPage.title},e||{},""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),t.next=10,this.send(r);case 10:return t.next=12,this.visual.event(r);case 12:case"end":return t.stop()}}),t,this)})))}},{key:"duration",value:function(){return v(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.config.duration){e.next=2;break}return e.abrupt("return");case 2:return this.updateSession("duration"),y.isFunction(this.config.beforeDuration)&&this.config.beforeDuration(),t=this.currentPage.time-this.prevPage.time,e.next=7,this.trackBaseData("dr");case 7:return(r=e.sent).dt="abp",r.pr=y.merge(r.pr,{$dr:t,$url:this.prevPage.url,$title:this.prevPage.title}),e.next=12,this.send(r);case 12:y.isFunction(this.config.afterDuration)&&this.config.afterDuration();case 13:case"end":return e.stop()}}),e,this)})))}},{key:"track",value:function(e,t){return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.updateSession("track"),r.next=3,this.trackBaseData(e);case 3:return(n=r.sent).pr=y.merge(n.pr,y.encode(t),""!==this.config.appName?{"_小程序名称":this.config.appName}:{}),r.next=7,this.send(n);case 7:return r.next=9,this.visual.event(n);case 9:case"end":return r.stop()}}),r,this)})))}},{key:"identify",value:function(e,t){return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n,i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.storage.set("cuid",e),this.updateSession("identify"),n=new Date,(i={dt:"usr",pr:{$ct:n.getTime(),$tz:y.getTimezone(n),$cuid:e,$sid:this.storage.allData.sid,$url:this.currentPage.url}}).pr=y.merge(i.pr,y.encode(t)),r.next=7,this.trackBaseData("usr");case 7:return r.next=9,this.send(i);case 9:case"end":return r.stop()}}),r,this)})))}},{key:"setPushClient",value:function(e,t){return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n,i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=new Date,i={dt:"um",pr:{$ct:n.getTime(),$tz:y.getTimezone(n),$push_ch:t||"getui",$push_id:e}},r.next=4,this.trackBaseData("usr");case 4:return r.next=6,this.send(i);case 6:case"end":return r.stop()}}),r,this)})))}},{key:"trackCount",value:function(e,t){var r=this;0===this.count&&(this.countStartTime=Date.now(),this.previousCountEvent.name=e,this.previousCountEvent.props=y.clone(t)),this.previousCountEvent.name===e&&y.isEqual(this.previousCountEvent.props,t)||(this.sendCountEvent(this.previousCountEvent.name,this.previousCountEvent.props,!1),this.previousCountEvent.name=e,this.previousCountEvent.props=y.clone(t),this.countStartTime=Date.now(),this.count=0),this.count+=1,this.countTimer&&clearTimeout(this.countTimer),this.countTimer=setTimeout((function(){r.sendCountEvent(e,t,!0)}),this.config.countDuration)}},{key:"sendCountEvent",value:function(e,t,r){return v(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i,o,u,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.updateSession("track count"),i=Date.now()-this.countStartTime,r&&(i-=this.config.countDuration),o=this.count,this.count=r?0:1,n.next=7,this.trackBaseData(e);case 7:return u=n.sent,a={},y.isObject(t)&&(a=y.clone(t)),u.pr=y.merge(u.pr,y.encode(a),y.encode({count:o,countTime:i})),n.next=13,this.send(u);case 13:case"end":return n.stop()}}),n,this)})))}},{key:"trackRevenue",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r,n,i,o,u,a,s,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=function(e,t){var r=0;try{e.toString().split(".")[1]&&(r+=e.toString().split(".")[1].length)}catch(e){console.error(e)}try{t.toString().split(".")[1]&&(r+=t.toString().split(".")[1].length)}catch(e){console.error(e)}return Number(e.toString().replace(".",""))*Number(t.toString().replace(".",""))/Math.pow(10,r)},this.updateSession("track revenue"),t.next=4,this.trackBaseData("revenue");case 4:(r=t.sent).dt="abp",(n=y.merge({price:0,total:0,productID:null,productQuantity:0,revenueType:null},e)).total=i(n.price,n.productQuantity),o=["productID","revenueType"],u=["price","total","productQuantity"],a={},t.t0=regeneratorRuntime.keys(n);case 12:if((t.t1=t.t0()).done){t.next=21;break}if(s=t.t1.value,-1!==o.indexOf(s)||-1!==u.indexOf(s)){t.next=16;break}return t.abrupt("continue",12);case 16:c=n[s],u.indexOf(s)>-1&&((c=Number(c))||(c=0)),a["$"+s]=c,t.next=12;break;case 21:return r.pr=y.merge(r.pr,a),t.next=24,this.send(r);case 24:case"end":return t.stop()}}),t,this)})))}},{key:"setUtm",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null!==(r=y.filterUtm(e))&&(this.storage.set("utm",r),this.updateSession("setUtm"));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"setSuperProperty",value:function(e){y.isObject(e)&&(this.config.superProperty=e)}},{key:"extendSuperPropertys",value:function(e){y.isObject(e)&&(this.config.superProperty=y.merge(this.config.superProperty,e))}},{key:"removeSuperProperty",value:function(e){var t,r=function(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=f(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return u=e.done,e},e:function(e){a=!0,o=e},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw o}}}}(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;delete this.config.superProperty[n]}}catch(e){r.e(e)}finally{r.f()}}},{key:"getSuperProperty",value:function(){return this.config.superProperty}},{key:"flush",value:function(){this.request.clear()}}]),e}();d([R],E.prototype,"environmentInfo",null),d([R],E.prototype,"sessionEnd",null),d([R],E.prototype,"sessionStart",null),d([R],E.prototype,"updateSession",null),d([R],E.prototype,"click",null),d([R],E.prototype,"pv",null),d([R],E.prototype,"duration",null),d([R],E.prototype,"track",null),d([R],E.prototype,"identify",null),d([R],E.prototype,"setPushClient",null),d([R],E.prototype,"trackCount",null),d([R],E.prototype,"trackRevenue",null),d([R],E.prototype,"setUtm",null);var $=["onLaunch","onShow","onHide","onError","onPageNotFound","onUnhandledRejection","onThemeChange","onShareAppMessage","onLogin"],C=["onLoad","onShow","onReady","onHide","onUnload","onShareAppMessage","onReachBottom","onPageScroll","onPullDownRefresh","onTabItemTap","onInit","onShareTimeline","onAddToFavorites","onResize","onTitleClick","onOptionMenuClick","onPullIntercept","onURLQueryChange"],D=function(e){return y.wxGetTitle(e)},j={did:null,getDid:function(){return new Promise((function(e,t){wx.getStorage({key:"zg-did",success:function(t){e(t.data||""),wx.removeStorage({key:"zg-did"})},fail:function(t){e("")}})}))},get:function(){return new Promise((function(e,t){wx.getStorage({key:"zg",success:function(t){e(t.data||{})},fail:function(t){e({})}})}))},set:function(e,t){return new Promise((function(r,n){wx.setStorage({key:e,data:t,success:r,fail:n})}))}},I=!1,L=wx.getSystemInfoSync(),A=L.system.split(/\s/),z={os:A[0],ov:A[1],version:L.version,windowHeight:L.windowHeight,windowWidth:L.windowWidth,net:0,mnet:0};function N(e){var t=e.toLowerCase();"wifi"===t?(z.net=1,z.mnet=0):(z.net=0,z.mnet={"2g":1,"3g":3,"4g":13}[t]||0)}function U(e){return new Promise((function(t,r){if(I)return t(z[e]);wx.getNetworkType({success:function(r){I=!0,N(r.networkType),t(z[e])}})}))}wx.onNetworkStatusChange((function(e){N(e.networkType)}));var q,M,F={os:function(){return z.os},ov:function(){return z.ov},version:function(){return z.version},net:function(){return U("net")},mnet:function(){return U("mnet")},windowWidth:function(){return z.windowWidth},windowHeight:function(){return z.windowHeight}},B=App,Q=Page,W=Component,H=["eid","ct","tz","cuid","cn","sid","url","os","ov","wv","mnet","referrer_domain","net","vn","wxeid","uid","share_id","share_title","share_level","title","path"];function G(e,t,r){if(e[r]&&y.isFunction(e[r])){var n=e[r];e[r]=function(){n.apply(this,arguments),t[r].apply(this,arguments)}}else e[r]=function(){t[r].apply(this,arguments)}}function J(e,t,r){var n=e[t];e[t]=function(){var e=arguments[0];if(q===e||e&&q&&q.timeStamp===e.timeStamp)return n.apply(this,arguments);if(q=e,e){var t=e.type;"tap"===t&&r.click(e)}return n.apply(this,arguments)}}var V=function(e){o(i,e);var r=c(i);function i(e){var n;return t(this,i),(n=r.call(this,T,j,F)).openData={path:"",props:{}},n.shared=!1,n.semiAutoTrackEventCatch={},n.isShareOperation=!1,M=e,n.initLifeCycleHook(),n}return n(i,[{key:"initLifeCycleHook",value:function(){var e,t=this,r=(e=t,{App:{onLaunch:function(t){e.config.visual&&e.visual.getVisualData()},onShow:function(t){e.sceneToUtm(t),e.openOptions=t,e.updateSession("appOnShow")},onHide:function(){e.flush(),e.config.duration&&!e.isShareOperation&&(e.pageReady=!0,e.currentPage.time=Date.now(),e.duration().then((function(){e.pageReady=!1,e.prevPage={queryObj:{},query:"",route:"",time:0,url:"",title:""}})))}},Page:{onLoad:function(t){(null==t?void 0:t.scene)&&-1!==decodeURIComponent(t.scene).indexOf("vRQC")&&e.config.visual&&(e.visual.vRQC=decodeURIComponent(t.scene).split("vRQC=")[1],e.visual.init()),e.currentPage.query=y.parseQuery(t),e.currentPage.queryObj=t},onShow:function(){var t=getCurrentPages(),r=t[t.length-1];e.currentPage.route=r.__route__||r.route,e.currentPage.time=Date.now(),e.currentPage.url="".concat(e.currentPage.route);var n=D;if(e.currentPage.title="function"==typeof n?n(r):"",e.currentPage.query&&(e.currentPage.url+="?".concat(e.currentPage.query)),e.pageReady=!0,e.freeBuffer(),e.currentPage.url!==e.prevPage.url){""!==e.prevPage.url&&e.duration();try{e.trackOpenShare(e.openOptions)}catch(t){console.warn(t,"".concat(e.referrerDomain," ","zhuge"," sdk trackOpenShare error"))}e.pv()}e.startObserveMarkElement(r),e.openOptions=null,e.isShareOperation=!1},onHide:function(){e.semiAutoTrackEventCatch={},e.prevPage=y.clone(e.currentPage),e.pageReady=!1,e.flush()},onUnload:function(){e.semiAutoTrackEventCatch={},e.prevPage=y.clone(e.currentPage),e.pageReady=!1,e.flush()}}});this.lifecycle=r;var n=function(e){for(var n in r.App)G(e,r.App,n);for(var i in e)!$.includes(i)&&y.isFunction(e[i])&&J(e,i,t);return B(e)};for(var i in App)n[i]=App[i];App=n;var o=function(e){for(var n in r.Page)G(e,r.Page,n);for(var i in e)!C.includes(i)&&y.isFunction(e[i])&&"onShareAppMessage"!==i&&J(e,i,t);var o=e.onShareAppMessage;return y.isFunction(o)&&(e.onShareAppMessage=t.onShareAppMessage(o)),Q(e)};for(var u in Page)o[u]=Page[u];Page=o,Component=function(e){if(void 0!==e.methods)for(var r in e.methods)J(e.methods,r,t);return W(e)},global&&global.mpvue&&(global.App=App,global.Page=Page,global.Component=Component),App.zhuge=t}},{key:"load",value:function(e,t){return m(u(i.prototype),"load",this).call(this,e,t)}},{key:"pv",value:function(e){var t=this,r=Object.create(null,{pv:{get:function(){return m(u(i.prototype),"pv",t)}}});return v(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={},n=y.getCurrentPage(),this.config.forwardShare&&this.openOptions&&(t.$share_open_type=1008===this.openOptions.scene?"群聊":"聊天",this.openOptions.query&&this.openOptions.query.zg_share_level&&(t.$share_level=Number(this.openOptions.query.zg_share_level)),n.data&&n.data.zg_share_data&&(t=y.merge(t,y.encode(n.data.zg_share_data)))),e.next=5,r.pv.call(this,t);case 5:case"end":return e.stop()}}),e,this)})))}},{key:"click",value:function(e){var t=this,r=Object.create(null,{click:{get:function(){return m(u(i.prototype),"click",t)}}});return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.click.call(this,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"sceneToUtm",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=y.getUtmByQuery(e.query);if(this.config.parseScene&&e.scene&&M){var r=e.scene;this.cn=r+"";var n=M[r],i={},o=null,u=M.isShare(r);if(u&&e.referrerInfo&&(o=e.referrerInfo.appId),n){i={utm_source:n.utm_source,utm_medium:n.utm_medium,utm_campaign:o};var a=e.query||{};M.isCartShare(r)&&a.zg_uid&&a.zg_share_id&&(i.utm_term=a.zg_uid,i.utm_content=a.zg_share_id)}t=y.merge(i,t)}this.utmCatch=t,"fresh"===this.config.utmMode&&y.isEmpty(this.config.utm)&&this.storage.set("utm",t)}},{key:"trackOpenShare",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r,n,i,o,u,a,s,c,m,l,h;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e&&this.config.forwardShare){t.next=2;break}return t.abrupt("return");case 2:if(!this.shared){t.next=5;break}return this.shared=!1,t.abrupt("return");case 5:if(r=e.query||{},n=this.currentPage.route,!(M.isCartShare(e.scene)&&r.zg_uid&&r.zg_share_id)){t.next=24;break}for(u in i={$uid:r.zg_uid,$share_id:r.zg_share_id,$title:this.currentPage.title,$path:n,$share_open_type:1008===e.scene?"群聊":"聊天",$share_level:Number(r.zg_share_level)},this.shareId=r.zg_share_id,this.shareLevel=Number(r.zg_share_level),o={},r)a=u.replace(/^zg_/,""),-1===H.indexOf(a)&&/^zg_/.test(u)&&(o[a]=r[u]);if(s=this.config.shareToUtm,y.isObject(s)&&!y.isEmpty(s)){for(m in c={},s)null!==o[m]&&void 0!==o[m]&&(l=s[m],c[l]=o[m]);y.isEmpty(c)||(c.utm_campaign||(c.utm_campaign="分享打开"),this.setUtm(c))}return this.openData={path:n,props:o},i=y.merge(i,y.encode(o)),t.next=19,this.trackBaseData("wxsopen");case 19:return(h=t.sent).dt="abp",h.pr=y.merge(h.pr,i),t.next=24,this.send(h);case 24:case"end":return t.stop()}}),t,this)})))}},{key:"onShareAppMessage",value:function(e){var t=this;return function(){t.isShareOperation=!0;var r=e.apply(this,arguments)||{};if(!t.config.forwardShare)return r;r.path=r.path||t.currentPage.url;var n=r.title||t.currentPage.title,i=r.path.split("?")[0],o=this.data.zg_share_data,u=(new Date).getTime(),a=1;!this.data.newShare&&t.openData&&t.openData.path===i&&y.isEqual(o||{},t.openData.props)&&(u=t.shareId,a=t.shareLevel+1);var s={share_id:u,uid:t.storage.allData.cuid||t.storage.allData.did,share_level:a},c={$share_title:n,$title:t.currentPage.title||"",$path:i},m={};for(var l in s)c["$".concat(l)]=m["zg_".concat(l)]=s[l];for(var h in o)-1===H.indexOf(h)&&(c["_".concat(h)]=m["zg_".concat(h)]=o[h]);return r.path=y.addUrlParam(r.path,m),t.trackBaseData("wxshare").then((function(e){e.dt="abp",e.pr=y.merge(e.pr,c),t.request.send(e)})),t.shared=!0,r}}},{key:"startObserveMarkElement",value:function(e){var t=this;this.config.exposure&&(this.elementObserver&&this.elementObserver.disconnect(),e.isComponent?this.elementObserver=e.createIntersectionObserver({observeAll:!0}):this.elementObserver=wx.createIntersectionObserver(e,{observeAll:!0}),this.elementObserver.relativeToViewport().observe(".zhuge-expo-track",(function(e){if(e.intersectionRatio>0){var r,n=t.getEventDataFromDataset(e.dataset);(r=m(u(i.prototype),"track",t)).call.apply(r,[t].concat(h(n)))}})))}},{key:"getEventDataFromDataset",value:function(e){var t={},r="";for(var n in e){if(n.startsWith("expo"))if("expoName"===n)r=e[n];else t[n.replace(/^expo(.*)/,(function(e,t,r,n){return t.replace(t[0],t[0].toLocaleLowerCase())}))]=e[n]}return[r,t]}}]),i}(E);d([R],V.prototype,"sceneToUtm",null),d([R],V.prototype,"trackOpenShare",null);var K={1e3:{utm_source:"其他",utm_medium:"其他"},1001:{utm_source:"微信主程序",utm_medium:"发现栏小程序主入口"},1005:{utm_source:"搜索",utm_medium:"顶部搜索框的搜索结果页"},1006:{utm_source:"搜索",utm_medium:"发现栏小程序主入口搜索框的搜索结果页"},1007:{utm_source:"分享",utm_medium:"单人聊天会话中的小程序消息卡片"},1008:{utm_source:"分享",utm_medium:"群聊会话中的小程序消息卡片"},1010:{utm_source:"收藏",utm_medium:"收藏夹"},1011:{utm_source:"扫码",utm_medium:"扫描二维码"},1012:{utm_source:"扫码",utm_medium:"长按图片识别二维码"},1013:{utm_source:"扫码",utm_medium:"手机相册选取二维码"},1014:{utm_source:"小程序模板消息",utm_medium:"小程序模板消息"},1017:{utm_source:"体验版",utm_medium:"前往体验版的入口页"},1019:{utm_source:"微信支付",utm_medium:"微信钱包"},1023:{utm_source:"桌面图标",utm_medium:"安卓系统桌面图标"},1024:{utm_source:"微信主程序",utm_medium:"小程序 profile 页"},1025:{utm_source:"扫码",utm_medium:"扫描一维码"},1026:{utm_source:"微信主程序",utm_medium:"附近小程序列表"},1027:{utm_source:"搜索",utm_medium:"顶部搜索框搜索结果页“使用过的小程序”列表"},1028:{utm_source:"微信卡券",utm_medium:"我的卡包"},1029:{utm_source:"微信卡券",utm_medium:"卡券详情页"},1030:{utm_source:"测试",utm_medium:"自动化测试下打开小程序"},1031:{utm_source:"扫码",utm_medium:"长按图片识别一维码"},1032:{utm_source:"扫码",utm_medium:"手机相册选取一维码"},1034:{utm_source:"微信支付",utm_medium:"微信支付完成页"},1035:{utm_source:"公众号",utm_medium:"公众号自定义菜单"},1036:{utm_source:"分享",utm_medium:"App分享消息卡片"},1037:{utm_source:"小程序",utm_medium:"小程序打开小程序"},1038:{utm_source:"小程序",utm_medium:"从另一个小程序返回"},1039:{utm_source:"摇电视",utm_medium:"摇电视"},1042:{utm_source:"搜索",utm_medium:"添加好友搜索框的搜索结果页"},1043:{utm_source:"公众号",utm_medium:"公众号模板消息"},1044:{utm_source:"分享",utm_medium:"带shareTicket的小程序消息卡片(详情)"},1045:{utm_source:"广告",utm_medium:"朋友圈广告"},1046:{utm_source:"广告",utm_medium:"朋友圈广告详情页"},1047:{utm_source:"扫码",utm_medium:"扫描小程序码"},1048:{utm_source:"扫码",utm_medium:"长按图片识别小程序码"},1049:{utm_source:"扫码",utm_medium:"手机相册选取小程序码"},1052:{utm_source:"微信卡券",utm_medium:"卡券的适用门店列表"},1053:{utm_source:"搜索",utm_medium:"搜一搜的结果页"},1056:{utm_source:"音乐播放器菜单",utm_medium:"音乐播放器菜单"},1057:{utm_source:"微信支付",utm_medium:"钱包中的银行卡详情页"},1058:{utm_source:"公众号",utm_medium:"公众号文章"},1059:{utm_source:"体验版",utm_medium:"体验版小程序绑定邀请页"},1060:{utm_source:"支付完成",utm_medium:"微信支付完成页"},1064:{utm_source:"微信WIFI",utm_medium:"微信连Wi-Fi状态栏"},1065:{utm_source:"scheme 详情",utm_medium:"URL scheme 详情"},1067:{utm_source:"广告",utm_medium:"公众号文章广告"},1069:{utm_source:"移动应用",utm_medium:"移动应用"},1071:{utm_source:"微信支付",utm_medium:"钱包中的银行卡列表页"},1072:{utm_source:"微信支付",utm_medium:"二维码收款页面"},1073:{utm_source:"客服消息",utm_medium:"客服消息列表下发的小程序消息卡片"},1074:{utm_source:"公众号会话",utm_medium:"公众号会话下发的小程序消息卡片"},1077:{utm_source:"摇周边",utm_medium:"摇周边"},1078:{utm_source:"微信WIFI",utm_medium:"连Wi-Fi成功页"},1079:{utm_source:"微信游戏中心",utm_medium:"微信游戏中心"},1081:{utm_source:"客服消息",utm_medium:"客服消息下发的文字链"},1082:{utm_source:"公众号",utm_medium:"公众号会话下发的文字链"},1084:{utm_source:"广告",utm_medium:"朋友圈广告原生页"},1088:{utm_source:"打开小程序",utm_medium:"会话中查看系统消息,打开小程序"},1089:{utm_source:"微信主程序",utm_medium:"微信聊天主界面下拉"},1090:{utm_source:"小程序",utm_medium:"长按小程序右上角菜单唤出最近使用历史"},1091:{utm_source:"公众号",utm_medium:"公众号文章商品卡片"},1092:{utm_source:"微信城市服务",utm_medium:"城市服务入口"},1095:{utm_source:"广告",utm_medium:"小程序广告组件"},1096:{utm_source:"分享",utm_medium:"聊天记录"},1097:{utm_source:"微信支付",utm_medium:"微信支付签约页"},1099:{utm_source:"小程序",utm_medium:"页面内嵌插件"},1100:{utm_source:"打开小程序",utm_medium:"红包封面详情页打开小程序"},1101:{utm_source:"调试",utm_medium:"远程调试热更新(开发者工具中,预览 -> 自动预览 -> 编译并预览)"},1102:{utm_source:"公众号",utm_medium:"公众号profile页服务预览"},1106:{utm_source:"打开小程序",utm_medium:"聊天主界面下拉,从顶部搜索结果页,打开小程序"},1107:{utm_source:"打开小程序",utm_medium:"订阅消息,打开小程序"},1113:{utm_source:"打开小程序",utm_medium:"安卓手机负一屏,打开小程序(三星)"},1114:{utm_source:"打开小程序",utm_medium:"安卓手机侧边栏,打开小程序(三星)"},1119:{utm_source:"打开小程序",utm_medium:"【企业微信】工作台内打开小程序"},1120:{utm_source:"打开小程序",utm_medium:"【企业微信】个人资料页内打开小程序"},1121:{utm_source:"打开小程序",utm_medium:"【企业微信】聊天加号附件框内打开小程序"},1124:{utm_source:"打开小程序",utm_medium:"扫“一物一码”打开小程序"},1125:{utm_source:"图片识别",utm_medium:"长按图片识别“一物一码”"},1126:{utm_source:"扫描手机相册",utm_medium:"扫描手机相册中选取的“一物一码”"},1129:{utm_source:"爬虫",utm_medium:"微信爬虫"},1131:{utm_source:"浮窗",utm_medium:"浮窗"},1133:{utm_source:"打开小程序详情",utm_medium:"硬件设备打开小程序详情"},1135:{utm_source:"打开小程序",utm_medium:"小程序 profile 页相关小程序列表,打开小程序"},1144:{utm_source:"视频贴片",utm_medium:"公众号文章 - 视频贴片"},1145:{utm_source:"发现小程序",utm_medium:"发现栏 - 发现小程序"},1146:{utm_source:"打开出行类小程序",utm_medium:"地理位置信息打开出行类小程序"},1148:{utm_source:"打开小程序",utm_medium:"卡包 - 交通卡,打开小程序"},1150:{utm_source:"扫一扫",utm_medium:"扫一扫商品条码结果页打开小程序"},1151:{utm_source:"我的订单",utm_medium:"发现栏 - 我的订单"},1152:{utm_source:"打开小程序",utm_medium:"订阅号视频打开小程序"},1153:{utm_source:"打开小程序",utm_medium:"“识物”结果页打开小程序"},1154:{utm_source:"打开“单页模式”",utm_medium:"朋友圈内打开“单页模式”"},1155:{utm_source:"打开小程序",utm_medium:"“单页模式”打开小程序"},1157:{utm_source:"打开小程序",utm_medium:"服务号会话页打开小程序"},1158:{utm_source:"打开小程序",utm_medium:"群工具打开小程序"},1160:{utm_source:"群待办",utm_medium:"群待办"},1167:{utm_source:"打开小程序详情",utm_medium:"H5 通过开放标签打开小程序详情"},1168:{utm_source:"运行小程序",utm_medium:"移动应用直接运行小程序"},1169:{utm_source:"小程序入口",utm_medium:"发现栏小程序主入口,各个生活服务入口"},1171:{utm_source:"微信运动记录",utm_medium:"微信运动记录"},1173:{utm_source:"打开小程序详情",utm_medium:"聊天素材用小程序打开详情"},1175:{utm_source:"商店入口",utm_medium:"视频号主页商店入口"},1176:{utm_source:"打开小程序",utm_medium:"视频号直播间主播打开小程序"},1177:{utm_source:"直播商品",utm_medium:"视频号直播商品"},1178:{utm_source:"打开小程序",utm_medium:"在电脑打开手机上打开的小程序"},1179:{utm_source:"打开小程序",utm_medium:"#话题页打开小程序"},1181:{utm_source:"打开 PC 小程序",utm_medium:"网站应用打开 PC 小程序"},1183:{utm_source:"搜索",utm_medium:"PC微信 - 小程序面板 - 发现小程序 - 搜索"},1184:{utm_source:"打开小程序",utm_medium:"视频号链接打开小程序"},1185:{utm_source:"群公告",utm_medium:"群公告"},1186:{utm_source:"收藏",utm_medium:"收藏 - 笔记"},1187:{utm_source:"浮窗",utm_medium:"浮窗"},1189:{utm_source:"表情雨广告",utm_medium:"表情雨广告"},1191:{utm_source:"视频号活动",utm_medium:"视频号活动"},1192:{utm_source:"企业微信联系人 profile 页",utm_medium:"企业微信联系人 profile 页"},1193:{utm_source:"打开小程序",utm_medium:"视频号主页服务菜单打开小程序"},1194:{utm_source:"URL Link 详情",utm_medium:"URL Link 详情"},1195:{utm_source:"主页商品tab",utm_medium:"视频号主页商品tab"},1196:{utm_source:"打开小程序",utm_medium:"个人状态打开小程序"},1197:{utm_source:"返回小游戏",utm_medium:"视频号主播从直播间返回小游戏"},1198:{utm_source:"打开小游戏",utm_medium:"视频号开播界面打开小游戏"},1201:{utm_source:"打开小程序",utm_medium:"视频号广告详情页打开小程序"},1202:{utm_source:"打开小程序卡片",utm_medium:"企微客服号会话打开小程序卡片"},1203:{utm_source:"压测工具的请求",utm_medium:"微信小程序压测工具的请求"},1206:{utm_source:"打开小游戏",utm_medium:"视频号小游戏直播间打开小游戏"},1207:{utm_source:"打开小程序文字链",utm_medium:"企微客服号会话打开小程序文字链"},1208:{utm_source:"打开商品卡片",utm_medium:"聊天打开商品卡片"},1212:{utm_source:"打开小程序",utm_medium:"青少年模式申请页打开小程序"},1215:{utm_source:"打开小程序",utm_medium:"广告预约打开小程序"},1216:{utm_source:"打开小程序",utm_medium:"视频号订单中心打开小程序"},isShare:function(e){return[1096].includes(e)},isCartShare:function(e){return[1007,1008,1036,1044].includes(e)}},Y=new(function(e){o(i,e);var r=c(i);function i(){return t(this,i),r.call(this,K)}return n(i,[{key:"load",value:function(e,t){var r=t||{};if(wx.getAccountInfoSync){var n=wx.getAccountInfoSync();n&&n.miniProgram&&n.miniProgram.appId&&(r.appId=n.miniProgram.appId)}return m(u(i.prototype),"load",this).call(this,e,r)}}]),i}(V));return App.zhuge=Y,Y}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zg-sdk-wechart",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"description": "诸葛智能微信小程序sdk",
|
|
5
5
|
"main": "./dist/zhuge.min.js",
|
|
6
6
|
"module": "./dist/zhuge.es.min.js",
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
"keywords": [],
|
|
14
14
|
"author": "",
|
|
15
15
|
"license": "ISC",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "9af143d74cda0d0ebc0f3fc7375c3ab3c4c54f23"
|
|
17
17
|
}
|