diff --git a/index.html b/index.html index 5683bdd..56781cd 100644 --- a/index.html +++ b/index.html @@ -45,22 +45,3 @@ - - diff --git a/public/landing-sdk-v1.0.8.js b/public/landing-sdk-v1.0.8.js deleted file mode 100644 index 0e17ae0..0000000 --- a/public/landing-sdk-v1.0.8.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).LandingSDK=t()}(this,function(){"use strict";if("function"!=typeof Object.keys||"function"!=typeof Date.now||"function"!=typeof Array.isArray){var e=function(){},t=function(){};t.landingPageView=e,t.landingPageClick=e;var n=function(){};if(n.init=e,n.track=t,"undefined"!=typeof globalThis)try{globalThis.LandingSDK=n}catch(e){}else"undefined"!=typeof window&&(window.LandingSDK=n);return n}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}var i,o="_s_token_",a="_d_token_",c="_d_sig_",u="_ping_flag_",d="data-app-id",l="app-id",f="event_id",p=null,v=null,g=null,s=null,y=function(e){var t=e.toString(16);return 1===t.length?"0"+t:t},h=function(){for(var e="",t=0;t<16;t++)e+=y(Math.floor(256*Math.random()));return e},w=function(){if(null!==s)return s;try{return window.localStorage.setItem(u,"1"),window.localStorage.removeItem(u),s=!0,!0}catch(e){return s=!1,!1}},_=function(){if("undefined"==typeof navigator)return"PC";var e=navigator.userAgent||"";return/Android/i.test(e)?"Android":/iPhone|iPad|iPod/i.test(e)?"iOS":"PC"},m=function(e){if(!e)return"";for(var t=e+"device_id_secret_key_v1",n=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:"")||""),n=0;n>>0).toString(16).padStart(8,"0")}(y));return function(t){if(t&&w())try{window.localStorage.setItem(e,t)}catch(e){}}(h),h}catch(e){return""}},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=function(){if("undefined"==typeof window)return"";if(w())try{var e=window.localStorage.getItem(a),t=window.localStorage.getItem(c);if(e&&!t){var n=h(),r=m(n);return window.localStorage.setItem(a,n),window.localStorage.setItem(c,r),n}if(e&&t){if(m(e)===t)return e;var i=h(),o=m(i);return window.localStorage.setItem(a,i),window.localStorage.setItem(c,o),i}var u=h(),d=m(u);return window.localStorage.setItem(a,u),window.localStorage.setItem(c,d),u}catch(e){}return g||(g=h()),g}(),n=function(){var e,t,n,r=(t=(e=new Date).getMonth()+1,n=e.getDate(),e.getFullYear()+"-"+(t<10?"0"+t:t)+"-"+(n<10?"0"+n:n));if("undefined"!=typeof window&&w())try{var i=window.localStorage.getItem(o);if(i)try{var a=JSON.parse(i);if(a.date===r&&a.sid)return a.sid}catch(e){}var c=h();return window.localStorage.setItem(o,JSON.stringify({sid:c,date:r})),c}catch(e){}return p&&v===r||(p=h(),v=r),p}(),r="",i="";return{app_id:e.appId||k(),uid:0,channel:e.channel||"",sid:n,client_ts:Math.floor(Date.now()/1e3),device:_(),device_id:t,user_agent:"undefined"==typeof navigator?"":navigator.userAgent||"",device_brand:r,device_model:i,fp_version:"1.0.0",device_fingerprint:b()}},j=function(){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")||(window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""));if(!n)return"";var r="/"===n.charAt(n.length-1)?n.slice(0,-1):n,i=e?"/dcserv":"",o=t?"/api/eventTracking/batchReport.json":"/api/eventTracking/report.json";return"".concat(r).concat(i).concat(o)},A=function(){for(var e={},t=0;t100?D(e,t,r,"must be int in [0,100]"):{keep:!0,value:o}}if(function(e){return"page_no"===e||"click_position"===e||/_position$/.test(e)}(t)){var a=C(n);return!x(a)||a<1?D(e,t,r,"must be int >= 1"):{keep:!0,value:a}}if("amount"===t||"coin_quantity"===t||"search_result_count"===t||"click_page_x"===t||"click_page_y"===t||"screen_width"===t||"screen_height"===t||"video_duration"===t||"play_duration"===t||"page_load_time"===t){var c=C(n);return!x(c)||c<=0?D(e,t,r,"must be int > 0"):{keep:!0,value:c}}if(T[t]){var u=q(n);if(!u)return D(e,t,r,"must not be empty");var d=u.split(",").map(function(e){return e.trim()}).filter(Boolean).join(",");return d?{keep:!0,value:d}:D(e,t,r,"must not be empty")}if(function(e){return/_key$/.test(e)}(t)){var l=q(n);return!l||l.length>64||!/^[A-Za-z0-9_]+$/.test(l)?D(e,t,r,"must match key rule"):{keep:!0,value:l}}if(function(e){return/_name$/.test(e)}(t)){var f=q(n);return f?{keep:!0,value:f.slice(0,128)}:D(e,t,r,"must not be empty")}if(function(e){return/(^id$|_id$)/.test(e)}(t)){var p=q(n);return p?{keep:!0,value:p.slice(0,128)}:D(e,t,r,"must not be empty")}if(function(e){return"comment_content"===e||"keyword"===e||/_title$/.test(e)||"novel_title"===e||"video_title"===e}(t)){var v=q(n),g="comment_content"===t||"keyword"===t?500:256;return v?{keep:!0,value:v.slice(0,g)}:D(e,t,r,"must not be empty")}if(Object.prototype.hasOwnProperty.call(P,t)){var s=q(n);return P[t][s]?{keep:!0,value:s}:D(e,t,r,"must be in enum whitelist")}return"string"==typeof n?{keep:!0,value:n.trim()}:{keep:!0,value:n}},M=function(e){return null===e?"null":Array.isArray(e)?"array":r(e)},$=function(e,t,n){t=t||{};var i=(n=n||{}).allowExtra,o=void 0!==i&&i,a=t&&"object"===r(t)&&!Array.isArray(t)?t:null;if(!a)throw new TypeError("[sdk][event] "+e+" payload must be an object");for(var c=O[e]||{},u=Object.keys(a),d={},l=0;l0&&void 0!==arguments[0]?arguments[0]:"")||""),n=0;n>>0).toString(16).padStart(8,"0")}(y));return function(t){if(t&&h())try{window.localStorage.setItem(e,t)}catch(e){}}(_),_}catch(e){return""}},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=function(){if("undefined"==typeof window)return"";if(h())try{var e=window.localStorage.getItem(a),t=window.localStorage.getItem(u);if(e&&!t){var n=_(),r=m(n);return window.localStorage.setItem(a,n),window.localStorage.setItem(u,r),n}if(e&&t){if(m(e)===t)return e;var i=_(),o=m(i);return window.localStorage.setItem(a,i),window.localStorage.setItem(u,o),i}var c=_(),d=m(c);return window.localStorage.setItem(a,c),window.localStorage.setItem(u,d),c}catch(e){}return s||(s=_()),s}(),n=function(){var e,t,n,r=(t=(e=new Date).getMonth()+1,n=e.getDate(),e.getFullYear()+"-"+(t<10?"0"+t:t)+"-"+(n<10?"0"+n:n));if("undefined"!=typeof window&&h())try{var i=window.localStorage.getItem(o);if(i)try{var a=JSON.parse(i);if(a.date===r&&a.sid)return a.sid}catch(e){}var u=_();return window.localStorage.setItem(o,JSON.stringify({sid:u,date:r})),u}catch(e){}return v&&p===r||(v=_(),p=r),v}(),r="",i="";return{app_id:e.appId||b(),uid:0,channel:e.channel||"",sid:n,client_ts:Math.floor(Date.now()/1e3),device:w(),device_id:e.deviceId||t,user_agent:"undefined"==typeof navigator?"":navigator.userAgent||"",device_brand:r,device_model:i,fp_version:"1.0.0",device_fingerprint:k(),sdk_version:"1.1.0",app_version:""}},A=function(){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")||(window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""));if(!n)return"";var r="/"===n.charAt(n.length-1)?n.slice(0,-1):n,i=e?"/dcserv":"",o=t?"/api/eventTracking/batchReport.json":"/api/eventTracking/report.json";return"".concat(r).concat(i).concat(o)},j=function(){for(var e={},t=0;t>6,128|63&i);else if(i>=55296&&i<=56319&&r+1=56320&&o<=57343){var a=o-56320+(i-55296<<10)+65536;n.push(240|a>>18,128|a>>12&63,128|a>>6&63,128|63&a),r+=1}else n.push(224|i>>12,128|i>>6&63,128|63&i)}else n.push(224|i>>12,128|i>>6&63,128|63&i)}var u=8*n.length;for(n.push(128);n.length%64!=56;)n.push(0);for(var c=0;c<8;c+=1)n.push(u>>>8*c&255);for(var d=function(e,t){return e<>>32-t},l=function(e,t){return((e>>>0)+(t>>>0)&4294967295)>>>0},f=function(e,t,n,r){return l(l(e,t),l(n,r))},v=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],p=new Array(64),s=0;s<64;s+=1)p[s]=Math.floor(4294967296*Math.abs(Math.sin(s+1)))>>>0;for(var g=1732584193,y=4023233417,_=2562383102,h=271733878,w=0;w>>0}for(var S=g,A=y,j=_,I=h,O=0;O<64;O+=1){var P=void 0,T=void 0;O<16?(P=A&j|~A&I,T=O):O<32?(P=I&A|~I&j,T=(5*O+1)%16):O<48?(P=A^j^I,T=(3*O+5)%16):(P=j^(A|~I),T=7*O%16);var q=I;I=j,j=A,A=l(A,d(f(S,P,p[O],m[T]),v[O])),S=q}g=l(g,S),y=l(y,A),_=l(_,j),h=l(h,I)}var x=function(e){for(var t="",n=0;n<4;n+=1)t+=(256+(e>>>8*n&255)).toString(16).slice(1);return t};return""+x(g)+x(y)+x(_)+x(h)},O=function(e){return null===e?"__t:null__":"string"==typeof e?"__t:str__:"+e:"number"==typeof e&&isFinite(e)?"__t:num__:"+String(e):"boolean"==typeof e?"__t:bool__:"+(e?"1":"0"):Array.isArray(e)?"["+e.map(O).join(",")+"]":"object"===r(e)?"{"+Object.keys(e).sort().map(function(t){return t+":"+O(e[t])}).join(",")+"}":"__t:any__:"+String(e)},P=function(e){var t=(e=e||{}).endpoint?e.endpoint:A(e.domain,!0,e.batch)||"",n=function(e){return e=e||{},{sendPayload:function(t,n){if(n){var i,o;if(e.batch?(i=JSON.stringify(t),o="application/json"):(i=function(e){for(var t=Object.keys(e||{}),n=[],i=0;i100?E(e,t,r,"must be int in [0,100]"):{keep:!0,value:o}}if(function(e){return"page_no"===e||"click_position"===e||/_position$/.test(e)}(t)){var a=M(n);return!D(a)||a<1?E(e,t,r,"must be int >= 1"):{keep:!0,value:a}}if("amount"===t||"coin_quantity"===t||"search_result_count"===t||"click_page_x"===t||"click_page_y"===t||"screen_width"===t||"screen_height"===t||"video_duration"===t||"play_duration"===t||"page_load_time"===t){var u=M(n);return!D(u)||u<=0?E(e,t,r,"must be int > 0"):{keep:!0,value:u}}if(x[t]){var c=C(n);if(!c)return E(e,t,r,"must not be empty");var d=c.split(",").map(function(e){return e.trim()}).filter(Boolean).join(",");return d?{keep:!0,value:d}:E(e,t,r,"must not be empty")}if(function(e){return/_key$/.test(e)}(t)){var l=C(n);return!l||l.length>64||!/^[A-Za-z0-9_]+$/.test(l)?E(e,t,r,"must match key rule"):{keep:!0,value:l}}if(function(e){return/_name$/.test(e)}(t)){var f=C(n);return f?{keep:!0,value:f.slice(0,128)}:E(e,t,r,"must not be empty")}if(function(e){return/(^id$|_id$)/.test(e)}(t)){var v=C(n);return v?{keep:!0,value:v.slice(0,128)}:E(e,t,r,"must not be empty")}if(function(e){return"comment_content"===e||"keyword"===e||/_title$/.test(e)||"novel_title"===e||"video_title"===e}(t)){var p=C(n),s="comment_content"===t||"keyword"===t?500:256;return p?{keep:!0,value:p.slice(0,s)}:E(e,t,r,"must not be empty")}if(Object.prototype.hasOwnProperty.call(q,t)){var g=C(n);return q[t][g]?{keep:!0,value:g}:E(e,t,r,"must be in enum whitelist")}return"string"==typeof n?{keep:!0,value:n.trim()}:{keep:!0,value:n}},N=function(e){return null===e?"null":Array.isArray(e)?"array":r(e)},R=function(e,t,n){t=t||{};var i=(n=n||{}).allowExtra,o=void 0!==i&&i,a=t&&"object"===r(t)&&!Array.isArray(t)?t:null;if(!a)throw new TypeError("[sdk][event] "+e+" payload must be an object");for(var u=T[e]||{},c=Object.keys(a),d={},l=0;l>6,128|63&o);else if(o>=55296&&o<=56319&&r+1=56320&&i<=57343){var s=i-56320+(o-55296<<10)+65536;n.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|63&s),r++}else n.push(224|o>>12,128|o>>6&63,128|63&o)}else n.push(224|o>>12,128|o>>6&63,128|63&o)}return n}(String(null==e?"":e)),n=8*t.length;for(t.push(128);t.length%64!=56;)t.push(0);for(var r=0;r<8;r++)t.push(n>>>8*r&255);for(var o=function(e,t){return e<>>32-t},i=function(e,t){return((e>>>0)+(t>>>0)&4294967295)>>>0},s=function(e,t,n,r){return i(i(e,t),i(n,r))},a=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],u=new Array(64),c=0;c<64;c++)u[c]=Math.floor(4294967296*Math.abs(Math.sin(c+1)))>>>0;for(var f=1732584193,l=4023233417,h=2562383102,d=271733878,p=0;p>>0}for(var m=f,_=l,w=h,b=d,P=0;P<64;P++){var S,C;P<16?(S=_&w|~_&b,C=P):P<32?(S=b&_|~b&w,C=(5*P+1)%16):P<48?(S=_^w^b,C=(3*P+5)%16):(S=w^(_|~b),C=7*P%16);var k=b;b=w,w=_,_=i(_,o(s(m,S,u[P],v[C]),a[P])),m=k}f=i(f,m),l=i(l,_),h=i(h,w),d=i(d,b)}var E=function(e){for(var t="",n=0;n<4;n++)t+=(256+(e>>>8*n&255)).toString(16).slice(1);return t};return E(f)+E(l)+E(h)+E(d)}function t(e,t){var n=65535&e,r=65535&t;return n*r+((e>>>16&65535)*r+n*(t>>>16&65535)<<16>>>0)|0}function n(e){for(var n=String(null==e?"":e),r=2166136261,o=0;o>>0).toString(16);i.length<8;)i="0"+i;return i}function r(e,t){if(null===e)return"__t:null__";if("string"==typeof e)return"__t:str__:"+e;if("number"==typeof e&&isFinite(e))return"__t:num__:"+String(e);if("boolean"==typeof e)return"__t:bool__:"+(e?"1":"0");if(Array.isArray(e)){if(-1!==t.indexOf(e))return"__t:circular__";t.push(e);var n="["+e.map(function(e){return r(e,t)}).join(",")+"]";return t.splice(t.indexOf(e),1),n}if(null!==e&&"object"==typeof e){if(-1!==t.indexOf(e))return"__t:circular__";t.push(e);var o="{"+Object.keys(e).sort().map(function(n){return n+":"+r(e[n],t)}).join(",")+"}";return t.splice(t.indexOf(e),1),o}return"__t:any__:"+String(e)}function o(e){return r(e,[])}function i(t){var n=t||{},r=Object.keys(n).filter(function(e){return"event_id"!==e}).sort();if(!r.length)return e("");var i=r.map(function(t){return e(o(n[t]))}).join("");return e(i)}function s(){if("undefined"==typeof navigator)return"PC";var e=navigator.userAgent||"";return/Android/i.test(e)?"Android":/iPhone|iPad|iPod/i.test(e)?"iOS":"PC"}function a(){try{var e="undefined"!=typeof navigator?navigator:{},t="undefined"!=typeof screen?screen:{},r="undefined"!=typeof Intl&&Intl.DateTimeFormat&&Intl.DateTimeFormat().resolvedOptions().timeZone||"",o=e.language||"",i=Array.isArray(e.languages)?e.languages.join(","):"",s=t.colorDepth||"",a=t.pixelDepth||"",u=void 0!==t.width&&void 0!==t.height?t.width+"x"+t.height:"",c=void 0!==t.availWidth&&void 0!==t.availHeight?t.availWidth+"x"+t.availHeight:"",f="undefined"!=typeof window&&window.devicePixelRatio?window.devicePixelRatio:"",l=e.maxTouchPoints||0,h=e.hardwareConcurrency||"",d=e.deviceMemory||"";return"fp_"+n([e.userAgent||"",e.platform||"",e.vendor||"",o,i,r,(new Date).getTimezoneOffset(),u,c,s,a,f,l,h,d].join("||"))}catch(e){return""}}function u(e){var t=String(null==e?"":e).trim();return t&&/^\d+\.\d+\.\d+$/.test(t)?t:"1.0.0"}function c(e){var t=e||{};return{app_id:String(t.appId||""),uid:null!=t.uid?t.uid:0,channel:String(t.channel||""),sid:String(t.sid||""),client_ts:Math.floor(Date.now()/1e3),device:String(t.deviceType||"PC"),device_id:String(t.deviceId||""),device_brand:String(t.deviceBrand||""),device_model:String(t.deviceModel||""),device_fingerprint:String(t.deviceFingerprint||""),fp_version:String(t.fpVersion||""),user_agent:"undefined"!=typeof navigator&&navigator.userAgent||"",sdk_version:String(t.sdkVersion||""),app_version:String(t.appVersion||"1.0.0")}}var f="__landing_sdk_sid__",l="__landing_sdk_sid_v1",h="__landing_sdk_device_id__",d="__landing_sdk_device_fp__",p="__landing_sdk_ping__",v=18e5,g=null,y=null;function m(){try{return!("undefined"==typeof window||!window.localStorage||(window.localStorage.setItem(p,"1"),window.localStorage.removeItem(p),0))}catch(e){return!1}}function _(){var e=new Uint8Array(16);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.floor(256*Math.random());for(var n="",r=0;rv?S(e):(g=r={sid:r.sid,lastBehaviorAt:e},P(r),r.sid)}var o=null;try{o=window.localStorage.getItem(f)}catch(e){}var i=o?b(o):null;if(!i&&g&&(i=g),!i||e-i.lastBehaviorAt>v)return S(e);var s={sid:i.sid,lastBehaviorAt:e};return g=s,P(s),s.sid}function k(){if(!m())return y||(y=_()),Promise.resolve(y);try{var e=window.localStorage.getItem(h);if(e&&/^[0-9a-f]{32}$/.test(e))return Promise.resolve(e);var t=_();return window.localStorage.setItem(h,t),Promise.resolve(t)}catch(e){return y||(y=_()),Promise.resolve(y)}}function E(e){try{if(m()){var t=window.localStorage.getItem(d);if(t)return t}var n=e();if(n&&m())try{window.localStorage.setItem(d,n)}catch(e){}return n}catch(e){return""}}function A(e,t,n){if(n=n||{},!e)return Promise.resolve({sent:!1,ok:!1,status:0,reason:"no_endpoint"});if(!Array.isArray(t)||0===t.length)return Promise.resolve({sent:!0,ok:!0,status:200,reason:"empty_batch"});var r=JSON.stringify(t),o=!0===n.useBeacon,i=!1!==n.requireHttps,s=Number(n.timeoutMs),a=isFinite(s)&&s>0?Math.floor(s):1e4;if(!function(e,t){if(!t)return!0;var n,r=String(e||"").match(/^(https?):\/\/([^/:?#]+)/i);return!!r&&("https"===r[1].toLowerCase()||"http"===r[1].toLowerCase()&&("localhost"===(n=String(r[2]||"").toLowerCase())||"127.0.0.1"===n||"::1"===n))}(e,i))return"undefined"!=typeof console&&console.warn&&console.warn("[sdk][web] 已拒绝非 HTTPS 上报地址(localhost HTTP 除外)"),Promise.resolve({sent:!1,ok:!1,status:0,reason:"insecure_endpoint"});if(o&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon)try{var u=new Blob([r],{type:"application/json"});if(navigator.sendBeacon(e,u))return Promise.resolve({sent:!0,ok:!0,status:200,transport:"beacon",uncertain:!0})}catch(e){}return function(e,t,n){if("function"!=typeof fetch)return Promise.resolve(null);var r="undefined"!=typeof AbortController?new AbortController:null,o=r&&n>0?setTimeout(function(){r.abort()},n):null;return fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:t,keepalive:!0,signal:r?r.signal:void 0}).then(function(e){return o&&clearTimeout(o),{sent:!0,ok:e.ok,status:Number(e.status||0),transport:"fetch"}}).catch(function(e){return o&&clearTimeout(o),e&&"object"==typeof e&&"AbortError"===e.name?{sent:!1,ok:!1,status:0,reason:"timeout",transport:"fetch"}:null})}(e,r,a).then(function(t){return null!==t?t:function(e,t,n){return new Promise(function(r){try{if("undefined"==typeof XMLHttpRequest)return r({sent:!1,ok:!1,status:0,reason:"no_xhr"});var o=new XMLHttpRequest;o.open("POST",e,!0),o.timeout=n,o.setRequestHeader("Content-Type","application/json"),o.onreadystatechange=function(){4===o.readyState&&r({sent:!0,ok:o.status>=200&&o.status<300,status:o.status,transport:"xhr"})},o.onerror=function(){r({sent:!1,ok:!1,status:0,reason:"xhr_error"})},o.ontimeout=function(){r({sent:!1,ok:!1,status:0,reason:"timeout",transport:"xhr"})},o.send(t)}catch(e){r({sent:!1,ok:!1,status:0,reason:"xhr_exception"})}})}(e,r,a)})}var T="2.0.0",x="1.0.0",O="/dcserv/api/eventTracking/batchReport.json",B="/dcserv/api/eventTracking/report.json",I=5e3,D=!1;function M(e){e=e||{},this.selectedBatchEndpoint="",this.remoteEndpoints=[],this.remoteProbePromise=null,this.remoteProbeKey="",this.shouldPersistOnFail=!1,this.hasBatchProbeStarted=!1,this.initialized=!1,this.initPromise=null,this.endpointReadyListeners=[],this.timeoutMs=Number(e.pingTimeoutMs)||1500}M.prototype.normalizeBatchEndpoints=function(e){return(Array.isArray(e)?e:[]).map(function(e){return String(e||"").trim()}).filter(Boolean).filter(function(e){return/^https:\/\//i.test(e)}).map(function(e){var t=e.match(/^(https?:\/\/[^/?#]+)/i);return(t?t[1]:e.replace(/\/+$/,""))+"/api/eventTracking/batchReport.json"})},M.prototype._withTimeout=function(e,t){return new Promise(function(n,r){var o=setTimeout(function(){r(new Error("timeout"))},t);e.then(function(e){clearTimeout(o),n(e)}).catch(function(e){clearTimeout(o),r(e)})})},M.prototype._xhrRace=function(e,t){return e.length?new Promise(function(n){var r=e.length,o=!1,i=[];function s(){for(var e=0;e0)},a.onerror=function(){f(!1)},a.send("[]")}catch(l){r--,o||0!==r||n("")}})(e[a])}):Promise.resolve("")},M.prototype._pickFastest=function(e,t){var n=this;if("undefined"==typeof fetch)return n._xhrRace(e,t);if(!e.length)return Promise.resolve("");var r="undefined"!=typeof AbortController,o=[];function i(){if(r)for(var e=0;e0?u||(u=!0,i(),s(e)):(a--,u||0!==a||s(""))}).catch(function(){a--,u||0!==a||s("")})})(e[c])})},M.prototype._notifyReady=function(){var e=this.selectedBatchEndpoint;this.endpointReadyListeners.forEach(function(t){try{t(e)}catch(e){}})},M.prototype._setSelectedEndpoint=function(e){var t=String(e||"");t&&t!==this.selectedBatchEndpoint&&(this.selectedBatchEndpoint=t,this._notifyReady())},M.prototype.startRemoteProbe=function(e){var t=e.join("|");if(!e.length)return Promise.resolve("");if(this.remoteProbePromise&&this.remoteProbeKey===t)return this.remoteProbePromise;this.remoteProbeKey=t,this.shouldPersistOnFail=!1;var n=this,r=this._pickFastest(e,this.timeoutMs).then(function(t){if(n.remoteProbePromise!==r)return n.selectedBatchEndpoint;if(n.remoteProbePromise=null,t)n._setSelectedEndpoint(t);else if(!n.selectedBatchEndpoint&&e.length){n.shouldPersistOnFail=!0;var o=e[Math.floor(Math.random()*e.length)];n._setSelectedEndpoint(o)}return n.selectedBatchEndpoint}).catch(function(){return n.remoteProbePromise===r&&(n.remoteProbePromise=null),n.selectedBatchEndpoint});return this.remoteProbePromise=r,r},M.prototype.refreshDomainConfig=function(e){var t=this;return e().then(function(e){var n=t.normalizeBatchEndpoints(e);return t.remoteEndpoints=n,n.length?(t.hasBatchProbeStarted=!0,t.startRemoteProbe(n)):t.selectedBatchEndpoint})},M.prototype.init=function(e){return this.initialized?Promise.resolve():(this.initPromise||(this.initialized=!0,this.initPromise=this.refreshDomainConfig(e).catch(function(){})),this.initPromise)},M.prototype.resolveEndpoint=function(e,t){if(t)return Promise.resolve(t);var n=this;return this.init(e).then(function(){return n.selectedBatchEndpoint||""})},M.prototype.onEndpointReady=function(e){if("function"!=typeof e)return function(){};this.endpointReadyListeners.push(e);var t=this;return function(){var n=t.endpointReadyListeners.indexOf(e);n>=0&&t.endpointReadyListeners.splice(n,1)}},M.prototype.consumeProbeFailurePersistSignal=function(){return!!this.shouldPersistOnFail&&(this.shouldPersistOnFail=!1,!0)},M.prototype.getEndpointState=function(){return this.selectedBatchEndpoint?"ready":this.remoteEndpoints.length>0?"probing":"unavailable"},M.prototype.getSelectedBatchEndpoint=function(){return this.selectedBatchEndpoint};var j="__web_sdk_remote_config_cache__",R=function(){var e=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],t=[1,2,4,8,16,32,64,128,27,54];function n(e){return 255&(e<<1^(128&e?27:0))}function r(t){return(e[t>>>24&255]<<24|e[t>>>16&255]<<16|e[t>>>8&255]<<8|e[255&t])>>>0}function o(t,r){var o,i,s,a,u,c,f,l,h,d,p,v,g=t.slice(0);for(s=[],a=0;a<16;a++)g[a]=255&(g[a]^r[a>>2]>>>24-8*(3&a));for(u=1;u<=14;u++){for(o=[],a=0;a<16;a++)o[a]=e[g[a]];for(i=[],f=0;f<4;f++)for(l=0;l<4;l++)i[f+4*l]=o[f+4*(l+f&3)];if(u<14){for(s=[],c=0;c<4;c++)d=i[4*c+1],p=i[4*c+2],v=i[4*c+3],s[4*c]=255&(n(h=i[4*c])^n(d)^d^p^v),s[4*c+1]=255&(h^n(d)^n(p)^p^v),s[4*c+2]=255&(h^d^n(p)^n(v)^v),s[4*c+3]=255&(n(h)^h^d^p^n(v));for(g=s,s=[],a=0;a<16;a++)g[a]=255&(g[a]^r[4*u+(a>>2)]>>>24-8*(3&a))}else for(g=i,a=0;a<16;a++)g[a]=255&(g[a]^r[4*u+(a>>2)]>>>24-8*(3&a))}return g}function i(e,t){var n,r,o,i=[],s=t.slice(0);for(n=0;n<16;n++)i[n]=0;for(n=0;n<128;n++){if(e[n>>3]&128>>(7&n))for(r=0;r<16;r++)i[r]^=s[r];for(o=1&s[15],r=15;r>0;r--)s[r]=255&(s[r]>>>1|s[r-1]<<7);s[0]=s[0]>>>1&255,o&&(s[0]^=225)}return i}function s(e){var t,n=e.slice(0);for(t=15;t>=12&&(n[t]=n[t]+1&255,!n[t]);t--);return n}return{decrypt:function(e,n,a){var u,c,f,l,h,d,p,v,g,y,m,_,w,b,P=[],S=[],C=[],k=[];for(u=0;u<32;u++)P[u]=e[u]||0;for(u=0;u<12;u++)S[u]=n[u]||0;if((f=a.length-16)<0)return null;for(u=0;u>>0;for(n=8;n<60;n++)o=i[n-1],n%8?n%8==4&&(o=r(o)):o=(r((o<<8|o>>>24)>>>0)^t[n/8-1]<<24)>>>0,i[n]=(i[n-8]^o)>>>0;return i}(P),h=[],u=0;u<16;u++)h[u]=0;for(d=o(h,l),p=S.slice(0),u=12;u<15;u++)p[u]=0;for(p[15]=1,v=o(p,l),g=s(p),y=[],u=0;u>>24&255,w>>>16&255,w>>>8&255,255&w),b=function(e,t){var n,r,o=[];for(n=0;n<16;n++)o[n]=0;for(n=0;n24e5?{}:this._mapPayload(n)}catch(e){return{}}},F.prototype._mapPayload=function(e){if(!e||"object"!=typeof e)return{};var t=e.data&&"object"==typeof e.data?e.data:e;return{batchUrls:this._toStringArray(null!=t.batchUrls?t.batchUrls:t.domainList),eventCodes:this._toStringArray(null!=t.eventCodes?t.eventCodes:t.eventList)}},F.prototype._persist=function(e){try{var t=this._getStorage();if(!t)return;t.setItem(j,JSON.stringify({batchUrls:this._toStringArray(e.batchUrls),eventCodes:this._toStringArray(e.eventCodes),updatedAt:Date.now()}))}catch(e){}},F.prototype._base64ToBytes=function(e){for(var t=String(e||"").trim().replace(/-/g,"+").replace(/_/g,"/"),n=t.length%4?4-t.length%4:0,r=0;r0?e.eventCodes:[]})},F.prototype.prewarm=function(){this.fetchAndDecryptConfig().catch(function(){})},F.prototype.forceRefresh=function(){this.cachedConfigPromise=null};var q="events";function L(e,t){var n=String(e&&e.event_id||"").trim();return n?n+"|||"+String(t||""):null}function H(e){for(var t={},n=Object.keys(e),r=0;r=o)return e();i.objectStore(n).delete(t.primaryKey),a++,t.continue()}}).then(function(){return t._txDone(i)})}})},V.prototype.enqueueMany=function(e){var t=this;return e&&e.length?this.openDb().then(function(n){if(n){var r=Date.now(),o=e.map(function(e,t){var n=e&&"object"==typeof e&&"record"in e?e:{record:e},o=L(n.record,n.endpointOverride||""),i={createdAt:r+t,record:n.record,endpointOverride:n.endpointOverride||"",retryCount:0,nextRetryAt:0};return o&&(i.pendingDedupeKey=o),i});return new Promise(function(e,t){var r=n.transaction(q,"readwrite"),i=r.objectStore(q);r.oncomplete=function(){e()},r.onerror=function(){t(r.error)},r.onabort=function(){t(r.error)};var s=0;!function e(){if(!(s>=o.length)){var n=o[s++],r=i.add(n);r.onsuccess=function(){e()},r.onerror=function(n){var o=r.error;if(o&&"ConstraintError"===o.name)return n.preventDefault(),void e();t(o||new Error("add failed"))}}}()}).then(function(){return t._trimOverflow(n)}).then(function(){n.close()}).catch(function(e){throw n.close(),e})}}):Promise.resolve()},V.prototype.readOldest=function(e){return e=e||20,this.openDb().then(function(t){if(!t)return[];var n=Date.now(),r=[];return new Promise(function(o,i){var s=t.transaction(q,"readonly").objectStore(q).index("createdAt").openCursor();s.onerror=function(){i(s.error)},s.onsuccess=function(){var t=s.result;if(!t||r.length>=e)return o();var i=t.value,a=Number(i.nextRetryAt),u=isFinite(a)?Math.floor(a):0;if(u<=n){var c=H(i);c.endpointOverride=i.endpointOverride||"";var f=Number(i.retryCount);c.retryCount=isFinite(f)?Math.floor(f):0,c.nextRetryAt=u,r.push(c)}t.continue()}}).then(function(){return t.close(),r}).catch(function(e){throw t.close(),e})})},V.prototype.removeByIds=function(e){var t=this;return e&&e.length?this.openDb().then(function(n){if(n){for(var r=n.transaction(q,"readwrite"),o=r.objectStore(q),i=0;ic)f++,d.delete(v.id);else{l++;var m=v.pendingDedupeKey||L(v.record,v.endpointOverride||""),_=H(v);m&&(_.pendingDedupeKey=m),_.retryCount=y,_.nextRetryAt=i+a,d.put(_)}}return r._txDone(h).then(function(){return o.close(),{dropped:f,kept:l}}).catch(function(e){throw o.close(),e})}):Promise.resolve({dropped:0,kept:0})},V.prototype.count=function(){var e=this;return this.openDb().then(function(t){if(!t)return 0;var n=t.transaction(q,"readonly");return new Promise(function(e,t){var r=n.objectStore(q).count();r.onsuccess=function(){e(Number(r.result||0))},r.onerror=function(){t(r.error)}}).then(function(r){return e._txDone(n).then(function(){return t.close(),r})}).catch(function(e){throw t.close(),e})})};var N={landingPageView:{landing_page_id:1},landingPageClick:{landing_page_id:1,tab_key:0,tab_name:0,click_coordinates_x:3,click_coordinates_y:3,click_x_percent:3,click_y_percent:3,screen_width:3,screen_height:3,trace_id:1}},U={landingPageView:"landing_page_view",landingPageClick:"landing_page_click"};function K(e,t){var n=N[e];if(!n)throw new Error("[sdk][landing] 未知事件方法:"+e);var r=t||{},o={},i=[],s=[];if(Object.keys(n).forEach(function(e){var t,a=n[e],u=1&a,c=a>>1&3,f=!!(8&a),l=r[e];f&&null===l&&(l=""),!u||f||null!=l&&""!==l?u&&f&&void 0===l?i.push(e):(u||null!=l)&&((1===c?"number"==typeof(t=l)&&isFinite(t)&&t===Math.floor(t):function(e){return"string"==typeof e}(l))?o[e]=l:s.push(e+"(expected "+(1===c?"int":"string")+")")):i.push(e)}),i.length||s.length){var a=new Error("[sdk][landing] 事件字段校验失败:"+e);throw a.name="EventValidationError",a.eventMethod=e,a.missingFields=i.slice(),a.typeErrorFields=s.slice(),a}return o}var z=Object.keys(U).reduce(function(e,t){var n=U[t];return e[t]=function(e){return{event:n,payload:K(t,e||{})}},e},{});function Q(){for(var e={},t=0;tJ&&delete e[n[r]]}function n(){try{"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem($,JSON.stringify(e))}catch(e){}}if(function(){try{if("undefined"!=typeof window&&window.localStorage){var t=window.localStorage.getItem($);if(t)for(var n=JSON.parse(t),r=Date.now(),o=Object.keys(n),i=0;i500){for(var a="",u=1/0,c=0;ch&&(h=p)}var v=n._getRetryDelay(h);return n.persistentQueue.updateRetryMeta(t,v,5)}):l}}):(G("[sdk][landing] _resolveEndpoint 未注入,持久队列重试跳过"),Promise.resolve())},X.prototype.replayPersistent=function(){var e=this;return!this.hasPersistentItems||this.replaying?Promise.resolve():(this.replaying=!0,this.persistentQueue.readOldest(10).then(function(t){if(!t.length)return e.persistentQueue.count().then(function(t){0===t&&(e.hasPersistentItems=!1)});for(var n={},r=0;r=10?n.flush().catch(function(){}):n.schedule()})})})},X.prototype.stop=function(){this._stopTimer(),this.replayTimer&&(clearInterval(this.replayTimer),this.replayTimer=null);var e={sent:!1,ok:!1,status:0,reason:"stopped"},t=this;this.queue.splice(0).forEach(function(n){t._settleItem(n,e)})},X.prototype.getConfig=function(){return{batchMaxSize:10,batchIntervalMs:2e3,replayBatchSize:10,replayIntervalMs:I}},Y.prototype._registerLifecycle=function(){if("undefined"!=typeof window){var e=this;this._onPageHide=function(){e.batcher.flush().catch(function(){})},this._onVisChange=function(){"undefined"!=typeof document&&"hidden"===document.visibilityState&&e.batcher.flush().catch(function(){})},window.addEventListener("pagehide",this._onPageHide),window.addEventListener("visibilitychange",this._onVisChange)}},Y.prototype._init=function(e){if(this._ssrSkipped)return this._buildInitReturn();for(var t=Object.keys(e||{}),n=0;n=e.length)return Promise.resolve();if(!Z||Z!==t){for(var r=e.slice(n),o=r.length-1;o>=0;o--)ee.unshift(r[o]);return Promise.resolve()}var i=e[n];return t.track(i.event,i.endpoint).catch(function(){}).then(function(){return re(e,t,n+1)})}function oe(e,t){if(Z){var n=Z;return(te||Promise.resolve()).then(function(){return n.track(e,t)})}return ee.push({event:e,endpoint:t}),ee.length>500&&ee.shift(),Promise.resolve({sent:!1,ok:!0,status:0,reason:"pre_init_cached"})}var ie=oe;ie.setContext=function(e){return ne().setContext(e)},ie.setUid=function(e){return ne().setUid(e)},ie.setChannel=function(e){return ne().setContext({channel:e})},ie.notifyPageLoad=function(){S(Date.now())},ie.getConfig=function(){return ne().getConfig()},ie.flush=function(){return ne().flush()},ie.refreshDomainConfig=function(){return ne().refreshDomainConfig()},ie.stop=function(){Z?(Z.stop(),Z=null):ee.length=0},ie.version=T,ie.getCommonFields=function(e){var t=Z?Z.getConfig():{};return k().then(function(n){var r=c({appId:t.appId,channel:t.channel,uid:t.uid,deviceId:t.deviceId||n,sid:C(),deviceType:s(),deviceBrand:"",deviceModel:"",deviceFingerprint:E(a),fpVersion:x,sdkVersion:T,appVersion:u(t.appVersion)});if(!Array.isArray(e)||!e.length)return r;for(var o={},i=0;i -import { onMounted } from 'vue' - -function initTracker() { - var urlParams = new URLSearchParams(window.location.search) - var config = { - appId: 'JHA-209', - domain: window.location.origin, - // 渠道参数优先级 dc → ch → pc(与 d10vry7axuojk2 版落地页一致) - channel: urlParams.get('dc') || urlParams.get('ch') || urlParams.get('pc') || '', - batch: true, - } - var timer = setInterval(function () { - if (window.LandingSDK) { - clearInterval(timer) - window.LandingSDK.init(config) - var queued = (window.tracker && window.tracker.q) || [] - var real = window.LandingSDK.track - real.q = [] - window.tracker = real - queued.forEach(function (item) { - real.apply(null, item.args).then(item.resolve).catch(item.reject) - }) - queued.length = 0 - } - }, 30) -} - -// 黄果落地页埋点 appId = JHA-209(下载接口用数字 209,见 config/app.ts);channel 取 URL 的 dc 渠道参数 -onMounted(() => { - initTracker() -}) - -