@robosystems/core 0.3.0

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 (249) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +252 -0
  3. package/actions/entity-actions.d.ts +8 -0
  4. package/actions/entity-actions.js +16 -0
  5. package/actions/graph-actions.d.ts +3 -0
  6. package/actions/graph-actions.js +13 -0
  7. package/auth-components/AppSwitcher.d.ts +6 -0
  8. package/auth-components/AppSwitcher.js +28 -0
  9. package/auth-components/AuthGuard.d.ts +7 -0
  10. package/auth-components/AuthGuard.js +31 -0
  11. package/auth-components/AuthProvider.d.ts +9 -0
  12. package/auth-components/AuthProvider.js +565 -0
  13. package/auth-components/SessionWarningDialog.d.ts +1 -0
  14. package/auth-components/SessionWarningDialog.js +51 -0
  15. package/auth-components/SignInForm.d.ts +20 -0
  16. package/auth-components/SignInForm.js +139 -0
  17. package/auth-components/SignUpForm.d.ts +15 -0
  18. package/auth-components/SignUpForm.js +167 -0
  19. package/auth-components/TurnstileWidget.d.ts +99 -0
  20. package/auth-components/TurnstileWidget.js +224 -0
  21. package/auth-components/index.d.ts +6 -0
  22. package/auth-components/index.js +6 -0
  23. package/auth-core/cleanup.d.ts +44 -0
  24. package/auth-core/cleanup.js +157 -0
  25. package/auth-core/client.d.ts +121 -0
  26. package/auth-core/client.js +767 -0
  27. package/auth-core/config.d.ts +19 -0
  28. package/auth-core/config.js +56 -0
  29. package/auth-core/hooks.d.ts +19 -0
  30. package/auth-core/hooks.js +63 -0
  31. package/auth-core/index.d.ts +6 -0
  32. package/auth-core/index.js +6 -0
  33. package/auth-core/sso.d.ts +42 -0
  34. package/auth-core/sso.js +281 -0
  35. package/auth-core/token-storage.d.ts +58 -0
  36. package/auth-core/token-storage.js +177 -0
  37. package/auth-core/types.d.ts +145 -0
  38. package/auth-core/types.js +1 -0
  39. package/components/EntitySelector.d.ts +44 -0
  40. package/components/EntitySelector.js +64 -0
  41. package/components/EntitySelectorCore.d.ts +45 -0
  42. package/components/EntitySelectorCore.js +67 -0
  43. package/components/GraphSelectorCore.d.ts +21 -0
  44. package/components/GraphSelectorCore.js +39 -0
  45. package/components/PageLayout.d.ts +8 -0
  46. package/components/PageLayout.js +5 -0
  47. package/components/RepositoryGuard.d.ts +68 -0
  48. package/components/RepositoryGuard.js +91 -0
  49. package/components/console/ConsoleContent.d.ts +4 -0
  50. package/components/console/ConsoleContent.js +612 -0
  51. package/components/console/ConsoleMarkdown.d.ts +11 -0
  52. package/components/console/ConsoleMarkdown.js +49 -0
  53. package/components/console/ProgressiveText.d.ts +6 -0
  54. package/components/console/ProgressiveText.js +21 -0
  55. package/components/console/graphAwareConfig.d.ts +70 -0
  56. package/components/console/graphAwareConfig.js +411 -0
  57. package/components/console/index.d.ts +6 -0
  58. package/components/console/index.js +4 -0
  59. package/components/console/types.d.ts +84 -0
  60. package/components/console/types.js +1 -0
  61. package/components/graph-filters.d.ts +75 -0
  62. package/components/graph-filters.js +111 -0
  63. package/components/index.d.ts +10 -0
  64. package/components/index.js +9 -0
  65. package/components/repositories/ActiveSubscriptions.d.ts +26 -0
  66. package/components/repositories/ActiveSubscriptions.js +103 -0
  67. package/components/repositories/BrowseRepositories.d.ts +11 -0
  68. package/components/repositories/BrowseRepositories.js +184 -0
  69. package/components/repositories/index.d.ts +2 -0
  70. package/components/repositories/index.js +2 -0
  71. package/components/search/SearchContent.d.ts +4 -0
  72. package/components/search/SearchContent.js +168 -0
  73. package/components/search/index.d.ts +2 -0
  74. package/components/search/index.js +1 -0
  75. package/components/search/types.d.ts +15 -0
  76. package/components/search/types.js +1 -0
  77. package/contexts/entity-context.d.ts +28 -0
  78. package/contexts/entity-context.js +89 -0
  79. package/contexts/graph-context.d.ts +27 -0
  80. package/contexts/graph-context.js +128 -0
  81. package/contexts/index.d.ts +5 -0
  82. package/contexts/index.js +5 -0
  83. package/contexts/org-context.d.ts +25 -0
  84. package/contexts/org-context.js +64 -0
  85. package/contexts/service-offerings-context.d.ts +45 -0
  86. package/contexts/service-offerings-context.js +98 -0
  87. package/contexts/sidebar-context.d.ts +18 -0
  88. package/contexts/sidebar-context.js +44 -0
  89. package/hooks/index.d.ts +6 -0
  90. package/hooks/index.js +6 -0
  91. package/hooks/use-api-error.d.ts +3 -0
  92. package/hooks/use-api-error.js +24 -0
  93. package/hooks/use-media-query.d.ts +1 -0
  94. package/hooks/use-media-query.js +21 -0
  95. package/hooks/use-streaming-query.d.ts +22 -0
  96. package/hooks/use-streaming-query.js +142 -0
  97. package/hooks/use-toast.d.ts +37 -0
  98. package/hooks/use-toast.js +117 -0
  99. package/hooks/use-user-limits.d.ts +12 -0
  100. package/hooks/use-user-limits.js +73 -0
  101. package/hooks/use-user.d.ts +11 -0
  102. package/hooks/use-user.js +39 -0
  103. package/index.d.ts +29 -0
  104. package/index.js +77 -0
  105. package/lib/entity-cookie.d.ts +10 -0
  106. package/lib/entity-cookie.js +38 -0
  107. package/lib/graph-cookie.d.ts +11 -0
  108. package/lib/graph-cookie.js +62 -0
  109. package/lib/graph-tiers.d.ts +41 -0
  110. package/lib/graph-tiers.js +107 -0
  111. package/lib/index.d.ts +3 -0
  112. package/lib/index.js +3 -0
  113. package/lib/sidebar-cookie.d.ts +11 -0
  114. package/lib/sidebar-cookie.js +42 -0
  115. package/library/colors.d.ts +4 -0
  116. package/library/colors.js +41 -0
  117. package/library/components/ClassificationPicker.d.ts +8 -0
  118. package/library/components/ClassificationPicker.js +55 -0
  119. package/library/components/ElementBrowser.d.ts +11 -0
  120. package/library/components/ElementBrowser.js +106 -0
  121. package/library/components/ElementDetail.d.ts +7 -0
  122. package/library/components/ElementDetail.js +97 -0
  123. package/library/components/LibraryHierarchy.d.ts +13 -0
  124. package/library/components/LibraryHierarchy.js +380 -0
  125. package/library/components/TaxonomySidebar.d.ts +6 -0
  126. package/library/components/TaxonomySidebar.js +45 -0
  127. package/library/index.d.ts +8 -0
  128. package/library/index.js +7 -0
  129. package/package.json +37 -0
  130. package/research/CoverageCard.d.ts +12 -0
  131. package/research/CoverageCard.js +15 -0
  132. package/research/CoverageGrid.d.ts +6 -0
  133. package/research/CoverageGrid.js +9 -0
  134. package/research/CoverageHistory.d.ts +5 -0
  135. package/research/CoverageHistory.js +7 -0
  136. package/research/ResearchArticle.d.ts +15 -0
  137. package/research/ResearchArticle.js +26 -0
  138. package/research/catalog.d.ts +14 -0
  139. package/research/catalog.js +42 -0
  140. package/research/index.d.ts +6 -0
  141. package/research/index.js +9 -0
  142. package/research/types.d.ts +38 -0
  143. package/research/types.js +4 -0
  144. package/task-monitoring/hooks.d.ts +26 -0
  145. package/task-monitoring/hooks.js +126 -0
  146. package/task-monitoring/index.d.ts +5 -0
  147. package/task-monitoring/index.js +7 -0
  148. package/task-monitoring/operationErrors.d.ts +82 -0
  149. package/task-monitoring/operationErrors.js +251 -0
  150. package/task-monitoring/operationHooks.d.ts +117 -0
  151. package/task-monitoring/operationHooks.js +536 -0
  152. package/task-monitoring/operationMonitor.d.ts +78 -0
  153. package/task-monitoring/operationMonitor.js +200 -0
  154. package/task-monitoring/operationTypes.d.ts +236 -0
  155. package/task-monitoring/operationTypes.js +60 -0
  156. package/task-monitoring/taskMonitor.d.ts +14 -0
  157. package/task-monitoring/taskMonitor.js +132 -0
  158. package/task-monitoring/types.d.ts +31 -0
  159. package/task-monitoring/types.js +1 -0
  160. package/theme/flowbite-theme.d.ts +758 -0
  161. package/theme/flowbite-theme.js +765 -0
  162. package/theme/index.d.ts +1 -0
  163. package/theme/index.js +1 -0
  164. package/types/entity.d.ts +19 -0
  165. package/types/index.d.ts +2 -0
  166. package/types/index.js +1 -0
  167. package/types/user.d.ts +6 -0
  168. package/ui-components/ConfirmModal.d.ts +41 -0
  169. package/ui-components/ConfirmModal.js +19 -0
  170. package/ui-components/EmptyState.d.ts +22 -0
  171. package/ui-components/EmptyState.js +10 -0
  172. package/ui-components/LoadingState.d.ts +27 -0
  173. package/ui-components/LoadingState.js +12 -0
  174. package/ui-components/Logo.d.ts +28 -0
  175. package/ui-components/Logo.js +95 -0
  176. package/ui-components/Spinner.d.ts +37 -0
  177. package/ui-components/Spinner.js +48 -0
  178. package/ui-components/StatCard.d.ts +21 -0
  179. package/ui-components/StatCard.js +10 -0
  180. package/ui-components/api-keys/ApiKeyDisplay.d.ts +13 -0
  181. package/ui-components/api-keys/ApiKeyDisplay.js +7 -0
  182. package/ui-components/api-keys/ApiKeyTable.d.ts +9 -0
  183. package/ui-components/api-keys/ApiKeyTable.js +17 -0
  184. package/ui-components/api-keys/ApiKeysCard.d.ts +6 -0
  185. package/ui-components/api-keys/ApiKeysCard.js +97 -0
  186. package/ui-components/api-keys/CreateApiKeyModal.d.ts +11 -0
  187. package/ui-components/api-keys/CreateApiKeyModal.js +47 -0
  188. package/ui-components/api-keys/SecureApiKeyField.d.ts +13 -0
  189. package/ui-components/api-keys/SecureApiKeyField.js +64 -0
  190. package/ui-components/api-keys/index.d.ts +5 -0
  191. package/ui-components/api-keys/index.js +5 -0
  192. package/ui-components/chat/ChatHeader.d.ts +12 -0
  193. package/ui-components/chat/ChatHeader.js +5 -0
  194. package/ui-components/chat/ChatInputArea.d.ts +16 -0
  195. package/ui-components/chat/ChatInputArea.js +9 -0
  196. package/ui-components/chat/ChatMessage.d.ts +7 -0
  197. package/ui-components/chat/ChatMessage.js +24 -0
  198. package/ui-components/chat/DeepResearchToggle.d.ts +8 -0
  199. package/ui-components/chat/DeepResearchToggle.js +13 -0
  200. package/ui-components/chat/index.d.ts +9 -0
  201. package/ui-components/chat/index.js +8 -0
  202. package/ui-components/chat/types.d.ts +23 -0
  203. package/ui-components/chat/types.js +51 -0
  204. package/ui-components/forms/PasswordRequirements.d.ts +10 -0
  205. package/ui-components/forms/PasswordRequirements.js +15 -0
  206. package/ui-components/forms/SettingsCard.d.ts +11 -0
  207. package/ui-components/forms/SettingsCard.js +5 -0
  208. package/ui-components/forms/SettingsFormField.d.ts +18 -0
  209. package/ui-components/forms/SettingsFormField.js +17 -0
  210. package/ui-components/forms/StatusAlert.d.ts +8 -0
  211. package/ui-components/forms/StatusAlert.js +7 -0
  212. package/ui-components/forms/index.d.ts +4 -0
  213. package/ui-components/forms/index.js +4 -0
  214. package/ui-components/index.d.ts +13 -0
  215. package/ui-components/index.js +18 -0
  216. package/ui-components/layout/CoreNavbar.d.ts +14 -0
  217. package/ui-components/layout/CoreNavbar.js +53 -0
  218. package/ui-components/layout/CoreSidebar.d.ts +28 -0
  219. package/ui-components/layout/CoreSidebar.js +62 -0
  220. package/ui-components/layout/LandingFooter.d.ts +28 -0
  221. package/ui-components/layout/LandingFooter.js +34 -0
  222. package/ui-components/layout/PageContainer.d.ts +8 -0
  223. package/ui-components/layout/PageContainer.js +17 -0
  224. package/ui-components/layout/PageHeader.d.ts +23 -0
  225. package/ui-components/layout/PageHeader.js +12 -0
  226. package/ui-components/layout/SettingsContainer.d.ts +10 -0
  227. package/ui-components/layout/SettingsContainer.js +9 -0
  228. package/ui-components/layout/ThemeToggle.d.ts +4 -0
  229. package/ui-components/layout/ThemeToggle.js +6 -0
  230. package/ui-components/layout/index.d.ts +7 -0
  231. package/ui-components/layout/index.js +7 -0
  232. package/ui-components/settings/GeneralInformationCard.d.ts +12 -0
  233. package/ui-components/settings/GeneralInformationCard.js +72 -0
  234. package/ui-components/settings/PasswordInformationCard.d.ts +10 -0
  235. package/ui-components/settings/PasswordInformationCard.js +167 -0
  236. package/ui-components/settings/SettingsPageHeader.d.ts +7 -0
  237. package/ui-components/settings/SettingsPageHeader.js +6 -0
  238. package/ui-components/settings/index.d.ts +3 -0
  239. package/ui-components/settings/index.js +3 -0
  240. package/ui-components/support/SupportModal.d.ts +15 -0
  241. package/ui-components/support/SupportModal.js +74 -0
  242. package/ui-components/support/index.d.ts +2 -0
  243. package/ui-components/support/index.js +1 -0
  244. package/ui-components/types/index.d.ts +39 -0
  245. package/ui-components/types/index.js +1 -0
  246. package/utils/index.d.ts +31 -0
  247. package/utils/index.js +38 -0
  248. package/utils/turnstile-config.d.ts +11 -0
  249. package/utils/turnstile-config.js +19 -0
