@burdenoff/microfe-store 2026.626.1 → 2026.703.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.
@@ -1 +1 @@
1
- {"version":3,"file":"useStoreGraphQL.js","names":[],"sources":["../../src/hooks/useStoreGraphQL.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport { useStore } from '../providers/StoreProvider';\nimport { useStoreGraphQLWithContext } from './useStoreGraphQLWithContext';\nimport {\n BrowseStoreDocument,\n StoreProductDetailsDocument,\n HomeGroupedProductsDocument,\n} from '../generated/global-operations';\nimport { type BrowseStoreInput, type StoreProductDetailsInput } from '../generated/global-types';\n\n// Local type definitions until schema is fully defined\ntype ProductType = 'APP' | 'TEMPLATE' | 'THEME' | 'INTEGRATION' | 'WIDGET' | 'DATASET';\ntype CreateReviewInput = { productId: string; rating: number; title?: string; comment?: string };\ntype UpdateReviewInput = { rating?: number; title?: string; comment?: string };\n\n// Import generated document nodes for operations extracted to .graphql files\nimport {\n FeaturedProductsDocument,\n SearchSuggestionsDocument,\n TrendingSearchesDocument,\n FilterOptionsDocument,\n CategoriesDocument,\n ProductReviewsDocument,\n UserReviewForProductDocument,\n MyEntitlementsDocument,\n CheckEntitlementDocument,\n WorkspaceStoreOrdersDocument,\n MyPublishedProductsDocument,\n DeveloperEarningsDocument,\n CreateReviewDocument,\n UpdateReviewDocument,\n DeleteReviewDocument,\n MarkReviewHelpfulDocument,\n} from '../generated/global-operations';\n\n// ============================================================================\n// Helper to get Apollo Client\n// ============================================================================\n\n/**\n * Hook to get the store Apollo client from the shell's GatewayRoute context.\n * The Store route is wrapped with <GatewayRoute gateway=\"global\"> in the app shell,\n * so useApolloClient() returns the global gateway client.\n */\nfunction useStoreClient() {\n return useApolloClient();\n}\n\n// ============================================================================\n// Type Definitions\n// ============================================================================\n\ninterface StoreProduct {\n id: string;\n name: string;\n slug: string;\n type: string;\n nature: string;\n status: string;\n description?: string;\n pricingModel: string;\n price: number;\n currency: string;\n icon?: string;\n screenshots: string[];\n rating?: number;\n reviewCount: number;\n downloads: number;\n featured: boolean;\n category?: string;\n tags?: string[];\n publishedAt?: string;\n publisher?: {\n id: string;\n name: string;\n isVerified: boolean;\n logoUrl?: string;\n };\n}\n\ninterface BrowseStoreResult {\n products: StoreProduct[];\n totalCount: number;\n hasMore: boolean;\n nextCursor?: string;\n facets?: {\n types: { value: string; count: number }[];\n subTypes: { value: string; count: number }[];\n categories: { value: string; count: number }[];\n pricingModels: { value: string; count: number }[];\n licenses: { value: string; count: number }[];\n priceRange?: { min: number; max: number };\n ratingDistribution?: {\n fiveStars: number;\n fourStars: number;\n threeStars: number;\n twoStars: number;\n oneStar: number;\n };\n };\n}\n\ninterface ProductReview {\n id: string;\n productId: string;\n userId: string;\n rating: number;\n title?: string;\n comment?: string;\n status: string;\n helpful: number;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface ProductCategory {\n id: string;\n name: string;\n slug: string;\n description?: string;\n icon?: string;\n parentId?: string;\n}\n\ninterface SearchSuggestion {\n term: string;\n type: string;\n count: number;\n highlight?: string;\n}\n\ninterface GroupedProducts {\n featured: StoreProduct[];\n mostDownloaded: StoreProduct[];\n recentlyAdded: StoreProduct[];\n freeItems: StoreProduct[];\n}\n\n// GraphQL Query Result Types\ninterface StoreProductDetailsData {\n storeProductDetails?: {\n product: StoreProduct;\n publisher?: {\n id: string;\n name: string;\n isVerified: boolean;\n logoUrl?: string;\n };\n relatedProducts?: StoreProduct[];\n reviews?: ProductReview[];\n } | null;\n}\n\ninterface FilterOptionsData {\n filterOptions?: {\n types: { value: string; count: number }[];\n subTypes: { value: string; count: number }[];\n categories: { value: string; count: number }[];\n pricingModels: { value: string; count: number }[];\n licenses: { value: string; count: number }[];\n priceRange?: { min: number; max: number };\n } | null;\n}\n\ninterface CheckEntitlementData {\n checkEntitlement?: {\n hasAccess: boolean;\n entitlement?: {\n id: string;\n productId: string;\n type: string;\n status: string;\n expiresAt?: string;\n };\n } | null;\n}\n\ninterface DeveloperEarningsData {\n developerEarnings?: {\n totalEarnings: number;\n pendingPayout: number;\n periodEarnings: number;\n currency: string;\n transactions?: Array<{\n id: string;\n amount: number;\n type: string;\n status: string;\n createdAt: string;\n }>;\n } | null;\n}\n\n// ============================================================================\n// Browse & Search Hooks\n// ============================================================================\n\n/**\n * Hook to browse/search store products with filters\n * Uses Apollo Client from context\n */\nexport function useBrowseStore(input: BrowseStoreInput = {}) {\n const client = useStoreClient();\n const [products, setProducts] = useState<StoreProduct[]>([]);\n const [totalCount, setTotalCount] = useState(0);\n const [hasMore, setHasMore] = useState(false);\n const [facets, setFacets] = useState<BrowseStoreResult['facets']>(undefined);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n // Stringify input to use as stable dependency\n const inputKey = JSON.stringify(input);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ browseStore: BrowseStoreResult }>({\n query: BrowseStoreDocument,\n variables: { input: JSON.parse(inputKey) },\n fetchPolicy: 'network-only',\n });\n setProducts(result.data?.browseStore?.products ?? []);\n setTotalCount(result.data?.browseStore?.totalCount ?? 0);\n setHasMore(result.data?.browseStore?.hasMore ?? false);\n setFacets(result.data?.browseStore?.facets);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, inputKey]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n products,\n totalCount,\n hasMore,\n facets,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to browse/search store products with organization context.\n * Uses organization-aware GraphQL client with automatic headers.\n * Automatically applies defaultCompatibleWith from store context\n * to the filter if not already specified in the input.\n */\nexport function useBrowseStoreWithContext(\n input: BrowseStoreInput = {},\n options?: { skip?: boolean }\n) {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n const { defaultCompatibleWith } = useStore();\n const [allProducts, setAllProducts] = useState<StoreProduct[]>([]);\n const [totalCount, setTotalCount] = useState(0);\n const [hasMore, setHasMore] = useState(false);\n const [facets, setFacets] = useState<BrowseStoreResult['facets']>(undefined);\n const [loading, setLoading] = useState(!options?.skip);\n const [error, setError] = useState<Error | null>(null);\n const [currentOffset, setCurrentOffset] = useState(input.pagination?.offset ?? 0);\n\n const skip = options?.skip;\n\n // Merge defaultCompatibleWith into the input filter if not already set\n const mergedInput = useMemo(() => {\n if (!defaultCompatibleWith) return input;\n const merged = { ...input };\n if (merged.filter) {\n merged.filter = { ...merged.filter };\n if (!merged.filter.compatibleWith) {\n merged.filter.compatibleWith = defaultCompatibleWith;\n }\n } else {\n merged.filter = { compatibleWith: defaultCompatibleWith };\n }\n return merged;\n }, [input, defaultCompatibleWith]);\n\n // Stringify only filter/sort/type parts (NOT offset) as stable dependency\n // so changing offset for loadMore doesn't retrigger the effect\n const filterKey = useMemo(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { pagination, ...rest } = mergedInput;\n return JSON.stringify(rest);\n }, [mergedInput]);\n\n const pageLimit = input.pagination?.limit ?? 30;\n\n const fetchData = useCallback(\n async (fetchOffset: number, append: boolean) => {\n if (skip) {\n setLoading(false);\n return;\n }\n setLoading(true);\n setError(null);\n try {\n const queryInput: BrowseStoreInput = {\n ...(JSON.parse(filterKey) as BrowseStoreInput),\n pagination: { ...mergedInput.pagination, limit: pageLimit, offset: fetchOffset },\n };\n\n let result;\n\n if (hasOrganizationContext) {\n // Use organization-aware query\n result = (await queryWithContext({\n query: BrowseStoreDocument,\n variables: { input: queryInput },\n fetchPolicy: 'network-only',\n })) as { data?: { browseStore: BrowseStoreResult } };\n } else {\n // Fallback to global client without organization context\n result = await globalClient.query<{ browseStore: BrowseStoreResult }>({\n query: BrowseStoreDocument,\n variables: { input: queryInput },\n fetchPolicy: 'network-only',\n });\n }\n\n const fetched = result.data?.browseStore?.products ?? [];\n if (append) {\n setAllProducts((prev) => [...prev, ...fetched]);\n } else {\n setAllProducts(fetched);\n }\n setTotalCount(result.data?.browseStore?.totalCount ?? 0);\n setHasMore(result.data?.browseStore?.hasMore ?? false);\n setFacets(result.data?.browseStore?.facets);\n setCurrentOffset(fetchOffset + fetched.length);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n },\n [\n queryWithContext,\n globalClient,\n hasOrganizationContext,\n filterKey,\n skip,\n pageLimit,\n mergedInput.pagination,\n ]\n );\n\n // Re-fetch from offset 0 whenever filters/sort change. fetchData and pagination\n // offset are intentionally read via refs to avoid refetch loops on stable changes.\n const fetchDataRef = useRef(fetchData);\n fetchDataRef.current = fetchData;\n const offsetRef = useRef(input.pagination?.offset ?? 0);\n offsetRef.current = input.pagination?.offset ?? 0;\n useEffect(() => {\n void fetchDataRef.current(offsetRef.current, false);\n }, [filterKey, skip]);\n\n const loadMore = useCallback(() => {\n if (!hasMore || loading) return;\n void fetchData(currentOffset, true);\n }, [fetchData, hasMore, loading, currentOffset]);\n\n return {\n products: allProducts,\n totalCount,\n hasMore,\n facets,\n loading,\n error,\n refetch: () => fetchData(input.pagination?.offset ?? 0, false),\n loadMore,\n };\n}\n\n/**\n * Lazy hook to browse store on demand\n */\nexport function useLazyBrowseStore() {\n const client = useStoreClient();\n const [products, setProducts] = useState<StoreProduct[]>([]);\n const [totalCount, setTotalCount] = useState(0);\n const [hasMore, setHasMore] = useState(false);\n const [facets, setFacets] = useState<BrowseStoreResult['facets']>(undefined);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const browseStore = useCallback(\n async (input: BrowseStoreInput = {}) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ browseStore: BrowseStoreResult }>({\n query: BrowseStoreDocument,\n variables: { input },\n fetchPolicy: 'network-only',\n });\n const data = result.data?.browseStore;\n setProducts(data?.products ?? []);\n setTotalCount(data?.totalCount ?? 0);\n setHasMore(data?.hasMore ?? false);\n setFacets(data?.facets);\n return data;\n } catch (err) {\n setError(err as Error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n browseStore,\n products,\n totalCount,\n hasMore,\n facets,\n loading,\n error,\n };\n}\n\n/**\n * Hook to fetch product details for product page\n */\nexport function useStoreProductDetails(input: StoreProductDetailsInput) {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n const [data, setData] = useState<unknown>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const shouldSkip = !input.id && !input.slug;\n\n // Stringify input to use as stable dependency (prevents infinite loops)\n const inputKey = JSON.stringify(input);\n\n // Track if fetch has been attempted for this input\n const fetchedRef = useRef<string | null>(null);\n\n const fetchData = useCallback(async () => {\n if (shouldSkip) {\n setLoading(false);\n return;\n }\n\n // Skip if already fetched for this input\n if (fetchedRef.current === inputKey) {\n return;\n }\n fetchedRef.current = inputKey;\n\n setLoading(true);\n setError(null);\n try {\n const result = hasOrganizationContext\n ? ((await queryWithContext({\n query: StoreProductDetailsDocument,\n variables: { input: JSON.parse(inputKey) },\n fetchPolicy: 'network-only',\n })) as { data?: StoreProductDetailsData })\n : await globalClient.query<StoreProductDetailsData>({\n query: StoreProductDetailsDocument,\n variables: { input: JSON.parse(inputKey) },\n fetchPolicy: 'network-only',\n });\n setData(result.data?.storeProductDetails ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [globalClient, hasOrganizationContext, inputKey, queryWithContext, shouldSkip]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n data,\n loading,\n error,\n refetch: () => {\n fetchedRef.current = null; // Reset to allow refetch\n return fetchData();\n },\n };\n}\n\n/**\n * Lazy hook to fetch product details on demand\n */\nexport function useLazyStoreProductDetails() {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n const [data, setData] = useState<unknown>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const getProductDetails = useCallback(\n async (input: StoreProductDetailsInput) => {\n setLoading(true);\n setError(null);\n try {\n const result = hasOrganizationContext\n ? ((await queryWithContext({\n query: StoreProductDetailsDocument,\n variables: { input },\n })) as { data?: StoreProductDetailsData })\n : await globalClient.query<StoreProductDetailsData>({\n query: StoreProductDetailsDocument,\n variables: { input },\n });\n const details = result.data?.storeProductDetails ?? null;\n setData(details);\n return details;\n } catch (err) {\n setError(err as Error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [globalClient, hasOrganizationContext, queryWithContext]\n );\n\n return {\n getProductDetails,\n data,\n loading,\n error,\n };\n}\n\n/**\n * Hook to fetch grouped products for homepage.\n */\nexport function useHomeGroupedProducts(options?: { skip?: boolean }) {\n const client = useStoreClient();\n const { defaultCompatibleWith } = useStore();\n const [data, setData] = useState<GroupedProducts | null>(null);\n const [loading, setLoading] = useState(!options?.skip);\n const [error, setError] = useState<Error | null>(null);\n\n const skip = options?.skip;\n\n const fetchData = useCallback(async () => {\n if (skip) {\n setLoading(false);\n return;\n }\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ homeGroupedProducts: GroupedProducts }>({\n query: HomeGroupedProductsDocument,\n variables: { compatibleWith: defaultCompatibleWith ?? null },\n fetchPolicy: 'cache-first',\n });\n setData(result.data?.homeGroupedProducts ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, defaultCompatibleWith, skip]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n data,\n featured: data?.featured ?? [],\n mostDownloaded: data?.mostDownloaded ?? [],\n recentlyAdded: data?.recentlyAdded ?? [],\n freeItems: data?.freeItems ?? [],\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to fetch featured products\n */\nexport function useFeaturedProducts(limit?: number) {\n const client = useStoreClient();\n const [products, setProducts] = useState<StoreProduct[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ featuredProducts: StoreProduct[] }>({\n query: FeaturedProductsDocument,\n variables: { limit },\n fetchPolicy: 'cache-first',\n });\n setProducts(result.data?.featuredProducts ?? []);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, limit]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n products,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to fetch search suggestions for autocomplete\n */\nexport function useSearchSuggestions(\n query: string,\n options?: { limit?: number; types?: string[] }\n) {\n const client = useStoreClient();\n const [suggestions, setSuggestions] = useState<SearchSuggestion[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const shouldSkip = query.length < 2;\n\n const fetchData = useCallback(async () => {\n if (shouldSkip) {\n setSuggestions([]);\n return;\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ searchSuggestions: SearchSuggestion[] }>({\n query: SearchSuggestionsDocument,\n variables: { query, limit: options?.limit, types: options?.types },\n fetchPolicy: 'network-only',\n });\n setSuggestions(result.data?.searchSuggestions ?? []);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, query, options?.limit, options?.types, shouldSkip]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n suggestions,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Lazy hook to fetch search suggestions on demand\n */\nexport function useLazySearchSuggestions() {\n const client = useStoreClient();\n const [suggestions, setSuggestions] = useState<SearchSuggestion[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const getSuggestions = useCallback(\n async (query: string, options?: { limit?: number; types?: string[] }) => {\n if (query.length < 2) {\n setSuggestions([]);\n return [];\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ searchSuggestions: SearchSuggestion[] }>({\n query: SearchSuggestionsDocument,\n variables: { query, limit: options?.limit, types: options?.types },\n fetchPolicy: 'network-only',\n });\n const data = result.data?.searchSuggestions ?? [];\n setSuggestions(data);\n return data;\n } catch (err) {\n setError(err as Error);\n return [];\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n getSuggestions,\n suggestions,\n loading,\n error,\n };\n}\n\n/**\n * Hook to fetch trending search terms\n */\nexport function useTrendingSearches(options?: { limit?: number; type?: ProductType }) {\n const client = useStoreClient();\n const [terms, setTerms] = useState<string[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ trendingSearches: string[] }>({\n query: TrendingSearchesDocument,\n variables: { limit: options?.limit, type: options?.type },\n fetchPolicy: 'cache-first',\n });\n setTerms(result.data?.trendingSearches ?? []);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, options?.limit, options?.type]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n terms,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to fetch filter options for dropdowns\n */\nexport function useFilterOptions(options?: { type?: ProductType; withProducts?: boolean }) {\n const client = useStoreClient();\n const [filterOptions, setFilterOptions] = useState<unknown>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<FilterOptionsData>({\n query: FilterOptionsDocument,\n variables: { type: options?.type, withProducts: options?.withProducts },\n fetchPolicy: 'cache-first',\n });\n setFilterOptions(result.data?.filterOptions ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, options?.type, options?.withProducts]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n filterOptions,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n// ============================================================================\n// Category Hooks\n// ============================================================================\n\n/**\n * Hook to fetch all categories\n */\nexport function useCategories() {\n const client = useStoreClient();\n const [categories, setCategories] = useState<ProductCategory[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ categories: ProductCategory[] }>({\n query: CategoriesDocument,\n fetchPolicy: 'cache-first',\n });\n setCategories(result.data?.categories ?? []);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n categories,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n// ============================================================================\n// Review Hooks\n// ============================================================================\n\n/**\n * Hook to fetch reviews for a product\n */\nexport function useProductReviews(productId: string, options?: { status?: string }) {\n const client = useStoreClient();\n const [reviews, setReviews] = useState<ProductReview[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n if (!productId) {\n setLoading(false);\n return;\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ productReviews: ProductReview[] }>({\n query: ProductReviewsDocument,\n variables: { productId, status: options?.status },\n fetchPolicy: 'cache-first',\n });\n setReviews(result.data?.productReviews ?? []);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, productId, options?.status]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n reviews,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to fetch current user's review for a product\n */\nexport function useUserReviewForProduct(productId: string) {\n const client = useStoreClient();\n const [review, setReview] = useState<ProductReview | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n if (!productId) {\n setLoading(false);\n return;\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ userReviewForProduct: ProductReview | null }>({\n query: UserReviewForProductDocument,\n variables: { productId },\n fetchPolicy: 'network-only',\n });\n setReview(result.data?.userReviewForProduct ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, productId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n review,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to create a review\n */\nexport function useCreateReview() {\n const client = useStoreClient();\n const [review, setReview] = useState<ProductReview | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const createReview = useCallback(\n async (input: CreateReviewInput) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.mutate<{ createReview: ProductReview }>({\n mutation: CreateReviewDocument,\n variables: { input },\n });\n const data = result.data?.createReview ?? null;\n setReview(data);\n return data;\n } catch (err) {\n setError(err as Error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n createReview,\n review,\n loading,\n error,\n };\n}\n\n/**\n * Hook to update a review\n */\nexport function useUpdateReview() {\n const client = useStoreClient();\n const [review, setReview] = useState<ProductReview | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const updateReview = useCallback(\n async (id: string, input: UpdateReviewInput) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.mutate<{ updateReview: ProductReview }>({\n mutation: UpdateReviewDocument,\n variables: { id, input },\n });\n const data = result.data?.updateReview ?? null;\n setReview(data);\n return data;\n } catch (err) {\n setError(err as Error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n updateReview,\n review,\n loading,\n error,\n };\n}\n\n/**\n * Hook to delete a review\n */\nexport function useDeleteReview() {\n const client = useStoreClient();\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const deleteReview = useCallback(\n async (id: string) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.mutate<{ deleteReview: boolean }>({\n mutation: DeleteReviewDocument,\n variables: { id },\n });\n return result.data?.deleteReview ?? false;\n } catch (err) {\n setError(err as Error);\n return false;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n deleteReview,\n loading,\n error,\n };\n}\n\n/**\n * Hook to mark review as helpful\n */\nexport function useMarkReviewHelpful() {\n const client = useStoreClient();\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const markHelpful = useCallback(\n async (id: string) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.mutate<{ markReviewHelpful: { id: string; helpful: number } }>({\n mutation: MarkReviewHelpfulDocument,\n variables: { id },\n });\n return result.data?.markReviewHelpful ?? null;\n } catch (err) {\n setError(err as Error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n markHelpful,\n loading,\n error,\n };\n}\n\n// ============================================================================\n// Entitlement Hooks\n// ============================================================================\n\n/**\n * Hook to fetch current user's entitlements\n */\nexport function useMyEntitlements() {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n const PAGE_SIZE = 20;\n const [allEntitlements, setAllEntitlements] = useState<unknown[]>([]);\n const [hasMore, setHasMore] = useState(false);\n const [currentOffset, setCurrentOffset] = useState(0);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(\n async (fetchOffset = 0, append = false) => {\n setLoading(true);\n setError(null);\n try {\n const variables = { limit: PAGE_SIZE, offset: fetchOffset };\n const result = hasOrganizationContext\n ? ((await queryWithContext({\n query: MyEntitlementsDocument,\n variables,\n fetchPolicy: 'network-only',\n })) as { data?: { myEntitlements: unknown[] } })\n : await globalClient.query<{ myEntitlements: unknown[] }>({\n query: MyEntitlementsDocument,\n variables,\n fetchPolicy: 'network-only',\n });\n const fetched = result.data?.myEntitlements ?? [];\n if (append) {\n setAllEntitlements((prev) => [...prev, ...fetched]);\n } else {\n setAllEntitlements(fetched);\n }\n setHasMore(fetched.length === PAGE_SIZE);\n setCurrentOffset(fetchOffset);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n },\n [globalClient, hasOrganizationContext, queryWithContext]\n );\n\n useEffect(() => {\n fetchData(0);\n }, [fetchData]);\n\n const loadMore = useCallback(() => {\n if (!hasMore || loading) return;\n fetchData(currentOffset + PAGE_SIZE, true);\n }, [fetchData, hasMore, loading, currentOffset]);\n\n return {\n entitlements: allEntitlements,\n hasMore,\n loading,\n error,\n refetch: () => fetchData(0),\n loadMore,\n };\n}\n\n/**\n * Hook to check entitlement for a product\n */\nexport function useCheckEntitlement(productId: string) {\n const client = useStoreClient();\n const [entitlement, setEntitlement] = useState<unknown>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n if (!productId) {\n setLoading(false);\n return;\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<CheckEntitlementData>({\n query: CheckEntitlementDocument,\n variables: { productId },\n fetchPolicy: 'network-only',\n });\n setEntitlement(result.data?.checkEntitlement ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, productId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n entitlement,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n// ============================================================================\n// Order Hooks\n// ============================================================================\n\n/**\n * Hook to fetch workspace store orders\n */\nexport function useWorkspaceStoreOrders(\n billingAccountId: string,\n page: number,\n limit: number,\n options?: { status?: string; search?: string }\n) {\n const client = useStoreClient();\n const [orders, setOrders] = useState<unknown[]>([]);\n const [total, setTotal] = useState(0);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n if (!billingAccountId) {\n setLoading(false);\n return;\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{\n workspaceStoreOrders: { total: number; orders: unknown[] };\n }>({\n query: WorkspaceStoreOrdersDocument,\n variables: {\n billingAccountId,\n page,\n limit,\n status: options?.status,\n search: options?.search,\n },\n fetchPolicy: 'network-only',\n });\n setOrders(result.data?.workspaceStoreOrders?.orders ?? []);\n setTotal(result.data?.workspaceStoreOrders?.total ?? 0);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, billingAccountId, page, limit, options?.status, options?.search]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n orders,\n total,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n// ============================================================================\n// Publisher Hooks\n// ============================================================================\n\n/**\n * Hook to fetch publisher's products\n */\nexport function useMyPublishedProducts() {\n const client = useStoreClient();\n const [allProducts, setAllProducts] = useState<StoreProduct[]>([]);\n const [hasMore, setHasMore] = useState(false);\n const [currentOffset, setCurrentOffset] = useState(0);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const PAGE_SIZE = 20;\n\n const fetchData = useCallback(\n async (fetchOffset = 0, append = false) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ publishedProducts: StoreProduct[] }>({\n query: MyPublishedProductsDocument,\n variables: { limit: PAGE_SIZE, offset: fetchOffset },\n fetchPolicy: 'network-only',\n });\n const fetched = result.data?.publishedProducts ?? [];\n if (append) {\n setAllProducts((prev) => [...prev, ...fetched]);\n } else {\n setAllProducts(fetched);\n }\n setHasMore(fetched.length === PAGE_SIZE);\n setCurrentOffset(fetchOffset + fetched.length);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n const loadMore = useCallback(() => {\n if (!hasMore || loading) return;\n void fetchData(currentOffset, true);\n }, [fetchData, hasMore, loading, currentOffset]);\n\n useEffect(() => {\n void fetchData(0, false);\n }, [fetchData]);\n\n return {\n products: allProducts,\n hasMore,\n loading,\n error,\n refetch: () => fetchData(0, false),\n loadMore,\n };\n}\n\n/**\n * Hook to fetch developer earnings\n */\nexport function useDeveloperEarnings(options?: {\n period?: string;\n startDate?: string;\n endDate?: string;\n}) {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n const [earnings, setEarnings] = useState<unknown>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = hasOrganizationContext\n ? ((await queryWithContext({\n query: DeveloperEarningsDocument,\n variables: { input: options },\n fetchPolicy: 'network-only',\n })) as { data?: DeveloperEarningsData })\n : await globalClient.query<DeveloperEarningsData>({\n query: DeveloperEarningsDocument,\n variables: { input: options },\n fetchPolicy: 'network-only',\n });\n setEarnings(result.data?.developerEarnings ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [globalClient, hasOrganizationContext, options, queryWithContext]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n earnings,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n// ============================================================================\n// Re-export types for convenience\n// ============================================================================\n\nexport type {\n BrowseStoreInput,\n StoreProductDetailsInput,\n ProductType,\n CreateReviewInput,\n UpdateReviewInput,\n StoreProduct,\n ProductReview,\n ProductCategory,\n SearchSuggestion,\n GroupedProducts,\n BrowseStoreResult,\n};\n"],"mappings":";;;;;;AA6CA,SAAS,IAAiB;AACxB,QAAO,GAAiB;;AA4J1B,SAAgB,EAAe,IAA0B,EAAE,EAAE;CAC3D,IAAM,IAAS,GAAgB,EACzB,CAAC,GAAU,KAAe,EAAyB,EAAE,CAAC,EACtD,CAAC,GAAY,KAAiB,EAAS,EAAE,EACzC,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAQ,KAAa,EAAsC,KAAA,EAAU,EACtE,CAAC,GAAS,KAAc,EAAS,GAAK,EACtC,CAAC,GAAO,KAAY,EAAuB,KAAK,EAGhD,IAAW,KAAK,UAAU,EAAM,EAEhC,IAAY,EAAY,YAAY;AAExC,EADA,EAAW,GAAK,EAChB,EAAS,KA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,GAAS;IAC7B,aAAa;IACd,CAAC,GACF,MAAM,EAAa,MAA6B;IAC9C,OAAO;IACP,WAAW,EAAE,OAAO,GAAS;IAC7B,aAAa;IACd,CAAC,EACa,MAAM,qBAAqB,KAAK;WAC5C,GAAK;AACZ,KAAS,EAAa;YACd;AACR,KAAW,GAAM;;IAElB;EAAC;EAAc;EAAwB;EAAS;EAAiB,CAAC;AAMrE,QAJA,QAAgB;AACd,KAAW;IACV,CAAC,EAAU,CAAC,EAER;EACL;EACA;EACA;EACA,SAAS;EACV"}
1
+ {"version":3,"file":"useStoreGraphQL.js","names":[],"sources":["../../src/hooks/useStoreGraphQL.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport { useStore } from '../providers/StoreProvider';\nimport { useStoreGraphQLWithContext } from './useStoreGraphQLWithContext';\nimport {\n BrowseStoreDocument,\n StoreProductDetailsDocument,\n HomeGroupedProductsDocument,\n} from '../generated/global-operations';\nimport { type BrowseStoreInput, type StoreProductDetailsInput } from '../generated/global-types';\n\n// Local type definitions until schema is fully defined\ntype ProductType = 'APP' | 'TEMPLATE' | 'THEME' | 'INTEGRATION' | 'WIDGET' | 'DATASET';\ntype CreateReviewInput = { productId: string; rating: number; title?: string; comment?: string };\ntype UpdateReviewInput = { rating?: number; title?: string; comment?: string };\n\n// Import generated document nodes for operations extracted to .graphql files\nimport {\n FeaturedProductsDocument,\n SearchSuggestionsDocument,\n TrendingSearchesDocument,\n FilterOptionsDocument,\n CategoriesDocument,\n ProductReviewsDocument,\n UserReviewForProductDocument,\n MyEntitlementsDocument,\n CheckEntitlementDocument,\n WorkspaceStoreOrdersDocument,\n MyPublishedProductsDocument,\n DeveloperEarningsDocument,\n CreateReviewDocument,\n UpdateReviewDocument,\n DeleteReviewDocument,\n MarkReviewHelpfulDocument,\n} from '../generated/global-operations';\n\n// ============================================================================\n// Helper to get Apollo Client\n// ============================================================================\n\n/**\n * Hook to get the store Apollo client from the shell's GatewayRoute context.\n * The Store route is wrapped with <GatewayRoute gateway=\"global\"> in the app shell,\n * so useApolloClient() returns the global gateway client.\n */\nfunction useStoreClient() {\n return useApolloClient();\n}\n\n// ============================================================================\n// Type Definitions\n// ============================================================================\n\ninterface StoreProduct {\n id: string;\n name: string;\n slug: string;\n type: string;\n nature: string;\n status: string;\n description?: string;\n pricingModel: string;\n price: number;\n currency: string;\n icon?: string;\n screenshots: string[];\n rating?: number;\n reviewCount: number;\n downloads: number;\n featured: boolean;\n category?: string;\n tags?: string[];\n publishedAt?: string;\n publisher?: {\n id: string;\n name: string;\n isVerified: boolean;\n logoUrl?: string;\n };\n}\n\ninterface BrowseStoreResult {\n products: StoreProduct[];\n totalCount: number;\n hasMore: boolean;\n nextCursor?: string;\n facets?: {\n types: { value: string; count: number }[];\n subTypes: { value: string; count: number }[];\n categories: { value: string; count: number }[];\n pricingModels: { value: string; count: number }[];\n licenses: { value: string; count: number }[];\n priceRange?: { min: number; max: number };\n ratingDistribution?: {\n fiveStars: number;\n fourStars: number;\n threeStars: number;\n twoStars: number;\n oneStar: number;\n };\n };\n}\n\ninterface ProductReview {\n id: string;\n productId: string;\n userId: string;\n rating: number;\n title?: string;\n comment?: string;\n status: string;\n helpful: number;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface ProductCategory {\n id: string;\n name: string;\n slug: string;\n description?: string;\n icon?: string;\n parentId?: string;\n}\n\ninterface SearchSuggestion {\n term: string;\n type: string;\n count: number;\n highlight?: string;\n}\n\ninterface GroupedProducts {\n featured: StoreProduct[];\n mostDownloaded: StoreProduct[];\n recentlyAdded: StoreProduct[];\n freeItems: StoreProduct[];\n}\n\n// GraphQL Query Result Types\ninterface StoreProductDetailsData {\n storeProductDetails?: {\n product: StoreProduct;\n publisher?: {\n id: string;\n name: string;\n isVerified: boolean;\n logoUrl?: string;\n };\n relatedProducts?: StoreProduct[];\n reviews?: ProductReview[];\n } | null;\n}\n\ninterface FilterOptionsData {\n filterOptions?: {\n types: { value: string; count: number }[];\n subTypes: { value: string; count: number }[];\n categories: { value: string; count: number }[];\n pricingModels: { value: string; count: number }[];\n licenses: { value: string; count: number }[];\n priceRange?: { min: number; max: number };\n } | null;\n}\n\ninterface CheckEntitlementData {\n checkEntitlement?: {\n hasAccess: boolean;\n entitlement?: {\n id: string;\n productId: string;\n type: string;\n status: string;\n expiresAt?: string;\n };\n } | null;\n}\n\ninterface DeveloperEarningsData {\n developerEarnings?: {\n totalEarnings: number;\n pendingPayout: number;\n periodEarnings: number;\n currency: string;\n transactions?: Array<{\n id: string;\n amount: number;\n type: string;\n status: string;\n createdAt: string;\n }>;\n } | null;\n}\n\n// ============================================================================\n// Browse & Search Hooks\n// ============================================================================\n\n/**\n * Hook to browse/search store products with filters\n * Uses Apollo Client from context\n */\nexport function useBrowseStore(input: BrowseStoreInput = {}) {\n const client = useStoreClient();\n const [products, setProducts] = useState<StoreProduct[]>([]);\n const [totalCount, setTotalCount] = useState(0);\n const [hasMore, setHasMore] = useState(false);\n const [facets, setFacets] = useState<BrowseStoreResult['facets']>(undefined);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n // Stringify input to use as stable dependency\n const inputKey = JSON.stringify(input);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ browseStore: BrowseStoreResult }>({\n query: BrowseStoreDocument,\n variables: { input: JSON.parse(inputKey) },\n fetchPolicy: 'network-only',\n });\n setProducts(result.data?.browseStore?.products ?? []);\n setTotalCount(result.data?.browseStore?.totalCount ?? 0);\n setHasMore(result.data?.browseStore?.hasMore ?? false);\n setFacets(result.data?.browseStore?.facets);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, inputKey]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n products,\n totalCount,\n hasMore,\n facets,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to browse/search store products with organization context.\n * Uses organization-aware GraphQL client with automatic headers.\n * Automatically applies defaultCompatibleWith from store context\n * to the filter if not already specified in the input.\n */\nexport function useBrowseStoreWithContext(\n input: BrowseStoreInput = {},\n options?: { skip?: boolean }\n) {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n const { defaultCompatibleWith } = useStore();\n const [allProducts, setAllProducts] = useState<StoreProduct[]>([]);\n const [totalCount, setTotalCount] = useState(0);\n const [hasMore, setHasMore] = useState(false);\n const [facets, setFacets] = useState<BrowseStoreResult['facets']>(undefined);\n const [loading, setLoading] = useState(!options?.skip);\n const [error, setError] = useState<Error | null>(null);\n const [currentOffset, setCurrentOffset] = useState(input.pagination?.offset ?? 0);\n\n const skip = options?.skip;\n\n // Merge defaultCompatibleWith into the input filter if not already set\n const mergedInput = useMemo(() => {\n if (!defaultCompatibleWith) return input;\n const merged = { ...input };\n if (merged.filter) {\n merged.filter = { ...merged.filter };\n if (!merged.filter.compatibleWith) {\n merged.filter.compatibleWith = defaultCompatibleWith;\n }\n } else {\n merged.filter = { compatibleWith: defaultCompatibleWith };\n }\n return merged;\n }, [input, defaultCompatibleWith]);\n\n // Stringify only filter/sort/type parts (NOT offset) as stable dependency\n // so changing offset for loadMore doesn't retrigger the effect\n const filterKey = useMemo(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { pagination, ...rest } = mergedInput;\n return JSON.stringify(rest);\n }, [mergedInput]);\n\n const pageLimit = input.pagination?.limit ?? 30;\n\n const fetchData = useCallback(\n async (fetchOffset: number, append: boolean) => {\n if (skip) {\n setLoading(false);\n return;\n }\n setLoading(true);\n setError(null);\n try {\n const queryInput: BrowseStoreInput = {\n ...(JSON.parse(filterKey) as BrowseStoreInput),\n pagination: { ...mergedInput.pagination, limit: pageLimit, offset: fetchOffset },\n };\n\n let result;\n\n if (hasOrganizationContext) {\n // Use organization-aware query\n result = (await queryWithContext({\n query: BrowseStoreDocument,\n variables: { input: queryInput },\n fetchPolicy: 'network-only',\n })) as { data?: { browseStore: BrowseStoreResult } };\n } else {\n // Fallback to global client without organization context\n result = await globalClient.query<{ browseStore: BrowseStoreResult }>({\n query: BrowseStoreDocument,\n variables: { input: queryInput },\n fetchPolicy: 'network-only',\n });\n }\n\n const fetched = result.data?.browseStore?.products ?? [];\n if (append) {\n setAllProducts((prev) => [...prev, ...fetched]);\n } else {\n setAllProducts(fetched);\n }\n setTotalCount(result.data?.browseStore?.totalCount ?? 0);\n setHasMore(result.data?.browseStore?.hasMore ?? false);\n setFacets(result.data?.browseStore?.facets);\n setCurrentOffset(fetchOffset + fetched.length);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n },\n [\n queryWithContext,\n globalClient,\n hasOrganizationContext,\n filterKey,\n skip,\n pageLimit,\n mergedInput.pagination,\n ]\n );\n\n // Re-fetch from offset 0 whenever filters/sort change. fetchData and pagination\n // offset are intentionally read via refs to avoid refetch loops on stable changes.\n const fetchDataRef = useRef(fetchData);\n fetchDataRef.current = fetchData;\n const offsetRef = useRef(input.pagination?.offset ?? 0);\n offsetRef.current = input.pagination?.offset ?? 0;\n useEffect(() => {\n void fetchDataRef.current(offsetRef.current, false);\n }, [filterKey, skip]);\n\n const loadMore = useCallback(() => {\n if (!hasMore || loading) return;\n void fetchData(currentOffset, true);\n }, [fetchData, hasMore, loading, currentOffset]);\n\n return {\n products: allProducts,\n totalCount,\n hasMore,\n facets,\n loading,\n error,\n refetch: () => fetchData(input.pagination?.offset ?? 0, false),\n loadMore,\n };\n}\n\n/**\n * Lazy hook to browse store on demand\n */\nexport function useLazyBrowseStore() {\n const client = useStoreClient();\n const [products, setProducts] = useState<StoreProduct[]>([]);\n const [totalCount, setTotalCount] = useState(0);\n const [hasMore, setHasMore] = useState(false);\n const [facets, setFacets] = useState<BrowseStoreResult['facets']>(undefined);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const browseStore = useCallback(\n async (input: BrowseStoreInput = {}) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ browseStore: BrowseStoreResult }>({\n query: BrowseStoreDocument,\n variables: { input },\n fetchPolicy: 'network-only',\n });\n const data = result.data?.browseStore;\n setProducts(data?.products ?? []);\n setTotalCount(data?.totalCount ?? 0);\n setHasMore(data?.hasMore ?? false);\n setFacets(data?.facets);\n return data;\n } catch (err) {\n setError(err as Error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n browseStore,\n products,\n totalCount,\n hasMore,\n facets,\n loading,\n error,\n };\n}\n\n/**\n * Hook to fetch product details for product page\n */\nexport function useStoreProductDetails(input: StoreProductDetailsInput) {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n const [data, setData] = useState<unknown>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const shouldSkip = !input.id && !input.slug;\n\n // Stringify input to use as stable dependency (prevents infinite loops)\n const inputKey = JSON.stringify(input);\n\n // Track if fetch has been attempted for this input\n const fetchedRef = useRef<string | null>(null);\n\n const fetchData = useCallback(async () => {\n if (shouldSkip) {\n setLoading(false);\n return;\n }\n\n // Skip if already fetched for this input\n if (fetchedRef.current === inputKey) {\n return;\n }\n fetchedRef.current = inputKey;\n\n setLoading(true);\n setError(null);\n try {\n const result = hasOrganizationContext\n ? ((await queryWithContext({\n query: StoreProductDetailsDocument,\n variables: { input: JSON.parse(inputKey) },\n fetchPolicy: 'network-only',\n })) as { data?: StoreProductDetailsData })\n : await globalClient.query<StoreProductDetailsData>({\n query: StoreProductDetailsDocument,\n variables: { input: JSON.parse(inputKey) },\n fetchPolicy: 'network-only',\n });\n setData(result.data?.storeProductDetails ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [globalClient, hasOrganizationContext, inputKey, queryWithContext, shouldSkip]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n data,\n loading,\n error,\n refetch: () => {\n fetchedRef.current = null; // Reset to allow refetch\n return fetchData();\n },\n };\n}\n\n/**\n * Lazy hook to fetch product details on demand\n */\nexport function useLazyStoreProductDetails() {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n const [data, setData] = useState<unknown>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const getProductDetails = useCallback(\n async (input: StoreProductDetailsInput) => {\n setLoading(true);\n setError(null);\n try {\n const result = hasOrganizationContext\n ? ((await queryWithContext({\n query: StoreProductDetailsDocument,\n variables: { input },\n })) as { data?: StoreProductDetailsData })\n : await globalClient.query<StoreProductDetailsData>({\n query: StoreProductDetailsDocument,\n variables: { input },\n });\n const details = result.data?.storeProductDetails ?? null;\n setData(details);\n return details;\n } catch (err) {\n setError(err as Error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [globalClient, hasOrganizationContext, queryWithContext]\n );\n\n return {\n getProductDetails,\n data,\n loading,\n error,\n };\n}\n\n/**\n * Hook to fetch grouped products for homepage.\n */\nexport function useHomeGroupedProducts(options?: { skip?: boolean }) {\n const client = useStoreClient();\n const { defaultCompatibleWith } = useStore();\n const [data, setData] = useState<GroupedProducts | null>(null);\n const [loading, setLoading] = useState(!options?.skip);\n const [error, setError] = useState<Error | null>(null);\n\n const skip = options?.skip;\n\n const fetchData = useCallback(async () => {\n if (skip) {\n setLoading(false);\n return;\n }\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ homeGroupedProducts: GroupedProducts }>({\n query: HomeGroupedProductsDocument,\n variables: { compatibleWith: defaultCompatibleWith ?? null },\n fetchPolicy: 'cache-first',\n });\n setData(result.data?.homeGroupedProducts ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, defaultCompatibleWith, skip]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n data,\n featured: data?.featured ?? [],\n mostDownloaded: data?.mostDownloaded ?? [],\n recentlyAdded: data?.recentlyAdded ?? [],\n freeItems: data?.freeItems ?? [],\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to fetch featured products\n */\nexport function useFeaturedProducts(limit?: number) {\n const client = useStoreClient();\n const [products, setProducts] = useState<StoreProduct[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ featuredProducts: StoreProduct[] }>({\n query: FeaturedProductsDocument,\n variables: { limit },\n fetchPolicy: 'cache-first',\n });\n setProducts(result.data?.featuredProducts ?? []);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, limit]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n products,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to fetch search suggestions for autocomplete\n */\nexport function useSearchSuggestions(\n query: string,\n options?: { limit?: number; types?: string[] }\n) {\n const client = useStoreClient();\n const [suggestions, setSuggestions] = useState<SearchSuggestion[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const shouldSkip = query.length < 2;\n\n const fetchData = useCallback(async () => {\n if (shouldSkip) {\n setSuggestions([]);\n return;\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ searchSuggestions: SearchSuggestion[] }>({\n query: SearchSuggestionsDocument,\n variables: { query, limit: options?.limit, types: options?.types },\n fetchPolicy: 'network-only',\n });\n setSuggestions(result.data?.searchSuggestions ?? []);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, query, options?.limit, options?.types, shouldSkip]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n suggestions,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Lazy hook to fetch search suggestions on demand\n */\nexport function useLazySearchSuggestions() {\n const client = useStoreClient();\n const [suggestions, setSuggestions] = useState<SearchSuggestion[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const getSuggestions = useCallback(\n async (query: string, options?: { limit?: number; types?: string[] }) => {\n if (query.length < 2) {\n setSuggestions([]);\n return [];\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ searchSuggestions: SearchSuggestion[] }>({\n query: SearchSuggestionsDocument,\n variables: { query, limit: options?.limit, types: options?.types },\n fetchPolicy: 'network-only',\n });\n const data = result.data?.searchSuggestions ?? [];\n setSuggestions(data);\n return data;\n } catch (err) {\n setError(err as Error);\n return [];\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n getSuggestions,\n suggestions,\n loading,\n error,\n };\n}\n\n/**\n * Hook to fetch trending search terms\n */\nexport function useTrendingSearches(options?: { limit?: number; type?: ProductType }) {\n const client = useStoreClient();\n const [terms, setTerms] = useState<string[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ trendingSearches: string[] }>({\n query: TrendingSearchesDocument,\n variables: { limit: options?.limit, type: options?.type },\n fetchPolicy: 'cache-first',\n });\n setTerms(result.data?.trendingSearches ?? []);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, options?.limit, options?.type]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n terms,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to fetch filter options for dropdowns\n */\nexport function useFilterOptions(options?: { type?: ProductType; withProducts?: boolean }) {\n const client = useStoreClient();\n const [filterOptions, setFilterOptions] = useState<unknown>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<FilterOptionsData>({\n query: FilterOptionsDocument,\n variables: { type: options?.type, withProducts: options?.withProducts },\n fetchPolicy: 'cache-first',\n });\n setFilterOptions(result.data?.filterOptions ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, options?.type, options?.withProducts]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n filterOptions,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n// ============================================================================\n// Category Hooks\n// ============================================================================\n\n/**\n * Hook to fetch all categories\n */\nexport function useCategories() {\n const client = useStoreClient();\n const [categories, setCategories] = useState<ProductCategory[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ categories: ProductCategory[] }>({\n query: CategoriesDocument,\n fetchPolicy: 'cache-first',\n });\n setCategories(result.data?.categories ?? []);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n categories,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n// ============================================================================\n// Review Hooks\n// ============================================================================\n\n/**\n * Hook to fetch reviews for a product\n */\nexport function useProductReviews(productId: string, options?: { status?: string }) {\n const client = useStoreClient();\n const [reviews, setReviews] = useState<ProductReview[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n if (!productId) {\n setLoading(false);\n return;\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ productReviews: ProductReview[] }>({\n query: ProductReviewsDocument,\n variables: { productId, status: options?.status },\n fetchPolicy: 'cache-first',\n });\n setReviews(result.data?.productReviews ?? []);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, productId, options?.status]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n reviews,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to fetch current user's review for a product\n */\nexport function useUserReviewForProduct(productId: string) {\n const client = useStoreClient();\n const [review, setReview] = useState<ProductReview | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n if (!productId) {\n setLoading(false);\n return;\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ userReviewForProduct: ProductReview | null }>({\n query: UserReviewForProductDocument,\n variables: { productId },\n fetchPolicy: 'network-only',\n });\n setReview(result.data?.userReviewForProduct ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, productId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n review,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n/**\n * Hook to create a review\n */\nexport function useCreateReview() {\n const client = useStoreClient();\n const [review, setReview] = useState<ProductReview | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const createReview = useCallback(\n async (input: CreateReviewInput) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.mutate<{ createReview: ProductReview }>({\n mutation: CreateReviewDocument,\n variables: { input },\n });\n const data = result.data?.createReview ?? null;\n setReview(data);\n return data;\n } catch (err) {\n setError(err as Error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n createReview,\n review,\n loading,\n error,\n };\n}\n\n/**\n * Hook to update a review\n */\nexport function useUpdateReview() {\n const client = useStoreClient();\n const [review, setReview] = useState<ProductReview | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const updateReview = useCallback(\n async (id: string, input: UpdateReviewInput) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.mutate<{ updateReview: ProductReview }>({\n mutation: UpdateReviewDocument,\n variables: { id, input },\n });\n const data = result.data?.updateReview ?? null;\n setReview(data);\n return data;\n } catch (err) {\n setError(err as Error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n updateReview,\n review,\n loading,\n error,\n };\n}\n\n/**\n * Hook to delete a review\n */\nexport function useDeleteReview() {\n const client = useStoreClient();\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const deleteReview = useCallback(\n async (id: string) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.mutate<{ deleteReview: boolean }>({\n mutation: DeleteReviewDocument,\n variables: { id },\n });\n return result.data?.deleteReview ?? false;\n } catch (err) {\n setError(err as Error);\n return false;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n deleteReview,\n loading,\n error,\n };\n}\n\n/**\n * Hook to mark review as helpful\n */\nexport function useMarkReviewHelpful() {\n const client = useStoreClient();\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const markHelpful = useCallback(\n async (id: string) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.mutate<{ markReviewHelpful: { id: string; helpful: number } }>({\n mutation: MarkReviewHelpfulDocument,\n variables: { id },\n });\n return result.data?.markReviewHelpful ?? null;\n } catch (err) {\n setError(err as Error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n return {\n markHelpful,\n loading,\n error,\n };\n}\n\n// ============================================================================\n// Entitlement Hooks\n// ============================================================================\n\n/**\n * Hook to fetch current user's entitlements\n */\nexport function useMyEntitlements() {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n const PAGE_SIZE = 20;\n const [allEntitlements, setAllEntitlements] = useState<unknown[]>([]);\n const [hasMore, setHasMore] = useState(false);\n const [currentOffset, setCurrentOffset] = useState(0);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(\n async (fetchOffset = 0, append = false) => {\n setLoading(true);\n setError(null);\n try {\n const variables = { limit: PAGE_SIZE, offset: fetchOffset };\n const result = hasOrganizationContext\n ? ((await queryWithContext({\n query: MyEntitlementsDocument,\n variables,\n fetchPolicy: 'network-only',\n })) as { data?: { myEntitlements: unknown[] } })\n : await globalClient.query<{ myEntitlements: unknown[] }>({\n query: MyEntitlementsDocument,\n variables,\n fetchPolicy: 'network-only',\n });\n const fetched = result.data?.myEntitlements ?? [];\n if (append) {\n setAllEntitlements((prev) => [...prev, ...fetched]);\n } else {\n setAllEntitlements(fetched);\n }\n setHasMore(fetched.length === PAGE_SIZE);\n setCurrentOffset(fetchOffset);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n },\n [globalClient, hasOrganizationContext, queryWithContext]\n );\n\n useEffect(() => {\n fetchData(0);\n }, [fetchData]);\n\n const loadMore = useCallback(() => {\n if (!hasMore || loading) return;\n fetchData(currentOffset + PAGE_SIZE, true);\n }, [fetchData, hasMore, loading, currentOffset]);\n\n return {\n entitlements: allEntitlements,\n hasMore,\n loading,\n error,\n refetch: () => fetchData(0),\n loadMore,\n };\n}\n\n/**\n * Hook to check entitlement for a product\n */\nexport function useCheckEntitlement(productId: string) {\n const client = useStoreClient();\n const [entitlement, setEntitlement] = useState<unknown>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n if (!productId) {\n setLoading(false);\n return;\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<CheckEntitlementData>({\n query: CheckEntitlementDocument,\n variables: { productId },\n fetchPolicy: 'network-only',\n });\n setEntitlement(result.data?.checkEntitlement ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, productId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n entitlement,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n// ============================================================================\n// Order Hooks\n// ============================================================================\n\n/**\n * Hook to fetch workspace store orders\n */\nexport function useWorkspaceStoreOrders(\n billingAccountId: string,\n page: number,\n limit: number,\n options?: { status?: string; search?: string }\n) {\n const client = useStoreClient();\n const [orders, setOrders] = useState<unknown[]>([]);\n const [total, setTotal] = useState(0);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n if (!billingAccountId) {\n setLoading(false);\n return;\n }\n\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{\n workspaceStoreOrders: { total: number; orders: unknown[] };\n }>({\n query: WorkspaceStoreOrdersDocument,\n variables: {\n billingAccountId,\n page,\n limit,\n status: options?.status,\n search: options?.search,\n },\n fetchPolicy: 'network-only',\n });\n setOrders(result.data?.workspaceStoreOrders?.orders ?? []);\n setTotal(result.data?.workspaceStoreOrders?.total ?? 0);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [client, billingAccountId, page, limit, options?.status, options?.search]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n orders,\n total,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n// ============================================================================\n// Publisher Hooks\n// ============================================================================\n\n/**\n * Hook to fetch publisher's products\n */\nexport function useMyPublishedProducts() {\n const client = useStoreClient();\n const [allProducts, setAllProducts] = useState<StoreProduct[]>([]);\n const [hasMore, setHasMore] = useState(false);\n const [currentOffset, setCurrentOffset] = useState(0);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const PAGE_SIZE = 20;\n\n const fetchData = useCallback(\n async (fetchOffset = 0, append = false) => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query<{ publishedProducts: StoreProduct[] }>({\n query: MyPublishedProductsDocument,\n variables: { limit: PAGE_SIZE, offset: fetchOffset },\n fetchPolicy: 'network-only',\n });\n const fetched = result.data?.publishedProducts ?? [];\n if (append) {\n setAllProducts((prev) => [...prev, ...fetched]);\n } else {\n setAllProducts(fetched);\n }\n setHasMore(fetched.length === PAGE_SIZE);\n setCurrentOffset(fetchOffset + fetched.length);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n const loadMore = useCallback(() => {\n if (!hasMore || loading) return;\n void fetchData(currentOffset, true);\n }, [fetchData, hasMore, loading, currentOffset]);\n\n useEffect(() => {\n void fetchData(0, false);\n }, [fetchData]);\n\n return {\n products: allProducts,\n hasMore,\n loading,\n error,\n refetch: () => fetchData(0, false),\n loadMore,\n };\n}\n\n/**\n * Hook to fetch developer earnings\n */\nexport function useDeveloperEarnings(options?: {\n period?: string;\n startDate?: string;\n endDate?: string;\n}) {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n const [earnings, setEarnings] = useState<unknown>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n const result = hasOrganizationContext\n ? ((await queryWithContext({\n query: DeveloperEarningsDocument,\n variables: { input: options },\n fetchPolicy: 'network-only',\n })) as { data?: DeveloperEarningsData })\n : await globalClient.query<DeveloperEarningsData>({\n query: DeveloperEarningsDocument,\n variables: { input: options },\n fetchPolicy: 'network-only',\n });\n setEarnings(result.data?.developerEarnings ?? null);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [globalClient, hasOrganizationContext, options, queryWithContext]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n earnings,\n loading,\n error,\n refetch: fetchData,\n };\n}\n\n// ============================================================================\n// Re-export types for convenience\n// ============================================================================\n\nexport type {\n BrowseStoreInput,\n StoreProductDetailsInput,\n ProductType,\n CreateReviewInput,\n UpdateReviewInput,\n StoreProduct,\n ProductReview,\n ProductCategory,\n SearchSuggestion,\n GroupedProducts,\n BrowseStoreResult,\n};\n"],"mappings":";;;;;;AA6CA,SAAS,IAAiB;AACxB,QAAO,GAAiB;;AA4J1B,SAAgB,EAAe,IAA0B,EAAE,EAAE;CAC3D,IAAM,IAAS,GAAgB,EACzB,CAAC,GAAU,KAAe,EAAyB,EAAE,CAAC,EACtD,CAAC,GAAY,KAAiB,EAAS,EAAE,EACzC,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,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C;EAAQ;EAAkB;EAAM;EAAO,GAAS;EAAQ,GAAS;EAAO,CAAC;AAM7E,QAJA,QAAgB;AACd,KAAW;IACV,CAAC,EAAU,CAAC,EAER;EACL;EACA;EACA;EACA;EACA,SAAS;EACV"}
package/dist/index.js CHANGED
@@ -8,6 +8,6 @@ import { StoreRoot as mt } from "./StoreRoot.js";
8
8
  import { StoreAdminRoot as ht } from "./StoreAdminRoot.js";
