@devtron-labs/devtron-fe-common-lib 0.0.40-beta-1 → 0.0.40-beta-3

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.
@@ -52,4 +52,11 @@ export declare const closeOnEscKeyPressed: (e: any, actionClose: () => void) =>
52
52
  export declare function copyToClipboard(str: any, callback?: typeof noop): void;
53
53
  export declare function useAsync<T>(func: (...rest: any[]) => Promise<T>, dependencyArray?: any[], shouldRun?: boolean, options?: AsyncOptions): [boolean, T, any | null, () => void, React.Dispatch<any>, any[]];
54
54
  export declare const processDeployedTime: (lastDeployed: any, isArgoInstalled: any) => string;
55
+ /**
56
+ * Appends search parameters to the url as a query string
57
+ *
58
+ * @param url URL to which the search params needs to be added
59
+ * @param params Object for the search parameters
60
+ */
61
+ export declare const getUrlWithSearchParams: (url: string, params: Record<string | number, any>) => string;
55
62
  export {};
package/dist/index.js CHANGED
@@ -10250,6 +10250,22 @@ var processDeployedTime = function (lastDeployed, isArgoInstalled) {
10250
10250
  else {
10251
10251
  return isArgoInstalled ? '' : 'Not deployed';
10252
10252
  }
10253
+ };
10254
+ /**
10255
+ * Appends search parameters to the url as a query string
10256
+ *
10257
+ * @param url URL to which the search params needs to be added
10258
+ * @param params Object for the search parameters
10259
+ */
10260
+ var getUrlWithSearchParams = function (url, params) {
10261
+ var searchParams = new URLSearchParams();
10262
+ Object.keys(params).forEach(function (key) {
10263
+ if (params[key]) {
10264
+ searchParams.append(key, params[key]);
10265
+ }
10266
+ });
10267
+ var queryString = searchParams.toString();
10268
+ return url + (queryString ? "?".concat(queryString) : '');
10253
10269
  };
10254
10270
 
10255
10271
  function Progressing(_a) {
@@ -24154,6 +24170,7 @@ exports.getEmptyArrayOfLength = getEmptyArrayOfLength;
24154
24170
  exports.getLoginInfo = getLoginInfo;
24155
24171
  exports.getRandomColor = getRandomColor;
24156
24172
  exports.getTeamListMin = getTeamListMin;
24173
+ exports.getUrlWithSearchParams = getUrlWithSearchParams;
24157
24174
  exports.getUserRole = getUserRole;
24158
24175
  exports.handleUTCTime = handleUTCTime;
24159
24176
  exports.multiSelectStyles = multiSelectStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.40-beta-1",
3
+ "version": "0.0.40-beta-3",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -495,3 +495,20 @@ export const processDeployedTime = (lastDeployed, isArgoInstalled) => {
495
495
  return isArgoInstalled ? '' : 'Not deployed'
496
496
  }
497
497
  }
498
+
499
+ /**
500
+ * Appends search parameters to the url as a query string
501
+ *
502
+ * @param url URL to which the search params needs to be added
503
+ * @param params Object for the search parameters
504
+ */
505
+ export const getUrlWithSearchParams = (url: string, params: Record<string | number, any>) => {
506
+ const searchParams = new URLSearchParams()
507
+ Object.keys(params).forEach((key) => {
508
+ if (params[key]) {
509
+ searchParams.append(key, params[key])
510
+ }
511
+ })
512
+ const queryString = searchParams.toString()
513
+ return url + (queryString ? `?${queryString}` : '')
514
+ }