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

@ikas/app-helpers

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ikas/app-helpers - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

7

dist/helpers/app-bridge.d.ts

@@ -11,2 +11,3 @@ export declare class AppBridgeHelper {

static getNewToken(): Promise<string | undefined>;
static getAuthorizedAppId(): Promise<string | undefined>;
static sendEvent(event: AppEvent): void;

@@ -21,6 +22,8 @@ }

REQUEST_TOKEN = "REQUEST_TOKEN",
CLOSE_APP = "CLOSE_APP"
CLOSE_APP = "CLOSE_APP",
AUTHORIZED_APP_ID = "AUTHORIZED_APP_ID"
}
export declare enum AppBridgeCallbackMessageType {
REQUEST_TOKEN_RESPONSE = "REQUEST_TOKEN_RESPONSE"
REQUEST_TOKEN_RESPONSE = "REQUEST_TOKEN_RESPONSE",
AUTHORIZED_APP_ID_RESPONSE = "AUTHORIZED_APP_ID_RESPONSE"
}

@@ -27,0 +30,0 @@ export declare type AppEvent = {

@@ -85,2 +85,28 @@ "use strict";

}
static getAuthorizedAppId() {
return new Promise((resolve, reject) => {
const timer = setTimeout(() => reject('Timed out'), 5000);
try {
const callback = (msg) => {
var _a, _b, _c;
if (((_a = msg.data) === null || _a === void 0 ? void 0 : _a.type) === AppBridgeCallbackMessageType.AUTHORIZED_APP_ID_RESPONSE) {
const authorizedAppId = (_c = (_b = msg.data) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.authorizedAppId;
resolve(authorizedAppId);
AppBridgeHelper.stopListener(callback);
clearTimeout(timer);
}
};
AppBridgeHelper.startListener(callback);
const event = {
type: AppBridgeMessageType.AUTHORIZED_APP_ID,
data: {},
};
AppBridgeHelper.sendEvent(event);
}
catch (e) {
clearTimeout(timer);
reject(e);
}
});
}
static sendEvent(event) {

@@ -101,2 +127,3 @@ //@ts-ignore

AppBridgeMessageType["CLOSE_APP"] = "CLOSE_APP";
AppBridgeMessageType["AUTHORIZED_APP_ID"] = "AUTHORIZED_APP_ID";
})(AppBridgeMessageType = exports.AppBridgeMessageType || (exports.AppBridgeMessageType = {}));

@@ -106,3 +133,4 @@ var AppBridgeCallbackMessageType;

AppBridgeCallbackMessageType["REQUEST_TOKEN_RESPONSE"] = "REQUEST_TOKEN_RESPONSE";
AppBridgeCallbackMessageType["AUTHORIZED_APP_ID_RESPONSE"] = "AUTHORIZED_APP_ID_RESPONSE";
})(AppBridgeCallbackMessageType = exports.AppBridgeCallbackMessageType || (exports.AppBridgeCallbackMessageType = {}));
//# sourceMappingURL=app-bridge.js.map
{
"name": "@ikas/app-helpers",
"version": "1.0.1",
"version": "1.0.2",
"description": "ikas store app helpers",

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

@@ -99,2 +99,31 @@ export class AppBridgeHelper {

static getAuthorizedAppId(): Promise<string | undefined> {
return new Promise((resolve, reject) => {
const timer = setTimeout(() => reject('Timed out'), 5000);
try {
const callback = (msg: MessageEvent) => {
if (msg.data?.type === AppBridgeCallbackMessageType.AUTHORIZED_APP_ID_RESPONSE) {
const authorizedAppId = msg.data?.data?.authorizedAppId;
resolve(authorizedAppId);
AppBridgeHelper.stopListener(callback);
clearTimeout(timer);
}
};
AppBridgeHelper.startListener(callback);
const event: AppEvent = {
type: AppBridgeMessageType.AUTHORIZED_APP_ID,
data: {},
};
AppBridgeHelper.sendEvent(event);
} catch (e) {
clearTimeout(timer);
reject(e);
}
});
}
static sendEvent(event: AppEvent) {

@@ -114,2 +143,3 @@ //@ts-ignore

CLOSE_APP = 'CLOSE_APP',
AUTHORIZED_APP_ID = 'AUTHORIZED_APP_ID',
}

@@ -119,2 +149,3 @@

REQUEST_TOKEN_RESPONSE = 'REQUEST_TOKEN_RESPONSE',
AUTHORIZED_APP_ID_RESPONSE = 'AUTHORIZED_APP_ID_RESPONSE',
}

@@ -121,0 +152,0 @@

Sorry, the diff of this file is not supported yet

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