Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@liff/is-api-available

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/is-api-available - npm Package Compare versions

Comparing version 2.22.2 to 2.22.3

2

lib/index.cjs.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("@liff/consts"),r=require("@liff/use"),n=require("@liff/util"),a=require("@liff/is-sub-window"),o=require("@liff/store"),t=require("@liff/get-line-version"),s=require("@liff/is-in-client"),l=require("@liff/is-logged-in");function c(e){var i,r=o.getContext();return null===(i=null==r?void 0:r.availability)||void 0===i?void 0:i[e]}function u(e,r){var a=c(e);if(!a||!a.permission)return{available:!1,error:{code:i.FORBIDDEN,message:"".concat(e," is not allowed in this LIFF app")}};var o=a.minVer,l=a.unsupportedFromVer;if(s.isInClient()){var u=function(e,i){var r=t.getLineVersion();return!!r&&!(i&&n.compareVersion(r,i)>0)&&n.compareVersion(r,e)>=0}(o,l);return u?{available:!0}:{available:!1,error:{code:i.FORBIDDEN,message:"".concat(e," is unavailable in this client version.")}}}return r?{available:!0}:{available:!1,error:{code:i.FORBIDDEN,message:"".concat(e," is not allowed in external browser")}}}var d=function(){return l.isLoggedIn()?!n.isLIFFBrowser()&&n.isLINEBrowser()?{available:!1,error:{code:i.FORBIDDEN,message:"Subwindow is not supported in this browser"}}:a.isSubWindow()?{available:!1,error:{code:i.FORBIDDEN,message:"this api can be only called in child window"}}:u("subwindowOpen",!0):{available:!1,error:{code:i.UNAUTHORIZED,message:"Need access_token for api call, Please login first"}}},f=["subwindowOpen","shareTargetPicker","multipleLiffTransition","scanCode","scanCodeV2","getAdvertisingId","addToHomeScreen","bluetoothLeFunction","skipChannelVerificationScreen"],p={scanCode:function(){return u("scanCode")},getAdvertisingId:function(){return u("getAdvertisingId")},bluetoothLeFunction:function(){return u("bluetoothLeFunction")},shareTargetPicker:function(){return a.isSubWindow()?{available:!1,error:{code:i.FORBIDDEN,message:"this api can be only called in child window"}}:l.isLoggedIn()?u("shareTargetPicker",!0):{available:!1,error:{code:i.UNAUTHORIZED,message:"Need access_token for api call, Please login first"}}},multipleLiffTransition:function(){var e=c("multipleLiffTransition");return e&&e.permission?s.isInClient()?{available:!0}:{available:!1,error:{code:i.FORBIDDEN,message:"multipleLiffTransition is available only in the LINE App browser"}}:{available:!1,error:{code:i.FORBIDDEN,message:"multipleLiffTransition is not allowed in this LIFF app"}}},subwindowOpen:d,scanCodeV2:function(){if(!l.isLoggedIn())return{available:!1,error:{code:i.UNAUTHORIZED,message:"Need access_token for api call, Please login first"}};var e=d();return e.available?u("scanCodeV2",!0):e},addToHomeScreen:function(){return a.isSubWindow()?{available:!1,error:{code:i.FORBIDDEN,message:"this api can be only called in child window"}}:u("addToHomeScreen")},skipChannelVerificationScreen:function(){var e=o.getContext();return e?"square_chat"===e.type?{available:!1,error:{code:i.FORBIDDEN,message:"skipChannelVerificationScreen is not allowed in OpenChat"}}:u("skipChannelVerificationScreen"):{available:!1,error:{code:i.FORBIDDEN,message:"Context is not found"}}}},b=function(e){return function(){var i=e();if(!i.available)throw n.createLiffError(i.error.code,i.error.message)}},v={scanCode:b(p.scanCode),getAdvertisingId:b(p.getAdvertisingId),bluetoothLeFunction:b(p.bluetoothLeFunction),shareTargetPicker:b(p.shareTargetPicker),multipleLiffTransition:b(p.multipleLiffTransition),subwindowOpen:b(p.subwindowOpen),scanCodeV2:b(p.scanCodeV2),addToHomeScreen:b(p.addToHomeScreen),skipChannelVerificationScreen:b(p.skipChannelVerificationScreen)};function g(e){if(!function(e){return f.some((function(i){return i===e}))}(e))throw n.createLiffError(i.INVALID_ARGUMENT,"Unexpected API name.");var r=p[e];return!r||r().available}var m=function(i){function r(){var e=null!==i&&i.apply(this,arguments)||this;return e.hooks={},e}return e.__extends(r,i),Object.defineProperty(r.prototype,"name",{get:function(){return"isApiAvailable"},enumerable:!1,configurable:!0}),r.prototype.install=function(){return function(e){return g(e)}},r}(r.LiffModule);exports.IsApiAvailableModule=m,exports.isApiAvailable=g,exports.validators=v;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("@liff/consts"),r=require("@liff/use"),n=require("@liff/util"),a=require("@liff/is-sub-window"),o=require("@liff/store"),t=require("@liff/get-line-version"),s=require("@liff/is-in-client"),l=require("@liff/is-logged-in");function c(e){var i,r=o.getContext();return null===(i=null==r?void 0:r.availability)||void 0===i?void 0:i[e]}function u(e,r){var a=c(e);if(!a||!a.permission)return{available:!1,error:{code:i.FORBIDDEN,message:"".concat(e," is not allowed in this LIFF app")}};var o=a.minVer,l=a.unsupportedFromVer;if(s.isInClient()){var u=function(e,i){var r=t.getLineVersion();return!!r&&!(i&&n.compareVersion(r,i)>0)&&n.compareVersion(r,e)>=0}(o,l);return u?{available:!0}:{available:!1,error:{code:i.FORBIDDEN,message:"".concat(e," is unavailable in this client version.")}}}return r?{available:!0}:{available:!1,error:{code:i.FORBIDDEN,message:"".concat(e," is not allowed in external browser")}}}var d=function(){return l.isLoggedIn()?!n.isLIFFBrowser()&&n.isLINEBrowser()?{available:!1,error:{code:i.FORBIDDEN,message:"Subwindow is not supported in this browser"}}:a.isSubWindow()?{available:!1,error:{code:i.FORBIDDEN,message:"this api can be only called in parent window"}}:u("subwindowOpen",!0):{available:!1,error:{code:i.UNAUTHORIZED,message:"Need access_token for api call, Please login first"}}},f=["subwindowOpen","shareTargetPicker","multipleLiffTransition","scanCode","scanCodeV2","getAdvertisingId","addToHomeScreen","bluetoothLeFunction","skipChannelVerificationScreen"],p={scanCode:function(){return u("scanCode")},getAdvertisingId:function(){return u("getAdvertisingId")},bluetoothLeFunction:function(){return u("bluetoothLeFunction")},shareTargetPicker:function(){return a.isSubWindow()?{available:!1,error:{code:i.FORBIDDEN,message:"this api can be only called in parent window"}}:l.isLoggedIn()?u("shareTargetPicker",!0):{available:!1,error:{code:i.UNAUTHORIZED,message:"Need access_token for api call, Please login first"}}},multipleLiffTransition:function(){var e=c("multipleLiffTransition");return e&&e.permission?s.isInClient()?{available:!0}:{available:!1,error:{code:i.FORBIDDEN,message:"multipleLiffTransition is available only in the LINE App browser"}}:{available:!1,error:{code:i.FORBIDDEN,message:"multipleLiffTransition is not allowed in this LIFF app"}}},subwindowOpen:d,scanCodeV2:function(){if(!l.isLoggedIn())return{available:!1,error:{code:i.UNAUTHORIZED,message:"Need access_token for api call, Please login first"}};var e=d();return e.available?u("scanCodeV2",!0):e},addToHomeScreen:function(){return a.isSubWindow()?{available:!1,error:{code:i.FORBIDDEN,message:"this api can be only called in parent window"}}:u("addToHomeScreen")},skipChannelVerificationScreen:function(){var e=o.getContext();return e?"square_chat"===e.type?{available:!1,error:{code:i.FORBIDDEN,message:"skipChannelVerificationScreen is not allowed in OpenChat"}}:u("skipChannelVerificationScreen"):{available:!1,error:{code:i.FORBIDDEN,message:"Context is not found"}}}},b=function(e){return function(){var i=e();if(!i.available)throw n.createLiffError(i.error.code,i.error.message)}},v={scanCode:b(p.scanCode),getAdvertisingId:b(p.getAdvertisingId),bluetoothLeFunction:b(p.bluetoothLeFunction),shareTargetPicker:b(p.shareTargetPicker),multipleLiffTransition:b(p.multipleLiffTransition),subwindowOpen:b(p.subwindowOpen),scanCodeV2:b(p.scanCodeV2),addToHomeScreen:b(p.addToHomeScreen),skipChannelVerificationScreen:b(p.skipChannelVerificationScreen)};function g(e){if(!function(e){return f.some((function(i){return i===e}))}(e))throw n.createLiffError(i.INVALID_ARGUMENT,"Unexpected API name.");var r=p[e];return!r||r().available}var m=function(i){function r(){var e=null!==i&&i.apply(this,arguments)||this;return e.hooks={},e}return e.__extends(r,i),Object.defineProperty(r.prototype,"name",{get:function(){return"isApiAvailable"},enumerable:!1,configurable:!0}),r.prototype.install=function(){return function(e){return g(e)}},r}(r.LiffModule);exports.IsApiAvailableModule=m,exports.isApiAvailable=g,exports.validators=v;

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

