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.4 to 2.22.0

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"),s=require("@liff/util"),r=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,s;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=r.getDecodedIDToken())&&t.sub?[2,t.sub]:[3,2];case 2:return[4,u.getProfile()];case 3:if((s=e.sent())&&s.userId)return[2,s.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,"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,t=this.utsExtra,i=t.isLiffSuccessful,s=t.isLoggedIn,r=t.id,n=t.version,o=(s?u.LiffUtsLoginStatus.isLoggedIn:0)|(i?u.LiffUtsLoginStatus.isLiffSuccessful:0);null===(e=this.uts)||void 0===e||e.setExtra("liff",{id:r,loginStatus:o,version:n})},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(){var e;i.logger.debug("[LIFFUTS][sendCustom] liff.init"),null===(e=this.uts)||void 0===e||e.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(s){if(t.UTS_REFERRER_QUERY.includes(s)){var r=e[s];"string"==typeof r&&r&&(i[s.replace(/^liff\.ref\./,"")]=r)}})),Object.keys(i).length>0&&(this.referrer=i)},u.prototype.beforeInitFinished=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,u,a,c,g,l,d,h,p,I,b,L;return e.__generator(this,(function(S){switch(S.label){case 0:if(t=s.qs.parse(window.location.search),this.prepareReferrer(t),u=r.getContext(),!(a=null==u?void 0:u.utsTracking))return[2];if(c=r.getConfig(),g=c.liffId,l=c.analytics,"auto"!==a.mode||!l)return[3,6];i.logger.debug("[LIFFUTS] ".concat((new Date).toUTCString())),S.label=1;case 1:return S.trys.push([1,3,,4]),d=this,[4,new Promise((function(e,t){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 t=window.uts;e(t),window.uts=i},s.onerror=function(e){t(e)},document.getElementsByTagName("head")[0].appendChild(s)}))];case 2:return d.uts=S.sent(),[3,4];case 3:return h=S.sent(),i.logger.debug("[LIFFUTS] cannot load UTS, reason: ".concat(h)),[2];case 4:return p=e.__assign(e.__assign({},l.context),{utsId:l.context.utsId,appName:l.context.appName,appEnv:l.context.appEnv||"release"}),I=e.__assign(e.__assign({endpoint:"https://uts-front.line-apps.com"},l.options),{sampleRate:this.changeRatioToUTSFormat(a.sendRatio),version:"current"}),this.uts.init(p,I),[4,f()];case 5:(b=S.sent())&&(i.logger.debug("[LIFFUTS][mid] ".concat(b)),this.uts.setMid(b)),(null==u?void 0:u.tid)&&(i.logger.debug("[LIFFUTS][tid] ".concat(u.tid)),this.uts.setTid(u.tid)),this.referrer&&(i.logger.debug("liff.ref.referrer",this.referrer),this.uts.setSessionParams(this.referrer)),g&&this.setLiffId(g),this.setIsLoggedIn(o.isLoggedIn()),this.setVersion(n.getVersion()),L=s.removeCredential(location.href),i.logger.debug("[LIFFUTS][url] ".concat(L)),this.uts.setUrl(L),this.liffCore.analytics=this.uts,this.injected=!0,S.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/use"),o=require("@liff/get-version"),u=require("@liff/is-logged-in"),a=require("@liff/get-profile");function f(){return e.__awaiter(this,void 0,void 0,(function(){var t,r;return e.__generator(this,(function(e){switch(e.label){case 0:if(!u.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,a.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 c(){return e.__awaiter(this,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,f()];case 1:return(t=e.sent())&&"u"===t.substring(0,1)?[2,t]:[2]}}))}))}var l=function(n){function a(){var e=null!==n&&n.apply(this,arguments)||this;return e.utsExtra={isLiffSuccessful:!1,isLoggedIn:!1,id:"",version:""},e.injected=!1,e}return e.__extends(a,n),Object.defineProperty(a,"CUSTOMPLACEID_INIT",{get:function(){return"liff.init"},enumerable:!1,configurable:!0}),Object.defineProperty(a,"CUSTOMTYPE",{get:function(){return"liffSdk"},enumerable:!1,configurable:!0}),Object.defineProperty(a,"LiffUtsLoginStatus",{get:function(){return{isLoggedIn:1,isLiffSuccessful:2}},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"name",{get:function(){return"analytics"},enumerable:!1,configurable:!0}),a.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))},a.prototype.changeRatioToUTSFormat=function(e){if(e&&Number.isFinite(e))return Math.round(100*e)},a.prototype.setExtra=function(){var e,t=this.utsExtra,i=t.isLiffSuccessful,r=t.isLoggedIn,s=t.id,n=t.version,o=(r?a.LiffUtsLoginStatus.isLoggedIn:0)|(i?a.LiffUtsLoginStatus.isLiffSuccessful:0);null===(e=this.uts)||void 0===e||e.setExtra("liff",{id:s,loginStatus:o,version:n})},a.prototype.assignUtsExtra=function(e){Object.assign(this.utsExtra,e)},a.prototype.setVersion=function(e){this.assignUtsExtra({version:e}),i.logger.debug("[LIFFUTS][SDK version] ".concat(e)),this.setExtra()},a.prototype.setLiffId=function(e){this.assignUtsExtra({id:e}),i.logger.debug("[LIFFUTS][LIFFID] ".concat(e)),this.setExtra()},a.prototype.setIsLoggedIn=function(e){this.assignUtsExtra({isLoggedIn:e}),i.logger.debug("[LIFFUTS][isLoggedIn] ".concat(e)),this.setExtra()},a.prototype.sendLiffInit=function(){var e;i.logger.debug("[LIFFUTS][sendCustom] liff.init"),null===(e=this.uts)||void 0===e||e.sendCustom({type:a.CUSTOMTYPE,params:{placeId:a.CUSTOMPLACEID_INIT}})},a.prototype.setIsLiffSuccessful=function(e){this.assignUtsExtra({isLiffSuccessful:e}),i.logger.debug("[LIFFUTS][isLiffInitSuccessful] ".concat(e)),this.setExtra()},a.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)},a.prototype.beforeInitFinished=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,n,a,f,l,g,d,h,p,I,b,L;return e.__generator(this,(function(S){switch(S.label){case 0:if(t=r.qs.parse(window.location.search),this.prepareReferrer(t),n=s.getContext(),!(a=null==n?void 0:n.utsTracking))return[2];if(f=s.getConfig(),l=f.liffId,g=f.analytics,"auto"!==a.mode||!g)return[3,6];i.logger.debug("[LIFFUTS] ".concat((new Date).toUTCString())),S.label=1;case 1:return S.trys.push([1,3,,4]),d=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 d.uts=S.sent(),[3,4];case 3:return h=S.sent(),i.logger.debug("[LIFFUTS] cannot load UTS, reason: ".concat(h)),[2];case 4:return p=e.__assign(e.__assign({},g.context),{utsId:g.context.utsId,appName:g.context.appName,appEnv:g.context.appEnv||"release"}),I=e.__assign(e.__assign({endpoint:"https://uts-front.line-apps.com"},g.options),{sampleRate:this.changeRatioToUTSFormat(a.sendRatio),version:"current"}),this.uts.init(p,I),[4,c()];case 5:(b=S.sent())&&(i.logger.debug("[LIFFUTS][mid] ".concat(b)),this.uts.setMid(b)),(null==n?void 0:n.tid)&&(i.logger.debug("[LIFFUTS][tid] ".concat(n.tid)),this.uts.setTid(n.tid)),this.referrer&&(i.logger.debug("liff.ref.referrer",this.referrer),this.uts.setSessionParams(this.referrer)),l&&this.setLiffId(l),this.setIsLoggedIn(u.isLoggedIn()),this.setVersion(o.getVersion()),L=r.removeCredential(location.href),i.logger.debug("[LIFFUTS][url] ".concat(L)),this.uts.setUrl(L),this.liffCore.analytics=this.uts,this.injected=!0,S.label=6;case 6:return[2]}}))}))},a.prototype.beforeInitSuccess=function(){return this.injected&&(this.setIsLiffSuccessful(!0),this.sendLiffInit()),Promise.resolve()},a.prototype.initError=function(){return this.injected&&(this.setIsLiffSuccessful(!1),this.sendLiffInit()),Promise.resolve()},a}(n.LiffModule);exports.AnalyticsModule=l,exports.sendShareTargetPicker=function(e){i.logger.debug("[LIFFUTS][sendCustom] liff.shareTargetPicker"),e.sendCustom({type:"liffSdk",params:{placeId:"liff.shareTargetPicker"}})};
import { LiffUTS } from '@liff/types';
import { LiffModule, ModuleContext } from '@liff/use';
import { LiffCore } from '@liff/core';
export interface ExtendLiffCore {
analytics?: LiffUTS;
}
declare type Liff = {
type Liff = {
analytics?: LiffUTS;
};
export declare class AnalyticsModule implements LiffModule<void> {
} & LiffCore;
export declare class AnalyticsModule extends LiffModule<void, never, Liff> {
private static get CUSTOMPLACEID_INIT();

@@ -19,3 +20,9 @@ private static get CUSTOMTYPE();

private liffCore;
install({ liff, internalHooks }: ModuleContext<Liff>): void;
install({ liff, internalHooks, }: ModuleContext<Liff, {}, {
init: {
beforeFinished: any;
beforeSuccess: any;
error: any;
};
}>): void;
private changeRatioToUTSFormat;

@@ -22,0 +29,0 @@ private setExtra;

@@ -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 n}from"@liff/logger";import{removeCredential as r,qs as o}from"@liff/util";import{getDecodedIDToken as f,getContext as u,getConfig as c}from"@liff/store";import{getVersion as a}from"@liff/get-version";import{isLoggedIn as d}from"@liff/is-logged-in";import{getProfile as l}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(!d())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,l()];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,"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,e=this.utsExtra,i=e.isLiffSuccessful,s=e.isLoggedIn,n=e.id,r=e.version,o=(s?f.LiffUtsLoginStatus.isLoggedIn:0)|(i?f.LiffUtsLoginStatus.isLiffSuccessful:0);null===(t=this.uts)||void 0===t||t.setExtra("liff",{id:n,loginStatus:o,version:r})},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(){var t;n.debug("[LIFFUTS][sendCustom] liff.init"),null===(t=this.uts)||void 0===t||t.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,f,l,p,g,b,I,m,L,S,v;return e(this,(function(e){switch(e.label){case 0:if(t=o.parse(window.location.search),this.prepareReferrer(t),s=u(),!(f=null==s?void 0:s.utsTracking))return[2];if(l=c(),p=l.liffId,g=l.analytics,"auto"!==f.mode||!g)return[3,6];n.debug("[LIFFUTS] ".concat((new Date).toUTCString())),e.label=1;case 1:return e.trys.push([1,3,,4]),b=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 b.uts=e.sent(),[3,4];case 3:return I=e.sent(),n.debug("[LIFFUTS] cannot load UTS, reason: ".concat(I)),[2];case 4:return m=i(i({},g.context),{utsId:g.context.utsId,appName:g.context.appName,appEnv:g.context.appEnv||"release"}),L=i(i({endpoint:"https://uts-front.line-apps.com"},g.options),{sampleRate:this.changeRatioToUTSFormat(f.sendRatio),version:"current"}),this.uts.init(m,L),[4,h()];case 5:(S=e.sent())&&(n.debug("[LIFFUTS][mid] ".concat(S)),this.uts.setMid(S)),(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)),p&&this.setLiffId(p),this.setIsLoggedIn(d()),this.setVersion(a()),v=r(location.href),n.debug("[LIFFUTS][url] ".concat(v)),this.uts.setUrl(v),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};
import{__awaiter as t,__generator as e,__extends as i,__assign as s}from"tslib";import{UTS_REFERRER_QUERY as r}from"@liff/consts";import{logger as n}from"@liff/logger";import{removeCredential as o,qs as f}from"@liff/util";import{getDecodedIDToken as u,getContext as c,getConfig as a}from"@liff/store";import{LiffModule as d}from"@liff/use";import{getVersion as l}from"@liff/get-version";import{isLoggedIn as p}from"@liff/is-logged-in";import{getProfile as h}from"@liff/get-profile";function g(){return t(this,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!p())return[3,6];e.label=1;case 1:return e.trys.push([1,5,,6]),(t=u())&&t.sub?[2,t.sub]:[3,2];case 2:return[4,h()];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 b(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,g()];case 1:return(t=e.sent())&&"u"===t.substring(0,1)?[2,t]:[2]}}))}))}var I=function(u){function d(){var t=null!==u&&u.apply(this,arguments)||this;return t.utsExtra={isLiffSuccessful:!1,isLoggedIn:!1,id:"",version:""},t.injected=!1,t}return i(d,u),Object.defineProperty(d,"CUSTOMPLACEID_INIT",{get:function(){return"liff.init"},enumerable:!1,configurable:!0}),Object.defineProperty(d,"CUSTOMTYPE",{get:function(){return"liffSdk"},enumerable:!1,configurable:!0}),Object.defineProperty(d,"LiffUtsLoginStatus",{get:function(){return{isLoggedIn:1,isLiffSuccessful:2}},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"name",{get:function(){return"analytics"},enumerable:!1,configurable:!0}),d.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))},d.prototype.changeRatioToUTSFormat=function(t){if(t&&Number.isFinite(t))return Math.round(100*t)},d.prototype.setExtra=function(){var t,e=this.utsExtra,i=e.isLiffSuccessful,s=e.isLoggedIn,r=e.id,n=e.version,o=(s?d.LiffUtsLoginStatus.isLoggedIn:0)|(i?d.LiffUtsLoginStatus.isLiffSuccessful:0);null===(t=this.uts)||void 0===t||t.setExtra("liff",{id:r,loginStatus:o,version:n})},d.prototype.assignUtsExtra=function(t){Object.assign(this.utsExtra,t)},d.prototype.setVersion=function(t){this.assignUtsExtra({version:t}),n.debug("[LIFFUTS][SDK version] ".concat(t)),this.setExtra()},d.prototype.setLiffId=function(t){this.assignUtsExtra({id:t}),n.debug("[LIFFUTS][LIFFID] ".concat(t)),this.setExtra()},d.prototype.setIsLoggedIn=function(t){this.assignUtsExtra({isLoggedIn:t}),n.debug("[LIFFUTS][isLoggedIn] ".concat(t)),this.setExtra()},d.prototype.sendLiffInit=function(){var t;n.debug("[LIFFUTS][sendCustom] liff.init"),null===(t=this.uts)||void 0===t||t.sendCustom({type:d.CUSTOMTYPE,params:{placeId:d.CUSTOMPLACEID_INIT}})},d.prototype.setIsLiffSuccessful=function(t){this.assignUtsExtra({isLiffSuccessful:t}),n.debug("[LIFFUTS][isLiffInitSuccessful] ".concat(t)),this.setExtra()},d.prototype.prepareReferrer=function(t){var e={};Object.keys(t).forEach((function(i){if(r.includes(i)){var s=t[i];"string"==typeof s&&s&&(e[i.replace(/^liff\.ref\./,"")]=s)}})),Object.keys(e).length>0&&(this.referrer=e)},d.prototype.beforeInitFinished=function(){return t(this,void 0,void 0,(function(){var t,i,r,u,d,h,g,I,m,L,S,v;return e(this,(function(e){switch(e.label){case 0:if(t=f.parse(window.location.search),this.prepareReferrer(t),i=c(),!(r=null==i?void 0:i.utsTracking))return[2];if(u=a(),d=u.liffId,h=u.analytics,"auto"!==r.mode||!h)return[3,6];n.debug("[LIFFUTS] ".concat((new Date).toUTCString())),e.label=1;case 1:return e.trys.push([1,3,,4]),g=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 g.uts=e.sent(),[3,4];case 3:return I=e.sent(),n.debug("[LIFFUTS] cannot load UTS, reason: ".concat(I)),[2];case 4:return m=s(s({},h.context),{utsId:h.context.utsId,appName:h.context.appName,appEnv:h.context.appEnv||"release"}),L=s(s({endpoint:"https://uts-front.line-apps.com"},h.options),{sampleRate:this.changeRatioToUTSFormat(r.sendRatio),version:"current"}),this.uts.init(m,L),[4,b()];case 5:(S=e.sent())&&(n.debug("[LIFFUTS][mid] ".concat(S)),this.uts.setMid(S)),(null==i?void 0:i.tid)&&(n.debug("[LIFFUTS][tid] ".concat(i.tid)),this.uts.setTid(i.tid)),this.referrer&&(n.debug("liff.ref.referrer",this.referrer),this.uts.setSessionParams(this.referrer)),d&&this.setLiffId(d),this.setIsLoggedIn(p()),this.setVersion(l()),v=o(location.href),n.debug("[LIFFUTS][url] ".concat(v)),this.uts.setUrl(v),this.liffCore.analytics=this.uts,this.injected=!0,e.label=6;case 6:return[2]}}))}))},d.prototype.beforeInitSuccess=function(){return this.injected&&(this.setIsLiffSuccessful(!0),this.sendLiffInit()),Promise.resolve()},d.prototype.initError=function(){return this.injected&&(this.setIsLiffSuccessful(!1),this.sendLiffInit()),Promise.resolve()},d}(d),m=function(t){n.debug("[LIFFUTS][sendCustom] liff.shareTargetPicker"),t.sendCustom({type:"liffSdk",params:{placeId:"liff.shareTargetPicker"}})};export{I as AnalyticsModule,m as sendShareTargetPicker};
{
"name": "@liff/analytics",
"version": "2.21.4",
"version": "2.22.0",
"description": "@liff/analytics",

@@ -34,13 +34,13 @@ "license": "SEE LICENSE IN README.md",

"dependencies": {
"@liff/consts": "2.21.4",
"@liff/get-profile": "2.21.4",
"@liff/get-version": "2.21.4",
"@liff/is-logged-in": "2.21.4",
"@liff/logger": "2.21.4",
"@liff/store": "2.21.4",
"@liff/types": "2.21.4",
"@liff/use": "2.21.4",
"@liff/util": "2.21.4"
},
"gitHead": "af2b35a241fa715f3aa1ce484f011c9da9524e12"
"@liff/consts": "2.22.0",
"@liff/core": "2.22.0",
"@liff/get-profile": "2.22.0",
"@liff/get-version": "2.22.0",
"@liff/is-logged-in": "2.22.0",
"@liff/logger": "2.22.0",
"@liff/store": "2.22.0",
"@liff/types": "2.22.0",
"@liff/use": "2.22.0",
"@liff/util": "2.22.0"
}
}
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