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

@liff/analytics

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@liff/analytics - npm Package Compare versions

Comparing version 2.21.1 to 2.21.2

2

lib/index.cjs.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@liff/consts"),i=require("@liff/logger"),r=require("@liff/util"),s=require("@liff/store"),n=require("@liff/get-version"),o=require("@liff/is-logged-in"),u=require("@liff/get-profile");function a(){return e.__awaiter(this,void 0,void 0,(function(){var t,r;return e.__generator(this,(function(e){switch(e.label){case 0:if(!o.isLoggedIn())return[3,6];e.label=1;case 1:return e.trys.push([1,5,,6]),(t=s.getDecodedIDToken())&&t.sub?[2,t.sub]:[3,2];case 2:return[4,u.getProfile()];case 3:if((r=e.sent())&&r.userId)return[2,r.userId];e.label=4;case 4:return[3,6];case 5:return e.sent(),i.logger.debug("can't retrieve Mid/Uid because of something wrong"),[3,6];case 6:return[2]}}))}))}function f(){return e.__awaiter(this,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,a()];case 1:return(t=e.sent())&&"u"===t.substring(0,1)?[2,t]:[2]}}))}))}var c=function(){function u(){this.utsExtra={isLiffSuccessful:!1,isLoggedIn:!1,id:"",version:""},this.injected=!1}return Object.defineProperty(u,"CUSTOMPLACEID_INIT",{get:function(){return"liff.init"},enumerable:!1,configurable:!0}),Object.defineProperty(u,"CUSTOMTYPE",{get:function(){return"liffSdk"},enumerable:!1,configurable:!0}),Object.defineProperty(u,"GENERAL_UTS_ID",{get:function(){return"liff_general"},enumerable:!1,configurable:!0}),Object.defineProperty(u,"GENERAL_APP_NAME",{get:function(){return"LIFF General"},enumerable:!1,configurable:!0}),Object.defineProperty(u,"LiffUtsLoginStatus",{get:function(){return{isLoggedIn:1,isLiffSuccessful:2}},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"name",{get:function(){return"analytics"},enumerable:!1,configurable:!0}),u.prototype.install=function(e){var t=e.liff,i=e.internalHooks;this.liffCore=t,i.init.beforeFinished(this.beforeInitFinished.bind(this)),i.init.beforeSuccess(this.beforeInitSuccess.bind(this)),i.init.error(this.initError.bind(this))},u.prototype.changeRatioToUTSFormat=function(e){if(e&&Number.isFinite(e))return Math.round(100*e)},u.prototype.setExtra=function(){var e=this.utsExtra,t=e.isLiffSuccessful,i=e.isLoggedIn,r=e.id,s=e.version,n=(i?u.LiffUtsLoginStatus.isLoggedIn:0)|(t?u.LiffUtsLoginStatus.isLiffSuccessful:0);this.uts.setExtra("liff",{id:r,loginStatus:n,version:s})},u.prototype.assignUtsExtra=function(e){Object.assign(this.utsExtra,e)},u.prototype.setVersion=function(e){this.assignUtsExtra({version:e}),i.logger.debug("[LIFFUTS][SDK version] "+e),this.setExtra()},u.prototype.setLiffId=function(e){this.assignUtsExtra({id:e}),i.logger.debug("[LIFFUTS][LIFFID] "+e),this.setExtra()},u.prototype.setIsLoggedIn=function(e){this.assignUtsExtra({isLoggedIn:e}),i.logger.debug("[LIFFUTS][isLoggedIn] "+e),this.setExtra()},u.prototype.sendLiffInit=function(){i.logger.debug("[LIFFUTS][sendCustom] liff.init"),this.uts.sendCustom({type:u.CUSTOMTYPE,params:{placeId:u.CUSTOMPLACEID_INIT}})},u.prototype.setIsLiffSuccessful=function(e){this.assignUtsExtra({isLiffSuccessful:e}),i.logger.debug("[LIFFUTS][isLiffInitSuccessful] "+e),this.setExtra()},u.prototype.prepareReferrer=function(e){var i={};Object.keys(e).forEach((function(r){if(t.UTS_REFERRER_QUERY.includes(r)){var s=e[r];"string"==typeof s&&s&&(i[r.replace(/^liff\.ref\./,"")]=s)}})),Object.keys(i).length>0&&(this.referrer=i)},u.prototype.beforeInitFinished=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,a,c,l,g,d,p,h,b,I,L,E,S;return e.__generator(this,(function(v){switch(v.label){case 0:if(t=r.qs.parse(window.location.search),this.prepareReferrer(t),a=s.getContext(),!(c=null==a?void 0:a.utsTracking))return[2];if("auto"!==(l=c.mode)&&"force"!==l)return[3,6];i.logger.debug("[LIFFUTS] "+(new Date).toUTCString()),g=s.getConfig(),d=g.liffId,p=g.analytics,v.label=1;case 1:return v.trys.push([1,3,,4]),h=this,[4,new Promise((function(e,t){var i=window.uts,r=document.createElement("script");r.type="text/javascript",r.src="https://static.line-scdn.net/uts/edge/4.1.0/uts.js",r.onload=function(){var t=window.uts;e(t),window.uts=i},r.onerror=function(e){t(e)},document.getElementsByTagName("head")[0].appendChild(r)}))];case 2:return h.uts=v.sent(),[3,4];case 3:return b=v.sent(),i.logger.debug("[LIFFUTS] cannot load UTS, reason: "+b),[2];case 4:return I=void 0,L=void 0,"force"===l?(I={utsId:u.GENERAL_UTS_ID,appName:u.GENERAL_APP_NAME,appEnv:"release"},L={endpoint:"https://uts-front.line-apps.com",sampleRate:this.changeRatioToUTSFormat(c.sendRatio),version:"current"}):(I=e.__assign(e.__assign({},null==p?void 0:p.context),{utsId:(null==p?void 0:p.context.utsId)||u.GENERAL_UTS_ID,appName:(null==p?void 0:p.context.appName)||u.GENERAL_APP_NAME,appEnv:(null==p?void 0:p.context.appEnv)||"release"}),L=e.__assign(e.__assign({endpoint:"https://uts-front.line-apps.com"},null==p?void 0:p.options),{sampleRate:this.changeRatioToUTSFormat(c.sendRatio),version:"current"})),this.uts.init(I,L),[4,f()];case 5:(E=v.sent())&&(i.logger.debug("[LIFFUTS][mid] "+E),this.uts.setMid(E)),(null==a?void 0:a.tid)&&(i.logger.debug("[LIFFUTS][tid] "+a.tid),this.uts.setTid(a.tid)),this.referrer&&(i.logger.debug("liff.ref.referrer",this.referrer),this.uts.setSessionParams(this.referrer)),d&&this.setLiffId(d),this.setIsLoggedIn(o.isLoggedIn()),this.setVersion(n.getVersion()),S=r.removeCredential(location.href),i.logger.debug("[LIFFUTS][url] "+S),this.uts.setUrl(S),this.liffCore.analytics=this.uts,this.injected=!0,v.label=6;case 6:return[2]}}))}))},u.prototype.beforeInitSuccess=function(){return this.injected&&(this.setIsLiffSuccessful(!0),this.sendLiffInit()),Promise.resolve()},u.prototype.initError=function(){return this.injected&&(this.setIsLiffSuccessful(!1),this.sendLiffInit()),Promise.resolve()},u}();exports.AnalyticsModule=c,exports.sendShareTargetPicker=function(e){i.logger.debug("[LIFFUTS][sendCustom] liff.shareTargetPicker"),e.sendCustom({type:"liffSdk",params:{placeId:"liff.shareTargetPicker"}})};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@liff/consts"),i=require("@liff/logger"),r=require("@liff/util"),s=require("@liff/store"),n=require("@liff/get-version"),o=require("@liff/is-logged-in"),u=require("@liff/get-profile");function a(){return e.__awaiter(this,void 0,void 0,(function(){var t,r;return e.__generator(this,(function(e){switch(e.label){case 0:if(!o.isLoggedIn())return[3,6];e.label=1;case 1:return e.trys.push([1,5,,6]),(t=s.getDecodedIDToken())&&t.sub?[2,t.sub]:[3,2];case 2:return[4,u.getProfile()];case 3:if((r=e.sent())&&r.userId)return[2,r.userId];e.label=4;case 4:return[3,6];case 5:return e.sent(),i.logger.debug("can't retrieve Mid/Uid because of something wrong"),[3,6];case 6:return[2]}}))}))}function f(){return e.__awaiter(this,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,a()];case 1:return(t=e.sent())&&"u"===t.substring(0,1)?[2,t]:[2]}}))}))}var c=function(){function u(){this.utsExtra={isLiffSuccessful:!1,isLoggedIn:!1,id:"",version:""},this.injected=!1}return Object.defineProperty(u,"CUSTOMPLACEID_INIT",{get:function(){return"liff.init"},enumerable:!1,configurable:!0}),Object.defineProperty(u,"CUSTOMTYPE",{get:function(){return"liffSdk"},enumerable:!1,configurable:!0}),Object.defineProperty(u,"GENERAL_UTS_ID",{get:function(){return"liff_general"},enumerable:!1,configurable:!0}),Object.defineProperty(u,"GENERAL_APP_NAME",{get:function(){return"LIFF General"},enumerable:!1,configurable:!0}),Object.defineProperty(u,"LiffUtsLoginStatus",{get:function(){return{isLoggedIn:1,isLiffSuccessful:2}},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"name",{get:function(){return"analytics"},enumerable:!1,configurable:!0}),u.prototype.install=function(e){var t=e.liff,i=e.internalHooks;this.liffCore=t,i.init.beforeFinished(this.beforeInitFinished.bind(this)),i.init.beforeSuccess(this.beforeInitSuccess.bind(this)),i.init.error(this.initError.bind(this))},u.prototype.changeRatioToUTSFormat=function(e){if(e&&Number.isFinite(e))return Math.round(100*e)},u.prototype.setExtra=function(){var e=this.utsExtra,t=e.isLiffSuccessful,i=e.isLoggedIn,r=e.id,s=e.version,n=(i?u.LiffUtsLoginStatus.isLoggedIn:0)|(t?u.LiffUtsLoginStatus.isLiffSuccessful:0);this.uts.setExtra("liff",{id:r,loginStatus:n,version:s})},u.prototype.assignUtsExtra=function(e){Object.assign(this.utsExtra,e)},u.prototype.setVersion=function(e){this.assignUtsExtra({version:e}),i.logger.debug("[LIFFUTS][SDK version] ".concat(e)),this.setExtra()},u.prototype.setLiffId=function(e){this.assignUtsExtra({id:e}),i.logger.debug("[LIFFUTS][LIFFID] ".concat(e)),this.setExtra()},u.prototype.setIsLoggedIn=function(e){this.assignUtsExtra({isLoggedIn:e}),i.logger.debug("[LIFFUTS][isLoggedIn] ".concat(e)),this.setExtra()},u.prototype.sendLiffInit=function(){i.logger.debug("[LIFFUTS][sendCustom] liff.init"),this.uts.sendCustom({type:u.CUSTOMTYPE,params:{placeId:u.CUSTOMPLACEID_INIT}})},u.prototype.setIsLiffSuccessful=function(e){this.assignUtsExtra({isLiffSuccessful:e}),i.logger.debug("[LIFFUTS][isLiffInitSuccessful] ".concat(e)),this.setExtra()},u.prototype.prepareReferrer=function(e){var i={};Object.keys(e).forEach((function(r){if(t.UTS_REFERRER_QUERY.includes(r)){var s=e[r];"string"==typeof s&&s&&(i[r.replace(/^liff\.ref\./,"")]=s)}})),Object.keys(i).length>0&&(this.referrer=i)},u.prototype.beforeInitFinished=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,a,c,l,g,d,p,h,b,I,L,E,S;return e.__generator(this,(function(v){switch(v.label){case 0:if(t=r.qs.parse(window.location.search),this.prepareReferrer(t),a=s.getContext(),!(c=null==a?void 0:a.utsTracking))return[2];if("auto"!==(l=c.mode)&&"force"!==l)return[3,6];i.logger.debug("[LIFFUTS] ".concat((new Date).toUTCString())),g=s.getConfig(),d=g.liffId,p=g.analytics,v.label=1;case 1:return v.trys.push([1,3,,4]),h=this,[4,new Promise((function(e,t){var i=window.uts,r=document.createElement("script");r.type="text/javascript",r.src="https://static.line-scdn.net/uts/edge/4.1.0/uts.js",r.onload=function(){var t=window.uts;e(t),window.uts=i},r.onerror=function(e){t(e)},document.getElementsByTagName("head")[0].appendChild(r)}))];case 2:return h.uts=v.sent(),[3,4];case 3:return b=v.sent(),i.logger.debug("[LIFFUTS] cannot load UTS, reason: ".concat(b)),[2];case 4:return I=void 0,L=void 0,"force"===l?(I={utsId:u.GENERAL_UTS_ID,appName:u.GENERAL_APP_NAME,appEnv:"release"},L={endpoint:"https://uts-front.line-apps.com",sampleRate:this.changeRatioToUTSFormat(c.sendRatio),version:"current"}):(I=e.__assign(e.__assign({},null==p?void 0:p.context),{utsId:(null==p?void 0:p.context.utsId)||u.GENERAL_UTS_ID,appName:(null==p?void 0:p.context.appName)||u.GENERAL_APP_NAME,appEnv:(null==p?void 0:p.context.appEnv)||"release"}),L=e.__assign(e.__assign({endpoint:"https://uts-front.line-apps.com"},null==p?void 0:p.options),{sampleRate:this.changeRatioToUTSFormat(c.sendRatio),version:"current"})),this.uts.init(I,L),[4,f()];case 5:(E=v.sent())&&(i.logger.debug("[LIFFUTS][mid] ".concat(E)),this.uts.setMid(E)),(null==a?void 0:a.tid)&&(i.logger.debug("[LIFFUTS][tid] ".concat(a.tid)),this.uts.setTid(a.tid)),this.referrer&&(i.logger.debug("liff.ref.referrer",this.referrer),this.uts.setSessionParams(this.referrer)),d&&this.setLiffId(d),this.setIsLoggedIn(o.isLoggedIn()),this.setVersion(n.getVersion()),S=r.removeCredential(location.href),i.logger.debug("[LIFFUTS][url] ".concat(S)),this.uts.setUrl(S),this.liffCore.analytics=this.uts,this.injected=!0,v.label=6;case 6:return[2]}}))}))},u.prototype.beforeInitSuccess=function(){return this.injected&&(this.setIsLiffSuccessful(!0),this.sendLiffInit()),Promise.resolve()},u.prototype.initError=function(){return this.injected&&(this.setIsLiffSuccessful(!1),this.sendLiffInit()),Promise.resolve()},u}();exports.AnalyticsModule=c,exports.sendShareTargetPicker=function(e){i.logger.debug("[LIFFUTS][sendCustom] liff.shareTargetPicker"),e.sendCustom({type:"liffSdk",params:{placeId:"liff.shareTargetPicker"}})};

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

