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

@ombori/ga-settings

Package Overview
Dependencies
Maintainers
19
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ombori/ga-settings - npm Package Compare versions

Comparing version 2.35.1 to 2.55.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [2.55.0](https://github.com/ombori/gridapp/compare/v2.54.4...v2.55.0) (2021-04-30)
### Features
* useAppInfo for ga-settings ([a16d061](https://github.com/ombori/gridapp/commit/a16d061dc47ee90c25a65daeae3fb97466def89f))
## [2.35.1](https://github.com/ombori/gridapp/compare/v2.35.0...v2.35.1) (2021-02-26)

@@ -8,0 +19,0 @@

@@ -7,6 +7,20 @@ declare global {

export declare function useSettings<T>(): T | null;
export declare type AppInfo = {
appDisplayName: string;
appId: string;
appName: string;
defaultLanguage: string;
organizationId: string;
organizationName: string;
provider: string;
release: string;
supportedLanguages: string[];
type: string;
};
export declare const useAppInfo: () => AppInfo | null;
declare const _default: {
useSettings: typeof useSettings;
useAppInfo: () => AppInfo | null;
};
export default _default;
//# sourceMappingURL=index.d.ts.map

48

dist/index.js
import { useEffect, useState } from 'react';
var globalSettings = null;
var globalInfo = null;
// NOTE: in dev mode we just load everything to a global variable
var IS_DEV = !process.env.NODE_ENV || process.env.NODE_ENV === 'development';
if (IS_DEV) {
console.log('Settings development mode', process.cwd());
var settings = require('settings/index.json');
globalSettings = settings.app.gridApp.settings;
globalInfo = settings.general;
}
;
export function useSettings() {
if (IS_DEV)
return globalSettings;
var _a = useState(globalSettings), settings = _a[0], setSettings = _a[1];
useEffect(function () {
if (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') {
console.log('Settings development mode', process.cwd());
var settings_1 = require('settings/index.json');
setSettings(settings_1.app.gridApp.settings);
console.log('Settings loaded', settings_1.app.gridApp.settings);
}
else {
console.log('Settings production mode');
window.addEventListener('GridappReady', function () {
// settings are ready for use!
var gridapp = window.gridapp;
console.log('GridAppReady', gridapp);
var settings = gridapp.getSettings();
globalSettings = settings;
setSettings(settings);
});
}
console.log('Settings production mode');
var handler = function () {
// settings are ready for use!
var gridapp = window.gridapp;
console.log('Settings ready', gridapp);
var settings = gridapp.getSettings();
globalSettings = settings;
setSettings(settings);
};
window.addEventListener('GridappReady', handler);
return function () { return window.removeEventListener('GridappReady', handler); };
}, []);
return settings;
}
export default { useSettings: useSettings };
export var useAppInfo = function () {
if (IS_DEV)
return globalInfo;
var settings = useSettings();
return settings ? settings._general : null;
};
export default { useSettings: useSettings, useAppInfo: useAppInfo };
{
"name": "@ombori/ga-settings",
"version": "2.35.1",
"version": "2.55.0",
"main": "dist/index.js",

@@ -19,3 +19,3 @@ "license": "UNLICENSED",

},
"gitHead": "4da5f5d89fd95934793151ac32e9a32055775365"
"gitHead": "f6e19e0e6163a7b54c19e9912e795a90de6b889d"
}

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