Refactoring (#27)

* chore: release version v1.3.1

* fix(Core): Add system "true security" correction

* chore: release version v1.3.1
This commit is contained in:
Dmitry Popov
2024-10-09 13:23:35 +04:00
committed by GitHub
parent 495c3e1cd7
commit ef6c08dfe8
39 changed files with 955 additions and 2454 deletions

View File

@@ -1,6 +1,5 @@
import { createRoot } from 'react-dom/client';
import Mapper from './MapRoot';
import { decompressToJson } from './utils';
export default {
_rootEl: null,
@@ -28,17 +27,12 @@ export default {
handleEventWrapper(event: string, handler: (payload: any) => void) {
this.handleEvent(event, (body: any) => {
if (event === 'map_event') {
const { type, body: data } = body;
handler({ type, body: decompressToJson(data) });
} else {
handler(body);
}
handler(body);
});
},
reconnected() {
this.pushEvent('reconnected');
this.pushEvent('ui_loaded');
},
async pushEventAsync(event: string, payload: any) {

View File

@@ -1,14 +0,0 @@
import pako from 'pako';
export const decompressToJson = (base64string: string) => {
const base64_decoded = atob(base64string);
const charData = base64_decoded.split('').map(function (x) {
return x.charCodeAt(0);
});
const zlibData = new Uint8Array(charData);
const inflatedData = pako.inflate(zlibData, {
to: 'string',
});
return JSON.parse(inflatedData);
};

View File

@@ -1,3 +1,2 @@
export * from './contextStore';
export * from './decompressToJson';
export * from './getQueryVariable';