@geowiki/cms 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.
Files changed (98) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +55 -0
  3. package/dist/BannerFollowLinksWidget-26TXCSTL.mjs +21 -0
  4. package/dist/CardGridWidget-VZIU6X63.mjs +7 -0
  5. package/dist/CardWidget-7UX7ACLE.mjs +7 -0
  6. package/dist/ColumnWidget-XEDFONE6.mjs +7 -0
  7. package/dist/ContactCardsWidget-KRR6IY4X.mjs +95 -0
  8. package/dist/ContactWidget-WJH7K4FN.mjs +7 -0
  9. package/dist/ContainerWidget-6T555RQD.mjs +8 -0
  10. package/dist/DownloadQuestWidget-EVKBU33Z.mjs +86 -0
  11. package/dist/EntityListWidget-JC6UCIP5.mjs +7 -0
  12. package/dist/FarmerClusterFinderWidget-YENEGEZN.mjs +7 -0
  13. package/dist/FeatureRowWidget-YXCRZBKZ.mjs +7 -0
  14. package/dist/FeatureRowWithImageWidget-RDAGTLCL.mjs +7 -0
  15. package/dist/FeatureRowWithMultipleImagesWidget-NWLWBI3L.mjs +7 -0
  16. package/dist/GalleryWidget-7A3FR3Y7.mjs +7 -0
  17. package/dist/H2BodyInternalLinkMapWidget-T7MARJTA.mjs +78 -0
  18. package/dist/HeaderBodyWidget-ZW2WYKNP.mjs +27 -0
  19. package/dist/HeaderWidget-DUNY7APY.mjs +7 -0
  20. package/dist/HeadingTextWidget-YC36BLDY.mjs +6 -0
  21. package/dist/HeroCenterTextWidget-5LDZNUBR.mjs +7 -0
  22. package/dist/HeroMap-AT3N4ZVZ.mjs +164 -0
  23. package/dist/HeroWidget-A4ODJCXZ.mjs +7 -0
  24. package/dist/IframeWidget-DPA25ZE2.mjs +17 -0
  25. package/dist/ImageLeftH3BodyLinkWidget-JMALBJVD.mjs +26 -0
  26. package/dist/ImageLefttH3BodyWidget-2YAEQZHJ.mjs +26 -0
  27. package/dist/ImageWidget-JWDKESIB.mjs +7 -0
  28. package/dist/LanguagesWidget-OENZMIFA.mjs +61 -0
  29. package/dist/MapHeroWidget-MLNO6KKC.mjs +7 -0
  30. package/dist/MarkdownWidget-QTTNNVQW.mjs +7 -0
  31. package/dist/NewContactUsWidget-R5TILYPP.mjs +237 -0
  32. package/dist/NewTestimonialsWidget-CVFZM2UI.mjs +17 -0
  33. package/dist/NewfeedPreviewWidget-VM6ZMYGO.mjs +25 -0
  34. package/dist/NewsFeedWidget-4W7T4H2P.mjs +22 -0
  35. package/dist/NewsLetterWidget-PMR355EB.mjs +7 -0
  36. package/dist/QuestMapClient-B6LGGSGT.mjs +120 -0
  37. package/dist/QuestMapWidget-5JIFDDUO.mjs +22 -0
  38. package/dist/ResourceCollectionItemWidget-QXAJEPCN.mjs +7 -0
  39. package/dist/ResourceCollectionsWidget-KZ5HD3PG.mjs +8 -0
  40. package/dist/ResourceQuickFindWidget-S3OJV3GF.mjs +9 -0
  41. package/dist/RowWidget-VSVZUIYH.mjs +7 -0
  42. package/dist/SelectQuestWidget-YGZ5TFLV.mjs +161 -0
  43. package/dist/SignUpBannerWidget-R77S5VSL.mjs +27 -0
  44. package/dist/SimpleActionListWidget-NF32S56W.mjs +7 -0
  45. package/dist/SimpleCallToActionWidget-3LI6HMJR.mjs +7 -0
  46. package/dist/SixClusterNewsWidget-5DDHGLAI.mjs +11 -0
  47. package/dist/SpecialFeaturesWidget-ZWILQPVB.mjs +7 -0
  48. package/dist/StatsWidget-4MISF6XB.mjs +7 -0
  49. package/dist/SubtitleH2BodyVideoWidget-CP7T4FJ6.mjs +24 -0
  50. package/dist/SubtitleH3BodyInternalLinkListWidget-KFP3TIKE.mjs +25 -0
  51. package/dist/SubtitleH3BodySpecialFeatureResourceCollectionsWidget-62SJ4J73.mjs +37 -0
  52. package/dist/SubtitleH3BodyWidget-7XGVXSMR.mjs +35 -0
  53. package/dist/SubtitleH3ChildrenWidget-CA3TR726.mjs +40 -0
  54. package/dist/SubtitleH3FaqWidget-VXVV7TUL.mjs +78 -0
  55. package/dist/SubtitleH3KeyResourcesWidget-AGBBJ7ZJ.mjs +24 -0
  56. package/dist/SubtitleH3ResourceCollectionsWidget-IBDVHMSC.mjs +37 -0
  57. package/dist/TestimonialListWidget-5OKZ5TQQ.mjs +7 -0
  58. package/dist/UpdateUserInfoWidget-4I6RJQ5M.mjs +7 -0
  59. package/dist/UserInfoWidget-AS53SE7B.mjs +7 -0
  60. package/dist/VideoWidget-YRR7FCDN.mjs +18 -0
  61. package/dist/chunk-4AG2CMM3.mjs +86 -0
  62. package/dist/chunk-AO6SFQGL.mjs +20 -0
  63. package/dist/chunk-AQKMITUZ.mjs +52 -0
  64. package/dist/chunk-DED6JF7X.mjs +335 -0
  65. package/dist/chunk-DMKIIBTI.mjs +11 -0
  66. package/dist/chunk-DVN7SXOC.mjs +131 -0
  67. package/dist/chunk-ECRLCFXK.mjs +65 -0
  68. package/dist/chunk-ER4KI2WR.mjs +24 -0
  69. package/dist/chunk-FQ57AT5X.mjs +51 -0
  70. package/dist/chunk-HLTYOLFG.mjs +20 -0
  71. package/dist/chunk-J7SY757T.mjs +44 -0
  72. package/dist/chunk-JJWETKAK.mjs +18 -0
  73. package/dist/chunk-JNVPTKNZ.mjs +20 -0
  74. package/dist/chunk-KR42WXX4.mjs +18 -0
  75. package/dist/chunk-LIPPN7U2.mjs +25 -0
  76. package/dist/chunk-MR3ABJDZ.mjs +30 -0
  77. package/dist/chunk-NSGNUHUW.mjs +28 -0
  78. package/dist/chunk-O6WFR4J5.mjs +10 -0
  79. package/dist/chunk-OCSKL7XJ.mjs +34 -0
  80. package/dist/chunk-QDEIIXMC.mjs +52 -0
  81. package/dist/chunk-QYIHQTW5.mjs +46 -0
  82. package/dist/chunk-RXVHS4OJ.mjs +24 -0
  83. package/dist/chunk-SNHJDG24.mjs +44 -0
  84. package/dist/chunk-UGGGP7ZA.mjs +166 -0
  85. package/dist/chunk-UYS3OVMP.mjs +9 -0
  86. package/dist/chunk-VFXOGW3A.mjs +10 -0
  87. package/dist/chunk-VFYJ2I2X.mjs +45 -0
  88. package/dist/chunk-VHLUUHQ3.mjs +43 -0
  89. package/dist/chunk-VKH6K2KB.mjs +33 -0
  90. package/dist/chunk-XF76SGFU.mjs +10 -0
  91. package/dist/chunk-XR7AIYAA.mjs +112 -0
  92. package/dist/html-section-CWKFJCXX.mjs +7 -0
  93. package/dist/index.d.mts +185 -0
  94. package/dist/index.d.ts +185 -0
  95. package/dist/index.js +3990 -0
  96. package/dist/index.mjs +343 -0
  97. package/dist/styles.css +1 -0
  98. package/package.json +79 -0
