@gen3/frontend 0.11.24 → 0.11.26
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/dist/cjs/index.js +221 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/dts/components/Buttons/index.d.ts +1 -0
- package/dist/dts/components/Buttons/index.d.ts.map +1 -1
- package/dist/dts/components/Buttons/index.js +1 -0
- package/dist/dts/components/Buttons/index.js.map +1 -1
- package/dist/dts/components/Providers/Gen3Provider.d.ts +8 -8
- package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +14 -14
- package/dist/dts/features/CohortDiscovery/queryApi.d.ts +3 -3
- package/dist/dts/features/CohortDiscovery/queryApi.d.ts.map +1 -1
- package/dist/dts/features/CohortDiscovery/queryApi.js +1 -1
- package/dist/dts/features/CohortDiscovery/queryApi.js.map +1 -1
- package/dist/esm/index.js +222 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -2,5 +2,6 @@ import ActionButton from './ActionButton';
|
|
|
2
2
|
import UploadJSONButton from './UploadJSONButton';
|
|
3
3
|
import { DropdownButton } from './DropdownButtons';
|
|
4
4
|
import { Gen3Button, Gen3ButtonReverse } from './Gen3Button';
|
|
5
|
+
export * from './DownloadButtons';
|
|
5
6
|
export { ActionButton, UploadJSONButton, DropdownButton, Gen3Button, Gen3ButtonReverse, };
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Buttons/index.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Buttons/index.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE7D,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,iBAAiB,GAClB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import ActionButton from './ActionButton';
|
|
|
3
3
|
import UploadJSONButton from './UploadJSONButton';
|
|
4
4
|
import { DropdownButton } from './DropdownButtons';
|
|
5
5
|
import { Gen3Button, Gen3ButtonReverse } from './Gen3Button';
|
|
6
|
+
export * from './DownloadButtons';
|
|
6
7
|
// Export all imported components
|
|
7
8
|
export { ActionButton, UploadJSONButton, DropdownButton, Gen3Button, Gen3ButtonReverse, };
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Buttons/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE7D,iCAAiC;AACjC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,iBAAiB,GAClB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Buttons/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE7D,cAAc,mBAAmB,CAAC;AAElC,iCAAiC;AACjC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,iBAAiB,GAClB,CAAC"}
|
|
@@ -45,7 +45,7 @@ export declare const createMantineTheme: (fonts: Fonts, colors: Record<string, T
|
|
|
45
45
|
headings?: {
|
|
46
46
|
fontFamily?: string | undefined;
|
|
47
47
|
fontWeight?: string | undefined;
|
|
48
|
-
textWrap?: "wrap" | "
|
|
48
|
+
textWrap?: "wrap" | "balance" | "nowrap" | "pretty" | "stable" | undefined;
|
|
49
49
|
sizes?: {
|
|
50
50
|
h1?: {
|
|
51
51
|
fontSize?: string | undefined;
|
|
@@ -82,8 +82,8 @@ export declare const createMantineTheme: (fonts: Fonts, colors: Record<string, T
|
|
|
82
82
|
radius?: {
|
|
83
83
|
[x: string & {}]: string | undefined;
|
|
84
84
|
sm?: string | undefined;
|
|
85
|
-
md?: string | undefined;
|
|
86
85
|
xs?: string | undefined;
|
|
86
|
+
md?: string | undefined;
|
|
87
87
|
lg?: string | undefined;
|
|
88
88
|
xl?: string | undefined;
|
|
89
89
|
} | undefined;
|
|
@@ -92,45 +92,45 @@ export declare const createMantineTheme: (fonts: Fonts, colors: Record<string, T
|
|
|
92
92
|
[x: number]: string | undefined;
|
|
93
93
|
[x: string & {}]: string | undefined;
|
|
94
94
|
sm?: string | undefined;
|
|
95
|
-
md?: string | undefined;
|
|
96
95
|
xs?: string | undefined;
|
|
96
|
+
md?: string | undefined;
|
|
97
97
|
lg?: string | undefined;
|
|
98
98
|
xl?: string | undefined;
|
|
99
99
|
} | undefined;
|
|
100
100
|
fontSizes?: {
|
|
101
101
|
[x: string & {}]: string | undefined;
|
|
102
102
|
sm?: string | undefined;
|
|
103
|
-
md?: string | undefined;
|
|
104
103
|
xs?: string | undefined;
|
|
104
|
+
md?: string | undefined;
|
|
105
105
|
lg?: string | undefined;
|
|
106
106
|
xl?: string | undefined;
|
|
107
107
|
} | undefined;
|
|
108
108
|
lineHeights?: {
|
|
109
109
|
[x: string & {}]: string | undefined;
|
|
110
110
|
sm?: string | undefined;
|
|
111
|
-
md?: string | undefined;
|
|
112
111
|
xs?: string | undefined;
|
|
112
|
+
md?: string | undefined;
|
|
113
113
|
lg?: string | undefined;
|
|
114
114
|
xl?: string | undefined;
|
|
115
115
|
} | undefined;
|
|
116
116
|
breakpoints?: {
|
|
117
117
|
[x: string & {}]: string | undefined;
|
|
118
118
|
sm?: string | undefined;
|
|
119
|
-
md?: string | undefined;
|
|
120
119
|
xs?: string | undefined;
|
|
120
|
+
md?: string | undefined;
|
|
121
121
|
lg?: string | undefined;
|
|
122
122
|
xl?: string | undefined;
|
|
123
123
|
} | undefined;
|
|
124
124
|
shadows?: {
|
|
125
125
|
[x: string & {}]: string | undefined;
|
|
126
126
|
sm?: string | undefined;
|
|
127
|
-
md?: string | undefined;
|
|
128
127
|
xs?: string | undefined;
|
|
128
|
+
md?: string | undefined;
|
|
129
129
|
lg?: string | undefined;
|
|
130
130
|
xl?: string | undefined;
|
|
131
131
|
} | undefined;
|
|
132
132
|
respectReducedMotion?: boolean | undefined;
|
|
133
|
-
cursorType?: "
|
|
133
|
+
cursorType?: "default" | "pointer" | undefined;
|
|
134
134
|
defaultGradient?: {
|
|
135
135
|
from?: string | undefined;
|
|
136
136
|
to?: string | undefined;
|
|
@@ -2,44 +2,44 @@ import React from 'react';
|
|
|
2
2
|
import type { StoryObj } from '@storybook/react';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
component: React.FC<{
|
|
5
|
-
title: string;
|
|
6
|
-
icon: string | React.ReactElement;
|
|
7
5
|
type: string;
|
|
8
6
|
description: string;
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
title: string;
|
|
8
|
+
count?: number | undefined;
|
|
11
9
|
href: string;
|
|
10
|
+
icon: string | React.ReactElement;
|
|
11
|
+
tags?: Array<string> | undefined;
|
|
12
|
+
loginRequired: boolean;
|
|
13
|
+
hasDemo?: boolean | undefined;
|
|
14
|
+
btnText?: string | undefined;
|
|
12
15
|
appId?: string | undefined;
|
|
13
16
|
componentName?: string | undefined;
|
|
14
|
-
count?: number | undefined;
|
|
15
17
|
countFunction?: (() => string) | undefined;
|
|
16
18
|
countIndex?: string | undefined;
|
|
17
19
|
countUnits?: string | undefined;
|
|
18
20
|
noDataTooltip?: string | undefined;
|
|
19
21
|
cardType?: "regular" | "compact" | undefined;
|
|
20
|
-
btnText?: string | undefined;
|
|
21
|
-
tags?: Array<string> | undefined;
|
|
22
22
|
readonly rightComponent?: React.FC | undefined;
|
|
23
23
|
readonly selectionScreen?: React.FC | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
decorators: ((Story: import("@storybook/core/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
26
|
-
title: string;
|
|
27
|
-
icon: string | React.ReactElement;
|
|
28
26
|
type: string;
|
|
29
27
|
description: string;
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
title: string;
|
|
29
|
+
count?: number | undefined;
|
|
32
30
|
href: string;
|
|
31
|
+
icon: string | React.ReactElement;
|
|
32
|
+
tags?: Array<string> | undefined;
|
|
33
|
+
loginRequired: boolean;
|
|
34
|
+
hasDemo?: boolean | undefined;
|
|
35
|
+
btnText?: string | undefined;
|
|
33
36
|
appId?: string | undefined;
|
|
34
37
|
componentName?: string | undefined;
|
|
35
|
-
count?: number | undefined;
|
|
36
38
|
countFunction?: (() => string) | undefined;
|
|
37
39
|
countIndex?: string | undefined;
|
|
38
40
|
countUnits?: string | undefined;
|
|
39
41
|
noDataTooltip?: string | undefined;
|
|
40
42
|
cardType?: "regular" | "compact" | undefined;
|
|
41
|
-
btnText?: string | undefined;
|
|
42
|
-
tags?: Array<string> | undefined;
|
|
43
43
|
readonly rightComponent?: React.FC | undefined;
|
|
44
44
|
readonly selectionScreen?: React.FC | undefined;
|
|
45
45
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accessibility,
|
|
1
|
+
import { Accessibility, AggregationsData, FilterSet, GuppyAggregationsResponse } from '@gen3/core';
|
|
2
2
|
interface ErrorDetails {
|
|
3
3
|
status: string;
|
|
4
4
|
message: string;
|
|
@@ -22,7 +22,7 @@ interface QueryOptions {
|
|
|
22
22
|
skip?: boolean;
|
|
23
23
|
}
|
|
24
24
|
export declare const useRoundedAggsQuery: ({ type, fields, filters, accessibility }: QueryAggsParams, { skip }?: QueryOptions) => {
|
|
25
|
-
data: import("@gen3/core").
|
|
25
|
+
data: AggregationsData | import("@gen3/core").StatsData;
|
|
26
26
|
isLoading: boolean;
|
|
27
27
|
isSuccess: boolean;
|
|
28
28
|
isError: boolean;
|
|
@@ -32,7 +32,7 @@ export declare const useRoundedAggsQuery: ({ type, fields, filters, accessibilit
|
|
|
32
32
|
}>;
|
|
33
33
|
};
|
|
34
34
|
export declare const useUnsecureRoundedAggsQuery: ({ type, fields, filters, accessibility }: QueryAggsParams, { skip }?: QueryOptions) => {
|
|
35
|
-
data:
|
|
35
|
+
data: AggregationsData;
|
|
36
36
|
isLoading: boolean;
|
|
37
37
|
isSuccess: boolean;
|
|
38
38
|
isError: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryApi.d.ts","sourceRoot":"","sources":["../../../../src/features/CohortDiscovery/queryApi.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"queryApi.d.ts","sourceRoot":"","sources":["../../../../src/features/CohortDiscovery/queryApi.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,gBAAgB,EAGhB,SAAS,EAGT,yBAAyB,EAK1B,MAAM,YAAY,CAAC;AAIpB,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,GAAI,SAAS,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO,EACjE,KAAK,MAAM,EACX,MAAM,KAAK,EACX,OAAO,OAAO;;;;;;;CA8Df,CAAC;AAEF,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,SAAS,CAAC;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,mBAAmB,GAC9B,0CAA8D,eAAe,EAC7E,WAAU,YAA8B;;;;;;;cAG9B,yBAAyB;;CAcpC,CAAC;AAOF,eAAO,MAAM,2BAA2B,GACtC,0CAA8D,eAAe,EAC7E,WAAU,YAA8B;;;;;;;cAG9B,yBAAyB;;CAsBpC,CAAC"}
|
|
@@ -46,7 +46,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
import useSWR from 'swr';
|
|
49
|
-
import { Accessibility, buildGetAggregationQuery, processHistogramResponse, roundHistogramResponse,
|
|
49
|
+
import { Accessibility, buildGetAggregationQuery, GEN3_GUPPY_API, processHistogramResponse, roundHistogramResponse, selectCSRFToken, useCoreSelector, } from '@gen3/core';
|
|
50
50
|
import { getCookie } from 'cookies-next';
|
|
51
51
|
import { GEN3_COHORT_DISCOVERY_API } from './constants';
|
|
52
52
|
export var useGraphQLData = function (url, body, skip) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryApi.js","sourceRoot":"","sources":["../../../../src/features/CohortDiscovery/queryApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,MAAM,MAAM,KAAK,CAAC;AACzB,OAAO,EACL,aAAa,EAEb,wBAAwB,EAGxB,wBAAwB,EACxB,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"queryApi.js","sourceRoot":"","sources":["../../../../src/features/CohortDiscovery/queryApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,MAAM,MAAM,KAAK,CAAC;AACzB,OAAO,EACL,aAAa,EAEb,wBAAwB,EAGxB,cAAc,EAGd,wBAAwB,EACxB,sBAAsB,EACtB,eAAe,EACf,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAQxD,MAAM,CAAC,IAAM,cAAc,GAAG,UAC5B,GAAW,EACX,IAAW,EACX,IAAc;IAEd,kEAAkE;;IAElE,IAAM,SAAS,GAAG,eAAe,CAAC,UAAC,KAAgB;QACjD,OAAA,eAAe,CAAC,KAAK,CAAC;IAAtB,CAAsB,CACvB,CAAC;IAEF,IAAM,OAAO,GAAG,UAAO,QAAgB,EAAE,SAAgB;;;;;oBACjD,OAAO,GAAG,IAAI,OAAO,CAAC;wBAC1B,MAAM,EAAE,kBAAkB;wBAC1B,cAAc,EAAE,kBAAkB;wBAClC,cAAc,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE;qBAChC,CAAC,CAAC;oBACH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;wBAGrC,WAAW,GAAG,SAAS,CAAC,mBAAmB,CAAC,CAAC;wBACnD,IAAI,WAAW,EAAE,CAAC;4BAChB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,iBAAU,WAAW,CAAE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N,IAAM,QAAQ,GAAG,cAAc,CAI7B,UAAG,cAAc,aAAU,EAC3B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,EACrE,IAAI,CACL,CAAC;IAEF,6BACK,QAAQ,KACX,IAAI,EAAE,CAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,IAAI;YACxB,CAAC,CAAC,wBAAwB,CACtB,sBAAsB,CACpB,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAGrC,EACD,sBAAsB,CACvB,CACF;YACH,CAAC,CAAC,EAAE,IACN;AACJ,CAAC,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import useSWR from 'swr';
|
|
|
12
12
|
import { errors, importSPKI, jwtVerify, decodeJwt } from 'jose';
|
|
13
13
|
import { notifications, showNotification, cleanNotifications, Notifications } from '@mantine/notifications';
|
|
14
14
|
import tinycolor from 'tinycolor2';
|
|
15
|
-
import { capitalize as capitalize$1, toString, isArray, get, omit, partial, cloneDeep, unset } from 'lodash';
|
|
15
|
+
import { capitalize as capitalize$1, toString, isArray, uniqueId, reduce, includes, isPlainObject, get, omit, partial, cloneDeep, unset } from 'lodash';
|
|
16
16
|
import { twMerge } from 'tailwind-merge';
|
|
17
17
|
import { BsExclamationTriangle, BsArrowsFullscreen } from 'react-icons/bs';
|
|
18
18
|
import { IoMdInformationCircleOutline, IoMdArrowDropdown, IoMdRefresh, IoMdLogIn } from 'react-icons/io';
|
|
@@ -45,7 +45,7 @@ import MiniSearch from 'minisearch';
|
|
|
45
45
|
import uniq from 'lodash/uniq';
|
|
46
46
|
import sum from 'lodash/sum';
|
|
47
47
|
import { LuCircleSlash, LuClock, LuLock, LuUnlock } from 'react-icons/lu';
|
|
48
|
-
import 'universal-cookie';
|
|
48
|
+
import Cookies from 'universal-cookie';
|
|
49
49
|
import GraphiQL from 'graphiql';
|
|
50
50
|
import fs from 'fs';
|
|
51
51
|
import path from 'path';
|
|
@@ -1413,7 +1413,7 @@ const CredentialsLogin = ({ handleLogin })=>{
|
|
|
1413
1413
|
};
|
|
1414
1414
|
|
|
1415
1415
|
// separate function for hashing logic
|
|
1416
|
-
function hashString(str) {
|
|
1416
|
+
function hashString$1(str) {
|
|
1417
1417
|
let hash = 0;
|
|
1418
1418
|
for(let i = 0; i < str.length; i++){
|
|
1419
1419
|
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
@@ -1425,7 +1425,7 @@ function hashCode(str) {
|
|
|
1425
1425
|
if (str === null || str === '') {
|
|
1426
1426
|
return 0;
|
|
1427
1427
|
}
|
|
1428
|
-
return hashString(str);
|
|
1428
|
+
return hashString$1(str);
|
|
1429
1429
|
}
|
|
1430
1430
|
|
|
1431
1431
|
/**
|
|
@@ -11161,6 +11161,22 @@ const CountsValue = ({ label, isSuccess, counts })=>{
|
|
|
11161
11161
|
});
|
|
11162
11162
|
};
|
|
11163
11163
|
|
|
11164
|
+
const hashString = (s)=>s.split('').reduce((acc, c)=>(acc << 5) - acc + c.charCodeAt(0), 0);
|
|
11165
|
+
const getBody = (iframe)=>{
|
|
11166
|
+
const document1 = iframe?.contentWindow || iframe?.contentDocument;
|
|
11167
|
+
return document1?.document?.body || document1?.body;
|
|
11168
|
+
};
|
|
11169
|
+
const toHtml = (key, value)=>`<input
|
|
11170
|
+
type="hidden"
|
|
11171
|
+
name="${key}"
|
|
11172
|
+
value="${isPlainObject(value) ? JSON.stringify(value).replace(/"/g, '"') : value}"
|
|
11173
|
+
/>`;
|
|
11174
|
+
const customKeys = [
|
|
11175
|
+
'expand',
|
|
11176
|
+
'fields',
|
|
11177
|
+
'facets'
|
|
11178
|
+
];
|
|
11179
|
+
const processParamObj = (key, value)=>includes(customKeys, key) ? [].concat(value).join() : value;
|
|
11164
11180
|
/**
|
|
11165
11181
|
* A notification box that is used to alert the user that their
|
|
11166
11182
|
* selected file downloads are in progress
|
|
@@ -11186,6 +11202,136 @@ const CountsValue = ({ label, isSuccess, counts })=>{
|
|
|
11186
11202
|
]
|
|
11187
11203
|
});
|
|
11188
11204
|
};
|
|
11205
|
+
/**
|
|
11206
|
+
* Trigger a download by attaching an iFrame to the document with the parameters of the request as fields in a form
|
|
11207
|
+
* @param endpoint - endpoint to be attached with
|
|
11208
|
+
* @param params - body to be attached with post request
|
|
11209
|
+
* @param method - Request Method: GET, PUT, POST
|
|
11210
|
+
* @param dispatch - dispatch send from the parent component to dispatch Modals
|
|
11211
|
+
* @param done - callback function to be called after the download has been initiated
|
|
11212
|
+
* @param Modal400 - Modal for 400 error
|
|
11213
|
+
* @param Modal403 - Modal for 403 error
|
|
11214
|
+
* @param customErrorMessage - custom message to be passed for 400 errors
|
|
11215
|
+
* @param hideNotification - hide the notification
|
|
11216
|
+
*/ const download = async ({ endpoint, params, method, dispatch, done, Modal400 = Modals.GeneralErrorModal, Modal403 = Modals.NoAccessModal, customErrorMessage, hideNotification = false })=>{
|
|
11217
|
+
const cookies = new Cookies();
|
|
11218
|
+
/* Create a cookie with a unique identifier to attach to request. Response from server will use the set-cookie header
|
|
11219
|
+
to remove the cookie when the response is received (aka the download starts). This will only work on when the FE and BE
|
|
11220
|
+
are on the same domain.
|
|
11221
|
+
*/ const downloadToken = uniqueId(`${+new Date()}-`);
|
|
11222
|
+
const cookieKey = navigator.cookieEnabled ? Math.abs(hashString(JSON.stringify(params) + downloadToken)).toString(16) : null;
|
|
11223
|
+
if (cookieKey) {
|
|
11224
|
+
cookies.set(cookieKey, downloadToken);
|
|
11225
|
+
}
|
|
11226
|
+
// place notification in timeout to avoid flicker on fast calls
|
|
11227
|
+
const showNotificationTimeout = setTimeout(()=>showNotification({
|
|
11228
|
+
message: /*#__PURE__*/ jsx(DownloadNotification, {
|
|
11229
|
+
onClick: ()=>{
|
|
11230
|
+
iFrame.remove();
|
|
11231
|
+
cleanNotifications();
|
|
11232
|
+
if (done) {
|
|
11233
|
+
done();
|
|
11234
|
+
}
|
|
11235
|
+
}
|
|
11236
|
+
}),
|
|
11237
|
+
styles: ()=>({
|
|
11238
|
+
root: {
|
|
11239
|
+
textAlign: 'center',
|
|
11240
|
+
display: hideNotification ? 'none' : 'block'
|
|
11241
|
+
},
|
|
11242
|
+
closeButton: {
|
|
11243
|
+
color: 'black',
|
|
11244
|
+
'&:hover': {
|
|
11245
|
+
backgroundColor: 'lightslategray'
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
}),
|
|
11249
|
+
closeButtonProps: {
|
|
11250
|
+
'aria-label': 'Close notification'
|
|
11251
|
+
}
|
|
11252
|
+
}), 100); // set to 100 as that is perceived as instant
|
|
11253
|
+
const fields = reduce({
|
|
11254
|
+
...params,
|
|
11255
|
+
downloadCookieKey: cookieKey,
|
|
11256
|
+
downloadCookiePath: '/',
|
|
11257
|
+
attachment: true,
|
|
11258
|
+
...params.filename !== undefined ? {
|
|
11259
|
+
download: params.filename
|
|
11260
|
+
} : {}
|
|
11261
|
+
}, (result, value, key)=>{
|
|
11262
|
+
const paramValue = processParamObj(key, value);
|
|
11263
|
+
return result + [].concat(paramValue).reduce((acc, v)=>acc + toHtml(key, v), '');
|
|
11264
|
+
}, '');
|
|
11265
|
+
const iFrame = document.createElement('iframe');
|
|
11266
|
+
iFrame.style.display = 'none';
|
|
11267
|
+
iFrame.src = 'about:blank';
|
|
11268
|
+
// Appending to document body to allow navigation away from the current
|
|
11269
|
+
// page and downloads in the background
|
|
11270
|
+
document.body.appendChild(iFrame);
|
|
11271
|
+
const pollForDownloadResult = async ()=>{
|
|
11272
|
+
const executePoll = async (resolve)=>{
|
|
11273
|
+
// Request has been canceled
|
|
11274
|
+
const body = getBody(iFrame);
|
|
11275
|
+
if (body === undefined) {
|
|
11276
|
+
resolve();
|
|
11277
|
+
return;
|
|
11278
|
+
}
|
|
11279
|
+
const content = body?.textContent;
|
|
11280
|
+
// Download has started
|
|
11281
|
+
if (cookieKey !== null && !cookies.get(cookieKey)) {
|
|
11282
|
+
clearTimeout(showNotificationTimeout);
|
|
11283
|
+
cleanNotifications();
|
|
11284
|
+
if (done) {
|
|
11285
|
+
done();
|
|
11286
|
+
}
|
|
11287
|
+
resolve();
|
|
11288
|
+
} else {
|
|
11289
|
+
const iFrameHasContent = iFrame.contentWindow?.document.body;
|
|
11290
|
+
const requestError = iFrame.contentWindow?.document.getElementsByTagName('form').length === 0 && content !== '';
|
|
11291
|
+
if (iFrameHasContent && requestError) {
|
|
11292
|
+
clearTimeout(showNotificationTimeout);
|
|
11293
|
+
cleanNotifications();
|
|
11294
|
+
const errorMessage = /{"(?:message|error)":"([^"]*)"/g.exec(content ?? 'Undefined')?.[1];
|
|
11295
|
+
if (errorMessage === 'internal server error' || errorMessage === undefined) {
|
|
11296
|
+
dispatch(showModal({
|
|
11297
|
+
modal: Modal400,
|
|
11298
|
+
message: errorMessage
|
|
11299
|
+
}));
|
|
11300
|
+
} else if (errorMessage === 'Your token is invalid or expired. Please get a new token.') {
|
|
11301
|
+
dispatch(showModal({
|
|
11302
|
+
modal: Modal403,
|
|
11303
|
+
message: errorMessage
|
|
11304
|
+
}));
|
|
11305
|
+
} else {
|
|
11306
|
+
dispatch(showModal({
|
|
11307
|
+
modal: Modal400,
|
|
11308
|
+
message: customErrorMessage || errorMessage
|
|
11309
|
+
}));
|
|
11310
|
+
}
|
|
11311
|
+
if (done) {
|
|
11312
|
+
done();
|
|
11313
|
+
}
|
|
11314
|
+
resolve();
|
|
11315
|
+
} else {
|
|
11316
|
+
setTimeout(executePoll, 1000, resolve);
|
|
11317
|
+
}
|
|
11318
|
+
}
|
|
11319
|
+
};
|
|
11320
|
+
return new Promise(executePoll);
|
|
11321
|
+
};
|
|
11322
|
+
const addFormAndSubmit = ()=>{
|
|
11323
|
+
//do all of this together for FireFox support
|
|
11324
|
+
const form = document.createElement('form');
|
|
11325
|
+
form.method = method.toUpperCase();
|
|
11326
|
+
form.action = endpoint;
|
|
11327
|
+
form.innerHTML = fields;
|
|
11328
|
+
getBody(iFrame).appendChild(form);
|
|
11329
|
+
form.submit();
|
|
11330
|
+
};
|
|
11331
|
+
addFormAndSubmit();
|
|
11332
|
+
await pollForDownloadResult();
|
|
11333
|
+
iFrame.remove();
|
|
11334
|
+
};
|
|
11189
11335
|
|
|
11190
11336
|
const showErrorMessage = (error)=>{
|
|
11191
11337
|
showNotification({
|
|
@@ -19719,6 +19865,78 @@ border-solid
|
|
|
19719
19865
|
rounded-[7px]
|
|
19720
19866
|
`;
|
|
19721
19867
|
|
|
19868
|
+
/**
|
|
19869
|
+
* A Button component that downloads data from a given endpoint.
|
|
19870
|
+
* The component will handle all download logic including fetching
|
|
19871
|
+
* the data, creating the file, and downloading the file.
|
|
19872
|
+
* @param endpoint - The endpoint to download from.
|
|
19873
|
+
* @param disabled - Whether the button is disabled.
|
|
19874
|
+
* @param inactiveText - The text to display when the button is inactive.
|
|
19875
|
+
* @param activeText - The text to display when the button is active.
|
|
19876
|
+
* @param filename - The name of the file to download.
|
|
19877
|
+
* @param size - The size of the download.
|
|
19878
|
+
* @param format - The format of the download.
|
|
19879
|
+
* @param fields - The fields to download.
|
|
19880
|
+
* @param caseFilters - The case filters to download.
|
|
19881
|
+
* @param filters - The filters to download.
|
|
19882
|
+
* @param extraParams - Any extra parameters to download.
|
|
19883
|
+
* @param method - The method to use for the download.
|
|
19884
|
+
* @param customStyle - Any custom styles to apply to the button.
|
|
19885
|
+
* @param showLoading - Whether to show the loading icon.
|
|
19886
|
+
* @param showIcon - Whether to show the download icon.
|
|
19887
|
+
* @param preventClickEvent - Whether to prevent the default click event.
|
|
19888
|
+
* @param onClick - The function to call when the button is clicked.
|
|
19889
|
+
* @param setActive - The function to call when the button is set active.
|
|
19890
|
+
* @param active - Whether the button is active.
|
|
19891
|
+
* @param Modal403 - The modal to display when a 403 error occurs.
|
|
19892
|
+
* @param Modal400 - The modal to display when a 400 error occurs.
|
|
19893
|
+
* @param toolTip - The tooltip to display.
|
|
19894
|
+
* @category Buttons
|
|
19895
|
+
*/ const DownloadButton = /*#__PURE__*/ forwardRef(({ endpoint = '', disabled = false, inactiveText, activeText, params = {}, method = 'POST', customStyle, setActive, onClick, showLoading = true, showIcon = true, preventClickEvent = false, active, Modal400 = Modals.GeneralErrorModal, Modal403 = Modals.NoAccessModal, toolTip, ...buttonProps }, ref)=>{
|
|
19896
|
+
const text = active ? activeText : inactiveText;
|
|
19897
|
+
const dispatch = useCoreDispatch();
|
|
19898
|
+
const Icon = active ? /*#__PURE__*/ jsx(Loader, {
|
|
19899
|
+
size: "sm",
|
|
19900
|
+
className: "p-1"
|
|
19901
|
+
}) : /*#__PURE__*/ jsx(FiDownload, {
|
|
19902
|
+
title: "download",
|
|
19903
|
+
size: 16
|
|
19904
|
+
});
|
|
19905
|
+
return /*#__PURE__*/ jsx(Tooltip, {
|
|
19906
|
+
disabled: !toolTip,
|
|
19907
|
+
label: toolTip,
|
|
19908
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
19909
|
+
ref: ref,
|
|
19910
|
+
leftSection: showIcon && inactiveText && /*#__PURE__*/ jsx(FiDownload, {}),
|
|
19911
|
+
disabled: disabled,
|
|
19912
|
+
className: customStyle || `text-base-lightest ${disabled ? 'bg-base' : 'bg-primary hover:bg-primary-darker'} `,
|
|
19913
|
+
loading: showLoading && active,
|
|
19914
|
+
onClick: ()=>{
|
|
19915
|
+
if (!preventClickEvent && onClick) {
|
|
19916
|
+
onClick();
|
|
19917
|
+
return;
|
|
19918
|
+
}
|
|
19919
|
+
dispatch(hideModal());
|
|
19920
|
+
if (setActive) setActive(true);
|
|
19921
|
+
download({
|
|
19922
|
+
endpoint,
|
|
19923
|
+
params,
|
|
19924
|
+
method,
|
|
19925
|
+
dispatch,
|
|
19926
|
+
done: ()=>{
|
|
19927
|
+
if (setActive) setActive(false);
|
|
19928
|
+
},
|
|
19929
|
+
Modal400,
|
|
19930
|
+
Modal403
|
|
19931
|
+
});
|
|
19932
|
+
},
|
|
19933
|
+
...buttonProps,
|
|
19934
|
+
children: text || Icon
|
|
19935
|
+
})
|
|
19936
|
+
});
|
|
19937
|
+
});
|
|
19938
|
+
DownloadButton.displayName = 'DownloadButton';
|
|
19939
|
+
|
|
19722
19940
|
// Define theme for mantine v7
|
|
19723
19941
|
const createMantineTheme = (fonts, colors)=>{
|
|
19724
19942
|
const theme = createTheme({
|