| 
									
										
										
										
											2025-02-17 17:05:13 +08:00
										 |  |  | import { MarketplaceContextProvider } from './context' | 
					
						
							|  |  |  | import Description from './description' | 
					
						
							|  |  |  | import IntersectionLine from './intersection-line' | 
					
						
							|  |  |  | import SearchBoxWrapper from './search-box/search-box-wrapper' | 
					
						
							|  |  |  | import PluginTypeSwitch from './plugin-type-switch' | 
					
						
							|  |  |  | import ListWrapper from './list/list-wrapper' | 
					
						
							|  |  |  | import type { SearchParams } from './types' | 
					
						
							|  |  |  | import { getMarketplaceCollectionsAndPlugins } from './utils' | 
					
						
							|  |  |  | import { TanstackQueryIniter } from '@/context/query-client' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type MarketplaceProps = { | 
					
						
							|  |  |  |   locale: string | 
					
						
							|  |  |  |   searchBoxAutoAnimate?: boolean | 
					
						
							|  |  |  |   showInstallButton?: boolean | 
					
						
							|  |  |  |   shouldExclude?: boolean | 
					
						
							|  |  |  |   searchParams?: SearchParams | 
					
						
							|  |  |  |   pluginTypeSwitchClassName?: string | 
					
						
							|  |  |  |   intersectionContainerId?: string | 
					
						
							|  |  |  |   scrollContainerId?: string | 
					
						
							| 
									
										
										
										
											2025-04-10 11:18:43 +08:00
										 |  |  |   showSearchParams?: boolean | 
					
						
							| 
									
										
										
										
											2025-02-17 17:05:13 +08:00
										 |  |  | } | 
					
						
							|  |  |  | const Marketplace = async ({ | 
					
						
							|  |  |  |   locale, | 
					
						
							|  |  |  |   searchBoxAutoAnimate = true, | 
					
						
							|  |  |  |   showInstallButton = true, | 
					
						
							|  |  |  |   shouldExclude, | 
					
						
							|  |  |  |   searchParams, | 
					
						
							|  |  |  |   pluginTypeSwitchClassName, | 
					
						
							|  |  |  |   intersectionContainerId, | 
					
						
							|  |  |  |   scrollContainerId, | 
					
						
							| 
									
										
										
										
											2025-04-10 11:18:43 +08:00
										 |  |  |   showSearchParams = true, | 
					
						
							| 
									
										
										
										
											2025-02-17 17:05:13 +08:00
										 |  |  | }: MarketplaceProps) => { | 
					
						
							|  |  |  |   let marketplaceCollections: any = [] | 
					
						
							|  |  |  |   let marketplaceCollectionPluginsMap = {} | 
					
						
							|  |  |  |   if (!shouldExclude) { | 
					
						
							|  |  |  |     const marketplaceCollectionsAndPluginsData = await getMarketplaceCollectionsAndPlugins() | 
					
						
							|  |  |  |     marketplaceCollections = marketplaceCollectionsAndPluginsData.marketplaceCollections | 
					
						
							|  |  |  |     marketplaceCollectionPluginsMap = marketplaceCollectionsAndPluginsData.marketplaceCollectionPluginsMap | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return ( | 
					
						
							|  |  |  |     <TanstackQueryIniter> | 
					
						
							|  |  |  |       <MarketplaceContextProvider | 
					
						
							|  |  |  |         searchParams={searchParams} | 
					
						
							|  |  |  |         shouldExclude={shouldExclude} | 
					
						
							|  |  |  |         scrollContainerId={scrollContainerId} | 
					
						
							| 
									
										
										
										
											2025-04-10 11:18:43 +08:00
										 |  |  |         showSearchParams={showSearchParams} | 
					
						
							| 
									
										
										
										
											2025-02-17 17:05:13 +08:00
										 |  |  |       > | 
					
						
							|  |  |  |         <Description locale={locale} /> | 
					
						
							|  |  |  |         <IntersectionLine intersectionContainerId={intersectionContainerId} /> | 
					
						
							|  |  |  |         <SearchBoxWrapper | 
					
						
							|  |  |  |           locale={locale} | 
					
						
							|  |  |  |           searchBoxAutoAnimate={searchBoxAutoAnimate} | 
					
						
							|  |  |  |         /> | 
					
						
							|  |  |  |         <PluginTypeSwitch | 
					
						
							|  |  |  |           locale={locale} | 
					
						
							|  |  |  |           className={pluginTypeSwitchClassName} | 
					
						
							|  |  |  |           searchBoxAutoAnimate={searchBoxAutoAnimate} | 
					
						
							| 
									
										
										
										
											2025-04-10 11:18:43 +08:00
										 |  |  |           showSearchParams={showSearchParams} | 
					
						
							| 
									
										
										
										
											2025-02-17 17:05:13 +08:00
										 |  |  |         /> | 
					
						
							|  |  |  |         <ListWrapper | 
					
						
							|  |  |  |           locale={locale} | 
					
						
							|  |  |  |           marketplaceCollections={marketplaceCollections} | 
					
						
							|  |  |  |           marketplaceCollectionPluginsMap={marketplaceCollectionPluginsMap} | 
					
						
							|  |  |  |           showInstallButton={showInstallButton} | 
					
						
							|  |  |  |         /> | 
					
						
							|  |  |  |       </MarketplaceContextProvider> | 
					
						
							|  |  |  |     </TanstackQueryIniter> | 
					
						
							|  |  |  |   ) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default Marketplace |