@@ -0,0 +1,27 @@
1
+ // src/components/Section/HeaderBodyWidget.tsx
2
+ import { H1Body, H7Body } from "@geowiki/ui";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var HeaderBodyWidget = ({ data }) => {
5
+ var type = data.HeaderBody.Type.Values[0];
6
+ if (type === "H1Body") {
7
+ return /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-full lg:container lg:max-w-5xl", children: /* @__PURE__ */ jsx(
8
+ H1Body,
9
+ {
10
+ title: data.TitlePart.Title,
11
+ textBody: data.HeaderBody.TextBody.Html
12
+ }
13
+ ) });
14
+ }
15
+ if (type === "H7Body") {
16
+ return /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-full lg:container lg:max-w-5xl", children: /* @__PURE__ */ jsx(
17
+ H7Body,
18
+ {
19
+ title: data.TitlePart.Title,
20
+ textBody: data.HeaderBody.TextBody.Html
21
+ }
22
+ ) });
23
+ }
24
+ };
25
+ export {
26
+ HeaderBodyWidget
27
+ };
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ HeaderWidget
4
+ } from "./chunk-ER4KI2WR.mjs";
5
+ export {
6
+ HeaderWidget
7
+ };
@@ -0,0 +1,6 @@
1
+ import {
2
+ HeadingTextWidget
3
+ } from "./chunk-QDEIIXMC.mjs";
4
+ export {
5
+ HeadingTextWidget
6
+ };
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ HeroCenterTextWidget
4
+ } from "./chunk-JJWETKAK.mjs";
5
+ export {
6
+ HeroCenterTextWidget
7
+ };
@@ -0,0 +1,164 @@
1
+ // src/components/ClusterMap/HeroMap.tsx
2
+ import { MapContainer, TileLayer } from "react-leaflet";
3
+ import "leaflet/dist/leaflet.css";
4
+
5
+ // src/components/ClusterMap/cluster-markers.tsx
6
+ import { DivIcon, LatLng, divIcon } from "leaflet";
7
+ import { Marker, Popup } from "react-leaflet";
8
+ import { useClusterMapInfo } from "@geowiki/core";
9
+ import { DesignFarmerClusterPin, LoaderFull } from "@geowiki/ui";
10
+
11
+ // src/components/ClusterMap/MarkerClusterGroup.tsx
12
+ import {
13
+ extendContext,
14
+ createElementObject,
15
+ createPathComponent
16
+ } from "@react-leaflet/core";
17
+ import * as L from "leaflet";
18
+ import "leaflet.markercluster";
19
+ function getPropsAndEvents(props) {
20
+ let clusterProps = {};
21
+ let clusterEvents = {};
22
+ const { children, ...rest } = props;
23
+ Object.entries(rest).forEach(([propName, prop]) => {
24
+ if (propName.startsWith("on")) {
25
+ clusterEvents = { ...clusterEvents, [propName]: prop };
26
+ } else {
27
+ clusterProps = { ...clusterProps, [propName]: prop };
28
+ }
29
+ });
30
+ return { clusterProps, clusterEvents };
31
+ }
32
+ function createMarkerClusterGroup(props, context) {
33
+ const { clusterProps, clusterEvents } = getPropsAndEvents(props);
34
+ const markerClusterGroup = new L.MarkerClusterGroup(clusterProps);
35
+ Object.entries(clusterEvents).forEach(([eventAsProp, callback]) => {
36
+ const clusterEvent = `cluster${eventAsProp.substring(2).toLowerCase()}`;
37
+ markerClusterGroup.on(clusterEvent, callback);
38
+ });
39
+ return createElementObject(
40
+ markerClusterGroup,
41
+ extendContext(context, { layerContainer: markerClusterGroup })
42
+ );
43
+ }
44
+ var updateMarkerCluster = () => {
45
+ };
46
+ var MarkerClusterGroup2 = createPathComponent(
47
+ createMarkerClusterGroup,
48
+ updateMarkerCluster
49
+ );
50
+
51
+ // src/components/ClusterMap/cluster-markers.tsx
52
+ import { useFileUrl } from "@geowiki/core";
53
+ import MapPinIcon from "@heroicons/react/24/solid/MapPinIcon";
54
+ import { renderToString } from "react-dom/server";
55
+ import { useConfigSettings } from "@geowiki/core";
56
+ import { MapIcon, IconPaths } from "@geowiki/ui";
57
+ import { jsx } from "react/jsx-runtime";
58
+ function getIcon(color, name) {
59
+ const myIcon = IconPaths.find((icon) => icon.name === name);
60
+ if (myIcon) {
61
+ const MyIcon = MapIcon;
62
+ return renderToString(/* @__PURE__ */ jsx(MyIcon, { Icon: myIcon.icon, color }));
63
+ } else {
64
+ const MyIcon = MapPinIcon;
65
+ return renderToString(/* @__PURE__ */ jsx(MyIcon, { height: 40, width: 40, color }));
66
+ }
67
+ }
68
+ var createClusterIcon = (color) => {
69
+ return (cluster) => {
70
+ const markers = cluster.getAllChildMarkers();
71
+ const statusCount = {
72
+ ongoing: 0,
73
+ auxiliary: 0,
74
+ default: 0
75
+ };
76
+ markers.forEach((marker) => {
77
+ const status = marker.feature?.properties?.Status?.trim().toLowerCase() || "default";
78
+ if (status === "ongoing")
79
+ statusCount.ongoing++;
80
+ else if (status === "auxiliary")
81
+ statusCount.auxiliary++;
82
+ else
83
+ statusCount.default++;
84
+ });
85
+ return divIcon({
86
+ html: `<div style=
87
+ "background-color: ${color};
88
+ width: 36px;
89
+ height: 36px;
90
+ border-radius: 50%;
91
+ display: flex;
92
+ justify-content: center;
93
+ align-items: center;
94
+ text-align: center;
95
+ justify-content: center;
96
+ font-size: 14px;
97
+ font-weight: 600;
98
+ color: white;
99
+ ">${markers.length}</div>`,
100
+ className: "custom-cluster-icon",
101
+ iconSize: [30, 30]
102
+ });
103
+ };
104
+ };
105
+ var ClusterMarkers = (_props) => {
106
+ const { data: ConfigSettings, isLoading: IsConfigSettingsLoaded } = useConfigSettings();
107
+ const { data, error, isLoading } = useClusterMapInfo();
108
+ const fileUrl = useFileUrl();
109
+ if (error)
110
+ return null;
111
+ if (isLoading || IsConfigSettingsLoaded)
112
+ return /* @__PURE__ */ jsx(LoaderFull, {});
113
+ if (ConfigSettings?.ConfigSettings?.FeaturesFarmerCluster?.Text) {
114
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(MarkerClusterGroup2, { iconCreateFunction: createClusterIcon("#9999CC"), children: data?.map((cluster) => /* @__PURE__ */ jsx(
115
+ Marker,
116
+ {
117
+ icon: new DivIcon({
118
+ iconSize: [30, 30],
119
+ html: `<i>${getIcon("#9999CC", "Farmer Clusters")}</i>`,
120
+ className: "custom-div-icon",
121
+ iconAnchor: [18, 30]
122
+ }),
123
+ position: cluster.location ? new LatLng(
124
+ cluster?.location?.latitude,
125
+ cluster?.location?.longitude
126
+ ) : new LatLng(0, 0),
127
+ children: /* @__PURE__ */ jsx(Popup, { maxWidth: 600, children: /* @__PURE__ */ jsx("div", { className: "bg-white text-black rounded-3xl", children: /* @__PURE__ */ jsx(
128
+ DesignFarmerClusterPin,
129
+ {
130
+ farmerCluster: {
131
+ description: cluster.description,
132
+ path: `${fileUrl}${cluster.coverImageId}`,
133
+ title: cluster.name,
134
+ viewUrl: `/cluster/view/${cluster.id}`
135
+ }
136
+ }
137
+ ) }) })
138
+ },
139
+ cluster.id
140
+ )) }) });
141
+ } else {
142
+ return null;
143
+ }
144
+ };
145
+
146
+ // src/components/ClusterMap/HeroMap.tsx
147
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
148
+ var HeroMap = () => {
149
+ const position = [48.210033, 16.363449];
150
+ return /* @__PURE__ */ jsxs(MapContainer, { center: position, zoom: 5, scrollWheelZoom: false, children: [
151
+ /* @__PURE__ */ jsx2(
152
+ TileLayer,
153
+ {
154
+ attribution: '\xA9 <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
155
+ url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
156
+ maxZoom: 18
157
+ }
158
+ ),
159
+ /* @__PURE__ */ jsx2(ClusterMarkers, {})
160
+ ] });
161
+ };
162
+ export {
163
+ HeroMap
164
+ };
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ HeroWidget
4
+ } from "./chunk-XR7AIYAA.mjs";
5
+ export {
6
+ HeroWidget
7
+ };
@@ -0,0 +1,17 @@
1
+ "use client";
2
+
3
+ // src/components/Section/IframeWidget.tsx
4
+ import { IframeViewer } from "@geowiki/ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var IframeWidget = ({ data }) => {
7
+ return /* @__PURE__ */ jsx("div", { className: "lg:container mx-auto", children: /* @__PURE__ */ jsx(
8
+ IframeViewer,
9
+ {
10
+ html: data.IframeViewer?.Content?.Text,
11
+ className: data.IframeViewer?.ClassName?.Text
12
+ }
13
+ ) });
14
+ };
15
+ export {
16
+ IframeWidget
17
+ };
@@ -0,0 +1,26 @@
1
+ "use client";
2
+
3
+ // src/components/Section/ImageLeftH3BodyLinkWidget.tsx
4
+ import { ImageLeftH3BodyLink } from "@geowiki/ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var ImageLeftH3BodyLinkWidget = ({
7
+ data
8
+ }) => {
9
+ var buttonProps = {
10
+ text: data.LinkPart.Text.Text,
11
+ link: data.LinkPart.Url.Text,
12
+ isNewTab: data.LinkPart.IsNewTab.Value
13
+ };
14
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
15
+ ImageLeftH3BodyLink,
16
+ {
17
+ title: data.TitlePart.Title,
18
+ content: data.ImageLeftH3BodyLink.Content.Html,
19
+ button: buttonProps,
20
+ path: data?.ImageLeftH3BodyLink?.Image?.Paths[0]
21
+ }
22
+ ) });
23
+ };
24
+ export {
25
+ ImageLeftH3BodyLinkWidget
26
+ };
@@ -0,0 +1,26 @@
1
+ "use client";
2
+
3
+ // src/components/Section/ImageLefttH3BodyWidget.tsx
4
+ import { ImageLefttH3Body } from "@geowiki/ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var ImageLefttH3BodyWidget = ({
7
+ data
8
+ }) => {
9
+ var button = {
10
+ text: data.LinkPart.Text.Text,
11
+ link: data.LinkPart.Url.Text,
12
+ isNewTab: data.LinkPart.IsNewTab.Value
13
+ };
14
+ return /* @__PURE__ */ jsx(
15
+ ImageLefttH3Body,
16
+ {
17
+ imagePath: data?.ImageLefttH3Body?.Image?.Paths,
18
+ title: data.TitlePart?.Title,
19
+ text: data?.ImageLefttH3Body?.Text?.Html,
20
+ button
21
+ }
22
+ );
23
+ };
24
+ export {
25
+ ImageLefttH3BodyWidget
26
+ };
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ ImageWidget
4
+ } from "./chunk-KR42WXX4.mjs";
5
+ export {
6
+ ImageWidget
7
+ };
@@ -0,0 +1,61 @@
1
+ import {
2
+ Sections
3
+ } from "./chunk-DED6JF7X.mjs";
4
+
5
+ // src/components/Section/Recodo/LanguagesWidget.tsx
6
+ import { useCmsContentWithType, useDefaultSettings } from "@geowiki/core";
7
+ import { Label, RadioGroup, RadioGroupItem } from "@geowiki/ui";
8
+ import { useEffect, useState } from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ var LanguageWidget = () => {
11
+ const { data: languages, isLoading: isLanguagesLoading } = useCmsContentWithType("LanguageItem");
12
+ const { data: generalSettings, isLoading: isGeneralSettingsLoading } = useDefaultSettings();
13
+ const [selectedLanguageContent, setSelectedLanguageContent] = useState();
14
+ const handleLanguageChange = (language) => {
15
+ const selectedLang = languages.find(
16
+ (lang) => lang.TitlePart.Title === language
17
+ );
18
+ console.log(selectedLang);
19
+ setSelectedLanguageContent(selectedLang);
20
+ };
21
+ useEffect(() => {
22
+ if (languages) {
23
+ const englishLanguage = languages.find(
24
+ (lang) => lang.TitlePart.Title === "English"
25
+ );
26
+ setSelectedLanguageContent(englishLanguage);
27
+ }
28
+ }, [languages]);
29
+ if (isLanguagesLoading || isGeneralSettingsLoading)
30
+ return /* @__PURE__ */ jsx("div", { children: "Loading..." });
31
+ return /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-8", children: [
32
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4 lg:mt-28", children: [
33
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold", children: "Language" }),
34
+ /* @__PURE__ */ jsx("nav", { className: "space-y-1", children: /* @__PURE__ */ jsx(
35
+ RadioGroup,
36
+ {
37
+ defaultValue: "English",
38
+ onValueChange: (e) => {
39
+ console.log(e);
40
+ handleLanguageChange(e);
41
+ },
42
+ children: languages.map((language, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
43
+ /* @__PURE__ */ jsx(RadioGroupItem, { value: language?.TitlePart?.Title, id: "r1" }),
44
+ /* @__PURE__ */ jsx(Label, { htmlFor: "r1", children: language?.TitlePart?.Title })
45
+ ] }, index))
46
+ }
47
+ ) })
48
+ ] }),
49
+ /* @__PURE__ */ jsx("div", { className: "md:col-span-2 space-y-6", children: /* @__PURE__ */ jsx(
50
+ Sections,
51
+ {
52
+ sections: selectedLanguageContent?.Content.ContentItems,
53
+ settings: generalSettings,
54
+ cmsUrl: ""
55
+ }
56
+ ) })
57
+ ] }) });
58
+ };
59
+ export {
60
+ LanguageWidget
61
+ };
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ MapHeroWidget
4
+ } from "./chunk-NSGNUHUW.mjs";
5
+ export {
6
+ MapHeroWidget
7
+ };
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ MarkdownWidget
4
+ } from "./chunk-UYS3OVMP.mjs";
5
+ export {
6
+ MarkdownWidget
7
+ };
@@ -0,0 +1,237 @@
1
+ "use client";
2
+
3
+ // src/components/Section/NewContactUsWidget.tsx
4
+ import { ClusterService } from "@geowiki/api-proxy";
5
+ import { useRef } from "react";
6
+ import { useForm } from "react-hook-form";
7
+ import { Checkbox, DesignInput } from "@geowiki/ui";
8
+ import {
9
+ DesignSelect,
10
+ DesignSelectContent,
11
+ DesignSelectGroup,
12
+ DesignSelectItem,
13
+ DesignSelectTrigger,
14
+ DesignSelectValue,
15
+ Notification,
16
+ FormField,
17
+ FormControl,
18
+ Form,
19
+ FormItem
20
+ } from "@geowiki/ui";
21
+ import { DesignButton } from "@geowiki/ui";
22
+ import { useState } from "react";
23
+ import { useAudience } from "@geowiki/core";
24
+ import { z } from "zod";
25
+ import { zodResolver } from "@hookform/resolvers/zod";
26
+ import { jsx, jsxs } from "react/jsx-runtime";
27
+ var ContactFormSchema = z.object({
28
+ name: z.string().min(3, "Name is required"),
29
+ email: z.string().email("Invalid email address"),
30
+ subject: z.string().min(3, "Subject is required"),
31
+ role: z.string({ message: "Role is required" }).min(3, "Role is required"),
32
+ message: z.string().min(3, "Message is required"),
33
+ acceptTerms: z.boolean({ message: "You must accept the terms and conditions" }).default(false).refine((val) => {
34
+ return val === true;
35
+ }, "You must accept the terms and conditions")
36
+ });
37
+ var NewContactUsWidget = ({ data }) => {
38
+ console.log("data", data);
39
+ const formRef = useRef(null);
40
+ const { data: audiences, isLoading: isAudienceLoading } = useAudience();
41
+ const [open, setOpen] = useState(false);
42
+ const [openSending, setOpenSending] = useState(false);
43
+ const form = useForm({
44
+ resolver: zodResolver(ContactFormSchema)
45
+ });
46
+ const {
47
+ register,
48
+ handleSubmit,
49
+ watch,
50
+ reset,
51
+ control,
52
+ formState: { errors }
53
+ } = form;
54
+ const acceptTerms = watch("acceptTerms");
55
+ const onSubmit = async (data2) => {
56
+ setOpenSending(true);
57
+ ClusterService.clusterRecodoContact({
58
+ name: data2.name,
59
+ email: data2.email,
60
+ subject: data2.subject,
61
+ role: data2.role,
62
+ message: data2.message
63
+ }).then(() => {
64
+ setOpenSending(false);
65
+ setOpen(true);
66
+ reset({
67
+ name: "",
68
+ email: "",
69
+ subject: "",
70
+ role: void 0,
71
+ message: "",
72
+ acceptTerms: false
73
+ });
74
+ }).catch((error) => {
75
+ console.log(error);
76
+ setOpenSending(false);
77
+ setOpen(false);
78
+ });
79
+ };
80
+ return /* @__PURE__ */ jsx("div", { className: "p-5 bg-grey-lightest rounded-xl flex justify-center mt-6 lg:px-88 lg:py-20 lg:mt-12", children: /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs(
81
+ "form",
82
+ {
83
+ onSubmit: handleSubmit(onSubmit),
84
+ className: "w-[41.25rem] space-y-8",
85
+ ref: formRef,
86
+ children: [
87
+ /* @__PURE__ */ jsxs("div", { className: "space-y-8", children: [
88
+ /* @__PURE__ */ jsx(
89
+ DesignInput,
90
+ {
91
+ placeholder: "Your name",
92
+ type: "text",
93
+ id: "name",
94
+ autoComplete: "name",
95
+ ...register("name", { required: true })
96
+ }
97
+ ),
98
+ errors.name && /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm", children: errors.name.message }),
99
+ /* @__PURE__ */ jsx(
100
+ DesignInput,
101
+ {
102
+ placeholder: "Your email",
103
+ type: "email",
104
+ id: "from",
105
+ autoComplete: "email",
106
+ ...register("email", { required: true })
107
+ }
108
+ ),
109
+ errors.email && /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm", children: errors.email.message }),
110
+ /* @__PURE__ */ jsx(
111
+ DesignInput,
112
+ {
113
+ placeholder: "Your subject",
114
+ id: "subject",
115
+ ...register("subject", { required: true })
116
+ }
117
+ ),
118
+ errors.subject && /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm", children: errors.subject.message }),
119
+ !isAudienceLoading && /* @__PURE__ */ jsx(
120
+ FormField,
121
+ {
122
+ control,
123
+ name: "role",
124
+ render: ({ field }) => /* @__PURE__ */ jsxs(
125
+ DesignSelect,
126
+ {
127
+ onValueChange: field.onChange,
128
+ defaultValue: field.value,
129
+ children: [
130
+ /* @__PURE__ */ jsx(
131
+ DesignSelectTrigger,
132
+ {
133
+ className: "pl-0 py-1.5",
134
+ variant: "input",
135
+ children: /* @__PURE__ */ jsx(DesignSelectValue, { placeholder: "Your role" })
136
+ }
137
+ ),
138
+ /* @__PURE__ */ jsx(DesignSelectContent, { children: /* @__PURE__ */ jsx(DesignSelectGroup, { children: audiences.map((audience) => /* @__PURE__ */ jsx(
139
+ DesignSelectItem,
140
+ {
141
+ value: audience.value,
142
+ children: audience.value
143
+ },
144
+ audience.key
145
+ )) }) })
146
+ ]
147
+ },
148
+ field.value
149
+ )
150
+ }
151
+ ),
152
+ errors.role && /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm", children: errors.role.message }),
153
+ /* @__PURE__ */ jsx(
154
+ "textarea",
155
+ {
156
+ id: "message",
157
+ placeholder: "Your message",
158
+ ...register("message", { required: true }),
159
+ rows: 5,
160
+ className: "textarea textarea-bordered-0 text-sm lg:text-base w-full bg-transparent pl-0 border-0 border-b border-zinc-300 focus-within:border-primary focus:ring-0 focus:outline-none",
161
+ defaultValue: ""
162
+ }
163
+ ),
164
+ errors.message && /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm", children: errors.message.message })
165
+ ] }),
166
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
167
+ /* @__PURE__ */ jsx(
168
+ FormField,
169
+ {
170
+ control,
171
+ name: "acceptTerms",
172
+ render: ({ field }) => /* @__PURE__ */ jsx(FormItem, { children: /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
173
+ Checkbox,
174
+ {
175
+ onCheckedChange: field.onChange,
176
+ checked: field.value
177
+ }
178
+ ) }) })
179
+ }
180
+ ),
181
+ /* @__PURE__ */ jsxs("label", { children: [
182
+ /* @__PURE__ */ jsx("span", { className: "text-sm lg:text-base leading-[130%]", children: "I'm accepting Recodo's" }),
183
+ /* @__PURE__ */ jsx(
184
+ "a",
185
+ {
186
+ href: "/page/terms-of-use",
187
+ className: " text-primary",
188
+ target: "_blank",
189
+ children: /* @__PURE__ */ jsx("span", { className: "text-[.9375rem] lg:text-base font-semibold leading-[130%]", children: " Terms of Use " })
190
+ }
191
+ ),
192
+ /* @__PURE__ */ jsx("span", { className: "text-sm lg:text-base leading-[130%]", children: "and " }),
193
+ /* @__PURE__ */ jsx(
194
+ "a",
195
+ {
196
+ href: "/page/privacy-policy",
197
+ className: " text-primary",
198
+ target: "_blank",
199
+ children: /* @__PURE__ */ jsx("span", { className: "text-[.9375rem] lg:text-base font-semibold leading-[130%]", children: "Privacy Policy " })
200
+ }
201
+ )
202
+ ] })
203
+ ] }),
204
+ /* @__PURE__ */ jsx(
205
+ DesignButton,
206
+ {
207
+ type: "submit",
208
+ disabled: !acceptTerms,
209
+ className: "w-full lg:w-auto",
210
+ children: "Send"
211
+ }
212
+ ),
213
+ /* @__PURE__ */ jsx(
214
+ Notification,
215
+ {
216
+ title: "Sending",
217
+ description: " ",
218
+ open: openSending,
219
+ setOpen: setOpenSending
220
+ }
221
+ ),
222
+ /* @__PURE__ */ jsx(
223
+ Notification,
224
+ {
225
+ title: "Thank you for submitting your information.",
226
+ description: "Someone from the Recodo team will contact you shortly.",
227
+ open,
228
+ setOpen
229
+ }
230
+ )
231
+ ]
232
+ }
233
+ ) }) });
234
+ };
235
+ export {
236
+ NewContactUsWidget
237
+ };
@@ -0,0 +1,17 @@
1
+ "use client";
2
+
3
+ // src/components/Section/NewTestimonialsWidget.tsx
4
+ import { DesignTestimonials } from "@geowiki/ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var NewTestimonialsWidget = ({ data }) => {
7
+ const testimonials = data.BagPart.ContentItems.map((contentItem) => ({
8
+ info: contentItem.Testimonial?.Info?.Text,
9
+ name: contentItem.Testimonial?.Name?.Text,
10
+ position: contentItem.Testimonial?.Title?.Text,
11
+ imagePath: contentItem.Testimonial?.Image?.Paths[0]
12
+ }));
13
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(DesignTestimonials, { testimonials }) });
14
+ };
15
+ export {
16
+ NewTestimonialsWidget
17
+ };
@@ -0,0 +1,25 @@
1
+ // src/components/Section/NewfeedPreviewWidget.tsx
2
+ import { useNews } from "@geowiki/core";
3
+ import { NewsfeedPreview } from "@geowiki/ui";
4
+ import { jsx } from "react/jsx-runtime";
5
+ var NewsfeedPreviewWidget = () => {
6
+ var { data: newsItems, isLoading } = useNews("all", 0, 6);
7
+ var newsArticleData = newsItems?.slice(0, 4)?.map((news) => {
8
+ return {
9
+ title: news.title,
10
+ description: news.description,
11
+ username: news.sourceName,
12
+ time: news.publishDate,
13
+ language: news.language,
14
+ path: news.imageUrl,
15
+ link: news.url
16
+ };
17
+ });
18
+ if (isLoading) {
19
+ return /* @__PURE__ */ jsx("div", { children: "Loading..." });
20
+ }
21
+ return /* @__PURE__ */ jsx(NewsfeedPreview, { newsArticleData });
22
+ };
23
+ export {
24
+ NewsfeedPreviewWidget
25
+ };