@liff/util
Advanced tools
Comparing version 2.22.4 to 2.23.0
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@liff/logger"),r=require("tslib"),t=require("@liff/consts");function n(e){return window.atob(e.replace(/-/g,"+").replace(/_/g,"/"))}var o={decode:n,encode:function(e){return window.btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},decodeUnicode:function(e){var r=n(e).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join("");return decodeURIComponent(r)}};function i(e){return parseInt(e,16)}var a={get:function(e){var r=new RegExp("(?:(?:^|.*;\\s*)".concat(e,"\\s*\\=\\s*([^;]*).*$)|^.*$"));return document.cookie.replace(r,"$1")},set:function(r,t,n){var o=r+"="+t;if(n)for(var i in n){var a=n[i]?"=".concat(n[i]):"";o+="; ".concat(i).concat(a)}e.logger.debug("set cookie",o),document.cookie=o},remove:function(e,r){var t="".concat(e,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT");if(r)for(var n in r)t+="; ".concat(n,"=").concat(r[n]);document.cookie=t}},c=new Set(["400","401","403","404","429","500"]),u=function(e){function t(r,t){var n=e.call(this,t)||this;return n.code=r,n}return r.__extends(t,e),t}(Error);var s=function(){function e(){this.map={}}return e.prototype.clear=function(){this.map={}},e.prototype.getItem=function(e){var r=this.map[e];return void 0===r?null:r},e.prototype.setItem=function(e,r){this.map[e]=r},e.prototype.removeItem=function(e){delete this.map[e]},e.prototype.key=function(e){var r=Object.keys(this.map)[e];return void 0===r?null:r},Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.map).length},enumerable:!1,configurable:!0}),e}();var p={parse:function(e){return e.replace(/^\?/,"").replace(/^#\/?/,"").split(/&+/).filter((function(e){return e.length>0})).reduce((function(e,t){var n=r.__read(t.split("=").map(decodeURIComponent),2),o=n[0],i=n[1],a=e[o];return Array.isArray(a)?a.push(i):Object.prototype.hasOwnProperty.call(e,o)?e[o]=[a,i]:e[o]=i,e}),{})},stringify:function(e){return Object.keys(e).map((function(r){var t=e[r],n=function(e){return void 0!==e?"".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(e)):encodeURIComponent(r)};return Array.isArray(t)?t.map((function(e){return n(e)})).join("&"):n(t)})).join("&")}},f="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function d(){return window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967296}function l(e){var r=new URL(e),n=r.hash.slice(1).split("&").filter((function(e){return!t.CREDENTIAL_KEYS.some((function(r){return e.includes("".concat(r,"="))}))})).join("&");return r.hash=n,r.toString()}function g(e){var t=new URL(e);return t.toString().replace(new RegExp(String.raw(v||(v=r.__makeTemplateObject(["^",""],["^",""])),t.origin)),"")}var v;exports.HTTPStatusCodes=c,exports.InMemoryStorage=s,exports.LiffError=u,exports.addParamsToUrl=function(e,t){if(!e)throw new Error("addParamsToUrl: invalid URL");var n=new URL(e);return Object.entries(t).forEach((function(e){var t=r.__read(e,2),o=t[0],i=t[1];n.searchParams.set(o,i)})),n.toString()},exports.base64Url=o,exports.compareVersion=function(e,r){if(e===r)return 0;for(var t=e.split("."),n=r.split("."),o=Math.max(t.length,n.length),i=0;i<o;i++){t[i]||(t[i]="0"),n[i]||(n[i]="0");var a=parseInt(t[i])-parseInt(n[i]);if(0!==a)return a>0?1:-1}return 0},exports.convertArgbToRgba=function(r){var t=r.replace("#","").match(/.{2}/g)||[];if(4!==t.length)return e.logger.warn("convertArgbToRgba: Received invalid ARGB color"),"";var n=function(e){var r=i(e);return Math.round(r/255*100)/100}(t[0]),o=i(t[1]),a=i(t[2]),c=i(t[3]);return"rgba(".concat(o,", ").concat(a,", ").concat(c,", ").concat(n,")")},exports.convertArrayBuffer=function(e){for(var r=e.length,t=new ArrayBuffer(r),n=new Uint8Array(t),o=0;o<r;o++)n[o]=e.charCodeAt(o);return t},exports.convertHexToRgb=function(r){var t=r.replace("#","").match(/.{2}/g)||[];if(3!==t.length)return e.logger.warn("convertArgbToRgba: Received invalid hex color"),"";var n=i(t[0]),o=i(t[1]),a=i(t[2]);return"".concat(n,", ").concat(o,", ").concat(a)},exports.cookie=a,exports.createLiffError=function(e,r){return new u(e,r||"")},exports.extractChannelIdFromLiffId=function(e){var r=e.match(/([^-]+)-[^-]+/);return r&&r[1]},exports.extractLiffId=function(e){var r,n,o=e.match((n=t.PERMANENT_LINK_ORIGIN,r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),new RegExp("^".concat(r,"(\\d+-\\w+)"))));return o&&o[1]},exports.getOriginOfUrl=function(e){var r=e.match(/^(https?:\/\/.*?)\//);return r&&r[1]||""},exports.getRandomValue=d,exports.hexToBase64=function(e){var r="";return e.replace(/\r|\n/g,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ").forEach((function(e){r+=String.fromCharCode(parseInt(e))})),window.btoa(r)},exports.isIE=function(e){void 0===e&&(e=window.navigator.userAgent);var r=e.toLowerCase();return-1!==r.indexOf("msie")||-1!==r.indexOf("trident")},exports.isIpad=function(e){return void 0===e&&(e=window.navigator.userAgent),/ipad/.test(e.toLowerCase())},exports.isLIFFBrowser=function(e){return void 0===e&&(e=window.navigator.userAgent),/Line\/\d+\.\d+\.\d+ LIFF/.test(e)},exports.isLINEBrowser=function(e){return void 0===e&&(e=window.navigator.userAgent),/Line\/\d+\.\d+\.\d+/.test(e)},exports.isNonBrowserEnvironment=function(){return"undefined"==typeof window},exports.isSubWindow=function(e){return void 0===e&&(e=window.navigator.userAgent),/LIFF\/SubWindow/.test(e)},exports.qs=p,exports.randomAlphaNumericString=function(e){for(var r="",t=0;t<e;t++)r+=f[Math.floor(d()*f.length)];return r},exports.removeCredential=l,exports.removeOrigin=g,exports.replaceUrlCredentialRemoved=function(e){var r=g(l(e));window.history.replaceState(history.state,"",r)}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@liff/logger"),e=require("tslib"),t=require("@liff/consts");function n(r){return window.atob(r.replace(/-/g,"+").replace(/_/g,"/"))}var o={decode:n,encode:function(r){return window.btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},decodeUnicode:function(r){var e=n(r).split("").map((function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)})).join("");return decodeURIComponent(e)}};function i(r){return parseInt(r,16)}var a={get:function(r){var e=new RegExp("(?:(?:^|.*;\\s*)".concat(r,"\\s*\\=\\s*([^;]*).*$)|^.*$"));return document.cookie.replace(e,"$1")},set:function(e,t,n){var o=e+"="+t;if(n)for(var i in n){var a=n[i]?"=".concat(n[i]):"";o+="; ".concat(i).concat(a)}r.logger.debug("set cookie",o),document.cookie=o},remove:function(r,e){var t="".concat(r,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT");if(e)for(var n in e)t+="; ".concat(n,"=").concat(e[n]);document.cookie=t}},c=new Set(["400","401","403","404","429","500"]),u=function(r){function t(e,t){var n=r.call(this,t)||this;return n.code=e,n}return e.__extends(t,r),t}(Error);var s=function(){function r(){this.map={}}return r.prototype.clear=function(){this.map={}},r.prototype.getItem=function(r){var e=this.map[r];return void 0===e?null:e},r.prototype.setItem=function(r,e){this.map[r]=e},r.prototype.removeItem=function(r){delete this.map[r]},r.prototype.key=function(r){var e=Object.keys(this.map)[r];return void 0===e?null:e},Object.defineProperty(r.prototype,"length",{get:function(){return Object.keys(this.map).length},enumerable:!1,configurable:!0}),r}();var p,f={parse:function(r){return r.replace(/^\?/,"").replace(/^#\/?/,"").split(/&+/).filter((function(r){return r.length>0})).reduce((function(r,t){var n=e.__read(t.split("=").map(decodeURIComponent),2),o=n[0],i=n[1],a=r[o];return Array.isArray(a)?a.push(i):Object.prototype.hasOwnProperty.call(r,o)?r[o]=[a,i]:r[o]=i,r}),{})},stringify:function(r){return Object.keys(r).map((function(e){var t=r[e],n=function(r){return void 0!==r?"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(r)):encodeURIComponent(e)};return Array.isArray(t)?t.map((function(r){return n(r)})).join("&"):n(t)})).join("&")}},d="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(){return window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967296}function v(r){var e=new URL(r),n=e.hash.slice(1).split("&").filter((function(r){return!t.CREDENTIAL_KEYS.some((function(e){return r.includes("".concat(e,"="))}))})).join("&");return e.hash=n,e.toString()}function g(r){var t=new URL(r);return t.toString().replace(new RegExp(String.raw(m||(m=e.__makeTemplateObject(["^",""],["^",""])),t.origin)),"")}var m,w=((p={})[t.PERMANENT_LINK_ORIGIN]=function(){var r=h(t.PERMANENT_LINK_ORIGIN);return new RegExp("^".concat(r,"(\\d+-\\w+)"))},p[t.PERMANENT_LINK_ORIGIN_MINI]=function(){var r=h(t.PERMANENT_LINK_ORIGIN_MINI);return new RegExp("^".concat(r,"((\\d+-\\w+)|(\\w+$))"))},p);function h(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}exports.HTTPStatusCodes=c,exports.InMemoryStorage=s,exports.LiffError=u,exports.addParamsToUrl=function(r,t){if(!r)throw new Error("addParamsToUrl: invalid URL");var n=new URL(r);return Object.entries(t).forEach((function(r){var t=e.__read(r,2),o=t[0],i=t[1];n.searchParams.set(o,i)})),n.toString()},exports.base64Url=o,exports.compareVersion=function(r,e){if(r===e)return 0;for(var t=r.split("."),n=e.split("."),o=Math.max(t.length,n.length),i=0;i<o;i++){t[i]||(t[i]="0"),n[i]||(n[i]="0");var a=parseInt(t[i])-parseInt(n[i]);if(0!==a)return a>0?1:-1}return 0},exports.convertArgbToRgba=function(e){var t=e.replace("#","").match(/.{2}/g)||[];if(4!==t.length)return r.logger.warn("convertArgbToRgba: Received invalid ARGB color"),"";var n=function(r){var e=i(r);return Math.round(e/255*100)/100}(t[0]),o=i(t[1]),a=i(t[2]),c=i(t[3]);return"rgba(".concat(o,", ").concat(a,", ").concat(c,", ").concat(n,")")},exports.convertArrayBuffer=function(r){for(var e=r.length,t=new ArrayBuffer(e),n=new Uint8Array(t),o=0;o<e;o++)n[o]=r.charCodeAt(o);return t},exports.convertHexToRgb=function(e){var t=e.replace("#","").match(/.{2}/g)||[];if(3!==t.length)return r.logger.warn("convertArgbToRgba: Received invalid hex color"),"";var n=i(t[0]),o=i(t[1]),a=i(t[2]);return"".concat(n,", ").concat(o,", ").concat(a)},exports.cookie=a,exports.createLiffError=function(r,e){return new u(r,e||"")},exports.extractChannelIdFromLiffId=function(r){var e=r.match(/([^-]+)-[^-]+/);return e&&e[1]},exports.extractLiffId=function(r){for(var e in w){var t=r.match(w[e]());if(t)return t[1]}return null},exports.getOriginOfUrl=function(r){var e=r.match(/^(https?:\/\/.*?)\//);return e&&e[1]||""},exports.getRandomValue=l,exports.hexToBase64=function(r){var e="";return r.replace(/\r|\n/g,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ").forEach((function(r){e+=String.fromCharCode(parseInt(r))})),window.btoa(e)},exports.isIE=function(r){void 0===r&&(r=window.navigator.userAgent);var e=r.toLowerCase();return-1!==e.indexOf("msie")||-1!==e.indexOf("trident")},exports.isIpad=function(r){return void 0===r&&(r=window.navigator.userAgent),/ipad/.test(r.toLowerCase())},exports.isLIFFBrowser=function(r){return void 0===r&&(r=window.navigator.userAgent),/Line\/\d+\.\d+\.\d+ LIFF/.test(r)},exports.isLINEBrowser=function(r){return void 0===r&&(r=window.navigator.userAgent),/Line\/\d+\.\d+\.\d+/.test(r)},exports.isLineCustomUrlScheme=function(r){return r.startsWith("line:")},exports.isNonBrowserEnvironment=function(){return"undefined"==typeof window},exports.isSubWindow=function(r){return void 0===r&&(r=window.navigator.userAgent),/LIFF\/SubWindow/.test(r)},exports.qs=f,exports.randomAlphaNumericString=function(r){for(var e="",t=0;t<r;t++)e+=d[Math.floor(l()*d.length)];return e},exports.removeCredential=v,exports.removeOrigin=g,exports.replaceUrlCredentialRemoved=function(r){var e=g(v(r));window.history.replaceState(history.state,"",e)}; |
@@ -1,1 +0,1 @@ | ||
import{logger as n}from"@liff/logger";import{__extends as t,__read as r,__makeTemplateObject as e}from"tslib";import{CREDENTIAL_KEYS as o,PERMANENT_LINK_ORIGIN as i}from"@liff/consts";function a(n){return window.atob(n.replace(/-/g,"+").replace(/_/g,"/"))}var c={decode:a,encode:function(n){return window.btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},decodeUnicode:function(n){var t=a(n).split("").map((function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)})).join("");return decodeURIComponent(t)}};function u(n,t){if(n===t)return 0;for(var r=n.split("."),e=t.split("."),o=Math.max(r.length,e.length),i=0;i<o;i++){r[i]||(r[i]="0"),e[i]||(e[i]="0");var a=parseInt(r[i])-parseInt(e[i]);if(0!==a)return a>0?1:-1}return 0}function f(t){var r=t.replace("#","").match(/.{2}/g)||[];if(4!==r.length)return n.warn("convertArgbToRgba: Received invalid ARGB color"),"";var e=function(n){var t=p(n);return Math.round(t/255*100)/100}(r[0]),o=p(r[1]),i=p(r[2]),a=p(r[3]);return"rgba(".concat(o,", ").concat(i,", ").concat(a,", ").concat(e,")")}function p(n){return parseInt(n,16)}function d(t){var r=t.replace("#","").match(/.{2}/g)||[];if(3!==r.length)return n.warn("convertArgbToRgba: Received invalid hex color"),"";var e=p(r[0]),o=p(r[1]),i=p(r[2]);return"".concat(e,", ").concat(o,", ").concat(i)}function s(n){for(var t=n.length,r=new ArrayBuffer(t),e=new Uint8Array(r),o=0;o<t;o++)e[o]=n.charCodeAt(o);return r}var l={get:function(n){var t=new RegExp("(?:(?:^|.*;\\s*)".concat(n,"\\s*\\=\\s*([^;]*).*$)|^.*$"));return document.cookie.replace(t,"$1")},set:function(t,r,e){var o=t+"="+r;if(e)for(var i in e){var a=e[i]?"=".concat(e[i]):"";o+="; ".concat(i).concat(a)}n.debug("set cookie",o),document.cookie=o},remove:function(n,t){var r="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT");if(t)for(var e in t)r+="; ".concat(e,"=").concat(t[e]);document.cookie=r}},v=new Set(["400","401","403","404","429","500"]),g=function(n){function r(t,r){var e=n.call(this,r)||this;return e.code=t,e}return t(r,n),r}(Error);function h(n,t){return new g(n,t||"")}function m(n){var t=n.match(/([^-]+)-[^-]+/);return t&&t[1]}function w(n){var t="";return n.replace(/\r|\n/g,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ").forEach((function(n){t+=String.fromCharCode(parseInt(n))})),window.btoa(t)}var y=function(){function n(){this.map={}}return n.prototype.clear=function(){this.map={}},n.prototype.getItem=function(n){var t=this.map[n];return void 0===t?null:t},n.prototype.setItem=function(n,t){this.map[n]=t},n.prototype.removeItem=function(n){delete this.map[n]},n.prototype.key=function(n){var t=Object.keys(this.map)[n];return void 0===t?null:t},Object.defineProperty(n.prototype,"length",{get:function(){return Object.keys(this.map).length},enumerable:!1,configurable:!0}),n}();var b={parse:function(n){return n.replace(/^\?/,"").replace(/^#\/?/,"").split(/&+/).filter((function(n){return n.length>0})).reduce((function(n,t){var e=r(t.split("=").map(decodeURIComponent),2),o=e[0],i=e[1],a=n[o];return Array.isArray(a)?a.push(i):Object.prototype.hasOwnProperty.call(n,o)?n[o]=[a,i]:n[o]=i,n}),{})},stringify:function(n){return Object.keys(n).map((function(t){var r=n[t],e=function(n){return void 0!==n?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n)):encodeURIComponent(t)};return Array.isArray(r)?r.map((function(n){return e(n)})).join("&"):e(r)})).join("&")}},A="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function R(){return window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967296}function I(n){for(var t="",r=0;r<n;r++)t+=A[Math.floor(R()*A.length)];return t}function U(n){var t=new URL(n),r=t.hash.slice(1).split("&").filter((function(n){return!o.some((function(t){return n.includes("".concat(t,"="))}))})).join("&");return t.hash=r,t.toString()}function C(n){var t=new URL(n);return t.toString().replace(new RegExp(String.raw(j||(j=e(["^",""],["^",""])),t.origin)),"")}var j,x=function(n){var t=C(U(n));window.history.replaceState(history.state,"",t)};function L(n,t){if(!n)throw new Error("addParamsToUrl: invalid URL");var e=new URL(n);return Object.entries(t).forEach((function(n){var t=r(n,2),o=t[0],i=t[1];e.searchParams.set(o,i)})),e.toString()}function O(n){var t,r=n.match((t=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),new RegExp("^".concat(t,"(\\d+-\\w+)"))));return r&&r[1]}function S(n){var t=n.match(/^(https?:\/\/.*?)\//);return t&&t[1]||""}function k(n){void 0===n&&(n=window.navigator.userAgent);var t=n.toLowerCase();return-1!==t.indexOf("msie")||-1!==t.indexOf("trident")}function E(n){return void 0===n&&(n=window.navigator.userAgent),/ipad/.test(n.toLowerCase())}function $(n){return void 0===n&&(n=window.navigator.userAgent),/Line\/\d+\.\d+\.\d+/.test(n)}function F(n){return void 0===n&&(n=window.navigator.userAgent),/Line\/\d+\.\d+\.\d+ LIFF/.test(n)}function T(n){return void 0===n&&(n=window.navigator.userAgent),/LIFF\/SubWindow/.test(n)}var M=function(){return"undefined"==typeof window};export{v as HTTPStatusCodes,y as InMemoryStorage,g as LiffError,L as addParamsToUrl,c as base64Url,u as compareVersion,f as convertArgbToRgba,s as convertArrayBuffer,d as convertHexToRgb,l as cookie,h as createLiffError,m as extractChannelIdFromLiffId,O as extractLiffId,S as getOriginOfUrl,R as getRandomValue,w as hexToBase64,k as isIE,E as isIpad,F as isLIFFBrowser,$ as isLINEBrowser,M as isNonBrowserEnvironment,T as isSubWindow,b as qs,I as randomAlphaNumericString,U as removeCredential,C as removeOrigin,x as replaceUrlCredentialRemoved}; | ||
import{logger as n}from"@liff/logger";import{__extends as t,__read as r,__makeTemplateObject as e}from"tslib";import{PERMANENT_LINK_ORIGIN as o,PERMANENT_LINK_ORIGIN_MINI as i,CREDENTIAL_KEYS as a}from"@liff/consts";function c(n){return window.atob(n.replace(/-/g,"+").replace(/_/g,"/"))}var u={decode:c,encode:function(n){return window.btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},decodeUnicode:function(n){var t=c(n).split("").map((function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)})).join("");return decodeURIComponent(t)}};function f(n,t){if(n===t)return 0;for(var r=n.split("."),e=t.split("."),o=Math.max(r.length,e.length),i=0;i<o;i++){r[i]||(r[i]="0"),e[i]||(e[i]="0");var a=parseInt(r[i])-parseInt(e[i]);if(0!==a)return a>0?1:-1}return 0}function p(t){var r=t.replace("#","").match(/.{2}/g)||[];if(4!==r.length)return n.warn("convertArgbToRgba: Received invalid ARGB color"),"";var e=function(n){var t=d(n);return Math.round(t/255*100)/100}(r[0]),o=d(r[1]),i=d(r[2]),a=d(r[3]);return"rgba(".concat(o,", ").concat(i,", ").concat(a,", ").concat(e,")")}function d(n){return parseInt(n,16)}function s(t){var r=t.replace("#","").match(/.{2}/g)||[];if(3!==r.length)return n.warn("convertArgbToRgba: Received invalid hex color"),"";var e=d(r[0]),o=d(r[1]),i=d(r[2]);return"".concat(e,", ").concat(o,", ").concat(i)}function l(n){for(var t=n.length,r=new ArrayBuffer(t),e=new Uint8Array(r),o=0;o<t;o++)e[o]=n.charCodeAt(o);return r}var v={get:function(n){var t=new RegExp("(?:(?:^|.*;\\s*)".concat(n,"\\s*\\=\\s*([^;]*).*$)|^.*$"));return document.cookie.replace(t,"$1")},set:function(t,r,e){var o=t+"="+r;if(e)for(var i in e){var a=e[i]?"=".concat(e[i]):"";o+="; ".concat(i).concat(a)}n.debug("set cookie",o),document.cookie=o},remove:function(n,t){var r="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT");if(t)for(var e in t)r+="; ".concat(e,"=").concat(t[e]);document.cookie=r}},g=new Set(["400","401","403","404","429","500"]),w=function(n){function r(t,r){var e=n.call(this,r)||this;return e.code=t,e}return t(r,n),r}(Error);function h(n,t){return new w(n,t||"")}function m(n){var t=n.match(/([^-]+)-[^-]+/);return t&&t[1]}function y(n){var t="";return n.replace(/\r|\n/g,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ").forEach((function(n){t+=String.fromCharCode(parseInt(n))})),window.btoa(t)}var b=function(){function n(){this.map={}}return n.prototype.clear=function(){this.map={}},n.prototype.getItem=function(n){var t=this.map[n];return void 0===t?null:t},n.prototype.setItem=function(n,t){this.map[n]=t},n.prototype.removeItem=function(n){delete this.map[n]},n.prototype.key=function(n){var t=Object.keys(this.map)[n];return void 0===t?null:t},Object.defineProperty(n.prototype,"length",{get:function(){return Object.keys(this.map).length},enumerable:!1,configurable:!0}),n}();var R,A={parse:function(n){return n.replace(/^\?/,"").replace(/^#\/?/,"").split(/&+/).filter((function(n){return n.length>0})).reduce((function(n,t){var e=r(t.split("=").map(decodeURIComponent),2),o=e[0],i=e[1],a=n[o];return Array.isArray(a)?a.push(i):Object.prototype.hasOwnProperty.call(n,o)?n[o]=[a,i]:n[o]=i,n}),{})},stringify:function(n){return Object.keys(n).map((function(t){var r=n[t],e=function(n){return void 0!==n?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n)):encodeURIComponent(t)};return Array.isArray(r)?r.map((function(n){return e(n)})).join("&"):e(r)})).join("&")}},I="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function U(){return window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967296}function x(n){for(var t="",r=0;r<n;r++)t+=I[Math.floor(U()*I.length)];return t}function C(n){var t=new URL(n),r=t.hash.slice(1).split("&").filter((function(n){return!a.some((function(t){return n.includes("".concat(t,"="))}))})).join("&");return t.hash=r,t.toString()}function j(n){var t=new URL(n);return t.toString().replace(new RegExp(String.raw(S||(S=e(["^",""],["^",""])),t.origin)),"")}var L=function(n){var t=j(C(n));window.history.replaceState(history.state,"",t)};function O(n,t){if(!n)throw new Error("addParamsToUrl: invalid URL");var e=new URL(n);return Object.entries(t).forEach((function(n){var t=r(n,2),o=t[0],i=t[1];e.searchParams.set(o,i)})),e.toString()}var S,k=((R={})[o]=function(){var n=$(o);return new RegExp("^".concat(n,"(\\d+-\\w+)"))},R[i]=function(){var n=$(i);return new RegExp("^".concat(n,"((\\d+-\\w+)|(\\w+$))"))},R);function E(n){for(var t in k){var r=n.match(k[t]());if(r)return r[1]}return null}function $(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(n){var t=n.match(/^(https?:\/\/.*?)\//);return t&&t[1]||""}function T(n){return n.startsWith("line:")}function M(n){void 0===n&&(n=window.navigator.userAgent);var t=n.toLowerCase();return-1!==t.indexOf("msie")||-1!==t.indexOf("trident")}function P(n){return void 0===n&&(n=window.navigator.userAgent),/ipad/.test(n.toLowerCase())}function B(n){return void 0===n&&(n=window.navigator.userAgent),/Line\/\d+\.\d+\.\d+/.test(n)}function G(n){return void 0===n&&(n=window.navigator.userAgent),/Line\/\d+\.\d+\.\d+ LIFF/.test(n)}function W(n){return void 0===n&&(n=window.navigator.userAgent),/LIFF\/SubWindow/.test(n)}var J=function(){return"undefined"==typeof window};export{g as HTTPStatusCodes,b as InMemoryStorage,w as LiffError,O as addParamsToUrl,u as base64Url,f as compareVersion,p as convertArgbToRgba,l as convertArrayBuffer,s as convertHexToRgb,v as cookie,h as createLiffError,m as extractChannelIdFromLiffId,E as extractLiffId,F as getOriginOfUrl,U as getRandomValue,y as hexToBase64,M as isIE,P as isIpad,G as isLIFFBrowser,B as isLINEBrowser,T as isLineCustomUrlScheme,J as isNonBrowserEnvironment,W as isSubWindow,A as qs,x as randomAlphaNumericString,C as removeCredential,j as removeOrigin,L as replaceUrlCredentialRemoved}; |
@@ -9,1 +9,2 @@ export declare function removeCredential(url: string): string; | ||
export declare function getOriginOfUrl(url: string): string; | ||
export declare function isLineCustomUrlScheme(url: string): boolean; |
{ | ||
"name": "@liff/util", | ||
"version": "2.22.4", | ||
"version": "2.23.0", | ||
"description": "@liff/util", | ||
@@ -31,4 +31,4 @@ "license": "SEE LICENSE IN README.md", | ||
"dependencies": { | ||
"@liff/consts": "2.22.4", | ||
"@liff/logger": "2.22.4" | ||
"@liff/consts": "2.23.0", | ||
"@liff/logger": "2.23.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "peerDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18264
141
+ Added@liff/consts@2.23.0(transitive)
+ Added@liff/logger@2.23.0(transitive)
- Removed@liff/consts@2.22.4(transitive)
- Removed@liff/logger@2.22.4(transitive)
Updated@liff/consts@2.23.0
Updated@liff/logger@2.23.0