@m4l/core 2.0.18 → 2.0.20-beta.1

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.
Files changed (61) hide show
  1. package/commonjs/index.js +12 -0
  2. package/contexts/AuthContext/AuthContext.d.ts +0 -4
  3. package/contexts/BaseContext/BaseContext.d.ts +7 -0
  4. package/contexts/BaseContext/BaseContext.js +21 -0
  5. package/contexts/BaseContext/index.d.ts +1 -11
  6. package/contexts/BaseContext/index.js +1 -11
  7. package/contexts/BaseContext/store.d.ts +6 -0
  8. package/contexts/BaseContext/store.js +42 -0
  9. package/contexts/BaseContext/types.d.ts +29 -2
  10. package/contexts/DomainContext/index.d.ts +0 -4
  11. package/contexts/DomainCountryContext/index.d.ts +0 -4
  12. package/contexts/EnvironmentContext/index.d.ts +0 -4
  13. package/contexts/FlagsContext/index.d.ts +0 -4
  14. package/contexts/FlagsContext/store.d.ts +0 -4
  15. package/contexts/FlagsContext/store.js +0 -8
  16. package/contexts/HostToolsContext/index.d.ts +0 -4
  17. package/contexts/ModuleDictionaryContext/index.d.ts +0 -4
  18. package/contexts/ModulePrivilegesContext/index.d.ts +0 -4
  19. package/contexts/ModuleSkeletonContext/index.d.ts +0 -4
  20. package/contexts/NetworkContext/index.d.ts +0 -4
  21. package/hooks/index.d.ts +1 -1
  22. package/hooks/useAuth/useAuth.d.ts +0 -4
  23. package/hooks/useBase/index.d.ts +1 -9
  24. package/hooks/useBase/index.js +1 -11
  25. package/hooks/useBase/useBase.d.ts +10 -0
  26. package/hooks/useBase/useBase.js +17 -0
  27. package/hooks/useDomain/index.d.ts +0 -4
  28. package/hooks/useDomainCountry/index.d.ts +0 -4
  29. package/hooks/useEnvironment/index.d.ts +0 -4
  30. package/hooks/useFlagsStore/index.d.ts +0 -8
  31. package/hooks/useHostTools/index.d.ts +0 -4
  32. package/hooks/useLocalStorage/index.d.ts +0 -4
  33. package/hooks/useLocalStorageWithListener/index.d.ts +0 -4
  34. package/hooks/useModuleDictionary/index.d.ts +0 -4
  35. package/hooks/useModulePrivileges/index.d.ts +0 -4
  36. package/hooks/useModuleSkeleton/index.d.ts +0 -4
  37. package/hooks/useNetwork/index.d.ts +0 -4
  38. package/hooks/usePaginate/index.d.ts +1 -0
  39. package/hooks/usePaginate/index.js +9 -9
  40. package/hooks/usePropageteMF/index.d.ts +0 -4
  41. package/index.d.ts +1 -0
  42. package/index.js +116 -81
  43. package/not_recognized/index.js +16404 -0
  44. package/package.json +4 -2
  45. package/test/constants.d.ts +0 -20
  46. package/test/constants.js +72 -0
  47. package/test/index.d.ts +4 -0
  48. package/test/index.js +1 -0
  49. package/test/mocks.js +10 -0
  50. package/test/types.js +1 -0
  51. package/test/utils.d.ts +0 -4
  52. package/test/utils.js +18 -0
  53. package/types/index.d.ts +1 -1
  54. package/utils/axiosOperation/index.d.ts +0 -4
  55. package/utils/axiosOperation/index.js +0 -4
  56. package/utils/getLocalStorage/index.d.ts +0 -4
  57. package/utils/getPropertyByString/index.d.ts +2 -8
  58. package/utils/getPropertyByString/index.js +18 -19
  59. package/utils/index.d.ts +1 -0
  60. package/utils/setLocalStorage/index.d.ts +0 -4
  61. package/utils/voidFunction.d.ts +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/core",
