New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wxobs/miniprogram-helper

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wxobs/miniprogram-helper - npm Package Compare versions

Comparing version 0.5.4 to 0.6.4

21

dist/index.d.ts

@@ -45,19 +45,8 @@ declare enum PxStatus {

export declare function setAttrs(attrs: Record<string, string>): Promise<void>;
export declare const event: (name: string, props: Record<string, string | number>) => boolean;
export declare const setCustomId: (uid: string) => boolean;
export declare const setCustomProperties: (props: Record<string, string | number>) => boolean;
export declare function getStatus(): PxStatus | undefined;
export declare function event(eventName: string, eventProperties?: Record<string, string | number>): boolean;
export declare function setCustomId(uid: string): boolean;
export declare function setCustomProperties(props: Record<string, string | number>): boolean;
export declare function getStatus(): PxStatus;
export declare function getFeatureFlags(options: IGetFeatureFlagsOptions): Promise<Record<string, IFeatureFlagInfo>>;
export declare function getFeatureFlagsSync(): Record<string, IFeatureFlagInfo>;
declare const _default: {
setup: typeof setup;
event: (name: string, props: Record<string, string | number>) => boolean;
setCustomId: (uid: string) => boolean;
setCustomProperties: (props: Record<string, string | number>) => boolean;
teardown: typeof teardown;
setAttrs: typeof setAttrs;
getStatus: typeof getStatus;
getFeatureFlags: typeof getFeatureFlags;
getFeatureFlagsSync: typeof getFeatureFlagsSync;
};
export default _default;
export {};

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,o,n,r,i,s,u,l=function(){return l=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},l.apply(this,arguments)};function a(e,t,o,n){return new(o||(o=Promise))((function(r,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function u(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,u)}l((n=n.apply(e,t||[])).next())}))}function c(e,t){var o,n,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(l){return function(u){if(o)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(s=0)),s;)try{if(o=1,n&&(r=2&u[0]?n.return:u[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,u[1])).done)return r;switch(n=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,n=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],n=0}finally{o=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,l])}}}!function(e){e.NotSetup="NotSetup",e.SettingUp="SettingUp",e.WaitingForFirstReport="WaitingForFirstReport",e.Collecting="Collecting",e.TearingDown="TearingDown"}(s||(s={})),function(e){e[e.BOOLEAN=1]="BOOLEAN",e[e.STRING=2]="STRING",e[e.NUMBER=3]="NUMBER",e[e.JSON=4]="JSON"}(u||(u={}));var v,d=new Promise((function(e){var t=setInterval((function(){var o,n;if(void 0===(null===(n=null===(o=wx.cloud)||void 0===o?void 0:o.obs)||void 0===n?void 0:n.getStatus))return e(!0),void clearInterval(t);m()===s.Collecting&&(clearInterval(t),e(!0))}),100)}));function p(e){var t;return a(this,void 0,void 0,(function(){var o,n;return c(this,(function(r){switch(r.label){case 0:return void 0===(null===(t=null===wx||void 0===wx?void 0:wx.cloud)||void 0===t?void 0:t.obs)?[2,{errMsg:"function setup is not supported in this version, please upgrade your wxapplib version\n[体验分析]当前基础库版本过低,不支持体验分析,请升级基础库版本到 2.24.4 或以上"}]:(o=!0,void 0!==(null==e?void 0:e.isWhitelistMaskMode)?o=e.isWhitelistMaskMode:(null==e?void 0:e.maskMode)&&(o="all-mask"===e.maskMode),y(),wx.cloud.obs.asyncSetup?[2,wx.cloud.obs.asyncSetup(Object.assign(e||{},{projectId:null===__wxConfig||void 0===__wxConfig?void 0:__wxConfig.accountInfo.appId,isWhitelistMaskMode:o,newSessionCallback:function(t){var o;null===(o=null==e?void 0:e.newSessionCallback)||void 0===o||o.call(e,t),y()}}))]:[3,1]);case 1:return n=wx.cloud.obs.setup(Object.assign(e||{},{projectId:null===__wxConfig||void 0===__wxConfig?void 0:__wxConfig.accountInfo.appId,isWhitelistMaskMode:o})),[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:return r.sent(),[2,n?{sessionId:n}:{errMsg:"setup failed"}]}}))}))}function f(){var e,t;return a(this,void 0,void 0,(function(){return c(this,(function(o){switch(o.label){case 0:if(void 0===(null===(t=null===(e=null===wx||void 0===wx?void 0:wx.cloud)||void 0===e?void 0:e.obs)||void 0===t?void 0:t.teardown))throw new Error("[wxobs]function teardown is not supported in this version, please upgrade your wxapplib version\n[体验分析]当前基础库版本过低,不支持 teardown 函数");return[4,wx.cloud.obs.teardown()];case 1:return o.sent(),d=new Promise((function(e){var t=setInterval((function(){var o,n;if(void 0===(null===(n=null===(o=wx.cloud)||void 0===o?void 0:o.obs)||void 0===n?void 0:n.getStatus))return e(!0),void clearInterval(t);m()===s.Collecting&&(clearInterval(t),e(!0))}),100)})),[2]}}))}))}function w(e){var t,o;return a(this,void 0,void 0,(function(){return c(this,(function(n){switch(n.label){case 0:return[4,d];case 1:return n.sent(),void 0===(null===(o=null===(t=null===wx||void 0===wx?void 0:wx.cloud)||void 0===t?void 0:t.obs)||void 0===o?void 0:o.setAttrs)?(console.error("[wxobs]function setAttrs is not supported in this version, please upgrade your wxapplib version\n[体验分析]当前基础库版本过低,不支持 setAttrs 函数"),[2]):(wx.cloud.obs.setAttrs(e),[2])}}))}))}function g(e){var t,o;return a(this,void 0,void 0,(function(){return c(this,(function(n){switch(n.label){case 0:return[4,d];case 1:return n.sent(),void 0===(null===(o=null===(t=null===wx||void 0===wx?void 0:wx.cloud)||void 0===t?void 0:t.obs)||void 0===o?void 0:o.emitEvent)?(console.error("[wxobs]function emitEvent is not supported in this version, please upgrade your wxapplib version\n[体验分析]当前基础库版本过低,不支持 emitEvent 函数"),[2]):(wx.cloud.obs.emitEvent(e),[2])}}))}))}function x(e,t,o){var n="[wxobs] ".concat(e," 调用错误,");try{if("object"==typeof t&&null!==t){var r=Boolean(t.__cos_only__),i=Object.keys(t);if(r||i.length<=10){for(var s=0;s<i.length;s++){if(i[s].length>50&&!i[s].includes(","))return console.error("".concat(n).concat(i[s]," 属性key过长,需<=50,且不包含','")),!1;var u=t[i[s]];if("string"==typeof u){if(!r&&(u.length>255||u.includes(",")))return console.error("".concat(n).concat(i[s]," 属性 value 不符合规则,长度不能超过 255 且不能包含英文逗号(,),如需包含请先转义")),!1;o["wxobs_props_".concat(i[s],"_string")]=u}else{if(!Number.isSafeInteger(u))return console.error("".concat(n).concat(i[s],"属性value不符合规则")),!1;o["wxobs_props_".concat(i[s],"_int")]="".concat(u)}}return r&&(o.__cos_only__="1"),!0}console.error("".concat(n," 需要少于 10 个属性"))}else console.error("".concat(n," 需要为 Object"))}catch(e){console.error(n,e)}return!1}var b=null!==(t=null===(e=wx.obs)||void 0===e?void 0:e.event)&&void 0!==t?t:function(e,t){if(void 0===t&&(t={}),wx.obs&&I(wx.version.version,"3.4.8")>=0)return wx.obs.event(e,t);var o={};if(x("event",t,o)){if("string"==typeof e&&e.length<=50&&!e.includes(","))return g(l({wxobs_type:"__userob_default_custom_event_emit__",wxobs_primary_event_name:e},o)),!0;console.error("体验分析helper.event调用错误,eventName需要少于50个字符")}return!1},_=null!==(n=null===(o=wx.obs)||void 0===o?void 0:o.setCustomId)&&void 0!==n?n:function(e){return"string"==typeof e&&e.length<=80&&!e.includes(",")?(g({wxobs_type:"__userob_default_custom_id_set__",wxobs_primary_uid:e}),v=e,wx.setStorage({key:"wxobs_cache_uid",data:e}),!0):(console.error("setCustomId调用错误,自定义id必须为字符串且少于80个字符, 当前输入为'".concat(e,"'")),!1)},h=null!==(i=null===(r=wx.obs)||void 0===r?void 0:r.setCustomProperties)&&void 0!==i?i:function(e){if(!v)return console.error("未setId。无法setProperties"),!1;var t={};return!!x("setCustomProperties",e,t)&&(g(l({wxobs_type:"__userob_default_custom_props_set__",wxobs_primary_uid:v},t)),!0)};function y(){try{var e=wx.getStorageSync("wxobs_cache_uid");e&&_(e)}catch(e){}}function m(){var e,t,o,n,r,i;return void 0!==(null===(t=null===(e=null===wx||void 0===wx?void 0:wx.cloud)||void 0===e?void 0:e.obs)||void 0===t?void 0:t.getStatus)||(null===(o=wx.obs)||void 0===o?void 0:o.getStatus)?null===(i=null===(r=null===(n=null===wx||void 0===wx?void 0:wx.cloud)||void 0===n?void 0:n.obs)||void 0===r?void 0:r.getStatus)||void 0===i?void 0:i.call(r):s.NotSetup}function S(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(o){switch(o.label){case 0:return wx.obs||console.error("[wxobs] getFeatureFlags is not supported in this version, please upgrade your wxapplib version\n[体验分析]当前基础库版本过低,不支持 getFeatureFlags 函数"),[4,wx.obs.getFeatureFlags(e)];case 1:return t=o.sent(),I(wx.version.version,"3.4.7")<0&&setTimeout((function(){!function(e,t){var o,n,r={};try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],n=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),s=i.next();!s.done;s=i.next()){var a=s.value;if(t[a]){var c="flag_value_".concat(a);t[a].type===u.JSON?r[c]=C(JSON.stringify(t[a].value)):t[a].type===u.STRING?r[c]=C(t[a].value+""):t[a].type===u.NUMBER||t[a].type===u.BOOLEAN?r[c]="".concat(t[a].value):(console.warn("体验分析helper: 收到未知类型的 flag(key ".concat(a,",类型 ").concat(t[a].type,"),将当做 string 处理,请检查是否需要更新 SDK 版本,或反馈官方支持")),r[c]=C(t[a].value+""))}else r["flag_empty_".concat(a)]="1"}}catch(e){o={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}g(l({wxobs_type:"feature_flags_received"},r))}(e.flags,t)}),0),[2,t]}}))}))}function F(){return wx.obs||console.error("[wxobs] getFeatureFlagsSync is not supported in this version, please upgrade your wxapplib version\n[体验分析]当前基础库版本过低,不支持 getFeatureFlagsSync 函数"),wx.obs.getFeatureFlagsSync()}function I(e,t){if("string"!=typeof e||"string"!=typeof t)return 0;for(var o=e.split("."),n=t.split("."),r=Math.max(o.length,n.length);o.length<r;)o.push("0");for(;n.length<r;)n.push("0");for(var i=0;i<r;i++){var s=parseInt(o[i],10),u=parseInt(n[i],10);if(s>u)return 1;if(s<u)return-1}return 0}function C(e){for(var t=e.length,o=5381,n=0;n<t;++n)o=(o<<5)+o+e.charCodeAt(n);return String(o)}var O={setup:p,event:b,setCustomId:_,setCustomProperties:h,teardown:f,setAttrs:w,getStatus:m,getFeatureFlags:S,getFeatureFlagsSync:F};exports.default=O,exports.event=b,exports.getFeatureFlags=S,exports.getFeatureFlagsSync=F,exports.getStatus=m,exports.setAttrs=w,exports.setCustomId=_,exports.setCustomProperties=h,exports.setup=p,exports.teardown=f;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,o=function(){return o=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},o.apply(this,arguments)};function n(t,e,o,n){return new(o||(o=Promise))((function(r,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function l(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(s,l)}u((n=n.apply(t,e||[])).next())}))}function r(t,e){var o,n,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=l(0),s.throw=l(1),s.return=l(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function l(l){return function(u){return function(l){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(i=0)),i;)try{if(o=1,n&&(r=2&l[0]?n.return:l[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,l[1])).done)return r;switch(n=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!r||l[1]>r[0]&&l[1]<r[3])){i.label=l[1];break}if(6===l[0]&&i.label<r[1]){i.label=r[1],r=l;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(l);break}r[2]&&i.ops.pop(),i.trys.pop();continue}l=e.call(t,i)}catch(t){l=[6,t],n=0}finally{o=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,u])}}}"function"==typeof SuppressedError&&SuppressedError,function(t){t.NotSetup="NotSetup",t.SettingUp="SettingUp",t.WaitingForFirstReport="WaitingForFirstReport",t.Collecting="Collecting",t.TearingDown="TearingDown"}(t||(t={})),function(t){t[t.BOOLEAN=1]="BOOLEAN",t[t.STRING=2]="STRING",t[t.NUMBER=3]="NUMBER",t[t.JSON=4]="JSON"}(e||(e={}));var i,s,l,u,a,c,v,d,f,p,w,b,x,g,_,h,y,S,m,I,F,O,C=new Promise((function(e){var o=setInterval((function(){var n,r;if(void 0===(null===(r=null===(n=wx.cloud)||void 0===n?void 0:n.obs)||void 0===r?void 0:r.getStatus))return e(!0),void clearInterval(o);R()===t.Collecting&&(clearInterval(o),e(!0))}),100)}));function N(t){var e;return n(this,void 0,void 0,(function(){var o,n;return r(this,(function(r){switch(r.label){case 0:return void 0===(null===(e=null===wx||void 0===wx?void 0:wx.cloud)||void 0===e?void 0:e.obs)?[2,{errMsg:"function setup is not supported in this version"}]:(o=!0,void 0!==(null==t?void 0:t.isWhitelistMaskMode)?o=t.isWhitelistMaskMode:(null==t?void 0:t.maskMode)&&(o="all-mask"===t.maskMode),T(),wx.cloud.obs.asyncSetup?[2,wx.cloud.obs.asyncSetup(Object.assign(t||{},{projectId:null===__wxConfig||void 0===__wxConfig?void 0:__wxConfig.accountInfo.appId,isWhitelistMaskMode:o,newSessionCallback:function(e){var o,n;s=null!==(o=e.sessionId)&&void 0!==o?o:"",null===(n=null==t?void 0:t.newSessionCallback)||void 0===n||n.call(t,e),T()}})).then((function(t){var e;return s=null!==(e=t.sessionId)&&void 0!==e?e:"",t}))]:[3,1]);case 1:return n=wx.cloud.obs.setup(Object.assign(t||{},{projectId:null===__wxConfig||void 0===__wxConfig?void 0:__wxConfig.accountInfo.appId,isWhitelistMaskMode:o})),s=null!=n?n:"",[4,new Promise((function(t){return setTimeout(t,1e3)}))];case 2:return r.sent(),[2,n?{sessionId:n}:{errMsg:"setup failed"}]}}))}))}function k(){var e,o;return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:if(void 0===(null===(o=null===(e=null===wx||void 0===wx?void 0:wx.cloud)||void 0===e?void 0:e.obs)||void 0===o?void 0:o.teardown))throw new Error("[wxobs]function teardown is not supported in this version");return[4,wx.cloud.obs.teardown()];case 1:return n.sent(),C=new Promise((function(e){var o=setInterval((function(){var n,r;if(void 0===(null===(r=null===(n=wx.cloud)||void 0===n?void 0:n.obs)||void 0===r?void 0:r.getStatus))return e(!0),void clearInterval(o);R()===t.Collecting&&(clearInterval(o),e(!0))}),100)})),[2]}}))}))}function M(t){var e,o;return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:return[4,C];case 1:return n.sent(),void 0===(null===(o=null===(e=null===wx||void 0===wx?void 0:wx.cloud)||void 0===e?void 0:e.obs)||void 0===o?void 0:o.setAttrs)?(console.error("[wxobs]function setAttrs is not supported in this version"),[2]):(wx.cloud.obs.setAttrs(t),[2])}}))}))}function j(t){var e,o;return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:return[4,C];case 1:return n.sent(),void 0===(null===(o=null===(e=null===wx||void 0===wx?void 0:wx.cloud)||void 0===e?void 0:e.obs)||void 0===o?void 0:o.emitEvent)?(console.error("[wxobs]function emitEvent is not supported in this version"),[2]):(wx.cloud.obs.emitEvent(t),[2])}}))}))}function E(t,e,o){var n="[wxobs] ".concat(t," 调用错误,");try{if("object"==typeof e&&null!==e){var r=Boolean(e.__cos_only__),i=Object.keys(e);if(r||i.length<=10){for(var s=0;s<i.length;s++){if(i[s].length>50&&!i[s].includes(","))return console.error("".concat(n).concat(i[s]," 属性key过长,需<=50,且不包含','")),!1;var l=e[i[s]];if("string"==typeof l){if(!r&&(l.length>255||l.includes(",")))return console.error("".concat(n).concat(i[s]," 属性 value 不符合规则,长度不能超过 255 且不能包含英文逗号(,),如需包含请先转义")),!1;o["wxobs_props_".concat(i[s],"_string")]=l}else{if(!Number.isSafeInteger(l))return console.error("".concat(n).concat(i[s],"属性value不符合规则")),!1;o["wxobs_props_".concat(i[s],"_int")]="".concat(l)}}return r&&(o.__cos_only__="1"),!0}console.error("".concat(n," 需要少于 10 个属性"))}else console.error("".concat(n," 需要为 Object"))}catch(t){console.error(n,t)}return!1}function P(t,e){if(void 0===e&&(e={}),wx.obs&&U(wx.version.version,"3.4.8")>=0)return wx.obs.event(t,e);var n={};if(E("event",e,n)){if("string"==typeof t&&t.length<=50&&!t.includes(","))return j(o({wxobs_type:"__userob_default_custom_event_emit__",wxobs_primary_event_name:t},n)),!0;console.error("体验分析helper.event调用错误,eventName需要少于50个字符")}return!1}function A(t){return"string"==typeof t&&t.length<=80&&!t.includes(",")?(j({wxobs_type:"__userob_default_custom_id_set__",wxobs_primary_uid:t}),i=t,wx.setStorage({key:"wxobs_cache_uid",data:t}),!0):(console.error("setCustomId调用错误,自定义id必须为字符串且少于80个字符, 当前输入为'".concat(t,"'")),!1)}function T(){try{var t=wx.getStorageSync("wxobs_cache_uid");t&&A(t)}catch(t){}}function R(){var e,o,n,r,i;return void 0===(null===(o=null===(e=null===wx||void 0===wx?void 0:wx.cloud)||void 0===e?void 0:e.obs)||void 0===o?void 0:o.getStatus)?t.NotSetup:null===(i=null===(r=null===(n=null===wx||void 0===wx?void 0:wx.cloud)||void 0===n?void 0:n.obs)||void 0===r?void 0:r.getStatus)||void 0===i?void 0:i.call(r)}function B(t){return n(this,void 0,void 0,(function(){var n;return r(this,(function(r){switch(r.label){case 0:return wx.obs||console.error("[wxobs] getFeatureFlags is not supported in this version"),[4,wx.obs.getFeatureFlags(t)];case 1:return n=r.sent(),U(wx.version.version,"3.4.7")<0&&setTimeout((function(){!function(t,n){var r,i,s={};try{for(var l=function(t){var e="function"==typeof Symbol&&Symbol.iterator,o=e&&t[e],n=0;if(o)return o.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(t),u=l.next();!u.done;u=l.next()){var a=u.value;if(n[a]){var c="flag_value_".concat(a);n[a].type===e.JSON?s[c]=G(JSON.stringify(n[a].value)):n[a].type===e.STRING?s[c]=G(n[a].value+""):n[a].type===e.NUMBER||n[a].type===e.BOOLEAN?s[c]="".concat(n[a].value):(console.warn("体验分析helper: 收到未知类型的 flag(key ".concat(a,",类型 ").concat(n[a].type,"),将当做 string 处理,请检查是否需要更新 SDK 版本,或反馈官方支持")),s[c]=G(n[a].value+""))}else s["flag_empty_".concat(a)]="1"}}catch(t){r={error:t}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}j(o({wxobs_type:"feature_flags_received"},s))}(t.flags,n)}),0),[2,n]}}))}))}function W(){return wx.obs||console.error("[wxobs] getFeatureFlagsSync is not supported in this version"),wx.obs.getFeatureFlagsSync()}function U(t,e){if("string"!=typeof t||"string"!=typeof e)return 0;for(var o=t.split("."),n=e.split("."),r=Math.max(o.length,n.length);o.length<r;)o.push("0");for(;n.length<r;)n.push("0");for(var i=0;i<r;i++){var s=parseInt(o[i],10),l=parseInt(n[i],10);if(s>l)return 1;if(s<l)return-1}return 0}function G(t){for(var e=t.length,o=5381,n=0;n<e;++n)o=(o<<5)+o+t.charCodeAt(n);return String(o)}wx.obs||Object.assign(wx,{obs:{}}),Object.assign(wx.obs,{setup:null!==(u=null===(l=wx.obs)||void 0===l?void 0:l.setup)&&void 0!==u?u:N,event:null!==(c=null===(a=wx.obs)||void 0===a?void 0:a.event)&&void 0!==c?c:P,setCustomId:null!==(d=null===(v=wx.obs)||void 0===v?void 0:v.setCustomId)&&void 0!==d?d:A,setCustomProperties:null!==(p=null===(f=wx.obs)||void 0===f?void 0:f.setCustomProperties)&&void 0!==p?p:A,teardown:null!==(b=null===(w=wx.obs)||void 0===w?void 0:w.teardown)&&void 0!==b?b:k,setAttrs:null!==(g=null===(x=wx.obs)||void 0===x?void 0:x.setAttrs)&&void 0!==g?g:M,getStatus:null!==(h=null===(_=wx.obs)||void 0===_?void 0:_.getStatus)&&void 0!==h?h:R,getSessionId:null!==(S=null===(y=wx.obs)||void 0===y?void 0:y.getSessionId)&&void 0!==S?S:function(){return s},getFeatureFlags:null!==(I=null===(m=wx.obs)||void 0===m?void 0:m.getFeatureFlags)&&void 0!==I?I:B,getFeatureFlagsSync:null!==(O=null===(F=wx.obs)||void 0===F?void 0:F.getFeatureFlagsSync)&&void 0!==O?O:W}),exports.event=P,exports.getFeatureFlags=B,exports.getFeatureFlagsSync=W,exports.getStatus=R,exports.setAttrs=M,exports.setCustomId=A,exports.setCustomProperties=function(t){if(!i)return console.error("未setId。无法setProperties"),!1;var e={};return!!E("setCustomProperties",t,e)&&(j(o({wxobs_type:"__userob_default_custom_props_set__",wxobs_primary_uid:i},e)),!0)},exports.setup=N,exports.teardown=k;
{
"name": "@wxobs/miniprogram-helper",
"version": "0.5.4",
"version": "0.6.4",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc