@devtron-labs/devtron-fe-common-lib 0.0.48 → 0.0.49

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,5 +1,5 @@
1
1
  import { RegistryTypeDetailType } from "./Types";
2
- export declare const RequestTimeout = 60000;
2
+ export declare const FALLBACK_REQUEST_TIMEOUT = 60000;
3
3
  export declare const Host: string;
4
4
  export declare const DOCUMENTATION_HOME_PAGE = "https://docs.devtron.ai";
5
5
  export declare const DOCUMENTATION: {
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ function _interopNamespaceDefault(e) {
27
27
 
28
28
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
29
29
 
30
- var RequestTimeout = 60000;
30
+ var FALLBACK_REQUEST_TIMEOUT = 60000;
31
31
  var Host = process.env.REACT_APP_ORCHESTRATOR_ROOT;
32
32
  var DOCUMENTATION_HOME_PAGE = 'https://docs.devtron.ai';
33
33
  var DOCUMENTATION = {
@@ -671,7 +671,9 @@ function fetchInTime(url, type, data, options, isMultipartRequest) {
671
671
  var controller = new AbortController();
672
672
  var signal = controller.signal;
673
673
  var timeoutPromise = new Promise(function (resolve, reject) {
674
- var timeout = (options === null || options === void 0 ? void 0 : options.timeout) ? options.timeout : RequestTimeout;
674
+ var _a, _b;
675
+ var requestTimeout = (_b = (_a = window === null || window === void 0 ? void 0 : window._env_) === null || _a === void 0 ? void 0 : _a.GLOBAL_API_TIMEOUT) !== null && _b !== void 0 ? _b : FALLBACK_REQUEST_TIMEOUT;
676
+ var timeout = (options === null || options === void 0 ? void 0 : options.timeout) ? options.timeout : requestTimeout;
675
677
  setTimeout(function () {
676
678
  controller.abort();
677
679
  reject({
@@ -26775,6 +26777,7 @@ exports.ERROR_EMPTY_SCREEN = ERROR_EMPTY_SCREEN;
26775
26777
  exports.EmptyState = EmptyState;
26776
26778
  exports.ErrorScreenManager = ErrorScreenManager;
26777
26779
  exports.ErrorScreenNotAuthorized = ErrorScreenNotAuthorized;
26780
+ exports.FALLBACK_REQUEST_TIMEOUT = FALLBACK_REQUEST_TIMEOUT;
26778
26781
  exports.ForceDeleteDialog = ForceDeleteDialog;
26779
26782
  exports.GenericEmptyState = GenericEmptyState;
26780
26783
  exports.Grid = Grid;
@@ -26799,7 +26802,6 @@ exports.RadioGroup = RadioGroup$1;
26799
26802
  exports.RadioGroupItem = RadioGroupItem;
26800
26803
  exports.Reload = Reload;
26801
26804
  exports.RepositoryAction = RepositoryAction;
26802
- exports.RequestTimeout = RequestTimeout;
26803
26805
  exports.ResizableTagTextArea = ResizableTagTextArea;
26804
26806
  exports.ResizableTextarea = ResizableTextarea;
26805
26807
  exports.ScanVulnerabilitiesTable = ScanVulnerabilitiesTable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/Common/Api.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ServerErrors } from './ServerError'
2
- import { RequestTimeout, Host, URLS } from './Constants'
2
+ import { FALLBACK_REQUEST_TIMEOUT, Host, URLS } from './Constants'
3
3
  import { ResponseType, APIOptions } from './Types'
4
4
 
5
5
  const responseMessages = {
@@ -176,7 +176,9 @@ function fetchInTime(
176
176
  const controller = new AbortController()
177
177
  const { signal } = controller
178
178
  const timeoutPromise: Promise<ResponseType> = new Promise((resolve, reject) => {
179
- let timeout = options?.timeout ? options.timeout : RequestTimeout
179
+ const requestTimeout = (window as any)?._env_?.GLOBAL_API_TIMEOUT ?? FALLBACK_REQUEST_TIMEOUT
180
+ const timeout = options?.timeout ? options.timeout : requestTimeout
181
+
180
182
  setTimeout(() => {
181
183
  controller.abort()
182
184
  reject({
@@ -1,6 +1,6 @@
1
1
  import { RegistryTypeDetailType } from "./Types"
2
2
 
3
- export const RequestTimeout = 60000
3
+ export const FALLBACK_REQUEST_TIMEOUT = 60000
4
4
  export const Host = process.env.REACT_APP_ORCHESTRATOR_ROOT
5
5
 
6
6
  export const DOCUMENTATION_HOME_PAGE = 'https://docs.devtron.ai'