3
- "version": "2.0.18",
3
+ "version": "2.0.20-beta.1",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team",
6
6
  "publishConfig": {
@@ -12,8 +12,10 @@
12
12
  "dependencies": {
13
13
  "axios": "^1.0.0",
14
14
  "camelcase-keys": "^9.1.3",
15
+ "fast-equals": "^5.0.1",
15
16
  "history": "5.3.0",
16
17
  "immer": "^9.0.21",
18
+ "lodash-es": "^4.17.21",
17
19
  "qs": "^6.0.0",
18
20
  "react-toastify": "10.0.5",
19
21
  "snakecase-keys": "^8.0.1",
@@ -44,7 +46,7 @@
44
46
  "*"
45
47
  ],
46
48
  "source": "./index.js",
47
- "main": "./src/index.ts",
49
+ "main": "./dist/index.js",
48
50
  "module": "./index.js",
49
51
  "type": "module",
50
52
  "types": "./index.d.ts",
@@ -64,26 +64,6 @@ export declare const environmentDataForTesting: {
64
64
  export declare const baseDataForTesting: BaseDataForTesting;
65
65
  /**
66
66
  * Mock toaster
67
- * @updatedUser Juan Escobar - automatic
68
- * @updatedUser Juan Escobar - automatic
69
- * @updatedUser Juan Escobar - automatic
70
- * @updatedUser Juan Escobar - automatic
71
- * @updatedAt 2024-10-04 18:42:01 - automatic
72
- * @updatedAt 2024-10-04 18:42:01 - automatic
73
- * @updatedAt 2024-10-04 18:42:01 - automatic
74
- * @updatedAt 2024-10-04 18:42:01 - automatic
75
- * @createdAt 2024-10-04 18:42:00 - automatic
76
- * @createdAt 2024-10-04 18:42:00 - automatic
77
- * @createdAt 2024-10-04 18:42:00 - automatic
78
- * @createdAt 2024-10-04 18:42:00 - automatic
79
- * @author Juan Escobar - automatic
80
- * @author Juan Escobar - automatic
81
- * @author Juan Escobar - automatic
82
- * @author Juan Escobar - automatic
83
- * @author Juan Escobar - automatic
84
- * @createdAt 2024-10-04 18:42:00 - automatic
85
- * @updatedAt 2024-10-04 18:42:01 - automatic
86
- * @updatedUser Juan Escobar - automatic
87
67
  */
88
68
  export declare const mock_toaster: Toaster;
89
69
  export declare const hostToolsDataForTesting: HostToolsType;
@@ -0,0 +1,72 @@
1
+ import { e as t, f as o, b as e, c as a, d as n } from "./mocks.js";
2
+ const c = "testing", r = "label_for_module_name", l = {
3
+ data: { module_name: r, label1: "testGetLabel1" },
4
+ comp1: { key1: "testcomp1label" }
5
+ }, m = ["priv1"], _ = { data: { priv1: !0 } }, d = {
6
+ data: {
7
+ name: "a",
8
+ company_logo_small_url: "b",
9
+ company_logo_normal_url: "c"
10
+ }
11
+ }, g = {
12
+ id: 1,
13
+ currency: "$",
14
+ currency_decimal_digits: 0,
15
+ decimal_symbol: ".",
16
+ thousands_symbol: ","
17
+ }, u = {
18
+ id: 2,
19
+ currency: "USD",
20
+ currency_decimal_digits: 2,
21
+ decimal_symbol: ",",
22
+ thousands_symbol: "."
23
+ }, p = {
24
+ data: { a: 1, b: "testing" }
25
+ }, y = {
26
+ method: "GET",
27
+ endPoint: "endpoint",
28
+ parms: {}
29
+ }, b = {
30
+ isLocalhost: !0,
31
+ host: "h2",
32
+ domain_token: "1",
33
+ host_api_local: "2",
34
+ host_api_remote: "https://localhost",
35
+ host_static_assets: "4",
36
+ environment_assets: "5",
37
+ isMicroFrontend: !1,
38
+ isIsolatation: !1,
39
+ database: "domain"
40
+ }, h = {
41
+ a: "hellou",
42
+ b: 1
43
+ }, s = () => 0;
44
+ s.info = () => 1;
45
+ s.success = () => 2;
46
+ s.warning = () => 3;
47
+ s.error = () => 4;
48
+ const T = {
49
+ history: {},
50
+ toast: s,
51
+ startProgress: t,
52
+ stopProgress: o,
53
+ events_add_listener: e,
54
+ events_remove_listener: a,
55
+ events_emit: n
56
+ };
57
+ export {
58
+ r as a,
59
+ d as b,
60
+ g as c,
61
+ l as d,
62
+ u as e,
63
+ p as f,
64
+ b as g,
65
+ h,
66
+ s as i,
67
+ T as j,
68
+ c as m,
69
+ y as n,
70
+ m as q,
71
+ _ as r
72
+ };
@@ -0,0 +1,4 @@
1
+ export * from './constants';
2
+ export * from './mocks';
3
+ export * from './types';
4
+ export * from './utils';
package/test/index.js ADDED
@@ -0,0 +1 @@
1
+
package/test/mocks.js ADDED
@@ -0,0 +1,10 @@
1
+ const s = vi.fn(), n = vi.fn(), o = vi.fn(), e = vi.fn(), t = vi.fn(), c = vi.fn(), a = vi.fn();
2
+ export {
3
+ n as a,
4
+ o as b,
5
+ e as c,
6
+ t as d,
7
+ c as e,
8
+ a as f,
9
+ s as m
10
+ };
package/test/types.js ADDED
@@ -0,0 +1 @@
1
+
package/test/utils.d.ts CHANGED
@@ -3,10 +3,6 @@ import { renderHook } from '@testing-library/react-hooks';
3
3
  import { default as React, act } from 'react';
4
4
  /**
5
5
  * customRender
6
- * @author Juan Escobar - automatic
7
- * @createdAt 2024-10-04 18:42:01 - automatic
8
- * @updatedAt 2024-10-04 18:42:01 - automatic
9
- * @updatedUser Juan Escobar - automatic
10
6
  */
11
7
  declare const customRender: (ui: React.ReactElement, options?: {}) => import('@testing-library/react').RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
12
8
  export { default as userEvent } from '@testing-library/user-event';
package/test/utils.js ADDED
@@ -0,0 +1,18 @@
1
+ import { c, l as o, a as s, r as l } from "../not_recognized/index.js";
2
+ import "react";
3
+ beforeEach(() => {
4
+ c(), o.cleanup(), vi.clearAllMocks();
5
+ });
6
+ s(() => {
7
+ });
8
+ const n = (r, a = {}) => l(r, {
9
+ // wrap provider(s) here if needed
10
+ /**
11
+ * wrapper
12
+ */
13
+ wrapper: ({ children: e }) => e,
14
+ ...a
15
+ });
16
+ export {
17
+ n as c
18
+ };
package/types/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { BrowserHistory } from 'history';
4
4
  import { AxiosProgressEvent, ResponseType } from 'axios';
5
5
  import { DomainCountry } from '../contexts';
6
6
  import { AxiosOptions } from '../utils/axiosOperation/types';
7
- export declare type Maybe<T> = T | undefined | null;
7
+ export type Maybe<T> = T | undefined | null;
8
8
  type MFProps = {
9
9
  moduleId: string;
10
10
  debugPort: number;
@@ -1,9 +1,5 @@
1
1
  import { EnvironmentType, HostToolsType, NetworkProps } from '../../types';
2
2
  /**
3
3
  * Esta función se encarga de realizar las operaciones de red.
4
- * @author Juan Escobar - automatic
5
- * @createdAt 2024-10-04 18:42:01 - automatic
6
- * @updatedAt 2024-10-04 18:42:01 - automatic
7
- * @updatedUser Juan Escobar - automatic
8
4
  */
9
5
  export declare const axiosOperation: (props: NetworkProps, enviroment: EnvironmentType, hostTools: HostToolsType) => Promise<any>;
@@ -55,10 +55,6 @@ const L = async (e, t, a) => {
55
55
  params: {},
56
56
  /**
57
57
  * paramsSerializer: es una función opcional que permite serializar los parámetros de la URL.
58
- * @author Juan Escobar - automatic
59
- * @createdAt 2024-10-04 18:42:01 - automatic
60
- * @updatedAt 2024-10-04 18:42:01 - automatic
61
- * @updatedUser Juan Escobar - automatic
62
58
  */
63
59
  paramsSerializer: () => b.stringify(g, { encode: !0 }),
64
60
  headers: p,
@@ -1,8 +1,4 @@
1
1
  /**
2
2
  * Get value from local storage
3
- * @author Juan Escobar - automatic
4
- * @createdAt 2024-10-04 18:42:01 - automatic
5
- * @updatedAt 2024-10-04 18:42:01 - automatic
6
- * @updatedUser Juan Escobar - automatic
7
3
  */
8
4
  export declare function getLocalStorage<ValueType>(key: string, initialValue: ValueType): ValueType;
@@ -1,10 +1,4 @@
1
- type PropertyType = string | undefined | any[] | Record<any, any>;
2
- /**
3
- * Devuelve una parte de un objeto, que puede estar anidado.
4
- * @author Juan Escobar - automatic
5
- * @createdAt 2024-10-04 18:42:01 - automatic
6
- * @updatedAt 2024-10-04 18:42:01 - automatic
7
- * @updatedUser Juan Escobar - automatic
8
- */
1
+ type PropertyType = string | number | boolean | any[] | Record<any, any>;
9
2
  export declare function getPropertyByString<T extends PropertyType = PropertyType>(object: any, key: string, defaultValue?: T): T;
3
+ export declare function getPropertyByString<T extends PropertyType = PropertyType>(object: any, key: string, defaultValue: T): T;
10
4
  export {};
@@ -1,25 +1,24 @@
1
- function f(o, i, s) {
2
- const y = i.split(".");
3
- let e = o;
4
- for (const t of y) {
5
- const n = t.match(/^(\w+)\[(\w+)\]$/);
6
- if (n) {
7
- const r = n[1], c = n[2];
8
- if (e[r] && Array.isArray(e[r])) {
9
- if (c === "lastIndex")
10
- return e[r][e[r].length - 1];
11
- {
12
- const a = parseInt(c);
13
- return e[r][a];
14
- }
1
+ function f(y, a, n) {
2
+ const g = a.split(".");
3
+ let r = y;
4
+ for (const s of g) {
5
+ const c = s.match(/^(\w+)\[(\w+)\]$/);
6
+ if (c) {
7
+ const i = c[1], o = c[2];
8
+ if (r[i] && Array.isArray(r[i])) {
9
+ const t = r[i];
10
+ if (o === "lastIndex")
11
+ return t.length > 0 ? t[t.length - 1] : n;
12
+ const e = parseInt(o, 10);
13
+ return isNaN(e) || e < 0 || e >= t.length ? n : t[e];
15
14
  } else
16
- return s;
17
- } else if (e[t] !== void 0)
18
- e = e[t];
15
+ return n;
16
+ } else if (r[s] !== void 0)
17
+ r = r[s];
19
18
  else
20
- return s;
19
+ return n;
21
20
  }
22
- return e;
21
+ return r;
23
22
  }
24
23
  export {
25
24
  f as g
package/utils/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export { evaluateWithContext } from './evaluateWithContext';
4
4
  export { getLocalStorage } from './getLocalStorage';
5
5
  export { setLocalStorage } from './setLocalStorage';
6
6
  export { axiosOperation } from './axiosOperation';
7
+ export type { AxiosOptions } from './axiosOperation/types';
@@ -1,8 +1,4 @@
1
1
  /**
2
2
  * Graba en el localStorage un objeto con la key especificada. Si ya existe, lo mezcla con el objeto actual.
3
- * @author Juan Escobar - automatic
4
- * @createdAt 2024-10-04 18:42:01 - automatic
5
- * @updatedAt 2024-10-04 18:42:01 - automatic
6
- * @updatedUser Juan Escobar - automatic
7
3
  */
8
4
  export declare function setLocalStorage<ValueType>(key: string, newValue: ValueType, mixCurrentLocalStorage?: boolean): void;
@@ -1,8 +1,4 @@
1
1
  /**
2
2
  * A function that does nothing.
3
- * @author Juan Escobar - automatic
4
- * @createdAt 2024-10-04 18:42:01 - automatic
5
- * @updatedAt 2024-10-04 18:42:01 - automatic
6
- * @updatedUser Juan Escobar - automatic
7
3
  */
8
4
  export declare function voidFunction(): void;