import{__awaiter as t,__generator as e,__assign as i}from"tslib";import{UTS_REFERRER_QUERY as s}from"@liff/consts";import{logger as r}from"@liff/logger";import{removeCredential as n,qs as o}from"@liff/util";import{getDecodedIDToken as f,getContext as u,getConfig as a}from"@liff/store";import{getVersion as c}from"@liff/get-version";import{isLoggedIn as l}from"@liff/is-logged-in";import{getProfile as d}from"@liff/get-profile";function p(){return t(this,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!l())return[3,6];e.label=1;case 1:return e.trys.push([1,5,,6]),(t=f())&&t.sub?[2,t.sub]:[3,2];case 2:return[4,d()];case 3:if((i=e.sent())&&i.userId)return[2,i.userId];e.label=4;case 4:return[3,6];case 5:return e.sent(),r.debug("can't retrieve Mid/Uid because of something wrong"),[3,6];case 6:return[2]}}))}))}function h(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,p()];case 1:return(t=e.sent())&&"u"===t.substring(0,1)?[2,t]:[2]}}))}))}var g=function(){function f(){this.utsExtra={isLiffSuccessful:!1,isLoggedIn:!1,id:"",version:""},this.injected=!1}return Object.defineProperty(f,"CUSTOMPLACEID_INIT",{get:function(){return"liff.init"},enumerable:!1,configurable:!0}),Object.defineProperty(f,"CUSTOMTYPE",{get:function(){return"liffSdk"},enumerable:!1,configurable:!0}),Object.defineProperty(f,"GENERAL_UTS_ID",{get:function(){return"liff_general"},enumerable:!1,configurable:!0}),Object.defineProperty(f,"GENERAL_APP_NAME",{get:function(){return"LIFF General"},enumerable:!1,configurable:!0}),Object.defineProperty(f,"LiffUtsLoginStatus",{get:function(){return{isLoggedIn:1,isLiffSuccessful:2}},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"name",{get:function(){return"analytics"},enumerable:!1,configurable:!0}),f.prototype.install=function(t){var e=t.liff,i=t.internalHooks;this.liffCore=e,i.init.beforeFinished(this.beforeInitFinished.bind(this)),i.init.beforeSuccess(this.beforeInitSuccess.bind(this)),i.init.error(this.initError.bind(this))},f.prototype.changeRatioToUTSFormat=function(t){if(t&&Number.isFinite(t))return Math.round(100*t)},f.prototype.setExtra=function(){var t=this.utsExtra,e=t.isLiffSuccessful,i=t.isLoggedIn,s=t.id,r=t.version,n=(i?f.LiffUtsLoginStatus.isLoggedIn:0)|(e?f.LiffUtsLoginStatus.isLiffSuccessful:0);this.uts.setExtra("liff",{id:s,loginStatus:n,version:r})},f.prototype.assignUtsExtra=function(t){Object.assign(this.utsExtra,t)},f.prototype.setVersion=function(t){this.assignUtsExtra({version:t}),r.debug("[LIFFUTS][SDK version] "+t),this.setExtra()},f.prototype.setLiffId=function(t){this.assignUtsExtra({id:t}),r.debug("[LIFFUTS][LIFFID] "+t),this.setExtra()},f.prototype.setIsLoggedIn=function(t){this.assignUtsExtra({isLoggedIn:t}),r.debug("[LIFFUTS][isLoggedIn] "+t),this.setExtra()},f.prototype.sendLiffInit=function(){r.debug("[LIFFUTS][sendCustom] liff.init"),this.uts.sendCustom({type:f.CUSTOMTYPE,params:{placeId:f.CUSTOMPLACEID_INIT}})},f.prototype.setIsLiffSuccessful=function(t){this.assignUtsExtra({isLiffSuccessful:t}),r.debug("[LIFFUTS][isLiffInitSuccessful] "+t),this.setExtra()},f.prototype.prepareReferrer=function(t){var e={};Object.keys(t).forEach((function(i){if(s.includes(i)){var r=t[i];"string"==typeof r&&r&&(e[i.replace(/^liff\.ref\./,"")]=r)}})),Object.keys(e).length>0&&(this.referrer=e)},f.prototype.beforeInitFinished=function(){return t(this,void 0,void 0,(function(){var t,s,d,p,g,b,I,m,L,S,E,v,T;return e(this,(function(e){switch(e.label){case 0:if(t=o.parse(window.location.search),this.prepareReferrer(t),s=u(),!(d=null==s?void 0:s.utsTracking))return[2];if("auto"!==(p=d.mode)&&"force"!==p)return[3,6];r.debug("[LIFFUTS] "+(new Date).toUTCString()),g=a(),b=g.liffId,I=g.analytics,e.label=1;case 1:return e.trys.push([1,3,,4]),m=this,[4,new Promise((function(t,e){var i=window.uts,s=document.createElement("script");s.type="text/javascript",s.src="https://static.line-scdn.net/uts/edge/4.1.0/uts.js",s.onload=function(){var e=window.uts;t(e),window.uts=i},s.onerror=function(t){e(t)},document.getElementsByTagName("head")[0].appendChild(s)}))];case 2:return m.uts=e.sent(),[3,4];case 3:return L=e.sent(),r.debug("[LIFFUTS] cannot load UTS, reason: "+L),[2];case 4:return S=void 0,E=void 0,"force"===p?(S={utsId:f.GENERAL_UTS_ID,appName:f.GENERAL_APP_NAME,appEnv:"release"},E={endpoint:"https://uts-front.line-apps.com",sampleRate:this.changeRatioToUTSFormat(d.sendRatio),version:"current"}):(S=i(i({},null==I?void 0:I.context),{utsId:(null==I?void 0:I.context.utsId)||f.GENERAL_UTS_ID,appName:(null==I?void 0:I.context.appName)||f.GENERAL_APP_NAME,appEnv:(null==I?void 0:I.context.appEnv)||"release"}),E=i(i({endpoint:"https://uts-front.line-apps.com"},null==I?void 0:I.options),{sampleRate:this.changeRatioToUTSFormat(d.sendRatio),version:"current"})),this.uts.init(S,E),[4,h()];case 5:(v=e.sent())&&(r.debug("[LIFFUTS][mid] "+v),this.uts.setMid(v)),(null==s?void 0:s.tid)&&(r.debug("[LIFFUTS][tid] "+s.tid),this.uts.setTid(s.tid)),this.referrer&&(r.debug("liff.ref.referrer",this.referrer),this.uts.setSessionParams(this.referrer)),b&&this.setLiffId(b),this.setIsLoggedIn(l()),this.setVersion(c()),T=n(location.href),r.debug("[LIFFUTS][url] "+T),this.uts.setUrl(T),this.liffCore.analytics=this.uts,this.injected=!0,e.label=6;case 6:return[2]}}))}))},f.prototype.beforeInitSuccess=function(){return this.injected&&(this.setIsLiffSuccessful(!0),this.sendLiffInit()),Promise.resolve()},f.prototype.initError=function(){return this.injected&&(this.setIsLiffSuccessful(!1),this.sendLiffInit()),Promise.resolve()},f}(),b=function(t){r.debug("[LIFFUTS][sendCustom] liff.shareTargetPicker"),t.sendCustom({type:"liffSdk",params:{placeId:"liff.shareTargetPicker"}})};export{g as AnalyticsModule,b as sendShareTargetPicker};
import{__awaiter as t,__generator as e,__assign as i}from"tslib";import{UTS_REFERRER_QUERY as s}from"@liff/consts";import{logger as n}from"@liff/logger";import{removeCredential as r,qs as o}from"@liff/util";import{getDecodedIDToken as f,getContext as u,getConfig as a}from"@liff/store";import{getVersion as c}from"@liff/get-version";import{isLoggedIn as l}from"@liff/is-logged-in";import{getProfile as d}from"@liff/get-profile";function p(){return t(this,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!l())return[3,6];e.label=1;case 1:return e.trys.push([1,5,,6]),(t=f())&&t.sub?[2,t.sub]:[3,2];case 2:return[4,d()];case 3:if((i=e.sent())&&i.userId)return[2,i.userId];e.label=4;case 4:return[3,6];case 5:return e.sent(),n.debug("can't retrieve Mid/Uid because of something wrong"),[3,6];case 6:return[2]}}))}))}function h(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,p()];case 1:return(t=e.sent())&&"u"===t.substring(0,1)?[2,t]:[2]}}))}))}var g=function(){function f(){this.utsExtra={isLiffSuccessful:!1,isLoggedIn:!1,id:"",version:""},this.injected=!1}return Object.defineProperty(f,"CUSTOMPLACEID_INIT",{get:function(){return"liff.init"},enumerable:!1,configurable:!0}),Object.defineProperty(f,"CUSTOMTYPE",{get:function(){return"liffSdk"},enumerable:!1,configurable:!0}),Object.defineProperty(f,"GENERAL_UTS_ID",{get:function(){return"liff_general"},enumerable:!1,configurable:!0}),Object.defineProperty(f,"GENERAL_APP_NAME",{get:function(){return"LIFF General"},enumerable:!1,configurable:!0}),Object.defineProperty(f,"LiffUtsLoginStatus",{get:function(){return{isLoggedIn:1,isLiffSuccessful:2}},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"name",{get:function(){return"analytics"},enumerable:!1,configurable:!0}),f.prototype.install=function(t){var e=t.liff,i=t.internalHooks;this.liffCore=e,i.init.beforeFinished(this.beforeInitFinished.bind(this)),i.init.beforeSuccess(this.beforeInitSuccess.bind(this)),i.init.error(this.initError.bind(this))},f.prototype.changeRatioToUTSFormat=function(t){if(t&&Number.isFinite(t))return Math.round(100*t)},f.prototype.setExtra=function(){var t=this.utsExtra,e=t.isLiffSuccessful,i=t.isLoggedIn,s=t.id,n=t.version,r=(i?f.LiffUtsLoginStatus.isLoggedIn:0)|(e?f.LiffUtsLoginStatus.isLiffSuccessful:0);this.uts.setExtra("liff",{id:s,loginStatus:r,version:n})},f.prototype.assignUtsExtra=function(t){Object.assign(this.utsExtra,t)},f.prototype.setVersion=function(t){this.assignUtsExtra({version:t}),n.debug("[LIFFUTS][SDK version] ".concat(t)),this.setExtra()},f.prototype.setLiffId=function(t){this.assignUtsExtra({id:t}),n.debug("[LIFFUTS][LIFFID] ".concat(t)),this.setExtra()},f.prototype.setIsLoggedIn=function(t){this.assignUtsExtra({isLoggedIn:t}),n.debug("[LIFFUTS][isLoggedIn] ".concat(t)),this.setExtra()},f.prototype.sendLiffInit=function(){n.debug("[LIFFUTS][sendCustom] liff.init"),this.uts.sendCustom({type:f.CUSTOMTYPE,params:{placeId:f.CUSTOMPLACEID_INIT}})},f.prototype.setIsLiffSuccessful=function(t){this.assignUtsExtra({isLiffSuccessful:t}),n.debug("[LIFFUTS][isLiffInitSuccessful] ".concat(t)),this.setExtra()},f.prototype.prepareReferrer=function(t){var e={};Object.keys(t).forEach((function(i){if(s.includes(i)){var n=t[i];"string"==typeof n&&n&&(e[i.replace(/^liff\.ref\./,"")]=n)}})),Object.keys(e).length>0&&(this.referrer=e)},f.prototype.beforeInitFinished=function(){return t(this,void 0,void 0,(function(){var t,s,d,p,g,b,I,m,L,S,E,v,T;return e(this,(function(e){switch(e.label){case 0:if(t=o.parse(window.location.search),this.prepareReferrer(t),s=u(),!(d=null==s?void 0:s.utsTracking))return[2];if("auto"!==(p=d.mode)&&"force"!==p)return[3,6];n.debug("[LIFFUTS] ".concat((new Date).toUTCString())),g=a(),b=g.liffId,I=g.analytics,e.label=1;case 1:return e.trys.push([1,3,,4]),m=this,[4,new Promise((function(t,e){var i=window.uts,s=document.createElement("script");s.type="text/javascript",s.src="https://static.line-scdn.net/uts/edge/4.1.0/uts.js",s.onload=function(){var e=window.uts;t(e),window.uts=i},s.onerror=function(t){e(t)},document.getElementsByTagName("head")[0].appendChild(s)}))];case 2:return m.uts=e.sent(),[3,4];case 3:return L=e.sent(),n.debug("[LIFFUTS] cannot load UTS, reason: ".concat(L)),[2];case 4:return S=void 0,E=void 0,"force"===p?(S={utsId:f.GENERAL_UTS_ID,appName:f.GENERAL_APP_NAME,appEnv:"release"},E={endpoint:"https://uts-front.line-apps.com",sampleRate:this.changeRatioToUTSFormat(d.sendRatio),version:"current"}):(S=i(i({},null==I?void 0:I.context),{utsId:(null==I?void 0:I.context.utsId)||f.GENERAL_UTS_ID,appName:(null==I?void 0:I.context.appName)||f.GENERAL_APP_NAME,appEnv:(null==I?void 0:I.context.appEnv)||"release"}),E=i(i({endpoint:"https://uts-front.line-apps.com"},null==I?void 0:I.options),{sampleRate:this.changeRatioToUTSFormat(d.sendRatio),version:"current"})),this.uts.init(S,E),[4,h()];case 5:(v=e.sent())&&(n.debug("[LIFFUTS][mid] ".concat(v)),this.uts.setMid(v)),(null==s?void 0:s.tid)&&(n.debug("[LIFFUTS][tid] ".concat(s.tid)),this.uts.setTid(s.tid)),this.referrer&&(n.debug("liff.ref.referrer",this.referrer),this.uts.setSessionParams(this.referrer)),b&&this.setLiffId(b),this.setIsLoggedIn(l()),this.setVersion(c()),T=r(location.href),n.debug("[LIFFUTS][url] ".concat(T)),this.uts.setUrl(T),this.liffCore.analytics=this.uts,this.injected=!0,e.label=6;case 6:return[2]}}))}))},f.prototype.beforeInitSuccess=function(){return this.injected&&(this.setIsLiffSuccessful(!0),this.sendLiffInit()),Promise.resolve()},f.prototype.initError=function(){return this.injected&&(this.setIsLiffSuccessful(!1),this.sendLiffInit()),Promise.resolve()},f}(),b=function(t){n.debug("[LIFFUTS][sendCustom] liff.shareTargetPicker"),t.sendCustom({type:"liffSdk",params:{placeId:"liff.shareTargetPicker"}})};export{g as AnalyticsModule,b as sendShareTargetPicker};
{
"name": "@liff/analytics",
"version": "2.21.1",
"version": "2.21.2",
"description": "@liff/analytics",

@@ -24,5 +24,5 @@ "license": "SEE LICENSE IN README.md",

"build:npm": "rollup -c rollup.config.js",
"build:watch": "yarn build:npm -w --watch.include './src/**'",
"dev-server": "yarn build:watch",
"dev-server:https": "yarn build:watch",
"build:watch": "npm run build:npm -- --watch",
"dev-server": "npm run build:watch",
"dev-server:https": "npm run build:watch",
"build:prerelease": "rollup -c rollup.config.prerelease.js",

@@ -35,13 +35,13 @@ "clean": "rm -rf ./lib ./tsconfig.tsbuildinfo"

"dependencies": {
"@liff/consts": "2.21.1",
"@liff/get-profile": "2.21.1",
"@liff/get-version": "2.21.1",
"@liff/is-logged-in": "2.21.1",
"@liff/logger": "2.21.1",
"@liff/store": "2.21.1",
"@liff/types": "2.21.1",
"@liff/use": "2.21.1",
"@liff/util": "2.21.1"
"@liff/consts": "2.21.2",
"@liff/get-profile": "2.21.2",
"@liff/get-version": "2.21.2",
"@liff/is-logged-in": "2.21.2",
"@liff/logger": "2.21.2",
"@liff/store": "2.21.2",
"@liff/types": "2.21.2",
"@liff/use": "2.21.2",
"@liff/util": "2.21.2"
},
"gitHead": "9af2e0816a5cd5547b99e8cadba3ee274b270a9a"
"gitHead": "b43eee22bc2c90b85e9919820c557cc15fb9712c"
}
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