@xyz-fe/log 6.0.2 → 6.1.0
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/dist/index.d.ts +20 -2
- package/dist/index.js +3 -3
- package/dist/index.min.js +3 -3
- package/dist/index.mjs +3 -3
- package/dist/mp.d.ts +20 -2
- package/dist/mp.js +2 -2
- package/dist/mp.min.js +2 -2
- package/dist/mp.mjs +2 -2
- package/dist/web-hw.d.ts +12 -2
- package/dist/web-hw.js +3 -3
- package/dist/web-hw.min.js +3 -3
- package/dist/web-hw.mjs +3 -3
- package/dist/web.d.ts +12 -2
- package/dist/web.js +2 -2
- package/dist/web.min.js +2 -2
- package/dist/web.mjs +2 -2
- package/package.json +2 -2
package/dist/mp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @xyz-fe/log v6.0
|
|
2
|
+
* @xyz-fe/log v6.1.0
|
|
3
3
|
* (c) lizhigao <lizhigao@021.com>
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){return t=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var i in e=arguments[o])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)};function e(t,e,o,n){return new(o||(o=Promise))((function(i,s){function r(t){try{c(n.next(t))}catch(t){s(t)}}function a(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var o,n,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return r.next=a(0),r.throw=a(1),r.return=a(2),"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(c){return function(a){if(o)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(o=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{o=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function n(){var t=new Date,e=t.getFullYear().toString(),o=(t.getMonth()+1).toString(),n=t.getDate().toString();return(e=e.toString().substr(-2))+(o=Number(o)<10?"0"+o:o)+(n=Number(n)<10?"0"+n:n)}"function"==typeof SuppressedError&&SuppressedError;var i,s,r,a="6.0.2",c="organic";exports.EGender=void 0,(i=exports.EGender||(exports.EGender={}))[i.Unknown=0]="Unknown",i[i.Male=1]="Male",i[i.Female=2]="Female",function(t){t[t.WECHAT=1]="WECHAT",t[t.DOUYIN=2]="DOUYIN",t[t.TIKTOK=200]="TIKTOK",t[t.KUAISHOU=3]="KUAISHOU",t[t.BAIDU=4]="BAIDU",t[t.QQ=5]="QQ",t[t.WEB=7]="WEB"}(s||(s={})),function(t){t.BATCH_ID="BATCH_ID",t.COMMON_PARAMS="COMMON_PARAMS",t.ONLINE_BATCH_DATA="ONLINE_BATCH_DATA",t.ACCUMULATED_TIME="ACCUMULATED_TIME"}(r||(r={}));var p=function(){function i(t){var e,o,n=t.domain,i=t.commonParams,s=t.isPro,c=void 0===s||s,p=t.sendOpenLog,l=void 0===p||p,u=t.consoleLog,d=void 0===u||u,h=t.useIAA,m=void 0!==h&&h,_=t.periodicReportInterval,f=void 0===_?0:_;if(this.version=a,this.buildDate="5/13/2026, 2:50:09 PM",this._openUrl="",this._eventUrl="",this._actUrl="",this._adUrl="",this._onlineUrl="",this._businessDomain="",this._startTime=Date.now(),this._commonParams={},this._periodicReportInterval=0,this._accumulatedTime=0,this._periodicTimer=null,this._isPro=!0,this._sendOpenLog=!0,this._isColdStartUp=!0,this._systemInfo={},this._mp={},this._consoleLog=!0,this._useIAA=!1,this._sessionInfo={},this._isPro=c,this._sendOpenLog=l,this._consoleLog=d,this._useIAA=m,f>0){var y=f>0?f:10;this._periodicReportInterval=Math.max(1e3*y,5e3)}else this._periodicReportInterval=0;var v=this._getApis(n),g=v.openUrl,I=v.eventUrl,O=v.actUrl,A=v.adUrl,L=v.onlineUrl;this._openUrl=g,this._eventUrl=I,this._actUrl=O,this._adUrl=A,this._onlineUrl=L,this._businessDomain=this._isPro?"https://applet-xx.mop.com":"https://test-applet-xx.mop.com";var w,P=this._getMp(),b=P.mp,S=P.platform;this._mp=b,this._platform=S,!b||(w=b)&&0===Object.keys(w).length&&w.constructor===Object?console.error("[XLOG] 日志SDK初始化失败,当前环境为非小程序环境!"):this._consoleLog&&console.log("[XLOG] 小程序对象:",b,"平台类型:",S);try{this._systemInfo=(null===(o=null===(e=this._mp)||void 0===e?void 0:e.getSystemInfoSync)||void 0===o?void 0:o.call(e))||{},this._consoleLog&&console.log("[XLOG] 系统信息:",this._systemInfo)}catch(t){console.error("[XLOG] getSystemInfoSync error",t)}if(this._extraInfo={language:this._systemInfo.language,wxVersion:this._systemInfo.version,SDKVersion:this._systemInfo.SDKVersion,benchmarkLevel:this._systemInfo.benchmarkLevel||-1,theme:this._systemInfo.theme,pixelRatio:this._systemInfo.pixelRatio},this._periodicReportInterval>0){var T=this._getStorage(r.ACCUMULATED_TIME);this._accumulatedTime=T?Number(T):0,this._consoleLog&&console.log("[XLOG] 加载缓存的累计时长:",this._accumulatedTime,"ms")}this._init(i)}return Object.defineProperty(i.prototype,"commonParams",{get:function(){return this._commonParams},enumerable:!1,configurable:!0}),i.prototype._safeJsonParse=function(t,e){try{return t?JSON.parse(t):e}catch(o){return console.error("[XLOG] JSON解析错误:",o,"原始数据:",t),e}},i.prototype._getLaunchOptions=function(){var t,e,o,n,i,s,r,a,c,p,l,u;try{return 2===this._platform?(null===(e=null===(t=this._mp)||void 0===t?void 0:t.getLaunchOptionsSync)||void 0===e?void 0:e.call(t))||null:3===this._platform?(null===(n=null===(o=this._mp)||void 0===o?void 0:o.getLaunchOptionsSync)||void 0===n?void 0:n.call(o))||null:1===this._platform?(null===(s=null===(i=this._mp)||void 0===i?void 0:i.getEnterOptionsSync)||void 0===s?void 0:s.call(i))||(null===(a=null===(r=this._mp)||void 0===r?void 0:r.getLaunchOptionsSync)||void 0===a?void 0:a.call(r))||null:(null===(p=null===(c=this._mp)||void 0===c?void 0:c.getLaunchOptionsSync)||void 0===p?void 0:p.call(c))||(null===(u=null===(l=this._mp)||void 0===l?void 0:l.getEnterOptionsSync)||void 0===u?void 0:u.call(l))||null}catch(t){return console.error("[XLOG] 获取启动参数失败",t),null}},i.prototype._updateQuerystring=function(e,o){void 0===e&&(e=null),void 0===o&&(o={});var n=(null==e?void 0:e.query)?t(t({},e.query),o):o;this._updateCommonParams({srcqid:n.channel||"",userinfo:JSON.stringify({querystring:n})})},i.prototype._init=function(t){var e=this;this._initCommonParams(this._filterParams(t));var o=this._getLaunchOptions();this._updateQuerystring(o),this._coldStartUp(),this._useIAA&&this._initIAAPlugin(),this._visibilityChange((function(){e._isColdStartUp||e._getNetworkType().then((function(t){e._updateCommonParams({network:t}),e._open({openway:1})})),e._startTime=Date.now(),e._periodicReportInterval>0&&e._startPeriodicTimer();var t=e._getOnlineBatchData();t&&t.length>0&&e._online(t)}),(function(){if(e._isColdStartUp=!1,e._open({openway:5}),e._periodicReportInterval>0){e._stopPeriodicTimer();var t=Date.now()-e._startTime;e._accumulatedTime+=t,e._setStorage(r.ACCUMULATED_TIME,e._accumulatedTime.toString()),e._consoleLog&&console.log("[XLOG] 切后台,累计时长:",e._accumulatedTime,"ms")}else e._sendOnline()}))},i.prototype._startPeriodicTimer=function(){var t=this;this._periodicTimer&&clearInterval(this._periodicTimer),this._periodicTimer=setInterval((function(){t._checkPeriodicReport()}),1e3),this._consoleLog&&console.log("[XLOG] 启动定期上报定时器,间隔(ms):",this._periodicReportInterval)},i.prototype._stopPeriodicTimer=function(){this._periodicTimer&&(clearInterval(this._periodicTimer),this._periodicTimer=null,this._consoleLog&&console.log("[XLOG] 停止定期上报定时器"))},i.prototype._checkPeriodicReport=function(){var t=Date.now()-this._startTime,e=this._accumulatedTime+t;if(e>=this._periodicReportInterval){var o=Math.floor(e/this._periodicReportInterval),n=o*this._periodicReportInterval;this._sendPeriodicOnline(n,o),this._accumulatedTime=e-n,this._startTime=Date.now(),this._setStorage(r.ACCUMULATED_TIME,this._accumulatedTime.toString()),this._consoleLog&&console.log("[XLOG] 定期上报 ".concat(o," 次,总计 ").concat(n,"ms,剩余 ").concat(this._accumulatedTime,"ms"))}},i.prototype._sendPeriodicOnline=function(e,o){for(var n=Date.now()-e,i=[],s=0;s<o;s++){var r=n+s*this._periodicReportInterval,a=r+this._periodicReportInterval;i.push(t(t({},this._commonParams),{appqid:this._getAppqid(),onlinetime:this._periodicReportInterval.toString(),endtime:a.toString(),starttime:r.toString()}))}this._online(i)},i.prototype._getMp=function(){var t={mp:null,platform:s.WEB};try{if("undefined"!=typeof TTMinis&&TTMinis.game)return t.mp=TTMinis.game,t.platform=s.TIKTOK,t;if("undefined"!=typeof tt&&tt.getSystemInfoSync){var e=tt.getSystemInfoSync();return t.mp=tt,"TikTok"===e.appName?t.platform=s.TIKTOK:t.platform=s.DOUYIN,t}"undefined"!=typeof ks&&ks.getSystemInfo?(t.mp=ks,t.platform=s.KUAISHOU):"undefined"!=typeof swan&&swan.getSystemInfo?(t.mp=swan,t.platform=s.BAIDU):"undefined"!=typeof qq&&qq.getSystemInfo?(t.mp=qq,t.platform=s.QQ):"undefined"!=typeof wx&&wx.getSystemInfo&&(t.mp=wx,t.platform=s.WECHAT)}catch(t){console.error("[XLOG] Platform detection failed:",t)}return t},i.prototype._visibilityChange=function(t,e){var o,n,i,s,r=this;void 0===t&&(t=function(){}),void 0===e&&(e=function(){});try{var a=(null===(o=this._mp)||void 0===o?void 0:o.onAppShow)||(null===(n=this._mp)||void 0===n?void 0:n.onShow),c=(null===(i=this._mp)||void 0===i?void 0:i.onAppHide)||(null===(s=this._mp)||void 0===s?void 0:s.onHide);a&&a((function(){r._consoleLog&&console.log("[XLOG] onAppShow"),t()})),c&&c((function(){r._consoleLog&&console.log("[XLOG] onAppHide"),e()}))}catch(t){console.error("[XLOG] onAppShow or onAppHide error",t)}},i.prototype._getStorage=function(t){var e;try{var o=null===(e=this._mp)||void 0===e?void 0:e.getStorageSync("XYZ_LOG_".concat(t));return null==o?"":o}catch(t){return console.error("[XLOG] getStorageSync error",t),""}},i.prototype._setStorage=function(t,e){var o;try{null===(o=this._mp)||void 0===o||o.setStorageSync("XYZ_LOG_".concat(t),e)}catch(t){console.error("[XLOG] setStorageSync error",t)}},i.prototype._getBatchId=function(){var t=this._getStorage(r.BATCH_ID);return t||(t=function(t,e){void 0===t&&(t=18),void 0===e&&(e=0);for(var o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[],i=Math.random,s=t,r=e||o.length,a=0;a<s;a++)n[a]=o[0|i()*r];return n.join("")}(),this._setStorage(r.BATCH_ID,t)),t},i.prototype._coldStartUp=function(){var t=this;this._getNetworkType().then((function(e){t._updateCommonParams({network:e}),t._open({openway:0}),t._periodicReportInterval>0&&t._startPeriodicTimer()}))},i.prototype._getApis=function(e){var o=this._isPro?{open:"webopen-inside.tt.cn",event:"webevent-inside.tt.cn",act:"webact-inside.tt.cn",ad:"webadv-inside.tt.cn",online:"webact-inside.tt.cn"}:{open:"test-webopen-inside.tt.cn",event:"test-webevent-inside.tt.cn",act:"test-webact-inside.tt.cn",ad:"test-webadv-inside.tt.cn",online:"test-webact-inside.tt.cn"},n=t(t({},o),e);return{openUrl:"https://".concat(n.open,"/gamefunction_logs/applet/open"),eventUrl:"https://".concat(n.event,"/gamefunction_logs/applet/event"),actUrl:"https://".concat(n.act,"/gamefunction_logs/applet/activity"),adUrl:"https://".concat(n.ad,"/gamefunction_logs/applet/adv"),onlineUrl:"https://".concat(n.online,"/gamefunction_logs/applet/onlineTime")}},i.prototype._cacheCommonParams=function(t){this._setStorage(r.COMMON_PARAMS,JSON.stringify(t))},i.prototype._getInitParams=function(){var t,e,o,i=(null===(t=this._systemInfo.system)||void 0===t?void 0:t.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system;return{platform:this._platform,appcqid:c,appqid:c+n(),os:this._systemInfo.platform,osversion:i,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo(),timezone:(e=(new Date).getTimezoneOffset(),o=Math.abs(Math.floor(e/60)),"".concat(e>0?"-":"+").concat(o))}},i.prototype._initCommonParams=function(e){var o,n=this._getInitParams(),i=this._getStorage(r.COMMON_PARAMS);i&&(n=t(t({},n),this._safeJsonParse(i,{}))),e&&(n=t(t({},n),e));var s={platform:this._platform,os:this._systemInfo.platform,osversion:(null===(o=this._systemInfo.system)||void 0===o?void 0:o.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo(n.userinfo)};this._updateCommonParams(t(t(t({},n),s),{obatchid:this._getBatchId()}))},i.prototype._getNetworkType=function(){var t=this;return new Promise((function(e){var o;try{null===(o=t._mp)||void 0===o||o.getNetworkType({success:function(t){var o=((null==t?void 0:t.networkType)||"").toLowerCase();e({wifi:"wifi","2g":"2g","3g":"3g","4g":"4g","5g":"5g",none:"none",unknown:"unknown",ethernet:"wifi",cellular:"4g"}[o]||"unknown")},fail:function(){return e("none")}})}catch(t){console.error("[XLOG] getNetworkType error",t),e("none")}}))},i.prototype._getUserInfo=function(e){var o={};e&&(o=this._safeJsonParse(e,{}));var n={};return this.commonParams.userinfo&&(n=this._safeJsonParse(this.commonParams.userinfo,{})),JSON.stringify(t(t(t({},n),o),this._extraInfo))},i.prototype._filterParams=function(t){var e={};if(t){var o=["openid","unionid","accid","apptypeid","appsubid","appcqid","srcqid","appver","userinfo"];for(var n in t){var i=t[n];o.includes(n)&&i&&(e[n]=i)}}return e},i.prototype.setParams=function(t){if(t){this._consoleLog&&console.log("[XLOG] setParams",t);var e=this._commonParams.openid,o=this._commonParams.unionid;t=this._filterParams(t),this._updateCommonParams(t),(t.openid&&t.openid!==e||t.unionid&&t.unionid!==o)&&this._open({isreturn:t.openid?1:2,openway:0})}},i.prototype._updateCommonParams=function(e){if(this._consoleLog&&console.log("[XLOG] _updateCommonParams",e),e.userinfo){var o=e.appsubid||this._commonParams.appsubid;o&&(e.userinfo=JSON.stringify(t(t({},this._safeJsonParse(e.userinfo,{})),{appsubid:o}))),e.userinfo=this._getUserInfo(e.userinfo)}e.appcqid&&(e.appqid=e.appcqid+n()),e.appver&&(e.appverint=function(t){try{return t&&"string"==typeof t?t.split(".").map((function(t){return 1===t.length?"0"+t:t})).join(""):""}catch(e){return console.error('[transferVersion] ver("'.concat(t,'")格式异常:'),e),""}}(e.appver)),this._commonParams=t(t({},this._commonParams),e),this._cacheCommonParams(this._commonParams)},i.prototype._getAppqid=function(){return this._commonParams.appcqid+n()},i.prototype._getApptypeid=function(t){var e=t||this._commonParams.apptypeid||"";return e||console.warn("[XLOG] apptypeid未配置,请在初始化时传入或调用方法时传入"),e},i.prototype._request=function(t,e,o){var n=this;return void 0===o&&(o="application/x-www-form-urlencoded"),new Promise((function(i,s){var r;try{null===(r=n._mp)||void 0===r||r.request({url:t,data:e,method:"POST",header:{"content-type":o},success:function(o){n._consoleLog&&console.log("[XLOG] SUCCESS: ".concat(t),e,o),i(o)},fail:function(o){n._consoleLog&&console.error("[XLOG] FAIL: ".concat(t),e,o),s(o)}})}catch(t){console.error("[XLOG] request error",t),s(t)}}))},i.prototype.open=function(t){this._open({querystring:t.querystring,isreturn:3,openway:0,manual:!0})},i.prototype._open=function(e){if(this._sendOpenLog||e.manual){var o=this._getLaunchOptions();this._updateQuerystring(o,e.querystring);var n=t(t({},this._commonParams),{appqid:this._getAppqid(),wakeway:e.wakeway||(null==o?void 0:o.scene)||"",openway:e.openway,isreturn:e.isreturn||0,xmlog:a});this._consoleLog&&console.log("[XLOG] PARAMS(OPEN)",n),this._request(this._openUrl,n)}},i.prototype.event=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),event1:e.event1||"",event2:e.event2||"",event3:e.event3||"",event4:e.event4||"",value1:e.value1||"",value2:e.value2||"",value3:e.value3||"",value4:e.value4||""});this._consoleLog&&console.log("[XLOG] PARAMS(EVENT)",o),this._request(this._eventUrl,o)},i.prototype.act=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),actentryid:e.actentryid||"",subactid:e.subactid||"",type:e.type||"",custom:e.custom||"",batchid:e.batchid||""});this._consoleLog&&console.log("[XLOG] PARAMS(ACT)",o),this._request(this._actUrl,o)},i.prototype.ad=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),type:e.type||"",code:e.code||"",codeinfo:e.codeinfo||"",pagetype:e.pagetype||"",gametype:e.gametype||"",adslot:e.adslot||"",adunitid:e.adunitid||"",adbatchid:e.adbatchid||"",ecpm:e.ecpm||""});this._consoleLog&&console.log("[XLOG] PARAMS(AD)",o),this._request(this._adUrl,o,"application/json")},i.prototype._getPlatformPath=function(){var t="";return 1===this._platform?t="wx/":3===this._platform&&(t="ks/"),t},i.prototype._getPlatformStr=function(){var t="DY";return 1===this._platform?t="WX":3===this._platform&&(t="KS"),t},i.prototype.code2session=function(t){var n;return e(this,void 0,void 0,(function(){var e,i,s,r,a;return o(this,(function(o){switch(o.label){case 0:return e=this._getApptypeid(t.apptypeid),i=this._getPlatformPath(),s="".concat(this._businessDomain,"/AppletUtils/").concat(i,"code2session"),[4,this._request(s,{appTypeId:e,code:t.code,testNet:t.testNet},"application/json")];case 1:return r=o.sent(),a=null===(n=r.data)||void 0===n?void 0:n.data,this._sessionInfo=null!=a?a:{},this.setParams({openid:this._sessionInfo.openid,unionid:this._sessionInfo.unionid}),[2,r.data]}}))}))},i.prototype.msgSecCheck=function(t){return e(this,void 0,void 0,(function(){var e,n,i,s,r,a;return o(this,(function(o){switch(o.label){case 0:return 1!==this._platform?(console.warn("[XLOG] msgSecCheck 仅支持微信小程序/小游戏平台"),[2]):(e=(t.content||"").trim())?(n=this._getApptypeid(t.apptypeid),(i=t.openid||this._sessionInfo.openid||this._commonParams.openid)?((s="number"==typeof t.scene?t.scene:4)!==(r=s>=1&&s<=5?s:4)&&console.warn("[XLOG] msgSecCheck scene超出范围,已回退为4"),a="".concat(this._businessDomain,"/AppletUtils/wx/msgCheck"),this._consoleLog&&console.log("[XLOG] PARAMS(MSG_SEC_CHECK)",{appTypeId:n,openid:i,scene:r,content:e}),[4,this._request(a,{appTypeId:n,openid:i,scene:r,content:e},"application/json")]):(console.warn("[XLOG] msgSecCheck openid不存在,请先登录(调用方法code2session)或手动传入openid",this._sessionInfo),[2])):(console.warn("[XLOG] msgSecCheck content不能为空"),[2]);case 1:return[2,o.sent().data]}}))}))},i.prototype.isLogin=function(){return!!this._sessionInfo.openid||(console.warn("[XLOG] checkLogin","openid不存在,请检查是否已经调用过登录(code2session)。"),!1)},i.prototype.getSubsidy=function(t){return void 0===t&&(t={}),e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/subsidy"),{apptypeid:e,os:this._systemInfo.platform,openId:n},"application/json")]):(console.warn("[XLOG] getSubsidy 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},i.prototype.getUserProps=function(t){return void 0===t&&(t={}),e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/userProps"),{appTypeId:e,openId:n},"application/json")]):(console.warn("[XLOG] getUserProps 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},i.prototype._sleep=function(t){return void 0===t&&(t=1e3),e(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new Promise((function(e,o){setTimeout(e,t)}))]}))}))},i.prototype._checkOrderAfterPayment=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this._sleep()];case 1:return o.sent(),[4,this.checkOrder({orderId:n})];case 2:return e=o.sent(),[2,{payResult:1===Number(null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.payResult)?1:0}];case 3:return r=o.sent(),console.error("[XLOG] 订单校验 err: ",r,t({orderId:n},i)),[2,{payResult:0}];case 4:return[2]}}))}))},i.prototype._payWx=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r,a,c,p,l,u,d,h,m,_,f,y,v,g,I=this;return o(this,(function(o){switch(o.label){case 0:if(this._consoleLog&&console.log('[XLOG] 当前平台: "'.concat(this._systemInfo.platform,'"')),e="ios"===(this._systemInfo.platform||"").toLowerCase(),r=i.orderId,a=i.payContent,p=(c=a||{}).offerId,l=c.zone_id,u=c.env,d=c.buy_quantity,h=c.kfMessageTitle,m=c.kfMessageImg,!e)return[3,4];_={sessionFrom:n.sessionFrom,showMessageCard:null===(s=n.showMessageCard)||void 0===s||s,sendMessageTitle:n.sendMessageTitle||h,sendMessagePath:n.sendMessagePath,sendMessageImg:n.sendMessageImg||m},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,new Promise((function(e,o){var n;null===(n=I._mp)||void 0===n||n.openCustomerServiceConversation(t(t({},_),{success:e,fail:o}))}))];case 2:return v=o.sent(),this._consoleLog&&console.log("[XLOG] 进入客服会话",v),[2,{payResult:-1}];case 3:return f=o.sent(),console.error("[XLOG] 取消进入客服会话",f,_),[2,{payResult:0}];case 4:y={mode:"game",env:1===Number(u)?1:0,offerId:p,currencyType:"CNY",platform:"android",buyQuantity:Number(d||n.buyQuantity),zoneId:l,outTradeNo:r},o.label=5;case 5:return o.trys.push([5,7,,8]),[4,new Promise((function(e,o){var n;null===(n=I._mp)||void 0===n||n.requestMidasPayment(t(t({},y),{success:e,fail:o}))}))];case 6:return v=o.sent(),this._consoleLog&&console.log("[XLOG] 微信虚拟支付",v),[3,8];case 7:return g=o.sent(),console.error("[XLOG] 微信虚拟支付 err: ",g,y),[2,{payResult:0}];case 8:return[2,this._checkOrderAfterPayment(r,y)]}}))}))},i.prototype._payDy=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r,a,c,p,l,u,d,h,m,_,f,y,v,g=this;return o(this,(function(o){switch(o.label){case 0:if(e=i.orderId,r=i.payContent,c=(a=r||{}).zone_id,p=a.env,l=a.buy_quantity,u=a.extraInfo,d="ios"===(this._systemInfo.platform||"").toLowerCase(),h="windows"===(this._systemInfo.platform||"").toLowerCase(),!d)return[3,5];if(!(null===(s=this._mp)||void 0===s?void 0:s.openAwemeCustomerService))return console.error("[XLOG] 当前抖音基础库不支持 openAwemeCustomerService"),[2,{payResult:0}];m={currencyType:"DIAMOND",buyQuantity:Number(l||n.buyQuantity),zoneId:c||"1",customId:e,extraInfo:u},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,new Promise((function(e,o){var n;null===(n=g._mp)||void 0===n||n.openAwemeCustomerService(t(t({},m),{success:e,fail:o}))}))];case 2:return y=o.sent(),this._consoleLog&&console.log("[XLOG] 抖音 iOS 客服支付",y),[3,4];case 3:return _=o.sent(),console.error("[XLOG] 抖音 iOS 客服支付 err: ",_,m),[2,{payResult:0}];case 4:return[2,this._checkOrderAfterPayment(e,m)];case 5:f={mode:"game",env:1===Number(p)?1:0,currencyType:"CNY",platform:h?"windows":"android",buyQuantity:Number(l||n.buyQuantity),zoneId:c||"1",customId:e,extraInfo:u},o.label=6;case 6:return o.trys.push([6,8,,9]),[4,new Promise((function(e,o){var n;null===(n=g._mp)||void 0===n||n.requestGamePayment(t(t({},f),{success:e,fail:o}))}))];case 7:return y=o.sent(),this._consoleLog&&console.log("[XLOG] 抖音支付",y),[3,9];case 8:return v=o.sent(),console.error("[XLOG] 抖音支付 err: ",v,f),[2,{payResult:0}];case 9:return[2,this._checkOrderAfterPayment(e,f)]}}))}))},i.prototype.pay=function(t){return e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this._consoleLog&&console.log("[XLOG] pay params: ",t),"WX"!==(e=this._getPlatformStr())&&"DY"!==e?(console.error("[XLOG] 支付目前只支持微信/抖音平台,当前平台: ".concat(e||"UNKNOWN")),[2,{payResult:0}]):[4,this.createOrder(t)];case 1:return(null==(n=o.sent())?void 0:n.data)?"WX"===e?[2,this._payWx(t,n.data)]:[2,this._payDy(t,n.data)]:(console.error("[XLOG] 未获取到订单信息"),[2,{payResult:0}])}}))}))},i.prototype.checkOrder=function(t){return e(this,void 0,void 0,(function(){var e,n,i,s,r;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._getPlatformPath(),i=this._sessionInfo,s=i.openid,r=i.session_key,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/").concat(n,"chkOrder"),{appTypeId:e,orderId:t.orderId,os:this._systemInfo.platform,openId:s,sessionKey:r},"application/json")]):(console.warn("[XLOG] checkOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},i.prototype.createOrder=function(t){return e(this,void 0,void 0,(function(){var e,n,i;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,i=this._getPlatformStr(),[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/crtOrder"),{appTypeId:e,productId:t.productId,extInfo:t.extInfo,os:this._systemInfo.platform,payPlatform:i,openId:n},"application/json")]):(console.warn("[XLOG] createOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},i.prototype._sendOnline=function(){var e=Date.now(),o=Math.max(0,e-this._startTime),n=t(t({},this._commonParams),{appqid:this._getAppqid(),onlinetime:"".concat(o),endtime:e.toString(),starttime:this._startTime.toString()});this._online([n])},i.prototype._setOnlineBatchData=function(t){this._setStorage(r.ONLINE_BATCH_DATA,t)},i.prototype._getOnlineBatchData=function(){try{var t=this._getStorage(r.ONLINE_BATCH_DATA);if(Array.isArray(t))return t;if("string"==typeof t&&t){var e=this._safeJsonParse(t,[]);return Array.isArray(e)?e:[]}return[]}catch(t){return console.error("[XLOG] get online batch data error",t),[]}},i.prototype._clearOnlineBatchData=function(){this._setStorage(r.ONLINE_BATCH_DATA,"")},i.prototype._online=function(t){var e=this;t&&0!==t.length&&(this._consoleLog&&console.log("[XLOG] PARAMS(ONLINE)",t),this._clearOnlineBatchData(),this._request(this._onlineUrl,{batch:JSON.stringify(t)}).catch((function(o){console.error("[XLOG] Online log report failed, caching batch data",o),e._setOnlineBatchData(t)})))},i.prototype._initIAAPlugin=function(){var t;if(1===this._platform)try{if("undefined"==typeof requirePlugin)return void console.error("[XLOG:IAA] 环境不支持requirePlugin");var e=null===(t=requirePlugin("MiniGameCommon",{enableRequireHostModule:!0,customEnv:{wx:"undefined"!=typeof wx?wx:null}}))||void 0===t?void 0:t.default;if("function"!=typeof e)return void console.error("[XLOG:IAA] 插件加载失败,无法获取createMiniGameCommon");this._miniGameCommon=e(),this._miniGameCommon&&this._miniGameCommon.canIUse?("undefined"!=typeof GameGlobal&&(GameGlobal.miniGameCommon=this._miniGameCommon),this._consoleLog&&console.log("[XLOG:IAA] 插件初始化成功")):console.error("[XLOG:IAA] 插件初始化失败")}catch(t){console.error("[XLOG:IAA] 插件初始化异常",t)}else console.warn("[XLOG:IAA] 仅微信小程序支持IAA插件")},i.prototype.iaa=function(t){return e(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return this._miniGameCommon?[2,new Promise((function(i,s){setTimeout((function(){return e(n,void 0,void 0,(function(){var e,n,r,a;return o(this,(function(o){switch(o.label){case 0:e=null,n=t.sessionKey,r=t.reportData,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._miniGameCommon.getUserLabel({reportData:JSON.stringify(r),labelId:"iaa_feature"})];case 2:return e=o.sent(),[3,4];case 3:return a=o.sent(),console.error("[XLOG:IAA] getUserLabel 调用失败:",a),s(a),[2];case 4:return e?(this._consoleLog&&console.log("[XLOG:IAA] 平台返回:",e),this._sendIAAData({session_key:n,requestReportData:JSON.stringify(r),iv:e.iv,encryptedData:e.encryptedData}),i(e),[2]):(s(new Error("Platform response is null")),[2])}}))}))}),3e4)}))]:(console.error("[XLOG:IAA] 插件未初始化"),[2])}))}))},i.prototype._sendIAAData=function(t){this._request("".concat(this._businessDomain,"/AppletUtils/util/wx/uploadReportData"),t,"application/json")},i}();exports.XLog=p;
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){return t=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var i in e=arguments[o])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)};function e(t,e,o,n){return new(o||(o=Promise))((function(i,s){function r(t){try{c(n.next(t))}catch(t){s(t)}}function a(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var o,n,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return r.next=a(0),r.throw=a(1),r.return=a(2),"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(c){return function(a){if(o)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(o=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{o=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function n(){var t=new Date,e=t.getFullYear().toString(),o=(t.getMonth()+1).toString(),n=t.getDate().toString();return(e=e.toString().substr(-2))+(o=Number(o)<10?"0"+o:o)+(n=Number(n)<10?"0"+n:n)}"function"==typeof SuppressedError&&SuppressedError;function i(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch(t){return""}}var s,r,a,c="6.1.0",p="organic";exports.EGender=void 0,(s=exports.EGender||(exports.EGender={}))[s.Unknown=0]="Unknown",s[s.Male=1]="Male",s[s.Female=2]="Female",function(t){t[t.WECHAT=1]="WECHAT",t[t.DOUYIN=2]="DOUYIN",t[t.TIKTOK=200]="TIKTOK",t[t.KUAISHOU=3]="KUAISHOU",t[t.BAIDU=4]="BAIDU",t[t.QQ=5]="QQ",t[t.WEB=7]="WEB"}(r||(r={})),function(t){t.BATCH_ID="BATCH_ID",t.COMMON_PARAMS="COMMON_PARAMS",t.ONLINE_BATCH_DATA="ONLINE_BATCH_DATA",t.ACCUMULATED_TIME="ACCUMULATED_TIME"}(a||(a={}));var l=function(){function s(t){var e,o,n=t.domain,s=t.commonParams,r=t.isPro,p=void 0===r||r,l=t.sendOpenLog,u=void 0===l||l,h=t.consoleLog,d=void 0===h||h,m=t.useIAA,_=void 0!==m&&m,f=t.periodicReportInterval,y=void 0===f?0:f;if(this.version=c,this.buildDate="5/21/2026, 2:52:03 PM",this._openUrl="",this._eventUrl="",this._actUrl="",this._adUrl="",this._onlineUrl="",this._businessDomain="",this._geoUrl="",this._startTime=Date.now(),this._commonParams={},this._geoInfo={},this._hasSentColdOpen=!1,this._hasReportedGeoOpen=!1,this._periodicReportInterval=0,this._accumulatedTime=0,this._periodicTimer=null,this._isPro=!0,this._sendOpenLog=!0,this._isColdStartUp=!0,this._systemInfo={},this._mp={},this._consoleLog=!0,this._useIAA=!1,this._sessionInfo={},this._isPro=p,this._sendOpenLog=u,this._consoleLog=d,this._useIAA=_,y>0){var v=y>0?y:10;this._periodicReportInterval=Math.max(1e3*v,5e3)}else this._periodicReportInterval=0;var g=this._getApis(n),I=g.openUrl,O=g.eventUrl,A=g.actUrl,L=g.adUrl,w=g.onlineUrl;this._openUrl=I,this._eventUrl=O,this._actUrl=A,this._adUrl=L,this._onlineUrl=w,this._businessDomain=this._isPro?"https://applet-xx.mop.com":"https://test-applet-xx.mop.com",this._geoUrl=this._isPro?"https://geoapi.huanlewan.net/geo-api/l":"https://test-geoapi.huanlewan.net/geo-api/l";var P,S=this._getMp(),b=S.mp,T=S.platform;this._mp=b,this._platform=T,!b||(P=b)&&0===Object.keys(P).length&&P.constructor===Object?console.error("[XLOG] 日志SDK初始化失败,当前环境为非小程序环境!"):this._consoleLog&&console.log("[XLOG] 小程序对象:",b,"平台类型:",T);try{this._systemInfo=(null===(o=null===(e=this._mp)||void 0===e?void 0:e.getSystemInfoSync)||void 0===o?void 0:o.call(e))||{},this._consoleLog&&console.log("[XLOG] 系统信息:",this._systemInfo)}catch(t){console.error("[XLOG] getSystemInfoSync error",t)}if(this._extraInfo={language:this._systemInfo.language,wxVersion:this._systemInfo.version,SDKVersion:this._systemInfo.SDKVersion,benchmarkLevel:this._systemInfo.benchmarkLevel||-1,theme:this._systemInfo.theme,pixelRatio:this._systemInfo.pixelRatio,tz:i()},this._periodicReportInterval>0){var G=this._getStorage(a.ACCUMULATED_TIME);this._accumulatedTime=G?Number(G):0,this._consoleLog&&console.log("[XLOG] 加载缓存的累计时长:",this._accumulatedTime,"ms")}this._init(s)}return Object.defineProperty(s.prototype,"commonParams",{get:function(){return this._commonParams},enumerable:!1,configurable:!0}),s.prototype._safeJsonParse=function(t,e){try{return t?JSON.parse(t):e}catch(o){return console.error("[XLOG] JSON解析错误:",o,"原始数据:",t),e}},s.prototype._getLaunchOptions=function(){var t,e,o,n,i,s,r,a,c,p,l,u;try{return 2===this._platform?(null===(e=null===(t=this._mp)||void 0===t?void 0:t.getLaunchOptionsSync)||void 0===e?void 0:e.call(t))||null:3===this._platform?(null===(n=null===(o=this._mp)||void 0===o?void 0:o.getLaunchOptionsSync)||void 0===n?void 0:n.call(o))||null:1===this._platform?(null===(s=null===(i=this._mp)||void 0===i?void 0:i.getEnterOptionsSync)||void 0===s?void 0:s.call(i))||(null===(a=null===(r=this._mp)||void 0===r?void 0:r.getLaunchOptionsSync)||void 0===a?void 0:a.call(r))||null:(null===(p=null===(c=this._mp)||void 0===c?void 0:c.getLaunchOptionsSync)||void 0===p?void 0:p.call(c))||(null===(u=null===(l=this._mp)||void 0===l?void 0:l.getEnterOptionsSync)||void 0===u?void 0:u.call(l))||null}catch(t){return console.error("[XLOG] 获取启动参数失败",t),null}},s.prototype._updateQuerystring=function(e,o){void 0===e&&(e=null),void 0===o&&(o={});var n=(null==e?void 0:e.query)?t(t({},e.query),o):o;this._updateCommonParams({srcqid:n.channel||"",userinfo:JSON.stringify({querystring:n})})},s.prototype._init=function(t){var e=this;this._initCommonParams(this._filterParams(t));var o=this._getLaunchOptions();this._updateQuerystring(o),this._loadGeoInfo(),this._coldStartUp(),this._useIAA&&this._initIAAPlugin(),this._visibilityChange((function(){e._isColdStartUp||e._getNetworkType().then((function(t){e._updateCommonParams({network:t}),e._open({openway:1})})),e._startTime=Date.now(),e._periodicReportInterval>0&&e._startPeriodicTimer();var t=e._getOnlineBatchData();t&&t.length>0&&e._online(t)}),(function(){if(e._isColdStartUp=!1,e._open({openway:5}),e._periodicReportInterval>0){e._stopPeriodicTimer();var t=Date.now()-e._startTime;e._accumulatedTime+=t,e._setStorage(a.ACCUMULATED_TIME,e._accumulatedTime.toString()),e._consoleLog&&console.log("[XLOG] 切后台,累计时长:",e._accumulatedTime,"ms")}else e._sendOnline()}))},s.prototype._startPeriodicTimer=function(){var t=this;this._periodicTimer&&clearInterval(this._periodicTimer),this._periodicTimer=setInterval((function(){t._checkPeriodicReport()}),1e3),this._consoleLog&&console.log("[XLOG] 启动定期上报定时器,间隔(ms):",this._periodicReportInterval)},s.prototype._stopPeriodicTimer=function(){this._periodicTimer&&(clearInterval(this._periodicTimer),this._periodicTimer=null,this._consoleLog&&console.log("[XLOG] 停止定期上报定时器"))},s.prototype._checkPeriodicReport=function(){var t=Date.now()-this._startTime,e=this._accumulatedTime+t;if(e>=this._periodicReportInterval){var o=Math.floor(e/this._periodicReportInterval),n=o*this._periodicReportInterval;this._sendPeriodicOnline(n,o),this._accumulatedTime=e-n,this._startTime=Date.now(),this._setStorage(a.ACCUMULATED_TIME,this._accumulatedTime.toString()),this._consoleLog&&console.log("[XLOG] 定期上报 ".concat(o," 次,总计 ").concat(n,"ms,剩余 ").concat(this._accumulatedTime,"ms"))}},s.prototype._sendPeriodicOnline=function(e,o){for(var n=Date.now()-e,i=[],s=0;s<o;s++){var r=n+s*this._periodicReportInterval,a=r+this._periodicReportInterval;i.push(t(t({},this._commonParams),{appqid:this._getAppqid(),onlinetime:this._periodicReportInterval.toString(),endtime:a.toString(),starttime:r.toString()}))}this._online(i)},s.prototype._getMp=function(){var t={mp:null,platform:r.WEB};try{if("undefined"!=typeof TTMinis&&TTMinis.game)return t.mp=TTMinis.game,t.platform=r.TIKTOK,t;if("undefined"!=typeof tt&&tt.getSystemInfoSync){var e=tt.getSystemInfoSync();return t.mp=tt,"TikTok"===e.appName?t.platform=r.TIKTOK:t.platform=r.DOUYIN,t}"undefined"!=typeof ks&&ks.getSystemInfo?(t.mp=ks,t.platform=r.KUAISHOU):"undefined"!=typeof swan&&swan.getSystemInfo?(t.mp=swan,t.platform=r.BAIDU):"undefined"!=typeof qq&&qq.getSystemInfo?(t.mp=qq,t.platform=r.QQ):"undefined"!=typeof wx&&wx.getSystemInfo&&(t.mp=wx,t.platform=r.WECHAT)}catch(t){console.error("[XLOG] Platform detection failed:",t)}return t},s.prototype._visibilityChange=function(t,e){var o,n,i,s,r=this;void 0===t&&(t=function(){}),void 0===e&&(e=function(){});try{var a=(null===(o=this._mp)||void 0===o?void 0:o.onAppShow)||(null===(n=this._mp)||void 0===n?void 0:n.onShow),c=(null===(i=this._mp)||void 0===i?void 0:i.onAppHide)||(null===(s=this._mp)||void 0===s?void 0:s.onHide);a&&a((function(){r._consoleLog&&console.log("[XLOG] onAppShow"),t()})),c&&c((function(){r._consoleLog&&console.log("[XLOG] onAppHide"),e()}))}catch(t){console.error("[XLOG] onAppShow or onAppHide error",t)}},s.prototype._getStorage=function(t){var e;try{var o=null===(e=this._mp)||void 0===e?void 0:e.getStorageSync("XYZ_LOG_".concat(t));return null==o?"":o}catch(t){return console.error("[XLOG] getStorageSync error",t),""}},s.prototype._setStorage=function(t,e){var o;try{null===(o=this._mp)||void 0===o||o.setStorageSync("XYZ_LOG_".concat(t),e)}catch(t){console.error("[XLOG] setStorageSync error",t)}},s.prototype._getBatchId=function(){var t=this._getStorage(a.BATCH_ID);return t||(t=function(t,e){void 0===t&&(t=18),void 0===e&&(e=0);for(var o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[],i=Math.random,s=t,r=e||o.length,a=0;a<s;a++)n[a]=o[0|i()*r];return n.join("")}(),this._setStorage(a.BATCH_ID,t)),t},s.prototype._coldStartUp=function(){var t=this;this._getNetworkType().then((function(e){t._updateCommonParams({network:e}),t._open({openway:0}),t._periodicReportInterval>0&&t._startPeriodicTimer()}))},s.prototype._getApis=function(e){var o=this._isPro?{open:"webopen-inside.tt.cn",event:"webevent-inside.tt.cn",act:"webact-inside.tt.cn",ad:"webadv-inside.tt.cn",online:"webact-inside.tt.cn"}:{open:"test-webopen-inside.tt.cn",event:"test-webevent-inside.tt.cn",act:"test-webact-inside.tt.cn",ad:"test-webadv-inside.tt.cn",online:"test-webact-inside.tt.cn"},n=t(t({},o),e);return{openUrl:"https://".concat(n.open,"/gamefunction_logs/applet/open"),eventUrl:"https://".concat(n.event,"/gamefunction_logs/applet/event"),actUrl:"https://".concat(n.act,"/gamefunction_logs/applet/activity"),adUrl:"https://".concat(n.ad,"/gamefunction_logs/applet/adv"),onlineUrl:"https://".concat(n.online,"/gamefunction_logs/applet/onlineTime")}},s.prototype._cacheCommonParams=function(t){this._setStorage(a.COMMON_PARAMS,JSON.stringify(t))},s.prototype._loadGeoInfo=function(){var n,i,s,a,c;return e(this,void 0,void 0,(function(){var e,p,l,u,h,d,m;return o(this,(function(o){switch(o.label){case 0:if(this._platform!==r.TIKTOK||!this._geoUrl)return[2];e=t(t({},this._commonParams),{appqid:this._getAppqid(),overseas:!0}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._request(this._geoUrl,e,"application/json")];case 2:return p=o.sent(),l=null===(n=p.data)||void 0===n?void 0:n.data,u=(null===(i=null==l?void 0:l.country)||void 0===i?void 0:i.trim())||"",h=(null===(s=null==l?void 0:l.province)||void 0===s?void 0:s.trim())||"",d=(null===(a=null==l?void 0:l.city)||void 0===a?void 0:a.trim())||"",u||h||d?(this._updateGeoInfo({region:u,province:h,city:d}),this._hasSentColdOpen&&!this._hasReportedGeoOpen&&(this._hasReportedGeoOpen=!0,this._open({openway:0,isreturn:4})),[3,4]):(this._consoleLog&&console.warn("[XLOG] Geo info invalid, skip merge",{code:null===(c=p.data)||void 0===c?void 0:c.code,data:l}),[2]);case 3:return m=o.sent(),console.error("[XLOG] load geo info error",m),[3,4];case 4:return[2]}}))}))},s.prototype._updateGeoInfo=function(t){this._geoInfo=this._pickGeoInfo(t),this._updateCommonParams({userinfo:this._commonParams.userinfo||"{}"})},s.prototype._getInitParams=function(){var t,e=(null===(t=this._systemInfo.system)||void 0===t?void 0:t.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system;return{platform:this._platform,appcqid:p,appqid:p+n(),os:this._systemInfo.platform,osversion:e,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo()}},s.prototype._initCommonParams=function(e){var o,n=this._getInitParams(),i=this._getStorage(a.COMMON_PARAMS);i&&(n=t(t({},n),this._safeJsonParse(i,{}))),e&&(n=t(t({},n),e));var s={platform:this._platform,os:this._systemInfo.platform,osversion:(null===(o=this._systemInfo.system)||void 0===o?void 0:o.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo(n.userinfo)};this._updateCommonParams(t(t(t({},n),s),{obatchid:this._getBatchId()}))},s.prototype._getNetworkType=function(){var t=this;return new Promise((function(e){var o;try{null===(o=t._mp)||void 0===o||o.getNetworkType({success:function(t){var o=((null==t?void 0:t.networkType)||"").toLowerCase();e({wifi:"wifi","2g":"2g","3g":"3g","4g":"4g","5g":"5g",none:"none",unknown:"unknown",ethernet:"wifi",cellular:"4g"}[o]||"unknown")},fail:function(){return e("none")}})}catch(t){console.error("[XLOG] getNetworkType error",t),e("none")}}))},s.prototype._getUserInfo=function(e,o){void 0===o&&(o=this._geoInfo);var n={};e&&(n=this._safeJsonParse(e,{}));var i={};this.commonParams.userinfo&&(i=this._safeJsonParse(this.commonParams.userinfo,{}));var s=this._pickGeoInfo(o);return JSON.stringify(t(t(t(t({},i),n),s),this._extraInfo))},s.prototype._pickGeoInfo=function(t){var e={};return t?(t.region&&(e.region=t.region),t.province&&(e.province=t.province),t.city&&(e.city=t.city),e):e},s.prototype._filterParams=function(t){var e={};if(t){var o=["openid","unionid","accid","apptypeid","appsubid","appcqid","srcqid","appver","userinfo"];for(var n in t){var i=t[n];o.includes(n)&&i&&(e[n]=i)}}return e},s.prototype.setParams=function(t){if(t){this._consoleLog&&console.log("[XLOG] setParams",t);var e=this._commonParams.openid,o=this._commonParams.unionid;t=this._filterParams(t),this._updateCommonParams(t),(t.openid&&t.openid!==e||t.unionid&&t.unionid!==o)&&this._open({isreturn:t.openid?1:2,openway:0})}},s.prototype._updateCommonParams=function(e){if(this._consoleLog&&console.log("[XLOG] _updateCommonParams",e),e.userinfo){var o=e.userinfo||this._commonParams.userinfo,i=e.appsubid||this._commonParams.appsubid;e.userinfo=i&&o?JSON.stringify(t(t({},this._safeJsonParse(o,{})),{appsubid:i})):o,e.userinfo=this._getUserInfo(e.userinfo)}e.appcqid&&(e.appqid=e.appcqid+n()),e.appver&&(e.appverint=function(t){try{return t&&"string"==typeof t?t.split(".").map((function(t){return 1===t.length?"0"+t:t})).join(""):""}catch(e){return console.error('[transferVersion] ver("'.concat(t,'")格式异常:'),e),""}}(e.appver)),this._commonParams=t(t({},this._commonParams),e),this._cacheCommonParams(this._commonParams)},s.prototype._getAppqid=function(){return this._commonParams.appcqid+n()},s.prototype._getApptypeid=function(t){var e=t||this._commonParams.apptypeid||"";return e||console.warn("[XLOG] apptypeid未配置,请在初始化时传入或调用方法时传入"),e},s.prototype._request=function(t,e,o){var n=this;return void 0===o&&(o="application/x-www-form-urlencoded"),new Promise((function(i,s){var r;try{null===(r=n._mp)||void 0===r||r.request({url:t,data:e,method:"POST",header:{"content-type":o},success:function(o){n._consoleLog&&console.log("[XLOG] SUCCESS: ".concat(t),e,o),i(o)},fail:function(o){n._consoleLog&&console.error("[XLOG] FAIL: ".concat(t),e,o),s(o)}})}catch(t){console.error("[XLOG] request error",t),s(t)}}))},s.prototype.open=function(t){this._open({querystring:t.querystring,isreturn:3,openway:0,manual:!0})},s.prototype._open=function(e){if(this._sendOpenLog||e.manual){0===e.openway&&(this._hasSentColdOpen=!0);var o=this._getLaunchOptions();this._updateQuerystring(o,e.querystring);var n=t(t({},this._commonParams),{appqid:this._getAppqid(),wakeway:e.wakeway||(null==o?void 0:o.scene)||"",openway:e.openway,isreturn:e.isreturn||0,xmlog:c});this._consoleLog&&console.log("[XLOG] PARAMS(OPEN)",n),this._request(this._openUrl,n)}},s.prototype.event=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),event1:e.event1||"",event2:e.event2||"",event3:e.event3||"",event4:e.event4||"",value1:e.value1||"",value2:e.value2||"",value3:e.value3||"",value4:e.value4||""});this._consoleLog&&console.log("[XLOG] PARAMS(EVENT)",o),this._request(this._eventUrl,o)},s.prototype.act=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),actentryid:e.actentryid||"",subactid:e.subactid||"",type:e.type||"",custom:e.custom||"",batchid:e.batchid||""});this._consoleLog&&console.log("[XLOG] PARAMS(ACT)",o),this._request(this._actUrl,o)},s.prototype.ad=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),type:e.type||"",code:e.code||"",codeinfo:e.codeinfo||"",pagetype:e.pagetype||"",gametype:e.gametype||"",adslot:e.adslot||"",adunitid:e.adunitid||"",adbatchid:e.adbatchid||"",ecpm:e.ecpm||""});this._consoleLog&&console.log("[XLOG] PARAMS(AD)",o),this._request(this._adUrl,o,"application/json")},s.prototype._getPlatformPath=function(){var t="";return 1===this._platform?t="wx/":3===this._platform&&(t="ks/"),t},s.prototype._getPlatformStr=function(){var t="DY";return 1===this._platform?t="WX":3===this._platform&&(t="KS"),t},s.prototype.code2session=function(t){var n;return e(this,void 0,void 0,(function(){var e,i,s,r,a;return o(this,(function(o){switch(o.label){case 0:return e=this._getApptypeid(t.apptypeid),i=this._getPlatformPath(),s="".concat(this._businessDomain,"/AppletUtils/").concat(i,"code2session"),[4,this._request(s,{appTypeId:e,code:t.code,testNet:t.testNet},"application/json")];case 1:return r=o.sent(),a=null===(n=r.data)||void 0===n?void 0:n.data,this._sessionInfo=null!=a?a:{},this.setParams({openid:this._sessionInfo.openid,unionid:this._sessionInfo.unionid}),[2,r.data]}}))}))},s.prototype.msgSecCheck=function(t){return e(this,void 0,void 0,(function(){var e,n,i,s,r,a;return o(this,(function(o){switch(o.label){case 0:return 1!==this._platform?(console.warn("[XLOG] msgSecCheck 仅支持微信小程序/小游戏平台"),[2]):(e=(t.content||"").trim())?(n=this._getApptypeid(t.apptypeid),(i=t.openid||this._sessionInfo.openid||this._commonParams.openid)?((s="number"==typeof t.scene?t.scene:4)!==(r=s>=1&&s<=5?s:4)&&console.warn("[XLOG] msgSecCheck scene超出范围,已回退为4"),a="".concat(this._businessDomain,"/AppletUtils/wx/msgCheck"),this._consoleLog&&console.log("[XLOG] PARAMS(MSG_SEC_CHECK)",{appTypeId:n,openid:i,scene:r,content:e}),[4,this._request(a,{appTypeId:n,openid:i,scene:r,content:e},"application/json")]):(console.warn("[XLOG] msgSecCheck openid不存在,请先登录(调用方法code2session)或手动传入openid",this._sessionInfo),[2])):(console.warn("[XLOG] msgSecCheck content不能为空"),[2]);case 1:return[2,o.sent().data]}}))}))},s.prototype.isLogin=function(){return!!this._sessionInfo.openid||(console.warn("[XLOG] checkLogin","openid不存在,请检查是否已经调用过登录(code2session)。"),!1)},s.prototype.getSubsidy=function(t){return void 0===t&&(t={}),e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/subsidy"),{apptypeid:e,os:this._systemInfo.platform,openId:n},"application/json")]):(console.warn("[XLOG] getSubsidy 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},s.prototype.getUserProps=function(t){return void 0===t&&(t={}),e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/userProps"),{appTypeId:e,openId:n},"application/json")]):(console.warn("[XLOG] getUserProps 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},s.prototype._sleep=function(t){return void 0===t&&(t=1e3),e(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new Promise((function(e){setTimeout(e,t)}))]}))}))},s.prototype._checkOrderAfterPayment=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this._sleep()];case 1:return o.sent(),[4,this.checkOrder({orderId:n})];case 2:return e=o.sent(),[2,{payResult:1===Number(null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.payResult)?1:0}];case 3:return r=o.sent(),console.error("[XLOG] 订单校验 err: ",r,t({orderId:n},i)),[2,{payResult:0}];case 4:return[2]}}))}))},s.prototype._payWx=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r,a,c,p,l,u,h,d,m,_,f,y,v,g,I=this;return o(this,(function(o){switch(o.label){case 0:if(this._consoleLog&&console.log('[XLOG] 当前平台: "'.concat(this._systemInfo.platform,'"')),e="ios"===(this._systemInfo.platform||"").toLowerCase(),r=i.orderId,a=i.payContent,p=(c=a||{}).offerId,l=c.zone_id,u=c.env,h=c.buy_quantity,d=c.kfMessageTitle,m=c.kfMessageImg,!e)return[3,4];_={sessionFrom:n.sessionFrom,showMessageCard:null===(s=n.showMessageCard)||void 0===s||s,sendMessageTitle:n.sendMessageTitle||d,sendMessagePath:n.sendMessagePath,sendMessageImg:n.sendMessageImg||m},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,new Promise((function(e,o){var n;null===(n=I._mp)||void 0===n||n.openCustomerServiceConversation(t(t({},_),{success:e,fail:o}))}))];case 2:return v=o.sent(),this._consoleLog&&console.log("[XLOG] 进入客服会话",v),[2,{payResult:-1}];case 3:return f=o.sent(),console.error("[XLOG] 取消进入客服会话",f,_),[2,{payResult:0}];case 4:y={mode:"game",env:1===Number(u)?1:0,offerId:p,currencyType:"CNY",platform:"android",buyQuantity:Number(h||n.buyQuantity),zoneId:l,outTradeNo:r},o.label=5;case 5:return o.trys.push([5,7,,8]),[4,new Promise((function(e,o){var n;null===(n=I._mp)||void 0===n||n.requestMidasPayment(t(t({},y),{success:e,fail:o}))}))];case 6:return v=o.sent(),this._consoleLog&&console.log("[XLOG] 微信虚拟支付",v),[3,8];case 7:return g=o.sent(),console.error("[XLOG] 微信虚拟支付 err: ",g,y),[2,{payResult:0}];case 8:return[2,this._checkOrderAfterPayment(r,y)]}}))}))},s.prototype._payDy=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r,a,c,p,l,u,h,d,m,_,f,y,v,g=this;return o(this,(function(o){switch(o.label){case 0:if(e=i.orderId,r=i.payContent,c=(a=r||{}).zone_id,p=a.env,l=a.buy_quantity,u=a.extraInfo,h="ios"===(this._systemInfo.platform||"").toLowerCase(),d="windows"===(this._systemInfo.platform||"").toLowerCase(),!h)return[3,5];if(!(null===(s=this._mp)||void 0===s?void 0:s.openAwemeCustomerService))return console.error("[XLOG] 当前抖音基础库不支持 openAwemeCustomerService"),[2,{payResult:0}];m={currencyType:"DIAMOND",buyQuantity:Number(l||n.buyQuantity),zoneId:c||"1",customId:e,extraInfo:u},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,new Promise((function(e,o){var n;null===(n=g._mp)||void 0===n||n.openAwemeCustomerService(t(t({},m),{success:e,fail:o}))}))];case 2:return y=o.sent(),this._consoleLog&&console.log("[XLOG] 抖音 iOS 客服支付",y),[3,4];case 3:return _=o.sent(),console.error("[XLOG] 抖音 iOS 客服支付 err: ",_,m),[2,{payResult:0}];case 4:return[2,this._checkOrderAfterPayment(e,m)];case 5:f={mode:"game",env:1===Number(p)?1:0,currencyType:"CNY",platform:d?"windows":"android",buyQuantity:Number(l||n.buyQuantity),zoneId:c||"1",customId:e,extraInfo:u},o.label=6;case 6:return o.trys.push([6,8,,9]),[4,new Promise((function(e,o){var n;null===(n=g._mp)||void 0===n||n.requestGamePayment(t(t({},f),{success:e,fail:o}))}))];case 7:return y=o.sent(),this._consoleLog&&console.log("[XLOG] 抖音支付",y),[3,9];case 8:return v=o.sent(),console.error("[XLOG] 抖音支付 err: ",v,f),[2,{payResult:0}];case 9:return[2,this._checkOrderAfterPayment(e,f)]}}))}))},s.prototype.pay=function(t){return e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this._consoleLog&&console.log("[XLOG] pay params: ",t),"WX"!==(e=this._getPlatformStr())&&"DY"!==e?(console.error("[XLOG] 支付目前只支持微信/抖音平台,当前平台: ".concat(e||"UNKNOWN")),[2,{payResult:0}]):[4,this.createOrder(t)];case 1:return(null==(n=o.sent())?void 0:n.data)?"WX"===e?[2,this._payWx(t,n.data)]:[2,this._payDy(t,n.data)]:(console.error("[XLOG] 未获取到订单信息"),[2,{payResult:0}])}}))}))},s.prototype.checkOrder=function(t){return e(this,void 0,void 0,(function(){var e,n,i,s,r;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._getPlatformPath(),i=this._sessionInfo,s=i.openid,r=i.session_key,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/").concat(n,"chkOrder"),{appTypeId:e,orderId:t.orderId,os:this._systemInfo.platform,openId:s,sessionKey:r},"application/json")]):(console.warn("[XLOG] checkOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},s.prototype.createOrder=function(t){return e(this,void 0,void 0,(function(){var e,n,i;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,i=this._getPlatformStr(),[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/crtOrder"),{appTypeId:e,productId:t.productId,extInfo:t.extInfo,os:this._systemInfo.platform,payPlatform:i,openId:n},"application/json")]):(console.warn("[XLOG] createOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},s.prototype._sendOnline=function(){var e=Date.now(),o=Math.max(0,e-this._startTime),n=t(t({},this._commonParams),{appqid:this._getAppqid(),onlinetime:"".concat(o),endtime:e.toString(),starttime:this._startTime.toString()});this._online([n])},s.prototype._setOnlineBatchData=function(t){this._setStorage(a.ONLINE_BATCH_DATA,t)},s.prototype._getOnlineBatchData=function(){try{var t=this._getStorage(a.ONLINE_BATCH_DATA);if(Array.isArray(t))return t;if("string"==typeof t&&t){var e=this._safeJsonParse(t,[]);return Array.isArray(e)?e:[]}return[]}catch(t){return console.error("[XLOG] get online batch data error",t),[]}},s.prototype._clearOnlineBatchData=function(){this._setStorage(a.ONLINE_BATCH_DATA,"")},s.prototype._online=function(t){var e=this;t&&0!==t.length&&(this._consoleLog&&console.log("[XLOG] PARAMS(ONLINE)",t),this._clearOnlineBatchData(),this._request(this._onlineUrl,{batch:JSON.stringify(t)}).catch((function(o){console.error("[XLOG] Online log report failed, caching batch data",o),e._setOnlineBatchData(t)})))},s.prototype._initIAAPlugin=function(){var t;if(1===this._platform)try{if("undefined"==typeof requirePlugin)return void console.error("[XLOG:IAA] 环境不支持requirePlugin");var e=null===(t=requirePlugin("MiniGameCommon",{enableRequireHostModule:!0,customEnv:{wx:"undefined"!=typeof wx?wx:null}}))||void 0===t?void 0:t.default;if("function"!=typeof e)return void console.error("[XLOG:IAA] 插件加载失败,无法获取createMiniGameCommon");this._miniGameCommon=e(),this._miniGameCommon&&this._miniGameCommon.canIUse?("undefined"!=typeof GameGlobal&&(GameGlobal.miniGameCommon=this._miniGameCommon),this._consoleLog&&console.log("[XLOG:IAA] 插件初始化成功")):console.error("[XLOG:IAA] 插件初始化失败")}catch(t){console.error("[XLOG:IAA] 插件初始化异常",t)}else console.warn("[XLOG:IAA] 仅微信小程序支持IAA插件")},s.prototype.iaa=function(t){return e(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return this._miniGameCommon?[2,new Promise((function(i,s){setTimeout((function(){return e(n,void 0,void 0,(function(){var e,n,r,a;return o(this,(function(o){switch(o.label){case 0:e=null,n=t.sessionKey,r=t.reportData,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._miniGameCommon.getUserLabel({reportData:JSON.stringify(r),labelId:"iaa_feature"})];case 2:return e=o.sent(),[3,4];case 3:return a=o.sent(),console.error("[XLOG:IAA] getUserLabel 调用失败:",a),s(a),[2];case 4:return e?(this._consoleLog&&console.log("[XLOG:IAA] 平台返回:",e),this._sendIAAData({session_key:n,requestReportData:JSON.stringify(r),iv:e.iv,encryptedData:e.encryptedData}),i(e),[2]):(s(new Error("Platform response is null")),[2])}}))}))}),3e4)}))]:(console.error("[XLOG:IAA] 插件未初始化"),[2])}))}))},s.prototype._sendIAAData=function(t){this._request("".concat(this._businessDomain,"/AppletUtils/util/wx/uploadReportData"),t,"application/json")},s}();exports.XLog=l;
|
package/dist/mp.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @xyz-fe/log v6.0
|
|
2
|
+
* @xyz-fe/log v6.1.0
|
|
3
3
|
* (c) lizhigao <lizhigao@021.com>
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).mp={})}(this,(function(t){"use strict";var e=function(){return e=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var i in e=arguments[o])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e.apply(this,arguments)};function o(t,e,o,n){return new(o||(o=Promise))((function(i,s){function r(t){try{c(n.next(t))}catch(t){s(t)}}function a(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))}function n(t,e){var o,n,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return r.next=a(0),r.throw=a(1),r.return=a(2),"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(c){return function(a){if(o)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(o=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{o=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function i(){var t=new Date,e=t.getFullYear().toString(),o=(t.getMonth()+1).toString(),n=t.getDate().toString();return(e=e.toString().substr(-2))+(o=Number(o)<10?"0"+o:o)+(n=Number(n)<10?"0"+n:n)}"function"==typeof SuppressedError&&SuppressedError;var s,r,a,c="6.0.2",p="organic";t.EGender=void 0,(s=t.EGender||(t.EGender={}))[s.Unknown=0]="Unknown",s[s.Male=1]="Male",s[s.Female=2]="Female",function(t){t[t.WECHAT=1]="WECHAT",t[t.DOUYIN=2]="DOUYIN",t[t.TIKTOK=200]="TIKTOK",t[t.KUAISHOU=3]="KUAISHOU",t[t.BAIDU=4]="BAIDU",t[t.QQ=5]="QQ",t[t.WEB=7]="WEB"}(r||(r={})),function(t){t.BATCH_ID="BATCH_ID",t.COMMON_PARAMS="COMMON_PARAMS",t.ONLINE_BATCH_DATA="ONLINE_BATCH_DATA",t.ACCUMULATED_TIME="ACCUMULATED_TIME"}(a||(a={}));var l=function(){function t(t){var e,o,n=t.domain,i=t.commonParams,s=t.isPro,r=void 0===s||s,p=t.sendOpenLog,l=void 0===p||p,u=t.consoleLog,d=void 0===u||u,h=t.useIAA,m=void 0!==h&&h,_=t.periodicReportInterval,f=void 0===_?0:_;if(this.version=c,this.buildDate="5/13/2026, 2:50:09 PM",this._openUrl="",this._eventUrl="",this._actUrl="",this._adUrl="",this._onlineUrl="",this._businessDomain="",this._startTime=Date.now(),this._commonParams={},this._periodicReportInterval=0,this._accumulatedTime=0,this._periodicTimer=null,this._isPro=!0,this._sendOpenLog=!0,this._isColdStartUp=!0,this._systemInfo={},this._mp={},this._consoleLog=!0,this._useIAA=!1,this._sessionInfo={},this._isPro=r,this._sendOpenLog=l,this._consoleLog=d,this._useIAA=m,f>0){var y=f>0?f:10;this._periodicReportInterval=Math.max(1e3*y,5e3)}else this._periodicReportInterval=0;var v=this._getApis(n),g=v.openUrl,I=v.eventUrl,O=v.actUrl,A=v.adUrl,L=v.onlineUrl;this._openUrl=g,this._eventUrl=I,this._actUrl=O,this._adUrl=A,this._onlineUrl=L,this._businessDomain=this._isPro?"https://applet-xx.mop.com":"https://test-applet-xx.mop.com";var w,b=this._getMp(),P=b.mp,S=b.platform;this._mp=P,this._platform=S,!P||(w=P)&&0===Object.keys(w).length&&w.constructor===Object?console.error("[XLOG] 日志SDK初始化失败,当前环境为非小程序环境!"):this._consoleLog&&console.log("[XLOG] 小程序对象:",P,"平台类型:",S);try{this._systemInfo=(null===(o=null===(e=this._mp)||void 0===e?void 0:e.getSystemInfoSync)||void 0===o?void 0:o.call(e))||{},this._consoleLog&&console.log("[XLOG] 系统信息:",this._systemInfo)}catch(t){console.error("[XLOG] getSystemInfoSync error",t)}if(this._extraInfo={language:this._systemInfo.language,wxVersion:this._systemInfo.version,SDKVersion:this._systemInfo.SDKVersion,benchmarkLevel:this._systemInfo.benchmarkLevel||-1,theme:this._systemInfo.theme,pixelRatio:this._systemInfo.pixelRatio},this._periodicReportInterval>0){var T=this._getStorage(a.ACCUMULATED_TIME);this._accumulatedTime=T?Number(T):0,this._consoleLog&&console.log("[XLOG] 加载缓存的累计时长:",this._accumulatedTime,"ms")}this._init(i)}return Object.defineProperty(t.prototype,"commonParams",{get:function(){return this._commonParams},enumerable:!1,configurable:!0}),t.prototype._safeJsonParse=function(t,e){try{return t?JSON.parse(t):e}catch(o){return console.error("[XLOG] JSON解析错误:",o,"原始数据:",t),e}},t.prototype._getLaunchOptions=function(){var t,e,o,n,i,s,r,a,c,p,l,u;try{return 2===this._platform?(null===(e=null===(t=this._mp)||void 0===t?void 0:t.getLaunchOptionsSync)||void 0===e?void 0:e.call(t))||null:3===this._platform?(null===(n=null===(o=this._mp)||void 0===o?void 0:o.getLaunchOptionsSync)||void 0===n?void 0:n.call(o))||null:1===this._platform?(null===(s=null===(i=this._mp)||void 0===i?void 0:i.getEnterOptionsSync)||void 0===s?void 0:s.call(i))||(null===(a=null===(r=this._mp)||void 0===r?void 0:r.getLaunchOptionsSync)||void 0===a?void 0:a.call(r))||null:(null===(p=null===(c=this._mp)||void 0===c?void 0:c.getLaunchOptionsSync)||void 0===p?void 0:p.call(c))||(null===(u=null===(l=this._mp)||void 0===l?void 0:l.getEnterOptionsSync)||void 0===u?void 0:u.call(l))||null}catch(t){return console.error("[XLOG] 获取启动参数失败",t),null}},t.prototype._updateQuerystring=function(t,o){void 0===t&&(t=null),void 0===o&&(o={});var n=(null==t?void 0:t.query)?e(e({},t.query),o):o;this._updateCommonParams({srcqid:n.channel||"",userinfo:JSON.stringify({querystring:n})})},t.prototype._init=function(t){var e=this;this._initCommonParams(this._filterParams(t));var o=this._getLaunchOptions();this._updateQuerystring(o),this._coldStartUp(),this._useIAA&&this._initIAAPlugin(),this._visibilityChange((function(){e._isColdStartUp||e._getNetworkType().then((function(t){e._updateCommonParams({network:t}),e._open({openway:1})})),e._startTime=Date.now(),e._periodicReportInterval>0&&e._startPeriodicTimer();var t=e._getOnlineBatchData();t&&t.length>0&&e._online(t)}),(function(){if(e._isColdStartUp=!1,e._open({openway:5}),e._periodicReportInterval>0){e._stopPeriodicTimer();var t=Date.now()-e._startTime;e._accumulatedTime+=t,e._setStorage(a.ACCUMULATED_TIME,e._accumulatedTime.toString()),e._consoleLog&&console.log("[XLOG] 切后台,累计时长:",e._accumulatedTime,"ms")}else e._sendOnline()}))},t.prototype._startPeriodicTimer=function(){var t=this;this._periodicTimer&&clearInterval(this._periodicTimer),this._periodicTimer=setInterval((function(){t._checkPeriodicReport()}),1e3),this._consoleLog&&console.log("[XLOG] 启动定期上报定时器,间隔(ms):",this._periodicReportInterval)},t.prototype._stopPeriodicTimer=function(){this._periodicTimer&&(clearInterval(this._periodicTimer),this._periodicTimer=null,this._consoleLog&&console.log("[XLOG] 停止定期上报定时器"))},t.prototype._checkPeriodicReport=function(){var t=Date.now()-this._startTime,e=this._accumulatedTime+t;if(e>=this._periodicReportInterval){var o=Math.floor(e/this._periodicReportInterval),n=o*this._periodicReportInterval;this._sendPeriodicOnline(n,o),this._accumulatedTime=e-n,this._startTime=Date.now(),this._setStorage(a.ACCUMULATED_TIME,this._accumulatedTime.toString()),this._consoleLog&&console.log("[XLOG] 定期上报 ".concat(o," 次,总计 ").concat(n,"ms,剩余 ").concat(this._accumulatedTime,"ms"))}},t.prototype._sendPeriodicOnline=function(t,o){for(var n=Date.now()-t,i=[],s=0;s<o;s++){var r=n+s*this._periodicReportInterval,a=r+this._periodicReportInterval;i.push(e(e({},this._commonParams),{appqid:this._getAppqid(),onlinetime:this._periodicReportInterval.toString(),endtime:a.toString(),starttime:r.toString()}))}this._online(i)},t.prototype._getMp=function(){var t={mp:null,platform:r.WEB};try{if("undefined"!=typeof TTMinis&&TTMinis.game)return t.mp=TTMinis.game,t.platform=r.TIKTOK,t;if("undefined"!=typeof tt&&tt.getSystemInfoSync){var e=tt.getSystemInfoSync();return t.mp=tt,"TikTok"===e.appName?t.platform=r.TIKTOK:t.platform=r.DOUYIN,t}"undefined"!=typeof ks&&ks.getSystemInfo?(t.mp=ks,t.platform=r.KUAISHOU):"undefined"!=typeof swan&&swan.getSystemInfo?(t.mp=swan,t.platform=r.BAIDU):"undefined"!=typeof qq&&qq.getSystemInfo?(t.mp=qq,t.platform=r.QQ):"undefined"!=typeof wx&&wx.getSystemInfo&&(t.mp=wx,t.platform=r.WECHAT)}catch(t){console.error("[XLOG] Platform detection failed:",t)}return t},t.prototype._visibilityChange=function(t,e){var o,n,i,s,r=this;void 0===t&&(t=function(){}),void 0===e&&(e=function(){});try{var a=(null===(o=this._mp)||void 0===o?void 0:o.onAppShow)||(null===(n=this._mp)||void 0===n?void 0:n.onShow),c=(null===(i=this._mp)||void 0===i?void 0:i.onAppHide)||(null===(s=this._mp)||void 0===s?void 0:s.onHide);a&&a((function(){r._consoleLog&&console.log("[XLOG] onAppShow"),t()})),c&&c((function(){r._consoleLog&&console.log("[XLOG] onAppHide"),e()}))}catch(t){console.error("[XLOG] onAppShow or onAppHide error",t)}},t.prototype._getStorage=function(t){var e;try{var o=null===(e=this._mp)||void 0===e?void 0:e.getStorageSync("XYZ_LOG_".concat(t));return null==o?"":o}catch(t){return console.error("[XLOG] getStorageSync error",t),""}},t.prototype._setStorage=function(t,e){var o;try{null===(o=this._mp)||void 0===o||o.setStorageSync("XYZ_LOG_".concat(t),e)}catch(t){console.error("[XLOG] setStorageSync error",t)}},t.prototype._getBatchId=function(){var t=this._getStorage(a.BATCH_ID);return t||(t=function(t,e){void 0===t&&(t=18),void 0===e&&(e=0);for(var o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[],i=Math.random,s=t,r=e||o.length,a=0;a<s;a++)n[a]=o[0|i()*r];return n.join("")}(),this._setStorage(a.BATCH_ID,t)),t},t.prototype._coldStartUp=function(){var t=this;this._getNetworkType().then((function(e){t._updateCommonParams({network:e}),t._open({openway:0}),t._periodicReportInterval>0&&t._startPeriodicTimer()}))},t.prototype._getApis=function(t){var o=this._isPro?{open:"webopen-inside.tt.cn",event:"webevent-inside.tt.cn",act:"webact-inside.tt.cn",ad:"webadv-inside.tt.cn",online:"webact-inside.tt.cn"}:{open:"test-webopen-inside.tt.cn",event:"test-webevent-inside.tt.cn",act:"test-webact-inside.tt.cn",ad:"test-webadv-inside.tt.cn",online:"test-webact-inside.tt.cn"},n=e(e({},o),t);return{openUrl:"https://".concat(n.open,"/gamefunction_logs/applet/open"),eventUrl:"https://".concat(n.event,"/gamefunction_logs/applet/event"),actUrl:"https://".concat(n.act,"/gamefunction_logs/applet/activity"),adUrl:"https://".concat(n.ad,"/gamefunction_logs/applet/adv"),onlineUrl:"https://".concat(n.online,"/gamefunction_logs/applet/onlineTime")}},t.prototype._cacheCommonParams=function(t){this._setStorage(a.COMMON_PARAMS,JSON.stringify(t))},t.prototype._getInitParams=function(){var t,e,o,n=(null===(t=this._systemInfo.system)||void 0===t?void 0:t.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system;return{platform:this._platform,appcqid:p,appqid:p+i(),os:this._systemInfo.platform,osversion:n,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo(),timezone:(e=(new Date).getTimezoneOffset(),o=Math.abs(Math.floor(e/60)),"".concat(e>0?"-":"+").concat(o))}},t.prototype._initCommonParams=function(t){var o,n=this._getInitParams(),i=this._getStorage(a.COMMON_PARAMS);i&&(n=e(e({},n),this._safeJsonParse(i,{}))),t&&(n=e(e({},n),t));var s={platform:this._platform,os:this._systemInfo.platform,osversion:(null===(o=this._systemInfo.system)||void 0===o?void 0:o.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo(n.userinfo)};this._updateCommonParams(e(e(e({},n),s),{obatchid:this._getBatchId()}))},t.prototype._getNetworkType=function(){var t=this;return new Promise((function(e){var o;try{null===(o=t._mp)||void 0===o||o.getNetworkType({success:function(t){var o=((null==t?void 0:t.networkType)||"").toLowerCase();e({wifi:"wifi","2g":"2g","3g":"3g","4g":"4g","5g":"5g",none:"none",unknown:"unknown",ethernet:"wifi",cellular:"4g"}[o]||"unknown")},fail:function(){return e("none")}})}catch(t){console.error("[XLOG] getNetworkType error",t),e("none")}}))},t.prototype._getUserInfo=function(t){var o={};t&&(o=this._safeJsonParse(t,{}));var n={};return this.commonParams.userinfo&&(n=this._safeJsonParse(this.commonParams.userinfo,{})),JSON.stringify(e(e(e({},n),o),this._extraInfo))},t.prototype._filterParams=function(t){var e={};if(t){var o=["openid","unionid","accid","apptypeid","appsubid","appcqid","srcqid","appver","userinfo"];for(var n in t){var i=t[n];o.includes(n)&&i&&(e[n]=i)}}return e},t.prototype.setParams=function(t){if(t){this._consoleLog&&console.log("[XLOG] setParams",t);var e=this._commonParams.openid,o=this._commonParams.unionid;t=this._filterParams(t),this._updateCommonParams(t),(t.openid&&t.openid!==e||t.unionid&&t.unionid!==o)&&this._open({isreturn:t.openid?1:2,openway:0})}},t.prototype._updateCommonParams=function(t){if(this._consoleLog&&console.log("[XLOG] _updateCommonParams",t),t.userinfo){var o=t.appsubid||this._commonParams.appsubid;o&&(t.userinfo=JSON.stringify(e(e({},this._safeJsonParse(t.userinfo,{})),{appsubid:o}))),t.userinfo=this._getUserInfo(t.userinfo)}t.appcqid&&(t.appqid=t.appcqid+i()),t.appver&&(t.appverint=function(t){try{return t&&"string"==typeof t?t.split(".").map((function(t){return 1===t.length?"0"+t:t})).join(""):""}catch(e){return console.error('[transferVersion] ver("'.concat(t,'")格式异常:'),e),""}}(t.appver)),this._commonParams=e(e({},this._commonParams),t),this._cacheCommonParams(this._commonParams)},t.prototype._getAppqid=function(){return this._commonParams.appcqid+i()},t.prototype._getApptypeid=function(t){var e=t||this._commonParams.apptypeid||"";return e||console.warn("[XLOG] apptypeid未配置,请在初始化时传入或调用方法时传入"),e},t.prototype._request=function(t,e,o){var n=this;return void 0===o&&(o="application/x-www-form-urlencoded"),new Promise((function(i,s){var r;try{null===(r=n._mp)||void 0===r||r.request({url:t,data:e,method:"POST",header:{"content-type":o},success:function(o){n._consoleLog&&console.log("[XLOG] SUCCESS: ".concat(t),e,o),i(o)},fail:function(o){n._consoleLog&&console.error("[XLOG] FAIL: ".concat(t),e,o),s(o)}})}catch(t){console.error("[XLOG] request error",t),s(t)}}))},t.prototype.open=function(t){this._open({querystring:t.querystring,isreturn:3,openway:0,manual:!0})},t.prototype._open=function(t){if(this._sendOpenLog||t.manual){var o=this._getLaunchOptions();this._updateQuerystring(o,t.querystring);var n=e(e({},this._commonParams),{appqid:this._getAppqid(),wakeway:t.wakeway||(null==o?void 0:o.scene)||"",openway:t.openway,isreturn:t.isreturn||0,xmlog:c});this._consoleLog&&console.log("[XLOG] PARAMS(OPEN)",n),this._request(this._openUrl,n)}},t.prototype.event=function(t){var o=e(e({},this._commonParams),{appqid:this._getAppqid(),event1:t.event1||"",event2:t.event2||"",event3:t.event3||"",event4:t.event4||"",value1:t.value1||"",value2:t.value2||"",value3:t.value3||"",value4:t.value4||""});this._consoleLog&&console.log("[XLOG] PARAMS(EVENT)",o),this._request(this._eventUrl,o)},t.prototype.act=function(t){var o=e(e({},this._commonParams),{appqid:this._getAppqid(),actentryid:t.actentryid||"",subactid:t.subactid||"",type:t.type||"",custom:t.custom||"",batchid:t.batchid||""});this._consoleLog&&console.log("[XLOG] PARAMS(ACT)",o),this._request(this._actUrl,o)},t.prototype.ad=function(t){var o=e(e({},this._commonParams),{appqid:this._getAppqid(),type:t.type||"",code:t.code||"",codeinfo:t.codeinfo||"",pagetype:t.pagetype||"",gametype:t.gametype||"",adslot:t.adslot||"",adunitid:t.adunitid||"",adbatchid:t.adbatchid||"",ecpm:t.ecpm||""});this._consoleLog&&console.log("[XLOG] PARAMS(AD)",o),this._request(this._adUrl,o,"application/json")},t.prototype._getPlatformPath=function(){var t="";return 1===this._platform?t="wx/":3===this._platform&&(t="ks/"),t},t.prototype._getPlatformStr=function(){var t="DY";return 1===this._platform?t="WX":3===this._platform&&(t="KS"),t},t.prototype.code2session=function(t){var e;return o(this,void 0,void 0,(function(){var o,i,s,r,a;return n(this,(function(n){switch(n.label){case 0:return o=this._getApptypeid(t.apptypeid),i=this._getPlatformPath(),s="".concat(this._businessDomain,"/AppletUtils/").concat(i,"code2session"),[4,this._request(s,{appTypeId:o,code:t.code,testNet:t.testNet},"application/json")];case 1:return r=n.sent(),a=null===(e=r.data)||void 0===e?void 0:e.data,this._sessionInfo=null!=a?a:{},this.setParams({openid:this._sessionInfo.openid,unionid:this._sessionInfo.unionid}),[2,r.data]}}))}))},t.prototype.msgSecCheck=function(t){return o(this,void 0,void 0,(function(){var e,o,i,s,r,a;return n(this,(function(n){switch(n.label){case 0:return 1!==this._platform?(console.warn("[XLOG] msgSecCheck 仅支持微信小程序/小游戏平台"),[2]):(e=(t.content||"").trim())?(o=this._getApptypeid(t.apptypeid),(i=t.openid||this._sessionInfo.openid||this._commonParams.openid)?((s="number"==typeof t.scene?t.scene:4)!==(r=s>=1&&s<=5?s:4)&&console.warn("[XLOG] msgSecCheck scene超出范围,已回退为4"),a="".concat(this._businessDomain,"/AppletUtils/wx/msgCheck"),this._consoleLog&&console.log("[XLOG] PARAMS(MSG_SEC_CHECK)",{appTypeId:o,openid:i,scene:r,content:e}),[4,this._request(a,{appTypeId:o,openid:i,scene:r,content:e},"application/json")]):(console.warn("[XLOG] msgSecCheck openid不存在,请先登录(调用方法code2session)或手动传入openid",this._sessionInfo),[2])):(console.warn("[XLOG] msgSecCheck content不能为空"),[2]);case 1:return[2,n.sent().data]}}))}))},t.prototype.isLogin=function(){return!!this._sessionInfo.openid||(console.warn("[XLOG] checkLogin","openid不存在,请检查是否已经调用过登录(code2session)。"),!1)},t.prototype.getSubsidy=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),o=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/subsidy"),{apptypeid:e,os:this._systemInfo.platform,openId:o},"application/json")]):(console.warn("[XLOG] getSubsidy 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,n.sent().data]}}))}))},t.prototype.getUserProps=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),o=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/userProps"),{appTypeId:e,openId:o},"application/json")]):(console.warn("[XLOG] getUserProps 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,n.sent().data]}}))}))},t.prototype._sleep=function(t){return void 0===t&&(t=1e3),o(this,void 0,void 0,(function(){return n(this,(function(e){return[2,new Promise((function(e,o){setTimeout(e,t)}))]}))}))},t.prototype._checkOrderAfterPayment=function(t,i){var s;return o(this,void 0,void 0,(function(){var o,r;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this._sleep()];case 1:return n.sent(),[4,this.checkOrder({orderId:t})];case 2:return o=n.sent(),[2,{payResult:1===Number(null===(s=null==o?void 0:o.data)||void 0===s?void 0:s.payResult)?1:0}];case 3:return r=n.sent(),console.error("[XLOG] 订单校验 err: ",r,e({orderId:t},i)),[2,{payResult:0}];case 4:return[2]}}))}))},t.prototype._payWx=function(t,i){var s;return o(this,void 0,void 0,(function(){var o,r,a,c,p,l,u,d,h,m,_,f,y,v,g,I=this;return n(this,(function(n){switch(n.label){case 0:if(this._consoleLog&&console.log('[XLOG] 当前平台: "'.concat(this._systemInfo.platform,'"')),o="ios"===(this._systemInfo.platform||"").toLowerCase(),r=i.orderId,a=i.payContent,p=(c=a||{}).offerId,l=c.zone_id,u=c.env,d=c.buy_quantity,h=c.kfMessageTitle,m=c.kfMessageImg,!o)return[3,4];_={sessionFrom:t.sessionFrom,showMessageCard:null===(s=t.showMessageCard)||void 0===s||s,sendMessageTitle:t.sendMessageTitle||h,sendMessagePath:t.sendMessagePath,sendMessageImg:t.sendMessageImg||m},n.label=1;case 1:return n.trys.push([1,3,,4]),[4,new Promise((function(t,o){var n;null===(n=I._mp)||void 0===n||n.openCustomerServiceConversation(e(e({},_),{success:t,fail:o}))}))];case 2:return v=n.sent(),this._consoleLog&&console.log("[XLOG] 进入客服会话",v),[2,{payResult:-1}];case 3:return f=n.sent(),console.error("[XLOG] 取消进入客服会话",f,_),[2,{payResult:0}];case 4:y={mode:"game",env:1===Number(u)?1:0,offerId:p,currencyType:"CNY",platform:"android",buyQuantity:Number(d||t.buyQuantity),zoneId:l,outTradeNo:r},n.label=5;case 5:return n.trys.push([5,7,,8]),[4,new Promise((function(t,o){var n;null===(n=I._mp)||void 0===n||n.requestMidasPayment(e(e({},y),{success:t,fail:o}))}))];case 6:return v=n.sent(),this._consoleLog&&console.log("[XLOG] 微信虚拟支付",v),[3,8];case 7:return g=n.sent(),console.error("[XLOG] 微信虚拟支付 err: ",g,y),[2,{payResult:0}];case 8:return[2,this._checkOrderAfterPayment(r,y)]}}))}))},t.prototype._payDy=function(t,i){var s;return o(this,void 0,void 0,(function(){var o,r,a,c,p,l,u,d,h,m,_,f,y,v,g=this;return n(this,(function(n){switch(n.label){case 0:if(o=i.orderId,r=i.payContent,c=(a=r||{}).zone_id,p=a.env,l=a.buy_quantity,u=a.extraInfo,d="ios"===(this._systemInfo.platform||"").toLowerCase(),h="windows"===(this._systemInfo.platform||"").toLowerCase(),!d)return[3,5];if(!(null===(s=this._mp)||void 0===s?void 0:s.openAwemeCustomerService))return console.error("[XLOG] 当前抖音基础库不支持 openAwemeCustomerService"),[2,{payResult:0}];m={currencyType:"DIAMOND",buyQuantity:Number(l||t.buyQuantity),zoneId:c||"1",customId:o,extraInfo:u},n.label=1;case 1:return n.trys.push([1,3,,4]),[4,new Promise((function(t,o){var n;null===(n=g._mp)||void 0===n||n.openAwemeCustomerService(e(e({},m),{success:t,fail:o}))}))];case 2:return y=n.sent(),this._consoleLog&&console.log("[XLOG] 抖音 iOS 客服支付",y),[3,4];case 3:return _=n.sent(),console.error("[XLOG] 抖音 iOS 客服支付 err: ",_,m),[2,{payResult:0}];case 4:return[2,this._checkOrderAfterPayment(o,m)];case 5:f={mode:"game",env:1===Number(p)?1:0,currencyType:"CNY",platform:h?"windows":"android",buyQuantity:Number(l||t.buyQuantity),zoneId:c||"1",customId:o,extraInfo:u},n.label=6;case 6:return n.trys.push([6,8,,9]),[4,new Promise((function(t,o){var n;null===(n=g._mp)||void 0===n||n.requestGamePayment(e(e({},f),{success:t,fail:o}))}))];case 7:return y=n.sent(),this._consoleLog&&console.log("[XLOG] 抖音支付",y),[3,9];case 8:return v=n.sent(),console.error("[XLOG] 抖音支付 err: ",v,f),[2,{payResult:0}];case 9:return[2,this._checkOrderAfterPayment(o,f)]}}))}))},t.prototype.pay=function(t){return o(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return this._consoleLog&&console.log("[XLOG] pay params: ",t),"WX"!==(e=this._getPlatformStr())&&"DY"!==e?(console.error("[XLOG] 支付目前只支持微信/抖音平台,当前平台: ".concat(e||"UNKNOWN")),[2,{payResult:0}]):[4,this.createOrder(t)];case 1:return(null==(o=n.sent())?void 0:o.data)?"WX"===e?[2,this._payWx(t,o.data)]:[2,this._payDy(t,o.data)]:(console.error("[XLOG] 未获取到订单信息"),[2,{payResult:0}])}}))}))},t.prototype.checkOrder=function(t){return o(this,void 0,void 0,(function(){var e,o,i,s,r;return n(this,(function(n){switch(n.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),o=this._getPlatformPath(),i=this._sessionInfo,s=i.openid,r=i.session_key,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/").concat(o,"chkOrder"),{appTypeId:e,orderId:t.orderId,os:this._systemInfo.platform,openId:s,sessionKey:r},"application/json")]):(console.warn("[XLOG] checkOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,n.sent().data]}}))}))},t.prototype.createOrder=function(t){return o(this,void 0,void 0,(function(){var e,o,i;return n(this,(function(n){switch(n.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),o=this._sessionInfo.openid,i=this._getPlatformStr(),[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/crtOrder"),{appTypeId:e,productId:t.productId,extInfo:t.extInfo,os:this._systemInfo.platform,payPlatform:i,openId:o},"application/json")]):(console.warn("[XLOG] createOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,n.sent().data]}}))}))},t.prototype._sendOnline=function(){var t=Date.now(),o=Math.max(0,t-this._startTime),n=e(e({},this._commonParams),{appqid:this._getAppqid(),onlinetime:"".concat(o),endtime:t.toString(),starttime:this._startTime.toString()});this._online([n])},t.prototype._setOnlineBatchData=function(t){this._setStorage(a.ONLINE_BATCH_DATA,t)},t.prototype._getOnlineBatchData=function(){try{var t=this._getStorage(a.ONLINE_BATCH_DATA);if(Array.isArray(t))return t;if("string"==typeof t&&t){var e=this._safeJsonParse(t,[]);return Array.isArray(e)?e:[]}return[]}catch(t){return console.error("[XLOG] get online batch data error",t),[]}},t.prototype._clearOnlineBatchData=function(){this._setStorage(a.ONLINE_BATCH_DATA,"")},t.prototype._online=function(t){var e=this;t&&0!==t.length&&(this._consoleLog&&console.log("[XLOG] PARAMS(ONLINE)",t),this._clearOnlineBatchData(),this._request(this._onlineUrl,{batch:JSON.stringify(t)}).catch((function(o){console.error("[XLOG] Online log report failed, caching batch data",o),e._setOnlineBatchData(t)})))},t.prototype._initIAAPlugin=function(){var t;if(1===this._platform)try{if("undefined"==typeof requirePlugin)return void console.error("[XLOG:IAA] 环境不支持requirePlugin");var e=null===(t=requirePlugin("MiniGameCommon",{enableRequireHostModule:!0,customEnv:{wx:"undefined"!=typeof wx?wx:null}}))||void 0===t?void 0:t.default;if("function"!=typeof e)return void console.error("[XLOG:IAA] 插件加载失败,无法获取createMiniGameCommon");this._miniGameCommon=e(),this._miniGameCommon&&this._miniGameCommon.canIUse?("undefined"!=typeof GameGlobal&&(GameGlobal.miniGameCommon=this._miniGameCommon),this._consoleLog&&console.log("[XLOG:IAA] 插件初始化成功")):console.error("[XLOG:IAA] 插件初始化失败")}catch(t){console.error("[XLOG:IAA] 插件初始化异常",t)}else console.warn("[XLOG:IAA] 仅微信小程序支持IAA插件")},t.prototype.iaa=function(t){return o(this,void 0,void 0,(function(){var e=this;return n(this,(function(i){return this._miniGameCommon?[2,new Promise((function(i,s){setTimeout((function(){return o(e,void 0,void 0,(function(){var e,o,r,a;return n(this,(function(n){switch(n.label){case 0:e=null,o=t.sessionKey,r=t.reportData,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._miniGameCommon.getUserLabel({reportData:JSON.stringify(r),labelId:"iaa_feature"})];case 2:return e=n.sent(),[3,4];case 3:return a=n.sent(),console.error("[XLOG:IAA] getUserLabel 调用失败:",a),s(a),[2];case 4:return e?(this._consoleLog&&console.log("[XLOG:IAA] 平台返回:",e),this._sendIAAData({session_key:o,requestReportData:JSON.stringify(r),iv:e.iv,encryptedData:e.encryptedData}),i(e),[2]):(s(new Error("Platform response is null")),[2])}}))}))}),3e4)}))]:(console.error("[XLOG:IAA] 插件未初始化"),[2])}))}))},t.prototype._sendIAAData=function(t){this._request("".concat(this._businessDomain,"/AppletUtils/util/wx/uploadReportData"),t,"application/json")},t}();t.XLog=l,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
6
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).mp={})}(this,(function(t){"use strict";var e=function(){return e=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var i in e=arguments[o])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e.apply(this,arguments)};function o(t,e,o,n){return new(o||(o=Promise))((function(i,s){function r(t){try{c(n.next(t))}catch(t){s(t)}}function a(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))}function n(t,e){var o,n,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return r.next=a(0),r.throw=a(1),r.return=a(2),"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(c){return function(a){if(o)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(o=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{o=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function i(){var t=new Date,e=t.getFullYear().toString(),o=(t.getMonth()+1).toString(),n=t.getDate().toString();return(e=e.toString().substr(-2))+(o=Number(o)<10?"0"+o:o)+(n=Number(n)<10?"0"+n:n)}"function"==typeof SuppressedError&&SuppressedError;function s(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch(t){return""}}var r,a,c,p="6.1.0",l="organic";t.EGender=void 0,(r=t.EGender||(t.EGender={}))[r.Unknown=0]="Unknown",r[r.Male=1]="Male",r[r.Female=2]="Female",function(t){t[t.WECHAT=1]="WECHAT",t[t.DOUYIN=2]="DOUYIN",t[t.TIKTOK=200]="TIKTOK",t[t.KUAISHOU=3]="KUAISHOU",t[t.BAIDU=4]="BAIDU",t[t.QQ=5]="QQ",t[t.WEB=7]="WEB"}(a||(a={})),function(t){t.BATCH_ID="BATCH_ID",t.COMMON_PARAMS="COMMON_PARAMS",t.ONLINE_BATCH_DATA="ONLINE_BATCH_DATA",t.ACCUMULATED_TIME="ACCUMULATED_TIME"}(c||(c={}));var u=function(){function t(t){var e,o,n=t.domain,i=t.commonParams,r=t.isPro,a=void 0===r||r,l=t.sendOpenLog,u=void 0===l||l,d=t.consoleLog,h=void 0===d||d,m=t.useIAA,_=void 0!==m&&m,f=t.periodicReportInterval,y=void 0===f?0:f;if(this.version=p,this.buildDate="5/21/2026, 2:52:03 PM",this._openUrl="",this._eventUrl="",this._actUrl="",this._adUrl="",this._onlineUrl="",this._businessDomain="",this._geoUrl="",this._startTime=Date.now(),this._commonParams={},this._geoInfo={},this._hasSentColdOpen=!1,this._hasReportedGeoOpen=!1,this._periodicReportInterval=0,this._accumulatedTime=0,this._periodicTimer=null,this._isPro=!0,this._sendOpenLog=!0,this._isColdStartUp=!0,this._systemInfo={},this._mp={},this._consoleLog=!0,this._useIAA=!1,this._sessionInfo={},this._isPro=a,this._sendOpenLog=u,this._consoleLog=h,this._useIAA=_,y>0){var v=y>0?y:10;this._periodicReportInterval=Math.max(1e3*v,5e3)}else this._periodicReportInterval=0;var g=this._getApis(n),I=g.openUrl,O=g.eventUrl,A=g.actUrl,L=g.adUrl,w=g.onlineUrl;this._openUrl=I,this._eventUrl=O,this._actUrl=A,this._adUrl=L,this._onlineUrl=w,this._businessDomain=this._isPro?"https://applet-xx.mop.com":"https://test-applet-xx.mop.com",this._geoUrl=this._isPro?"https://geoapi.huanlewan.net/geo-api/l":"https://test-geoapi.huanlewan.net/geo-api/l";var P,b=this._getMp(),S=b.mp,T=b.platform;this._mp=S,this._platform=T,!S||(P=S)&&0===Object.keys(P).length&&P.constructor===Object?console.error("[XLOG] 日志SDK初始化失败,当前环境为非小程序环境!"):this._consoleLog&&console.log("[XLOG] 小程序对象:",S,"平台类型:",T);try{this._systemInfo=(null===(o=null===(e=this._mp)||void 0===e?void 0:e.getSystemInfoSync)||void 0===o?void 0:o.call(e))||{},this._consoleLog&&console.log("[XLOG] 系统信息:",this._systemInfo)}catch(t){console.error("[XLOG] getSystemInfoSync error",t)}if(this._extraInfo={language:this._systemInfo.language,wxVersion:this._systemInfo.version,SDKVersion:this._systemInfo.SDKVersion,benchmarkLevel:this._systemInfo.benchmarkLevel||-1,theme:this._systemInfo.theme,pixelRatio:this._systemInfo.pixelRatio,tz:s()},this._periodicReportInterval>0){var G=this._getStorage(c.ACCUMULATED_TIME);this._accumulatedTime=G?Number(G):0,this._consoleLog&&console.log("[XLOG] 加载缓存的累计时长:",this._accumulatedTime,"ms")}this._init(i)}return Object.defineProperty(t.prototype,"commonParams",{get:function(){return this._commonParams},enumerable:!1,configurable:!0}),t.prototype._safeJsonParse=function(t,e){try{return t?JSON.parse(t):e}catch(o){return console.error("[XLOG] JSON解析错误:",o,"原始数据:",t),e}},t.prototype._getLaunchOptions=function(){var t,e,o,n,i,s,r,a,c,p,l,u;try{return 2===this._platform?(null===(e=null===(t=this._mp)||void 0===t?void 0:t.getLaunchOptionsSync)||void 0===e?void 0:e.call(t))||null:3===this._platform?(null===(n=null===(o=this._mp)||void 0===o?void 0:o.getLaunchOptionsSync)||void 0===n?void 0:n.call(o))||null:1===this._platform?(null===(s=null===(i=this._mp)||void 0===i?void 0:i.getEnterOptionsSync)||void 0===s?void 0:s.call(i))||(null===(a=null===(r=this._mp)||void 0===r?void 0:r.getLaunchOptionsSync)||void 0===a?void 0:a.call(r))||null:(null===(p=null===(c=this._mp)||void 0===c?void 0:c.getLaunchOptionsSync)||void 0===p?void 0:p.call(c))||(null===(u=null===(l=this._mp)||void 0===l?void 0:l.getEnterOptionsSync)||void 0===u?void 0:u.call(l))||null}catch(t){return console.error("[XLOG] 获取启动参数失败",t),null}},t.prototype._updateQuerystring=function(t,o){void 0===t&&(t=null),void 0===o&&(o={});var n=(null==t?void 0:t.query)?e(e({},t.query),o):o;this._updateCommonParams({srcqid:n.channel||"",userinfo:JSON.stringify({querystring:n})})},t.prototype._init=function(t){var e=this;this._initCommonParams(this._filterParams(t));var o=this._getLaunchOptions();this._updateQuerystring(o),this._loadGeoInfo(),this._coldStartUp(),this._useIAA&&this._initIAAPlugin(),this._visibilityChange((function(){e._isColdStartUp||e._getNetworkType().then((function(t){e._updateCommonParams({network:t}),e._open({openway:1})})),e._startTime=Date.now(),e._periodicReportInterval>0&&e._startPeriodicTimer();var t=e._getOnlineBatchData();t&&t.length>0&&e._online(t)}),(function(){if(e._isColdStartUp=!1,e._open({openway:5}),e._periodicReportInterval>0){e._stopPeriodicTimer();var t=Date.now()-e._startTime;e._accumulatedTime+=t,e._setStorage(c.ACCUMULATED_TIME,e._accumulatedTime.toString()),e._consoleLog&&console.log("[XLOG] 切后台,累计时长:",e._accumulatedTime,"ms")}else e._sendOnline()}))},t.prototype._startPeriodicTimer=function(){var t=this;this._periodicTimer&&clearInterval(this._periodicTimer),this._periodicTimer=setInterval((function(){t._checkPeriodicReport()}),1e3),this._consoleLog&&console.log("[XLOG] 启动定期上报定时器,间隔(ms):",this._periodicReportInterval)},t.prototype._stopPeriodicTimer=function(){this._periodicTimer&&(clearInterval(this._periodicTimer),this._periodicTimer=null,this._consoleLog&&console.log("[XLOG] 停止定期上报定时器"))},t.prototype._checkPeriodicReport=function(){var t=Date.now()-this._startTime,e=this._accumulatedTime+t;if(e>=this._periodicReportInterval){var o=Math.floor(e/this._periodicReportInterval),n=o*this._periodicReportInterval;this._sendPeriodicOnline(n,o),this._accumulatedTime=e-n,this._startTime=Date.now(),this._setStorage(c.ACCUMULATED_TIME,this._accumulatedTime.toString()),this._consoleLog&&console.log("[XLOG] 定期上报 ".concat(o," 次,总计 ").concat(n,"ms,剩余 ").concat(this._accumulatedTime,"ms"))}},t.prototype._sendPeriodicOnline=function(t,o){for(var n=Date.now()-t,i=[],s=0;s<o;s++){var r=n+s*this._periodicReportInterval,a=r+this._periodicReportInterval;i.push(e(e({},this._commonParams),{appqid:this._getAppqid(),onlinetime:this._periodicReportInterval.toString(),endtime:a.toString(),starttime:r.toString()}))}this._online(i)},t.prototype._getMp=function(){var t={mp:null,platform:a.WEB};try{if("undefined"!=typeof TTMinis&&TTMinis.game)return t.mp=TTMinis.game,t.platform=a.TIKTOK,t;if("undefined"!=typeof tt&&tt.getSystemInfoSync){var e=tt.getSystemInfoSync();return t.mp=tt,"TikTok"===e.appName?t.platform=a.TIKTOK:t.platform=a.DOUYIN,t}"undefined"!=typeof ks&&ks.getSystemInfo?(t.mp=ks,t.platform=a.KUAISHOU):"undefined"!=typeof swan&&swan.getSystemInfo?(t.mp=swan,t.platform=a.BAIDU):"undefined"!=typeof qq&&qq.getSystemInfo?(t.mp=qq,t.platform=a.QQ):"undefined"!=typeof wx&&wx.getSystemInfo&&(t.mp=wx,t.platform=a.WECHAT)}catch(t){console.error("[XLOG] Platform detection failed:",t)}return t},t.prototype._visibilityChange=function(t,e){var o,n,i,s,r=this;void 0===t&&(t=function(){}),void 0===e&&(e=function(){});try{var a=(null===(o=this._mp)||void 0===o?void 0:o.onAppShow)||(null===(n=this._mp)||void 0===n?void 0:n.onShow),c=(null===(i=this._mp)||void 0===i?void 0:i.onAppHide)||(null===(s=this._mp)||void 0===s?void 0:s.onHide);a&&a((function(){r._consoleLog&&console.log("[XLOG] onAppShow"),t()})),c&&c((function(){r._consoleLog&&console.log("[XLOG] onAppHide"),e()}))}catch(t){console.error("[XLOG] onAppShow or onAppHide error",t)}},t.prototype._getStorage=function(t){var e;try{var o=null===(e=this._mp)||void 0===e?void 0:e.getStorageSync("XYZ_LOG_".concat(t));return null==o?"":o}catch(t){return console.error("[XLOG] getStorageSync error",t),""}},t.prototype._setStorage=function(t,e){var o;try{null===(o=this._mp)||void 0===o||o.setStorageSync("XYZ_LOG_".concat(t),e)}catch(t){console.error("[XLOG] setStorageSync error",t)}},t.prototype._getBatchId=function(){var t=this._getStorage(c.BATCH_ID);return t||(t=function(t,e){void 0===t&&(t=18),void 0===e&&(e=0);for(var o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[],i=Math.random,s=t,r=e||o.length,a=0;a<s;a++)n[a]=o[0|i()*r];return n.join("")}(),this._setStorage(c.BATCH_ID,t)),t},t.prototype._coldStartUp=function(){var t=this;this._getNetworkType().then((function(e){t._updateCommonParams({network:e}),t._open({openway:0}),t._periodicReportInterval>0&&t._startPeriodicTimer()}))},t.prototype._getApis=function(t){var o=this._isPro?{open:"webopen-inside.tt.cn",event:"webevent-inside.tt.cn",act:"webact-inside.tt.cn",ad:"webadv-inside.tt.cn",online:"webact-inside.tt.cn"}:{open:"test-webopen-inside.tt.cn",event:"test-webevent-inside.tt.cn",act:"test-webact-inside.tt.cn",ad:"test-webadv-inside.tt.cn",online:"test-webact-inside.tt.cn"},n=e(e({},o),t);return{openUrl:"https://".concat(n.open,"/gamefunction_logs/applet/open"),eventUrl:"https://".concat(n.event,"/gamefunction_logs/applet/event"),actUrl:"https://".concat(n.act,"/gamefunction_logs/applet/activity"),adUrl:"https://".concat(n.ad,"/gamefunction_logs/applet/adv"),onlineUrl:"https://".concat(n.online,"/gamefunction_logs/applet/onlineTime")}},t.prototype._cacheCommonParams=function(t){this._setStorage(c.COMMON_PARAMS,JSON.stringify(t))},t.prototype._loadGeoInfo=function(){var t,i,s,r,c;return o(this,void 0,void 0,(function(){var o,p,l,u,d,h,m;return n(this,(function(n){switch(n.label){case 0:if(this._platform!==a.TIKTOK||!this._geoUrl)return[2];o=e(e({},this._commonParams),{appqid:this._getAppqid(),overseas:!0}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._request(this._geoUrl,o,"application/json")];case 2:return p=n.sent(),l=null===(t=p.data)||void 0===t?void 0:t.data,u=(null===(i=null==l?void 0:l.country)||void 0===i?void 0:i.trim())||"",d=(null===(s=null==l?void 0:l.province)||void 0===s?void 0:s.trim())||"",h=(null===(r=null==l?void 0:l.city)||void 0===r?void 0:r.trim())||"",u||d||h?(this._updateGeoInfo({region:u,province:d,city:h}),this._hasSentColdOpen&&!this._hasReportedGeoOpen&&(this._hasReportedGeoOpen=!0,this._open({openway:0,isreturn:4})),[3,4]):(this._consoleLog&&console.warn("[XLOG] Geo info invalid, skip merge",{code:null===(c=p.data)||void 0===c?void 0:c.code,data:l}),[2]);case 3:return m=n.sent(),console.error("[XLOG] load geo info error",m),[3,4];case 4:return[2]}}))}))},t.prototype._updateGeoInfo=function(t){this._geoInfo=this._pickGeoInfo(t),this._updateCommonParams({userinfo:this._commonParams.userinfo||"{}"})},t.prototype._getInitParams=function(){var t,e=(null===(t=this._systemInfo.system)||void 0===t?void 0:t.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system;return{platform:this._platform,appcqid:l,appqid:l+i(),os:this._systemInfo.platform,osversion:e,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo()}},t.prototype._initCommonParams=function(t){var o,n=this._getInitParams(),i=this._getStorage(c.COMMON_PARAMS);i&&(n=e(e({},n),this._safeJsonParse(i,{}))),t&&(n=e(e({},n),t));var s={platform:this._platform,os:this._systemInfo.platform,osversion:(null===(o=this._systemInfo.system)||void 0===o?void 0:o.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo(n.userinfo)};this._updateCommonParams(e(e(e({},n),s),{obatchid:this._getBatchId()}))},t.prototype._getNetworkType=function(){var t=this;return new Promise((function(e){var o;try{null===(o=t._mp)||void 0===o||o.getNetworkType({success:function(t){var o=((null==t?void 0:t.networkType)||"").toLowerCase();e({wifi:"wifi","2g":"2g","3g":"3g","4g":"4g","5g":"5g",none:"none",unknown:"unknown",ethernet:"wifi",cellular:"4g"}[o]||"unknown")},fail:function(){return e("none")}})}catch(t){console.error("[XLOG] getNetworkType error",t),e("none")}}))},t.prototype._getUserInfo=function(t,o){void 0===o&&(o=this._geoInfo);var n={};t&&(n=this._safeJsonParse(t,{}));var i={};this.commonParams.userinfo&&(i=this._safeJsonParse(this.commonParams.userinfo,{}));var s=this._pickGeoInfo(o);return JSON.stringify(e(e(e(e({},i),n),s),this._extraInfo))},t.prototype._pickGeoInfo=function(t){var e={};return t?(t.region&&(e.region=t.region),t.province&&(e.province=t.province),t.city&&(e.city=t.city),e):e},t.prototype._filterParams=function(t){var e={};if(t){var o=["openid","unionid","accid","apptypeid","appsubid","appcqid","srcqid","appver","userinfo"];for(var n in t){var i=t[n];o.includes(n)&&i&&(e[n]=i)}}return e},t.prototype.setParams=function(t){if(t){this._consoleLog&&console.log("[XLOG] setParams",t);var e=this._commonParams.openid,o=this._commonParams.unionid;t=this._filterParams(t),this._updateCommonParams(t),(t.openid&&t.openid!==e||t.unionid&&t.unionid!==o)&&this._open({isreturn:t.openid?1:2,openway:0})}},t.prototype._updateCommonParams=function(t){if(this._consoleLog&&console.log("[XLOG] _updateCommonParams",t),t.userinfo){var o=t.userinfo||this._commonParams.userinfo,n=t.appsubid||this._commonParams.appsubid;t.userinfo=n&&o?JSON.stringify(e(e({},this._safeJsonParse(o,{})),{appsubid:n})):o,t.userinfo=this._getUserInfo(t.userinfo)}t.appcqid&&(t.appqid=t.appcqid+i()),t.appver&&(t.appverint=function(t){try{return t&&"string"==typeof t?t.split(".").map((function(t){return 1===t.length?"0"+t:t})).join(""):""}catch(e){return console.error('[transferVersion] ver("'.concat(t,'")格式异常:'),e),""}}(t.appver)),this._commonParams=e(e({},this._commonParams),t),this._cacheCommonParams(this._commonParams)},t.prototype._getAppqid=function(){return this._commonParams.appcqid+i()},t.prototype._getApptypeid=function(t){var e=t||this._commonParams.apptypeid||"";return e||console.warn("[XLOG] apptypeid未配置,请在初始化时传入或调用方法时传入"),e},t.prototype._request=function(t,e,o){var n=this;return void 0===o&&(o="application/x-www-form-urlencoded"),new Promise((function(i,s){var r;try{null===(r=n._mp)||void 0===r||r.request({url:t,data:e,method:"POST",header:{"content-type":o},success:function(o){n._consoleLog&&console.log("[XLOG] SUCCESS: ".concat(t),e,o),i(o)},fail:function(o){n._consoleLog&&console.error("[XLOG] FAIL: ".concat(t),e,o),s(o)}})}catch(t){console.error("[XLOG] request error",t),s(t)}}))},t.prototype.open=function(t){this._open({querystring:t.querystring,isreturn:3,openway:0,manual:!0})},t.prototype._open=function(t){if(this._sendOpenLog||t.manual){0===t.openway&&(this._hasSentColdOpen=!0);var o=this._getLaunchOptions();this._updateQuerystring(o,t.querystring);var n=e(e({},this._commonParams),{appqid:this._getAppqid(),wakeway:t.wakeway||(null==o?void 0:o.scene)||"",openway:t.openway,isreturn:t.isreturn||0,xmlog:p});this._consoleLog&&console.log("[XLOG] PARAMS(OPEN)",n),this._request(this._openUrl,n)}},t.prototype.event=function(t){var o=e(e({},this._commonParams),{appqid:this._getAppqid(),event1:t.event1||"",event2:t.event2||"",event3:t.event3||"",event4:t.event4||"",value1:t.value1||"",value2:t.value2||"",value3:t.value3||"",value4:t.value4||""});this._consoleLog&&console.log("[XLOG] PARAMS(EVENT)",o),this._request(this._eventUrl,o)},t.prototype.act=function(t){var o=e(e({},this._commonParams),{appqid:this._getAppqid(),actentryid:t.actentryid||"",subactid:t.subactid||"",type:t.type||"",custom:t.custom||"",batchid:t.batchid||""});this._consoleLog&&console.log("[XLOG] PARAMS(ACT)",o),this._request(this._actUrl,o)},t.prototype.ad=function(t){var o=e(e({},this._commonParams),{appqid:this._getAppqid(),type:t.type||"",code:t.code||"",codeinfo:t.codeinfo||"",pagetype:t.pagetype||"",gametype:t.gametype||"",adslot:t.adslot||"",adunitid:t.adunitid||"",adbatchid:t.adbatchid||"",ecpm:t.ecpm||""});this._consoleLog&&console.log("[XLOG] PARAMS(AD)",o),this._request(this._adUrl,o,"application/json")},t.prototype._getPlatformPath=function(){var t="";return 1===this._platform?t="wx/":3===this._platform&&(t="ks/"),t},t.prototype._getPlatformStr=function(){var t="DY";return 1===this._platform?t="WX":3===this._platform&&(t="KS"),t},t.prototype.code2session=function(t){var e;return o(this,void 0,void 0,(function(){var o,i,s,r,a;return n(this,(function(n){switch(n.label){case 0:return o=this._getApptypeid(t.apptypeid),i=this._getPlatformPath(),s="".concat(this._businessDomain,"/AppletUtils/").concat(i,"code2session"),[4,this._request(s,{appTypeId:o,code:t.code,testNet:t.testNet},"application/json")];case 1:return r=n.sent(),a=null===(e=r.data)||void 0===e?void 0:e.data,this._sessionInfo=null!=a?a:{},this.setParams({openid:this._sessionInfo.openid,unionid:this._sessionInfo.unionid}),[2,r.data]}}))}))},t.prototype.msgSecCheck=function(t){return o(this,void 0,void 0,(function(){var e,o,i,s,r,a;return n(this,(function(n){switch(n.label){case 0:return 1!==this._platform?(console.warn("[XLOG] msgSecCheck 仅支持微信小程序/小游戏平台"),[2]):(e=(t.content||"").trim())?(o=this._getApptypeid(t.apptypeid),(i=t.openid||this._sessionInfo.openid||this._commonParams.openid)?((s="number"==typeof t.scene?t.scene:4)!==(r=s>=1&&s<=5?s:4)&&console.warn("[XLOG] msgSecCheck scene超出范围,已回退为4"),a="".concat(this._businessDomain,"/AppletUtils/wx/msgCheck"),this._consoleLog&&console.log("[XLOG] PARAMS(MSG_SEC_CHECK)",{appTypeId:o,openid:i,scene:r,content:e}),[4,this._request(a,{appTypeId:o,openid:i,scene:r,content:e},"application/json")]):(console.warn("[XLOG] msgSecCheck openid不存在,请先登录(调用方法code2session)或手动传入openid",this._sessionInfo),[2])):(console.warn("[XLOG] msgSecCheck content不能为空"),[2]);case 1:return[2,n.sent().data]}}))}))},t.prototype.isLogin=function(){return!!this._sessionInfo.openid||(console.warn("[XLOG] checkLogin","openid不存在,请检查是否已经调用过登录(code2session)。"),!1)},t.prototype.getSubsidy=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),o=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/subsidy"),{apptypeid:e,os:this._systemInfo.platform,openId:o},"application/json")]):(console.warn("[XLOG] getSubsidy 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,n.sent().data]}}))}))},t.prototype.getUserProps=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),o=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/userProps"),{appTypeId:e,openId:o},"application/json")]):(console.warn("[XLOG] getUserProps 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,n.sent().data]}}))}))},t.prototype._sleep=function(t){return void 0===t&&(t=1e3),o(this,void 0,void 0,(function(){return n(this,(function(e){return[2,new Promise((function(e){setTimeout(e,t)}))]}))}))},t.prototype._checkOrderAfterPayment=function(t,i){var s;return o(this,void 0,void 0,(function(){var o,r;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this._sleep()];case 1:return n.sent(),[4,this.checkOrder({orderId:t})];case 2:return o=n.sent(),[2,{payResult:1===Number(null===(s=null==o?void 0:o.data)||void 0===s?void 0:s.payResult)?1:0}];case 3:return r=n.sent(),console.error("[XLOG] 订单校验 err: ",r,e({orderId:t},i)),[2,{payResult:0}];case 4:return[2]}}))}))},t.prototype._payWx=function(t,i){var s;return o(this,void 0,void 0,(function(){var o,r,a,c,p,l,u,d,h,m,_,f,y,v,g,I=this;return n(this,(function(n){switch(n.label){case 0:if(this._consoleLog&&console.log('[XLOG] 当前平台: "'.concat(this._systemInfo.platform,'"')),o="ios"===(this._systemInfo.platform||"").toLowerCase(),r=i.orderId,a=i.payContent,p=(c=a||{}).offerId,l=c.zone_id,u=c.env,d=c.buy_quantity,h=c.kfMessageTitle,m=c.kfMessageImg,!o)return[3,4];_={sessionFrom:t.sessionFrom,showMessageCard:null===(s=t.showMessageCard)||void 0===s||s,sendMessageTitle:t.sendMessageTitle||h,sendMessagePath:t.sendMessagePath,sendMessageImg:t.sendMessageImg||m},n.label=1;case 1:return n.trys.push([1,3,,4]),[4,new Promise((function(t,o){var n;null===(n=I._mp)||void 0===n||n.openCustomerServiceConversation(e(e({},_),{success:t,fail:o}))}))];case 2:return v=n.sent(),this._consoleLog&&console.log("[XLOG] 进入客服会话",v),[2,{payResult:-1}];case 3:return f=n.sent(),console.error("[XLOG] 取消进入客服会话",f,_),[2,{payResult:0}];case 4:y={mode:"game",env:1===Number(u)?1:0,offerId:p,currencyType:"CNY",platform:"android",buyQuantity:Number(d||t.buyQuantity),zoneId:l,outTradeNo:r},n.label=5;case 5:return n.trys.push([5,7,,8]),[4,new Promise((function(t,o){var n;null===(n=I._mp)||void 0===n||n.requestMidasPayment(e(e({},y),{success:t,fail:o}))}))];case 6:return v=n.sent(),this._consoleLog&&console.log("[XLOG] 微信虚拟支付",v),[3,8];case 7:return g=n.sent(),console.error("[XLOG] 微信虚拟支付 err: ",g,y),[2,{payResult:0}];case 8:return[2,this._checkOrderAfterPayment(r,y)]}}))}))},t.prototype._payDy=function(t,i){var s;return o(this,void 0,void 0,(function(){var o,r,a,c,p,l,u,d,h,m,_,f,y,v,g=this;return n(this,(function(n){switch(n.label){case 0:if(o=i.orderId,r=i.payContent,c=(a=r||{}).zone_id,p=a.env,l=a.buy_quantity,u=a.extraInfo,d="ios"===(this._systemInfo.platform||"").toLowerCase(),h="windows"===(this._systemInfo.platform||"").toLowerCase(),!d)return[3,5];if(!(null===(s=this._mp)||void 0===s?void 0:s.openAwemeCustomerService))return console.error("[XLOG] 当前抖音基础库不支持 openAwemeCustomerService"),[2,{payResult:0}];m={currencyType:"DIAMOND",buyQuantity:Number(l||t.buyQuantity),zoneId:c||"1",customId:o,extraInfo:u},n.label=1;case 1:return n.trys.push([1,3,,4]),[4,new Promise((function(t,o){var n;null===(n=g._mp)||void 0===n||n.openAwemeCustomerService(e(e({},m),{success:t,fail:o}))}))];case 2:return y=n.sent(),this._consoleLog&&console.log("[XLOG] 抖音 iOS 客服支付",y),[3,4];case 3:return _=n.sent(),console.error("[XLOG] 抖音 iOS 客服支付 err: ",_,m),[2,{payResult:0}];case 4:return[2,this._checkOrderAfterPayment(o,m)];case 5:f={mode:"game",env:1===Number(p)?1:0,currencyType:"CNY",platform:h?"windows":"android",buyQuantity:Number(l||t.buyQuantity),zoneId:c||"1",customId:o,extraInfo:u},n.label=6;case 6:return n.trys.push([6,8,,9]),[4,new Promise((function(t,o){var n;null===(n=g._mp)||void 0===n||n.requestGamePayment(e(e({},f),{success:t,fail:o}))}))];case 7:return y=n.sent(),this._consoleLog&&console.log("[XLOG] 抖音支付",y),[3,9];case 8:return v=n.sent(),console.error("[XLOG] 抖音支付 err: ",v,f),[2,{payResult:0}];case 9:return[2,this._checkOrderAfterPayment(o,f)]}}))}))},t.prototype.pay=function(t){return o(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return this._consoleLog&&console.log("[XLOG] pay params: ",t),"WX"!==(e=this._getPlatformStr())&&"DY"!==e?(console.error("[XLOG] 支付目前只支持微信/抖音平台,当前平台: ".concat(e||"UNKNOWN")),[2,{payResult:0}]):[4,this.createOrder(t)];case 1:return(null==(o=n.sent())?void 0:o.data)?"WX"===e?[2,this._payWx(t,o.data)]:[2,this._payDy(t,o.data)]:(console.error("[XLOG] 未获取到订单信息"),[2,{payResult:0}])}}))}))},t.prototype.checkOrder=function(t){return o(this,void 0,void 0,(function(){var e,o,i,s,r;return n(this,(function(n){switch(n.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),o=this._getPlatformPath(),i=this._sessionInfo,s=i.openid,r=i.session_key,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/").concat(o,"chkOrder"),{appTypeId:e,orderId:t.orderId,os:this._systemInfo.platform,openId:s,sessionKey:r},"application/json")]):(console.warn("[XLOG] checkOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,n.sent().data]}}))}))},t.prototype.createOrder=function(t){return o(this,void 0,void 0,(function(){var e,o,i;return n(this,(function(n){switch(n.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),o=this._sessionInfo.openid,i=this._getPlatformStr(),[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/crtOrder"),{appTypeId:e,productId:t.productId,extInfo:t.extInfo,os:this._systemInfo.platform,payPlatform:i,openId:o},"application/json")]):(console.warn("[XLOG] createOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,n.sent().data]}}))}))},t.prototype._sendOnline=function(){var t=Date.now(),o=Math.max(0,t-this._startTime),n=e(e({},this._commonParams),{appqid:this._getAppqid(),onlinetime:"".concat(o),endtime:t.toString(),starttime:this._startTime.toString()});this._online([n])},t.prototype._setOnlineBatchData=function(t){this._setStorage(c.ONLINE_BATCH_DATA,t)},t.prototype._getOnlineBatchData=function(){try{var t=this._getStorage(c.ONLINE_BATCH_DATA);if(Array.isArray(t))return t;if("string"==typeof t&&t){var e=this._safeJsonParse(t,[]);return Array.isArray(e)?e:[]}return[]}catch(t){return console.error("[XLOG] get online batch data error",t),[]}},t.prototype._clearOnlineBatchData=function(){this._setStorage(c.ONLINE_BATCH_DATA,"")},t.prototype._online=function(t){var e=this;t&&0!==t.length&&(this._consoleLog&&console.log("[XLOG] PARAMS(ONLINE)",t),this._clearOnlineBatchData(),this._request(this._onlineUrl,{batch:JSON.stringify(t)}).catch((function(o){console.error("[XLOG] Online log report failed, caching batch data",o),e._setOnlineBatchData(t)})))},t.prototype._initIAAPlugin=function(){var t;if(1===this._platform)try{if("undefined"==typeof requirePlugin)return void console.error("[XLOG:IAA] 环境不支持requirePlugin");var e=null===(t=requirePlugin("MiniGameCommon",{enableRequireHostModule:!0,customEnv:{wx:"undefined"!=typeof wx?wx:null}}))||void 0===t?void 0:t.default;if("function"!=typeof e)return void console.error("[XLOG:IAA] 插件加载失败,无法获取createMiniGameCommon");this._miniGameCommon=e(),this._miniGameCommon&&this._miniGameCommon.canIUse?("undefined"!=typeof GameGlobal&&(GameGlobal.miniGameCommon=this._miniGameCommon),this._consoleLog&&console.log("[XLOG:IAA] 插件初始化成功")):console.error("[XLOG:IAA] 插件初始化失败")}catch(t){console.error("[XLOG:IAA] 插件初始化异常",t)}else console.warn("[XLOG:IAA] 仅微信小程序支持IAA插件")},t.prototype.iaa=function(t){return o(this,void 0,void 0,(function(){var e=this;return n(this,(function(i){return this._miniGameCommon?[2,new Promise((function(i,s){setTimeout((function(){return o(e,void 0,void 0,(function(){var e,o,r,a;return n(this,(function(n){switch(n.label){case 0:e=null,o=t.sessionKey,r=t.reportData,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._miniGameCommon.getUserLabel({reportData:JSON.stringify(r),labelId:"iaa_feature"})];case 2:return e=n.sent(),[3,4];case 3:return a=n.sent(),console.error("[XLOG:IAA] getUserLabel 调用失败:",a),s(a),[2];case 4:return e?(this._consoleLog&&console.log("[XLOG:IAA] 平台返回:",e),this._sendIAAData({session_key:o,requestReportData:JSON.stringify(r),iv:e.iv,encryptedData:e.encryptedData}),i(e),[2]):(s(new Error("Platform response is null")),[2])}}))}))}),3e4)}))]:(console.error("[XLOG:IAA] 插件未初始化"),[2])}))}))},t.prototype._sendIAAData=function(t){this._request("".concat(this._businessDomain,"/AppletUtils/util/wx/uploadReportData"),t,"application/json")},t}();t.XLog=u,Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/dist/mp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @xyz-fe/log v6.0
|
|
2
|
+
* @xyz-fe/log v6.1.0
|
|
3
3
|
* (c) lizhigao <lizhigao@021.com>
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
var t=function(){return t=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var i in e=arguments[o])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)};function e(t,e,o,n){return new(o||(o=Promise))((function(i,s){function r(t){try{c(n.next(t))}catch(t){s(t)}}function a(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var o,n,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return r.next=a(0),r.throw=a(1),r.return=a(2),"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(c){return function(a){if(o)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(o=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{o=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function n(){var t=new Date,e=t.getFullYear().toString(),o=(t.getMonth()+1).toString(),n=t.getDate().toString();return(e=e.toString().substr(-2))+(o=Number(o)<10?"0"+o:o)+(n=Number(n)<10?"0"+n:n)}"function"==typeof SuppressedError&&SuppressedError;var i,s,r,a="6.0.2",c="organic";!function(t){t[t.Unknown=0]="Unknown",t[t.Male=1]="Male",t[t.Female=2]="Female"}(i||(i={})),function(t){t[t.WECHAT=1]="WECHAT",t[t.DOUYIN=2]="DOUYIN",t[t.TIKTOK=200]="TIKTOK",t[t.KUAISHOU=3]="KUAISHOU",t[t.BAIDU=4]="BAIDU",t[t.QQ=5]="QQ",t[t.WEB=7]="WEB"}(s||(s={})),function(t){t.BATCH_ID="BATCH_ID",t.COMMON_PARAMS="COMMON_PARAMS",t.ONLINE_BATCH_DATA="ONLINE_BATCH_DATA",t.ACCUMULATED_TIME="ACCUMULATED_TIME"}(r||(r={}));var p=function(){function i(t){var e,o,n=t.domain,i=t.commonParams,s=t.isPro,c=void 0===s||s,p=t.sendOpenLog,l=void 0===p||p,u=t.consoleLog,h=void 0===u||u,d=t.useIAA,m=void 0!==d&&d,_=t.periodicReportInterval,f=void 0===_?0:_;if(this.version=a,this.buildDate="5/13/2026, 2:50:09 PM",this._openUrl="",this._eventUrl="",this._actUrl="",this._adUrl="",this._onlineUrl="",this._businessDomain="",this._startTime=Date.now(),this._commonParams={},this._periodicReportInterval=0,this._accumulatedTime=0,this._periodicTimer=null,this._isPro=!0,this._sendOpenLog=!0,this._isColdStartUp=!0,this._systemInfo={},this._mp={},this._consoleLog=!0,this._useIAA=!1,this._sessionInfo={},this._isPro=c,this._sendOpenLog=l,this._consoleLog=h,this._useIAA=m,f>0){var y=f>0?f:10;this._periodicReportInterval=Math.max(1e3*y,5e3)}else this._periodicReportInterval=0;var v=this._getApis(n),g=v.openUrl,I=v.eventUrl,O=v.actUrl,A=v.adUrl,L=v.onlineUrl;this._openUrl=g,this._eventUrl=I,this._actUrl=O,this._adUrl=A,this._onlineUrl=L,this._businessDomain=this._isPro?"https://applet-xx.mop.com":"https://test-applet-xx.mop.com";var w,P=this._getMp(),b=P.mp,S=P.platform;this._mp=b,this._platform=S,!b||(w=b)&&0===Object.keys(w).length&&w.constructor===Object?console.error("[XLOG] 日志SDK初始化失败,当前环境为非小程序环境!"):this._consoleLog&&console.log("[XLOG] 小程序对象:",b,"平台类型:",S);try{this._systemInfo=(null===(o=null===(e=this._mp)||void 0===e?void 0:e.getSystemInfoSync)||void 0===o?void 0:o.call(e))||{},this._consoleLog&&console.log("[XLOG] 系统信息:",this._systemInfo)}catch(t){console.error("[XLOG] getSystemInfoSync error",t)}if(this._extraInfo={language:this._systemInfo.language,wxVersion:this._systemInfo.version,SDKVersion:this._systemInfo.SDKVersion,benchmarkLevel:this._systemInfo.benchmarkLevel||-1,theme:this._systemInfo.theme,pixelRatio:this._systemInfo.pixelRatio},this._periodicReportInterval>0){var T=this._getStorage(r.ACCUMULATED_TIME);this._accumulatedTime=T?Number(T):0,this._consoleLog&&console.log("[XLOG] 加载缓存的累计时长:",this._accumulatedTime,"ms")}this._init(i)}return Object.defineProperty(i.prototype,"commonParams",{get:function(){return this._commonParams},enumerable:!1,configurable:!0}),i.prototype._safeJsonParse=function(t,e){try{return t?JSON.parse(t):e}catch(o){return console.error("[XLOG] JSON解析错误:",o,"原始数据:",t),e}},i.prototype._getLaunchOptions=function(){var t,e,o,n,i,s,r,a,c,p,l,u;try{return 2===this._platform?(null===(e=null===(t=this._mp)||void 0===t?void 0:t.getLaunchOptionsSync)||void 0===e?void 0:e.call(t))||null:3===this._platform?(null===(n=null===(o=this._mp)||void 0===o?void 0:o.getLaunchOptionsSync)||void 0===n?void 0:n.call(o))||null:1===this._platform?(null===(s=null===(i=this._mp)||void 0===i?void 0:i.getEnterOptionsSync)||void 0===s?void 0:s.call(i))||(null===(a=null===(r=this._mp)||void 0===r?void 0:r.getLaunchOptionsSync)||void 0===a?void 0:a.call(r))||null:(null===(p=null===(c=this._mp)||void 0===c?void 0:c.getLaunchOptionsSync)||void 0===p?void 0:p.call(c))||(null===(u=null===(l=this._mp)||void 0===l?void 0:l.getEnterOptionsSync)||void 0===u?void 0:u.call(l))||null}catch(t){return console.error("[XLOG] 获取启动参数失败",t),null}},i.prototype._updateQuerystring=function(e,o){void 0===e&&(e=null),void 0===o&&(o={});var n=(null==e?void 0:e.query)?t(t({},e.query),o):o;this._updateCommonParams({srcqid:n.channel||"",userinfo:JSON.stringify({querystring:n})})},i.prototype._init=function(t){var e=this;this._initCommonParams(this._filterParams(t));var o=this._getLaunchOptions();this._updateQuerystring(o),this._coldStartUp(),this._useIAA&&this._initIAAPlugin(),this._visibilityChange((function(){e._isColdStartUp||e._getNetworkType().then((function(t){e._updateCommonParams({network:t}),e._open({openway:1})})),e._startTime=Date.now(),e._periodicReportInterval>0&&e._startPeriodicTimer();var t=e._getOnlineBatchData();t&&t.length>0&&e._online(t)}),(function(){if(e._isColdStartUp=!1,e._open({openway:5}),e._periodicReportInterval>0){e._stopPeriodicTimer();var t=Date.now()-e._startTime;e._accumulatedTime+=t,e._setStorage(r.ACCUMULATED_TIME,e._accumulatedTime.toString()),e._consoleLog&&console.log("[XLOG] 切后台,累计时长:",e._accumulatedTime,"ms")}else e._sendOnline()}))},i.prototype._startPeriodicTimer=function(){var t=this;this._periodicTimer&&clearInterval(this._periodicTimer),this._periodicTimer=setInterval((function(){t._checkPeriodicReport()}),1e3),this._consoleLog&&console.log("[XLOG] 启动定期上报定时器,间隔(ms):",this._periodicReportInterval)},i.prototype._stopPeriodicTimer=function(){this._periodicTimer&&(clearInterval(this._periodicTimer),this._periodicTimer=null,this._consoleLog&&console.log("[XLOG] 停止定期上报定时器"))},i.prototype._checkPeriodicReport=function(){var t=Date.now()-this._startTime,e=this._accumulatedTime+t;if(e>=this._periodicReportInterval){var o=Math.floor(e/this._periodicReportInterval),n=o*this._periodicReportInterval;this._sendPeriodicOnline(n,o),this._accumulatedTime=e-n,this._startTime=Date.now(),this._setStorage(r.ACCUMULATED_TIME,this._accumulatedTime.toString()),this._consoleLog&&console.log("[XLOG] 定期上报 ".concat(o," 次,总计 ").concat(n,"ms,剩余 ").concat(this._accumulatedTime,"ms"))}},i.prototype._sendPeriodicOnline=function(e,o){for(var n=Date.now()-e,i=[],s=0;s<o;s++){var r=n+s*this._periodicReportInterval,a=r+this._periodicReportInterval;i.push(t(t({},this._commonParams),{appqid:this._getAppqid(),onlinetime:this._periodicReportInterval.toString(),endtime:a.toString(),starttime:r.toString()}))}this._online(i)},i.prototype._getMp=function(){var t={mp:null,platform:s.WEB};try{if("undefined"!=typeof TTMinis&&TTMinis.game)return t.mp=TTMinis.game,t.platform=s.TIKTOK,t;if("undefined"!=typeof tt&&tt.getSystemInfoSync){var e=tt.getSystemInfoSync();return t.mp=tt,"TikTok"===e.appName?t.platform=s.TIKTOK:t.platform=s.DOUYIN,t}"undefined"!=typeof ks&&ks.getSystemInfo?(t.mp=ks,t.platform=s.KUAISHOU):"undefined"!=typeof swan&&swan.getSystemInfo?(t.mp=swan,t.platform=s.BAIDU):"undefined"!=typeof qq&&qq.getSystemInfo?(t.mp=qq,t.platform=s.QQ):"undefined"!=typeof wx&&wx.getSystemInfo&&(t.mp=wx,t.platform=s.WECHAT)}catch(t){console.error("[XLOG] Platform detection failed:",t)}return t},i.prototype._visibilityChange=function(t,e){var o,n,i,s,r=this;void 0===t&&(t=function(){}),void 0===e&&(e=function(){});try{var a=(null===(o=this._mp)||void 0===o?void 0:o.onAppShow)||(null===(n=this._mp)||void 0===n?void 0:n.onShow),c=(null===(i=this._mp)||void 0===i?void 0:i.onAppHide)||(null===(s=this._mp)||void 0===s?void 0:s.onHide);a&&a((function(){r._consoleLog&&console.log("[XLOG] onAppShow"),t()})),c&&c((function(){r._consoleLog&&console.log("[XLOG] onAppHide"),e()}))}catch(t){console.error("[XLOG] onAppShow or onAppHide error",t)}},i.prototype._getStorage=function(t){var e;try{var o=null===(e=this._mp)||void 0===e?void 0:e.getStorageSync("XYZ_LOG_".concat(t));return null==o?"":o}catch(t){return console.error("[XLOG] getStorageSync error",t),""}},i.prototype._setStorage=function(t,e){var o;try{null===(o=this._mp)||void 0===o||o.setStorageSync("XYZ_LOG_".concat(t),e)}catch(t){console.error("[XLOG] setStorageSync error",t)}},i.prototype._getBatchId=function(){var t=this._getStorage(r.BATCH_ID);return t||(t=function(t,e){void 0===t&&(t=18),void 0===e&&(e=0);for(var o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[],i=Math.random,s=t,r=e||o.length,a=0;a<s;a++)n[a]=o[0|i()*r];return n.join("")}(),this._setStorage(r.BATCH_ID,t)),t},i.prototype._coldStartUp=function(){var t=this;this._getNetworkType().then((function(e){t._updateCommonParams({network:e}),t._open({openway:0}),t._periodicReportInterval>0&&t._startPeriodicTimer()}))},i.prototype._getApis=function(e){var o=this._isPro?{open:"webopen-inside.tt.cn",event:"webevent-inside.tt.cn",act:"webact-inside.tt.cn",ad:"webadv-inside.tt.cn",online:"webact-inside.tt.cn"}:{open:"test-webopen-inside.tt.cn",event:"test-webevent-inside.tt.cn",act:"test-webact-inside.tt.cn",ad:"test-webadv-inside.tt.cn",online:"test-webact-inside.tt.cn"},n=t(t({},o),e);return{openUrl:"https://".concat(n.open,"/gamefunction_logs/applet/open"),eventUrl:"https://".concat(n.event,"/gamefunction_logs/applet/event"),actUrl:"https://".concat(n.act,"/gamefunction_logs/applet/activity"),adUrl:"https://".concat(n.ad,"/gamefunction_logs/applet/adv"),onlineUrl:"https://".concat(n.online,"/gamefunction_logs/applet/onlineTime")}},i.prototype._cacheCommonParams=function(t){this._setStorage(r.COMMON_PARAMS,JSON.stringify(t))},i.prototype._getInitParams=function(){var t,e,o,i=(null===(t=this._systemInfo.system)||void 0===t?void 0:t.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system;return{platform:this._platform,appcqid:c,appqid:c+n(),os:this._systemInfo.platform,osversion:i,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo(),timezone:(e=(new Date).getTimezoneOffset(),o=Math.abs(Math.floor(e/60)),"".concat(e>0?"-":"+").concat(o))}},i.prototype._initCommonParams=function(e){var o,n=this._getInitParams(),i=this._getStorage(r.COMMON_PARAMS);i&&(n=t(t({},n),this._safeJsonParse(i,{}))),e&&(n=t(t({},n),e));var s={platform:this._platform,os:this._systemInfo.platform,osversion:(null===(o=this._systemInfo.system)||void 0===o?void 0:o.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo(n.userinfo)};this._updateCommonParams(t(t(t({},n),s),{obatchid:this._getBatchId()}))},i.prototype._getNetworkType=function(){var t=this;return new Promise((function(e){var o;try{null===(o=t._mp)||void 0===o||o.getNetworkType({success:function(t){var o=((null==t?void 0:t.networkType)||"").toLowerCase();e({wifi:"wifi","2g":"2g","3g":"3g","4g":"4g","5g":"5g",none:"none",unknown:"unknown",ethernet:"wifi",cellular:"4g"}[o]||"unknown")},fail:function(){return e("none")}})}catch(t){console.error("[XLOG] getNetworkType error",t),e("none")}}))},i.prototype._getUserInfo=function(e){var o={};e&&(o=this._safeJsonParse(e,{}));var n={};return this.commonParams.userinfo&&(n=this._safeJsonParse(this.commonParams.userinfo,{})),JSON.stringify(t(t(t({},n),o),this._extraInfo))},i.prototype._filterParams=function(t){var e={};if(t){var o=["openid","unionid","accid","apptypeid","appsubid","appcqid","srcqid","appver","userinfo"];for(var n in t){var i=t[n];o.includes(n)&&i&&(e[n]=i)}}return e},i.prototype.setParams=function(t){if(t){this._consoleLog&&console.log("[XLOG] setParams",t);var e=this._commonParams.openid,o=this._commonParams.unionid;t=this._filterParams(t),this._updateCommonParams(t),(t.openid&&t.openid!==e||t.unionid&&t.unionid!==o)&&this._open({isreturn:t.openid?1:2,openway:0})}},i.prototype._updateCommonParams=function(e){if(this._consoleLog&&console.log("[XLOG] _updateCommonParams",e),e.userinfo){var o=e.appsubid||this._commonParams.appsubid;o&&(e.userinfo=JSON.stringify(t(t({},this._safeJsonParse(e.userinfo,{})),{appsubid:o}))),e.userinfo=this._getUserInfo(e.userinfo)}e.appcqid&&(e.appqid=e.appcqid+n()),e.appver&&(e.appverint=function(t){try{return t&&"string"==typeof t?t.split(".").map((function(t){return 1===t.length?"0"+t:t})).join(""):""}catch(e){return console.error('[transferVersion] ver("'.concat(t,'")格式异常:'),e),""}}(e.appver)),this._commonParams=t(t({},this._commonParams),e),this._cacheCommonParams(this._commonParams)},i.prototype._getAppqid=function(){return this._commonParams.appcqid+n()},i.prototype._getApptypeid=function(t){var e=t||this._commonParams.apptypeid||"";return e||console.warn("[XLOG] apptypeid未配置,请在初始化时传入或调用方法时传入"),e},i.prototype._request=function(t,e,o){var n=this;return void 0===o&&(o="application/x-www-form-urlencoded"),new Promise((function(i,s){var r;try{null===(r=n._mp)||void 0===r||r.request({url:t,data:e,method:"POST",header:{"content-type":o},success:function(o){n._consoleLog&&console.log("[XLOG] SUCCESS: ".concat(t),e,o),i(o)},fail:function(o){n._consoleLog&&console.error("[XLOG] FAIL: ".concat(t),e,o),s(o)}})}catch(t){console.error("[XLOG] request error",t),s(t)}}))},i.prototype.open=function(t){this._open({querystring:t.querystring,isreturn:3,openway:0,manual:!0})},i.prototype._open=function(e){if(this._sendOpenLog||e.manual){var o=this._getLaunchOptions();this._updateQuerystring(o,e.querystring);var n=t(t({},this._commonParams),{appqid:this._getAppqid(),wakeway:e.wakeway||(null==o?void 0:o.scene)||"",openway:e.openway,isreturn:e.isreturn||0,xmlog:a});this._consoleLog&&console.log("[XLOG] PARAMS(OPEN)",n),this._request(this._openUrl,n)}},i.prototype.event=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),event1:e.event1||"",event2:e.event2||"",event3:e.event3||"",event4:e.event4||"",value1:e.value1||"",value2:e.value2||"",value3:e.value3||"",value4:e.value4||""});this._consoleLog&&console.log("[XLOG] PARAMS(EVENT)",o),this._request(this._eventUrl,o)},i.prototype.act=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),actentryid:e.actentryid||"",subactid:e.subactid||"",type:e.type||"",custom:e.custom||"",batchid:e.batchid||""});this._consoleLog&&console.log("[XLOG] PARAMS(ACT)",o),this._request(this._actUrl,o)},i.prototype.ad=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),type:e.type||"",code:e.code||"",codeinfo:e.codeinfo||"",pagetype:e.pagetype||"",gametype:e.gametype||"",adslot:e.adslot||"",adunitid:e.adunitid||"",adbatchid:e.adbatchid||"",ecpm:e.ecpm||""});this._consoleLog&&console.log("[XLOG] PARAMS(AD)",o),this._request(this._adUrl,o,"application/json")},i.prototype._getPlatformPath=function(){var t="";return 1===this._platform?t="wx/":3===this._platform&&(t="ks/"),t},i.prototype._getPlatformStr=function(){var t="DY";return 1===this._platform?t="WX":3===this._platform&&(t="KS"),t},i.prototype.code2session=function(t){var n;return e(this,void 0,void 0,(function(){var e,i,s,r,a;return o(this,(function(o){switch(o.label){case 0:return e=this._getApptypeid(t.apptypeid),i=this._getPlatformPath(),s="".concat(this._businessDomain,"/AppletUtils/").concat(i,"code2session"),[4,this._request(s,{appTypeId:e,code:t.code,testNet:t.testNet},"application/json")];case 1:return r=o.sent(),a=null===(n=r.data)||void 0===n?void 0:n.data,this._sessionInfo=null!=a?a:{},this.setParams({openid:this._sessionInfo.openid,unionid:this._sessionInfo.unionid}),[2,r.data]}}))}))},i.prototype.msgSecCheck=function(t){return e(this,void 0,void 0,(function(){var e,n,i,s,r,a;return o(this,(function(o){switch(o.label){case 0:return 1!==this._platform?(console.warn("[XLOG] msgSecCheck 仅支持微信小程序/小游戏平台"),[2]):(e=(t.content||"").trim())?(n=this._getApptypeid(t.apptypeid),(i=t.openid||this._sessionInfo.openid||this._commonParams.openid)?((s="number"==typeof t.scene?t.scene:4)!==(r=s>=1&&s<=5?s:4)&&console.warn("[XLOG] msgSecCheck scene超出范围,已回退为4"),a="".concat(this._businessDomain,"/AppletUtils/wx/msgCheck"),this._consoleLog&&console.log("[XLOG] PARAMS(MSG_SEC_CHECK)",{appTypeId:n,openid:i,scene:r,content:e}),[4,this._request(a,{appTypeId:n,openid:i,scene:r,content:e},"application/json")]):(console.warn("[XLOG] msgSecCheck openid不存在,请先登录(调用方法code2session)或手动传入openid",this._sessionInfo),[2])):(console.warn("[XLOG] msgSecCheck content不能为空"),[2]);case 1:return[2,o.sent().data]}}))}))},i.prototype.isLogin=function(){return!!this._sessionInfo.openid||(console.warn("[XLOG] checkLogin","openid不存在,请检查是否已经调用过登录(code2session)。"),!1)},i.prototype.getSubsidy=function(t){return void 0===t&&(t={}),e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/subsidy"),{apptypeid:e,os:this._systemInfo.platform,openId:n},"application/json")]):(console.warn("[XLOG] getSubsidy 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},i.prototype.getUserProps=function(t){return void 0===t&&(t={}),e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/userProps"),{appTypeId:e,openId:n},"application/json")]):(console.warn("[XLOG] getUserProps 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},i.prototype._sleep=function(t){return void 0===t&&(t=1e3),e(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new Promise((function(e,o){setTimeout(e,t)}))]}))}))},i.prototype._checkOrderAfterPayment=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this._sleep()];case 1:return o.sent(),[4,this.checkOrder({orderId:n})];case 2:return e=o.sent(),[2,{payResult:1===Number(null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.payResult)?1:0}];case 3:return r=o.sent(),console.error("[XLOG] 订单校验 err: ",r,t({orderId:n},i)),[2,{payResult:0}];case 4:return[2]}}))}))},i.prototype._payWx=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r,a,c,p,l,u,h,d,m,_,f,y,v,g,I=this;return o(this,(function(o){switch(o.label){case 0:if(this._consoleLog&&console.log('[XLOG] 当前平台: "'.concat(this._systemInfo.platform,'"')),e="ios"===(this._systemInfo.platform||"").toLowerCase(),r=i.orderId,a=i.payContent,p=(c=a||{}).offerId,l=c.zone_id,u=c.env,h=c.buy_quantity,d=c.kfMessageTitle,m=c.kfMessageImg,!e)return[3,4];_={sessionFrom:n.sessionFrom,showMessageCard:null===(s=n.showMessageCard)||void 0===s||s,sendMessageTitle:n.sendMessageTitle||d,sendMessagePath:n.sendMessagePath,sendMessageImg:n.sendMessageImg||m},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,new Promise((function(e,o){var n;null===(n=I._mp)||void 0===n||n.openCustomerServiceConversation(t(t({},_),{success:e,fail:o}))}))];case 2:return v=o.sent(),this._consoleLog&&console.log("[XLOG] 进入客服会话",v),[2,{payResult:-1}];case 3:return f=o.sent(),console.error("[XLOG] 取消进入客服会话",f,_),[2,{payResult:0}];case 4:y={mode:"game",env:1===Number(u)?1:0,offerId:p,currencyType:"CNY",platform:"android",buyQuantity:Number(h||n.buyQuantity),zoneId:l,outTradeNo:r},o.label=5;case 5:return o.trys.push([5,7,,8]),[4,new Promise((function(e,o){var n;null===(n=I._mp)||void 0===n||n.requestMidasPayment(t(t({},y),{success:e,fail:o}))}))];case 6:return v=o.sent(),this._consoleLog&&console.log("[XLOG] 微信虚拟支付",v),[3,8];case 7:return g=o.sent(),console.error("[XLOG] 微信虚拟支付 err: ",g,y),[2,{payResult:0}];case 8:return[2,this._checkOrderAfterPayment(r,y)]}}))}))},i.prototype._payDy=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r,a,c,p,l,u,h,d,m,_,f,y,v,g=this;return o(this,(function(o){switch(o.label){case 0:if(e=i.orderId,r=i.payContent,c=(a=r||{}).zone_id,p=a.env,l=a.buy_quantity,u=a.extraInfo,h="ios"===(this._systemInfo.platform||"").toLowerCase(),d="windows"===(this._systemInfo.platform||"").toLowerCase(),!h)return[3,5];if(!(null===(s=this._mp)||void 0===s?void 0:s.openAwemeCustomerService))return console.error("[XLOG] 当前抖音基础库不支持 openAwemeCustomerService"),[2,{payResult:0}];m={currencyType:"DIAMOND",buyQuantity:Number(l||n.buyQuantity),zoneId:c||"1",customId:e,extraInfo:u},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,new Promise((function(e,o){var n;null===(n=g._mp)||void 0===n||n.openAwemeCustomerService(t(t({},m),{success:e,fail:o}))}))];case 2:return y=o.sent(),this._consoleLog&&console.log("[XLOG] 抖音 iOS 客服支付",y),[3,4];case 3:return _=o.sent(),console.error("[XLOG] 抖音 iOS 客服支付 err: ",_,m),[2,{payResult:0}];case 4:return[2,this._checkOrderAfterPayment(e,m)];case 5:f={mode:"game",env:1===Number(p)?1:0,currencyType:"CNY",platform:d?"windows":"android",buyQuantity:Number(l||n.buyQuantity),zoneId:c||"1",customId:e,extraInfo:u},o.label=6;case 6:return o.trys.push([6,8,,9]),[4,new Promise((function(e,o){var n;null===(n=g._mp)||void 0===n||n.requestGamePayment(t(t({},f),{success:e,fail:o}))}))];case 7:return y=o.sent(),this._consoleLog&&console.log("[XLOG] 抖音支付",y),[3,9];case 8:return v=o.sent(),console.error("[XLOG] 抖音支付 err: ",v,f),[2,{payResult:0}];case 9:return[2,this._checkOrderAfterPayment(e,f)]}}))}))},i.prototype.pay=function(t){return e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this._consoleLog&&console.log("[XLOG] pay params: ",t),"WX"!==(e=this._getPlatformStr())&&"DY"!==e?(console.error("[XLOG] 支付目前只支持微信/抖音平台,当前平台: ".concat(e||"UNKNOWN")),[2,{payResult:0}]):[4,this.createOrder(t)];case 1:return(null==(n=o.sent())?void 0:n.data)?"WX"===e?[2,this._payWx(t,n.data)]:[2,this._payDy(t,n.data)]:(console.error("[XLOG] 未获取到订单信息"),[2,{payResult:0}])}}))}))},i.prototype.checkOrder=function(t){return e(this,void 0,void 0,(function(){var e,n,i,s,r;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._getPlatformPath(),i=this._sessionInfo,s=i.openid,r=i.session_key,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/").concat(n,"chkOrder"),{appTypeId:e,orderId:t.orderId,os:this._systemInfo.platform,openId:s,sessionKey:r},"application/json")]):(console.warn("[XLOG] checkOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},i.prototype.createOrder=function(t){return e(this,void 0,void 0,(function(){var e,n,i;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,i=this._getPlatformStr(),[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/crtOrder"),{appTypeId:e,productId:t.productId,extInfo:t.extInfo,os:this._systemInfo.platform,payPlatform:i,openId:n},"application/json")]):(console.warn("[XLOG] createOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},i.prototype._sendOnline=function(){var e=Date.now(),o=Math.max(0,e-this._startTime),n=t(t({},this._commonParams),{appqid:this._getAppqid(),onlinetime:"".concat(o),endtime:e.toString(),starttime:this._startTime.toString()});this._online([n])},i.prototype._setOnlineBatchData=function(t){this._setStorage(r.ONLINE_BATCH_DATA,t)},i.prototype._getOnlineBatchData=function(){try{var t=this._getStorage(r.ONLINE_BATCH_DATA);if(Array.isArray(t))return t;if("string"==typeof t&&t){var e=this._safeJsonParse(t,[]);return Array.isArray(e)?e:[]}return[]}catch(t){return console.error("[XLOG] get online batch data error",t),[]}},i.prototype._clearOnlineBatchData=function(){this._setStorage(r.ONLINE_BATCH_DATA,"")},i.prototype._online=function(t){var e=this;t&&0!==t.length&&(this._consoleLog&&console.log("[XLOG] PARAMS(ONLINE)",t),this._clearOnlineBatchData(),this._request(this._onlineUrl,{batch:JSON.stringify(t)}).catch((function(o){console.error("[XLOG] Online log report failed, caching batch data",o),e._setOnlineBatchData(t)})))},i.prototype._initIAAPlugin=function(){var t;if(1===this._platform)try{if("undefined"==typeof requirePlugin)return void console.error("[XLOG:IAA] 环境不支持requirePlugin");var e=null===(t=requirePlugin("MiniGameCommon",{enableRequireHostModule:!0,customEnv:{wx:"undefined"!=typeof wx?wx:null}}))||void 0===t?void 0:t.default;if("function"!=typeof e)return void console.error("[XLOG:IAA] 插件加载失败,无法获取createMiniGameCommon");this._miniGameCommon=e(),this._miniGameCommon&&this._miniGameCommon.canIUse?("undefined"!=typeof GameGlobal&&(GameGlobal.miniGameCommon=this._miniGameCommon),this._consoleLog&&console.log("[XLOG:IAA] 插件初始化成功")):console.error("[XLOG:IAA] 插件初始化失败")}catch(t){console.error("[XLOG:IAA] 插件初始化异常",t)}else console.warn("[XLOG:IAA] 仅微信小程序支持IAA插件")},i.prototype.iaa=function(t){return e(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return this._miniGameCommon?[2,new Promise((function(i,s){setTimeout((function(){return e(n,void 0,void 0,(function(){var e,n,r,a;return o(this,(function(o){switch(o.label){case 0:e=null,n=t.sessionKey,r=t.reportData,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._miniGameCommon.getUserLabel({reportData:JSON.stringify(r),labelId:"iaa_feature"})];case 2:return e=o.sent(),[3,4];case 3:return a=o.sent(),console.error("[XLOG:IAA] getUserLabel 调用失败:",a),s(a),[2];case 4:return e?(this._consoleLog&&console.log("[XLOG:IAA] 平台返回:",e),this._sendIAAData({session_key:n,requestReportData:JSON.stringify(r),iv:e.iv,encryptedData:e.encryptedData}),i(e),[2]):(s(new Error("Platform response is null")),[2])}}))}))}),3e4)}))]:(console.error("[XLOG:IAA] 插件未初始化"),[2])}))}))},i.prototype._sendIAAData=function(t){this._request("".concat(this._businessDomain,"/AppletUtils/util/wx/uploadReportData"),t,"application/json")},i}();export{i as EGender,p as XLog};
|
|
6
|
+
var t=function(){return t=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var i in e=arguments[o])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)};function e(t,e,o,n){return new(o||(o=Promise))((function(i,s){function r(t){try{c(n.next(t))}catch(t){s(t)}}function a(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var o,n,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return r.next=a(0),r.throw=a(1),r.return=a(2),"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(c){return function(a){if(o)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(o=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{o=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function n(){var t=new Date,e=t.getFullYear().toString(),o=(t.getMonth()+1).toString(),n=t.getDate().toString();return(e=e.toString().substr(-2))+(o=Number(o)<10?"0"+o:o)+(n=Number(n)<10?"0"+n:n)}"function"==typeof SuppressedError&&SuppressedError;function i(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch(t){return""}}var s,r,a,c="6.1.0",p="organic";!function(t){t[t.Unknown=0]="Unknown",t[t.Male=1]="Male",t[t.Female=2]="Female"}(s||(s={})),function(t){t[t.WECHAT=1]="WECHAT",t[t.DOUYIN=2]="DOUYIN",t[t.TIKTOK=200]="TIKTOK",t[t.KUAISHOU=3]="KUAISHOU",t[t.BAIDU=4]="BAIDU",t[t.QQ=5]="QQ",t[t.WEB=7]="WEB"}(r||(r={})),function(t){t.BATCH_ID="BATCH_ID",t.COMMON_PARAMS="COMMON_PARAMS",t.ONLINE_BATCH_DATA="ONLINE_BATCH_DATA",t.ACCUMULATED_TIME="ACCUMULATED_TIME"}(a||(a={}));var l=function(){function s(t){var e,o,n=t.domain,s=t.commonParams,r=t.isPro,p=void 0===r||r,l=t.sendOpenLog,u=void 0===l||l,h=t.consoleLog,d=void 0===h||h,m=t.useIAA,_=void 0!==m&&m,f=t.periodicReportInterval,y=void 0===f?0:f;if(this.version=c,this.buildDate="5/21/2026, 2:52:03 PM",this._openUrl="",this._eventUrl="",this._actUrl="",this._adUrl="",this._onlineUrl="",this._businessDomain="",this._geoUrl="",this._startTime=Date.now(),this._commonParams={},this._geoInfo={},this._hasSentColdOpen=!1,this._hasReportedGeoOpen=!1,this._periodicReportInterval=0,this._accumulatedTime=0,this._periodicTimer=null,this._isPro=!0,this._sendOpenLog=!0,this._isColdStartUp=!0,this._systemInfo={},this._mp={},this._consoleLog=!0,this._useIAA=!1,this._sessionInfo={},this._isPro=p,this._sendOpenLog=u,this._consoleLog=d,this._useIAA=_,y>0){var v=y>0?y:10;this._periodicReportInterval=Math.max(1e3*v,5e3)}else this._periodicReportInterval=0;var g=this._getApis(n),I=g.openUrl,O=g.eventUrl,A=g.actUrl,L=g.adUrl,w=g.onlineUrl;this._openUrl=I,this._eventUrl=O,this._actUrl=A,this._adUrl=L,this._onlineUrl=w,this._businessDomain=this._isPro?"https://applet-xx.mop.com":"https://test-applet-xx.mop.com",this._geoUrl=this._isPro?"https://geoapi.huanlewan.net/geo-api/l":"https://test-geoapi.huanlewan.net/geo-api/l";var P,S=this._getMp(),b=S.mp,T=S.platform;this._mp=b,this._platform=T,!b||(P=b)&&0===Object.keys(P).length&&P.constructor===Object?console.error("[XLOG] 日志SDK初始化失败,当前环境为非小程序环境!"):this._consoleLog&&console.log("[XLOG] 小程序对象:",b,"平台类型:",T);try{this._systemInfo=(null===(o=null===(e=this._mp)||void 0===e?void 0:e.getSystemInfoSync)||void 0===o?void 0:o.call(e))||{},this._consoleLog&&console.log("[XLOG] 系统信息:",this._systemInfo)}catch(t){console.error("[XLOG] getSystemInfoSync error",t)}if(this._extraInfo={language:this._systemInfo.language,wxVersion:this._systemInfo.version,SDKVersion:this._systemInfo.SDKVersion,benchmarkLevel:this._systemInfo.benchmarkLevel||-1,theme:this._systemInfo.theme,pixelRatio:this._systemInfo.pixelRatio,tz:i()},this._periodicReportInterval>0){var G=this._getStorage(a.ACCUMULATED_TIME);this._accumulatedTime=G?Number(G):0,this._consoleLog&&console.log("[XLOG] 加载缓存的累计时长:",this._accumulatedTime,"ms")}this._init(s)}return Object.defineProperty(s.prototype,"commonParams",{get:function(){return this._commonParams},enumerable:!1,configurable:!0}),s.prototype._safeJsonParse=function(t,e){try{return t?JSON.parse(t):e}catch(o){return console.error("[XLOG] JSON解析错误:",o,"原始数据:",t),e}},s.prototype._getLaunchOptions=function(){var t,e,o,n,i,s,r,a,c,p,l,u;try{return 2===this._platform?(null===(e=null===(t=this._mp)||void 0===t?void 0:t.getLaunchOptionsSync)||void 0===e?void 0:e.call(t))||null:3===this._platform?(null===(n=null===(o=this._mp)||void 0===o?void 0:o.getLaunchOptionsSync)||void 0===n?void 0:n.call(o))||null:1===this._platform?(null===(s=null===(i=this._mp)||void 0===i?void 0:i.getEnterOptionsSync)||void 0===s?void 0:s.call(i))||(null===(a=null===(r=this._mp)||void 0===r?void 0:r.getLaunchOptionsSync)||void 0===a?void 0:a.call(r))||null:(null===(p=null===(c=this._mp)||void 0===c?void 0:c.getLaunchOptionsSync)||void 0===p?void 0:p.call(c))||(null===(u=null===(l=this._mp)||void 0===l?void 0:l.getEnterOptionsSync)||void 0===u?void 0:u.call(l))||null}catch(t){return console.error("[XLOG] 获取启动参数失败",t),null}},s.prototype._updateQuerystring=function(e,o){void 0===e&&(e=null),void 0===o&&(o={});var n=(null==e?void 0:e.query)?t(t({},e.query),o):o;this._updateCommonParams({srcqid:n.channel||"",userinfo:JSON.stringify({querystring:n})})},s.prototype._init=function(t){var e=this;this._initCommonParams(this._filterParams(t));var o=this._getLaunchOptions();this._updateQuerystring(o),this._loadGeoInfo(),this._coldStartUp(),this._useIAA&&this._initIAAPlugin(),this._visibilityChange((function(){e._isColdStartUp||e._getNetworkType().then((function(t){e._updateCommonParams({network:t}),e._open({openway:1})})),e._startTime=Date.now(),e._periodicReportInterval>0&&e._startPeriodicTimer();var t=e._getOnlineBatchData();t&&t.length>0&&e._online(t)}),(function(){if(e._isColdStartUp=!1,e._open({openway:5}),e._periodicReportInterval>0){e._stopPeriodicTimer();var t=Date.now()-e._startTime;e._accumulatedTime+=t,e._setStorage(a.ACCUMULATED_TIME,e._accumulatedTime.toString()),e._consoleLog&&console.log("[XLOG] 切后台,累计时长:",e._accumulatedTime,"ms")}else e._sendOnline()}))},s.prototype._startPeriodicTimer=function(){var t=this;this._periodicTimer&&clearInterval(this._periodicTimer),this._periodicTimer=setInterval((function(){t._checkPeriodicReport()}),1e3),this._consoleLog&&console.log("[XLOG] 启动定期上报定时器,间隔(ms):",this._periodicReportInterval)},s.prototype._stopPeriodicTimer=function(){this._periodicTimer&&(clearInterval(this._periodicTimer),this._periodicTimer=null,this._consoleLog&&console.log("[XLOG] 停止定期上报定时器"))},s.prototype._checkPeriodicReport=function(){var t=Date.now()-this._startTime,e=this._accumulatedTime+t;if(e>=this._periodicReportInterval){var o=Math.floor(e/this._periodicReportInterval),n=o*this._periodicReportInterval;this._sendPeriodicOnline(n,o),this._accumulatedTime=e-n,this._startTime=Date.now(),this._setStorage(a.ACCUMULATED_TIME,this._accumulatedTime.toString()),this._consoleLog&&console.log("[XLOG] 定期上报 ".concat(o," 次,总计 ").concat(n,"ms,剩余 ").concat(this._accumulatedTime,"ms"))}},s.prototype._sendPeriodicOnline=function(e,o){for(var n=Date.now()-e,i=[],s=0;s<o;s++){var r=n+s*this._periodicReportInterval,a=r+this._periodicReportInterval;i.push(t(t({},this._commonParams),{appqid:this._getAppqid(),onlinetime:this._periodicReportInterval.toString(),endtime:a.toString(),starttime:r.toString()}))}this._online(i)},s.prototype._getMp=function(){var t={mp:null,platform:r.WEB};try{if("undefined"!=typeof TTMinis&&TTMinis.game)return t.mp=TTMinis.game,t.platform=r.TIKTOK,t;if("undefined"!=typeof tt&&tt.getSystemInfoSync){var e=tt.getSystemInfoSync();return t.mp=tt,"TikTok"===e.appName?t.platform=r.TIKTOK:t.platform=r.DOUYIN,t}"undefined"!=typeof ks&&ks.getSystemInfo?(t.mp=ks,t.platform=r.KUAISHOU):"undefined"!=typeof swan&&swan.getSystemInfo?(t.mp=swan,t.platform=r.BAIDU):"undefined"!=typeof qq&&qq.getSystemInfo?(t.mp=qq,t.platform=r.QQ):"undefined"!=typeof wx&&wx.getSystemInfo&&(t.mp=wx,t.platform=r.WECHAT)}catch(t){console.error("[XLOG] Platform detection failed:",t)}return t},s.prototype._visibilityChange=function(t,e){var o,n,i,s,r=this;void 0===t&&(t=function(){}),void 0===e&&(e=function(){});try{var a=(null===(o=this._mp)||void 0===o?void 0:o.onAppShow)||(null===(n=this._mp)||void 0===n?void 0:n.onShow),c=(null===(i=this._mp)||void 0===i?void 0:i.onAppHide)||(null===(s=this._mp)||void 0===s?void 0:s.onHide);a&&a((function(){r._consoleLog&&console.log("[XLOG] onAppShow"),t()})),c&&c((function(){r._consoleLog&&console.log("[XLOG] onAppHide"),e()}))}catch(t){console.error("[XLOG] onAppShow or onAppHide error",t)}},s.prototype._getStorage=function(t){var e;try{var o=null===(e=this._mp)||void 0===e?void 0:e.getStorageSync("XYZ_LOG_".concat(t));return null==o?"":o}catch(t){return console.error("[XLOG] getStorageSync error",t),""}},s.prototype._setStorage=function(t,e){var o;try{null===(o=this._mp)||void 0===o||o.setStorageSync("XYZ_LOG_".concat(t),e)}catch(t){console.error("[XLOG] setStorageSync error",t)}},s.prototype._getBatchId=function(){var t=this._getStorage(a.BATCH_ID);return t||(t=function(t,e){void 0===t&&(t=18),void 0===e&&(e=0);for(var o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[],i=Math.random,s=t,r=e||o.length,a=0;a<s;a++)n[a]=o[0|i()*r];return n.join("")}(),this._setStorage(a.BATCH_ID,t)),t},s.prototype._coldStartUp=function(){var t=this;this._getNetworkType().then((function(e){t._updateCommonParams({network:e}),t._open({openway:0}),t._periodicReportInterval>0&&t._startPeriodicTimer()}))},s.prototype._getApis=function(e){var o=this._isPro?{open:"webopen-inside.tt.cn",event:"webevent-inside.tt.cn",act:"webact-inside.tt.cn",ad:"webadv-inside.tt.cn",online:"webact-inside.tt.cn"}:{open:"test-webopen-inside.tt.cn",event:"test-webevent-inside.tt.cn",act:"test-webact-inside.tt.cn",ad:"test-webadv-inside.tt.cn",online:"test-webact-inside.tt.cn"},n=t(t({},o),e);return{openUrl:"https://".concat(n.open,"/gamefunction_logs/applet/open"),eventUrl:"https://".concat(n.event,"/gamefunction_logs/applet/event"),actUrl:"https://".concat(n.act,"/gamefunction_logs/applet/activity"),adUrl:"https://".concat(n.ad,"/gamefunction_logs/applet/adv"),onlineUrl:"https://".concat(n.online,"/gamefunction_logs/applet/onlineTime")}},s.prototype._cacheCommonParams=function(t){this._setStorage(a.COMMON_PARAMS,JSON.stringify(t))},s.prototype._loadGeoInfo=function(){var n,i,s,a,c;return e(this,void 0,void 0,(function(){var e,p,l,u,h,d,m;return o(this,(function(o){switch(o.label){case 0:if(this._platform!==r.TIKTOK||!this._geoUrl)return[2];e=t(t({},this._commonParams),{appqid:this._getAppqid(),overseas:!0}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._request(this._geoUrl,e,"application/json")];case 2:return p=o.sent(),l=null===(n=p.data)||void 0===n?void 0:n.data,u=(null===(i=null==l?void 0:l.country)||void 0===i?void 0:i.trim())||"",h=(null===(s=null==l?void 0:l.province)||void 0===s?void 0:s.trim())||"",d=(null===(a=null==l?void 0:l.city)||void 0===a?void 0:a.trim())||"",u||h||d?(this._updateGeoInfo({region:u,province:h,city:d}),this._hasSentColdOpen&&!this._hasReportedGeoOpen&&(this._hasReportedGeoOpen=!0,this._open({openway:0,isreturn:4})),[3,4]):(this._consoleLog&&console.warn("[XLOG] Geo info invalid, skip merge",{code:null===(c=p.data)||void 0===c?void 0:c.code,data:l}),[2]);case 3:return m=o.sent(),console.error("[XLOG] load geo info error",m),[3,4];case 4:return[2]}}))}))},s.prototype._updateGeoInfo=function(t){this._geoInfo=this._pickGeoInfo(t),this._updateCommonParams({userinfo:this._commonParams.userinfo||"{}"})},s.prototype._getInitParams=function(){var t,e=(null===(t=this._systemInfo.system)||void 0===t?void 0:t.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system;return{platform:this._platform,appcqid:p,appqid:p+n(),os:this._systemInfo.platform,osversion:e,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo()}},s.prototype._initCommonParams=function(e){var o,n=this._getInitParams(),i=this._getStorage(a.COMMON_PARAMS);i&&(n=t(t({},n),this._safeJsonParse(i,{}))),e&&(n=t(t({},n),e));var s={platform:this._platform,os:this._systemInfo.platform,osversion:(null===(o=this._systemInfo.system)||void 0===o?void 0:o.includes(" "))?this._systemInfo.system.split(" ")[1]:this._systemInfo.system,device:this._systemInfo.model,devicebrand:this._systemInfo.brand,pixel:this._systemInfo.screenWidth+"*"+this._systemInfo.screenHeight,userinfo:this._getUserInfo(n.userinfo)};this._updateCommonParams(t(t(t({},n),s),{obatchid:this._getBatchId()}))},s.prototype._getNetworkType=function(){var t=this;return new Promise((function(e){var o;try{null===(o=t._mp)||void 0===o||o.getNetworkType({success:function(t){var o=((null==t?void 0:t.networkType)||"").toLowerCase();e({wifi:"wifi","2g":"2g","3g":"3g","4g":"4g","5g":"5g",none:"none",unknown:"unknown",ethernet:"wifi",cellular:"4g"}[o]||"unknown")},fail:function(){return e("none")}})}catch(t){console.error("[XLOG] getNetworkType error",t),e("none")}}))},s.prototype._getUserInfo=function(e,o){void 0===o&&(o=this._geoInfo);var n={};e&&(n=this._safeJsonParse(e,{}));var i={};this.commonParams.userinfo&&(i=this._safeJsonParse(this.commonParams.userinfo,{}));var s=this._pickGeoInfo(o);return JSON.stringify(t(t(t(t({},i),n),s),this._extraInfo))},s.prototype._pickGeoInfo=function(t){var e={};return t?(t.region&&(e.region=t.region),t.province&&(e.province=t.province),t.city&&(e.city=t.city),e):e},s.prototype._filterParams=function(t){var e={};if(t){var o=["openid","unionid","accid","apptypeid","appsubid","appcqid","srcqid","appver","userinfo"];for(var n in t){var i=t[n];o.includes(n)&&i&&(e[n]=i)}}return e},s.prototype.setParams=function(t){if(t){this._consoleLog&&console.log("[XLOG] setParams",t);var e=this._commonParams.openid,o=this._commonParams.unionid;t=this._filterParams(t),this._updateCommonParams(t),(t.openid&&t.openid!==e||t.unionid&&t.unionid!==o)&&this._open({isreturn:t.openid?1:2,openway:0})}},s.prototype._updateCommonParams=function(e){if(this._consoleLog&&console.log("[XLOG] _updateCommonParams",e),e.userinfo){var o=e.userinfo||this._commonParams.userinfo,i=e.appsubid||this._commonParams.appsubid;e.userinfo=i&&o?JSON.stringify(t(t({},this._safeJsonParse(o,{})),{appsubid:i})):o,e.userinfo=this._getUserInfo(e.userinfo)}e.appcqid&&(e.appqid=e.appcqid+n()),e.appver&&(e.appverint=function(t){try{return t&&"string"==typeof t?t.split(".").map((function(t){return 1===t.length?"0"+t:t})).join(""):""}catch(e){return console.error('[transferVersion] ver("'.concat(t,'")格式异常:'),e),""}}(e.appver)),this._commonParams=t(t({},this._commonParams),e),this._cacheCommonParams(this._commonParams)},s.prototype._getAppqid=function(){return this._commonParams.appcqid+n()},s.prototype._getApptypeid=function(t){var e=t||this._commonParams.apptypeid||"";return e||console.warn("[XLOG] apptypeid未配置,请在初始化时传入或调用方法时传入"),e},s.prototype._request=function(t,e,o){var n=this;return void 0===o&&(o="application/x-www-form-urlencoded"),new Promise((function(i,s){var r;try{null===(r=n._mp)||void 0===r||r.request({url:t,data:e,method:"POST",header:{"content-type":o},success:function(o){n._consoleLog&&console.log("[XLOG] SUCCESS: ".concat(t),e,o),i(o)},fail:function(o){n._consoleLog&&console.error("[XLOG] FAIL: ".concat(t),e,o),s(o)}})}catch(t){console.error("[XLOG] request error",t),s(t)}}))},s.prototype.open=function(t){this._open({querystring:t.querystring,isreturn:3,openway:0,manual:!0})},s.prototype._open=function(e){if(this._sendOpenLog||e.manual){0===e.openway&&(this._hasSentColdOpen=!0);var o=this._getLaunchOptions();this._updateQuerystring(o,e.querystring);var n=t(t({},this._commonParams),{appqid:this._getAppqid(),wakeway:e.wakeway||(null==o?void 0:o.scene)||"",openway:e.openway,isreturn:e.isreturn||0,xmlog:c});this._consoleLog&&console.log("[XLOG] PARAMS(OPEN)",n),this._request(this._openUrl,n)}},s.prototype.event=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),event1:e.event1||"",event2:e.event2||"",event3:e.event3||"",event4:e.event4||"",value1:e.value1||"",value2:e.value2||"",value3:e.value3||"",value4:e.value4||""});this._consoleLog&&console.log("[XLOG] PARAMS(EVENT)",o),this._request(this._eventUrl,o)},s.prototype.act=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),actentryid:e.actentryid||"",subactid:e.subactid||"",type:e.type||"",custom:e.custom||"",batchid:e.batchid||""});this._consoleLog&&console.log("[XLOG] PARAMS(ACT)",o),this._request(this._actUrl,o)},s.prototype.ad=function(e){var o=t(t({},this._commonParams),{appqid:this._getAppqid(),type:e.type||"",code:e.code||"",codeinfo:e.codeinfo||"",pagetype:e.pagetype||"",gametype:e.gametype||"",adslot:e.adslot||"",adunitid:e.adunitid||"",adbatchid:e.adbatchid||"",ecpm:e.ecpm||""});this._consoleLog&&console.log("[XLOG] PARAMS(AD)",o),this._request(this._adUrl,o,"application/json")},s.prototype._getPlatformPath=function(){var t="";return 1===this._platform?t="wx/":3===this._platform&&(t="ks/"),t},s.prototype._getPlatformStr=function(){var t="DY";return 1===this._platform?t="WX":3===this._platform&&(t="KS"),t},s.prototype.code2session=function(t){var n;return e(this,void 0,void 0,(function(){var e,i,s,r,a;return o(this,(function(o){switch(o.label){case 0:return e=this._getApptypeid(t.apptypeid),i=this._getPlatformPath(),s="".concat(this._businessDomain,"/AppletUtils/").concat(i,"code2session"),[4,this._request(s,{appTypeId:e,code:t.code,testNet:t.testNet},"application/json")];case 1:return r=o.sent(),a=null===(n=r.data)||void 0===n?void 0:n.data,this._sessionInfo=null!=a?a:{},this.setParams({openid:this._sessionInfo.openid,unionid:this._sessionInfo.unionid}),[2,r.data]}}))}))},s.prototype.msgSecCheck=function(t){return e(this,void 0,void 0,(function(){var e,n,i,s,r,a;return o(this,(function(o){switch(o.label){case 0:return 1!==this._platform?(console.warn("[XLOG] msgSecCheck 仅支持微信小程序/小游戏平台"),[2]):(e=(t.content||"").trim())?(n=this._getApptypeid(t.apptypeid),(i=t.openid||this._sessionInfo.openid||this._commonParams.openid)?((s="number"==typeof t.scene?t.scene:4)!==(r=s>=1&&s<=5?s:4)&&console.warn("[XLOG] msgSecCheck scene超出范围,已回退为4"),a="".concat(this._businessDomain,"/AppletUtils/wx/msgCheck"),this._consoleLog&&console.log("[XLOG] PARAMS(MSG_SEC_CHECK)",{appTypeId:n,openid:i,scene:r,content:e}),[4,this._request(a,{appTypeId:n,openid:i,scene:r,content:e},"application/json")]):(console.warn("[XLOG] msgSecCheck openid不存在,请先登录(调用方法code2session)或手动传入openid",this._sessionInfo),[2])):(console.warn("[XLOG] msgSecCheck content不能为空"),[2]);case 1:return[2,o.sent().data]}}))}))},s.prototype.isLogin=function(){return!!this._sessionInfo.openid||(console.warn("[XLOG] checkLogin","openid不存在,请检查是否已经调用过登录(code2session)。"),!1)},s.prototype.getSubsidy=function(t){return void 0===t&&(t={}),e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/subsidy"),{apptypeid:e,os:this._systemInfo.platform,openId:n},"application/json")]):(console.warn("[XLOG] getSubsidy 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},s.prototype.getUserProps=function(t){return void 0===t&&(t={}),e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/userProps"),{appTypeId:e,openId:n},"application/json")]):(console.warn("[XLOG] getUserProps 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},s.prototype._sleep=function(t){return void 0===t&&(t=1e3),e(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new Promise((function(e){setTimeout(e,t)}))]}))}))},s.prototype._checkOrderAfterPayment=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this._sleep()];case 1:return o.sent(),[4,this.checkOrder({orderId:n})];case 2:return e=o.sent(),[2,{payResult:1===Number(null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.payResult)?1:0}];case 3:return r=o.sent(),console.error("[XLOG] 订单校验 err: ",r,t({orderId:n},i)),[2,{payResult:0}];case 4:return[2]}}))}))},s.prototype._payWx=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r,a,c,p,l,u,h,d,m,_,f,y,v,g,I=this;return o(this,(function(o){switch(o.label){case 0:if(this._consoleLog&&console.log('[XLOG] 当前平台: "'.concat(this._systemInfo.platform,'"')),e="ios"===(this._systemInfo.platform||"").toLowerCase(),r=i.orderId,a=i.payContent,p=(c=a||{}).offerId,l=c.zone_id,u=c.env,h=c.buy_quantity,d=c.kfMessageTitle,m=c.kfMessageImg,!e)return[3,4];_={sessionFrom:n.sessionFrom,showMessageCard:null===(s=n.showMessageCard)||void 0===s||s,sendMessageTitle:n.sendMessageTitle||d,sendMessagePath:n.sendMessagePath,sendMessageImg:n.sendMessageImg||m},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,new Promise((function(e,o){var n;null===(n=I._mp)||void 0===n||n.openCustomerServiceConversation(t(t({},_),{success:e,fail:o}))}))];case 2:return v=o.sent(),this._consoleLog&&console.log("[XLOG] 进入客服会话",v),[2,{payResult:-1}];case 3:return f=o.sent(),console.error("[XLOG] 取消进入客服会话",f,_),[2,{payResult:0}];case 4:y={mode:"game",env:1===Number(u)?1:0,offerId:p,currencyType:"CNY",platform:"android",buyQuantity:Number(h||n.buyQuantity),zoneId:l,outTradeNo:r},o.label=5;case 5:return o.trys.push([5,7,,8]),[4,new Promise((function(e,o){var n;null===(n=I._mp)||void 0===n||n.requestMidasPayment(t(t({},y),{success:e,fail:o}))}))];case 6:return v=o.sent(),this._consoleLog&&console.log("[XLOG] 微信虚拟支付",v),[3,8];case 7:return g=o.sent(),console.error("[XLOG] 微信虚拟支付 err: ",g,y),[2,{payResult:0}];case 8:return[2,this._checkOrderAfterPayment(r,y)]}}))}))},s.prototype._payDy=function(n,i){var s;return e(this,void 0,void 0,(function(){var e,r,a,c,p,l,u,h,d,m,_,f,y,v,g=this;return o(this,(function(o){switch(o.label){case 0:if(e=i.orderId,r=i.payContent,c=(a=r||{}).zone_id,p=a.env,l=a.buy_quantity,u=a.extraInfo,h="ios"===(this._systemInfo.platform||"").toLowerCase(),d="windows"===(this._systemInfo.platform||"").toLowerCase(),!h)return[3,5];if(!(null===(s=this._mp)||void 0===s?void 0:s.openAwemeCustomerService))return console.error("[XLOG] 当前抖音基础库不支持 openAwemeCustomerService"),[2,{payResult:0}];m={currencyType:"DIAMOND",buyQuantity:Number(l||n.buyQuantity),zoneId:c||"1",customId:e,extraInfo:u},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,new Promise((function(e,o){var n;null===(n=g._mp)||void 0===n||n.openAwemeCustomerService(t(t({},m),{success:e,fail:o}))}))];case 2:return y=o.sent(),this._consoleLog&&console.log("[XLOG] 抖音 iOS 客服支付",y),[3,4];case 3:return _=o.sent(),console.error("[XLOG] 抖音 iOS 客服支付 err: ",_,m),[2,{payResult:0}];case 4:return[2,this._checkOrderAfterPayment(e,m)];case 5:f={mode:"game",env:1===Number(p)?1:0,currencyType:"CNY",platform:d?"windows":"android",buyQuantity:Number(l||n.buyQuantity),zoneId:c||"1",customId:e,extraInfo:u},o.label=6;case 6:return o.trys.push([6,8,,9]),[4,new Promise((function(e,o){var n;null===(n=g._mp)||void 0===n||n.requestGamePayment(t(t({},f),{success:e,fail:o}))}))];case 7:return y=o.sent(),this._consoleLog&&console.log("[XLOG] 抖音支付",y),[3,9];case 8:return v=o.sent(),console.error("[XLOG] 抖音支付 err: ",v,f),[2,{payResult:0}];case 9:return[2,this._checkOrderAfterPayment(e,f)]}}))}))},s.prototype.pay=function(t){return e(this,void 0,void 0,(function(){var e,n;return o(this,(function(o){switch(o.label){case 0:return this._consoleLog&&console.log("[XLOG] pay params: ",t),"WX"!==(e=this._getPlatformStr())&&"DY"!==e?(console.error("[XLOG] 支付目前只支持微信/抖音平台,当前平台: ".concat(e||"UNKNOWN")),[2,{payResult:0}]):[4,this.createOrder(t)];case 1:return(null==(n=o.sent())?void 0:n.data)?"WX"===e?[2,this._payWx(t,n.data)]:[2,this._payDy(t,n.data)]:(console.error("[XLOG] 未获取到订单信息"),[2,{payResult:0}])}}))}))},s.prototype.checkOrder=function(t){return e(this,void 0,void 0,(function(){var e,n,i,s,r;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._getPlatformPath(),i=this._sessionInfo,s=i.openid,r=i.session_key,[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/").concat(n,"chkOrder"),{appTypeId:e,orderId:t.orderId,os:this._systemInfo.platform,openId:s,sessionKey:r},"application/json")]):(console.warn("[XLOG] checkOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},s.prototype.createOrder=function(t){return e(this,void 0,void 0,(function(){var e,n,i;return o(this,(function(o){switch(o.label){case 0:return this.isLogin()?(e=this._getApptypeid(t.apptypeid),n=this._sessionInfo.openid,i=this._getPlatformStr(),[4,this._request("".concat(this._businessDomain,"/AppletUtils/pay/ks/crtOrder"),{appTypeId:e,productId:t.productId,extInfo:t.extInfo,os:this._systemInfo.platform,payPlatform:i,openId:n},"application/json")]):(console.warn("[XLOG] createOrder 请先登录(调用方法code2session)",this._sessionInfo),[2]);case 1:return[2,o.sent().data]}}))}))},s.prototype._sendOnline=function(){var e=Date.now(),o=Math.max(0,e-this._startTime),n=t(t({},this._commonParams),{appqid:this._getAppqid(),onlinetime:"".concat(o),endtime:e.toString(),starttime:this._startTime.toString()});this._online([n])},s.prototype._setOnlineBatchData=function(t){this._setStorage(a.ONLINE_BATCH_DATA,t)},s.prototype._getOnlineBatchData=function(){try{var t=this._getStorage(a.ONLINE_BATCH_DATA);if(Array.isArray(t))return t;if("string"==typeof t&&t){var e=this._safeJsonParse(t,[]);return Array.isArray(e)?e:[]}return[]}catch(t){return console.error("[XLOG] get online batch data error",t),[]}},s.prototype._clearOnlineBatchData=function(){this._setStorage(a.ONLINE_BATCH_DATA,"")},s.prototype._online=function(t){var e=this;t&&0!==t.length&&(this._consoleLog&&console.log("[XLOG] PARAMS(ONLINE)",t),this._clearOnlineBatchData(),this._request(this._onlineUrl,{batch:JSON.stringify(t)}).catch((function(o){console.error("[XLOG] Online log report failed, caching batch data",o),e._setOnlineBatchData(t)})))},s.prototype._initIAAPlugin=function(){var t;if(1===this._platform)try{if("undefined"==typeof requirePlugin)return void console.error("[XLOG:IAA] 环境不支持requirePlugin");var e=null===(t=requirePlugin("MiniGameCommon",{enableRequireHostModule:!0,customEnv:{wx:"undefined"!=typeof wx?wx:null}}))||void 0===t?void 0:t.default;if("function"!=typeof e)return void console.error("[XLOG:IAA] 插件加载失败,无法获取createMiniGameCommon");this._miniGameCommon=e(),this._miniGameCommon&&this._miniGameCommon.canIUse?("undefined"!=typeof GameGlobal&&(GameGlobal.miniGameCommon=this._miniGameCommon),this._consoleLog&&console.log("[XLOG:IAA] 插件初始化成功")):console.error("[XLOG:IAA] 插件初始化失败")}catch(t){console.error("[XLOG:IAA] 插件初始化异常",t)}else console.warn("[XLOG:IAA] 仅微信小程序支持IAA插件")},s.prototype.iaa=function(t){return e(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return this._miniGameCommon?[2,new Promise((function(i,s){setTimeout((function(){return e(n,void 0,void 0,(function(){var e,n,r,a;return o(this,(function(o){switch(o.label){case 0:e=null,n=t.sessionKey,r=t.reportData,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._miniGameCommon.getUserLabel({reportData:JSON.stringify(r),labelId:"iaa_feature"})];case 2:return e=o.sent(),[3,4];case 3:return a=o.sent(),console.error("[XLOG:IAA] getUserLabel 调用失败:",a),s(a),[2];case 4:return e?(this._consoleLog&&console.log("[XLOG:IAA] 平台返回:",e),this._sendIAAData({session_key:n,requestReportData:JSON.stringify(r),iv:e.iv,encryptedData:e.encryptedData}),i(e),[2]):(s(new Error("Platform response is null")),[2])}}))}))}),3e4)}))]:(console.error("[XLOG:IAA] 插件未初始化"),[2])}))}))},s.prototype._sendIAAData=function(t){this._request("".concat(this._businessDomain,"/AppletUtils/util/wx/uploadReportData"),t,"application/json")},s}();export{s as EGender,l as XLog};
|
package/dist/web-hw.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ interface IOpenLogParams {
|
|
|
31
31
|
openway: 0 | 1 | 5;
|
|
32
32
|
wakeway?: string | number;
|
|
33
33
|
xmlog: string;
|
|
34
|
-
isreturn?: 0 | 1 | 2 | 3;
|
|
34
|
+
isreturn?: 0 | 1 | 2 | 3 | 4;
|
|
35
35
|
querystring?: Record<string | number, any>;
|
|
36
36
|
manual?: boolean;
|
|
37
37
|
}
|
|
@@ -89,6 +89,7 @@ interface ISystemInfo {
|
|
|
89
89
|
}
|
|
90
90
|
interface IExtraInfo extends Pick<ISystemInfo, 'language' | 'SDKVersion' | 'benchmarkLevel' | 'theme' | 'pixelRatio'> {
|
|
91
91
|
wxVersion: string;
|
|
92
|
+
tz?: string;
|
|
92
93
|
}
|
|
93
94
|
interface IDomain {
|
|
94
95
|
open?: string;
|
|
@@ -192,6 +193,15 @@ interface IRes<T = any> {
|
|
|
192
193
|
msg: string;
|
|
193
194
|
data: T;
|
|
194
195
|
}
|
|
196
|
+
interface IGeoParams extends Partial<ICommonParams> {
|
|
197
|
+
overseas: boolean;
|
|
198
|
+
}
|
|
199
|
+
interface IGeoResponseData {
|
|
200
|
+
country?: string;
|
|
201
|
+
province?: string;
|
|
202
|
+
city?: string;
|
|
203
|
+
clientIp?: string;
|
|
204
|
+
}
|
|
195
205
|
interface ICode2sessionParams {
|
|
196
206
|
apptypeid?: string;
|
|
197
207
|
code: string;
|
|
@@ -384,4 +394,4 @@ declare class XLog {
|
|
|
384
394
|
private _online;
|
|
385
395
|
}
|
|
386
396
|
|
|
387
|
-
export { EGender, HwInitParams, IAADecryptedData, IAAParams, IAAPlatformResponse, IAAReportData, IAAReportParams, IActiveLogParams, IAdLogParams, ICheckOrderParams, ICheckOrderResponseData, ICode2sessionParams, ICode2sessionResponseData, ICommonParams, ICreateOrderParams, ICreateOrderResponseData, IDomain, IDomainWithEnv, IDyAwemeCustomerServiceParams, IDyPaymentParams, IEventLogParams, IExtraInfo, IHwActiveLogParams, IHwAdLogParams, IHwCommonParams, IHwDomain, IHwOnlineLogParamsWithCommon, IHwOpenLogParams, IMsgSecCheckDetail, IMsgSecCheckParams, IMsgSecCheckResponseData, IMsgSecCheckResult, IOnlineLogParams, IOnlineLogParamsWithCommon, IOpenLogParams, IPayParams, IPayResponseData, IPlatformStr, IRes, IShareParams, ISubsidyParams, ISubsidyResponseData, ISystemInfo, IUserInfo, IUserPropsParams, IUserPropsResponseData, IWxCustomerServiceCardParams, IWxPaymentParams, InitParams, MiniprogramShowOptions, TCommonParams, THwCommonParams, TPlatform, XLog };
|
|
397
|
+
export { EGender, HwInitParams, IAADecryptedData, IAAParams, IAAPlatformResponse, IAAReportData, IAAReportParams, IActiveLogParams, IAdLogParams, ICheckOrderParams, ICheckOrderResponseData, ICode2sessionParams, ICode2sessionResponseData, ICommonParams, ICreateOrderParams, ICreateOrderResponseData, IDomain, IDomainWithEnv, IDyAwemeCustomerServiceParams, IDyPaymentParams, IEventLogParams, IExtraInfo, IGeoParams, IGeoResponseData, IHwActiveLogParams, IHwAdLogParams, IHwCommonParams, IHwDomain, IHwOnlineLogParamsWithCommon, IHwOpenLogParams, IMsgSecCheckDetail, IMsgSecCheckParams, IMsgSecCheckResponseData, IMsgSecCheckResult, IOnlineLogParams, IOnlineLogParamsWithCommon, IOpenLogParams, IPayParams, IPayResponseData, IPlatformStr, IRes, IShareParams, ISubsidyParams, ISubsidyResponseData, ISystemInfo, IUserInfo, IUserPropsParams, IUserPropsResponseData, IWxCustomerServiceCardParams, IWxPaymentParams, InitParams, MiniprogramShowOptions, TCommonParams, THwCommonParams, TPlatform, XLog };
|