@bit.rhplus/data 0.0.86 → 0.0.88

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.
@@ -0,0 +1,2 @@
1
+ export default useData;
2
+ export function fetchData(api: any, data: any, accessToken: any): any;
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ /* eslint-disable */
2
+ import useData from './useData';
3
+ import { FetchData } from '@bit.rhplus/api';
4
+ export default useData;
5
+ export { useFileDownload } from './useFileDownload';
6
+ export { useApiQuery, useApiQuerySilence, useStaticQuery } from './reactQuery';
7
+ // Standalone fetchData pro použití mimo React komponenty (např. v tooltip třídách)
8
+ export const fetchData = (api, data, accessToken) => FetchData(api, data, accessToken);
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,eAAe,OAAO,CAAC;AAEvB,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;AAE7E,mFAAmF;AACnF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ ;
2
+ ;
3
+
4
+ export const compositions = [];
5
+ export const overview = [];
6
+
7
+ export const compositions_metadata = {"compositions":[]};
@@ -0,0 +1,339 @@
1
+ export function useApiQuery(key: any, api: any, params: {}, accessToken: any, returnFn: any, ui?: boolean, staleTimeMinute?: number, queryOptions?: {}): {
2
+ updateData: (updateFn: any) => void;
3
+ data: any;
4
+ error: Error;
5
+ isError: true;
6
+ isPending: false;
7
+ isLoading: false;
8
+ isLoadingError: false;
9
+ isRefetchError: true;
10
+ isSuccess: false;
11
+ isPlaceholderData: false;
12
+ status: "error";
13
+ dataUpdatedAt: number;
14
+ errorUpdatedAt: number;
15
+ failureCount: number;
16
+ failureReason: Error;
17
+ errorUpdateCount: number;
18
+ isFetched: boolean;
19
+ isFetchedAfterMount: boolean;
20
+ isFetching: boolean;
21
+ isInitialLoading: boolean;
22
+ isPaused: boolean;
23
+ isRefetching: boolean;
24
+ isStale: boolean;
25
+ isEnabled: boolean;
26
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
27
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
28
+ promise: Promise<any>;
29
+ } | {
30
+ updateData: (updateFn: any) => void;
31
+ data: any;
32
+ error: null;
33
+ isError: false;
34
+ isPending: false;
35
+ isLoading: false;
36
+ isLoadingError: false;
37
+ isRefetchError: false;
38
+ isSuccess: true;
39
+ isPlaceholderData: false;
40
+ status: "success";
41
+ dataUpdatedAt: number;
42
+ errorUpdatedAt: number;
43
+ failureCount: number;
44
+ failureReason: Error;
45
+ errorUpdateCount: number;
46
+ isFetched: boolean;
47
+ isFetchedAfterMount: boolean;
48
+ isFetching: boolean;
49
+ isInitialLoading: boolean;
50
+ isPaused: boolean;
51
+ isRefetching: boolean;
52
+ isStale: boolean;
53
+ isEnabled: boolean;
54
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
55
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
56
+ promise: Promise<any>;
57
+ } | {
58
+ updateData: (updateFn: any) => void;
59
+ data: undefined;
60
+ error: Error;
61
+ isError: true;
62
+ isPending: false;
63
+ isLoading: false;
64
+ isLoadingError: true;
65
+ isRefetchError: false;
66
+ isSuccess: false;
67
+ isPlaceholderData: false;
68
+ status: "error";
69
+ dataUpdatedAt: number;
70
+ errorUpdatedAt: number;
71
+ failureCount: number;
72
+ failureReason: Error;
73
+ errorUpdateCount: number;
74
+ isFetched: boolean;
75
+ isFetchedAfterMount: boolean;
76
+ isFetching: boolean;
77
+ isInitialLoading: boolean;
78
+ isPaused: boolean;
79
+ isRefetching: boolean;
80
+ isStale: boolean;
81
+ isEnabled: boolean;
82
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
83
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
84
+ promise: Promise<any>;
85
+ } | {
86
+ updateData: (updateFn: any) => void;
87
+ data: undefined;
88
+ error: null;
89
+ isError: false;
90
+ isPending: true;
91
+ isLoading: true;
92
+ isLoadingError: false;
93
+ isRefetchError: false;
94
+ isSuccess: false;
95
+ isPlaceholderData: false;
96
+ status: "pending";
97
+ dataUpdatedAt: number;
98
+ errorUpdatedAt: number;
99
+ failureCount: number;
100
+ failureReason: Error;
101
+ errorUpdateCount: number;
102
+ isFetched: boolean;
103
+ isFetchedAfterMount: boolean;
104
+ isFetching: boolean;
105
+ isInitialLoading: boolean;
106
+ isPaused: boolean;
107
+ isRefetching: boolean;
108
+ isStale: boolean;
109
+ isEnabled: boolean;
110
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
111
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
112
+ promise: Promise<any>;
113
+ } | {
114
+ updateData: (updateFn: any) => void;
115
+ data: undefined;
116
+ error: null;
117
+ isError: false;
118
+ isPending: true;
119
+ isLoadingError: false;
120
+ isRefetchError: false;
121
+ isSuccess: false;
122
+ isPlaceholderData: false;
123
+ status: "pending";
124
+ dataUpdatedAt: number;
125
+ errorUpdatedAt: number;
126
+ failureCount: number;
127
+ failureReason: Error;
128
+ errorUpdateCount: number;
129
+ isFetched: boolean;
130
+ isFetchedAfterMount: boolean;
131
+ isFetching: boolean;
132
+ isLoading: boolean;
133
+ isInitialLoading: boolean;
134
+ isPaused: boolean;
135
+ isRefetching: boolean;
136
+ isStale: boolean;
137
+ isEnabled: boolean;
138
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
139
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
140
+ promise: Promise<any>;
141
+ } | {
142
+ updateData: (updateFn: any) => void;
143
+ data: any;
144
+ isError: false;
145
+ error: null;
146
+ isPending: false;
147
+ isLoading: false;
148
+ isLoadingError: false;
149
+ isRefetchError: false;
150
+ isSuccess: true;
151
+ isPlaceholderData: true;
152
+ status: "success";
153
+ dataUpdatedAt: number;
154
+ errorUpdatedAt: number;
155
+ failureCount: number;
156
+ failureReason: Error;
157
+ errorUpdateCount: number;
158
+ isFetched: boolean;
159
+ isFetchedAfterMount: boolean;
160
+ isFetching: boolean;
161
+ isInitialLoading: boolean;
162
+ isPaused: boolean;
163
+ isRefetching: boolean;
164
+ isStale: boolean;
165
+ isEnabled: boolean;
166
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
167
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
168
+ promise: Promise<any>;
169
+ };
170
+ export function useApiQuerySilence(key: any, api: any, params: {}, accessToken: any, returnFn: any): {
171
+ updateData: (updateFn: any) => void;
172
+ data: any;
173
+ error: Error;
174
+ isError: true;
175
+ isPending: false;
176
+ isLoading: false;
177
+ isLoadingError: false;
178
+ isRefetchError: true;
179
+ isSuccess: false;
180
+ isPlaceholderData: false;
181
+ status: "error";
182
+ dataUpdatedAt: number;
183
+ errorUpdatedAt: number;
184
+ failureCount: number;
185
+ failureReason: Error;
186
+ errorUpdateCount: number;
187
+ isFetched: boolean;
188
+ isFetchedAfterMount: boolean;
189
+ isFetching: boolean;
190
+ isInitialLoading: boolean;
191
+ isPaused: boolean;
192
+ isRefetching: boolean;
193
+ isStale: boolean;
194
+ isEnabled: boolean;
195
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
196
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
197
+ promise: Promise<any>;
198
+ } | {
199
+ updateData: (updateFn: any) => void;
200
+ data: any;
201
+ error: null;
202
+ isError: false;
203
+ isPending: false;
204
+ isLoading: false;
205
+ isLoadingError: false;
206
+ isRefetchError: false;
207
+ isSuccess: true;
208
+ isPlaceholderData: false;
209
+ status: "success";
210
+ dataUpdatedAt: number;
211
+ errorUpdatedAt: number;
212
+ failureCount: number;
213
+ failureReason: Error;
214
+ errorUpdateCount: number;
215
+ isFetched: boolean;
216
+ isFetchedAfterMount: boolean;
217
+ isFetching: boolean;
218
+ isInitialLoading: boolean;
219
+ isPaused: boolean;
220
+ isRefetching: boolean;
221
+ isStale: boolean;
222
+ isEnabled: boolean;
223
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
224
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
225
+ promise: Promise<any>;
226
+ } | {
227
+ updateData: (updateFn: any) => void;
228
+ data: undefined;
229
+ error: Error;
230
+ isError: true;
231
+ isPending: false;
232
+ isLoading: false;
233
+ isLoadingError: true;
234
+ isRefetchError: false;
235
+ isSuccess: false;
236
+ isPlaceholderData: false;
237
+ status: "error";
238
+ dataUpdatedAt: number;
239
+ errorUpdatedAt: number;
240
+ failureCount: number;
241
+ failureReason: Error;
242
+ errorUpdateCount: number;
243
+ isFetched: boolean;
244
+ isFetchedAfterMount: boolean;
245
+ isFetching: boolean;
246
+ isInitialLoading: boolean;
247
+ isPaused: boolean;
248
+ isRefetching: boolean;
249
+ isStale: boolean;
250
+ isEnabled: boolean;
251
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
252
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
253
+ promise: Promise<any>;
254
+ } | {
255
+ updateData: (updateFn: any) => void;
256
+ data: undefined;
257
+ error: null;
258
+ isError: false;
259
+ isPending: true;
260
+ isLoading: true;
261
+ isLoadingError: false;
262
+ isRefetchError: false;
263
+ isSuccess: false;
264
+ isPlaceholderData: false;
265
+ status: "pending";
266
+ dataUpdatedAt: number;
267
+ errorUpdatedAt: number;
268
+ failureCount: number;
269
+ failureReason: Error;
270
+ errorUpdateCount: number;
271
+ isFetched: boolean;
272
+ isFetchedAfterMount: boolean;
273
+ isFetching: boolean;
274
+ isInitialLoading: boolean;
275
+ isPaused: boolean;
276
+ isRefetching: boolean;
277
+ isStale: boolean;
278
+ isEnabled: boolean;
279
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
280
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
281
+ promise: Promise<any>;
282
+ } | {
283
+ updateData: (updateFn: any) => void;
284
+ data: undefined;
285
+ error: null;
286
+ isError: false;
287
+ isPending: true;
288
+ isLoadingError: false;
289
+ isRefetchError: false;
290
+ isSuccess: false;
291
+ isPlaceholderData: false;
292
+ status: "pending";
293
+ dataUpdatedAt: number;
294
+ errorUpdatedAt: number;
295
+ failureCount: number;
296
+ failureReason: Error;
297
+ errorUpdateCount: number;
298
+ isFetched: boolean;
299
+ isFetchedAfterMount: boolean;
300
+ isFetching: boolean;
301
+ isLoading: boolean;
302
+ isInitialLoading: boolean;
303
+ isPaused: boolean;
304
+ isRefetching: boolean;
305
+ isStale: boolean;
306
+ isEnabled: boolean;
307
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
308
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
309
+ promise: Promise<any>;
310
+ } | {
311
+ updateData: (updateFn: any) => void;
312
+ data: any;
313
+ isError: false;
314
+ error: null;
315
+ isPending: false;
316
+ isLoading: false;
317
+ isLoadingError: false;
318
+ isRefetchError: false;
319
+ isSuccess: true;
320
+ isPlaceholderData: true;
321
+ status: "success";
322
+ dataUpdatedAt: number;
323
+ errorUpdatedAt: number;
324
+ failureCount: number;
325
+ failureReason: Error;
326
+ errorUpdateCount: number;
327
+ isFetched: boolean;
328
+ isFetchedAfterMount: boolean;
329
+ isFetching: boolean;
330
+ isInitialLoading: boolean;
331
+ isPaused: boolean;
332
+ isRefetching: boolean;
333
+ isStale: boolean;
334
+ isEnabled: boolean;
335
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
336
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
337
+ promise: Promise<any>;
338
+ };
339
+ export function useStaticQuery(key: any, staticData: any): import("@tanstack/react-query").DefinedUseQueryResult<any, Error>;
@@ -0,0 +1,42 @@
1
+ /* eslint-disable */
2
+ import { useQuery, useQueryClient } from '@tanstack/react-query';
3
+ import useData from '.';
4
+ export const useApiQuery = (key, api, params = {}, accessToken, returnFn, ui = true, staleTimeMinute = 0, queryOptions = {}) => {
5
+ const { fetchData, fetchDataUIAsync } = useData();
6
+ const queryClient = useQueryClient();
7
+ return {
8
+ ...useQuery({
9
+ queryKey: [key, params],
10
+ staleTime: staleTimeMinute * 60 * 1000,
11
+ refetchOnWindowFocus: true,
12
+ refetchOnMount: true,
13
+ ...queryOptions,
14
+ queryFn: async () => {
15
+ const response = ui
16
+ ? await fetchDataUIAsync(api, params, accessToken)
17
+ : await fetchData(api, params, accessToken);
18
+ if (returnFn) {
19
+ return returnFn(response.data);
20
+ }
21
+ return response.data;
22
+ },
23
+ }),
24
+ updateData: (updateFn) => {
25
+ queryClient.setQueryData([key, params], (oldData) => {
26
+ if (!oldData)
27
+ return oldData;
28
+ return updateFn(oldData);
29
+ });
30
+ },
31
+ };
32
+ };
33
+ export const useApiQuerySilence = (key, api, params = {}, accessToken, returnFn) => useApiQuery(key, api, params, accessToken, returnFn, false);
34
+ export const useStaticQuery = (key, staticData) => {
35
+ return useQuery({
36
+ queryKey: [key],
37
+ queryFn: () => Promise.resolve(staticData),
38
+ initialData: staticData,
39
+ staleTime: Infinity,
40
+ });
41
+ };
42
+ //# sourceMappingURL=reactQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactQuery.js","sourceRoot":"","sources":["../reactQuery.js"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,OAAO,MAAM,GAAG,CAAC;AAExB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,GAAG,IAAI,EAAE,eAAe,GAAG,CAAC,EAAE,YAAY,GAAG,EAAE,EAAE,EAAE;IAC7H,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,OAAO,EAAE,CAAC;IAClD,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,OAAO;QACL,GAAG,QAAQ,CAAC;YACV,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC;YACvB,SAAS,EAAE,eAAe,GAAG,EAAE,GAAG,IAAI;YACtC,oBAAoB,EAAE,IAAI;YAC1B,cAAc,EAAE,IAAI;YACpB,GAAG,YAAY;YACf,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,MAAM,QAAQ,GAAG,EAAE;oBACjB,CAAC,CAAC,MAAM,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC;oBAClD,CAAC,CAAC,MAAM,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;gBAE9C,IAAI,QAAQ,EAAE,CAAC;oBACb,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBACjC,CAAC;gBAED,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;SACF,CAAC;QACF,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE;YACvB,WAAW,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE;gBAClD,IAAI,CAAC,OAAO;oBAAE,OAAO,OAAO,CAAC;gBAC7B,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,CAC/E,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE;IAChD,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,GAAG,CAAC;QACf,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;QAC1C,WAAW,EAAE,UAAU;QACvB,SAAS,EAAE,QAAQ;KACpB,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export default function useData(): {
2
+ fetchData: (api: any, data: any, accessToken: any) => any;
3
+ fetchDataUIAsync: (api: any, data: any, accessToken: any) => Promise<any>;
4
+ getFileURL: (content: any, type: any) => string;
5
+ downloadFileURL: (content: any, type: any, fileName: any) => void;
6
+ };
@@ -0,0 +1,126 @@
1
+ /* eslint-disable */
2
+ import { useState } from 'react';
3
+ import { FetchData, errorNotification } from '@bit.rhplus/api';
4
+ // import { useOidcAccessToken } from "@axa-fr/react-oidc";
5
+ export default function useData() {
6
+ const [isDownloading, setIsDownloading] = useState(false);
7
+ const [error, setError] = useState('');
8
+ // let accessToken = null;
9
+ // try {
10
+ // const oidcToken = useOidcAccessToken();
11
+ // accessToken = oidcToken?.accessToken || null;
12
+ // console.log("🚀 ~ useData ~ accessToken:", accessToken)
13
+ // } catch (err) {
14
+ // // Kontext OIDC není dostupný – pokračujeme bez tokenu
15
+ // errorNotification('OIDC není dostupné. Pravděpodobně chybí OidcProvider.', err);
16
+ // }
17
+ /* eslint-disable */
18
+ const fetchData = (api, data, accessToken) => FetchData(api, data, accessToken);
19
+ const fetchDataUIAsync = async (api, data, accessToken) => {
20
+ try {
21
+ const result = await fetchData(api, data, accessToken);
22
+ return {
23
+ ...result,
24
+ result: 'success',
25
+ success: true,
26
+ };
27
+ }
28
+ catch (error) {
29
+ console.error("❌ fetchDataUIAsync Error:", error);
30
+ errorNotification(error);
31
+ return {
32
+ result: 'fail',
33
+ success: false,
34
+ error,
35
+ };
36
+ }
37
+ };
38
+ const getFileURL = (content, type) => {
39
+ const isBase64 = typeof content === 'string' && /^[A-Za-z0-9+/=]+$/.test(content);
40
+ let byteArray;
41
+ if (isBase64) {
42
+ const byteCharacters = atob(content);
43
+ const byteNumbers = new Array(byteCharacters.length);
44
+ for (let i = 0; i < byteCharacters.length; i += 1) {
45
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
46
+ }
47
+ byteArray = new Uint8Array(byteNumbers);
48
+ }
49
+ else {
50
+ byteArray = new Uint8Array(content);
51
+ }
52
+ const blob = new Blob([byteArray], { type });
53
+ const fileUrl = window.URL.createObjectURL(blob);
54
+ return fileUrl;
55
+ };
56
+ const downloadFileURL = (content, type, fileName) => {
57
+ setIsDownloading(true);
58
+ setError('');
59
+ try {
60
+ const fileURL = getFileURL(content, type);
61
+ const tempLink = document.createElement('a');
62
+ tempLink.href = fileURL;
63
+ tempLink.download = fileName;
64
+ tempLink.click();
65
+ }
66
+ catch (err) {
67
+ console.error('Chyba při stahování:', err);
68
+ setError(`Chyba při stahování souboru: ${err.message}`);
69
+ }
70
+ finally {
71
+ setIsDownloading(false);
72
+ }
73
+ };
74
+ // const downloadFile = async () => {
75
+ // setIsDownloading(true);
76
+ // setError('');
77
+ // try {
78
+ // const response = await fetch(`/api/document/download/${documentId}`, {
79
+ // method: 'GET',
80
+ // headers: {
81
+ // Accept: '*/*',
82
+ // },
83
+ // });
84
+ // if (!response.ok) {
85
+ // throw new Error(`Chyba serveru: ${response.status}`);
86
+ // }
87
+ // // Získáme blob z odpovědi
88
+ // const blob = await response.blob();
89
+ // // Získáme název souboru z Content-Disposition hlavičky nebo použijeme předaný název
90
+ // const contentDisposition = response.headers.get('content-disposition');
91
+ // let downloadFileName = fileName;
92
+ // if (contentDisposition) {
93
+ // const fileNameMatch = contentDisposition.match(
94
+ // /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/
95
+ // );
96
+ // if (fileNameMatch && fileNameMatch[1]) {
97
+ // // Odstraníme uvozovky pokud jsou
98
+ // downloadFileName = fileNameMatch[1].replace(/['"]/g, '');
99
+ // }
100
+ // }
101
+ // // Vytvoříme URL pro blob a spustíme stahování
102
+ // const url = window.URL.createObjectURL(blob);
103
+ // const link = document.createElement('a');
104
+ // link.href = url;
105
+ // link.download = downloadFileName || `soubor_${documentId}`;
106
+ // document.body.appendChild(link);
107
+ // link.click();
108
+ // // Vyčistíme po sobě
109
+ // window.URL.revokeObjectURL(url);
110
+ // document.body.removeChild(link);
111
+ // } catch (err) {
112
+ // console.error('Chyba při stahování:', err);
113
+ // setError(`Chyba při stahování souboru: ${err.message}`);
114
+ // } finally {
115
+ // setIsDownloading(false);
116
+ // }
117
+ // };
118
+ return {
119
+ fetchData,
120
+ fetchDataUIAsync,
121
+ getFileURL,
122
+ downloadFileURL,
123
+ };
124
+ }
125
+ export { useApiQuery, useApiQuerySilence, useStaticQuery } from './reactQuery';
126
+ //# sourceMappingURL=useData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useData.js","sourceRoot":"","sources":["../useData.js"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC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C;YACb,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;YAC3C,QAAQ,CAAC,gCAAgC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1D,CAAC;gBAAS,CAAC;YACT,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CAAC;IAEF,qCAAqC;IACrC,4BAA4B;IAC5B,kBAAkB;IAElB,UAAU;IACV,6EAA6E;IAC7E,uBAAuB;IACvB,mBAAmB;IACnB,yBAAyB;IACzB,WAAW;IACX,UAAU;IAEV,0BAA0B;IAC1B,8DAA8D;IAC9D,QAAQ;IAER,iCAAiC;IACjC,0CAA0C;IAE1C,2FAA2F;IAC3F,8EAA8E;IAC9E,uCAAuC;IAEvC,gCAAgC;IAChC,wDAAwD;IACxD,mDAAmD;IACnD,WAAW;IACX,iDAAiD;IACjD,4CAA4C;IAC5C,oEAAoE;IACpE,UAAU;IACV,QAAQ;IAER,qDAAqD;IACrD,oDAAoD;IACpD,gDAAgD;IAChD,uBAAuB;IACvB,kEAAkE;IAClE,uCAAuC;IACvC,oBAAoB;IAEpB,2BAA2B;IAC3B,uCAAuC;IACvC,uCAAuC;IACvC,oBAAoB;IACpB,kDAAkD;IAClD,+DAA+D;IAC/D,gBAAgB;IAChB,+BAA+B;IAC/B,MAAM;IACN,KAAK;IAEL,OAAO;QACL,SAAS;QACT,gBAAgB;QAChB,UAAU;QACV,eAAe;KAChB,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,46 @@
1
+ export function useFileDownload(options?: {}): {
2
+ isDownloading: boolean;
3
+ error: string;
4
+ downloadFile: (api: any, data: any, fileName?: any) => Promise<{
5
+ success: boolean;
6
+ error: string;
7
+ fileName?: undefined;
8
+ size?: undefined;
9
+ errorMessage?: undefined;
10
+ } | {
11
+ success: boolean;
12
+ fileName: any;
13
+ size: any;
14
+ error?: undefined;
15
+ errorMessage?: undefined;
16
+ } | {
17
+ success: boolean;
18
+ error: any;
19
+ errorMessage: string;
20
+ fileName?: undefined;
21
+ size?: undefined;
22
+ }>;
23
+ fetchFile: (api: any, data: any, fileName?: any) => Promise<{
24
+ success: boolean;
25
+ error: string;
26
+ blob?: undefined;
27
+ fileName?: undefined;
28
+ size?: undefined;
29
+ errorMessage?: undefined;
30
+ } | {
31
+ success: boolean;
32
+ blob: any;
33
+ fileName: any;
34
+ size: any;
35
+ error?: undefined;
36
+ errorMessage?: undefined;
37
+ } | {
38
+ success: boolean;
39
+ error: any;
40
+ errorMessage: string;
41
+ blob?: undefined;
42
+ fileName?: undefined;
43
+ size?: undefined;
44
+ }>;
45
+ reset: () => void;
46
+ };
@@ -0,0 +1,195 @@
1
+ /* eslint-disable */
2
+ // hooks/useFileDownload.js
3
+ import { useState, useCallback } from 'react';
4
+ import useData from '.';
5
+ export const useFileDownload = (options = {}) => {
6
+ const { onDownloadStart, onDownloadEnd, onDownloadSuccess, onDownloadError, onLoadingChange, accessToken, } = options;
7
+ const { fetchData } = useData();
8
+ const [isDownloading, setIsDownloading] = useState(false);
9
+ const [error, setError] = useState('');
10
+ const downloadFile = useCallback(async (api, data, fileName = null) => {
11
+ if (isDownloading) {
12
+ return { success: false, error: 'Download already in progress' };
13
+ }
14
+ setIsDownloading(true);
15
+ setError('');
16
+ // Notify o začátku stahování
17
+ onDownloadStart?.();
18
+ onLoadingChange?.(true);
19
+ try {
20
+ const response = await fetchData(api, data, accessToken);
21
+ const blob = response.data;
22
+ // Získáme název souboru z Content-Disposition hlavičky nebo použijeme předaný název
23
+ let downloadFileName = fileName;
24
+ // Zkus získat filename ze serverových headers
25
+ if (response.headers) {
26
+ let contentDisposition;
27
+ // Různé způsoby jak získat header (záleží na struktuře response)
28
+ if (typeof response.headers.get === 'function') {
29
+ contentDisposition = response.headers.get('content-disposition');
30
+ }
31
+ else if (response.headers['content-disposition']) {
32
+ contentDisposition = response.headers['content-disposition'];
33
+ }
34
+ if (contentDisposition) {
35
+ const fileNameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
36
+ if (fileNameMatch && fileNameMatch[1]) {
37
+ downloadFileName = fileNameMatch[1].replace(/['"]/g, '');
38
+ }
39
+ }
40
+ }
41
+ // Vytvoříme URL pro blob
42
+ const objectUrl = window.URL.createObjectURL(blob);
43
+ // METODA: Pouze Save As dialog bez otevření PDF
44
+ const newWindow = window.open('', '_blank');
45
+ if (newWindow) {
46
+ // Okamžitě vytvoř download link v prázdném okně
47
+ const link = newWindow.document.createElement('a');
48
+ link.href = objectUrl;
49
+ link.download = downloadFileName || 'soubor.pdf';
50
+ newWindow.document.body.appendChild(link);
51
+ link.click();
52
+ // Zavři prázdné okno okamžitě
53
+ setTimeout(() => {
54
+ newWindow.close();
55
+ }, 100);
56
+ }
57
+ else {
58
+ const link = document.createElement('a');
59
+ link.style.display = 'none';
60
+ link.href = objectUrl;
61
+ link.download = downloadFileName || 'soubor.pdf';
62
+ document.body.appendChild(link);
63
+ // Zkus více způsobů kliknutí
64
+ try {
65
+ link.click();
66
+ }
67
+ catch (e) {
68
+ const event = new MouseEvent('click', {
69
+ view: window,
70
+ bubbles: true,
71
+ cancelable: true,
72
+ });
73
+ link.dispatchEvent(event);
74
+ }
75
+ // Cleanup
76
+ setTimeout(() => {
77
+ document.body.removeChild(link);
78
+ }, 100);
79
+ }
80
+ // Cleanup URL s kratším delayem
81
+ setTimeout(() => {
82
+ window.URL.revokeObjectURL(objectUrl);
83
+ }, 1000);
84
+ // Success callback
85
+ onDownloadSuccess?.(downloadFileName, blob.size);
86
+ return {
87
+ success: true,
88
+ fileName: downloadFileName,
89
+ size: blob.size,
90
+ };
91
+ }
92
+ catch (err) {
93
+ console.error('Chyba při stahování:', err);
94
+ const errorMessage = `Chyba při stahování souboru: ${err.message}`;
95
+ setError(errorMessage);
96
+ onDownloadError?.(err, errorMessage);
97
+ return {
98
+ success: false,
99
+ error: err,
100
+ errorMessage,
101
+ };
102
+ }
103
+ finally {
104
+ setIsDownloading(false);
105
+ onDownloadEnd?.();
106
+ onLoadingChange?.(false);
107
+ }
108
+ }, [
109
+ isDownloading,
110
+ onDownloadStart,
111
+ onDownloadEnd,
112
+ onDownloadSuccess,
113
+ onDownloadError,
114
+ onLoadingChange,
115
+ accessToken,
116
+ fetchData,
117
+ ]);
118
+ const fetchFile = useCallback(async (api, data, fileName = null) => {
119
+ if (isDownloading) {
120
+ return { success: false, error: 'Fetch already in progress' };
121
+ }
122
+ setIsDownloading(true);
123
+ setError('');
124
+ // Notify o začátku načítání
125
+ onDownloadStart?.();
126
+ onLoadingChange?.(true);
127
+ try {
128
+ const response = await fetchData(api, data, accessToken);
129
+ const blob = response.data;
130
+ // Získáme název souboru z Content-Disposition hlavičky nebo použijeme předaný název
131
+ let fetchedFileName = fileName;
132
+ // Zkus získat filename ze serverových headers
133
+ if (response.headers) {
134
+ let contentDisposition;
135
+ // Různé způsoby jak získat header (záleží na struktuře response)
136
+ if (typeof response.headers.get === 'function') {
137
+ contentDisposition = response.headers.get('content-disposition');
138
+ }
139
+ else if (response.headers['content-disposition']) {
140
+ contentDisposition = response.headers['content-disposition'];
141
+ }
142
+ if (contentDisposition) {
143
+ const fileNameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
144
+ if (fileNameMatch && fileNameMatch[1]) {
145
+ fetchedFileName = fileNameMatch[1].replace(/['"]/g, '');
146
+ }
147
+ }
148
+ }
149
+ // Success callback
150
+ onDownloadSuccess?.(fetchedFileName, blob.size);
151
+ return {
152
+ success: true,
153
+ blob: blob,
154
+ fileName: fetchedFileName,
155
+ size: blob.size,
156
+ };
157
+ }
158
+ catch (err) {
159
+ console.error('Chyba při načítání souboru:', err);
160
+ const errorMessage = `Chyba při načítání souboru: ${err.message}`;
161
+ setError(errorMessage);
162
+ onDownloadError?.(err, errorMessage);
163
+ return {
164
+ success: false,
165
+ error: err,
166
+ errorMessage,
167
+ };
168
+ }
169
+ finally {
170
+ setIsDownloading(false);
171
+ onDownloadEnd?.();
172
+ onLoadingChange?.(false);
173
+ }
174
+ }, [
175
+ isDownloading,
176
+ onDownloadStart,
177
+ onDownloadEnd,
178
+ onDownloadSuccess,
179
+ onDownloadError,
180
+ onLoadingChange,
181
+ accessToken,
182
+ fetchData,
183
+ ]);
184
+ const reset = useCallback(() => {
185
+ setError('');
186
+ }, []);
187
+ return {
188
+ isDownloading,
189
+ error,
190
+ downloadFile,
191
+ fetchFile,
192
+ reset,
193
+ };
194
+ };
195
+ //# sourceMappingURL=useFileDownload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFileDownload.js","sourceRoot":"","sources":["../useFileDownload.js"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,2BAA2B;AAC3B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,OAAO,MAAM,GAAG,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE;IAC9C,MAAM,EACJ,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,WAAW,GACZ,GAAG,OAAO,CAAC;IACZ,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC;IAChC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAG,WAAW,CAC9B,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,EAAE;QACnC,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,8BAA8B,EAAE,CAAC;QACnE,CAAC;QACD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AQ,EAAE,eAAe;gBACzB,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;YAClD,MAAM,YAAY,GAAG,+BAA+B,GAAG,CAAC,OAAO,EAAE,CAAC;YAClE,QAAQ,CAAC,YAAY,CAAC,CAAC;YACvB,eAAe,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;YAErC,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,GAAG;gBACV,YAAY;aACb,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,gBAAgB,CAAC,KAAK,CAAC,CAAC;YACxB,aAAa,EAAE,EAAE,CAAC;YAClB,eAAe,EAAE,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,EACD;QACE,aAAa;QACb,eAAe;QACf,aAAa;QACb,iBAAiB;QACjB,eAAe;QACf,eAAe;QACf,WAAW;QACX,SAAS;KACV,CACF,CAAC;IAEF,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7B,QAAQ,CAAC,EAAE,CAAC,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,aAAa;QACb,KAAK;QACL,YAAY;QACZ,SAAS;QACT,KAAK;KACN,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@bit.rhplus/data",
3
- "version": "0.0.86",
3
+ "version": "0.0.88",
4
4
  "homepage": "https://bit.cloud/remote-scope/data",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "remote-scope",
8
8
  "name": "data",
9
- "version": "0.0.86"
9
+ "version": "0.0.88"
10
10
  },
11
11
  "dependencies": {
12
12
  "@tanstack/react-query": "^5.66.9",
13
- "@bit.rhplus/api": "0.1.19"
13
+ "@bit.rhplus/api": "0.1.21"
14
14
  },
15
15
  "devDependencies": {
16
- "@bitdev/react.react-env": "4.0.14"
16
+ "@bitdev/react.react-env": "5.0.5"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
@@ -0,0 +1,43 @@
1
+ declare module '*.png' {
2
+ const value: any;
3
+ export = value;
4
+ }
5
+ declare module '*.svg' {
6
+ import type { FunctionComponent, SVGProps } from 'react';
7
+
8
+ export const ReactComponent: FunctionComponent<
9
+ SVGProps<SVGSVGElement> & { title?: string }
10
+ >;
11
+ const src: string;
12
+ export default src;
13
+ }
14
+
15
+ // @TODO Gilad
16
+ declare module '*.jpg' {
17
+ const value: any;
18
+ export = value;
19
+ }
20
+ declare module '*.jpeg' {
21
+ const value: any;
22
+ export = value;
23
+ }
24
+ declare module '*.gif' {
25
+ const value: any;
26
+ export = value;
27
+ }
28
+ declare module '*.bmp' {
29
+ const value: any;
30
+ export = value;
31
+ }
32
+ declare module '*.otf' {
33
+ const value: any;
34
+ export = value;
35
+ }
36
+ declare module '*.woff' {
37
+ const value: any;
38
+ export = value;
39
+ }
40
+ declare module '*.woff2' {
41
+ const value: any;
42
+ export = value;
43
+ }
package/types/env.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ export type ImportMetaEnv = Record<string, string>;
4
+
5
+ interface ImportMeta {
6
+ readonly env: ImportMetaEnv
7
+ }
8
+
9
+ declare global {
10
+ namespace NodeJS {
11
+ interface ProcessEnv {
12
+ [key: string]: string;
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,42 @@
1
+ declare module '*.module.css' {
2
+ const classes: { readonly [key: string]: string };
3
+ export default classes;
4
+ }
5
+ declare module '*.module.scss' {
6
+ const classes: { readonly [key: string]: string };
7
+ export default classes;
8
+ }
9
+ declare module '*.module.sass' {
10
+ const classes: { readonly [key: string]: string };
11
+ export default classes;
12
+ }
13
+
14
+ declare module '*.module.less' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+
19
+ declare module '*.less' {
20
+ const classes: { readonly [key: string]: string };
21
+ export default classes;
22
+ }
23
+
24
+ declare module '*.css' {
25
+ const classes: { readonly [key: string]: string };
26
+ export default classes;
27
+ }
28
+
29
+ declare module '*.sass' {
30
+ const classes: { readonly [key: string]: string };
31
+ export default classes;
32
+ }
33
+
34
+ declare module '*.scss' {
35
+ const classes: { readonly [key: string]: string };
36
+ export default classes;
37
+ }
38
+
39
+ declare module '*.mdx' {
40
+ const component: any;
41
+ export default component;
42
+ }