9
9
  import { useProductSearch as gt } from "./hooks/useProductSearch.js";
10
10
  import { calculateCartTotals as _t, debounce as vt, formatFileSize as yt, formatNumber as bt, formatPrice as xt, formatPriceForModel as St, generateCartItemId as Ct, getDaysUntilExpiry as wt, getItemTypeName as Tt, getPricingModelName as Et, getRatingStars as Dt, getStatusColor as Ot, isLicenseExpiringSoon as kt, maskLicenseKey as At, truncate as jt, validateLicenseKey as Mt } from "./utils/index.js";
11
- import { useBrowseStore as Nt, useBrowseStoreWithContext as Pt, useCategories as Ft, useCheckEntitlement as It, useCreateReview as Lt, useDeleteReview as Rt, useDeveloperEarnings as zt, useFeaturedProducts as Bt, useFilterOptions as Vt, useHomeGroupedProducts as Ht, useLazyBrowseStore as Ut, useLazySearchSuggestions as Wt, useLazyStoreProductDetails as Gt, useMarkReviewHelpful as Kt, useMyEntitlements as qt, useMyPublishedProducts as Jt, useProductReviews as Yt, useSearchSuggestions as Xt, useStoreProductDetails as Zt, useTrendingSearches as Qt, useUpdateReview as $t, useUserReviewForProduct as en, useWorkspaceStoreOrders as tn } from "./hooks/useStoreGraphQL.js";
12
- import { enTranslations as nn } from "./translations/en.js";
13
- export { i as AddToCartDocument, a as BrowseStoreDocument, o as CategoriesDocument, s as CheckEntitlementDocument, c as CheckoutDocument, l as ClearCartDocument, u as CreateProductForPublisherDocument, d as CreateReviewDocument, f as CreateStoreOrderDocument, p as DeleteReviewDocument, m as DeveloperEarningsDocument, h as FeaturedProductsDocument, g as FilterOptionsDocument, _ as GetCartDocument, v as GetMyOrdersDocument, y as GetMyStoreInstallationsDocument, b as GetProductDocument, x as GetProductsDocument, S as GetStoreAppInstallationDocument, C as HomeGroupedProductsDocument, w as InstallationStatusUpdatedDocument, T as LicenseStatusUpdatedDocument, E as MarkReviewHelpfulDocument, D as MyEntitlementsDocument, O as MyPublishedProductsDocument, k as OrderStatusUpdatedDocument, A as ProductReviewsDocument, j as RecordAppUninstallationDocument, M as RemoveFromCartDocument, t as STORE_PERMISSIONS, N as SearchSuggestionsDocument, ht as StoreAdminRoot, P as StoreProductDetailsDocument, mt as StoreRoot, F as SubmissionStatusUpdatedDocument, I as TrendingSearchesDocument, L as UpdateCartItemDocument, R as UpdateReviewDocument, z as UserReviewForProductDocument, B as WorkspaceStoreOrdersDocument, _t as calculateCartTotals, vt as debounce, yt as formatFileSize, bt as formatNumber, xt as formatPrice, St as formatPriceForModel, Ct as generateCartItemId, wt as getDaysUntilExpiry, Tt as getItemTypeName, Et as getPricingModelName, Dt as getRatingStars, Ot as getStatusColor, kt as isLicenseExpiringSoon, At as maskLicenseKey, nn as storeTranslations, jt as truncate, V as useAddToCartMutation, ft as useBackendCart, Nt as useBrowseStore, H as useBrowseStoreLazyQuery, U as useBrowseStoreQuery, W as useBrowseStoreSuspenseQuery, Pt as useBrowseStoreWithContext, pt as useCart, Ft as useCategories, G as useCategoriesLazyQuery, K as useCategoriesQuery, q as useCategoriesSuspenseQuery, It as useCheckEntitlement, J as useCheckEntitlementLazyQuery, Y as useCheckEntitlementQuery, X as useCheckEntitlementSuspenseQuery, Z as useCheckoutMutation, Q as useClearCartMutation, $ as useCreateProductForPublisherMutation, Lt as useCreateReview, ee as useCreateReviewMutation, te as useCreateStoreOrderMutation, Rt as useDeleteReview, ne as useDeleteReviewMutation, zt as useDeveloperEarnings, re as useDeveloperEarningsLazyQuery, ie as useDeveloperEarningsQuery, ae as useDeveloperEarningsSuspenseQuery, Bt as useFeaturedProducts, oe as useFeaturedProductsLazyQuery, se as useFeaturedProductsQuery, ce as useFeaturedProductsSuspenseQuery, Vt as useFilterOptions, le as useFilterOptionsLazyQuery, ue as useFilterOptionsQuery, de as useFilterOptionsSuspenseQuery, fe as useGetCartLazyQuery, pe as useGetCartQuery, me as useGetCartSuspenseQuery, he as useGetMyOrdersLazyQuery, ge as useGetMyOrdersQuery, _e as useGetMyOrdersSuspenseQuery, ve as useGetMyStoreInstallationsLazyQuery, ye as useGetMyStoreInstallationsQuery, be as useGetMyStoreInstallationsSuspenseQuery, xe as useGetProductLazyQuery, Se as useGetProductQuery, Ce as useGetProductSuspenseQuery, we as useGetProductsLazyQuery, Te as useGetProductsQuery, Ee as useGetProductsSuspenseQuery, De as useGetStoreAppInstallationLazyQuery, Oe as useGetStoreAppInstallationQuery, ke as useGetStoreAppInstallationSuspenseQuery, Ht as useHomeGroupedProducts, Ae as useHomeGroupedProductsLazyQuery, je as useHomeGroupedProductsQuery, Me as useHomeGroupedProductsSuspenseQuery, Ne as useInstallationStatusUpdatedSubscription, Ut as useLazyBrowseStore, Wt as useLazySearchSuggestions, Gt as useLazyStoreProductDetails, Pe as useLicenseStatusUpdatedSubscription, Kt as useMarkReviewHelpful, Fe as useMarkReviewHelpfulMutation, qt as useMyEntitlements, Ie as useMyEntitlementsLazyQuery, Le as useMyEntitlementsQuery, Re as useMyEntitlementsSuspenseQuery, Jt as useMyPublishedProducts, ze as useMyPublishedProductsLazyQuery, Be as useMyPublishedProductsQuery, Ve as useMyPublishedProductsSuspenseQuery, He as useOrderStatusUpdatedSubscription, Yt as useProductReviews, Ue as useProductReviewsLazyQuery, We as useProductReviewsQuery, Ge as useProductReviewsSuspenseQuery, gt as useProductSearch, Ke as useRecordAppUninstallationMutation, qe as useRemoveFromCartMutation, Xt as useSearchSuggestions, Je as useSearchSuggestionsLazyQuery, Ye as useSearchSuggestionsQuery, Xe as useSearchSuggestionsSuspenseQuery, e as useStore, n as useStorePermissions, Zt as useStoreProductDetails, Ze as useStoreProductDetailsLazyQuery, Qe as useStoreProductDetailsQuery, $e as useStoreProductDetailsSuspenseQuery, r as useStoreStore, et as useSubmissionStatusUpdatedSubscription, Qt as useTrendingSearches, tt as useTrendingSearchesLazyQuery, nt as useTrendingSearchesQuery, rt as useTrendingSearchesSuspenseQuery, it as useUpdateCartItemMutation, $t as useUpdateReview, at as useUpdateReviewMutation, en as useUserReviewForProduct, ot as useUserReviewForProductLazyQuery, st as useUserReviewForProductQuery, ct as useUserReviewForProductSuspenseQuery, tn as useWorkspaceStoreOrders, lt as useWorkspaceStoreOrdersLazyQuery, ut as useWorkspaceStoreOrdersQuery, dt as useWorkspaceStoreOrdersSuspenseQuery, Mt as validateLicenseKey };
11
+ import { useBrowseStore as Nt, useBrowseStoreWithContext as Pt, useCategories as Ft, useCheckEntitlement as It, useCreateReview as Lt, useDeleteReview as Rt, useFeaturedProducts as zt, useFilterOptions as Bt, useHomeGroupedProducts as Vt, useLazyBrowseStore as Ht, useLazySearchSuggestions as Ut, useLazyStoreProductDetails as Wt, useMarkReviewHelpful as Gt, useMyEntitlements as Kt, useProductReviews as qt, useSearchSuggestions as Jt, useStoreProductDetails as Yt, useTrendingSearches as Xt, useUpdateReview as Zt, useUserReviewForProduct as Qt, useWorkspaceStoreOrders as $t } from "./hooks/useStoreGraphQL.js";
12
+ import { enTranslations as en } from "./translations/en.js";
13
+ export { i as AddToCartDocument, a as BrowseStoreDocument, o as CategoriesDocument, s as CheckEntitlementDocument, c as CheckoutDocument, l as ClearCartDocument, u as CreateProductForPublisherDocument, d as CreateReviewDocument, f as CreateStoreOrderDocument, p as DeleteReviewDocument, m as DeveloperEarningsDocument, h as FeaturedProductsDocument, g as FilterOptionsDocument, _ as GetCartDocument, v as GetMyOrdersDocument, y as GetMyStoreInstallationsDocument, b as GetProductDocument, x as GetProductsDocument, S as GetStoreAppInstallationDocument, C as HomeGroupedProductsDocument, w as InstallationStatusUpdatedDocument, T as LicenseStatusUpdatedDocument, E as MarkReviewHelpfulDocument, D as MyEntitlementsDocument, O as MyPublishedProductsDocument, k as OrderStatusUpdatedDocument, A as ProductReviewsDocument, j as RecordAppUninstallationDocument, M as RemoveFromCartDocument, t as STORE_PERMISSIONS, N as SearchSuggestionsDocument, ht as StoreAdminRoot, P as StoreProductDetailsDocument, mt as StoreRoot, F as SubmissionStatusUpdatedDocument, I as TrendingSearchesDocument, L as UpdateCartItemDocument, R as UpdateReviewDocument, z as UserReviewForProductDocument, B as WorkspaceStoreOrdersDocument, _t as calculateCartTotals, vt as debounce, yt as formatFileSize, bt as formatNumber, xt as formatPrice, St as formatPriceForModel, Ct as generateCartItemId, wt as getDaysUntilExpiry, Tt as getItemTypeName, Et as getPricingModelName, Dt as getRatingStars, Ot as getStatusColor, kt as isLicenseExpiringSoon, At as maskLicenseKey, en as storeTranslations, jt as truncate, V as useAddToCartMutation, ft as useBackendCart, Nt as useBrowseStore, H as useBrowseStoreLazyQuery, U as useBrowseStoreQuery, W as useBrowseStoreSuspenseQuery, Pt as useBrowseStoreWithContext, pt as useCart, Ft as useCategories, G as useCategoriesLazyQuery, K as useCategoriesQuery, q as useCategoriesSuspenseQuery, It as useCheckEntitlement, J as useCheckEntitlementLazyQuery, Y as useCheckEntitlementQuery, X as useCheckEntitlementSuspenseQuery, Z as useCheckoutMutation, Q as useClearCartMutation, $ as useCreateProductForPublisherMutation, Lt as useCreateReview, ee as useCreateReviewMutation, te as useCreateStoreOrderMutation, Rt as useDeleteReview, ne as useDeleteReviewMutation, re as useDeveloperEarningsLazyQuery, ie as useDeveloperEarningsQuery, ae as useDeveloperEarningsSuspenseQuery, zt as useFeaturedProducts, oe as useFeaturedProductsLazyQuery, se as useFeaturedProductsQuery, ce as useFeaturedProductsSuspenseQuery, Bt as useFilterOptions, le as useFilterOptionsLazyQuery, ue as useFilterOptionsQuery, de as useFilterOptionsSuspenseQuery, fe as useGetCartLazyQuery, pe as useGetCartQuery, me as useGetCartSuspenseQuery, he as useGetMyOrdersLazyQuery, ge as useGetMyOrdersQuery, _e as useGetMyOrdersSuspenseQuery, ve as useGetMyStoreInstallationsLazyQuery, ye as useGetMyStoreInstallationsQuery, be as useGetMyStoreInstallationsSuspenseQuery, xe as useGetProductLazyQuery, Se as useGetProductQuery, Ce as useGetProductSuspenseQuery, we as useGetProductsLazyQuery, Te as useGetProductsQuery, Ee as useGetProductsSuspenseQuery, De as useGetStoreAppInstallationLazyQuery, Oe as useGetStoreAppInstallationQuery, ke as useGetStoreAppInstallationSuspenseQuery, Vt as useHomeGroupedProducts, Ae as useHomeGroupedProductsLazyQuery, je as useHomeGroupedProductsQuery, Me as useHomeGroupedProductsSuspenseQuery, Ne as useInstallationStatusUpdatedSubscription, Ht as useLazyBrowseStore, Ut as useLazySearchSuggestions, Wt as useLazyStoreProductDetails, Pe as useLicenseStatusUpdatedSubscription, Gt as useMarkReviewHelpful, Fe as useMarkReviewHelpfulMutation, Kt as useMyEntitlements, Ie as useMyEntitlementsLazyQuery, Le as useMyEntitlementsQuery, Re as useMyEntitlementsSuspenseQuery, ze as useMyPublishedProductsLazyQuery, Be as useMyPublishedProductsQuery, Ve as useMyPublishedProductsSuspenseQuery, He as useOrderStatusUpdatedSubscription, qt as useProductReviews, Ue as useProductReviewsLazyQuery, We as useProductReviewsQuery, Ge as useProductReviewsSuspenseQuery, gt as useProductSearch, Ke as useRecordAppUninstallationMutation, qe as useRemoveFromCartMutation, Jt as useSearchSuggestions, Je as useSearchSuggestionsLazyQuery, Ye as useSearchSuggestionsQuery, Xe as useSearchSuggestionsSuspenseQuery, e as useStore, n as useStorePermissions, Yt as useStoreProductDetails, Ze as useStoreProductDetailsLazyQuery, Qe as useStoreProductDetailsQuery, $e as useStoreProductDetailsSuspenseQuery, r as useStoreStore, et as useSubmissionStatusUpdatedSubscription, Xt as useTrendingSearches, tt as useTrendingSearchesLazyQuery, nt as useTrendingSearchesQuery, rt as useTrendingSearchesSuspenseQuery, it as useUpdateCartItemMutation, Zt as useUpdateReview, at as useUpdateReviewMutation, Qt as useUserReviewForProduct, ot as useUserReviewForProductLazyQuery, st as useUserReviewForProductQuery, ct as useUserReviewForProductSuspenseQuery, $t as useWorkspaceStoreOrders, lt as useWorkspaceStoreOrdersLazyQuery, ut as useWorkspaceStoreOrdersQuery, dt as useWorkspaceStoreOrdersSuspenseQuery, Mt as validateLicenseKey };