@m4l/core 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,4 @@ export * from './hooks';
|
|
|
3
3
|
export { EmitEvents } from './types';
|
|
4
4
|
export type { Maybe, HostToolsType, NetworkProps, EnvironmentType, AxiosOperation, EventFunListener, } from './types';
|
|
5
5
|
export type { GetLabelType, Dictionary, ModuleDictionary, ComponentDictionary, } from './types/dictionary';
|
|
6
|
-
export
|
|
7
|
-
export { axiosOperation } from './utils/axiosOperation/index';
|
|
6
|
+
export * from './utils';
|
package/dist/index.js
CHANGED
|
@@ -245,6 +245,34 @@ var EmitEvents = /* @__PURE__ */ ((EmitEvents2) => {
|
|
|
245
245
|
EmitEvents2["EMMIT_EVENT_HOST_THEME_CHANGE"] = "host_theme_change";
|
|
246
246
|
return EmitEvents2;
|
|
247
247
|
})(EmitEvents || {});
|
|
248
|
+
function getPropertyByString(object, propString) {
|
|
249
|
+
let value = object;
|
|
250
|
+
const props = propString.split(".");
|
|
251
|
+
for (let index = 0; index < props.length; index += 1) {
|
|
252
|
+
if (props[index] === void 0)
|
|
253
|
+
break;
|
|
254
|
+
value = value[props[index]];
|
|
255
|
+
}
|
|
256
|
+
return value;
|
|
257
|
+
}
|
|
258
|
+
function getLocalStorage(key, initialValue2) {
|
|
259
|
+
try {
|
|
260
|
+
const item = window.localStorage.getItem(key);
|
|
261
|
+
return item !== null ? JSON.parse(item) : initialValue2;
|
|
262
|
+
} catch (e) {
|
|
263
|
+
return initialValue2;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function setLocalStorage(key, value) {
|
|
267
|
+
try {
|
|
268
|
+
const item = window.localStorage.getItem(key);
|
|
269
|
+
let newValue = item !== null ? JSON.parse(item) : {};
|
|
270
|
+
newValue = { ...newValue, ...value };
|
|
271
|
+
window.localStorage.setItem(key, JSON.stringify(newValue));
|
|
272
|
+
} catch (e) {
|
|
273
|
+
console.error(e);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
248
276
|
function getResponse(endPoint, response) {
|
|
249
277
|
console.log("Axios response", response, typeof response.data);
|
|
250
278
|
if (response && response.data && typeof response.data === "object") {
|
|
@@ -322,4 +350,4 @@ const axiosOperation = async (props, enviroment, hostTools) => {
|
|
|
322
350
|
hostTools.stopProgress();
|
|
323
351
|
});
|
|
324
352
|
};
|
|
325
|
-
export { EmitEvents, EnvironmentContext, EnvironmentProvider, FlagsContext, FlagsProvider, HostToolsContext, HostToolsProvider, ModuleDictionaryContext, ModuleDictionaryProvider, NetworkContext, NetworkProvider, axiosOperation, useEnvironment, useFlags, useFlagsPresent, useHostTools, useLocalStorage, useModuleDictionary, useNetwork, voidFunction };
|
|
353
|
+
export { EmitEvents, EnvironmentContext, EnvironmentProvider, FlagsContext, FlagsProvider, HostToolsContext, HostToolsProvider, ModuleDictionaryContext, ModuleDictionaryProvider, NetworkContext, NetworkProvider, axiosOperation, getLocalStorage, getPropertyByString, setLocalStorage, useEnvironment, useFlags, useFlagsPresent, useHostTools, useLocalStorage, useModuleDictionary, useNetwork, voidFunction };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getLocalStorage<ValueType>(key: string, initialValue: ValueType): ValueType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getPropertyByString(object: Record<string, unknown>, propString: string): any;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { voidFunction } from './voidFunction';
|
|
2
|
+
export { getPropertyByString } from './getPropertyByString';
|
|
3
|
+
export { getLocalStorage } from './getLocalStorage';
|
|
4
|
+
export { setLocalStorage } from './setLocalStorage';
|
|
5
|
+
export { axiosOperation } from './axiosOperation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setLocalStorage<ValueType>(key: string, value: ValueType): void;
|