@geowiki/core 0.15.0-dev.1

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/index.mjs ADDED
@@ -0,0 +1,3243 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __async = (__this, __arguments, generator) => {
33
+ return new Promise((resolve, reject) => {
34
+ var fulfilled = (value) => {
35
+ try {
36
+ step(generator.next(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var rejected = (value) => {
42
+ try {
43
+ step(generator.throw(value));
44
+ } catch (e) {
45
+ reject(e);
46
+ }
47
+ };
48
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
+ step((generator = generator.apply(__this, __arguments)).next());
50
+ });
51
+ };
52
+
53
+ // src/Animation.ts
54
+ var easing = [0.175, 0.85, 0.42, 0.96];
55
+ var listVariants = {
56
+ initial: { scale: 0.96, y: 30, opacity: 0 },
57
+ enter: {
58
+ scale: 1,
59
+ y: 0,
60
+ opacity: 1,
61
+ transition: {
62
+ duration: 0.5,
63
+ ease: [0.48, 0.15, 0.25, 0.96],
64
+ staggerChildren: 0.1,
65
+ delayChildren: 0.2
66
+ }
67
+ },
68
+ exit: {
69
+ transition: { staggerChildren: 0.1, staggerDirection: -1 }
70
+ }
71
+ };
72
+ var itemVariants = {
73
+ initial: {
74
+ y: 50,
75
+ opacity: 0,
76
+ transition: {
77
+ y: { stiffness: 1e3 }
78
+ }
79
+ },
80
+ enter: {
81
+ y: 0,
82
+ opacity: 1,
83
+ transition: {
84
+ y: { stiffness: 1e3, velocity: -100 }
85
+ }
86
+ },
87
+ exit: {
88
+ y: 50,
89
+ opacity: 0,
90
+ transition: {
91
+ y: { stiffness: 1e3, velocity: -100 }
92
+ }
93
+ }
94
+ };
95
+ var slideInUp = {
96
+ exit: {
97
+ y: 100,
98
+ opacity: 0,
99
+ transition: { duration: 0.2, ease: easing }
100
+ },
101
+ enter: {
102
+ y: 0,
103
+ opacity: 1,
104
+ transition: { delay: 0.1, duration: 0.5, ease: easing }
105
+ }
106
+ };
107
+ var delayedSlideInUp = {
108
+ exit: {
109
+ y: 100,
110
+ opacity: 0,
111
+ transition: { duration: 0.2, ease: easing }
112
+ },
113
+ enter: {
114
+ y: 0,
115
+ opacity: 1,
116
+ transition: {
117
+ delay: 0.2,
118
+ duration: 0.5,
119
+ ease: easing
120
+ }
121
+ }
122
+ };
123
+ var slideInLeft = {
124
+ exit: {
125
+ x: -100,
126
+ opacity: 0,
127
+ transition: { duration: 0.4, ease: easing }
128
+ },
129
+ enter: {
130
+ x: 0,
131
+ opacity: 1,
132
+ transition: { delay: 0.1, duration: 0.5, ease: easing }
133
+ }
134
+ };
135
+ var slideInRight = {
136
+ exit: { x: 150, opacity: 0, transition: { duration: 0.4, ease: easing } },
137
+ enter: {
138
+ x: 0,
139
+ opacity: 1,
140
+ transition: {
141
+ duration: 0.5,
142
+ ease: easing
143
+ }
144
+ }
145
+ };
146
+ var spring = {
147
+ type: "spring",
148
+ stiffness: 500,
149
+ damping: 30
150
+ };
151
+
152
+ // src/hooks/QueryConstants.ts
153
+ var QueryConstants = {
154
+ GetUsers: "GetUsers",
155
+ GetTenants: "GetTenants",
156
+ GetRoles: "GetRoles",
157
+ GetAppConfig: "GetAppConfig",
158
+ GetFeatures: "GetFeatures",
159
+ GetTranslations: "GetTranslations",
160
+ GetPermissions: "GetPermissions",
161
+ GetUserRoles: "GetUserRoles",
162
+ SetUserDetail: "SetUserDetail",
163
+ GetEmailing: "GetEmailing",
164
+ GetAssignableRoles: "GetAssignableRoles",
165
+ GetProfile: "GetProfile",
166
+ GetProjects: "GetProjects",
167
+ GetProjectDetails: "GetProjectDetails",
168
+ GetProjectResultSet: "GetProjectResultSet",
169
+ DownlaodProjectsPoints: "DownlaodProjectsPoints",
170
+ GetProjectStatisticsByUser: "GetProjectStatisticsByUser",
171
+ GetContractStatisticsByUser: "GetContractStatisticsByUser",
172
+ GetGroupsInProject: "GetGroupsInProject",
173
+ UpdateActiveGroupsInProject: "UpdateActiveGroupsInProject",
174
+ GetProjectUsers: "GetProjectUsers",
175
+ GetUserProject: "GetUserProject",
176
+ SetProjectUser: "SetProjectUser",
177
+ GetLocations: "GetLocations",
178
+ UploadLocations: "UploadLocations",
179
+ GetLatestTaskOnLocation: "GetLatestTaskOnLocation",
180
+ GetTasksPerLocation: "GetTasksPerLocation",
181
+ GetTaskComment: "GetTaskComment",
182
+ GetTaskStatusList: "GetTaskStatusList",
183
+ GetTaskAnnotation: "GetTaskAnnotation",
184
+ GetTaskMultipleAnnotations: "GetTaskMultipleAnnotations",
185
+ GetTaskSavedAnnotations: "GetTaskSavedAnnotations",
186
+ DeleteTask: "DeleteTask",
187
+ GetApiImage: "GetApiImage",
188
+ GetCmsImage: "GetCmsImage",
189
+ GetQuestionnaireForProject: "GetQuestionnaireForProject",
190
+ GetTaskAnswers: "GetTaskAnswers",
191
+ UploadTasks: "UploadTasks",
192
+ UploadReviewTasks: "UploadReviewTasks"
193
+ };
194
+
195
+ // src/hooks/useEvolandBands.ts
196
+ import { useQuery } from "@tanstack/react-query";
197
+
198
+ // src/Constants/QueryNames.ts
199
+ var QueryNames = {
200
+ Users: "Users",
201
+ Tenants: "Tenants",
202
+ Roles: "Roles",
203
+ AppConfig: "AppConfig",
204
+ GetMapMenuItems: "GetMapMenuItems",
205
+ GetApps: "GetApps",
206
+ GetCountries: "GetCountries",
207
+ Clusters: "Clusters",
208
+ Cluster: "Cluster",
209
+ ClusterNewsWithId: "ClusterNewsWithId",
210
+ GetClusterOverview: "GetClusterOverview",
211
+ FilterClusters: "FilterClusters",
212
+ ClusterLookUp: "ClusterLookUp",
213
+ JoinRequests: "JoinRequests",
214
+ GetFarmerCluster: "GetFarmerCluster",
215
+ GetFarmerClusterNews: "GetFarmerClusterNews",
216
+ GetFarmerClusterMembers: "GetFarmerClusterMembers",
217
+ Menus: "Menus",
218
+ GetMenu: "GetMenu",
219
+ GetSettings: "GetSettings",
220
+ Layers: "Layers",
221
+ GetLayer: "GetLayer",
222
+ GetClusterForMap: "GetClusterForMap",
223
+ GetAppSettings: "GetAppSettings",
224
+ GetResource: "GetResource",
225
+ FileUpload: "FileUpload",
226
+ // PLOP_QUERY_NAMES
227
+ GetUserProfile: "GetUserProfile",
228
+ GetLookUp: "GetLookUp",
229
+ GetClusterFilterSettings: "GetClusterFilterSettings",
230
+ GetConfig: "GetConfig",
231
+ GetIntroTour: "GetIntroTour",
232
+ GetNews: "GetNews",
233
+ GetPublicationSettings: "GetPublicationSettings",
234
+ GetUseLayerInfo: "GetUseLayerInfo",
235
+ GetMapSettings: "GetMapSettings",
236
+ GetLanguages: "GetLanguages",
237
+ GetResourceFilter: "GetResourceFilter",
238
+ GetAudience: "GetAudience",
239
+ GetTopic: "GetTopic",
240
+ GetResourceType: "GetResourceType",
241
+ GetAvailableWmsLayers: "GetAvailableWmsLayers",
242
+ GetAvailableBands: "GetAvailableBands",
243
+ ClusterAllNews: "ClusterAllNews",
244
+ ClusterNews: "ClusterNews",
245
+ ClusterGetNews: "ClusterGetNews",
246
+ ClusterNewsNextPrevious: "ClusterNewsNextPrevious",
247
+ ClusterImages: "ClusterImages",
248
+ DefaultSettings: "DefaultSettings",
249
+ GetEvolandLabels: "GetEvolandLabels",
250
+ GetEvolandCombinationLabels: "GetEvolandCombinationLabels",
251
+ NewsFromAllClusters: "NewsFromAllClusters",
252
+ MapMenuItems: "MapMenuItems",
253
+ GetSocialLinks: "GetSocialLinks",
254
+ GetCmsContentWithType: "GetCmsContentWithType",
255
+ GetImagesAndVideos: "GetImagesAndVideos",
256
+ GetClusterDescription: "GetClusterDescription",
257
+ GetClusterDetails: "GetClusterDetails",
258
+ GetHost: "GetHost",
259
+ GetHosts: "GetHosts"
260
+ };
261
+
262
+ // src/hooks/useEvolandBands.ts
263
+ var useEvolandBands = () => {
264
+ return useQuery({
265
+ queryKey: [QueryNames.GetAvailableBands],
266
+ queryFn: () => {
267
+ }
268
+ });
269
+ };
270
+
271
+ // src/hooks/useEvolandWmsLayers.ts
272
+ import { useQuery as useQuery2 } from "@tanstack/react-query";
273
+ import { ProjectService } from "@geowiki/evoland-api-proxy";
274
+ var useEvolandWmsLayers = () => {
275
+ return useQuery2({
276
+ queryKey: [QueryNames.GetAvailableWmsLayers],
277
+ queryFn: () => __async(void 0, null, function* () {
278
+ const data = yield ProjectService.getAvailableLayersAvailablelayersGet();
279
+ return data;
280
+ })
281
+ });
282
+ };
283
+
284
+ // src/stores/config.ts
285
+ import { createStore } from "zustand/vanilla";
286
+ var configStore = createStore((set) => ({
287
+ apiUrl: "",
288
+ cmsUrl: "",
289
+ tenantId: "",
290
+ setApiUrl: (url) => set({ apiUrl: url }),
291
+ setCmsUrl: (url) => set({ cmsUrl: url }),
292
+ setTenant: (tenant) => set({ tenantId: tenant })
293
+ }));
294
+ var config_default = configStore;
295
+
296
+ // src/hooks/useApiUrl.ts
297
+ var useApiUrl = () => {
298
+ return config_default.getState().apiUrl;
299
+ };
300
+
301
+ // src/hooks/useAppConfig.ts
302
+ import { useQuery as useQuery3 } from "@tanstack/react-query";
303
+ import {
304
+ AbpApplicationConfigurationService
305
+ } from "@geowiki/api-proxy";
306
+ var useAppConfig = () => {
307
+ return useQuery3({
308
+ queryKey: [QueryConstants.GetAppConfig],
309
+ queryFn: () => __async(void 0, null, function* () {
310
+ const data = yield AbpApplicationConfigurationService.abpApplicationConfigurationGet();
311
+ return data;
312
+ }),
313
+ staleTime: 60 * 60 * 1e3
314
+ // 1 hour
315
+ });
316
+ };
317
+
318
+ // src/hooks/useAudience.ts
319
+ import { ResourceService } from "@geowiki/api-proxy";
320
+ import { keepPreviousData, useQuery as useQuery4 } from "@tanstack/react-query";
321
+ var useAudience = () => {
322
+ return useQuery4({
323
+ queryKey: [QueryNames.GetAudience],
324
+ queryFn: () => __async(void 0, null, function* () {
325
+ const data = yield ResourceService.resourceGetAvailableAudience();
326
+ return data;
327
+ }),
328
+ staleTime: 1e3 * 60 * 60 * 24,
329
+ gcTime: 1e3 * 60 * 60 * 24,
330
+ placeholderData: keepPreviousData
331
+ });
332
+ };
333
+
334
+ // src/hooks/useCluster.ts
335
+ import { ClusterService } from "@geowiki/api-proxy";
336
+ import { useQuery as useQuery5 } from "@tanstack/react-query";
337
+ var useCluster = (id) => {
338
+ return useQuery5({
339
+ queryKey: [QueryNames.Cluster, id],
340
+ queryFn: () => __async(void 0, null, function* () {
341
+ const data = yield ClusterService.clusterGet(id);
342
+ return data;
343
+ })
344
+ });
345
+ };
346
+
347
+ // src/hooks/useClusterFilterSettings.ts
348
+ import {
349
+ SettingsService
350
+ } from "@geowiki/cms-proxy";
351
+ import { useQuery as useQuery6 } from "@tanstack/react-query";
352
+ var useClusterFilterSettings = () => {
353
+ return useQuery6({
354
+ queryKey: [QueryNames.GetClusterFilterSettings],
355
+ queryFn: () => __async(void 0, null, function* () {
356
+ var req = yield SettingsService.settingsGetSiteSettings("ClusterFilter");
357
+ return req;
358
+ })
359
+ });
360
+ };
361
+ var useConfigSettings = () => {
362
+ return useQuery6({
363
+ queryKey: [QueryNames.GetConfig],
364
+ queryFn: () => __async(void 0, null, function* () {
365
+ var req = yield SettingsService.settingsGetSiteSettings("Config");
366
+ return req;
367
+ })
368
+ });
369
+ };
370
+
371
+ // src/hooks/useClusterMapInfo.ts
372
+ import { ClusterService as ClusterService2 } from "@geowiki/api-proxy";
373
+ import { useQuery as useQuery7 } from "@tanstack/react-query";
374
+ var useClusterMapInfo = () => {
375
+ return useQuery7({
376
+ queryKey: [QueryNames.GetClusterForMap],
377
+ queryFn: () => __async(void 0, null, function* () {
378
+ const data = yield ClusterService2.clusterGetMapInfo();
379
+ return data;
380
+ })
381
+ });
382
+ };
383
+
384
+ // src/hooks/useClusters.ts
385
+ import { ClusterService as ClusterService3 } from "@geowiki/api-proxy";
386
+ import { keepPreviousData as keepPreviousData2, useQuery as useQuery8 } from "@tanstack/react-query";
387
+ var useClusters = (fetchAll = false, sort = "", skip = 0, take = 100) => {
388
+ return useQuery8({
389
+ queryKey: [QueryNames.Clusters, skip, take],
390
+ queryFn: () => __async(void 0, null, function* () {
391
+ if (fetchAll) {
392
+ const data = yield ClusterService3.clusterGetAllClusters(
393
+ sort,
394
+ skip,
395
+ take
396
+ );
397
+ return data;
398
+ } else {
399
+ const data = yield ClusterService3.clusterGetList(sort, skip, take);
400
+ return data;
401
+ }
402
+ }),
403
+ placeholderData: keepPreviousData2
404
+ });
405
+ };
406
+ var useAllNewsFromAllClusters = (sort = "", skip = 0, take = 100) => {
407
+ return useQuery8({
408
+ queryKey: [QueryNames.GetFarmerClusterNews, sort, skip, take],
409
+ queryFn: () => __async(void 0, null, function* () {
410
+ const data = yield ClusterService3.clusterGetAllNewsFromAllClusters(
411
+ sort,
412
+ skip,
413
+ take
414
+ );
415
+ return data;
416
+ })
417
+ });
418
+ };
419
+
420
+ // src/hooks/useHosts.ts
421
+ import { useQuery as useQuery9 } from "@tanstack/react-query";
422
+ var getHosts = () => __async(void 0, null, function* () {
423
+ const response = yield fetch("/api/hosts");
424
+ if (!response.ok) {
425
+ throw new Error("Failed to fetch hosts");
426
+ }
427
+ return response.json();
428
+ });
429
+ function useHosts() {
430
+ return useQuery9({
431
+ queryKey: [QueryNames.GetHosts],
432
+ queryFn: getHosts,
433
+ staleTime: 5 * 60 * 1e3,
434
+ // 5 minutes
435
+ // React Query v5 renamed cacheTime to gcTime
436
+ gcTime: 10 * 60 * 1e3
437
+ // 10 minutes
438
+ });
439
+ }
440
+
441
+ // src/hooks/useCmsUrl.ts
442
+ var useCmsUrl = () => {
443
+ const { data: hosts, isLoading } = useHosts();
444
+ var cmsUrl = config_default.getState().cmsUrl;
445
+ if (!cmsUrl && !isLoading && hosts) {
446
+ console.error("CMS URL not found in the store");
447
+ var host = window.location.host;
448
+ var hostInfo = hosts.find((h) => h.host === host);
449
+ if (hostInfo) {
450
+ cmsUrl = hostInfo.cmsUrl;
451
+ }
452
+ }
453
+ return cmsUrl || "https://cms.geo-wiki.org";
454
+ };
455
+
456
+ // src/hooks/useCountries.ts
457
+ import { useQuery as useQuery10 } from "@tanstack/react-query";
458
+ import { ClusterService as ClusterService4 } from "@geowiki/api-proxy";
459
+ var useCountries = (fetchAll = false) => {
460
+ return useQuery10({
461
+ queryKey: [QueryNames.GetCountries, fetchAll],
462
+ queryFn: () => __async(void 0, null, function* () {
463
+ const data = yield ClusterService4.clusterGetCountries(fetchAll);
464
+ data.sort((a, b) => {
465
+ if (!a.country || !b.country) {
466
+ return -1;
467
+ }
468
+ if (a.country < b.country) {
469
+ return -1;
470
+ }
471
+ if (a.country > b.country) {
472
+ return 1;
473
+ }
474
+ return 0;
475
+ });
476
+ return data;
477
+ }),
478
+ gcTime: 1e3 * 60 * 60 * 24
479
+ // 24 hours
480
+ });
481
+ };
482
+
483
+ // src/hooks/useDimensions.ts
484
+ import { useEffect, useRef } from "react";
485
+ var useDimensions = (ref) => {
486
+ const dimensions = useRef({ width: 0, height: 0 });
487
+ useEffect(() => {
488
+ var _a, _b;
489
+ dimensions.current.width = (_a = ref.current) == null ? void 0 : _a.offsetWidth;
490
+ dimensions.current.height = (_b = ref.current) == null ? void 0 : _b.offsetHeight;
491
+ }, []);
492
+ return dimensions.current;
493
+ };
494
+
495
+ // src/hooks/useFeature.ts
496
+ var useFeature = (key) => {
497
+ var _a, _b, _c;
498
+ const { data } = useAppConfig();
499
+ return ((_c = (_b = (_a = data == null ? void 0 : data.features) == null ? void 0 : _a.values) == null ? void 0 : _b[key]) == null ? void 0 : _c.toLowerCase()) === "true";
500
+ };
501
+
502
+ // src/hooks/useFile.ts
503
+ import { FileService } from "@geowiki/api-proxy";
504
+ import { useQuery as useQuery11 } from "@tanstack/react-query";
505
+ var useFileUrl = () => {
506
+ var tenant = config_default.getState().tenantId;
507
+ var url = `${process.env.NEXT_PUBLIC_API_URL}/api/app/file/view?__tenant=${tenant}&id=`;
508
+ return url;
509
+ };
510
+ var useFileUpload = (formData) => {
511
+ return useQuery11({
512
+ queryKey: [QueryNames.FileUpload, formData],
513
+ queryFn: () => __async(void 0, null, function* () {
514
+ const data = yield FileService.fileUpload(formData);
515
+ return data;
516
+ })
517
+ });
518
+ };
519
+
520
+ // src/hooks/useFilterClusters.ts
521
+ import { ClusterService as ClusterService5 } from "@geowiki/api-proxy";
522
+ import { useQuery as useQuery12 } from "@tanstack/react-query";
523
+ var useFilterClusters = (filter) => {
524
+ return useQuery12({
525
+ queryKey: [
526
+ QueryNames.FilterClusters,
527
+ filter.skip,
528
+ filter.take,
529
+ filter.country,
530
+ filter.activityStatus,
531
+ filter.farmingSystem,
532
+ filter.mainCrop,
533
+ filter.mainAgriculturalAreas,
534
+ filter.sort
535
+ ],
536
+ queryFn: () => __async(void 0, null, function* () {
537
+ const data = yield ClusterService5.clusterFilter(filter);
538
+ return data;
539
+ })
540
+ });
541
+ };
542
+
543
+ // src/hooks/useGeoWikiSettings.ts
544
+ import { SettingsService as SettingsService2 } from "@geowiki/cms-proxy";
545
+ import { useQuery as useQuery13 } from "@tanstack/react-query";
546
+ var useGeoWikiSettings = () => {
547
+ return useQuery13({
548
+ queryKey: [QueryNames.GetAppSettings],
549
+ queryFn: () => __async(void 0, null, function* () {
550
+ var req = yield SettingsService2.settingsGetSiteSettings("GeoWiki");
551
+ return req;
552
+ })
553
+ });
554
+ };
555
+
556
+ // src/hooks/useImageUrl.ts
557
+ var useImageUrl = () => {
558
+ var cmsUrl = useCmsUrl();
559
+ return `${cmsUrl}/media/`;
560
+ };
561
+
562
+ // src/hooks/useIntroTourSettings.ts
563
+ import { SettingsService as SettingsService3 } from "@geowiki/cms-proxy";
564
+ import { useQuery as useQuery14 } from "@tanstack/react-query";
565
+ var useIntroTourSettings = () => {
566
+ return useQuery14({
567
+ queryKey: [QueryNames.GetIntroTour],
568
+ queryFn: () => __async(void 0, null, function* () {
569
+ var req = yield SettingsService3.settingsGetSiteSettings("IntroTour");
570
+ return req;
571
+ })
572
+ });
573
+ };
574
+
575
+ // src/hooks/useIsAdmin.ts
576
+ var useIsAdmin = () => {
577
+ var _a, _b;
578
+ const { data } = useAppConfig();
579
+ return (_b = (_a = data == null ? void 0 : data.currentUser) == null ? void 0 : _a.roles) == null ? void 0 : _b.includes("admin");
580
+ };
581
+
582
+ // src/hooks/useIsAuthenticated.ts
583
+ var useIsAuthenticated = () => {
584
+ var _a;
585
+ var { data } = useAppConfig();
586
+ return (_a = data == null ? void 0 : data.currentUser) == null ? void 0 : _a.isAuthenticated;
587
+ };
588
+
589
+ // src/hooks/useIsInRole.ts
590
+ var useIsInRole = (role) => {
591
+ var _a, _b;
592
+ const { data, isLoading } = useAppConfig();
593
+ return {
594
+ data: (_b = (_a = data == null ? void 0 : data.currentUser) == null ? void 0 : _a.roles) == null ? void 0 : _b.includes(role),
595
+ isLoading
596
+ };
597
+ };
598
+
599
+ // src/hooks/useLanguages.ts
600
+ import { ResourceService as ResourceService2 } from "@geowiki/api-proxy";
601
+ import { keepPreviousData as keepPreviousData3, useQuery as useQuery15 } from "@tanstack/react-query";
602
+ var useLanguages = () => {
603
+ return useQuery15({
604
+ queryKey: [QueryNames.GetLanguages],
605
+ queryFn: () => __async(void 0, null, function* () {
606
+ const data = yield ResourceService2.resourceGetAvailableLanguages();
607
+ return data;
608
+ }),
609
+ gcTime: 1e3 * 60 * 60 * 24,
610
+ staleTime: 1e3 * 60 * 60 * 24,
611
+ placeholderData: keepPreviousData3
612
+ });
613
+ };
614
+
615
+ // src/hooks/useLayerInfo.ts
616
+ import { useQuery as useQuery16 } from "@tanstack/react-query";
617
+ var useLayerInfo = (url, layerName) => {
618
+ return useQuery16({
619
+ queryKey: [QueryNames.GetUseLayerInfo, url, layerName],
620
+ queryFn: () => __async(void 0, null, function* () {
621
+ var legendUrl = url + "?service=WMS&version=1.1.0&request=GetLegendGraphic&layer=" + layerName + "&format=application/json";
622
+ var res = yield fetch(legendUrl);
623
+ var data = yield res.json();
624
+ return data;
625
+ })
626
+ });
627
+ };
628
+
629
+ // src/hooks/useLocation.ts
630
+ import { useEffect as useEffect2, useState } from "react";
631
+ import { ProjectService as ProjectService2, LocationService } from "@geowiki/evoland-api-proxy";
632
+ import { useQuery as useQuery17 } from "@tanstack/react-query";
633
+ function useLocation() {
634
+ const [location, setLocation] = useState();
635
+ useEffect2(() => {
636
+ navigator.geolocation.getCurrentPosition(function(position) {
637
+ setLocation(position.coords);
638
+ });
639
+ }, []);
640
+ return location;
641
+ }
642
+ var useLocationsForProject = (locationreq) => {
643
+ return useQuery17({
644
+ queryKey: [QueryConstants.GetLocations, locationreq],
645
+ queryFn: () => __async(void 0, null, function* () {
646
+ return ProjectService2.searchLocationsLocationsPost(locationreq);
647
+ })
648
+ });
649
+ };
650
+ var useLocationBulkUpload = (uploadLocations, file, project_id, group_id) => {
651
+ return useQuery17({
652
+ queryKey: [QueryConstants.UploadLocations, uploadLocations, file, group_id],
653
+ queryFn: () => __async(void 0, null, function* () {
654
+ try {
655
+ const res = yield LocationService.bulkUploadLocationsUploadlocationsPost({ file, project_id, group_id });
656
+ return res;
657
+ } catch (error) {
658
+ return { data: error.body, isLoading: false, error: true };
659
+ }
660
+ }),
661
+ enabled: !!uploadLocations && !!file && !!group_id
662
+ });
663
+ };
664
+ var useTaskBulkUpload = (uploadTasks, file, project_id) => {
665
+ return useQuery17({
666
+ queryKey: [QueryConstants.UploadTasks, uploadTasks, file],
667
+ queryFn: () => __async(void 0, null, function* () {
668
+ try {
669
+ return LocationService.uploadLocationTaskUploadlocationtaskPost({ file, project_id });
670
+ } catch (error) {
671
+ return { data: error.body, isLoading: false, error: true };
672
+ }
673
+ }),
674
+ enabled: !!uploadTasks && !!file
675
+ });
676
+ };
677
+ var useReviewTaskBulkUpload = (uploadReviewTasks, file, project_id) => {
678
+ return useQuery17({
679
+ queryKey: [QueryConstants.UploadReviewTasks, uploadReviewTasks, file],
680
+ queryFn: () => __async(void 0, null, function* () {
681
+ try {
682
+ return LocationService.bulkUploadReviewTasksUploadreviewtasksPost({ file, project_id });
683
+ } catch (error) {
684
+ return { data: error.body, isLoading: false, error: true };
685
+ }
686
+ }),
687
+ enabled: !!uploadReviewTasks && !!file
688
+ });
689
+ };
690
+
691
+ // src/hooks/useLockBodyScroll.ts
692
+ import { useEffect as useEffect3 } from "react";
693
+ function useLockBodyScroll() {
694
+ useEffect3(() => {
695
+ const originalStyle = window.getComputedStyle(document.body).overflow;
696
+ document.body.style.overflow = "hidden";
697
+ return () => {
698
+ document.body.style.overflow = originalStyle;
699
+ };
700
+ }, []);
701
+ }
702
+
703
+ // src/hooks/useMapSettings.ts
704
+ import { SettingsService as SettingsService4 } from "@geowiki/cms-proxy";
705
+ import { useQuery as useQuery18 } from "@tanstack/react-query";
706
+
707
+ // src/hooks/useNews.ts
708
+ import { keepPreviousData as keepPreviousData4, useQuery as useQuery19 } from "@tanstack/react-query";
709
+ import { NewsService } from "@geowiki/api-proxy";
710
+ var useNews = (lang = "all", skip = 0, take = 100) => {
711
+ return useQuery19({
712
+ queryKey: [QueryNames.GetNews, lang, skip, take],
713
+ queryFn: () => __async(void 0, null, function* () {
714
+ if (lang == "all") {
715
+ const res2 = yield NewsService.newsGetExternalNews("", skip, take);
716
+ return res2.items;
717
+ }
718
+ const res = yield NewsService.newsGetExternalNewsByLanguage(
719
+ "",
720
+ skip,
721
+ take,
722
+ lang
723
+ );
724
+ return res.items;
725
+ }),
726
+ gcTime: 1e3 * 60 * 60 * 24,
727
+ placeholderData: keepPreviousData4,
728
+ staleTime: 1e3 * 60 * 60 * 24
729
+ });
730
+ };
731
+
732
+ // src/hooks/usePagination.ts
733
+ import { useMemo } from "react";
734
+ var range = (start, end) => {
735
+ let length = end - start + 1;
736
+ return Array.from({ length }, (_, idx) => idx + start);
737
+ };
738
+ var DOTS = "...";
739
+ var usePagination = ({
740
+ totalCount,
741
+ pageSize,
742
+ siblingCount = 1,
743
+ currentPage
744
+ }) => {
745
+ const paginationRange = useMemo(() => {
746
+ const totalPageCount = Math.ceil(totalCount / pageSize);
747
+ const totalPageNumbers = siblingCount + 5;
748
+ if (totalPageNumbers >= totalPageCount) {
749
+ return range(1, totalPageCount);
750
+ }
751
+ const leftSiblingIndex = Math.max(currentPage - siblingCount, 1);
752
+ const rightSiblingIndex = Math.min(
753
+ currentPage + siblingCount,
754
+ totalPageCount
755
+ );
756
+ const shouldShowLeftDots = leftSiblingIndex > 2;
757
+ const shouldShowRightDots = rightSiblingIndex < totalPageCount - 2;
758
+ const firstPageIndex = 1;
759
+ const lastPageIndex = totalPageCount;
760
+ if (!shouldShowLeftDots && shouldShowRightDots) {
761
+ let leftItemCount = 3 + 2 * siblingCount;
762
+ let leftRange = range(1, leftItemCount);
763
+ return [...leftRange, DOTS, totalPageCount];
764
+ }
765
+ if (shouldShowLeftDots && !shouldShowRightDots) {
766
+ let rightItemCount = 3 + 2 * siblingCount;
767
+ let rightRange = range(
768
+ totalPageCount - rightItemCount + 1,
769
+ totalPageCount
770
+ );
771
+ return [firstPageIndex, DOTS, ...rightRange];
772
+ }
773
+ if (shouldShowLeftDots && shouldShowRightDots) {
774
+ let middleRange = range(leftSiblingIndex, rightSiblingIndex);
775
+ return [firstPageIndex, DOTS, ...middleRange, DOTS, lastPageIndex];
776
+ }
777
+ }, [totalCount, pageSize, siblingCount, currentPage]);
778
+ return paginationRange;
779
+ };
780
+
781
+ // src/hooks/usePermission.ts
782
+ var usePermission = (key) => {
783
+ var _a, _b;
784
+ var { data } = useAppConfig();
785
+ return ((_b = (_a = data == null ? void 0 : data.auth) == null ? void 0 : _a.grantedPolicies) == null ? void 0 : _b[key]) === true;
786
+ };
787
+
788
+ // src/hooks/usePublicationSettings.ts
789
+ import {
790
+ SettingsService as SettingsService5
791
+ } from "@geowiki/cms-proxy";
792
+ import { useQuery as useQuery20 } from "@tanstack/react-query";
793
+ var usePublicationSettings = () => {
794
+ return useQuery20({
795
+ queryKey: [QueryNames.GetPublicationSettings],
796
+ queryFn: () => __async(void 0, null, function* () {
797
+ var req = yield SettingsService5.settingsGetSiteSettings("Publication");
798
+ return req;
799
+ })
800
+ });
801
+ };
802
+
803
+ // src/hooks/useResource.ts
804
+ import { ResourceService as ResourceService3 } from "@geowiki/api-proxy";
805
+ import { keepPreviousData as keepPreviousData5, useQuery as useQuery21 } from "@tanstack/react-query";
806
+ var useResource = (search = "", sort = "", skip = 0, take = 100) => {
807
+ return useQuery21({
808
+ queryKey: [QueryNames.GetResource, search, sort, skip, take],
809
+ queryFn: () => __async(void 0, null, function* () {
810
+ if (search !== "") {
811
+ const data2 = yield ResourceService3.resourceSearch(search);
812
+ return data2;
813
+ }
814
+ const data = yield ResourceService3.resourceGetAll(sort, skip, take);
815
+ return data;
816
+ }),
817
+ gcTime: 1e3 * 60 * 60 * 24,
818
+ staleTime: 1e3 * 60 * 60 * 24,
819
+ placeholderData: keepPreviousData5
820
+ });
821
+ };
822
+
823
+ // src/hooks/useResourceFilter.ts
824
+ import { ResourceService as ResourceService4 } from "@geowiki/api-proxy";
825
+ import { useQuery as useQuery22 } from "@tanstack/react-query";
826
+ var useResourceFilter = (filter) => {
827
+ return useQuery22({
828
+ queryKey: [
829
+ QueryNames.GetResourceFilter,
830
+ filter.from,
831
+ filter.language,
832
+ filter.topic,
833
+ filter.resourceType,
834
+ filter.search,
835
+ filter.audience,
836
+ filter.currentPage,
837
+ filter.pageSize,
838
+ filter.sorting,
839
+ filter.isFramework
840
+ ],
841
+ queryFn: () => __async(void 0, null, function* () {
842
+ const data = yield ResourceService4.resourceFilter(filter);
843
+ return data;
844
+ })
845
+ });
846
+ };
847
+
848
+ // src/hooks/useResourceType.ts
849
+ import { ResourceService as ResourceService5 } from "@geowiki/api-proxy";
850
+ import { useQuery as useQuery23 } from "@tanstack/react-query";
851
+ var useResourceType = () => {
852
+ return useQuery23({
853
+ queryKey: [QueryNames.GetResourceType],
854
+ queryFn: () => __async(void 0, null, function* () {
855
+ var data = yield ResourceService5.resourceGetAvailableResourceType();
856
+ return data;
857
+ })
858
+ });
859
+ };
860
+
861
+ // src/hooks/useTopic.ts
862
+ import { ResourceService as ResourceService6 } from "@geowiki/api-proxy";
863
+ import { keepPreviousData as keepPreviousData6, useQuery as useQuery24 } from "@tanstack/react-query";
864
+ var useTopic = () => {
865
+ return useQuery24({
866
+ queryKey: [QueryNames.GetTopic],
867
+ queryFn: () => __async(void 0, null, function* () {
868
+ var data = yield ResourceService6.resourceGetAvailableTopic();
869
+ return data;
870
+ }),
871
+ gcTime: 1e3 * 60 * 60 * 24,
872
+ staleTime: 1e3 * 60 * 60 * 24,
873
+ placeholderData: keepPreviousData6
874
+ });
875
+ };
876
+
877
+ // src/hooks/useUserProfile.ts
878
+ import { useQuery as useQuery25 } from "@tanstack/react-query";
879
+ import { ProfileService } from "@geowiki/api-proxy";
880
+ var useUserProfileGet = () => {
881
+ return useQuery25({
882
+ queryKey: [QueryNames.GetUserProfile],
883
+ queryFn: () => __async(void 0, null, function* () {
884
+ var data = yield ProfileService.profileGet();
885
+ return data;
886
+ })
887
+ });
888
+ };
889
+
890
+ // src/hooks/useUsers.ts
891
+ import { useQuery as useQuery26 } from "@tanstack/react-query";
892
+ import { UserService } from "@geowiki/api-proxy";
893
+ var useUsers = (pageIndex, pageSize, filter, sorting) => {
894
+ return useQuery26({
895
+ queryKey: [QueryConstants.GetUsers, pageIndex, pageSize, filter, sorting],
896
+ queryFn: () => __async(void 0, null, function* () {
897
+ let skip = 0;
898
+ if (pageIndex > 0) {
899
+ skip = pageIndex * pageSize;
900
+ }
901
+ const data = yield UserService.userGetList(
902
+ filter ? filter : void 0,
903
+ sorting ? sorting : void 0,
904
+ skip,
905
+ pageSize
906
+ );
907
+ return data;
908
+ })
909
+ });
910
+ };
911
+
912
+ // src/hooks/useRenderInfo.ts
913
+ import React from "react";
914
+ function useRenderInfo(name = "Unknown") {
915
+ const count = React.useRef(0);
916
+ const lastRender = React.useRef();
917
+ const now = Date.now();
918
+ count.current++;
919
+ React.useEffect(() => {
920
+ lastRender.current = Date.now();
921
+ });
922
+ const sinceLastRender = lastRender.current ? now - lastRender.current : 0;
923
+ if (process.env.NODE_ENV !== "production") {
924
+ const info = {
925
+ name,
926
+ renders: count.current,
927
+ sinceLastRender,
928
+ timestamp: now
929
+ };
930
+ return info;
931
+ }
932
+ }
933
+
934
+ // src/hooks/useDefaultSettings.ts
935
+ import { SettingsService as SettingsService6 } from "@geowiki/cms-proxy";
936
+ import { useQuery as useQuery27 } from "@tanstack/react-query";
937
+ var useDefaultSettings = () => {
938
+ return useQuery27({
939
+ queryKey: [QueryNames.DefaultSettings],
940
+ queryFn: () => __async(void 0, null, function* () {
941
+ const req = yield SettingsService6.settingsGetDefaultSiteSettings();
942
+ return req;
943
+ })
944
+ });
945
+ };
946
+
947
+ // src/hooks/useCurrentUser.ts
948
+ var useCurrentUser = () => {
949
+ const { data } = useAppConfig();
950
+ return data == null ? void 0 : data.currentUser;
951
+ };
952
+
953
+ // src/hooks/useEmailing.ts
954
+ import { EmailSettingsService } from "@geowiki/api-proxy";
955
+ import { useQuery as useQuery28 } from "@tanstack/react-query";
956
+ var useEmailing = () => {
957
+ return useQuery28({
958
+ queryKey: [QueryConstants.GetEmailing],
959
+ queryFn: () => __async(void 0, null, function* () {
960
+ const data = yield EmailSettingsService.emailSettingsGet();
961
+ return data;
962
+ })
963
+ });
964
+ };
965
+
966
+ // src/hooks/useGrantedPolicies.ts
967
+ import { useCallback } from "react";
968
+ var useGrantedPolicies = () => {
969
+ var _a;
970
+ const { data } = useAppConfig();
971
+ const can = useCallback(
972
+ (key) => {
973
+ var _a2;
974
+ if (((_a2 = data == null ? void 0 : data.auth) == null ? void 0 : _a2.grantedPolicies) && !!data.auth.grantedPolicies[key])
975
+ return true;
976
+ return false;
977
+ },
978
+ [(_a = data == null ? void 0 : data.auth) == null ? void 0 : _a.grantedPolicies]
979
+ );
980
+ return { can };
981
+ };
982
+
983
+ // src/hooks/useFeatures.ts
984
+ import { FeaturesService } from "@geowiki/api-proxy";
985
+ import { useQuery as useQuery29 } from "@tanstack/react-query";
986
+ var useFeatures = (providerName, providerKey) => {
987
+ return useQuery29({
988
+ queryKey: [QueryConstants.GetFeatures, providerName, providerKey],
989
+ queryFn: () => __async(void 0, null, function* () {
990
+ const data = yield FeaturesService.featuresGet(providerName, providerKey);
991
+ return data;
992
+ })
993
+ });
994
+ };
995
+
996
+ // src/hooks/useAssignableRoles.ts
997
+ import { useQuery as useQuery30 } from "@tanstack/react-query";
998
+ import { UserService as UserService2 } from "@geowiki/api-proxy";
999
+ var useAssignableRoles = () => {
1000
+ return useQuery30({
1001
+ queryKey: [QueryConstants.GetAssignableRoles],
1002
+ queryFn: () => __async(void 0, null, function* () {
1003
+ const data = yield UserService2.userGetAssignableRoles();
1004
+ return data;
1005
+ })
1006
+ });
1007
+ };
1008
+
1009
+ // src/hooks/useUserRoles.ts
1010
+ import { UserService as UserService3 } from "@geowiki/api-proxy";
1011
+ import { useQuery as useQuery31 } from "@tanstack/react-query";
1012
+ var useUserRoles = ({ userId }) => {
1013
+ return useQuery31({
1014
+ queryKey: [QueryConstants.GetUserRoles, userId],
1015
+ queryFn: () => __async(void 0, null, function* () {
1016
+ const data = yield UserService3.userGetRoles(userId);
1017
+ return data;
1018
+ })
1019
+ });
1020
+ };
1021
+
1022
+ // src/hooks/usePermissions.ts
1023
+ import {
1024
+ PermissionsService
1025
+ } from "@geowiki/api-proxy";
1026
+ import { useQuery as useQuery32 } from "@tanstack/react-query";
1027
+ var usePermissions = (providerName, providerKey) => {
1028
+ return useQuery32({
1029
+ queryKey: [QueryConstants.GetPermissions, providerName, providerKey],
1030
+ queryFn: () => __async(void 0, null, function* () {
1031
+ const data = yield PermissionsService.permissionsGet(
1032
+ providerName,
1033
+ providerKey
1034
+ );
1035
+ return data;
1036
+ })
1037
+ });
1038
+ };
1039
+
1040
+ // src/hooks/useRoles.ts
1041
+ import { useQuery as useQuery33 } from "@tanstack/react-query";
1042
+ import { RoleService } from "@geowiki/api-proxy";
1043
+ var useRoles = (pageIndex, pageSize, filter, sorting) => {
1044
+ return useQuery33({
1045
+ queryKey: [QueryConstants.GetRoles, pageIndex, pageSize, filter, sorting],
1046
+ queryFn: () => __async(void 0, null, function* () {
1047
+ let skip = 0;
1048
+ if (pageIndex > 0) {
1049
+ skip = pageIndex * pageSize;
1050
+ }
1051
+ const data = yield RoleService.roleGetList(
1052
+ filter ? filter : void 0,
1053
+ sorting ? sorting : void 0,
1054
+ skip,
1055
+ pageSize
1056
+ );
1057
+ return data;
1058
+ })
1059
+ });
1060
+ };
1061
+
1062
+ // src/hooks/useProfile.ts
1063
+ import { ProfileService as ProfileService2 } from "@geowiki/api-proxy";
1064
+ import { useQuery as useQuery34 } from "@tanstack/react-query";
1065
+ var useProfile = () => {
1066
+ return useQuery34({
1067
+ queryKey: [QueryConstants.GetProfile],
1068
+ queryFn: () => __async(void 0, null, function* () {
1069
+ const data = yield ProfileService2.profileGet();
1070
+ return data;
1071
+ })
1072
+ });
1073
+ };
1074
+
1075
+ // src/hooks/useTenants.ts
1076
+ import { useQuery as useQuery35 } from "@tanstack/react-query";
1077
+ import { TenantService } from "@geowiki/api-proxy";
1078
+ var useTenants = (pageIndex, pageSize, filter, sorting) => {
1079
+ return useQuery35({
1080
+ queryKey: [QueryConstants.GetTenants, pageIndex, pageSize, filter, sorting],
1081
+ queryFn: () => __async(void 0, null, function* () {
1082
+ let skip = 0;
1083
+ if (pageIndex > 0) {
1084
+ skip = pageIndex * pageSize;
1085
+ }
1086
+ const data = yield TenantService.tenantGetList(
1087
+ filter ? filter : void 0,
1088
+ sorting ? sorting : void 0,
1089
+ skip,
1090
+ pageSize
1091
+ );
1092
+ return data;
1093
+ })
1094
+ });
1095
+ };
1096
+
1097
+ // src/hooks/useEvolandLabels.ts
1098
+ import { useQuery as useQuery36 } from "@tanstack/react-query";
1099
+ import { ProjectService as ProjectService3 } from "@geowiki/evoland-api-proxy";
1100
+ var useEvolandLabels = (projectId) => {
1101
+ return useQuery36({
1102
+ queryKey: [QueryNames.GetEvolandLabels, projectId],
1103
+ queryFn: () => __async(void 0, null, function* () {
1104
+ const data = yield ProjectService3.getLabelsLabelsProjectIdProjectIdGet(projectId);
1105
+ return data;
1106
+ })
1107
+ });
1108
+ };
1109
+
1110
+ // src/hooks/useLookUp.ts
1111
+ import { useQuery as useQuery37 } from "@tanstack/react-query";
1112
+ import { ClusterService as ClusterService6 } from "@geowiki/api-proxy";
1113
+ var useLookUp = (ServiceName, params, LookUpsClusterCountries, LookUpsClusterActivityStatus, LookUpsClusterFarmingSystem, LookUpsClusterMainAgricultureArea, LookUpsClusterMainCrops) => {
1114
+ let result;
1115
+ return useQuery37({
1116
+ queryKey: [QueryNames.GetLookUp, ServiceName, params],
1117
+ queryFn: () => __async(void 0, null, function* () {
1118
+ switch (ServiceName) {
1119
+ case LookUpsClusterCountries: {
1120
+ result = yield ClusterService6.clusterGetCountries(params);
1121
+ break;
1122
+ }
1123
+ case LookUpsClusterActivityStatus: {
1124
+ result = yield ClusterService6.clusterGetActivityStatus(params);
1125
+ break;
1126
+ }
1127
+ case LookUpsClusterFarmingSystem: {
1128
+ result = yield ClusterService6.clusterGetFarmingSystems(params);
1129
+ break;
1130
+ }
1131
+ case LookUpsClusterMainAgricultureArea: {
1132
+ result = yield ClusterService6.clusterGetMainAgriculturalAreas(params);
1133
+ break;
1134
+ }
1135
+ case LookUpsClusterMainCrops: {
1136
+ result = yield ClusterService6.clusterGetMainCrops(params);
1137
+ break;
1138
+ }
1139
+ }
1140
+ return result;
1141
+ })
1142
+ });
1143
+ };
1144
+
1145
+ // src/hooks/useProjects.ts
1146
+ import { useQuery as useQuery38, keepPreviousData as keepPreviousData7 } from "@tanstack/react-query";
1147
+ import {
1148
+ ProjectService as ProjectService4,
1149
+ TaskService,
1150
+ TaskStatus,
1151
+ StatisticService,
1152
+ QuestionService
1153
+ } from "@geowiki/evoland-api-proxy";
1154
+ var useProjects = (fetch2, start = 0, amount = 9) => {
1155
+ return useQuery38({
1156
+ queryKey: [QueryConstants.GetProjects, fetch2, start, amount],
1157
+ queryFn: () => __async(void 0, null, function* () {
1158
+ if (fetch2)
1159
+ return ProjectService4.listProjectsListprojectsStartidxStartidxAmountAmountGet(
1160
+ start,
1161
+ amount
1162
+ );
1163
+ })
1164
+ });
1165
+ };
1166
+ var useProjectDetails = (projectId, update) => {
1167
+ return useQuery38({
1168
+ queryKey: [QueryConstants.GetProjectDetails, projectId, update],
1169
+ queryFn: () => __async(void 0, null, function* () {
1170
+ return ProjectService4.projectInfoProjectinfoProjectIdProjectIdGet(
1171
+ projectId
1172
+ );
1173
+ })
1174
+ });
1175
+ };
1176
+ var useTasksPerLocation = (data) => {
1177
+ return useQuery38({
1178
+ queryKey: [QueryConstants.GetTasksPerLocation, data],
1179
+ queryFn: () => __async(void 0, null, function* () {
1180
+ return ProjectService4.getTasksTasksGet(
1181
+ data.locationProjectId,
1182
+ data.taskForReview,
1183
+ null,
1184
+ data.orderBy,
1185
+ data.search,
1186
+ TaskStatus[data.status],
1187
+ null,
1188
+ null,
1189
+ null,
1190
+ data.pageIdx,
1191
+ data.pageSize,
1192
+ data.userId,
1193
+ data.userUserAlias,
1194
+ data.userOrderBy,
1195
+ data.locationLocationId,
1196
+ data.locationOrderBy,
1197
+ data.groupName,
1198
+ data.groupOrderBy
1199
+ );
1200
+ }),
1201
+ placeholderData: keepPreviousData7
1202
+ });
1203
+ };
1204
+ var useRandomTasksPerLocation = (data) => {
1205
+ return useQuery38({
1206
+ queryKey: [QueryConstants.GetTasksPerLocation, data],
1207
+ queryFn: () => __async(void 0, null, function* () {
1208
+ return ProjectService4.getRandomTaskRandomtaskGet(
1209
+ data.locationProjectId,
1210
+ data.taskForReview,
1211
+ null,
1212
+ data.orderBy == "" ? null : data.orderBy,
1213
+ data.search == "" ? null : data.search,
1214
+ TaskStatus[data.status],
1215
+ data.statusIn == "" ? null : data.statusIn,
1216
+ data.dateLte == "" ? null : data.dateLte,
1217
+ data.dateGte == "" ? null : data.dateGte,
1218
+ data.pageIdx,
1219
+ data.pageSize,
1220
+ data.userId == "" ? null : data.userId,
1221
+ data.userUserAlias == "" ? null : data.userUserAlias,
1222
+ data.userOrderBy == "" ? null : data.userOrderBy,
1223
+ data.locationLocationId == "" ? null : data.locationLocationId,
1224
+ data.locationOrderBy == "" ? null : data.locationOrderBy,
1225
+ data.groupName == "" ? null : data.groupName
1226
+ );
1227
+ }),
1228
+ placeholderData: keepPreviousData7
1229
+ });
1230
+ };
1231
+ var useTaskComments = (taskIds) => {
1232
+ return useQuery38({
1233
+ queryKey: [QueryConstants.GetTaskComment, taskIds],
1234
+ queryFn: () => __async(void 0, null, function* () {
1235
+ return TaskService.taskLatestComomentsTasklatestcommentPost({
1236
+ task_ids: taskIds
1237
+ });
1238
+ })
1239
+ });
1240
+ };
1241
+ var useGroupsInProject = (projectId, updateGroup) => {
1242
+ return useQuery38({
1243
+ queryKey: [QueryConstants.GetGroupsInProject, projectId, updateGroup],
1244
+ queryFn: () => __async(void 0, null, function* () {
1245
+ return ProjectService4.getProjectGroupsProjectgroupsProjectIdProjectIdGet(
1246
+ projectId
1247
+ );
1248
+ })
1249
+ });
1250
+ };
1251
+ var useProjectUsers = (projectId) => {
1252
+ return useQuery38({
1253
+ queryKey: [QueryConstants.GetProjectUsers, projectId],
1254
+ queryFn: () => __async(void 0, null, function* () {
1255
+ return ProjectService4.projectAllUsersProjectusersProjectIdProjectIdGet(
1256
+ projectId
1257
+ );
1258
+ })
1259
+ });
1260
+ };
1261
+ var useTaskStatusList = () => {
1262
+ return useQuery38({
1263
+ queryKey: [QueryConstants.GetTaskStatusList],
1264
+ queryFn: () => __async(void 0, null, function* () {
1265
+ return TaskService.getTaskStatusesTaskstatusesGet();
1266
+ })
1267
+ });
1268
+ };
1269
+ var useUpdateActiveGroupInProject = (projectId, groupId, update) => {
1270
+ return useQuery38({
1271
+ queryKey: [
1272
+ QueryConstants.UpdateActiveGroupsInProject,
1273
+ projectId,
1274
+ groupId,
1275
+ update
1276
+ ],
1277
+ queryFn: () => __async(void 0, null, function* () {
1278
+ if (update)
1279
+ return ProjectService4.selectProjectGroupProjectselectgroupPost({
1280
+ project_id: projectId,
1281
+ group_id: groupId
1282
+ });
1283
+ })
1284
+ });
1285
+ };
1286
+ var useTaskAnnotation = (taskId) => {
1287
+ return useQuery38({
1288
+ queryKey: [QueryConstants.GetTaskAnnotation, taskId],
1289
+ queryFn: () => __async(void 0, null, function* () {
1290
+ if (taskId !== null && taskId !== 0 && taskId !== void 0)
1291
+ return TaskService.getTaskAnnotationAssetTaskannotationTaskIdTaskIdGet(
1292
+ taskId
1293
+ );
1294
+ })
1295
+ });
1296
+ };
1297
+ var useTaskMultipleAnnotations = (taskId) => {
1298
+ return useQuery38({
1299
+ queryKey: [QueryConstants.GetTaskMultipleAnnotations, taskId],
1300
+ queryFn: () => __async(void 0, null, function* () {
1301
+ if (taskId !== null && taskId !== 0 && taskId !== void 0)
1302
+ return TaskService.getTaskAnnotationAssetsTaskannotationsTaskIdTaskIdGet(
1303
+ taskId
1304
+ );
1305
+ })
1306
+ });
1307
+ };
1308
+ var useTaskSavedAnnotations = (taskId) => {
1309
+ return useQuery38({
1310
+ queryKey: [QueryConstants.GetTaskSavedAnnotations, taskId],
1311
+ queryFn: () => __async(void 0, null, function* () {
1312
+ if (taskId !== null && taskId !== 0 && taskId !== void 0)
1313
+ return TaskService.getSavedAnnotationGetsavedannotationTaskIdTaskIdGet(
1314
+ taskId
1315
+ );
1316
+ })
1317
+ });
1318
+ };
1319
+ var useTaskDelete = (taskId, projectId, deleteTask) => {
1320
+ return useQuery38({
1321
+ queryKey: [QueryConstants.DeleteTask, taskId, projectId, deleteTask],
1322
+ queryFn: () => __async(void 0, null, function* () {
1323
+ if (taskId !== null && taskId !== void 0 && taskId !== 0 && deleteTask === true)
1324
+ return TaskService.deleteTaskDeletetaskPost({
1325
+ project_id: projectId,
1326
+ task_id: taskId
1327
+ });
1328
+ })
1329
+ });
1330
+ };
1331
+ var useProjectStatisticsByUser = (projectId, startDate, endDate, filterUserId) => {
1332
+ return useQuery38({
1333
+ queryKey: [
1334
+ QueryConstants.GetProjectStatisticsByUser,
1335
+ projectId,
1336
+ startDate,
1337
+ endDate,
1338
+ filterUserId
1339
+ ],
1340
+ queryFn: () => __async(void 0, null, function* () {
1341
+ return StatisticService.getUserStatisticsUserstatisticsProjectIdProjectIdStartDateStartDateEndDateEndDateFilterUserIdFilterUserIdGet(
1342
+ projectId,
1343
+ endDate,
1344
+ startDate,
1345
+ filterUserId
1346
+ );
1347
+ })
1348
+ });
1349
+ };
1350
+ var useContractStatisticsByUser = (projectId, startDate, endDate, filterUserId) => {
1351
+ return useQuery38({
1352
+ queryKey: [
1353
+ QueryConstants.GetContractStatisticsByUser,
1354
+ projectId,
1355
+ startDate,
1356
+ endDate,
1357
+ filterUserId
1358
+ ],
1359
+ queryFn: () => __async(void 0, null, function* () {
1360
+ return StatisticService.getUserStatisticsUserstatisticsProjectIdProjectIdStartDateStartDateEndDateEndDateFilterUserIdFilterUserIdGet(
1361
+ projectId,
1362
+ endDate,
1363
+ startDate,
1364
+ filterUserId,
1365
+ true
1366
+ );
1367
+ })
1368
+ });
1369
+ };
1370
+ var useLatestTaskOnLocation = (locationId, projectId, referenceDate) => {
1371
+ return useQuery38({
1372
+ queryKey: [
1373
+ QueryConstants.GetLatestTaskOnLocation,
1374
+ locationId,
1375
+ projectId,
1376
+ referenceDate
1377
+ ],
1378
+ queryFn: () => __async(void 0, null, function* () {
1379
+ return ProjectService4.locationLatestTaskLocationtaskLocationIdLocationIdProjectIdProjectIdReferenceDateReferenceDateGet(
1380
+ locationId,
1381
+ projectId,
1382
+ referenceDate
1383
+ );
1384
+ })
1385
+ });
1386
+ };
1387
+ var useAssignProjectToUser = (userRoleRequest, update) => {
1388
+ return useQuery38({
1389
+ queryKey: [QueryConstants.GetProjectDetails, userRoleRequest, update],
1390
+ queryFn: () => __async(void 0, null, function* () {
1391
+ if (update)
1392
+ return ProjectService4.setUserRoleSetuserrolePost(userRoleRequest);
1393
+ }),
1394
+ enabled: !!update && !!userRoleRequest
1395
+ });
1396
+ };
1397
+ var useGetUserProject = (user_id, fetchData) => {
1398
+ return useQuery38({
1399
+ queryKey: [QueryConstants.GetUserProject, user_id, fetchData],
1400
+ queryFn: () => __async(void 0, null, function* () {
1401
+ if (fetchData)
1402
+ return ProjectService4.getUserRoleProjectGetuserroleprojectUserIdUserIdGet(
1403
+ user_id
1404
+ );
1405
+ })
1406
+ });
1407
+ };
1408
+ var useUpdateUserDetail = (userDetailRequest, update) => {
1409
+ return useQuery38({
1410
+ queryKey: [QueryConstants.SetUserDetail, userDetailRequest, update],
1411
+ queryFn: () => __async(void 0, null, function* () {
1412
+ if (update)
1413
+ return ProjectService4.setUserDetailSetuserdetailPost(userDetailRequest);
1414
+ })
1415
+ });
1416
+ };
1417
+ var useProjectsPointsDownload = (projectId, download, userRole) => {
1418
+ return useQuery38({
1419
+ queryKey: [
1420
+ QueryConstants.DownlaodProjectsPoints,
1421
+ projectId,
1422
+ download,
1423
+ userRole
1424
+ ],
1425
+ queryFn: () => __async(void 0, null, function* () {
1426
+ if (userRole == "admin" && download)
1427
+ return ProjectService4.getLocationsSummaryLocationssummaryProjectIdProjectIdGet(
1428
+ projectId
1429
+ );
1430
+ })
1431
+ });
1432
+ };
1433
+ var useQuestionnaire = (projectId) => {
1434
+ return useQuery38({
1435
+ queryKey: [QueryConstants.GetQuestionnaireForProject, projectId],
1436
+ queryFn: () => __async(void 0, null, function* () {
1437
+ return QuestionService.getProjectQuestionsAnswersQuestionsAnswersProjectIdProjectIdGet(
1438
+ projectId
1439
+ );
1440
+ })
1441
+ });
1442
+ };
1443
+ var useTaskAnswers = (taskId) => {
1444
+ return useQuery38({
1445
+ queryKey: [QueryConstants.GetTaskAnswers, taskId],
1446
+ queryFn: () => __async(void 0, null, function* () {
1447
+ return TaskService.getTaskAnswersTaskanswersTaskIdTaskIdGet(taskId);
1448
+ })
1449
+ });
1450
+ };
1451
+ var useProjectResultSet = (download, projectId, is_geo_json) => {
1452
+ return useQuery38({
1453
+ queryKey: [QueryConstants.GetProjectResultSet, download, projectId, is_geo_json],
1454
+ queryFn: () => __async(void 0, null, function* () {
1455
+ return ProjectService4.projectResultSetProjectresultsetProjectIdProjectIdIsGeoJsonIsGeoJsonGet(projectId, is_geo_json);
1456
+ }),
1457
+ enabled: !!download && !!projectId
1458
+ });
1459
+ };
1460
+
1461
+ // src/hooks/useApiImage.tsx
1462
+ import { useQuery as useQuery39 } from "@tanstack/react-query";
1463
+ var useApiImage = (imageId) => {
1464
+ return useQuery39({
1465
+ queryKey: [QueryConstants.GetApiImage, imageId],
1466
+ queryFn: () => __async(void 0, null, function* () {
1467
+ const res = yield fetch(`/api/api-image/${imageId}`);
1468
+ const data = yield res.json();
1469
+ return data.fileUrl;
1470
+ })
1471
+ });
1472
+ };
1473
+
1474
+ // src/hooks/useCmsImage.tsx
1475
+ import { useQuery as useQuery40 } from "@tanstack/react-query";
1476
+ var useCmsImage = (imageId) => {
1477
+ return useQuery40({
1478
+ queryKey: [QueryConstants.GetCmsImage, imageId],
1479
+ queryFn: () => __async(void 0, null, function* () {
1480
+ const res = yield fetch(`/api/cms-image/${imageId}`);
1481
+ const data = yield res.json();
1482
+ return data.fileUrl;
1483
+ })
1484
+ });
1485
+ };
1486
+
1487
+ // src/hooks/useClusterGetJoinRequests.ts
1488
+ import { ClusterService as ClusterService7 } from "@geowiki/api-proxy";
1489
+ import { useQuery as useQuery41 } from "@tanstack/react-query";
1490
+ var useClusterGetJoinRequests = (clusterId) => {
1491
+ return useQuery41({
1492
+ queryKey: [QueryNames.JoinRequests, clusterId],
1493
+ queryFn: () => __async(void 0, null, function* () {
1494
+ const data = yield ClusterService7.clusterGetJoinRequests(clusterId);
1495
+ return data;
1496
+ })
1497
+ });
1498
+ };
1499
+
1500
+ // src/hooks/useClusterGetNews.ts
1501
+ import { ClusterService as ClusterService8 } from "@geowiki/api-proxy";
1502
+ import { useQuery as useQuery42 } from "@tanstack/react-query";
1503
+ var useClusterGetNews = (clusterId, newsId) => {
1504
+ return useQuery42({
1505
+ queryKey: [QueryNames.ClusterGetNews, clusterId, newsId],
1506
+ queryFn: () => __async(void 0, null, function* () {
1507
+ const data = yield ClusterService8.clusterGetNews(clusterId, newsId);
1508
+ return data;
1509
+ })
1510
+ });
1511
+ };
1512
+
1513
+ // src/hooks/useClusterGetNewsNextPreviousStatus.ts
1514
+ import { ClusterService as ClusterService9 } from "@geowiki/api-proxy";
1515
+ import { useQuery as useQuery43 } from "@tanstack/react-query";
1516
+ var useClusterGetNewsNextPreviousStatus = (clusterId, newsId) => {
1517
+ return useQuery43({
1518
+ queryKey: [QueryNames.ClusterNewsNextPrevious, clusterId, newsId],
1519
+ queryFn: () => __async(void 0, null, function* () {
1520
+ const data = yield ClusterService9.clusterGetNewsNextPreviousStatus(
1521
+ clusterId,
1522
+ newsId
1523
+ );
1524
+ return data;
1525
+ })
1526
+ });
1527
+ };
1528
+
1529
+ // src/hooks/useClusterImages.ts
1530
+ import { ClusterService as ClusterService10 } from "@geowiki/api-proxy";
1531
+ import { useQuery as useQuery44 } from "@tanstack/react-query";
1532
+ var useClusterImages = (id) => {
1533
+ return useQuery44({
1534
+ queryKey: [QueryNames.ClusterImages, id],
1535
+ queryFn: () => __async(void 0, null, function* () {
1536
+ const data = yield ClusterService10.clusterGetClusterImages(id);
1537
+ return data;
1538
+ })
1539
+ });
1540
+ };
1541
+
1542
+ // src/hooks/useClusterOverview.ts
1543
+ import { ClusterService as ClusterService11 } from "@geowiki/api-proxy";
1544
+ import { useQuery as useQuery45 } from "@tanstack/react-query";
1545
+ var useClusterOverview = (id) => {
1546
+ return useQuery45({
1547
+ queryKey: [QueryNames.GetClusterOverview, id],
1548
+ queryFn: () => __async(void 0, null, function* () {
1549
+ const data = yield ClusterService11.clusterGetClusterOverview(id);
1550
+ return data;
1551
+ })
1552
+ });
1553
+ };
1554
+
1555
+ // src/hooks/useClusterAllNews.ts
1556
+ import { ClusterService as ClusterService12 } from "@geowiki/api-proxy";
1557
+ import { useQuery as useQuery46 } from "@tanstack/react-query";
1558
+ var useClusterAllNews = (id, refresh, sorting, skipCount, maxResultCount, status) => {
1559
+ return useQuery46({
1560
+ queryKey: [
1561
+ QueryNames.ClusterAllNews,
1562
+ id,
1563
+ sorting,
1564
+ skipCount,
1565
+ maxResultCount,
1566
+ refresh,
1567
+ status
1568
+ ],
1569
+ queryFn: () => __async(void 0, null, function* () {
1570
+ const data = yield ClusterService12.clusterGetAllNews(
1571
+ id,
1572
+ sorting,
1573
+ skipCount,
1574
+ maxResultCount,
1575
+ status
1576
+ );
1577
+ return data;
1578
+ })
1579
+ });
1580
+ };
1581
+
1582
+ // src/hooks/useNewsFromAllClusters.ts
1583
+ import { ClusterService as ClusterService13 } from "@geowiki/api-proxy";
1584
+ import { useQuery as useQuery47 } from "@tanstack/react-query";
1585
+ var useNewsFromAllClusters = (skip = 0, take = 10) => {
1586
+ return useQuery47({
1587
+ queryKey: [QueryNames.ClusterAllNews, skip, take],
1588
+ queryFn: () => __async(void 0, null, function* () {
1589
+ const data = yield ClusterService13.clusterGetAllNewsFromAllClusters(
1590
+ "",
1591
+ skip,
1592
+ take
1593
+ );
1594
+ return data;
1595
+ })
1596
+ });
1597
+ };
1598
+
1599
+ // src/hooks/useClusterNewsWithId.ts
1600
+ import { ClusterService as ClusterService14 } from "@geowiki/api-proxy";
1601
+ import { useQuery as useQuery48 } from "@tanstack/react-query";
1602
+ var useClusterNewsWithId = (id) => {
1603
+ return useQuery48({
1604
+ queryKey: [QueryNames.ClusterNewsWithId, id],
1605
+ queryFn: () => __async(void 0, null, function* () {
1606
+ const data = yield ClusterService14.clusterGetClusterNewsById(id);
1607
+ return data;
1608
+ })
1609
+ });
1610
+ };
1611
+
1612
+ // src/hooks/useMapMenuItems.ts
1613
+ import { useQuery as useQuery49 } from "@tanstack/react-query";
1614
+
1615
+ // src/utils/CmsApi.ts
1616
+ import {
1617
+ QueryApiService,
1618
+ SettingsService as SettingsService7
1619
+ } from "@geowiki/cms-proxy";
1620
+ var getGeoWikiSettings = () => __async(void 0, null, function* () {
1621
+ const req = yield SettingsService7.settingsGetSiteSettings("GeoWiki");
1622
+ return req;
1623
+ });
1624
+ var getDefaultSettings = () => __async(void 0, null, function* () {
1625
+ const req = yield SettingsService7.settingsGetDefaultSiteSettings();
1626
+ return req;
1627
+ });
1628
+ var getMenus = (displayName) => __async(void 0, null, function* () {
1629
+ const req = yield getContentWithTypeAndDisplayName(
1630
+ "Menu",
1631
+ displayName
1632
+ );
1633
+ const menus = req == null ? void 0 : req.items[0];
1634
+ return menus;
1635
+ });
1636
+ var getPageContent = (displayName) => __async(void 0, null, function* () {
1637
+ const req = yield getContentWithTypeAndDisplayName(
1638
+ "Page",
1639
+ displayName
1640
+ );
1641
+ const page = req == null ? void 0 : req.items[0];
1642
+ return page;
1643
+ });
1644
+ var getContentWithTypeAndDisplayName = (contentType, displayName) => __async(void 0, null, function* () {
1645
+ return QueryApiService.apiQueryGet(
1646
+ "GetContentByTypeAndDisplayText",
1647
+ `${JSON.stringify({ contenttype: contentType, displaytext: displayName })}`
1648
+ );
1649
+ });
1650
+ var getContentWithSlug = (slug) => __async(void 0, null, function* () {
1651
+ const req = yield QueryApiService.apiQueryGet(
1652
+ "GetDocumentBySlug",
1653
+ `${JSON.stringify({ path: slug })}`
1654
+ );
1655
+ return req == null ? void 0 : req.items[0];
1656
+ });
1657
+ var getContentsWithType = (contentType) => __async(void 0, null, function* () {
1658
+ const req = yield QueryApiService.apiQueryGet(
1659
+ "GetContentByType",
1660
+ `${JSON.stringify({ contenttype: contentType })}`
1661
+ );
1662
+ return req == null ? void 0 : req.items;
1663
+ });
1664
+ var getPageProps = (ctx) => __async(void 0, null, function* () {
1665
+ var _a;
1666
+ var page = "index";
1667
+ const slugs = ctx.query.slug;
1668
+ if (slugs && slugs.length > 0) {
1669
+ page = slugs[slugs.length - 1];
1670
+ }
1671
+ return {
1672
+ props: {
1673
+ page: (_a = yield getPageContent(page)) != null ? _a : null
1674
+ }
1675
+ };
1676
+ });
1677
+
1678
+ // src/hooks/useMapMenuItems.ts
1679
+ var useMapMenuItems = () => {
1680
+ return useQuery49({
1681
+ queryKey: [QueryNames.MapMenuItems],
1682
+ queryFn: () => __async(void 0, null, function* () {
1683
+ const req = yield getContentsWithType("MapMenuItem");
1684
+ return req;
1685
+ })
1686
+ });
1687
+ };
1688
+
1689
+ // src/hooks/useClusterLinks.ts
1690
+ import { ClusterService as ClusterService15 } from "@geowiki/api-proxy";
1691
+ import { useQuery as useQuery50 } from "@tanstack/react-query";
1692
+ var useClusterLinks = (id) => {
1693
+ return useQuery50({
1694
+ queryKey: [QueryNames.GetSocialLinks, id],
1695
+ queryFn: () => __async(void 0, null, function* () {
1696
+ const data = yield ClusterService15.clusterGetLinksAndPartner(id);
1697
+ return data;
1698
+ })
1699
+ });
1700
+ };
1701
+
1702
+ // src/hooks/useCmsContentWithType.ts
1703
+ import { useQuery as useQuery51 } from "@tanstack/react-query";
1704
+ var useCmsContentWithType = (contentType) => {
1705
+ return useQuery51({
1706
+ queryKey: [QueryNames.GetCmsContentWithType],
1707
+ queryFn: () => __async(void 0, null, function* () {
1708
+ const req = yield getContentsWithType(contentType);
1709
+ return req;
1710
+ })
1711
+ });
1712
+ };
1713
+
1714
+ // src/hooks/useClusterNews.ts
1715
+ import { ClusterService as ClusterService16 } from "@geowiki/api-proxy";
1716
+ import { useQuery as useQuery52 } from "@tanstack/react-query";
1717
+ var useClusterNews = (id, sort = "", skip = 0, take = 100) => {
1718
+ return useQuery52({
1719
+ queryKey: [QueryNames.ClusterNews, id, sort, skip, take],
1720
+ queryFn: () => __async(void 0, null, function* () {
1721
+ const data = yield ClusterService16.clusterGetClusterNews(
1722
+ id,
1723
+ sort,
1724
+ skip,
1725
+ take
1726
+ );
1727
+ return data;
1728
+ })
1729
+ });
1730
+ };
1731
+
1732
+ // src/hooks/useClusterDescription.ts
1733
+ import { ClusterService as ClusterService17 } from "@geowiki/api-proxy";
1734
+ import { useQuery as useQuery53 } from "@tanstack/react-query";
1735
+ var useClusterDescription = (id) => {
1736
+ return useQuery53({
1737
+ queryKey: [QueryNames.GetClusterDescription, id],
1738
+ queryFn: () => __async(void 0, null, function* () {
1739
+ const data = yield ClusterService17.clusterGetClusterDescription(id);
1740
+ return data;
1741
+ })
1742
+ });
1743
+ };
1744
+
1745
+ // src/hooks/useClusterDetails.ts
1746
+ import { ClusterService as ClusterService18 } from "@geowiki/api-proxy";
1747
+ import { useQuery as useQuery54 } from "@tanstack/react-query";
1748
+ var useClusterDetails = (id) => {
1749
+ return useQuery54({
1750
+ queryKey: [QueryNames.GetClusterDetails, id],
1751
+ queryFn: () => __async(void 0, null, function* () {
1752
+ const data = yield ClusterService18.clusterGetClusterDetails(id);
1753
+ return data;
1754
+ })
1755
+ });
1756
+ };
1757
+
1758
+ // src/hooks/useClusterImagesAndVideos.ts
1759
+ import { ClusterService as ClusterService19 } from "@geowiki/api-proxy";
1760
+ import { useQuery as useQuery55 } from "@tanstack/react-query";
1761
+ var useClusterImagesAndVideos = (id) => {
1762
+ return useQuery55({
1763
+ queryKey: [QueryNames.GetImagesAndVideos, id],
1764
+ queryFn: () => __async(void 0, null, function* () {
1765
+ const data = yield ClusterService19.clusterGetImagesAndVideos(id);
1766
+ return data;
1767
+ })
1768
+ });
1769
+ };
1770
+
1771
+ // src/hooks/useHost.ts
1772
+ import { useQuery as useQuery56 } from "@tanstack/react-query";
1773
+ var getHost = () => __async(void 0, null, function* () {
1774
+ const response = yield fetch("/api/host");
1775
+ if (!response.ok) {
1776
+ return Promise.reject(null);
1777
+ }
1778
+ return response.json();
1779
+ });
1780
+ function useHost() {
1781
+ return useQuery56({
1782
+ queryKey: [QueryNames.GetHost],
1783
+ queryFn: getHost
1784
+ });
1785
+ }
1786
+
1787
+ // src/hooks/useHostManagement.ts
1788
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
1789
+ var createHost = (hostData) => __async(void 0, null, function* () {
1790
+ const response = yield fetch("/api/hosts", {
1791
+ method: "POST",
1792
+ headers: {
1793
+ "Content-Type": "application/json"
1794
+ },
1795
+ body: JSON.stringify(hostData)
1796
+ });
1797
+ if (!response.ok) {
1798
+ throw new Error("Failed to create host");
1799
+ }
1800
+ return response.json();
1801
+ });
1802
+ var updateHost = (_a) => __async(void 0, null, function* () {
1803
+ var _b = _a, {
1804
+ host
1805
+ } = _b, hostData = __objRest(_b, [
1806
+ "host"
1807
+ ]);
1808
+ const response = yield fetch(`/api/hosts/${host}`, {
1809
+ method: "PUT",
1810
+ headers: {
1811
+ "Content-Type": "application/json"
1812
+ },
1813
+ body: JSON.stringify(hostData)
1814
+ });
1815
+ if (!response.ok) {
1816
+ throw new Error("Failed to update host");
1817
+ }
1818
+ return response.json();
1819
+ });
1820
+ var deleteHost = (host) => __async(void 0, null, function* () {
1821
+ const response = yield fetch(`/api/hosts/${host}`, {
1822
+ method: "DELETE"
1823
+ });
1824
+ if (!response.ok) {
1825
+ throw new Error("Failed to delete host");
1826
+ }
1827
+ });
1828
+ var useCreateHost = () => {
1829
+ const queryClient = useQueryClient();
1830
+ return useMutation({
1831
+ mutationFn: createHost,
1832
+ onSuccess: () => {
1833
+ queryClient.invalidateQueries({ queryKey: [QueryNames.GetHosts] });
1834
+ }
1835
+ });
1836
+ };
1837
+ var useUpdateHost = () => {
1838
+ const queryClient = useQueryClient();
1839
+ return useMutation({
1840
+ mutationFn: updateHost,
1841
+ onSuccess: () => {
1842
+ queryClient.invalidateQueries({ queryKey: [QueryNames.GetHosts] });
1843
+ queryClient.invalidateQueries({ queryKey: [QueryNames.GetHost] });
1844
+ }
1845
+ });
1846
+ };
1847
+ var useDeleteHost = () => {
1848
+ const queryClient = useQueryClient();
1849
+ return useMutation({
1850
+ mutationFn: deleteHost,
1851
+ onSuccess: () => {
1852
+ queryClient.invalidateQueries({ queryKey: [QueryNames.GetHosts] });
1853
+ }
1854
+ });
1855
+ };
1856
+
1857
+ // src/models/HostInfo.ts
1858
+ var HostType = /* @__PURE__ */ ((HostType2) => {
1859
+ HostType2["IsActive"] = "IsActive";
1860
+ HostType2["IsUnderConstruction"] = "IsUnderConstruction";
1861
+ return HostType2;
1862
+ })(HostType || {});
1863
+
1864
+ // src/utils/ServerHostUtils.ts
1865
+ var getHostData = () => {
1866
+ return process.env.NODE_ENV === "production" ? [
1867
+ {
1868
+ host: "v2.geo-wiki.org",
1869
+ cmsUrl: "https://cms.main.geo-wiki.org"
1870
+ },
1871
+ {
1872
+ host: "evo.geo-wiki.org",
1873
+ cmsUrl: "https://cms.main.geo-wiki.org/evoland",
1874
+ tenantId: "3a12f4a0-c86a-d6fc-ec94-910ebeb86aea",
1875
+ redirectUrl: "/evoland/projects"
1876
+ },
1877
+ {
1878
+ host: "evo-dev.main.geo-wiki.org",
1879
+ cmsUrl: "https://cms.main.geo-wiki.org/evoland-dev",
1880
+ tenantId: "3a0d5d86-5eac-0234-6d1c-eeecdd06739d",
1881
+ redirectUrl: "/evoland/projects"
1882
+ },
1883
+ {
1884
+ host: "recodo.geo-wiki.org",
1885
+ cmsUrl: "https://framework.cms.geo-wiki.org",
1886
+ tenantId: "39fdc096-4274-dfe4-1761-03d8f52219a5",
1887
+ redirectUrl: "/page/user/user-profile"
1888
+ },
1889
+ {
1890
+ host: "frameworkv2.geo-wiki.org",
1891
+ cmsUrl: "https://framework.cms.geo-wiki.org",
1892
+ tenantId: "39fdc096-4274-dfe4-1761-03d8f52219a5",
1893
+ redirectUrl: "/page/user/user-profile"
1894
+ },
1895
+ {
1896
+ host: "geo-wiki.org",
1897
+ cmsUrl: "https://cms.main.geo-wiki.org",
1898
+ tenantId: "39fdc097-fa0e-aa99-6ec9-a387d3225abc"
1899
+ },
1900
+ {
1901
+ host: "geowiki.iiasa.ac.at",
1902
+ cmsUrl: "https://cms.main.geo-wiki.org",
1903
+ tenantId: "39fdc097-fa0e-aa99-6ec9-a387d3225abc"
1904
+ },
1905
+ {
1906
+ host: "web.geowiki.iiasa.ac.at",
1907
+ cmsUrl: "https://cms.main.geo-wiki.org",
1908
+ tenantId: "39fdc097-fa0e-aa99-6ec9-a387d3225abc"
1909
+ },
1910
+ {
1911
+ host: "www.geo-wiki.org",
1912
+ cmsUrl: "https://cms.main.geo-wiki.org",
1913
+ tenantId: "39fdc097-fa0e-aa99-6ec9-a387d3225abc"
1914
+ },
1915
+ {
1916
+ host: "recodo.io",
1917
+ cmsUrl: "https://cms.geo-wiki.org/recodo",
1918
+ tenantId: "39fdc096-4274-dfe4-1761-03d8f52219a5",
1919
+ redirectUrl: "/admin/cluster"
1920
+ },
1921
+ {
1922
+ host: "recodo.iiasa.ac.at",
1923
+ cmsUrl: "https://cms.geo-wiki.org/recodo",
1924
+ tenantId: "39fdc096-4274-dfe4-1761-03d8f52219a5",
1925
+ redirectUrl: "/page/user/user-profile"
1926
+ },
1927
+ {
1928
+ host: "framework.geo-wiki.org",
1929
+ cmsUrl: "https://framework.cms.geo-wiki.org",
1930
+ tenantId: "39fdc096-4274-dfe4-1761-03d8f52219a5",
1931
+ redirectUrl: "/page/user/user-profile"
1932
+ },
1933
+ {
1934
+ host: "recodo.nodes.iiasa.ac.at",
1935
+ cmsUrl: "https://framework.cms.geo-wiki.org",
1936
+ tenantId: "39fdc096-4274-dfe4-1761-03d8f52219a5",
1937
+ redirectUrl: "/admin/cluster"
1938
+ },
1939
+ {
1940
+ host: "hpg1025.iiasa.ac.at:31028",
1941
+ cmsUrl: "https://framework.cms.geo-wiki.org",
1942
+ tenantId: "39fdc096-4274-dfe4-1761-03d8f52219a5",
1943
+ redirectUrl: "/page/user/user-profile"
1944
+ },
1945
+ {
1946
+ host: "demo.geo-wiki.org",
1947
+ cmsUrl: "https://demo.cms.geo-wiki.org"
1948
+ },
1949
+ {
1950
+ host: "mindstep.geo-wiki.org",
1951
+ cmsUrl: "https://mindstep.cms.geo-wiki.org"
1952
+ },
1953
+ {
1954
+ host: "tm.geo-wiki.org",
1955
+ cmsUrl: "https://tm.cms.geo-wiki.org"
1956
+ },
1957
+ {
1958
+ host: "cropobserve.org",
1959
+ cmsUrl: "https://cropobserve.cms.geo-wiki.org"
1960
+ },
1961
+ {
1962
+ host: "localhost:3000",
1963
+ cmsUrl: "https://cms.main.geo-wiki.org"
1964
+ },
1965
+ {
1966
+ host: "localhost:4000",
1967
+ cmsUrl: "https://cms.main.geo-wiki.org"
1968
+ },
1969
+ {
1970
+ host: "adapt-uhi.org",
1971
+ cmsUrl: "https://cms.main.geo-wiki.org/adapt"
1972
+ },
1973
+ {
1974
+ host: "geo-trees.nodes.iiasa.ac.at",
1975
+ cmsUrl: "https://cms.main.geo-wiki.org/geotrees",
1976
+ tenantId: "3a12f511-0804-948c-db52-a33491c51e48",
1977
+ redirectUrl: "/"
1978
+ },
1979
+ {
1980
+ host: "globalcanopyatlas.org",
1981
+ cmsUrl: "https://cms.geowiki.iiasa.ac.at/canopyatlas",
1982
+ tenantId: "3a1481ec-90a1-47d0-c34d-70610f97a4e5",
1983
+ redirectUrl: "/",
1984
+ protectedPaths: ["/map"]
1985
+ },
1986
+ {
1987
+ host: "canopyatlas.nodes.iiasa.ac.at",
1988
+ cmsUrl: "https://cms.geowiki.iiasa.ac.at/canopyatlas",
1989
+ tenantId: "3a1481ec-90a1-47d0-c34d-70610f97a4e5",
1990
+ redirectUrl: "/",
1991
+ protectedPaths: ["/map"]
1992
+ },
1993
+ {
1994
+ host: "basf.nodes.iiasa.ac.at",
1995
+ cmsUrl: "https://cms.main.geo-wiki.org/basf",
1996
+ tenantId: "3a16570a-6c13-db58-25f7-1866c09412b7",
1997
+ redirectUrl: "/",
1998
+ protectedPaths: ["/map"]
1999
+ },
2000
+ {
2001
+ host: "evo.nodes.iiasa.ac.at",
2002
+ cmsUrl: "https://cms.main.geo-wiki.org/evoland-dev",
2003
+ tenantId: "3a0d5d86-5eac-0234-6d1c-eeecdd06739d",
2004
+ redirectUrl: "/evoland/projects"
2005
+ },
2006
+ {
2007
+ host: "urbanreleaf.nodes.iiasa.ac.at",
2008
+ cmsUrl: "https://cms.main.geo-wiki.org/urbanreleaf",
2009
+ redirectUrl: "/"
2010
+ },
2011
+ {
2012
+ host: "geoquest.iiasa.ac.at",
2013
+ cmsUrl: "https://cms.geowiki.iiasa.ac.at/geoquest",
2014
+ redirectUrl: "/"
2015
+ },
2016
+ {
2017
+ host: "geo-quest.org",
2018
+ cmsUrl: "https://cms.geowiki.iiasa.ac.at/geoquest",
2019
+ redirectUrl: "/"
2020
+ },
2021
+ {
2022
+ host: "data.geo-trees.org",
2023
+ cmsUrl: "https://cms.main.geo-wiki.org/geotrees",
2024
+ tenantId: "3a1a9007-e328-c293-e501-472a18594650",
2025
+ redirectUrl: "/"
2026
+ }
2027
+ ] : [
2028
+ {
2029
+ host: "localhost:3000",
2030
+ cmsUrl: "https://framework.cms.geo-wiki.org",
2031
+ tenantId: "39fdc096-4274-dfe4-1761-03d8f52219a5",
2032
+ redirectUrl: "/page/user/user-profile"
2033
+ },
2034
+ {
2035
+ host: "geowiki.local:3000",
2036
+ cmsUrl: "https://cms.main.geo-wiki.org"
2037
+ },
2038
+ {
2039
+ host: "recodo.local:3000",
2040
+ cmsUrl: "https://framework.cms.geo-wiki.org"
2041
+ },
2042
+ {
2043
+ host: "evo.local:3000",
2044
+ cmsUrl: "https://cms.main.geo-wiki.org/evoland",
2045
+ tenantId: "3a0d5d86-5eac-0234-6d1c-eeecdd06739d",
2046
+ redirectUrl: "/evoland/projects"
2047
+ }
2048
+ ];
2049
+ };
2050
+ var findHostInfo = (host) => {
2051
+ const hosts = getHostData();
2052
+ return hosts.find((h) => h.host === host);
2053
+ };
2054
+ var getCmsUrlForHost = (host) => {
2055
+ const hostInfo = findHostInfo(host);
2056
+ return (hostInfo == null ? void 0 : hostInfo.cmsUrl) || "https://cms.geo-wiki.org";
2057
+ };
2058
+ var getTenantIdForHost = (host) => {
2059
+ const hostInfo = findHostInfo(host);
2060
+ return hostInfo == null ? void 0 : hostInfo.tenantId;
2061
+ };
2062
+
2063
+ // src/services/HostService.ts
2064
+ var HostService = class {
2065
+ /**
2066
+ * Server-side: Get all hosts data
2067
+ * This should be used in API routes and server-side code
2068
+ */
2069
+ static getHostData() {
2070
+ return getHostData();
2071
+ }
2072
+ /**
2073
+ * Server-side: Find host info by hostname
2074
+ * This should be used in API routes and server-side code
2075
+ */
2076
+ static findHostInfo(host) {
2077
+ return findHostInfo(host);
2078
+ }
2079
+ /**
2080
+ * Server-side: Get CMS URL for a specific host
2081
+ * This should be used in API routes and server-side code
2082
+ */
2083
+ static getCmsUrlForHost(host) {
2084
+ return getCmsUrlForHost(host);
2085
+ }
2086
+ /**
2087
+ * Server-side: Get tenant ID for a specific host
2088
+ * This should be used in API routes and server-side code
2089
+ */
2090
+ static getTenantIdForHost(host) {
2091
+ return getTenantIdForHost(host);
2092
+ }
2093
+ /**
2094
+ * Utility: Check if host is under construction
2095
+ */
2096
+ static isHostUnderConstruction(hostInfo) {
2097
+ return (hostInfo == null ? void 0 : hostInfo.hostType) === "IsUnderConstruction" /* IsUnderConstruction */;
2098
+ }
2099
+ /**
2100
+ * Utility: Check if host has protected paths
2101
+ */
2102
+ static hasProtectedPaths(hostInfo) {
2103
+ return Boolean(
2104
+ (hostInfo == null ? void 0 : hostInfo.protectedPaths) && hostInfo.protectedPaths.length > 0
2105
+ );
2106
+ }
2107
+ /**
2108
+ * Utility: Check if a path is protected for a host
2109
+ */
2110
+ static isPathProtected(hostInfo, path) {
2111
+ if (!(hostInfo == null ? void 0 : hostInfo.protectedPaths))
2112
+ return false;
2113
+ return hostInfo.protectedPaths.some(
2114
+ (protectedPath) => path.startsWith(protectedPath)
2115
+ );
2116
+ }
2117
+ /**
2118
+ * Utility: Get redirect URL for host
2119
+ */
2120
+ static getRedirectUrl(hostInfo) {
2121
+ return hostInfo == null ? void 0 : hostInfo.redirectUrl;
2122
+ }
2123
+ /**
2124
+ * Utility: Get tenant name from host info
2125
+ */
2126
+ static getTenantName(hostInfo) {
2127
+ return hostInfo == null ? void 0 : hostInfo.name;
2128
+ }
2129
+ /**
2130
+ * Utility: Validate host configuration
2131
+ */
2132
+ static validateHostInfo(hostInfo) {
2133
+ const errors = [];
2134
+ if (!hostInfo.host) {
2135
+ errors.push("Host is required");
2136
+ }
2137
+ if (!hostInfo.cmsUrl) {
2138
+ errors.push("CMS URL is required");
2139
+ }
2140
+ if (hostInfo.cmsUrl && !this.isValidUrl(hostInfo.cmsUrl)) {
2141
+ errors.push("CMS URL must be a valid URL");
2142
+ }
2143
+ if (hostInfo.redirectUrl && !this.isValidPath(hostInfo.redirectUrl)) {
2144
+ errors.push("Redirect URL must be a valid path");
2145
+ }
2146
+ return {
2147
+ isValid: errors.length === 0,
2148
+ errors
2149
+ };
2150
+ }
2151
+ /**
2152
+ * Utility: Check if URL is valid
2153
+ */
2154
+ static isValidUrl(url) {
2155
+ try {
2156
+ new URL(url);
2157
+ return true;
2158
+ } catch (e) {
2159
+ return false;
2160
+ }
2161
+ }
2162
+ /**
2163
+ * Utility: Check if path is valid
2164
+ */
2165
+ static isValidPath(path) {
2166
+ return path.startsWith("/") || path.startsWith("http");
2167
+ }
2168
+ /**
2169
+ * Utility: Get host info for current window location (client-side only)
2170
+ */
2171
+ static getCurrentHostInfo(hosts) {
2172
+ if (typeof window === "undefined")
2173
+ return void 0;
2174
+ return hosts.find((h) => h.host === window.location.host);
2175
+ }
2176
+ /**
2177
+ * Utility: Get host info for specific hostname from hosts array
2178
+ */
2179
+ static getHostInfoFromArray(hosts, hostname) {
2180
+ return hosts.find((h) => h.host === hostname);
2181
+ }
2182
+ /**
2183
+ * Utility: Filter hosts by tenant ID
2184
+ */
2185
+ static filterHostsByTenant(hosts, tenantId) {
2186
+ return hosts.filter((h) => h.tenantId === tenantId);
2187
+ }
2188
+ /**
2189
+ * Utility: Filter hosts by CMS URL
2190
+ */
2191
+ static filterHostsByCmsUrl(hosts, cmsUrl) {
2192
+ return hosts.filter((h) => h.cmsUrl === cmsUrl);
2193
+ }
2194
+ /**
2195
+ * Utility: Get unique tenant IDs from hosts
2196
+ */
2197
+ static getUniqueTenantIds(hosts) {
2198
+ const tenantIds = hosts.map((h) => h.tenantId).filter((id) => Boolean(id));
2199
+ return [...new Set(tenantIds)];
2200
+ }
2201
+ /**
2202
+ * Utility: Get unique CMS URLs from hosts
2203
+ */
2204
+ static getUniqueCmsUrls(hosts) {
2205
+ const cmsUrls = hosts.map((h) => h.cmsUrl);
2206
+ return [...new Set(cmsUrls)];
2207
+ }
2208
+ };
2209
+
2210
+ // src/models/ButtonType.ts
2211
+ var StyleType = /* @__PURE__ */ ((StyleType2) => {
2212
+ StyleType2[StyleType2["Primary"] = 0] = "Primary";
2213
+ StyleType2[StyleType2["Secondary"] = 1] = "Secondary";
2214
+ StyleType2[StyleType2["Success"] = 2] = "Success";
2215
+ StyleType2[StyleType2["Danger"] = 3] = "Danger";
2216
+ StyleType2[StyleType2["Warning"] = 4] = "Warning";
2217
+ StyleType2[StyleType2["Info"] = 5] = "Info";
2218
+ return StyleType2;
2219
+ })(StyleType || {});
2220
+
2221
+ // src/models/ViewStatus.ts
2222
+ var ViewStatus = /* @__PURE__ */ ((ViewStatus2) => {
2223
+ ViewStatus2[ViewStatus2["New"] = 0] = "New";
2224
+ ViewStatus2[ViewStatus2["Edit"] = 1] = "Edit";
2225
+ ViewStatus2[ViewStatus2["List"] = 2] = "List";
2226
+ ViewStatus2[ViewStatus2["View"] = 3] = "View";
2227
+ return ViewStatus2;
2228
+ })(ViewStatus || {});
2229
+
2230
+ // src/models/TaskStatus.ts
2231
+ var TaskStatus2 = /* @__PURE__ */ ((TaskStatus3) => {
2232
+ TaskStatus3["ASSIGNED"] = "ASSIGNED";
2233
+ TaskStatus3["SKIPPED"] = "SKIPPED";
2234
+ TaskStatus3["IN_REVIEW"] = "IN_REVIEW";
2235
+ TaskStatus3["SUBMITTED"] = "SUBMITTED";
2236
+ TaskStatus3["TO_FIX"] = "TO_FIX";
2237
+ TaskStatus3["ACCEPTED"] = "ACCEPTED";
2238
+ TaskStatus3["USER_DISCARDED"] = "USER_DISCARDED";
2239
+ TaskStatus3["DISCARDED"] = "DISCARDED";
2240
+ return TaskStatus3;
2241
+ })(TaskStatus2 || {});
2242
+ var TaskStatusColor = /* @__PURE__ */ ((TaskStatusColor2) => {
2243
+ TaskStatusColor2["ASSIGNED"] = "goldenrod";
2244
+ TaskStatusColor2["SKIPPED"] = "darkgray";
2245
+ TaskStatusColor2["IN_REVIEW"] = "pink";
2246
+ TaskStatusColor2["TO_FIX"] = "red";
2247
+ TaskStatusColor2["ACCEPTED"] = "violet";
2248
+ TaskStatusColor2["DISCARDED"] = "aqua";
2249
+ TaskStatusColor2["SUBMITTED"] = "green";
2250
+ TaskStatusColor2["USER_DISCARDED"] = "orange";
2251
+ return TaskStatusColor2;
2252
+ })(TaskStatusColor || {});
2253
+ var TaskEventType = /* @__PURE__ */ ((TaskEventType2) => {
2254
+ TaskEventType2["CREATED"] = "CREATED";
2255
+ TaskEventType2["NEW_ANNOTATION"] = "NEW_ANNOTATION";
2256
+ TaskEventType2["STATUS_UPDATED"] = "STATUS_UPDATED";
2257
+ TaskEventType2["COMMENT"] = "COMMENT";
2258
+ TaskEventType2["QUESTIONNAIRE"] = "QUESTIONNAIRE";
2259
+ TaskEventType2["REVIEW"] = "REVIEW";
2260
+ return TaskEventType2;
2261
+ })(TaskEventType || {});
2262
+ var TaskState = /* @__PURE__ */ ((TaskState2) => {
2263
+ TaskState2["ASSIGNED"] = "Assigned";
2264
+ TaskState2["SKIPPED"] = "Skip";
2265
+ TaskState2["IN_REVIEW"] = "Ask to Review";
2266
+ TaskState2["SUBMITTED"] = "Submit";
2267
+ TaskState2["TO_FIX"] = "To Fix";
2268
+ TaskState2["ACCEPTED"] = "Accept";
2269
+ TaskState2["USER_DISCARDED"] = "Discard";
2270
+ TaskState2["DISCARDED"] = "Discard";
2271
+ return TaskState2;
2272
+ })(TaskState || {});
2273
+ var AnnotationRequired = /* @__PURE__ */ ((AnnotationRequired2) => {
2274
+ AnnotationRequired2["NOT_REQUIRED"] = "NOT_REQUIRED";
2275
+ AnnotationRequired2["REQUIRED"] = "REQUIRED";
2276
+ AnnotationRequired2["OPTIONAL"] = "OPTIONAL";
2277
+ return AnnotationRequired2;
2278
+ })(AnnotationRequired || {});
2279
+ var QuestionnaireType = /* @__PURE__ */ ((QuestionnaireType2) => {
2280
+ QuestionnaireType2["TEXT"] = "TEXT";
2281
+ QuestionnaireType2["CONTEXT"] = "CONTEXT";
2282
+ QuestionnaireType2["SINGLE_CHOICE"] = "SINGLE_CHOICE";
2283
+ QuestionnaireType2["MULTI_CHOICE"] = "MULTI_CHOICE";
2284
+ QuestionnaireType2["DATETIME"] = "DATETIME";
2285
+ return QuestionnaireType2;
2286
+ })(QuestionnaireType || {});
2287
+
2288
+ // src/stores/breadCrumbs.ts
2289
+ import { create } from "zustand";
2290
+ var initialState = [];
2291
+ var useBreadCrumbStore = create()((set) => ({
2292
+ breadCrumbs: initialState,
2293
+ reset: () => set((state) => {
2294
+ state.breadCrumbs.length = 1;
2295
+ return { breadCrumbs: state.breadCrumbs };
2296
+ }),
2297
+ add: (breadCrumb) => set((state) => {
2298
+ const mainArr = [].concat(
2299
+ ...state.breadCrumbs.map((x) => x.path)
2300
+ );
2301
+ const currArr = [].concat(breadCrumb == null ? void 0 : breadCrumb.map((x) => x.path));
2302
+ if (breadCrumb != null && mainArr.some((r) => currArr == null ? void 0 : currArr.includes(r)) == false) {
2303
+ breadCrumb.forEach((element) => {
2304
+ state.breadCrumbs.push(element);
2305
+ });
2306
+ } else {
2307
+ var index = mainArr.findIndex(
2308
+ (x) => x == currArr[currArr.length - 1]
2309
+ );
2310
+ state.breadCrumbs.length = index + 1;
2311
+ }
2312
+ return { breadCrumbs: state.breadCrumbs };
2313
+ }),
2314
+ remove: (breadCrumb) => set((state) => {
2315
+ var index = state.breadCrumbs.findIndex(
2316
+ (l) => (l == null ? void 0 : l.path) === breadCrumb.path
2317
+ );
2318
+ state.breadCrumbs.length = index + 1;
2319
+ return { breadCrumbs: state.breadCrumbs };
2320
+ })
2321
+ }));
2322
+
2323
+ // src/stores/layers.ts
2324
+ import { create as create2 } from "zustand";
2325
+ var useLayerStore = create2()((set) => ({
2326
+ layers: [],
2327
+ add: (layer) => set((state) => {
2328
+ state.layers.push(layer);
2329
+ return { layers: state.layers };
2330
+ }),
2331
+ remove: (layer) => set((state) => {
2332
+ var index = state.layers.findIndex(
2333
+ (l) => l.ContentItemId === layer.ContentItemId
2334
+ );
2335
+ state.layers.splice(index, 1);
2336
+ return { layers: state.layers };
2337
+ })
2338
+ }));
2339
+
2340
+ // src/stores/settings.ts
2341
+ import { createStore as createStore2 } from "zustand/vanilla";
2342
+ var settingsStore = createStore2(() => ({
2343
+ settings: null
2344
+ }));
2345
+
2346
+ // src/stores/panel.ts
2347
+ import { create as create3 } from "zustand";
2348
+ var usePanelStore = create3((set) => ({
2349
+ isLeftPanelOpen: false,
2350
+ setIsLeftPanelOpen: (isLeftPanelOpen) => set({ isLeftPanelOpen }),
2351
+ isRightPanelOpen: false,
2352
+ setIsRightPanelOpen: (isRightPanelOpen) => set({ isRightPanelOpen }),
2353
+ panelRef: null,
2354
+ setPanelRef: (panelRef) => set({ panelRef }),
2355
+ showPanels: () => set((state) => {
2356
+ return __spreadProps(__spreadValues({}, state), {
2357
+ isLeftPanelOpen: true,
2358
+ isRightPanelOpen: true
2359
+ });
2360
+ })
2361
+ }));
2362
+
2363
+ // src/stores/basf.ts
2364
+ import { create as create4 } from "zustand";
2365
+ var useBasfStore = create4((set) => ({
2366
+ selectedItems: [],
2367
+ // addItem: (item) =>
2368
+ // set((state) => ({
2369
+ // selectedItems: [
2370
+ // ...state.selectedItems,
2371
+ // { ...item, opacity: 1, enabled: true },
2372
+ // ],
2373
+ // rightPanelOpen: true,
2374
+ // })),
2375
+ addItem: (item) => set(() => ({
2376
+ selectedItems: [__spreadProps(__spreadValues({}, item), { opacity: 1, enabled: true })],
2377
+ rightPanelOpen: true
2378
+ })),
2379
+ removeItem: (id) => set((state) => ({
2380
+ selectedItems: state.selectedItems.filter((item) => item.id !== id)
2381
+ })),
2382
+ updateItemOpacity: (id, opacity) => set((state) => ({
2383
+ selectedItems: state.selectedItems.map(
2384
+ (item) => item.id === id ? __spreadProps(__spreadValues({}, item), { opacity }) : item
2385
+ )
2386
+ })),
2387
+ updateItemEnabled: (id, enabled) => set((state) => ({
2388
+ selectedItems: state.selectedItems.map(
2389
+ (item) => item.id === id ? __spreadProps(__spreadValues({}, item), { enabled }) : item
2390
+ )
2391
+ })),
2392
+ rightPanelOpen: false,
2393
+ leftPanelOpen: true,
2394
+ updateRightPanelOpen: (open) => set({ rightPanelOpen: open }),
2395
+ updateLeftPanelOpen: (open) => set({ leftPanelOpen: open })
2396
+ }));
2397
+
2398
+ // src/utils/common.ts
2399
+ import { createRoot } from "react-dom/client";
2400
+ import { flushSync } from "react-dom";
2401
+ import { I18n } from "next-localization";
2402
+ import { driver } from "driver.js";
2403
+ import "driver.js/dist/driver.css";
2404
+ import * as XLSX from "xlsx";
2405
+ var i18n = I18n();
2406
+ var getHtmlElementFromReactNode = (node) => {
2407
+ const div = document.createElement("div");
2408
+ const root = createRoot(div);
2409
+ queueMicrotask(() => {
2410
+ flushSync(() => {
2411
+ root.render(node);
2412
+ });
2413
+ });
2414
+ return div;
2415
+ };
2416
+ var classNames = (...classes) => {
2417
+ return classes.filter(Boolean).join(" ");
2418
+ };
2419
+ function getButtonAppearance(type, background) {
2420
+ if (type === "primary") {
2421
+ if (background === "light") {
2422
+ return "dark";
2423
+ }
2424
+ return "white";
2425
+ } else if (type === "secondary") {
2426
+ if (background === "light") {
2427
+ return "dark-outline";
2428
+ }
2429
+ return "white-outline";
2430
+ }
2431
+ return "dark";
2432
+ }
2433
+ function getMediaUrl(url) {
2434
+ if (url == null) {
2435
+ return "";
2436
+ }
2437
+ if (url.startsWith("http") || url.startsWith("//")) {
2438
+ return url;
2439
+ }
2440
+ }
2441
+ var showIntroTour = (tourSteps) => {
2442
+ const driverObj = driver({
2443
+ showProgress: true,
2444
+ showButtons: ["next", "previous", "close"],
2445
+ steps: tourSteps
2446
+ });
2447
+ setTimeout(() => {
2448
+ driverObj.drive();
2449
+ }, 100);
2450
+ };
2451
+ var tokenData = (token, field) => {
2452
+ try {
2453
+ return JSON.parse(
2454
+ window.atob(
2455
+ token !== void 0 ? token.split(".")[1].replace("-", "+").replace("_", "/") : ""
2456
+ )
2457
+ )[field];
2458
+ } catch (e) {
2459
+ console.error("Invalid JSON : ", e);
2460
+ }
2461
+ };
2462
+ var IsTokenExpired = (tokenExpires) => {
2463
+ try {
2464
+ if (tokenExpires)
2465
+ return new Date(tokenExpires).valueOf() < Date.now().valueOf();
2466
+ } catch (e) {
2467
+ console.log("Invlaid token to check expiry : ", e);
2468
+ }
2469
+ };
2470
+ var getHostFromRequest = (req) => {
2471
+ let host = req.headers.host;
2472
+ if (!host) {
2473
+ host = window.location.host;
2474
+ if (!host) {
2475
+ throw new Error("Host not found");
2476
+ }
2477
+ }
2478
+ if (host == null ? void 0 : host.startsWith("hpg1025")) {
2479
+ const forwardedHost = req == null ? void 0 : req.headers["x-forwarded-host"];
2480
+ if (forwardedHost) {
2481
+ host = forwardedHost;
2482
+ }
2483
+ }
2484
+ return host;
2485
+ };
2486
+ var shimmer = (w, h) => `
2487
+ <svg width="${w}" height="${h}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2488
+ <defs>
2489
+ <linearGradient id="g">
2490
+ <stop stop-color="#333" offset="20%" />
2491
+ <stop stop-color="#222" offset="50%" />
2492
+ <stop stop-color="#333" offset="70%" />
2493
+ </linearGradient>
2494
+ </defs>
2495
+ <rect width="${w}" height="${h}" fill="#333" />
2496
+ <rect id="r" width="${w}" height="${h}" fill="url(#g)" />
2497
+ <animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" />
2498
+ </svg>`;
2499
+ var toBase64 = (str) => typeof window === "undefined" ? Buffer.from(str).toString("base64") : window.btoa(str);
2500
+ var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
2501
+ var triplet = (e1, e2, e3) => keyStr.charAt(e1 >> 2) + keyStr.charAt((e1 & 3) << 4 | e2 >> 4) + keyStr.charAt((e2 & 15) << 2 | e3 >> 6) + keyStr.charAt(e3 & 63);
2502
+ var rgbDataURL = (r, g, b) => `data:image/gif;base64,R0lGODlhAQABAPAA${triplet(0, r, g) + triplet(b, 255, 255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`;
2503
+ var downloadData = (data, fileName) => {
2504
+ const worksheet = XLSX.utils.json_to_sheet(data);
2505
+ const workbook = XLSX.utils.book_new();
2506
+ XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1");
2507
+ XLSX.writeFile(workbook, fileName);
2508
+ };
2509
+ var scrollToFirstErrorElement = (errors) => {
2510
+ const errorsValues = Object.values(errors);
2511
+ console.log(errorsValues);
2512
+ if (errorsValues.length > 0) {
2513
+ var elements = Object.keys(errors).map((name) => document.getElementsByName(name)[0]).filter((x) => x !== void 0);
2514
+ if (elements.length === 0) {
2515
+ var selectors = Object.keys(errors).map(
2516
+ (name) => `[data-name="${name}"]`
2517
+ );
2518
+ var dataElements = selectors.map((selector) => document.querySelectorAll(selector)[0]).filter((x) => x !== void 0 && x !== null);
2519
+ if (dataElements.length > 0) {
2520
+ dataElements[0].scrollIntoView({
2521
+ behavior: "smooth",
2522
+ block: "center",
2523
+ inline: "center"
2524
+ });
2525
+ }
2526
+ }
2527
+ }
2528
+ };
2529
+ var downloadJSON = (data, fileName) => {
2530
+ const jsonString = JSON.stringify(data);
2531
+ const blob = new Blob([jsonString], { type: "application/json" });
2532
+ const url = URL.createObjectURL(blob);
2533
+ const link = document.createElement("a");
2534
+ link.href = url;
2535
+ link.download = fileName;
2536
+ document.body.appendChild(link);
2537
+ link.click();
2538
+ document.body.removeChild(link);
2539
+ URL.revokeObjectURL(url);
2540
+ };
2541
+ var formatUnixDate = (date) => {
2542
+ const dateObj = new Date(date);
2543
+ const year = dateObj.getFullYear();
2544
+ const month = String(dateObj.getMonth() + 1).padStart(2, "0");
2545
+ const day = String(dateObj.getDate()).padStart(2, "0");
2546
+ return `${year}-${month}-${day}`;
2547
+ };
2548
+
2549
+ // src/utils/Config.ts
2550
+ import { HomeIcon, UserIcon, WrenchIcon } from "@heroicons/react/24/outline";
2551
+ var Config = {
2552
+ site_name: "Geo-Wiki",
2553
+ title: "Geo-Wiki",
2554
+ description: "Geo-Wiki",
2555
+ locale: "en"
2556
+ };
2557
+ var Permission = {
2558
+ FarmerCluster: {
2559
+ Default: "Framework.Cluster",
2560
+ Create: "Framework.Cluster.Create",
2561
+ Update: "Framework.Cluster.Update",
2562
+ Delete: "Framework.Cluster.Delete",
2563
+ AddNews: "Framework.Cluster.AddNews",
2564
+ EditNews: "Framework.Cluster.EditNews",
2565
+ DeleteNews: "Framework.Cluster.DeleteNews",
2566
+ ViewNews: "Framework.Cluster.ViewNews",
2567
+ ViewFarmers: "Framework.Cluster.ViewFarmers",
2568
+ RemoveFarmer: "Framework.Cluster.RemoveFarmer",
2569
+ AddFarmer: "Framework.Cluster.AddFarmer"
2570
+ },
2571
+ Resource: {
2572
+ Default: "Framework.Resource",
2573
+ Create: "Framework.Resource.Create",
2574
+ Update: "Framework.Resource.Update",
2575
+ Delete: "Framework.Resource.Delete"
2576
+ },
2577
+ File: {
2578
+ Default: "GeoWiki.File",
2579
+ Create: "GeoWiki.File.Create",
2580
+ Delete: "GeoWiki.File.Delete",
2581
+ Update: "GeoWiki.File.Update"
2582
+ },
2583
+ News: {
2584
+ Default: "GeoWiki.News",
2585
+ Create: "GeoWiki.News.Create",
2586
+ Delete: "GeoWiki.News.Delete",
2587
+ Update: "GeoWiki.News.Update"
2588
+ },
2589
+ Tenants: {
2590
+ Default: "AbpTenantManagement.Tenants",
2591
+ Create: "AbpTenantManagement.Tenants.Create",
2592
+ Delete: "AbpTenantManagement.Tenants.Delete",
2593
+ Update: "AbpTenantManagement.Tenants.Update",
2594
+ ManageConnectionStrings: "AbpTenantManagement.Tenants.ManageConnectionStrings",
2595
+ ManageFeatures: "AbpTenantManagement.Tenants.ManageFeatures"
2596
+ },
2597
+ Layer: {
2598
+ Default: "GeoWiki.Layer",
2599
+ Create: "GeoWiki.Layer.Create",
2600
+ Delete: "GeoWiki.Layer.Delete",
2601
+ Update: "GeoWiki.Layer.Update"
2602
+ },
2603
+ LayerCategory: {
2604
+ Default: "GeoWiki.LayerCategory",
2605
+ Create: "GeoWiki.LayerCategory.Create",
2606
+ Delete: "GeoWiki.LayerCategory.Delete",
2607
+ Update: "GeoWiki.LayerCategory.Update"
2608
+ },
2609
+ LayerInfo: {
2610
+ Default: "GeoWiki.LayerInfo",
2611
+ Create: "GeoWiki.LayerInfo.Create",
2612
+ Delete: "GeoWiki.LayerInfo.Delete",
2613
+ Update: "GeoWiki.LayerInfo.Update"
2614
+ },
2615
+ Settings: {
2616
+ Default: "GeoWiki.Settings",
2617
+ Create: "GeoWiki.Settings.Create",
2618
+ Update: "GeoWiki.Settings.Update"
2619
+ },
2620
+ Dashboard: {
2621
+ Default: "GeoWiki.Dashboard"
2622
+ }
2623
+ };
2624
+ var USER_ROLE = /* @__PURE__ */ ((USER_ROLE2) => {
2625
+ USER_ROLE2["ADMIN"] = "admin";
2626
+ USER_ROLE2["FARMER_CLUSTER_ADMIN"] = "FarmerClusterAdmin";
2627
+ return USER_ROLE2;
2628
+ })(USER_ROLE || {});
2629
+ var PermissionProvider = /* @__PURE__ */ ((PermissionProvider2) => {
2630
+ PermissionProvider2["U"] = "U";
2631
+ PermissionProvider2["R"] = "R";
2632
+ PermissionProvider2["T"] = "T";
2633
+ return PermissionProvider2;
2634
+ })(PermissionProvider || {});
2635
+ var Features = {
2636
+ FarmerCluster: "Framework.FarmerCluster",
2637
+ FarmerClusterNews: "Framework.FarmerCluster.News",
2638
+ SettingManagementEnable: "SettingManagement.Enable",
2639
+ GeoWikiLogin: "GeoWiki.Login",
2640
+ GeoWikiSettings: "GeoWiki.Settings",
2641
+ SettingManagementAllowTenantsToChangeEmailSettings: "SettingManagement.AllowTenantsToChangeEmailSettings",
2642
+ Resources: "Framework.FarmerCluster.Resource"
2643
+ };
2644
+ var FarmingSystem = [
2645
+ { value: "Conventional", label: "Conventional" },
2646
+ { value: "Organic", label: "Organic" },
2647
+ { value: "Certified", label: "Certified" },
2648
+ { value: "Other", label: "Other" }
2649
+ ];
2650
+ var MainAgriculturalAreas = [
2651
+ { value: "NonPermanentCrops", label: "Non permanent crops" },
2652
+ {
2653
+ value: "PermanentCultureAndTrees",
2654
+ label: "Permanent cultures and trees (fruit orchards, plantations, olive groves, vineyards, tree nurseries, etc.)"
2655
+ },
2656
+ { value: "TemporaryFallow", label: "Temporary fallow" },
2657
+ {
2658
+ value: "Grassland",
2659
+ label: "Grassland (meadows, pasture, other grassland)"
2660
+ },
2661
+ { value: "Other", label: "Other" }
2662
+ ];
2663
+ var MainCrops = [
2664
+ { value: "Cereals", label: "Cereals" },
2665
+ { value: "VegetablesAndMelons", label: "Vegetables and melons" },
2666
+ { value: "FruitAndNuts", label: "Fruit and nuts" },
2667
+ { value: "OilseedCrops", label: "Oilseed crops" },
2668
+ { value: "RootsAndTubers", label: "Roots and tubers" },
2669
+ { value: "BeverageCropsAndSpices", label: "Beverage crops and spices" },
2670
+ { value: "LeguminousCrops", label: "Leguminous crops" },
2671
+ { value: "SugarCrops", label: "Sugar crops" },
2672
+ {
2673
+ value: "OtherCropsIncludingGrasses",
2674
+ label: "Other crops, including grasses"
2675
+ }
2676
+ ];
2677
+ var LiveStock = [
2678
+ { value: "Cattle", label: "Cattle" },
2679
+ { value: "SheepAndGoats", label: "Sheep and goats" },
2680
+ { value: "Pigs", label: "Pigs" },
2681
+ {
2682
+ value: "HorsesMulesAndOtherEquines",
2683
+ label: "Horses, mules and other equines"
2684
+ },
2685
+ { value: "CamelsAndCamelids", label: "Camels and camelids" },
2686
+ { value: "Poultry", label: "Poultry" },
2687
+ { value: "InsectsIncludingBees", label: "Insects, including bees" },
2688
+ { value: "PigeonsAndOtherBirds", label: "Pigeons and other birds" },
2689
+ { value: "OtherAnimals", label: "Other animals" },
2690
+ { value: "NoLivestock", label: "No livestock" }
2691
+ ];
2692
+ var OtherLandscapeElements = [
2693
+ {
2694
+ value: "WoodyElements",
2695
+ label: "Woody elements (trees, tree lines, hedges, other woody strips)"
2696
+ },
2697
+ { value: "FlowerAreasAndStrips", label: "Flower areas and strips" },
2698
+ { value: "Scrubland", label: "Scrubland" },
2699
+ {
2700
+ value: "GrassStripsReedOrSedgeBeds",
2701
+ label: "Grassy strips, reed or sedge beds"
2702
+ },
2703
+ {
2704
+ value: "WaterElement",
2705
+ label: "Water elements (running fresh water, ponds, ditches)"
2706
+ },
2707
+ {
2708
+ value: "StoneRockAndSand",
2709
+ label: "Stone, rock, sands, bare soil or terrace elements"
2710
+ },
2711
+ { value: "Forest", label: "Forest" },
2712
+ { value: "Wetland", label: "Wetland" },
2713
+ { value: "OpenWaters", label: "Open waters" }
2714
+ ];
2715
+ var HuntingManagement = [
2716
+ { value: "SmallGame", label: "Small game" },
2717
+ { value: "BigGame", label: "Big game" },
2718
+ { value: "NoHunting", label: "No hunting" }
2719
+ ];
2720
+ var ClusterFunding = [
2721
+ { value: "LocalAndRegional", label: "Local / Regional" },
2722
+ { value: "National", label: "National" },
2723
+ { value: "DirectEU", label: "Direct EU" },
2724
+ { value: "SelfFunded", label: "Self funded" },
2725
+ { value: "Other", label: "Other" }
2726
+ ];
2727
+ var ActivityStatus = [
2728
+ { value: "Active", label: "Active" },
2729
+ { value: "Dormant", label: "Dormant" },
2730
+ { value: "Discontinued", label: "Discontinued" }
2731
+ ];
2732
+ var routes = {
2733
+ EditFarmerCluster: [
2734
+ {
2735
+ path: "/",
2736
+ name: "Home"
2737
+ },
2738
+ {
2739
+ path: "/admin/cluster",
2740
+ name: "My Area"
2741
+ },
2742
+ {
2743
+ path: "/admin/cluster",
2744
+ name: "My Farmer Clusters"
2745
+ },
2746
+ {
2747
+ path: "#",
2748
+ name: "Edit Farmer Cluster"
2749
+ }
2750
+ ],
2751
+ ViewFarmerClusterNews: [
2752
+ {
2753
+ path: "/",
2754
+ name: "Home"
2755
+ },
2756
+ {
2757
+ path: "/farmer-cluster",
2758
+ name: "Farmer Clusters"
2759
+ }
2760
+ ]
2761
+ };
2762
+ var imageMaxDimension = {
2763
+ width: 1920,
2764
+ height: 1080
2765
+ };
2766
+ var imageMinDimension = {
2767
+ width: 400,
2768
+ height: 250
2769
+ };
2770
+ var ImageError = "Image size requires a minimum 400px width and 250px height and is limited to max 1920px width and 1080px height.";
2771
+ var ColorArray = [
2772
+ "#423e4f",
2773
+ "#0072bb",
2774
+ "#009489",
2775
+ "#a47218",
2776
+ "#516c24",
2777
+ "#EC7063",
2778
+ "#5B2C6F",
2779
+ "#F1C40F"
2780
+ ];
2781
+ var ColorArrayCSSClass = [
2782
+ "bg-zinc-600",
2783
+ "bg-sky-600",
2784
+ "bg-teal-600",
2785
+ "bg-yellow-600",
2786
+ "bg-primary",
2787
+ "bg-rose-300",
2788
+ "bg-purple-600",
2789
+ "bg-orange-300"
2790
+ ];
2791
+ var Responsive = {
2792
+ desktop: {
2793
+ breakpoint: { max: 3e3, min: 1024 },
2794
+ items: 3,
2795
+ slidesToSlide: 3
2796
+ // optional, default to 1.
2797
+ },
2798
+ tablet: {
2799
+ breakpoint: { max: 1024, min: 464 },
2800
+ items: 2,
2801
+ slidesToSlide: 2
2802
+ // optional, default to 1.
2803
+ },
2804
+ mobile: {
2805
+ breakpoint: { max: 464, min: 0 },
2806
+ items: 1,
2807
+ slidesToSlide: 1
2808
+ // optional, default to 1.
2809
+ }
2810
+ };
2811
+ var ResourcesMenu = [
2812
+ {
2813
+ id: "1",
2814
+ name: "Resources",
2815
+ url: "/resources",
2816
+ newTab: false,
2817
+ children: [
2818
+ {
2819
+ id: "2",
2820
+ name: "Resource Finder",
2821
+ url: "/resources",
2822
+ newTab: false
2823
+ },
2824
+ {
2825
+ id: "3",
2826
+ name: "Collections",
2827
+ url: "/resources/collections",
2828
+ newTab: false
2829
+ }
2830
+ ]
2831
+ }
2832
+ ];
2833
+ var NewsDefaultImage = "3a084680-7984-e07d-d44e-d58f946604e3";
2834
+ var LookUps = {
2835
+ ClusterCountries: "Get countries in clusters",
2836
+ ClusterActivityStatus: "Get activity status in clusters",
2837
+ ClusterFarmingSystem: "Get farming system in clusters",
2838
+ ClusterMainAgricultureArea: "Get main agriculture areas in clusters",
2839
+ ClusterMainCrops: "Get main crops in clusters"
2840
+ };
2841
+ var AdminMenus = [
2842
+ {
2843
+ name: "Home",
2844
+ link: "/admin",
2845
+ icon: HomeIcon
2846
+ },
2847
+ {
2848
+ name: "Administration",
2849
+ icon: WrenchIcon,
2850
+ children: [
2851
+ {
2852
+ name: "Roles",
2853
+ link: "/admin/users/roles"
2854
+ },
2855
+ {
2856
+ name: "Users",
2857
+ link: "/admin/users"
2858
+ }
2859
+ ],
2860
+ roles: ["admin" /* ADMIN */]
2861
+ },
2862
+ {
2863
+ name: "Tenant Management",
2864
+ icon: UserIcon,
2865
+ children: [
2866
+ {
2867
+ name: "Tenants",
2868
+ link: "/admin/tenants"
2869
+ }
2870
+ ],
2871
+ roles: ["admin" /* ADMIN */]
2872
+ },
2873
+ {
2874
+ name: "Settings",
2875
+ link: "/admin/settings",
2876
+ icon: "SettingsIcon",
2877
+ roles: ["admin" /* ADMIN */]
2878
+ },
2879
+ {
2880
+ name: "Account",
2881
+ link: "/profile",
2882
+ icon: "AccountIcon",
2883
+ roles: ["admin" /* ADMIN */, "FarmerClusterAdmin" /* FARMER_CLUSTER_ADMIN */]
2884
+ },
2885
+ {
2886
+ name: "Farmer Clusters",
2887
+ link: "/admin/cluster",
2888
+ icon: "FarmerClustersIcon",
2889
+ roles: ["admin" /* ADMIN */, "FarmerClusterAdmin" /* FARMER_CLUSTER_ADMIN */],
2890
+ feature: [Features.FarmerCluster]
2891
+ },
2892
+ {
2893
+ name: "Resources",
2894
+ link: "/admin/resource",
2895
+ icon: "ResourcesIcon",
2896
+ roles: ["admin" /* ADMIN */],
2897
+ feature: [Features.Resources]
2898
+ }
2899
+ ];
2900
+ var CLUSTER_ACTIVITY_STATUS = [
2901
+ { value: "Active", label: "Active" },
2902
+ { value: "Dormant", label: "Dormant" },
2903
+ { value: "Discontinued", label: "Discontinued" }
2904
+ ];
2905
+
2906
+ // src/utils/analytics.ts
2907
+ var trackUmamiEvent = (eventName, eventData, session) => {
2908
+ var _a, _b, _c;
2909
+ console.log("trackUmamiEvent called:", eventName, eventData);
2910
+ if (typeof window !== "undefined" && window.umami) {
2911
+ const userInfo = session ? {
2912
+ userId: (_a = session.user) == null ? void 0 : _a.email,
2913
+ // Using email as userId since id might not be available
2914
+ userEmail: (_b = session.user) == null ? void 0 : _b.email,
2915
+ userName: (_c = session.user) == null ? void 0 : _c.name
2916
+ } : {};
2917
+ window.umami.track(eventName, __spreadValues(__spreadValues({}, eventData), userInfo));
2918
+ console.log("Umami track called with:", eventName, __spreadValues(__spreadValues({}, eventData), userInfo));
2919
+ } else {
2920
+ console.log("Umami not available or window undefined");
2921
+ }
2922
+ };
2923
+ var trackDownloadEvent = {
2924
+ /**
2925
+ * Track download attempt
2926
+ */
2927
+ attempt: (format, country, version, purpose, session) => {
2928
+ trackUmamiEvent(
2929
+ "download_attempt",
2930
+ { format, country, version, purpose },
2931
+ session
2932
+ );
2933
+ },
2934
+ /**
2935
+ * Track successful download
2936
+ */
2937
+ success: (filename, purpose, session) => {
2938
+ trackUmamiEvent("download_success", { filename, purpose }, session);
2939
+ },
2940
+ /**
2941
+ * Track download failure
2942
+ */
2943
+ failure: (error, purpose, session) => {
2944
+ trackUmamiEvent("download_failure", { error, purpose }, session);
2945
+ },
2946
+ /**
2947
+ * Track login attempt for download access
2948
+ */
2949
+ loginAttempt: (session) => {
2950
+ trackUmamiEvent("download_login_attempt", {}, session);
2951
+ }
2952
+ };
2953
+ var trackAuthEvent = {
2954
+ /**
2955
+ * Track login attempt
2956
+ */
2957
+ loginAttempt: (provider, session) => {
2958
+ trackUmamiEvent("auth_login_attempt", { provider }, session);
2959
+ },
2960
+ /**
2961
+ * Track successful login
2962
+ */
2963
+ loginSuccess: (provider, session) => {
2964
+ trackUmamiEvent("auth_login_success", { provider }, session);
2965
+ },
2966
+ /**
2967
+ * Track logout
2968
+ */
2969
+ logout: (session) => {
2970
+ trackUmamiEvent("auth_logout", {}, session);
2971
+ }
2972
+ };
2973
+ var trackUserEvent = {
2974
+ /**
2975
+ * Track page view
2976
+ */
2977
+ pageView: (page, session) => {
2978
+ trackUmamiEvent("page_view", { page }, session);
2979
+ },
2980
+ /**
2981
+ * Track button click
2982
+ */
2983
+ buttonClick: (buttonName, context, session) => {
2984
+ trackUmamiEvent("button_click", { buttonName, context }, session);
2985
+ },
2986
+ /**
2987
+ * Track form submission
2988
+ */
2989
+ formSubmit: (formName, session) => {
2990
+ trackUmamiEvent("form_submit", { formName }, session);
2991
+ },
2992
+ /**
2993
+ * Track map control button click with specific context
2994
+ */
2995
+ mapControlClick: (controlName, action, session) => {
2996
+ trackUmamiEvent("map_control_click", { controlName, action }, session);
2997
+ }
2998
+ };
2999
+ var trackMapEvent = {
3000
+ /**
3001
+ * Track layer toggle
3002
+ */
3003
+ layerToggle: (layerName, action, session) => {
3004
+ console.log("Tracking layer toggle:", layerName, action);
3005
+ trackUmamiEvent("map_layer_toggle", { layerName, action }, session);
3006
+ },
3007
+ /**
3008
+ * Track base layer change
3009
+ */
3010
+ baseLayerChange: (baseLayerName, session) => {
3011
+ trackUmamiEvent("map_base_layer_change", { baseLayerName }, session);
3012
+ },
3013
+ /**
3014
+ * Track layer opacity change
3015
+ */
3016
+ layerOpacityChange: (layerName, opacity, session) => {
3017
+ trackUmamiEvent(
3018
+ "map_layer_opacity_change",
3019
+ { layerName, opacity },
3020
+ session
3021
+ );
3022
+ },
3023
+ /**
3024
+ * Track layer reorder
3025
+ */
3026
+ layerReorder: (layerName, newPosition, session) => {
3027
+ trackUmamiEvent("map_layer_reorder", { layerName, newPosition }, session);
3028
+ },
3029
+ /**
3030
+ * Track layer info view
3031
+ */
3032
+ layerInfoView: (layerName, session) => {
3033
+ trackUmamiEvent("map_layer_info_view", { layerName }, session);
3034
+ },
3035
+ /**
3036
+ * Track measurement tool usage
3037
+ */
3038
+ measurementTool: (action, session) => {
3039
+ trackUmamiEvent("map_measurement_tool", { action }, session);
3040
+ },
3041
+ /**
3042
+ * Track zoom control usage
3043
+ */
3044
+ zoomControl: (action, session) => {
3045
+ trackUmamiEvent("map_zoom_control", { action }, session);
3046
+ },
3047
+ /**
3048
+ * Track legend interaction
3049
+ */
3050
+ legendInteraction: (action, session) => {
3051
+ trackUmamiEvent("map_legend_interaction", { action }, session);
3052
+ }
3053
+ };
3054
+ export {
3055
+ ActivityStatus,
3056
+ AdminMenus,
3057
+ AnnotationRequired,
3058
+ CLUSTER_ACTIVITY_STATUS,
3059
+ ClusterFunding,
3060
+ ColorArray,
3061
+ ColorArrayCSSClass,
3062
+ Config,
3063
+ DOTS,
3064
+ FarmingSystem,
3065
+ Features,
3066
+ HostService,
3067
+ HostType,
3068
+ HuntingManagement,
3069
+ ImageError,
3070
+ IsTokenExpired,
3071
+ LiveStock,
3072
+ LookUps,
3073
+ MainAgriculturalAreas,
3074
+ MainCrops,
3075
+ NewsDefaultImage,
3076
+ OtherLandscapeElements,
3077
+ Permission,
3078
+ PermissionProvider,
3079
+ QueryConstants,
3080
+ QueryNames,
3081
+ QuestionnaireType,
3082
+ ResourcesMenu,
3083
+ Responsive,
3084
+ StyleType,
3085
+ TaskEventType,
3086
+ TaskState,
3087
+ TaskStatus2 as TaskStatus,
3088
+ TaskStatusColor,
3089
+ USER_ROLE,
3090
+ ViewStatus,
3091
+ classNames,
3092
+ configStore,
3093
+ delayedSlideInUp,
3094
+ downloadData,
3095
+ downloadJSON,
3096
+ easing,
3097
+ findHostInfo,
3098
+ formatUnixDate,
3099
+ getButtonAppearance,
3100
+ getCmsUrlForHost,
3101
+ getContentWithSlug,
3102
+ getContentWithTypeAndDisplayName,
3103
+ getContentsWithType,
3104
+ getDefaultSettings,
3105
+ getGeoWikiSettings,
3106
+ getHostData,
3107
+ getHostFromRequest,
3108
+ getHtmlElementFromReactNode,
3109
+ getMediaUrl,
3110
+ getMenus,
3111
+ getPageContent,
3112
+ getPageProps,
3113
+ getTenantIdForHost,
3114
+ i18n,
3115
+ imageMaxDimension,
3116
+ imageMinDimension,
3117
+ itemVariants,
3118
+ keyStr,
3119
+ listVariants,
3120
+ rgbDataURL,
3121
+ routes,
3122
+ scrollToFirstErrorElement,
3123
+ settingsStore,
3124
+ shimmer,
3125
+ showIntroTour,
3126
+ slideInLeft,
3127
+ slideInRight,
3128
+ slideInUp,
3129
+ spring,
3130
+ toBase64,
3131
+ tokenData,
3132
+ trackAuthEvent,
3133
+ trackDownloadEvent,
3134
+ trackMapEvent,
3135
+ trackUmamiEvent,
3136
+ trackUserEvent,
3137
+ triplet,
3138
+ useAllNewsFromAllClusters,
3139
+ useApiImage,
3140
+ useApiUrl,
3141
+ useAppConfig,
3142
+ useAssignProjectToUser,
3143
+ useAssignableRoles,
3144
+ useAudience,
3145
+ useBasfStore,
3146
+ useBreadCrumbStore,
3147
+ useCluster,
3148
+ useClusterAllNews,
3149
+ useClusterDescription,
3150
+ useClusterDetails,
3151
+ useClusterFilterSettings,
3152
+ useClusterGetJoinRequests,
3153
+ useClusterGetNews,
3154
+ useClusterGetNewsNextPreviousStatus,
3155
+ useClusterImages,
3156
+ useClusterImagesAndVideos,
3157
+ useClusterLinks,
3158
+ useClusterMapInfo,
3159
+ useClusterNews,
3160
+ useClusterNewsWithId,
3161
+ useClusterOverview,
3162
+ useClusters,
3163
+ useCmsContentWithType,
3164
+ useCmsImage,
3165
+ useCmsUrl,
3166
+ useConfigSettings,
3167
+ useContractStatisticsByUser,
3168
+ useCountries,
3169
+ useCreateHost,
3170
+ useCurrentUser,
3171
+ useDefaultSettings,
3172
+ useDeleteHost,
3173
+ useDimensions,
3174
+ useEmailing,
3175
+ useEvolandBands,
3176
+ useEvolandLabels,
3177
+ useEvolandWmsLayers,
3178
+ useFeature,
3179
+ useFeatures,
3180
+ useFileUpload,
3181
+ useFileUrl,
3182
+ useFilterClusters,
3183
+ useGeoWikiSettings,
3184
+ useGetUserProject,
3185
+ useGrantedPolicies,
3186
+ useGroupsInProject,
3187
+ useHost,
3188
+ useHosts,
3189
+ useImageUrl,
3190
+ useIntroTourSettings,
3191
+ useIsAdmin,
3192
+ useIsAuthenticated,
3193
+ useIsInRole,
3194
+ useLanguages,
3195
+ useLatestTaskOnLocation,
3196
+ useLayerInfo,
3197
+ useLayerStore,
3198
+ useLocation,
3199
+ useLocationBulkUpload,
3200
+ useLocationsForProject,
3201
+ useLockBodyScroll,
3202
+ useLookUp,
3203
+ useMapMenuItems,
3204
+ useNews,
3205
+ useNewsFromAllClusters,
3206
+ usePagination,
3207
+ usePanelStore,
3208
+ usePermission,
3209
+ usePermissions,
3210
+ useProfile,
3211
+ useProjectDetails,
3212
+ useProjectResultSet,
3213
+ useProjectStatisticsByUser,
3214
+ useProjectUsers,
3215
+ useProjects,
3216
+ useProjectsPointsDownload,
3217
+ usePublicationSettings,
3218
+ useQuestionnaire,
3219
+ useRandomTasksPerLocation,
3220
+ useRenderInfo,
3221
+ useResource,
3222
+ useResourceFilter,
3223
+ useResourceType,
3224
+ useReviewTaskBulkUpload,
3225
+ useRoles,
3226
+ useTaskAnnotation,
3227
+ useTaskAnswers,
3228
+ useTaskBulkUpload,
3229
+ useTaskComments,
3230
+ useTaskDelete,
3231
+ useTaskMultipleAnnotations,
3232
+ useTaskSavedAnnotations,
3233
+ useTaskStatusList,
3234
+ useTasksPerLocation,
3235
+ useTenants,
3236
+ useTopic,
3237
+ useUpdateActiveGroupInProject,
3238
+ useUpdateHost,
3239
+ useUpdateUserDetail,
3240
+ useUserProfileGet,
3241
+ useUserRoles,
3242
+ useUsers
3243
+ };