@navservice/core 1.70.0 → 1.71.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.
package/build/es/index.js CHANGED
@@ -160,6 +160,10 @@ const _api_api = class _api {
160
160
  static resolve_base_url() {
161
161
  if ("undefined" == typeof window) throw new Error("resolveApiBaseURL must run in browser");
162
162
  const { hostname } = window.location;
163
+ const apiOverride = window.sessionStorage.get("API_TARGET");
164
+ if ("sandbox" === apiOverride) return "https://api-sandbox.navsoftware.com.br";
165
+ if ("prod" === apiOverride) return "https://api.navsoftware.com.br";
166
+ if ("local" === apiOverride) return "http://localhost:8787";
163
167
  if ("localhost" === hostname || hostname.startsWith("localhost")) return "http://localhost:8787";
164
168
  const isNavSoftware = hostname.includes("navsoftware");
165
169
  const isSandbox = hostname.includes("sandbox");
@@ -624,6 +628,15 @@ class _hooks {
624
628
  }
625
629
  }
626
630
  const utils_hooks = new _hooks;
631
+ const _environment = class {
632
+ static set(props) {
633
+ window.sessionStorage.setItem("ENVIRONMENT", props);
634
+ }
635
+ static get get() {
636
+ return window.sessionStorage.get("ENVIRONMENT");
637
+ }
638
+ };
639
+ const utils_environment = _environment;
627
640
  const utils = {
628
641
  api: utils_api,
629
642
  data: utils_data,
@@ -633,7 +646,8 @@ const utils = {
633
646
  update_context: utils_update_context,
634
647
  session_sorage: utils_session_storage,
635
648
  sistema: utils_sistema,
636
- hooks: utils_hooks
649
+ hooks: utils_hooks,
650
+ environment: utils_environment
637
651
  };
638
652
  const src_utils = utils;
639
653
  export { types as TypesCore, src_utils as utils };
@@ -0,0 +1,6 @@
1
+ declare const _environment: {
2
+ new (): {};
3
+ set(props: "LOCALHOST" | "PRODUCAO" | "SANDBOX"): void;
4
+ get get(): any;
5
+ };
6
+ export default _environment;
@@ -153,5 +153,10 @@ declare const utils: {
153
153
  use_is_mobile(): boolean;
154
154
  use_dark_mode(): void;
155
155
  };
156
+ environment: {
157
+ new (): {};
158
+ set(props: "LOCALHOST" | "PRODUCAO" | "SANDBOX"): void;
159
+ get get(): any;
160
+ };
156
161
  };
157
162
  export default utils;
@@ -239,6 +239,16 @@ const _api_api = class _api {
239
239
  throw new Error("resolveApiBaseURL must run in browser");
240
240
  }
241
241
  const { hostname } = window.location;
242
+ const apiOverride = window.sessionStorage.get("API_TARGET");
243
+ if (apiOverride === "sandbox") {
244
+ return "https://api-sandbox.navsoftware.com.br";
245
+ }
246
+ if (apiOverride === "prod") {
247
+ return "https://api.navsoftware.com.br";
248
+ }
249
+ if (apiOverride === "local") {
250
+ return "http://localhost:8787";
251
+ }
242
252
  if (hostname === "localhost" || hostname.startsWith("localhost")) {
243
253
  return "http://localhost:8787";
244
254
  }
@@ -802,6 +812,22 @@ class _hooks {
802
812
  }
803
813
  /* export default */ const utils_hooks = (new _hooks);
804
814
 
815
+ ;// CONCATENATED MODULE: ./src/utils/_environment.ts
816
+ //BIBLIOTECAS
817
+ //HELPERS
818
+ //BANCO DE DADOS
819
+ //SERVICES
820
+ const _environment = class _environment {
821
+ static set(props) {
822
+ window.sessionStorage.setItem("ENVIRONMENT", props);
823
+ return;
824
+ }
825
+ static get get() {
826
+ return window.sessionStorage.get("ENVIRONMENT");
827
+ }
828
+ };
829
+ /* export default */ const utils_environment = (_environment);
830
+
805
831
  ;// CONCATENATED MODULE: ./src/utils/index.ts
806
832
 
807
833
 
@@ -812,6 +838,7 @@ class _hooks {
812
838
 
813
839
 
814
840
 
841
+
815
842
  const utils = {
816
843
  api: utils_api,
817
844
  data: utils_data,
@@ -821,7 +848,8 @@ const utils = {
821
848
  update_context: utils_update_context,
822
849
  session_sorage: utils_session_storage,
823
850
  sistema: utils_sistema,
824
- hooks: utils_hooks
851
+ hooks: utils_hooks,
852
+ environment: utils_environment
825
853
  };
826
854
  /* export default */ const src_utils = (utils);
827
855
 
@@ -0,0 +1,6 @@
1
+ declare const _environment: {
2
+ new (): {};
3
+ set(props: "LOCALHOST" | "PRODUCAO" | "SANDBOX"): void;
4
+ get get(): any;
5
+ };
6
+ export default _environment;
@@ -153,5 +153,10 @@ declare const utils: {
153
153
  use_is_mobile(): boolean;
154
154
  use_dark_mode(): void;
155
155
  };
156
+ environment: {
157
+ new (): {};
158
+ set(props: "LOCALHOST" | "PRODUCAO" | "SANDBOX"): void;
159
+ get get(): any;
160
+ };
156
161
  };
157
162
  export default utils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/core",
3
- "version": "1.70.0",
3
+ "version": "1.71.0",
4
4
  "description": "Service core de todos os micro serviços",
5
5
  "type": "module",
6
6
  "exports": {