@orbe-agro/client-core 5.3.168 → 5.3.169

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.
@@ -1,6 +1,3 @@
1
- /**
2
- * @desc Endereço atual da API.
3
- **/
4
1
  export declare const API_URL: string;
5
2
  export declare const GOOGLE_MAP_API_KEY: any;
6
3
  export declare const GOOGLE_MAP_MAP_ID: any;
@@ -1 +1 @@
1
- {"version":3,"file":"api.config.d.ts","sourceRoot":"","sources":["../../../../lib/base/configs/api.config.ts"],"names":[],"mappings":"AAiCA;;IAEI;AAEJ,eAAO,MAAM,OAAO,QAAgK,CAAA;AAEpL,eAAO,MAAM,kBAAkB,KAA8C,CAAA;AAC7E,eAAO,MAAM,iBAAiB,KAA6C,CAAA;AAE3E,QAAA,MAAM,SAAS;;;;;;;CAOd,CAAA;AAED,eAAe,SAAS,CAAA"}
1
+ {"version":3,"file":"api.config.d.ts","sourceRoot":"","sources":["../../../../lib/base/configs/api.config.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,OAAO,QAAc,CAAA;AAElC,eAAO,MAAM,kBAAkB,KAA8C,CAAA;AAC7E,eAAO,MAAM,iBAAiB,KAA6C,CAAA;AAE3E,QAAA,MAAM,SAAS;;;;;;;CAOd,CAAA;AAED,eAAe,SAAS,CAAA"}
@@ -1,15 +1,20 @@
1
- const n = "production", t = "http://localhost:8081", o = "http://172.16.14.27:30001", e = n === "development" || !o ? t : window?.location?.origin?.replace(":5173", ":8081").replace(":31000", ":30001") ?? o, c = void 0, _ = void 0, i = {
2
- API_URL: e,
1
+ const t = "production", i = "http://localhost:8081", o = "http://172.16.14.27:30001", e = () => {
2
+ if (t === "development" || !o)
3
+ return i;
4
+ const n = globalThis?.location?.origin;
5
+ return n && (n.includes(":5173") || n.includes(":31000")) ? n.replace(":5173", ":8081").replace(":31000", ":30001") ?? o : "https://gateway.apps.prd.orbeagro.com.br";
6
+ }, r = e(), c = void 0, s = void 0, p = {
7
+ API_URL: r,
3
8
  GOOGLE_MAP_API_KEY: c,
4
- GOOGLE_MAP_MAP_ID: _,
5
- NODE_ENV: n,
6
- DEV_API_URL: t,
9
+ GOOGLE_MAP_MAP_ID: s,
10
+ NODE_ENV: t,
11
+ DEV_API_URL: i,
7
12
  BUILD_API_URL: o
8
13
  };
9
14
  export {
10
- e as API_URL,
15
+ r as API_URL,
11
16
  c as GOOGLE_MAP_API_KEY,
12
- _ as GOOGLE_MAP_MAP_ID,
13
- i as default
17
+ s as GOOGLE_MAP_MAP_ID,
18
+ p as default
14
19
  };
15
20
  //# sourceMappingURL=api.config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.config.js","sources":["../../../lib/base/configs/api.config.ts"],"sourcesContent":["/**\n * @desc Ambiente atual.\n *\n * \"development\" -> iniciado com \"yarn start\".\n *\n * \"production\" -> versão gerado com \"yarn build\".\n **/\nconst NODE_ENV = import.meta.env.MODE\n\n/**\n * @desc Endereço da API usado em modo de desenvolvimento, quando rodando a aplicação com \"yarn start\".\n *\n * @see http://localhost:8080/api (LOCAL)\n *\n * @see http://172.16.14.27:30001/api (QAS)\n *\n * */\n\nconst DEV_API_URL = 'http://localhost:8081'\n\n/**\n * @desc Endereço da API usado em versão de produção.\n *\n * VITE_APP_API_URL é definido no arquivo \".env.development\" e \".env.production\".\n *\n * Ambiente \".env.development\" é usado com o comando \"yarn build:dev\".\n *\n * Ambiente \".env.production\" é usado com o comando \"yarn build:prod\".\n *\n * Os ambientes sobrescrevem qualquer outro ambiente e as variáveis carregadas neles.\n **/\nconst BUILD_API_URL = import.meta.env.VITE_APP_API_URL\n\n/**\n * @desc Endereço atual da API.\n **/\n\nexport const API_URL = NODE_ENV === 'development' || !BUILD_API_URL ? DEV_API_URL : window?.location?.origin?.replace(':5173', ':8081').replace(':31000', ':30001') ?? BUILD_API_URL\n\nexport const GOOGLE_MAP_API_KEY = import.meta.env.VITE_APP_GOOGLE_MAP_API_KEY\nexport const GOOGLE_MAP_MAP_ID = import.meta.env.VITE_APP_GOOGLE_MAP_MAP_ID\n\nconst apiConfig = {\n API_URL,\n GOOGLE_MAP_API_KEY,\n GOOGLE_MAP_MAP_ID,\n NODE_ENV,\n DEV_API_URL,\n BUILD_API_URL,\n}\n\nexport default apiConfig\n"],"names":["NODE_ENV","DEV_API_URL","BUILD_API_URL","API_URL","GOOGLE_MAP_API_KEY","GOOGLE_MAP_MAP_ID","apiConfig"],"mappings":"AAOA,MAAMA,IAAW,cAWXC,IAAc,yBAadC,IAAgB,6BAMTC,IAAUH,MAAa,iBAAiB,CAACE,IAAgBD,IAAc,QAAQ,UAAU,QAAQ,QAAQ,SAAS,OAAO,EAAE,QAAQ,UAAU,QAAQ,KAAKC,GAE1JE,IAAqB,QACrBC,IAAoB,QAE3BC,IAAY;AAAA,EACd,SAAAH;AAAA,EACA,oBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,UAAAL;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AACJ;"}
1
+ {"version":3,"file":"api.config.js","sources":["../../../lib/base/configs/api.config.ts"],"sourcesContent":["/**\n * @desc Ambiente atual.\n *\n * \"development\" -> iniciado com \"yarn start\".\n *\n * \"production\" -> versão gerado com \"yarn build\".\n **/\nconst NODE_ENV = import.meta.env.MODE\n\n/**\n * @desc Endereço da API usado em modo de desenvolvimento, quando rodando a aplicação com \"yarn start\".\n *\n * @see http://localhost:8080/api (LOCAL)\n *\n * @see http://172.16.14.27:30001/api (QAS)\n *\n * */\n\nconst DEV_API_URL = 'http://localhost:8081'\n\n/**\n * @desc Endereço da API usado em versão de produção.\n *\n * VITE_APP_API_URL é definido no arquivo \".env.development\" e \".env.production\".\n *\n * Ambiente \".env.development\" é usado com o comando \"yarn build:dev\".\n *\n * Ambiente \".env.production\" é usado com o comando \"yarn build:prod\".\n *\n * Os ambientes sobrescrevem qualquer outro ambiente e as variáveis carregadas neles.\n **/\nconst BUILD_API_URL = import.meta.env.VITE_APP_API_URL\n\n/**\n * @desc Endereço atual da API.\n **/\n\nconst getApiUrl = (): string => {\n if (NODE_ENV === 'development' || !BUILD_API_URL) {\n return DEV_API_URL\n }\n \n const origin = globalThis?.location?.origin\n if (origin && (origin.includes(':5173') || origin.includes(':31000'))) {\n const modifiedOrigin = origin.replace(':5173', ':8081').replace(':31000', ':30001')\n return modifiedOrigin ?? BUILD_API_URL\n }\n \n return 'https://gateway.apps.prd.orbeagro.com.br'\n}\n\nexport const API_URL = getApiUrl()\n\nexport const GOOGLE_MAP_API_KEY = import.meta.env.VITE_APP_GOOGLE_MAP_API_KEY\nexport const GOOGLE_MAP_MAP_ID = import.meta.env.VITE_APP_GOOGLE_MAP_MAP_ID\n\nconst apiConfig = {\n API_URL,\n GOOGLE_MAP_API_KEY,\n GOOGLE_MAP_MAP_ID,\n NODE_ENV,\n DEV_API_URL,\n BUILD_API_URL,\n}\n\nexport default apiConfig\n"],"names":["NODE_ENV","DEV_API_URL","BUILD_API_URL","getApiUrl","origin","API_URL","GOOGLE_MAP_API_KEY","GOOGLE_MAP_MAP_ID","apiConfig"],"mappings":"AAOA,MAAMA,IAAW,cAWXC,IAAc,yBAadC,IAAgB,6BAMhBC,IAAY,MAAc;AACxB,MAAAH,MAAa,iBAAiB,CAACE;AACxB,WAAAD;AAGL,QAAAG,IAAS,YAAY,UAAU;AACjC,SAAAA,MAAWA,EAAO,SAAS,OAAO,KAAKA,EAAO,SAAS,QAAQ,KACxCA,EAAO,QAAQ,SAAS,OAAO,EAAE,QAAQ,UAAU,QAAQ,KACzDF,IAGtB;AACX,GAEaG,IAAUF,EAAU,GAEpBG,IAAqB,QACrBC,IAAoB,QAE3BC,IAAY;AAAA,EACd,SAAAH;AAAA,EACA,oBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,UAAAP;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AACJ;"}
@@ -35,7 +35,21 @@ const BUILD_API_URL = import.meta.env.VITE_APP_API_URL
35
35
  * @desc Endereço atual da API.
36
36
  **/
37
37
 
38
- export const API_URL = NODE_ENV === 'development' || !BUILD_API_URL ? DEV_API_URL : window?.location?.origin?.replace(':5173', ':8081').replace(':31000', ':30001') ?? BUILD_API_URL
38
+ const getApiUrl = (): string => {
39
+ if (NODE_ENV === 'development' || !BUILD_API_URL) {
40
+ return DEV_API_URL
41
+ }
42
+
43
+ const origin = globalThis?.location?.origin
44
+ if (origin && (origin.includes(':5173') || origin.includes(':31000'))) {
45
+ const modifiedOrigin = origin.replace(':5173', ':8081').replace(':31000', ':30001')
46
+ return modifiedOrigin ?? BUILD_API_URL
47
+ }
48
+
49
+ return 'https://gateway.apps.prd.orbeagro.com.br'
50
+ }
51
+
52
+ export const API_URL = getApiUrl()
39
53
 
40
54
  export const GOOGLE_MAP_API_KEY = import.meta.env.VITE_APP_GOOGLE_MAP_API_KEY
41
55
  export const GOOGLE_MAP_MAP_ID = import.meta.env.VITE_APP_GOOGLE_MAP_MAP_ID
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbe-agro/client-core",
3
- "version": "5.3.168",
3
+ "version": "5.3.169",
4
4
  "description": "Biblioteca principal de componentes e utilidades para os microfrontends do Orbe Agro.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",