@@ -0,0 +1,74 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Button, Label, Modal, ModalBody, ModalHeader, Textarea, TextInput, } from 'flowbite-react';
4
+ import { useRef, useState } from 'react';
5
+ import { TurnstileWidget, } from '../../auth-components/TurnstileWidget';
6
+ import { useUser } from '../../hooks';
7
+ import { isTurnstileEnabled, isTurnstileValid, } from '../../utils/turnstile-config';
8
+ export default function SupportModal({ isOpen, onClose, metadata, }) {
9
+ const { user } = useUser();
10
+ const [message, setMessage] = useState('');
11
+ const [subject, setSubject] = useState('');
12
+ const [isSubmitting, setIsSubmitting] = useState(false);
13
+ const [submitStatus, setSubmitStatus] = useState('idle');
14
+ const [captchaToken, setCaptchaToken] = useState(null);
15
+ const turnstileRef = useRef(null);
16
+ const handleClose = () => {
17
+ setMessage('');
18
+ setSubject('');
19
+ setSubmitStatus('idle');
20
+ setCaptchaToken(null);
21
+ if (turnstileRef.current) {
22
+ turnstileRef.current.reset();
23
+ }
24
+ onClose();
25
+ };
26
+ const handleSubmit = async (e) => {
27
+ e.preventDefault();
28
+ if (!isTurnstileValid(captchaToken)) {
29
+ setSubmitStatus('error');
30
+ return;
31
+ }
32
+ setIsSubmitting(true);
33
+ setSubmitStatus('idle');
34
+ try {
35
+ const response = await fetch('/api/support', {
36
+ method: 'POST',
37
+ headers: { 'Content-Type': 'application/json' },
38
+ body: JSON.stringify({
39
+ name: (user === null || user === void 0 ? void 0 : user.name) || 'Unknown',
40
+ email: (user === null || user === void 0 ? void 0 : user.email) || 'Unknown',
41
+ subject,
42
+ message,
43
+ metadata: metadata || {},
44
+ captchaToken,
45
+ }),
46
+ });
47
+ if (response.ok) {
48
+ setSubmitStatus('success');
49
+ setTimeout(handleClose, 2000);
50
+ }
51
+ else {
52
+ setSubmitStatus('error');
53
+ if (turnstileRef.current) {
54
+ turnstileRef.current.reset();
55
+ setCaptchaToken(null);
56
+ }
57
+ }
58
+ }
59
+ catch (_a) {
60
+ setSubmitStatus('error');
61
+ if (turnstileRef.current) {
62
+ turnstileRef.current.reset();
63
+ setCaptchaToken(null);
64
+ }
65
+ }
66
+ finally {
67
+ setIsSubmitting(false);
68
+ }
69
+ };
70
+ return (_jsxs(Modal, { show: isOpen, onClose: handleClose, size: "lg", children: [_jsx(ModalHeader, { children: "Contact Support" }), _jsx(ModalBody, { children: submitStatus === 'success' ? (_jsxs("div", { className: "py-8 text-center", children: [_jsx("svg", { className: "mx-auto mb-4 h-16 w-16 text-green-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }), _jsx("h3", { className: "mb-2 text-2xl font-bold text-gray-900 dark:text-white", children: "Message Sent!" }), _jsx("p", { className: "text-gray-500 dark:text-gray-400", children: "Our team will get back to you as soon as possible." })] })) : (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [_jsxs("div", { children: [_jsx(Label, { htmlFor: "support-subject", className: "mb-2 block", children: "Subject" }), _jsx(TextInput, { id: "support-subject", type: "text", required: true, placeholder: "Brief description of your issue", value: subject, onChange: (e) => setSubject(e.target.value) })] }), _jsxs("div", { children: [_jsx(Label, { htmlFor: "support-message", className: "mb-2 block", children: "Message" }), _jsx(Textarea, { id: "support-message", rows: 5, required: true, placeholder: "Please describe your issue or question in detail...", value: message, onChange: (e) => setMessage(e.target.value) })] }), isTurnstileEnabled() &&
71
+ process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY && (_jsx("div", { className: "flex min-h-[75px] items-center justify-center", children: _jsx(TurnstileWidget, { ref: turnstileRef, siteKey: process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY, onVerify: (token) => setCaptchaToken(token), onError: () => setCaptchaToken(null), onExpire: () => setCaptchaToken(null), theme: "dark", disabled: isSubmitting }) })), submitStatus === 'error' && (_jsx("p", { className: "text-sm text-red-600 dark:text-red-500", children: !isTurnstileValid(captchaToken)
72
+ ? 'Please complete the security verification.'
73
+ : 'Something went wrong. Please try again later.' })), _jsxs("div", { className: "flex justify-end gap-3 pt-2", children: [_jsx(Button, { type: "button", color: "gray", onClick: handleClose, disabled: isSubmitting, children: "Cancel" }), _jsx(Button, { type: "submit", disabled: isSubmitting || !isTurnstileValid(captchaToken), children: isSubmitting ? 'Sending...' : 'Send Message' })] })] })) })] }));
74
+ }
@@ -0,0 +1,2 @@
1
+ export { default as SupportModal } from './SupportModal';
2
+ export type { SupportMetadata } from './SupportModal';
@@ -0,0 +1 @@
1
+ export { default as SupportModal } from './SupportModal';
@@ -0,0 +1,39 @@
1
+ import type { AuthUser } from '../../auth-core/types';
2
+ export interface ApiKey {
3
+ id: string;
4
+ name: string;
5
+ graphId?: string;
6
+ createdAt: Date | string;
7
+ lastUsedAt?: Date | string | null;
8
+ expiresAt?: Date | string | null;
9
+ isActive: boolean;
10
+ isSystem: boolean;
11
+ }
12
+ export interface ApiKeyWithValue extends ApiKey {
13
+ key: string;
14
+ }
15
+ export interface GraphInfo {
16
+ graphId: string;
17
+ graphName: string;
18
+ isSelected: boolean;
19
+ }
20
+ export interface UserGraphsResponse {
21
+ graphs: GraphInfo[];
22
+ }
23
+ export interface UserSettingsProps {
24
+ user: AuthUser;
25
+ }
26
+ export interface PasswordUpdateData {
27
+ currentPassword: string;
28
+ newPassword: string;
29
+ confirmPassword: string;
30
+ }
31
+ export interface UserUpdateData {
32
+ username: string;
33
+ email: string;
34
+ }
35
+ export interface CreateApiKeyData {
36
+ name: string;
37
+ expiresInDays: number;
38
+ }
39
+ export type { AuthUser } from '../../auth-core/types';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Generate a URI-safe identifier from a name
3
+ * Converts to lowercase, replaces non-alphanumeric characters with hyphens,
4
+ * and removes leading/trailing hyphens
5
+ *
6
+ * @param name - The name to convert to a URI
7
+ * @returns URI-safe identifier
8
+ *
9
+ * @example
10
+ * generateEntityUri('Apple Inc.') // 'apple-inc'
11
+ * generateEntityUri(' Tesla Motors ') // 'tesla-motors'
12
+ */
13
+ export declare function generateEntityUri(name: string): string;
14
+ /**
15
+ * Regular expression for matching UUID v4 format
16
+ * Matches the pattern: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
17
+ * where x is a hexadecimal character (0-9, a-f)
18
+ */
19
+ export declare const UUID_REGEX: RegExp;
20
+ /**
21
+ * Check if a string is a valid UUID
22
+ *
23
+ * @param value - The string to validate
24
+ * @returns true if the string matches UUID format, false otherwise
25
+ *
26
+ * @example
27
+ * isUUID('550e8400-e29b-41d4-a716-446655440000') // true
28
+ * isUUID('sec') // false
29
+ * isUUID('not-a-uuid') // false
30
+ */
31
+ export declare function isUUID(value: string): boolean;
package/utils/index.js ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Generate a URI-safe identifier from a name
3
+ * Converts to lowercase, replaces non-alphanumeric characters with hyphens,
4
+ * and removes leading/trailing hyphens
5
+ *
6
+ * @param name - The name to convert to a URI
7
+ * @returns URI-safe identifier
8
+ *
9
+ * @example
10
+ * generateEntityUri('Apple Inc.') // 'apple-inc'
11
+ * generateEntityUri(' Tesla Motors ') // 'tesla-motors'
12
+ */
13
+ export function generateEntityUri(name) {
14
+ return name
15
+ .toLowerCase()
16
+ .replace(/[^a-z0-9]+/g, '-')
17
+ .replace(/^-|-$/g, '');
18
+ }
19
+ /**
20
+ * Regular expression for matching UUID v4 format
21
+ * Matches the pattern: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
22
+ * where x is a hexadecimal character (0-9, a-f)
23
+ */
24
+ export const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
25
+ /**
26
+ * Check if a string is a valid UUID
27
+ *
28
+ * @param value - The string to validate
29
+ * @returns true if the string matches UUID format, false otherwise
30
+ *
31
+ * @example
32
+ * isUUID('550e8400-e29b-41d4-a716-446655440000') // true
33
+ * isUUID('sec') // false
34
+ * isUUID('not-a-uuid') // false
35
+ */
36
+ export function isUUID(value) {
37
+ return UUID_REGEX.test(value);
38
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Check if Turnstile CAPTCHA is enabled
3
+ * @returns true if Turnstile site key is configured
4
+ */
5
+ export declare function isTurnstileEnabled(): boolean;
6
+ /**
7
+ * Validate if Turnstile token is present when required
8
+ * @param token - The Turnstile token
9
+ * @returns true if token is valid or Turnstile is not enabled
10
+ */
11
+ export declare function isTurnstileValid(token: string | null): boolean;
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ /**
3
+ * Check if Turnstile CAPTCHA is enabled
4
+ * @returns true if Turnstile site key is configured
5
+ */
6
+ export function isTurnstileEnabled() {
7
+ return !!process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY;
8
+ }
9
+ /**
10
+ * Validate if Turnstile token is present when required
11
+ * @param token - The Turnstile token
12
+ * @returns true if token is valid or Turnstile is not enabled
13
+ */
14
+ export function isTurnstileValid(token) {
15
+ if (!isTurnstileEnabled()) {
16
+ return true;
17
+ }
18
+ return !!token;
19
+ }