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

ame-super-app-web

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ame-super-app-web - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

dist/tsc/src/errors/InexistentStackError.d.ts

4

dist/tsc/src/model/SharedMethods.d.ts

@@ -17,2 +17,6 @@ import AskUserDataInput from "./input/AskUserDataInput";

/**
* Método para ir para a home do hospedeiro após fechar o último miniapp em uma pilha
*/
goHome?: () => void;
/**
* Métodos opcionais extra contrato

@@ -19,0 +23,0 @@ */

@@ -29,2 +29,3 @@ import OpenMiniAppFromClient from "../model/input/OpenMiniAppFromClient";

getLastMiniApp(id: string): OpenMiniAppFromClient;
removeStack(id: string): void;
private checkIfStackExists;

@@ -31,0 +32,0 @@ private wrapMiniApp;

@@ -5,2 +5,3 @@ "use strict";

const uuid_1 = require("uuid");
const InexistentStackError_1 = tslib_1.__importDefault(require("../errors/InexistentStackError"));
const BrowserHistoryService_1 = tslib_1.__importDefault(require("./BrowserHistoryService"));

@@ -92,2 +93,5 @@ class MiniAppStackService {

delete this.miniAppStacks[id];
if (this.stackIds[this.stackIds.length - 1] === id) {
this.stackIds.pop();
}
}

@@ -108,6 +112,16 @@ return this.unwrapMiniApp(wrappedMiniApp);

}
removeStack(id) {
try {
this.checkIfStackExists(id);
}
catch (e) {
return;
}
delete this.miniAppStacks[id];
this.stackIds = this.stackIds.filter((item) => item !== id);
}
checkIfStackExists(id) {
if (!this.miniAppStacks[id]) {
console.debug(`stack ${id} does not exist`);
throw new Error(`miniapp.stack.inexistent, id: ${id}`);
throw new InexistentStackError_1.default(id);
}

@@ -114,0 +128,0 @@ }

@@ -12,2 +12,4 @@ import MiniAppConfigs from "../model/MiniAppConfigs";

getInitializationInfos(): Promise<any>;
closeMiniApp(): Promise<any>;
closeAllAndGoHome(): Promise<any>;
}

@@ -66,4 +66,14 @@ "use strict";

}
closeMiniApp() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return this.superApp.closeMiniApp();
});
}
closeAllAndGoHome() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return this.superApp.closeAllAndGoHome();
});
}
}
exports.default = SuperAppService;
//# sourceMappingURL=SuperAppService.js.map

@@ -29,3 +29,3 @@ import InitInput from "./model/input/InitInput";

private parseOpenMiniAppWorkspaceInputContext;
pushMiniApp: (input: OpenMiniAppFromClient, shouldPushState?: boolean | undefined) => Promise<void>;
pushMiniApp: (input: OpenMiniAppFromClient, shouldPushState?: boolean) => Promise<void>;
getInitializationInfos(): {

@@ -41,2 +41,3 @@ type: string;

receiveMessage: (event: any) => void;
private decodeErrorMessage;
health: () => {

@@ -55,2 +56,6 @@ project: string;

private initMiniApp;
closeMiniApp(): void;
closeAllAndGoHome(): void;
private canGoHome;
private goHome;
}

@@ -15,2 +15,4 @@ "use strict";

const EnvironmentManager_1 = tslib_1.__importDefault(require("./helper/EnvironmentManager"));
const InexistentStackError_1 = tslib_1.__importDefault(require("./errors/InexistentStackError"));
const SuperAppServiceError_1 = tslib_1.__importDefault(require("./errors/SuperAppServiceError"));
const FRAME_ID = "ame-platform-frame";

@@ -165,4 +167,4 @@ class SuperApp {

.catch((err) => {
//console.error("executou com erro o método", methodName, err)
this.rejectPromiseOnWindow(originWindow, { promiseId: data.promiseId, res: err });
// console.error("executou com erro o método", methodName, err);
this.rejectPromiseOnWindow(originWindow, { promiseId: data.promiseId, res: this.decodeErrorMessage(err) });
});

@@ -277,2 +279,14 @@ };

}
decodeErrorMessage(error) {
let message = "";
if (error) {
if (error instanceof SuperAppServiceError_1.default) {
message = error.details;
}
else if (error instanceof Error) {
message = error.message;
}
}
return message;
}
checkMiniAppDataTargetValidity(miniAppData, errorMessage) {

@@ -306,4 +320,44 @@ if (!(miniAppData.target === this.context.target)) {

}
closeMiniApp() {
const stackId = this.miniAppStackService.getLastMiniAppStackKey();
this.miniAppStackService.popMiniApp(stackId);
try {
const miniapp = this.miniAppStackService.getLastMiniApp(stackId);
this.openMiniAppInDefaultContainer(miniapp.slug);
}
catch (e) {
if (e instanceof InexistentStackError_1.default) {
this.goHome();
}
else {
throw e;
}
}
}
closeAllAndGoHome() {
if (this.canGoHome()) {
const stackId = this.miniAppStackService.getLastMiniAppStackKey();
this.miniAppStackService.removeStack(stackId);
this.goHome();
}
else {
throw new Error("goHome.method.missing");
}
}
canGoHome() {
var _a;
return typeof ((_a = this.context.methods) === null || _a === void 0 ? void 0 : _a.goHome) === "function";
}
goHome() {
if (this.canGoHome()) {
// Garantido por lógica do if que a função da próxima linha nunca vai estar "undefined"
// @ts-ignore next-line
this.context.methods.goHome();
}
else {
throw new Error("goHome.method.missing");
}
}
}
exports.default = SuperApp;
//# sourceMappingURL=SuperApp.js.map

2

dist/tsc/src/version.d.ts

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

declare const _default: "3.0.0";
declare const _default: "3.1.0";
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = "3.0.0";
exports.default = "3.1.0";
//# sourceMappingURL=version.js.map
{
"name": "ame-super-app-web",
"version": "3.0.0",
"version": "3.1.0",
"_versionBetaExample": "1.0.2-beta.0",

@@ -5,0 +5,0 @@ "__versionBetaExample": "1.0.2-alpha.0",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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