@navservice/core 1.76.0 → 1.77.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
@@ -169,12 +169,12 @@ const _api_api = class _api {
169
169
  static resolve_base_url() {
170
170
  try {
171
171
  if ("undefined" == typeof window) throw new Error("resolveApiBaseURL must run in browser");
172
- const { hostname } = window.location;
172
+ const { origin, hostname } = window.location;
173
+ if (hostname.includes("navsoftware")) {
174
+ const apiOrigin = origin.replace(/^https?:\/\/app/, (match)=>match.replace("app", "api"));
175
+ return apiOrigin;
176
+ }
173
177
  const apiOverride = utils_environment.get;
174
- const isNavSoftware = hostname.includes("navsoftware");
175
- const isSandbox = hostname.includes("sandbox");
176
- if (isNavSoftware && isSandbox) return "https://api-sandbox.navsoftware.com.br";
177
- if (isNavSoftware) return "https://api.navsoftware.com.br";
178
178
  if ("SANDBOX" === apiOverride) return "https://api-sandbox.navsoftware.com.br";
179
179
  if ("PRODUCAO" === apiOverride) return "https://api.navsoftware.com.br";
180
180
  if ("LOCALHOST" === apiOverride) return "http://localhost:8787";
@@ -256,16 +256,12 @@ const _api_api = class _api {
256
256
  if (typeof window === "undefined") {
257
257
  throw new Error("resolveApiBaseURL must run in browser");
258
258
  }
259
- const { hostname } = window.location;
260
- const apiOverride = utils_environment.get;
261
- const isNavSoftware = hostname.includes("navsoftware");
262
- const isSandbox = hostname.includes("sandbox");
263
- if (isNavSoftware && isSandbox) {
264
- return "https://api-sandbox.navsoftware.com.br";
265
- }
266
- if (isNavSoftware) {
267
- return "https://api.navsoftware.com.br";
259
+ const { origin, hostname } = window.location;
260
+ if (hostname.includes("navsoftware")) {
261
+ const apiOrigin = origin.replace(/^https?:\/\/app/, (match)=>match.replace("app", "api"));
262
+ return apiOrigin;
268
263
  }
264
+ const apiOverride = utils_environment.get;
269
265
  if (apiOverride === "SANDBOX") {
270
266
  return "https://api-sandbox.navsoftware.com.br";
271
267
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/core",
3
- "version": "1.76.0",
3
+ "version": "1.77.0",
4
4
  "description": "Service core de todos os micro serviços",
5
5
  "type": "module",
6
6
  "exports": {