@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,75 @@
1
+ import type { GraphInfo } from '@robosystems/client';
2
+ /**
3
+ * Common filter functions for GraphSelectorCore
4
+ * These can be composed together for complex filtering
5
+ */
6
+ /**
7
+ * Filter out subgraphs using the isSubgraph field
8
+ */
9
+ export declare function excludeSubgraphs(graph: GraphInfo): boolean;
10
+ /**
11
+ * Filter out shared repositories
12
+ */
13
+ export declare function excludeRepositories(graph: GraphInfo): boolean;
14
+ /**
15
+ * Filter to only show shared repositories
16
+ */
17
+ export declare function onlyRepositories(graph: GraphInfo): boolean;
18
+ /**
19
+ * Filter to only show user-owned graphs (excludes repositories and subgraphs)
20
+ */
21
+ export declare function onlyUserGraphs(graph: GraphInfo): boolean;
22
+ /**
23
+ * Filter graphs by type
24
+ */
25
+ export declare function byGraphType(...types: string[]): (graph: GraphInfo) => boolean;
26
+ /**
27
+ * Filter to only show entity graphs
28
+ */
29
+ export declare const onlyEntityGraphs: (graph: GraphInfo) => boolean;
30
+ /**
31
+ * Filter to only show generic graphs
32
+ */
33
+ export declare const onlyGenericGraphs: (graph: GraphInfo) => boolean;
34
+ /**
35
+ * Compose multiple filter functions together (all must pass)
36
+ */
37
+ export declare function composeFilters(...filters: Array<(graph: GraphInfo) => boolean>): (graph: GraphInfo) => boolean;
38
+ /**
39
+ * Filter graphs by schema extension
40
+ * Checks if the graph has a specific schema extension installed
41
+ */
42
+ export declare function hasSchemaExtension(extensionName: string): (graph: GraphInfo) => boolean;
43
+ /**
44
+ * Filter graphs that have ANY of the specified schema extensions
45
+ */
46
+ export declare function hasAnySchemaExtension(...extensionNames: string[]): (graph: GraphInfo) => boolean;
47
+ /**
48
+ * Filter graphs that have ALL of the specified schema extensions
49
+ */
50
+ export declare function hasAllSchemaExtensions(...extensionNames: string[]): (graph: GraphInfo) => boolean;
51
+ /**
52
+ * Common preset filters for different app types
53
+ */
54
+ export declare const GraphFilters: {
55
+ /**
56
+ * For RoboLedger: Only user entity graphs with roboledger schema, no subgraphs or repositories
57
+ */
58
+ readonly roboledger: (graph: GraphInfo) => boolean;
59
+ /**
60
+ * For RoboInvestor: Only user entity graphs with roboinvestor schema, no subgraphs or repositories
61
+ */
62
+ readonly roboinvestor: (graph: GraphInfo) => boolean;
63
+ /**
64
+ * For RoboSystems: All graphs except subgraphs
65
+ */
66
+ readonly robosystems: typeof excludeSubgraphs;
67
+ /**
68
+ * For general use: Only user-owned graphs (no repositories or subgraphs)
69
+ */
70
+ readonly userGraphsOnly: typeof onlyUserGraphs;
71
+ /**
72
+ * Show everything (no filtering)
73
+ */
74
+ readonly all: () => boolean;
75
+ };
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Common filter functions for GraphSelectorCore
3
+ * These can be composed together for complex filtering
4
+ */
5
+ /**
6
+ * Filter out subgraphs using the isSubgraph field
7
+ */
8
+ export function excludeSubgraphs(graph) {
9
+ return !graph.isSubgraph;
10
+ }
11
+ /**
12
+ * Filter out shared repositories
13
+ */
14
+ export function excludeRepositories(graph) {
15
+ return !graph.isRepository;
16
+ }
17
+ /**
18
+ * Filter to only show shared repositories
19
+ */
20
+ export function onlyRepositories(graph) {
21
+ return graph.isRepository === true;
22
+ }
23
+ /**
24
+ * Filter to only show user-owned graphs (excludes repositories and subgraphs)
25
+ */
26
+ export function onlyUserGraphs(graph) {
27
+ return excludeRepositories(graph) && excludeSubgraphs(graph);
28
+ }
29
+ /**
30
+ * Filter graphs by type
31
+ */
32
+ export function byGraphType(...types) {
33
+ return (graph) => {
34
+ // If graphType is undefined, check if the filter includes default types
35
+ if (!graph.graphType) {
36
+ return types.includes('entity') || types.includes('generic');
37
+ }
38
+ return types.includes(graph.graphType);
39
+ };
40
+ }
41
+ /**
42
+ * Filter to only show entity graphs
43
+ */
44
+ export const onlyEntityGraphs = byGraphType('entity');
45
+ /**
46
+ * Filter to only show generic graphs
47
+ */
48
+ export const onlyGenericGraphs = byGraphType('generic');
49
+ /**
50
+ * Compose multiple filter functions together (all must pass)
51
+ */
52
+ export function composeFilters(...filters) {
53
+ return (graph) => filters.every((filter) => filter(graph));
54
+ }
55
+ /**
56
+ * Filter graphs by schema extension
57
+ * Checks if the graph has a specific schema extension installed
58
+ */
59
+ export function hasSchemaExtension(extensionName) {
60
+ return (graph) => {
61
+ var _a, _b;
62
+ return (_b = (_a = graph.schemaExtensions) === null || _a === void 0 ? void 0 : _a.includes(extensionName)) !== null && _b !== void 0 ? _b : false;
63
+ };
64
+ }
65
+ /**
66
+ * Filter graphs that have ANY of the specified schema extensions
67
+ */
68
+ export function hasAnySchemaExtension(...extensionNames) {
69
+ return (graph) => {
70
+ if (!graph.schemaExtensions || graph.schemaExtensions.length === 0) {
71
+ return false;
72
+ }
73
+ return extensionNames.some((ext) => graph.schemaExtensions.includes(ext));
74
+ };
75
+ }
76
+ /**
77
+ * Filter graphs that have ALL of the specified schema extensions
78
+ */
79
+ export function hasAllSchemaExtensions(...extensionNames) {
80
+ return (graph) => {
81
+ if (!graph.schemaExtensions || graph.schemaExtensions.length === 0) {
82
+ return false;
83
+ }
84
+ return extensionNames.every((ext) => graph.schemaExtensions.includes(ext));
85
+ };
86
+ }
87
+ /**
88
+ * Common preset filters for different app types
89
+ */
90
+ export const GraphFilters = {
91
+ /**
92
+ * For RoboLedger: Only user entity graphs with roboledger schema, no subgraphs or repositories
93
+ */
94
+ roboledger: composeFilters(excludeSubgraphs, excludeRepositories, onlyEntityGraphs, hasSchemaExtension('roboledger')),
95
+ /**
96
+ * For RoboInvestor: Only user entity graphs with roboinvestor schema, no subgraphs or repositories
97
+ */
98
+ roboinvestor: composeFilters(excludeSubgraphs, excludeRepositories, onlyEntityGraphs, hasSchemaExtension('roboinvestor')),
99
+ /**
100
+ * For RoboSystems: All graphs except subgraphs
101
+ */
102
+ robosystems: excludeSubgraphs,
103
+ /**
104
+ * For general use: Only user-owned graphs (no repositories or subgraphs)
105
+ */
106
+ userGraphsOnly: onlyUserGraphs,
107
+ /**
108
+ * Show everything (no filtering)
109
+ */
110
+ all: () => true,
111
+ };
@@ -0,0 +1,10 @@
1
+ export { ConsoleContent } from './console';
2
+ export { EntitySelector, type EntityGroup, type SelectableEntity, } from './EntitySelector';
3
+ export { EntitySelectorCore, type EntityLike, type EntityRecord, type EntitySelectorProps, type GraphWithEntities, } from './EntitySelectorCore';
4
+ export { GraphFilters, byGraphType, composeFilters, excludeRepositories, excludeSubgraphs, hasAllSchemaExtensions, hasAnySchemaExtension, hasSchemaExtension, onlyEntityGraphs, onlyGenericGraphs, onlyRepositories, onlyUserGraphs, } from './graph-filters';
5
+ export { GraphSelectorCore, type GraphSelectorProps } from './GraphSelectorCore';
6
+ export { PageLayout } from './PageLayout';
7
+ export { ActiveSubscriptions, BrowseRepositories, type ActiveSubscriptionsProps, type BrowseRepositoriesProps, } from './repositories';
8
+ export { RepositoryGuard, useIsRepository } from './RepositoryGuard';
9
+ export { SearchContent } from './search';
10
+ export type { SearchConfig, SearchFilterConfig } from './search';
@@ -0,0 +1,9 @@
1
+ export { ConsoleContent } from './console';
2
+ export { EntitySelector, } from './EntitySelector';
3
+ export { EntitySelectorCore, } from './EntitySelectorCore';
4
+ export { GraphFilters, byGraphType, composeFilters, excludeRepositories, excludeSubgraphs, hasAllSchemaExtensions, hasAnySchemaExtension, hasSchemaExtension, onlyEntityGraphs, onlyGenericGraphs, onlyRepositories, onlyUserGraphs, } from './graph-filters';
5
+ export { GraphSelectorCore } from './GraphSelectorCore';
6
+ export { PageLayout } from './PageLayout';
7
+ export { ActiveSubscriptions, BrowseRepositories, } from './repositories';
8
+ export { RepositoryGuard, useIsRepository } from './RepositoryGuard';
9
+ export { SearchContent } from './search';
@@ -0,0 +1,26 @@
1
+ import * as SDK from '@robosystems/client';
2
+ type SubscriptionInfo = SDK.GraphSubscriptionResponse;
3
+ export interface ActiveSubscriptionsProps {
4
+ /** Called when user clicks "Open Console" for a repository */
5
+ onOpenConsole?: (repositoryId: string) => void;
6
+ /** Called when user clicks "Credits & Usage" for a repository */
7
+ onOpenUsage?: (repositoryId: string) => void;
8
+ /** Called when user clicks "Getting Started" for a repository */
9
+ onGettingStarted?: (repositoryId: string) => void;
10
+ /** Called when user clicks "Backups" for a repository */
11
+ onBackups?: (repositoryId: string) => void;
12
+ /** Called when user clicks "Billing Details" */
13
+ onBilling?: () => void;
14
+ /** Called when user clicks "Browse Repositories" */
15
+ onBrowse?: () => void;
16
+ /**
17
+ * Called when user clicks "Cancel Subscription" for a repository.
18
+ * Receives the full subscription object so the parent can drive a
19
+ * cancel modal with both period-end and immediate modes.
20
+ */
21
+ onCancel?: (subscription: SubscriptionInfo) => void;
22
+ /** Fallback component to render when there are no active subscriptions */
23
+ emptyState?: React.ReactNode;
24
+ }
25
+ export declare function ActiveSubscriptions({ onOpenConsole, onOpenUsage, onGettingStarted, onBackups, onBilling, onBrowse, onCancel, emptyState, }: ActiveSubscriptionsProps): import("react").JSX.Element;
26
+ export {};
@@ -0,0 +1,103 @@
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as SDK from '@robosystems/client';
4
+ import { Badge, Button, Card, Spinner } from 'flowbite-react';
5
+ import { useCallback, useEffect, useState } from 'react';
6
+ import { GoRepo } from 'react-icons/go';
7
+ import { HiBookOpen, HiCheckCircle, HiCloudDownload, HiCreditCard, HiGlobeAlt, HiLightningBolt, HiSwitchHorizontal, HiTerminal, HiXCircle, } from 'react-icons/hi';
8
+ import { useGraphContext } from '../../contexts/graph-context';
9
+ import { useOrg } from '../../contexts/org-context';
10
+ import { useServiceOfferings } from '../../contexts/service-offerings-context';
11
+ import { useToast } from '../../hooks/use-toast';
12
+ export function ActiveSubscriptions({ onOpenConsole, onOpenUsage, onGettingStarted, onBackups, onBilling, onBrowse, onCancel, emptyState, }) {
13
+ const [userSubscriptions, setUserSubscriptions] = useState([]);
14
+ const [loading, setLoading] = useState(true);
15
+ const { showError, ToastContainer } = useToast();
16
+ const { currentOrg } = useOrg();
17
+ const { offerings, isLoading: offeringsLoading } = useServiceOfferings();
18
+ const { setCurrentGraph } = useGraphContext();
19
+ const loadData = useCallback(async () => {
20
+ if (!(currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.id)) {
21
+ setLoading(false);
22
+ return;
23
+ }
24
+ try {
25
+ setLoading(true);
26
+ const subscriptionsResponse = await SDK.listOrgSubscriptions({
27
+ path: { org_id: currentOrg.id },
28
+ });
29
+ if (subscriptionsResponse.data) {
30
+ const repositorySubscriptions = (subscriptionsResponse.data || []).filter((sub) => sub.resource_type === 'repository');
31
+ setUserSubscriptions(repositorySubscriptions);
32
+ }
33
+ else {
34
+ setUserSubscriptions([]);
35
+ }
36
+ }
37
+ catch (error) {
38
+ console.error('Failed to load user subscriptions:', error);
39
+ showError('Failed to load user subscriptions');
40
+ }
41
+ finally {
42
+ setLoading(false);
43
+ }
44
+ }, [currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.id, showError]);
45
+ useEffect(() => {
46
+ loadData();
47
+ }, [loadData]);
48
+ if (loading || offeringsLoading) {
49
+ return (_jsx("div", { className: "flex min-h-[400px] items-center justify-center", children: _jsx(Spinner, { size: "xl" }) }));
50
+ }
51
+ // Treat a period-end-canceled sub as "still active" until its access
52
+ // window actually closes. Otherwise the row would disappear from this
53
+ // view the moment the user clicks Cancel — even though the modal
54
+ // promises continued access through current_period_end.
55
+ const now = new Date();
56
+ const activeSubscriptions = userSubscriptions.filter((s) => {
57
+ if (s.status === 'active')
58
+ return true;
59
+ if (s.status === 'canceled' && s.current_period_end) {
60
+ return new Date(s.current_period_end) > now;
61
+ }
62
+ return false;
63
+ });
64
+ if (activeSubscriptions.length === 0) {
65
+ return _jsx(_Fragment, { children: emptyState });
66
+ }
67
+ const handleOpenConsole = async (repositoryId) => {
68
+ try {
69
+ await setCurrentGraph(repositoryId);
70
+ }
71
+ catch (error) {
72
+ console.warn('Failed to set graph, navigating anyway:', error);
73
+ }
74
+ onOpenConsole === null || onOpenConsole === void 0 ? void 0 : onOpenConsole(repositoryId);
75
+ };
76
+ const handleOpenUsage = async (repositoryId) => {
77
+ try {
78
+ await setCurrentGraph(repositoryId);
79
+ }
80
+ catch (error) {
81
+ console.warn('Failed to set graph, navigating anyway:', error);
82
+ }
83
+ onOpenUsage === null || onOpenUsage === void 0 ? void 0 : onOpenUsage(repositoryId);
84
+ };
85
+ const handleOpenBackups = async (repositoryId) => {
86
+ try {
87
+ await setCurrentGraph(repositoryId);
88
+ }
89
+ catch (error) {
90
+ console.warn('Failed to set graph, navigating anyway:', error);
91
+ }
92
+ onBackups === null || onBackups === void 0 ? void 0 : onBackups(repositoryId);
93
+ };
94
+ return (_jsxs("div", { className: "space-y-6", children: [_jsx(ToastContainer, {}), _jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("div", { className: "from-primary-500 to-secondary-600 rounded-lg bg-gradient-to-br p-3", children: _jsx(HiGlobeAlt, { className: "h-8 w-8 text-white" }) }), _jsxs("div", { children: [_jsx("h1", { className: "font-heading text-3xl font-bold text-zinc-900 dark:text-zinc-100", children: "Repository Subscriptions" }), _jsx("p", { className: "mt-1 text-sm text-zinc-500 dark:text-zinc-400", children: "Browse shared public datasets" })] })] }), onBrowse && (_jsxs(Button, { onClick: onBrowse, color: "purple", children: [_jsx(HiGlobeAlt, { className: "mr-2 h-4 w-4" }), "Browse Repositories"] }))] }), activeSubscriptions.map((subscription) => {
95
+ var _a, _b, _c;
96
+ const repoOffering = (_a = offerings === null || offerings === void 0 ? void 0 : offerings.repositoryPlans) === null || _a === void 0 ? void 0 : _a[subscription.resource_id];
97
+ const planFeatures = (_c = (_b = repoOffering === null || repoOffering === void 0 ? void 0 : repoOffering.plans) === null || _b === void 0 ? void 0 : _b.find((p) => p.plan.toLowerCase() === subscription.plan_name.toLowerCase())) === null || _c === void 0 ? void 0 : _c.features;
98
+ return (_jsx(Card, { children: _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex items-start justify-between", children: [_jsxs("div", { className: "flex items-start gap-4", children: [_jsx("div", { className: "from-primary-500 to-secondary-600 rounded-lg bg-gradient-to-br p-3", children: _jsx(GoRepo, { className: "h-8 w-8 text-white" }) }), _jsxs("div", { children: [_jsx("h2", { className: "font-heading text-2xl font-bold text-zinc-900 dark:text-zinc-100", children: (repoOffering === null || repoOffering === void 0 ? void 0 : repoOffering.name) ||
99
+ subscription.resource_id.toUpperCase() }), _jsx("p", { className: "mt-1 text-zinc-600 dark:text-zinc-400", children: (repoOffering === null || repoOffering === void 0 ? void 0 : repoOffering.description) ||
100
+ 'Shared repository subscription' }), _jsx("div", { className: "mt-2 flex", children: _jsxs(Badge, { color: "purple", children: [subscription.plan_name.charAt(0).toUpperCase() +
101
+ subscription.plan_name.slice(1), ' ', "Plan"] }) })] })] }), _jsx(Badge, { color: "success", icon: HiCheckCircle, children: "Active" })] }), _jsxs("div", { className: "border-t border-zinc-200 pt-6 dark:border-zinc-700", children: [_jsx("h4", { className: "font-heading mb-4 text-sm font-semibold tracking-wide text-zinc-500 uppercase dark:text-zinc-400", children: "Quick Actions" }), _jsxs("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: [onGettingStarted && (_jsxs(Button, { color: "gray", onClick: () => onGettingStarted(subscription.resource_id), className: "justify-start", children: [_jsx(HiBookOpen, { className: "mr-2 h-4 w-4" }), "Getting Started"] })), onOpenConsole && (_jsxs(Button, { color: "gray", onClick: () => handleOpenConsole(subscription.resource_id), className: "justify-start", children: [_jsx(HiTerminal, { className: "mr-2 h-4 w-4" }), "Console"] })), onOpenUsage && (_jsxs(Button, { color: "gray", onClick: () => handleOpenUsage(subscription.resource_id), className: "justify-start", children: [_jsx(HiLightningBolt, { className: "mr-2 h-4 w-4" }), "Credits & Usage"] })), onBackups && (_jsxs(Button, { color: "gray", onClick: () => handleOpenBackups(subscription.resource_id), className: "justify-start", children: [_jsx(HiCloudDownload, { className: "mr-2 h-4 w-4" }), "Backups"] })), onBrowse && (_jsxs(Button, { color: "gray", onClick: onBrowse, className: "justify-start", children: [_jsx(HiSwitchHorizontal, { className: "mr-2 h-4 w-4" }), "Change Plan"] })), onBilling && (_jsxs(Button, { color: "gray", onClick: onBilling, className: "justify-start", children: [_jsx(HiCreditCard, { className: "mr-2 h-4 w-4" }), "Billing Details"] })), onCancel && (_jsxs(Button, { color: "failure", outline: true, onClick: () => onCancel(subscription), className: "justify-start", children: [_jsx(HiXCircle, { className: "mr-2 h-4 w-4" }), "Cancel Subscription"] }))] })] }), planFeatures && planFeatures.length > 0 && (_jsxs("div", { className: "border-t border-zinc-200 pt-6 dark:border-zinc-700", children: [_jsx("h4", { className: "font-heading mb-4 text-sm font-semibold tracking-wide text-zinc-500 uppercase dark:text-zinc-400", children: "Plan Features" }), _jsx("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: planFeatures.map((feature, idx) => (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx(HiCheckCircle, { className: "mt-0.5 h-4 w-4 shrink-0 text-green-500" }), _jsx("span", { className: "text-sm text-zinc-600 dark:text-zinc-400", children: feature })] }, idx))) })] }))] }) }, subscription.resource_id));
102
+ })] }));
103
+ }
@@ -0,0 +1,11 @@
1
+ export interface BrowseRepositoriesProps {
2
+ /** Called after successful subscription with the repository type */
3
+ onSubscribed?: (repositoryType: string) => void;
4
+ /** Called when user wants to view their subscriptions */
5
+ onViewSubscriptions?: () => void;
6
+ /** Whether to show the header section */
7
+ showHeader?: boolean;
8
+ /** Whether to show the "How it Works" info card */
9
+ showInfoCard?: boolean;
10
+ }
11
+ export declare function BrowseRepositories({ onSubscribed, onViewSubscriptions, showHeader, showInfoCard, }: BrowseRepositoriesProps): import("react").JSX.Element;
@@ -0,0 +1,184 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import * as SDK from '@robosystems/client';
4
+ import { Alert, Badge, Button, Card, Modal, ModalBody, ModalFooter, ModalHeader, Spinner, } from 'flowbite-react';
5
+ import { useCallback, useEffect, useState } from 'react';
6
+ import { GoRepo } from 'react-icons/go';
7
+ import { HiArrowDown, HiArrowUp, HiCheckCircle, HiDatabase, HiGlobeAlt, HiInformationCircle, } from 'react-icons/hi';
8
+ import { useGraphContext } from '../../contexts/graph-context';
9
+ import { useOrg } from '../../contexts/org-context';
10
+ import { useServiceOfferings } from '../../contexts/service-offerings-context';
11
+ import { useToast } from '../../hooks/use-toast';
12
+ import { useRepositorySubscription } from '../../task-monitoring/operationHooks';
13
+ export function BrowseRepositories({ onSubscribed, onViewSubscriptions, showHeader = true, showInfoCard = true, }) {
14
+ const [userSubscriptions, setUserSubscriptions] = useState([]);
15
+ const [loading, setLoading] = useState(true);
16
+ const [subscribing, setSubscribing] = useState(null);
17
+ const [changingPlan, setChangingPlan] = useState(false);
18
+ const [planChangeModal, setPlanChangeModal] = useState(null);
19
+ const { showSuccess, showError, ToastContainer } = useToast();
20
+ const { currentOrg } = useOrg();
21
+ const { offerings, isLoading: offeringsLoading } = useServiceOfferings();
22
+ const repositorySubscription = useRepositorySubscription();
23
+ const { setCurrentGraph, refreshGraphs } = useGraphContext();
24
+ const loadData = useCallback(async () => {
25
+ if (!(currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.id)) {
26
+ setLoading(false);
27
+ return;
28
+ }
29
+ try {
30
+ setLoading(true);
31
+ // Load org subscriptions and filter for repositories
32
+ const subscriptionsResponse = await SDK.listOrgSubscriptions({
33
+ path: { org_id: currentOrg.id },
34
+ });
35
+ if (subscriptionsResponse.data) {
36
+ const repositorySubscriptions = (subscriptionsResponse.data || []).filter((sub) => sub.resource_type === 'repository');
37
+ setUserSubscriptions(repositorySubscriptions);
38
+ }
39
+ else {
40
+ setUserSubscriptions([]);
41
+ }
42
+ }
43
+ catch (error) {
44
+ console.error('Failed to load user subscriptions:', error);
45
+ showError('Failed to load user subscriptions');
46
+ }
47
+ finally {
48
+ setLoading(false);
49
+ }
50
+ }, [currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.id, showError]);
51
+ useEffect(() => {
52
+ loadData();
53
+ }, [loadData]);
54
+ const handleSubscribe = async (repositoryType, tier) => {
55
+ if (!(currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.id)) {
56
+ showError('No organization found');
57
+ return;
58
+ }
59
+ try {
60
+ setSubscribing(`${repositoryType}-${tier}`);
61
+ const result = await repositorySubscription.subscribe({
62
+ repository_name: repositoryType,
63
+ plan_name: tier,
64
+ org_id: currentOrg.id,
65
+ });
66
+ // If result indicates checkout is required, the hook will have already redirected
67
+ if (result && 'requires_checkout' in result) {
68
+ return;
69
+ }
70
+ showSuccess('Successfully subscribed to repository!');
71
+ // Reload subscriptions
72
+ await loadData();
73
+ // Refresh the graphs list to include the new repository
74
+ await refreshGraphs();
75
+ // Set the repository as the current graph context
76
+ await setCurrentGraph(repositoryType);
77
+ // Notify parent
78
+ onSubscribed === null || onSubscribed === void 0 ? void 0 : onSubscribed(repositoryType);
79
+ }
80
+ catch (error) {
81
+ console.error('Failed to subscribe:', error);
82
+ showError(error instanceof Error
83
+ ? error.message
84
+ : 'Failed to subscribe to repository');
85
+ }
86
+ finally {
87
+ setSubscribing(null);
88
+ }
89
+ };
90
+ const getUserSubscription = (repositoryName) => {
91
+ return userSubscriptions.find((sub) => sub.resource_id === repositoryName &&
92
+ (sub.status === 'active' ||
93
+ (sub.status === 'canceled' &&
94
+ sub.ends_at &&
95
+ new Date(sub.ends_at) > new Date())));
96
+ };
97
+ const handleChangePlan = (repoType, repoName, currentPlan, currentPlanName, currentPrice, newPlan, newPlanName, newPrice) => {
98
+ setPlanChangeModal({
99
+ repoType,
100
+ repoName,
101
+ currentPlan,
102
+ currentPlanName,
103
+ currentPrice,
104
+ newPlan,
105
+ newPlanName,
106
+ newPrice,
107
+ isUpgrade: newPrice > currentPrice,
108
+ });
109
+ };
110
+ const handleChangePlanConfirm = async () => {
111
+ if (!planChangeModal)
112
+ return;
113
+ try {
114
+ setChangingPlan(true);
115
+ await repositorySubscription.changePlan({
116
+ repository_name: planChangeModal.repoType,
117
+ new_plan_name: planChangeModal.newPlan,
118
+ });
119
+ showSuccess(`Successfully ${planChangeModal.isUpgrade ? 'upgraded' : 'downgraded'} to ${planChangeModal.newPlanName}`);
120
+ setPlanChangeModal(null);
121
+ await loadData();
122
+ }
123
+ catch (error) {
124
+ console.error('Failed to change plan:', error);
125
+ showError(error instanceof Error ? error.message : 'Failed to change plan');
126
+ }
127
+ finally {
128
+ setChangingPlan(false);
129
+ }
130
+ };
131
+ if (loading || offeringsLoading) {
132
+ return (_jsx("div", { className: "flex min-h-[400px] items-center justify-center", children: _jsx(Spinner, { size: "xl" }) }));
133
+ }
134
+ // Check if user has any active subscriptions
135
+ const hasActiveSubscriptions = userSubscriptions.some((sub) => sub.status === 'active');
136
+ return (_jsxs("div", { className: "space-y-6", children: [_jsx(ToastContainer, {}), showHeader && (_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("div", { className: "from-primary-500 to-secondary-600 rounded-lg bg-gradient-to-br p-3", children: _jsx(HiGlobeAlt, { className: "h-8 w-8 text-white" }) }), _jsxs("div", { children: [_jsx("h1", { className: "font-heading text-3xl font-bold text-zinc-900 dark:text-zinc-100", children: "Browse Repositories" }), _jsx("p", { className: "mt-1 text-sm text-zinc-500 dark:text-zinc-400", children: "Subscribe to read-only graph databases containing curated data" })] })] }), hasActiveSubscriptions && onViewSubscriptions && (_jsx(Button, { onClick: onViewSubscriptions, color: "gray", children: "View My Subscriptions" }))] })), showInfoCard && (_jsx(Card, { children: _jsxs("div", { className: "flex items-start gap-4", children: [_jsx("div", { className: "bg-primary-100 dark:bg-primary-900/30 rounded-lg p-3", children: _jsx(HiInformationCircle, { className: "text-primary-600 dark:text-primary-400 h-6 w-6" }) }), _jsxs("div", { className: "flex-1", children: [_jsx("h3", { className: "font-heading mb-3 text-lg font-semibold text-zinc-900 dark:text-white", children: "How Shared Repositories Work" }), _jsxs("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-4", children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("div", { className: "bg-primary-500 mt-1 h-2 w-2 rounded-full" }), _jsx("span", { className: "text-sm text-zinc-600 dark:text-zinc-400", children: "Subscribe to gain read-only access to curated graph databases" })] }), _jsxs("div", { className: "flex items-start gap-2", children: [_jsx("div", { className: "bg-primary-500 mt-1 h-2 w-2 rounded-full" }), _jsx("span", { className: "text-sm text-zinc-600 dark:text-zinc-400", children: "Credits are used for AI agent calls - queries are unlimited" })] }), _jsxs("div", { className: "flex items-start gap-2", children: [_jsx("div", { className: "bg-primary-500 mt-1 h-2 w-2 rounded-full" }), _jsx("span", { className: "text-sm text-zinc-600 dark:text-zinc-400", children: "Generate API keys to access repositories via MCP tools in AI apps" })] }), _jsxs("div", { className: "flex items-start gap-2", children: [_jsx("div", { className: "bg-primary-500 mt-1 h-2 w-2 rounded-full" }), _jsx("span", { className: "text-sm text-zinc-600 dark:text-zinc-400", children: "Different tiers offer varying credit limits and features" })] })] })] })] }) })), (offerings === null || offerings === void 0 ? void 0 : offerings.repositoryPlans) &&
137
+ Object.entries(offerings.repositoryPlans)
138
+ .filter(([_, repo]) => {
139
+ const repoData = repo;
140
+ return repoData.enabled && !repoData.comingSoon;
141
+ })
142
+ .map(([repoType, repo]) => {
143
+ const repoData = repo;
144
+ const userSub = getUserSubscription(repoType);
145
+ return (_jsx(Card, { className: "overflow-hidden", children: _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex items-start justify-between", children: [_jsxs("div", { className: "flex items-start gap-4", children: [_jsx("div", { className: "from-primary-500 to-secondary-600 rounded-lg bg-gradient-to-br p-3", children: _jsx(GoRepo, { className: "h-8 w-8 text-white" }) }), _jsxs("div", { children: [_jsx("h2", { className: "font-heading text-2xl font-bold text-zinc-900 dark:text-zinc-100", children: repoData.name }), _jsx("p", { className: "mt-1 text-zinc-600 dark:text-zinc-400", children: repoData.description })] })] }), userSub && (_jsxs(Badge, { color: "success", icon: HiCheckCircle, size: "lg", children: ["Active -", ' ', userSub.plan_name.charAt(0).toUpperCase() +
146
+ userSub.plan_name.slice(1)] }))] }), _jsx("div", { className: `grid gap-6 ${repoData.plans.length === 2
147
+ ? 'mx-auto max-w-3xl lg:grid-cols-2'
148
+ : 'lg:grid-cols-3'}`, children: repoData.plans.map((plan, index) => {
149
+ var _a, _b;
150
+ const subPlan = (_a = userSub === null || userSub === void 0 ? void 0 : userSub.plan_name.toLowerCase()) !== null && _a !== void 0 ? _a : '';
151
+ const planKey = plan.plan.toLowerCase();
152
+ const isCurrentPlan = subPlan === planKey ||
153
+ subPlan === `${repoType}-${planKey}`;
154
+ const isPopular = index === 1;
155
+ const currentPlanData = userSub
156
+ ? repoData.plans.find((p) => {
157
+ const key = p.plan.toLowerCase();
158
+ return (subPlan === key ||
159
+ subPlan === `${repoType}-${key}`);
160
+ })
161
+ : null;
162
+ const isUpgrade = userSub &&
163
+ plan.monthlyPrice > ((_b = currentPlanData === null || currentPlanData === void 0 ? void 0 : currentPlanData.monthlyPrice) !== null && _b !== void 0 ? _b : 0);
164
+ return (_jsxs("div", { className: `relative flex flex-col rounded-xl border-2 p-6 transition-all hover:shadow-lg ${isCurrentPlan
165
+ ? 'border-primary-500 bg-primary-50 dark:bg-primary-900/20 shadow-lg'
166
+ : isPopular
167
+ ? 'border-secondary-500 from-secondary-50 dark:from-secondary-900/20 bg-gradient-to-b to-white shadow-md dark:to-zinc-800'
168
+ : 'border-zinc-200 bg-white hover:border-zinc-300 dark:border-zinc-700 dark:bg-zinc-800'}`, children: [isPopular && (_jsx("div", { className: "absolute -top-3 left-1/2 -translate-x-1/2", children: _jsx(Badge, { color: "purple", size: "sm", children: "Most Popular" }) })), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "text-center", children: [_jsx("h3", { className: "font-heading mb-2 text-xl font-bold text-zinc-900 dark:text-zinc-100", children: plan.name }), _jsxs("div", { className: "mb-1", children: [_jsxs("span", { className: "text-3xl font-bold text-zinc-900 dark:text-zinc-100", children: ["$", plan.monthlyPrice] }), _jsx("span", { className: "text-zinc-500 dark:text-zinc-400", children: "/month" })] }), _jsxs("p", { className: "mb-6 text-sm font-medium text-zinc-600 dark:text-zinc-400", children: [plan.monthlyCredits.toLocaleString(), ' ', "credits/month"] })] }), plan.features && (_jsx("ul", { className: "mb-6 space-y-2 text-sm", children: plan.features.map((feature, idx) => (_jsxs("li", { className: "flex items-start gap-2", children: [_jsx(HiCheckCircle, { className: "mt-0.5 h-4 w-4 shrink-0 text-green-500" }), _jsx("span", { className: "text-zinc-600 dark:text-zinc-400", children: feature })] }, idx))) }))] }), _jsx("div", { className: "mt-6", children: isCurrentPlan ? (_jsxs(Button, { color: "gray", disabled: true, className: "w-full", size: "lg", children: [_jsx(HiCheckCircle, { className: "mr-2 h-4 w-4" }), "Current Plan"] })) : userSub ? (_jsx(Button, { onClick: () => {
169
+ var _a;
170
+ return handleChangePlan(repoType, repoData.name, userSub.plan_name, userSub.plan_display_name, (_a = currentPlanData === null || currentPlanData === void 0 ? void 0 : currentPlanData.monthlyPrice) !== null && _a !== void 0 ? _a : 0, plan.plan, plan.name, plan.monthlyPrice);
171
+ }, className: "w-full", size: "lg", color: isUpgrade ? 'purple' : 'blue', children: isUpgrade ? (_jsxs(_Fragment, { children: [_jsx(HiArrowUp, { className: "mr-2 h-4 w-4" }), "Upgrade to ", plan.name] })) : (_jsxs(_Fragment, { children: [_jsx(HiArrowDown, { className: "mr-2 h-4 w-4" }), "Downgrade to ", plan.name] })) })) : (_jsx(Button, { onClick: () => handleSubscribe(repoType, plan.plan), disabled: subscribing === `${repoType}-${plan.plan}`, className: "w-full", size: "lg", color: isPopular ? 'purple' : 'blue', children: subscribing === `${repoType}-${plan.plan}`
172
+ ? 'Subscribing...'
173
+ : `Subscribe to ${plan.name}` })) })] }, plan.plan));
174
+ }) })] }) }, repoType));
175
+ }), (!(offerings === null || offerings === void 0 ? void 0 : offerings.repositoryPlans) ||
176
+ Object.keys(offerings.repositoryPlans).filter((key) => offerings.repositoryPlans[key].enabled &&
177
+ !offerings.repositoryPlans[key].comingSoon).length === 0) && (_jsx(Card, { children: _jsxs("div", { className: "py-8 text-center", children: [_jsx(HiDatabase, { className: "mx-auto mb-4 h-12 w-12 text-zinc-400" }), _jsx("p", { className: "text-zinc-600 dark:text-zinc-400", children: "No shared repositories available at this time" })] }) })), _jsxs(Modal, { show: !!planChangeModal, onClose: () => !changingPlan && setPlanChangeModal(null), size: "md", children: [_jsxs(ModalHeader, { children: [(planChangeModal === null || planChangeModal === void 0 ? void 0 : planChangeModal.isUpgrade) ? 'Upgrade' : 'Downgrade', " Plan"] }), _jsx(ModalBody, { children: planChangeModal && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: `rounded-full p-3 ${planChangeModal.isUpgrade
178
+ ? 'bg-secondary-100 dark:bg-secondary-900/30'
179
+ : 'bg-primary-100 dark:bg-primary-900/30'}`, children: planChangeModal.isUpgrade ? (_jsx(HiArrowUp, { className: "text-secondary-600 dark:text-secondary-400 h-6 w-6" })) : (_jsx(HiArrowDown, { className: "text-primary-600 dark:text-primary-400 h-6 w-6" })) }), _jsxs("div", { className: "flex-1", children: [_jsxs("h3", { className: "font-semibold text-gray-900 dark:text-white", children: [planChangeModal.isUpgrade ? 'Upgrade' : 'Downgrade', ' ', planChangeModal.repoName, "?"] }), _jsx("div", { className: "mt-2 text-sm text-gray-600 dark:text-gray-400", children: _jsxs("p", { children: [planChangeModal.currentPlanName, " ($", planChangeModal.currentPrice, "/mo) \u2192", ' ', planChangeModal.newPlanName, " ($", planChangeModal.newPrice, "/mo)"] }) })] })] }), _jsx(Alert, { color: planChangeModal.isUpgrade ? 'info' : 'warning', icon: HiInformationCircle, children: _jsx("p", { className: "text-sm", children: planChangeModal.isUpgrade
180
+ ? 'Your new plan will take effect immediately. You will be charged a prorated amount for the remainder of this billing period.'
181
+ : 'Your plan will be downgraded immediately. You will receive a prorated credit for the remainder of this billing period.' }) })] })) }), _jsx(ModalFooter, { children: _jsxs("div", { className: "flex w-full gap-3", children: [_jsx(Button, { onClick: () => setPlanChangeModal(null), disabled: changingPlan, color: "gray", className: "flex-1", children: "Cancel" }), _jsx(Button, { onClick: handleChangePlanConfirm, disabled: changingPlan, color: (planChangeModal === null || planChangeModal === void 0 ? void 0 : planChangeModal.isUpgrade) ? 'purple' : 'blue', className: "flex-1", children: changingPlan
182
+ ? 'Processing...'
183
+ : `Confirm ${(planChangeModal === null || planChangeModal === void 0 ? void 0 : planChangeModal.isUpgrade) ? 'Upgrade' : 'Downgrade'}` })] }) })] })] }));
184
+ }
@@ -0,0 +1,2 @@
1
+ export { ActiveSubscriptions, type ActiveSubscriptionsProps, } from './ActiveSubscriptions';
2
+ export { BrowseRepositories, type BrowseRepositoriesProps, } from './BrowseRepositories';
@@ -0,0 +1,2 @@
1
+ export { ActiveSubscriptions, } from './ActiveSubscriptions';
2
+ export { BrowseRepositories, } from './BrowseRepositories';
@@ -0,0 +1,4 @@
1
+ import type { SearchConfig } from './types';
2
+ export declare function SearchContent({ config }: {
3
+ config: SearchConfig;
4
+ }): import("react").JSX.Element;