@m4l/core 2.0.7 → 2.0.9-alpha.0

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 (68) hide show
  1. package/contexts/AuthContext/{index-Dmmn1GmI.js → AuthContext.js} +38 -37
  2. package/contexts/AuthContext/constants.js +4 -0
  3. package/contexts/AuthContext/index.js +1 -0
  4. package/contexts/AuthContext/types.d.ts +6 -6
  5. package/contexts/BaseContext/types.d.ts +1 -1
  6. package/contexts/DomainContext/{index-GtnXeXqv.js → index.js} +5 -5
  7. package/contexts/DomainContext/types.d.ts +1 -1
  8. package/contexts/DomainCountryContext/{index-i1cLdKpa.js → index.js} +3 -3
  9. package/contexts/EnvironmentContext/types.d.ts +1 -1
  10. package/contexts/FlagsContext/index.js +14 -0
  11. package/contexts/FlagsContext/store.d.ts +1 -1
  12. package/contexts/FlagsContext/store.js +27 -0
  13. package/contexts/FlagsContext/types.d.ts +1 -1
  14. package/contexts/HostToolsContext/types.d.ts +1 -1
  15. package/contexts/ModuleDictionaryContext/{index-B_ZNLNhp.js → index.js} +16 -14
  16. package/contexts/ModulePrivilegesContext/{index-Ccm23KLv.js → index.js} +4 -4
  17. package/contexts/ModuleSkeletonContext/{index-op94InUL.js → index.js} +1 -1
  18. package/contexts/NetworkContext/{index-BdJ5VM1I.js → index.js} +7 -7
  19. package/contexts/NetworkContext/types.d.ts +2 -2
  20. package/contexts/index.js +1 -0
  21. package/hooks/index.js +1 -0
  22. package/hooks/useAuth/index.js +1 -0
  23. package/hooks/useAuth/useAuth.js +11 -0
  24. package/hooks/useBase/index.js +11 -0
  25. package/hooks/useDomain/index.js +11 -0
  26. package/hooks/useDomainCountry/index.js +11 -0
  27. package/hooks/useEnvironment/index.js +11 -0
  28. package/hooks/useFlagsStore/index.js +20 -0
  29. package/hooks/useHostTools/index.js +11 -0
  30. package/hooks/useLocalStorage/index.js +23 -0
  31. package/hooks/useLocalStorageWithListener/index.d.ts +1 -1
  32. package/hooks/useLocalStorageWithListener/index.js +33 -0
  33. package/hooks/useModuleDictionary/{index-BUUV7OWG.js → index.js} +1 -1
  34. package/hooks/useModulePrivileges/{index-DCvSiJ_1.js → index.js} +1 -1
  35. package/hooks/useModuleSkeleton/{index-CGP_hVSJ.js → index.js} +1 -1
  36. package/hooks/useNetwork/index.js +11 -0
  37. package/hooks/usePaginate/{index-BTDulhEo.js → index.js} +23 -27
  38. package/hooks/usePaginate/types.js +8 -0
  39. package/hooks/usePropageteMF/{index-BqiRJLJL.js → index.js} +1 -1
  40. package/index.js +50 -43
  41. package/package.json +28 -13
  42. package/types/dictionary.d.ts +1 -1
  43. package/types/index.d.ts +12 -11
  44. package/utils/{axiosOperation-CEky_K0E.js → axiosOperation/index.js} +1 -1
  45. package/utils/axiosOperation/types.d.ts +2 -2
  46. package/utils/evaluateWithContext/index.js +11 -0
  47. package/utils/getLocalStorage/index.js +11 -0
  48. package/utils/getPropertyByString/index.d.ts +1 -1
  49. package/utils/getPropertyByString/index.js +26 -0
  50. package/utils/index.js +1 -0
  51. package/utils/setLocalStorage/index.js +16 -0
  52. package/utils/voidFunction.js +5 -0
  53. package/vite-env.d.ts +4 -4
  54. package/contexts/FlagsContext/index-B-2B4Igz.js +0 -36
  55. package/hooks/useAuth/index-nEcvoYpH.js +0 -10
  56. package/hooks/useBase/index-D-4p1Xgw.js +0 -10
  57. package/hooks/useDomain/index-KteEl45C.js +0 -17
  58. package/hooks/useEnvironment/index-AJ50P5z7.js +0 -10
  59. package/hooks/useFlagsStore/index-C0OfnwSn.js +0 -19
  60. package/hooks/useHostTools/index-B20cHM5K.js +0 -10
  61. package/hooks/useLocalStorage/index-CsLmjbAr.js +0 -53
  62. package/hooks/useNetwork/index-Dr3i8fXz.js +0 -10
  63. package/node_modules-C59GSzS1.js +0 -377
  64. package/utils/index-C67J5HEa.js +0 -61
  65. /package/contexts/BaseContext/{index-DNyrnDVT.js → index.js} +0 -0
  66. /package/contexts/EnvironmentContext/{index-Ba_eINub.js → index.js} +0 -0
  67. /package/contexts/HostToolsContext/{index-Djz-c1-2.js → index.js} +0 -0
  68. /package/types/{index-TbOJOhBX.js → index.js} +0 -0