import{__extends as e}from"tslib";import{FORBIDDEN as i,UNAUTHORIZED as n,INVALID_ARGUMENT as r}from"@liff/consts";import{LiffModule as o}from"@liff/use";import{compareVersion as a,isLIFFBrowser as t,isLINEBrowser as l,createLiffError as s}from"@liff/util";import{isSubWindow as c}from"@liff/is-sub-window";import{getContext as u}from"@liff/store";import{getLineVersion as f}from"@liff/get-line-version";import{isInClient as d}from"@liff/is-in-client";import{isLoggedIn as p}from"@liff/is-logged-in";function m(e){var i,n=u();return null===(i=null==n?void 0:n.availability)||void 0===i?void 0:i[e]}function v(e,n){var r=m(e);if(!r||!r.permission)return{available:!1,error:{code:i,message:"".concat(e," is not allowed in this LIFF app")}};var o=r.minVer,t=r.unsupportedFromVer;if(d()){var l=function(e,i){var n=f();return!!n&&!(i&&a(n,i)>0)&&a(n,e)>=0}(o,t);return l?{available:!0}:{available:!1,error:{code:i,message:"".concat(e," is unavailable in this client version.")}}}return n?{available:!0}:{available:!1,error:{code:i,message:"".concat(e," is not allowed in external browser")}}}var b=function(){return p()?!t()&&l()?{available:!1,error:{code:i,message:"Subwindow is not supported in this browser"}}:c()?{available:!1,error:{code:i,message:"this api can be only called in child window"}}:v("subwindowOpen",!0):{available:!1,error:{code:n,message:"Need access_token for api call, Please login first"}}},g=["subwindowOpen","shareTargetPicker","multipleLiffTransition","scanCode","scanCodeV2","getAdvertisingId","addToHomeScreen","bluetoothLeFunction","skipChannelVerificationScreen"],h={scanCode:function(){return v("scanCode")},getAdvertisingId:function(){return v("getAdvertisingId")},bluetoothLeFunction:function(){return v("bluetoothLeFunction")},shareTargetPicker:function(){return c()?{available:!1,error:{code:i,message:"this api can be only called in child window"}}:p()?v("shareTargetPicker",!0):{available:!1,error:{code:n,message:"Need access_token for api call, Please login first"}}},multipleLiffTransition:function(){var e=m("multipleLiffTransition");return e&&e.permission?d()?{available:!0}:{available:!1,error:{code:i,message:"multipleLiffTransition is available only in the LINE App browser"}}:{available:!1,error:{code:i,message:"multipleLiffTransition is not allowed in this LIFF app"}}},subwindowOpen:b,scanCodeV2:function(){if(!p())return{available:!1,error:{code:n,message:"Need access_token for api call, Please login first"}};var e=b();return e.available?v("scanCodeV2",!0):e},addToHomeScreen:function(){return c()?{available:!1,error:{code:i,message:"this api can be only called in child window"}}:v("addToHomeScreen")},skipChannelVerificationScreen:function(){var e=u();return e?"square_chat"===e.type?{available:!1,error:{code:i,message:"skipChannelVerificationScreen is not allowed in OpenChat"}}:v("skipChannelVerificationScreen"):{available:!1,error:{code:i,message:"Context is not found"}}}},w=function(e){return function(){var i=e();if(!i.available)throw s(i.error.code,i.error.message)}},C={scanCode:w(h.scanCode),getAdvertisingId:w(h.getAdvertisingId),bluetoothLeFunction:w(h.bluetoothLeFunction),shareTargetPicker:w(h.shareTargetPicker),multipleLiffTransition:w(h.multipleLiffTransition),subwindowOpen:w(h.subwindowOpen),scanCodeV2:w(h.scanCodeV2),addToHomeScreen:w(h.addToHomeScreen),skipChannelVerificationScreen:w(h.skipChannelVerificationScreen)};function T(e){if(!function(e){return g.some((function(i){return i===e}))}(e))throw s(r,"Unexpected API name.");var i=h[e];return!i||i().available}var k=function(i){function n(){var e=null!==i&&i.apply(this,arguments)||this;return e.hooks={},e}return e(n,i),Object.defineProperty(n.prototype,"name",{get:function(){return"isApiAvailable"},enumerable:!1,configurable:!0}),n.prototype.install=function(){return function(e){return T(e)}},n}(o);export{k as IsApiAvailableModule,T as isApiAvailable,C as validators};
import{__extends as e}from"tslib";import{FORBIDDEN as i,UNAUTHORIZED as n,INVALID_ARGUMENT as r}from"@liff/consts";import{LiffModule as a}from"@liff/use";import{compareVersion as o,isLIFFBrowser as t,isLINEBrowser as l,createLiffError as s}from"@liff/util";import{isSubWindow as c}from"@liff/is-sub-window";import{getContext as u}from"@liff/store";import{getLineVersion as f}from"@liff/get-line-version";import{isInClient as d}from"@liff/is-in-client";import{isLoggedIn as p}from"@liff/is-logged-in";function m(e){var i,n=u();return null===(i=null==n?void 0:n.availability)||void 0===i?void 0:i[e]}function v(e,n){var r=m(e);if(!r||!r.permission)return{available:!1,error:{code:i,message:"".concat(e," is not allowed in this LIFF app")}};var a=r.minVer,t=r.unsupportedFromVer;if(d()){var l=function(e,i){var n=f();return!!n&&!(i&&o(n,i)>0)&&o(n,e)>=0}(a,t);return l?{available:!0}:{available:!1,error:{code:i,message:"".concat(e," is unavailable in this client version.")}}}return n?{available:!0}:{available:!1,error:{code:i,message:"".concat(e," is not allowed in external browser")}}}var b=function(){return p()?!t()&&l()?{available:!1,error:{code:i,message:"Subwindow is not supported in this browser"}}:c()?{available:!1,error:{code:i,message:"this api can be only called in parent window"}}:v("subwindowOpen",!0):{available:!1,error:{code:n,message:"Need access_token for api call, Please login first"}}},g=["subwindowOpen","shareTargetPicker","multipleLiffTransition","scanCode","scanCodeV2","getAdvertisingId","addToHomeScreen","bluetoothLeFunction","skipChannelVerificationScreen"],h={scanCode:function(){return v("scanCode")},getAdvertisingId:function(){return v("getAdvertisingId")},bluetoothLeFunction:function(){return v("bluetoothLeFunction")},shareTargetPicker:function(){return c()?{available:!1,error:{code:i,message:"this api can be only called in parent window"}}:p()?v("shareTargetPicker",!0):{available:!1,error:{code:n,message:"Need access_token for api call, Please login first"}}},multipleLiffTransition:function(){var e=m("multipleLiffTransition");return e&&e.permission?d()?{available:!0}:{available:!1,error:{code:i,message:"multipleLiffTransition is available only in the LINE App browser"}}:{available:!1,error:{code:i,message:"multipleLiffTransition is not allowed in this LIFF app"}}},subwindowOpen:b,scanCodeV2:function(){if(!p())return{available:!1,error:{code:n,message:"Need access_token for api call, Please login first"}};var e=b();return e.available?v("scanCodeV2",!0):e},addToHomeScreen:function(){return c()?{available:!1,error:{code:i,message:"this api can be only called in parent window"}}:v("addToHomeScreen")},skipChannelVerificationScreen:function(){var e=u();return e?"square_chat"===e.type?{available:!1,error:{code:i,message:"skipChannelVerificationScreen is not allowed in OpenChat"}}:v("skipChannelVerificationScreen"):{available:!1,error:{code:i,message:"Context is not found"}}}},w=function(e){return function(){var i=e();if(!i.available)throw s(i.error.code,i.error.message)}},C={scanCode:w(h.scanCode),getAdvertisingId:w(h.getAdvertisingId),bluetoothLeFunction:w(h.bluetoothLeFunction),shareTargetPicker:w(h.shareTargetPicker),multipleLiffTransition:w(h.multipleLiffTransition),subwindowOpen:w(h.subwindowOpen),scanCodeV2:w(h.scanCodeV2),addToHomeScreen:w(h.addToHomeScreen),skipChannelVerificationScreen:w(h.skipChannelVerificationScreen)};function T(e){if(!function(e){return g.some((function(i){return i===e}))}(e))throw s(r,"Unexpected API name.");var i=h[e];return!i||i().available}var k=function(i){function n(){var e=null!==i&&i.apply(this,arguments)||this;return e.hooks={},e}return e(n,i),Object.defineProperty(n.prototype,"name",{get:function(){return"isApiAvailable"},enumerable:!1,configurable:!0}),n.prototype.install=function(){return function(e){return T(e)}},n}(a);export{k as IsApiAvailableModule,T as isApiAvailable,C as validators};
{
"name": "@liff/is-api-available",
"version": "2.22.2",
"version": "2.22.3",
"description": "@liff/is-api-available",

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

"dependencies": {
"@liff/consts": "2.22.2",
"@liff/get-line-version": "2.22.2",
"@liff/is-in-client": "2.22.2",
"@liff/is-logged-in": "2.22.2",
"@liff/is-sub-window": "2.22.2",
"@liff/store": "2.22.2",
"@liff/use": "2.22.2",
"@liff/util": "2.22.2"
"@liff/consts": "2.22.3",
"@liff/get-line-version": "2.22.3",
"@liff/is-in-client": "2.22.3",
"@liff/is-logged-in": "2.22.3",
"@liff/is-sub-window": "2.22.3",
"@liff/store": "2.22.3",
"@liff/use": "2.22.3",
"@liff/util": "2.22.3"
}
}
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