@@ -1,18 +1,15 @@
1
- import { useState as n, useRef as H, useCallback as L, useEffect as m } from "react";
2
- import { u as U } from "../useHostTools/index-B20cHM5K.js";
3
- import { u as j } from "../useNetwork/index-Dr3i8fXz.js";
4
- const s = {
5
- page: 0,
6
- rowsPerPage: 25,
7
- totalRecords: 0
8
- }, J = (w) => {
1
+ import { useState as n, useRef as H, useCallback as L, useEffect as l } from "react";
2
+ import { i as s } from "./types.js";
3
+ import { u as U } from "../useHostTools/index.js";
4
+ import { u as j } from "../useNetwork/index.js";
5
+ const K = (h) => {
9
6
  const {
10
- endPoint: h,
11
- timeout: R = 5e3,
12
- queryParams: P,
13
- fireOnChangeParms: i,
7
+ endPoint: w,
8
+ timeout: C = 5e3,
9
+ queryParams: i,
10
+ fireOnChangeParms: P,
14
11
  // Propiedad para permitir que un cambio en los parametros de la consulta dispare la recarga de la red
15
- fireOnFirstLoad: C = !0,
12
+ fireOnFirstLoad: R = !0,
16
13
  // propiedad que evita que se cargue la red la en el primer render del hook
17
14
  rowsPerPage: u = s.rowsPerPage,
18
15
  startProgress: d,
@@ -23,24 +20,24 @@ const s = {
23
20
  initialRows: E = [],
24
21
  externalCondition: c = !0,
25
22
  onNetworkError: f
26
- } = w, [p, g] = n(i ? 1 : 0), [O, a] = n(E), [b, o] = n({ ...s, rowsPerPage: u }), t = H({ ...s, rowsPerPage: u }), [x, F] = n(C), { startProgress: N, stopProgress: Q } = U(), { networkOperation: q } = j(), l = L(() => {
23
+ } = h, [p, g] = n(P ? 1 : 0), [O, o] = n(E), [b, a] = n({ ...s, rowsPerPage: u }), t = H({ ...s, rowsPerPage: u }), [x, F] = n(R), { startProgress: N, stopProgress: Q } = U(), { networkOperation: q } = j(), m = L(() => {
27
24
  g((r) => r + 1);
28
25
  }, []);
29
- return m(() => {
26
+ return l(() => {
30
27
  if (x) {
31
28
  F(!1);
32
29
  return;
33
30
  }
34
- i && l();
35
- }, [P]), m(() => {
31
+ P && m();
32
+ }, [i]), l(() => {
36
33
  let r = !0;
37
34
  if (!(!c || p === 0))
38
35
  return q({
39
36
  method: "GET",
40
- endPoint: h,
41
- timeout: R,
37
+ endPoint: w,
38
+ timeout: C,
42
39
  parms: {
43
- ...P,
40
+ ...i,
44
41
  page: t.current.page,
45
42
  limit: t.current.rowsPerPage
46
43
  },
@@ -52,26 +49,25 @@ const s = {
52
49
  },
53
50
  isRemote: k
54
51
  }).then((e) => {
55
- r && (a(e.data), t.current.page = e.pager.page, o((G) => ({
52
+ r && (o(e.data), t.current.page = e.pager.page, a((G) => ({
56
53
  ...G,
57
54
  page: e.pager.page,
58
55
  // rowsPerPage: response.pager.limit,
59
56
  totalRecords: e.pager.total
60
57
  })));
61
58
  }).catch((e) => {
62
- a([]), o(s), f && f(e.status);
59
+ o([]), a(s), f && f(e.status);
63
60
  }), function() {
64
61
  r = !1;
65
62
  };
66
63
  }, [p, c]), { onPageChange: (r) => {
67
64
  t.current.page = r, g((e) => e + 1);
68
65
  }, onRowsPerPageChange: (r) => {
69
- t.current.rowsPerPage = r, o((e) => ({ ...e, rowsPerPage: r })), g((e) => e + 1);
66
+ t.current.rowsPerPage = r, a((e) => ({ ...e, rowsPerPage: r })), g((e) => e + 1);
70
67
  }, pagerState: b, rows: O, clearRows: () => {
71
- a([]), o(s);
72
- }, Refresh: l, setRows: a };
68
+ o([]), a(s);
69
+ }, Refresh: m, setRows: o };
73
70
  };
74
71
  export {
75
- s as i,
76
- J as u
72
+ K as u
77
73
  };
@@ -0,0 +1,8 @@
1
+ const a = {
2
+ page: 0,
3
+ rowsPerPage: 25,
4
+ totalRecords: 0
5
+ };
6
+ export {
7
+ a as i
8
+ };
@@ -1,5 +1,5 @@
1
1
  import { useEffect as i } from "react";
2
- import { u as f } from "../useHostTools/index-B20cHM5K.js";
2
+ import { u as f } from "../useHostTools/index.js";
3
3
  function c(s) {
4
4
  const { isMicroFrontEnd: e, event: t, setHandler: o } = s, { events_add_listener: r, events_remove_listener: n } = f();
5
5
  i(() => (e && r(t, o), () => {
package/index.js CHANGED
@@ -1,47 +1,54 @@
1
- import { C as r, E as a } from "./types/index-TbOJOhBX.js";
2
- import { B as s, a as i } from "./contexts/BaseContext/index-DNyrnDVT.js";
3
- import { E as u, a as x } from "./contexts/EnvironmentContext/index-Ba_eINub.js";
4
- import { H as p, a as l } from "./contexts/HostToolsContext/index-Djz-c1-2.js";
5
- import { N as d, a as v } from "./contexts/NetworkContext/index-BdJ5VM1I.js";
6
- import { F as P, a as C } from "./contexts/FlagsContext/index-B-2B4Igz.js";
7
- import { D, a as S } from "./contexts/DomainContext/index-GtnXeXqv.js";
8
- import { M as y, a as F } from "./contexts/ModuleDictionaryContext/index-B_ZNLNhp.js";
9
- import { M as k, a as h } from "./contexts/ModulePrivilegesContext/index-Ccm23KLv.js";
10
- import { M as L, a as A } from "./contexts/ModuleSkeletonContext/index-op94InUL.js";
11
- import { D as N, a as w } from "./contexts/DomainCountryContext/index-i1cLdKpa.js";
12
- import { A as W, a as O } from "./contexts/AuthContext/index-Dmmn1GmI.js";
13
- import { u as j } from "./hooks/useBase/index-D-4p1Xgw.js";
14
- import { u as z } from "./hooks/useEnvironment/index-AJ50P5z7.js";
15
- import { a as I, u as J } from "./hooks/useFlagsStore/index-C0OfnwSn.js";
16
- import { u as Q } from "./hooks/useHostTools/index-B20cHM5K.js";
17
- import { u as U, a as V } from "./hooks/useDomain/index-KteEl45C.js";
18
- import { a as Y, u as Z } from "./hooks/useLocalStorage/index-CsLmjbAr.js";
19
- import { u as $ } from "./hooks/useModuleDictionary/index-BUUV7OWG.js";
20
- import { u as eo } from "./hooks/useModulePrivileges/index-DCvSiJ_1.js";
21
- import { u as ao } from "./hooks/useModuleSkeleton/index-CGP_hVSJ.js";
22
- import { u as so } from "./hooks/useNetwork/index-Dr3i8fXz.js";
23
- import { i as no, u as uo } from "./hooks/usePaginate/index-BTDulhEo.js";
24
- import { u as mo } from "./hooks/usePropageteMF/index-BqiRJLJL.js";
25
- import { u as lo } from "./hooks/useAuth/index-nEcvoYpH.js";
26
- import { e as vo, g as go, a as Po, s as Co, v as Mo } from "./utils/index-C67J5HEa.js";
27
- import { a as So } from "./utils/axiosOperation-CEky_K0E.js";
1
+ import { C as r, E as t } from "./types/index.js";
2
+ import { B as s, a as u } from "./contexts/BaseContext/index.js";
3
+ import { E as i, a as m } from "./contexts/EnvironmentContext/index.js";
4
+ import { H as p, a as f } from "./contexts/HostToolsContext/index.js";
5
+ import { N as d, a as v } from "./contexts/NetworkContext/index.js";
6
+ import { F as P, a as C } from "./contexts/FlagsContext/index.js";
7
+ import { D, a as S } from "./contexts/DomainContext/index.js";
8
+ import { M as y, a as F } from "./contexts/ModuleDictionaryContext/index.js";
9
+ import { M as k, a as h } from "./contexts/ModulePrivilegesContext/index.js";
10
+ import { M as L, a as A } from "./contexts/ModuleSkeletonContext/index.js";
11
+ import { D as N, a as w } from "./contexts/DomainCountryContext/index.js";
12
+ import { A as W, a as O } from "./contexts/AuthContext/AuthContext.js";
13
+ import { u as j } from "./hooks/useBase/index.js";
14
+ import { u as z } from "./hooks/useEnvironment/index.js";
15
+ import { a as I, u as J } from "./hooks/useFlagsStore/index.js";
16
+ import { u as Q } from "./hooks/useHostTools/index.js";
17
+ import { u as U } from "./hooks/useDomain/index.js";
18
+ import { u as X } from "./hooks/useLocalStorage/index.js";
19
+ import { u as Z } from "./hooks/useLocalStorageWithListener/index.js";
20
+ import { u as $ } from "./hooks/useModuleDictionary/index.js";
21
+ import { u as eo } from "./hooks/useModulePrivileges/index.js";
22
+ import { u as to } from "./hooks/useModuleSkeleton/index.js";
23
+ import { u as so } from "./hooks/useNetwork/index.js";
24
+ import { u as xo } from "./hooks/usePaginate/index.js";
25
+ import { u as mo } from "./hooks/usePropageteMF/index.js";
26
+ import { u as po } from "./hooks/useDomainCountry/index.js";
27
+ import { u as lo } from "./hooks/useAuth/useAuth.js";
28
+ import { i as go } from "./hooks/usePaginate/types.js";
29
+ import { v as Co } from "./utils/voidFunction.js";
30
+ import { g as Do } from "./utils/getPropertyByString/index.js";
31
+ import { e as co } from "./utils/evaluateWithContext/index.js";
32
+ import { g as Fo } from "./utils/getLocalStorage/index.js";
33
+ import { s as ko } from "./utils/setLocalStorage/index.js";
34
+ import { a as Bo } from "./utils/axiosOperation/index.js";
28
35
  export {
29
36
  W as AuthContext,
30
37
  O as AuthProvider,
31
38
  s as BaseContext,
32
- i as BaseProvider,
39
+ u as BaseProvider,
33
40
  r as CommonFlags,
34
41
  D as DomainContext,
35
42
  N as DomainCountryContext,
36
43
  w as DomainCountryProvider,
37
44
  S as DomainProvider,
38
- a as EmitEvents,
39
- u as EnvironmentContext,
40
- x as EnvironmentProvider,
45
+ t as EmitEvents,
46
+ i as EnvironmentContext,
47
+ m as EnvironmentProvider,
41
48
  P as FlagsContext,
42
49
  C as FlagsProvider,
43
50
  p as HostToolsContext,
44
- l as HostToolsProvider,
51
+ f as HostToolsProvider,
45
52
  y as ModuleDictionaryContext,
46
53
  F as ModuleDictionaryProvider,
47
54
  k as ModulePrivilegesContext,
@@ -50,27 +57,27 @@ export {
50
57
  A as ModuleSkeletonProvider,
51
58
  d as NetworkContext,
52
59
  v as NetworkProvider,
53
- So as axiosOperation,
54
- vo as evaluateWithContext,
55
- go as getLocalStorage,
56
- Po as getPropertyByString,
57
- no as initialPagerState,
58
- Co as setLocalStorage,
60
+ Bo as axiosOperation,
61
+ co as evaluateWithContext,
62
+ Fo as getLocalStorage,
63
+ Do as getPropertyByString,
64
+ go as initialPagerState,
65
+ ko as setLocalStorage,
59
66
  lo as useAuth,
60
67
  j as useBase,
61
68
  U as useDomain,
62
- V as useDomainCountry,
69
+ po as useDomainCountry,
63
70
  z as useEnvironment,
64
71
  I as useFlagsPresent,
65
72
  J as useFlagsStore,
66
73
  Q as useHostTools,
67
- Y as useLocalStorage,
74
+ X as useLocalStorage,
68
75
  Z as useLocalStorageWithListener,
69
76
  $ as useModuleDictionary,
70
77
  eo as useModulePrivileges,
71
- ao as useModuleSkeleton,
78
+ to as useModuleSkeleton,
72
79
  so as useNetwork,
73
- uo as usePaginate,
80
+ xo as usePaginate,
74
81
  mo as usePropageteMF,
75
- Mo as voidFunction
82
+ Co as voidFunction
76
83
  };
package/package.json CHANGED
@@ -1,17 +1,36 @@
1
1
  {
2
2
  "name": "@m4l/core",
3
- "version": "2.0.7",
3
+ "version": "2.0.9-alpha.0",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team",
6
- "private": false,
6
+ "dependencies": {
7
+ "camelcase-keys": "^9.1.3",
8
+ "immer": "^9.0.21",
9
+ "snakecase-keys": "^8.0.1",
10
+ "zustand": "4.3.6"
11
+ },
12
+ "resolutions": {
13
+ "glob": "^10.4.5",
14
+ "react": "^18.0.0",
15
+ "@types/react": "^18.0.0",
16
+ "@types/react-dom": "^18.0.0",
17
+ "react-dom": "^18.0.0",
18
+ "vite": "^5.4.7"
19
+ },
20
+ "overrides": {
21
+ "glob": "^10.4.5",
22
+ "eslint": "^9.0.0",
23
+ "react": "^18.0.0",
24
+ "@types/react": "^18.0.0",
25
+ "@types/react-dom": "^18.0.0",
26
+ "react-dom": "^18.0.0",
27
+ "vite": "^5.4.7"
28
+ },
7
29
  "peerDependencies": {
8
- "@types/nprogress": "^0.2.0",
9
- "@types/qs": "^6.9.7",
10
- "@types/react": "^17.x || ^18.x",
11
30
  "axios": "^1.0.0",
12
31
  "history": "5.3.0",
13
- "qs": "^6.11.0",
14
- "react": "^17.0.0 || ^18.0.0",
32
+ "qs": "^6.0.0",
33
+ "react": "^18.0.0",
15
34
  "react-toastify": "10.0.5"
16
35
  },
17
36
  "files": [
@@ -29,10 +48,6 @@
29
48
  "engines": {
30
49
  "node": ">=12.0.0"
31
50
  },
32
- "dependencies": {
33
- "camelcase-keys": "^7.0.1",
34
- "snakecase-keys": "5.1.2",
35
- "zustand": "4.3.6",
36
- "immer": "^9.0.21"
37
- }
51
+ "packageManager": "yarn@4.5.0",
52
+ "private": false
38
53
  }
@@ -1,4 +1,4 @@
1
- export declare type GetLabelType = (key: string, ...args: string[]) => string;
1
+ export type GetLabelType = (key: string, ...args: string[]) => string;
2
2
  export interface ComponentDictionary {
3
3
  [key: string]: string;
4
4
  }
package/types/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { Id, ToastOptions } from 'react-toastify';
3
3
  import type { BrowserHistory } from 'history';
4
- import { ResponseType } from 'axios';
4
+ import { AxiosProgressEvent, ResponseType } from 'axios';
5
5
  import { DomainCountry } from '../contexts';
6
6
  import { AxiosOptions } from '../utils/axiosOperation/types';
7
7
  export declare type Maybe<T> = T | undefined | null;
8
- declare type MFProps = {
8
+ type MFProps = {
9
9
  moduleId: string;
10
10
  debugPort: number;
11
11
  };
12
- export declare type EnvironmentType = {
12
+ export type EnvironmentType = {
13
13
  /**
14
14
  * "isIsolatation" Indica si la aplicacion esta ejecutando stand alone sin el host.
15
15
  * Por defecto es false.
@@ -33,7 +33,8 @@ export declare type EnvironmentType = {
33
33
  host_api_local: string;
34
34
  host_static_assets: string;
35
35
  environment_assets: string;
36
- host_api_icons?: string;
36
+ hostApiIcons?: string;
37
+ googleMapsApiKey?: string;
37
38
  };
38
39
  export declare type NetworkProps = {
39
40
  method: any;
@@ -52,7 +53,7 @@ export declare type NetworkProps = {
52
53
  isRemote?: boolean;
53
54
  toastSuccess?: boolean;
54
55
  toastError?: boolean;
55
- onDownloadProgress?: (progressEvent: any) => void;
56
+ onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
56
57
  isExternalUrl?: boolean;
57
58
  responseType?: ResponseType;
58
59
  signal?: AbortSignal;
@@ -64,7 +65,7 @@ export interface ToasterFunctionProps {
64
65
  title: ReactNode;
65
66
  description?: ReactNode;
66
67
  }
67
- export declare type Toaster = {
68
+ export type Toaster = {
68
69
  (props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
69
70
  success(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
70
71
  info(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
@@ -79,23 +80,23 @@ export declare enum EmmitEvents {
79
80
  EMMIT_EVENT_HOST_FORMATTER_CHANGE = "formatter_change",
80
81
  EMMIT_EVENT_HOST_EMERGE_WINDOW = "host_emerge_window"
81
82
  }
82
- export declare type EmptyObject = Record<string, any>;
83
- export declare type EmmitBaseGuard = {
83
+ export type EmptyObject = Record<string, any>;
84
+ export type EmmitBaseGuard = {
84
85
  [K in EmmitEvents]: any;
85
86
  };
86
87
  export interface EmmitEventsGuard extends EmmitBaseGuard {
87
88
  domain_country_change: DomainCountry;
88
89
  netsevice_unauthorized: EmptyObject;
89
90
  }
90
- export declare type EmmitFunction = <E extends keyof EmmitEventsGuard>(event: E, arg1: EmmitEventsGuard[E]) => void;
91
+ export type EmmitFunction = <E extends keyof EmmitEventsGuard>(event: E, arg1: EmmitEventsGuard[E]) => void;
91
92
  export declare type EventListenerBase = (...args: any[]) => void;
92
- export declare type EmmitListenerBaseGuard = {
93
+ export type EmmitListenerBaseGuard = {
93
94
  [K in EmmitEvents]: EventListenerBase;
94
95
  };
95
96
  export interface EmmitListenerGuard extends EmmitListenerBaseGuard {
96
97
  domain_country_change: (newDomainCountry: DomainCountry) => void;
97
98
  }
98
- export declare type EmmitEventListener = <E extends keyof EmmitListenerGuard>(event: E, handler: EmmitListenerGuard[E]) => void;
99
+ export type EmmitEventListener = <E extends keyof EmmitListenerGuard>(event: E, handler: EmmitListenerGuard[E]) => void;
99
100
  export declare interface HostToolsType {
100
101
  history: BrowserHistory;
101
102
  toast: Toaster;
@@ -2,7 +2,7 @@ import R from "axios";
2
2
  import b from "qs";
3
3
  import j from "camelcase-keys";
4
4
  import v from "snakecase-keys";
5
- import { E as h } from "../types/index-TbOJOhBX.js";
5
+ import { E as h } from "../../types/index.js";
6
6
  function x(e, t, a, i, o, s) {
7
7
  const { toast: r } = a;
8
8
  return i === "json" ? t && t.data && typeof t.data == "object" ? t.data.error && t.data.error?.code && t.data.error?.msg !== void 0 ? Promise.reject({ ...t.data.error, status: t.status }) : (t.data.message && o && r({ title: t.data.message }, { type: "success", autoClose: 1e4 }), s ? j(t.data, { deep: !0 }) : t.data) : Promise.reject({
@@ -1,8 +1,8 @@
1
- export declare type AxiosOptions = {
1
+ export type AxiosOptions = {
2
2
  startProgress?: VoidFunction;
3
3
  stopProgress?: VoidFunction;
4
4
  };
5
- export declare type AxiosOperationError = {
5
+ export type AxiosOperationError = {
6
6
  message: string;
7
7
  status: number;
8
8
  code: string | number;
@@ -0,0 +1,11 @@
1
+ function a(e, t) {
2
+ try {
3
+ const n = new Function(...Object.keys(e), `return \`${t}\``)(...Object.values(e));
4
+ return String(n).replace(/`/g, "");
5
+ } catch (r) {
6
+ return console.error(`Error evaluating expression: ${r}`), "";
7
+ }
8
+ }
9
+ export {
10
+ a as e
11
+ };
@@ -0,0 +1,11 @@
1
+ function o(r, e) {
2
+ try {
3
+ const t = window.localStorage.getItem(r);
4
+ return t !== null ? typeof e == "string" ? t : JSON.parse(t) : e;
5
+ } catch {
6
+ return e;
7
+ }
8
+ }
9
+ export {
10
+ o as g
11
+ };
@@ -1,3 +1,3 @@
1
- declare type PropertyType = string | undefined | any[] | Record<any, any>;
1
+ type PropertyType = string | undefined | any[] | Record<any, any>;
2
2
  export declare function getPropertyByString<T extends PropertyType = PropertyType>(object: any, key: string, defaultValue?: T): T;
3
3
  export {};
@@ -0,0 +1,26 @@
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
+ }
15
+ } else
16
+ return s;
17
+ } else if (e[t] !== void 0)
18
+ e = e[t];
19
+ else
20
+ return s;
21
+ }
22
+ return e;
23
+ }
24
+ export {
25
+ f as g
26
+ };
package/utils/index.js ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,16 @@
1
+ function r(e, o, a = !1) {
2
+ try {
3
+ let t = null;
4
+ if (typeof o == "string") {
5
+ window.localStorage.setItem(e, o);
6
+ return;
7
+ }
8
+ a && (t = window.localStorage.getItem(e));
9
+ let l = t !== null ? JSON.parse(t) : {};
10
+ l = { ...l, ...o }, window.localStorage.setItem(e, JSON.stringify(l));
11
+ } catch {
12
+ }
13
+ }
14
+ export {
15
+ r as s
16
+ };
@@ -0,0 +1,5 @@
1
+ function n() {
2
+ }
3
+ export {
4
+ n as v
5
+ };
package/vite-env.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /// <reference types="vite/client" />
2
- /// <reference types="vitest" />
3
- /// <reference types="vitest/globals" />
4
- /// <reference types="vitest/importMeta" />
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vitest" />
3
+ /// <reference types="vitest/globals" />
4
+ /// <reference types="vitest/importMeta" />
@@ -1,36 +0,0 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { createContext as n, useRef as f } from "react";
3
- import { createStore as i } from "zustand";
4
- import { devtools as c } from "zustand/middleware";
5
- import { i as m } from "../../node_modules-C59GSzS1.js";
6
- const g = (e) => i(
7
- c(
8
- m((r) => ({
9
- ...e,
10
- flagsActions: {
11
- clearFlags: () => {
12
- r((o) => {
13
- o.flags = [];
14
- });
15
- },
16
- addFlag: (o) => {
17
- r((t) => {
18
- const a = t.flags;
19
- a.findIndex((s) => s === o) < 0 && (t.flags = [...a, o]);
20
- });
21
- }
22
- }
23
- })),
24
- { name: "FlagsStore" }
25
- )
26
- ), u = n(null);
27
- function S({ children: e }) {
28
- const r = f();
29
- return r.current || (r.current = g({
30
- flags: []
31
- })), /* @__PURE__ */ l(u.Provider, { value: r.current, children: e });
32
- }
33
- export {
34
- u as F,
35
- S as a
36
- };
@@ -1,10 +0,0 @@
1
- import { useContext as o } from "react";
2
- import { A as e } from "../../contexts/AuthContext/index-Dmmn1GmI.js";
3
- const n = () => {
4
- const t = o(e);
5
- if (!t) throw new Error("Auth context must be use inside AuthProvider");
6
- return t;
7
- };
8
- export {
9
- n as u
10
- };
@@ -1,10 +0,0 @@
1
- import { useContext as t } from "react";
2
- import { B as o } from "../../contexts/BaseContext/index-DNyrnDVT.js";
3
- function r() {
4
- const e = t(o);
5
- if (!e) throw new Error("useBase context must be use inside BaseContext");
6
- return e;
7
- }
8
- export {
9
- r as u
10
- };
@@ -1,17 +0,0 @@
1
- import { useContext as t } from "react";
2
- import { D as n } from "../../contexts/DomainContext/index-GtnXeXqv.js";
3
- import { D as e } from "../../contexts/DomainCountryContext/index-i1cLdKpa.js";
4
- const m = () => {
5
- const o = t(n);
6
- if (!o) throw new Error("useDomain context must be use inside DomainContext");
7
- return o;
8
- }, u = () => {
9
- const o = t(e);
10
- if (!o)
11
- throw new Error("useDomainCountry context must be use inside DomainCountryContext");
12
- return o;
13
- };
14
- export {
15
- u as a,
16
- m as u
17
- };
@@ -1,10 +0,0 @@
1
- import { useContext as t } from "react";
2
- import { E as e } from "../../contexts/EnvironmentContext/index-Ba_eINub.js";
3
- const s = () => {
4
- const n = t(e);
5
- if (!n) throw new Error("useEnvironment context must be use inside EnvironmentContext");
6
- return n;
7
- };
8
- export {
9
- s as u
10
- };
@@ -1,19 +0,0 @@
1
- import { useContext as o } from "react";
2
- import { F as i } from "../../contexts/FlagsContext/index-B-2B4Igz.js";
3
- import { useStore as l } from "zustand";
4
- import { s as a } from "../../node_modules-C59GSzS1.js";
5
- function u(t, s) {
6
- const e = o(i);
7
- if (!e) throw new Error("useFlagsStore context must be use inside FlagsProvider");
8
- return l(e, t, s);
9
- }
10
- function f(t, s) {
11
- return t.filter(
12
- (r) => s.findIndex((n) => n === r) !== -1
13
- ).length === t.length;
14
- }
15
- const x = (t) => u((e) => f(t, e.flags), a);
16
- export {
17
- x as a,
18
- u
19
- };
@@ -1,10 +0,0 @@
1
- import { useContext as t } from "react";
2
- import { H as s } from "../../contexts/HostToolsContext/index-Djz-c1-2.js";
3
- const n = () => {
4
- const o = t(s);
5
- if (!o) throw new Error("useHostTools context must be use inside HostToolsContext");
6
- return o;
7
- };
8
- export {
9
- n as u
10
- };