@01.software/sdk 0.38.0 → 0.40.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.
- package/README.md +169 -54
- package/dist/analytics/react.cjs.map +1 -1
- package/dist/analytics/react.js.map +1 -1
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/client.cjs +1194 -5
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +8 -7
- package/dist/client.d.ts +8 -7
- package/dist/client.js +1194 -5
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-BroIWHY1.d.ts → collection-client-CKFa99C6.d.ts} +16 -10
- package/dist/{collection-client-B0J9wMNE.d.cts → collection-client-VYwYi6u6.d.cts} +16 -10
- package/dist/const-4BUtUdGU.d.cts +32 -0
- package/dist/const-ymprfiPf.d.ts +32 -0
- package/dist/errors.cjs +4 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.js +4 -1
- package/dist/errors.js.map +1 -1
- package/dist/{index-BOLQxveo.d.cts → index-Dquv4xTL.d.cts} +3 -3
- package/dist/{index-CSwR2HSg.d.ts → index-w36lpSkU.d.ts} +3 -3
- package/dist/index.cjs +2796 -2651
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +2796 -2651
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-m3jjhxk9.d.cts → payload-types-DC0xzR9i.d.cts} +470 -265
- package/dist/{payload-types-m3jjhxk9.d.ts → payload-types-DC0xzR9i.d.ts} +470 -265
- package/dist/query.cjs +241 -58
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +151 -26
- package/dist/query.d.ts +151 -26
- package/dist/query.js +241 -58
- package/dist/query.js.map +1 -1
- package/dist/realtime.cjs +5 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js +5 -1
- package/dist/realtime.js.map +1 -1
- package/dist/server.cjs +1117 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.js +1117 -1
- package/dist/server.js.map +1 -1
- package/dist/storefront-cache.cjs +144 -0
- package/dist/storefront-cache.cjs.map +1 -0
- package/dist/storefront-cache.d.cts +24 -0
- package/dist/storefront-cache.d.ts +24 -0
- package/dist/storefront-cache.js +121 -0
- package/dist/storefront-cache.js.map +1 -0
- package/dist/{types-Cmrd1ezc.d.ts → types-Bh2p-EMc.d.ts} +5 -1
- package/dist/{types-D0ubzQw0.d.cts → types-BvpjooU-.d.cts} +5 -1
- package/dist/{types-D2xYdz4P.d.ts → types-D5uHrPLr.d.cts} +264 -96
- package/dist/{types-CIGscmus.d.cts → types-Umd-YTjM.d.ts} +264 -96
- package/dist/ui/canvas/server.cjs +5 -1
- package/dist/ui/canvas/server.cjs.map +1 -1
- package/dist/ui/canvas/server.js +5 -1
- package/dist/ui/canvas/server.js.map +1 -1
- package/dist/ui/canvas.cjs +5 -1
- package/dist/ui/canvas.cjs.map +1 -1
- package/dist/ui/canvas.js +5 -1
- package/dist/ui/canvas.js.map +1 -1
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.d.cts +4 -4
- package/dist/webhook.d.ts +4 -4
- package/package.json +13 -3
- package/dist/const-6XHz_jej.d.ts +0 -32
- package/dist/const-B5KT72c7.d.cts +0 -32
package/dist/query.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/query.ts","../src/core/query/get-query-client.ts","../src/core/query/query-keys.ts","../src/core/query/collection-hooks.ts","../src/core/query/customer-hooks.ts","../src/core/errors.ts","../src/core/query/query-hooks.ts","../src/core/internal/utils/query-string.ts","../src/core/query/realtime.ts","../src/core/query/query-client.ts"],"sourcesContent":["export * from './core/query'\n","import {\n isServer,\n QueryClient,\n defaultShouldDehydrateQuery,\n} from '@tanstack/react-query'\n\nfunction makeQueryClient() {\n return new QueryClient({\n defaultOptions: {\n queries: {\n // Infinite staleTime: server-fetched data persists until explicitly invalidated.\n // For browser clients needing fresher data, override per-query:\n // useQuery({ ..., staleTime: 5 * 60 * 1000 })\n staleTime: Number.POSITIVE_INFINITY,\n refetchOnWindowFocus: false,\n },\n dehydrate: {\n shouldDehydrateQuery: (query) =>\n defaultShouldDehydrateQuery(query) ||\n query.state.status === 'pending',\n shouldRedactErrors: () => false,\n },\n },\n })\n}\n\nlet browserQueryClient: QueryClient | undefined\nlet browserStorefrontQueryClient: QueryClient | undefined\n\n/** Default React Query client (SSR hydration-friendly: infinite staleTime). */\nexport function getQueryClient() {\n if (isServer) {\n return makeQueryClient()\n }\n if (!browserQueryClient) {\n browserQueryClient = makeQueryClient()\n }\n return browserQueryClient\n}\n\nconst STOREFRONT_STALE_TIME_MS = 60_000\n\nfunction makeStorefrontQueryClient() {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STOREFRONT_STALE_TIME_MS,\n refetchOnWindowFocus: false,\n },\n dehydrate: {\n shouldDehydrateQuery: (query) =>\n defaultShouldDehydrateQuery(query) ||\n query.state.status === 'pending',\n shouldRedactErrors: () => false,\n },\n },\n })\n}\n\n/**\n * Browser storefront client: refetches catalog data after ~1 minute instead of\n * keeping SSR data fresh forever. Use with `createQueryHooks(client, queryClient)`.\n */\nexport function getStorefrontQueryClient() {\n if (isServer) {\n return makeStorefrontQueryClient()\n }\n if (!browserStorefrontQueryClient) {\n browserStorefrontQueryClient = makeStorefrontQueryClient()\n }\n return browserStorefrontQueryClient\n}\n","import type { ServerCollection, ApiQueryOptions } from '../client/types'\nimport type { ProductListingGroupsQueryOptions } from './query-hooks'\n\nexport function collectionKeys<T extends ServerCollection>(collection: T) {\n return {\n all: [collection] as const,\n lists: () => [collection, 'list'] as const,\n list: (options?: ApiQueryOptions) => [collection, 'list', options] as const,\n details: () => [collection, 'detail'] as const,\n detail: (id: string, options?: ApiQueryOptions) =>\n [collection, 'detail', id, options] as const,\n infinites: () => [collection, 'infinite'] as const,\n infinite: (options?: Omit<ApiQueryOptions, 'page'>) =>\n [collection, 'infinite', options] as const,\n }\n}\n\nexport const customerKeys = {\n all: ['customer'] as const,\n me: () => ['customer', 'me'] as const,\n}\n\nexport const productKeys = {\n listingGroups: (options?: ProductListingGroupsQueryOptions) =>\n ['products', 'listing-groups', 'list', options] as const,\n listingGroupsCatalog: (options?: ProductListingGroupsQueryOptions) =>\n ['products', 'listing-groups', 'catalog', options] as const,\n listingGroupsInfinite: (\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>,\n ) =>\n ['products', 'listing-groups', 'infinite', options] as const,\n listingGroupsCatalogInfinite: (\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>,\n ) =>\n ['products', 'listing-groups', 'catalog', 'infinite', options] as const,\n detail: (params: { slug: string } | { id: string }) =>\n ['products', 'detail', params] as const,\n detailAll: () => ['products', 'detail'] as const,\n}\n","import {\n QueryClient,\n useQuery as useQueryOriginal,\n useSuspenseQuery as useSuspenseQueryOriginal,\n useInfiniteQuery as useInfiniteQueryOriginal,\n useSuspenseInfiniteQuery as useSuspenseInfiniteQueryOriginal,\n useMutation as useMutationOriginal,\n} from '@tanstack/react-query'\nimport type {\n InfiniteData,\n UseInfiniteQueryResult,\n UseQueryResult,\n UseSuspenseInfiniteQueryResult,\n UseSuspenseQueryResult,\n} from '@tanstack/react-query'\nimport type {\n PublicCollection,\n ServerCollection,\n ApiQueryOptions,\n PayloadFindResponse,\n PayloadMutationResponse,\n} from '../client/types'\nimport { type CollectionClient, type CollectionType } from '../collection'\nimport { SDKError } from '../internal/errors'\nimport { collectionKeys } from './query-keys'\n\n// ============================================================================\n// Query Params Types\n// ============================================================================\n\nexport interface CollectionQueryParams<T extends ServerCollection> {\n collection: T\n options?: ApiQueryOptions\n}\n\nexport interface CollectionDetailQueryParams<T extends ServerCollection> {\n collection: T\n id: string\n options?: ApiQueryOptions\n}\n\nexport interface CollectionInfiniteQueryParams<T extends ServerCollection> {\n collection: T\n options?: Omit<ApiQueryOptions, 'page'>\n pageSize?: number\n}\n\n// ============================================================================\n// Shared option types\n// ============================================================================\n\nexport interface QueryOptions<TQueryFnData = unknown, TData = TQueryFnData> {\n enabled?: boolean\n staleTime?: number\n gcTime?: number\n refetchOnWindowFocus?: boolean\n refetchOnMount?: boolean | 'always'\n refetchInterval?: number | false\n retry?: boolean | number\n select?: (data: TQueryFnData) => TData\n placeholderData?:\n | TQueryFnData\n | ((previousData: TData | undefined) => TQueryFnData | undefined)\n initialData?: TQueryFnData | (() => TQueryFnData)\n initialDataUpdatedAt?: number | (() => number | undefined)\n}\n\nexport type SuspenseQueryOptions<\n TQueryFnData = unknown,\n TData = TQueryFnData,\n> = Omit<QueryOptions<TQueryFnData, TData>, 'enabled' | 'placeholderData'>\n\n// placeholderData/initialData omitted: InfiniteData<T> structure is complex to construct\nexport interface InfiniteQueryOptions<\n TQueryFnData = unknown,\n TData = InfiniteData<TQueryFnData>,\n> {\n enabled?: boolean\n staleTime?: number\n gcTime?: number\n refetchOnWindowFocus?: boolean\n refetchOnMount?: boolean | 'always'\n refetchInterval?: number | false\n retry?: boolean | number\n select?: (data: InfiniteData<TQueryFnData>) => TData\n}\n\nexport type SuspenseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TData = InfiniteData<TQueryFnData>,\n> = Omit<InfiniteQueryOptions<TQueryFnData, TData>, 'enabled'>\n\ninterface MutationCallbacks<TData> {\n onSuccess?: (data: TData) => void\n onError?: (error: SDKError) => void\n onSettled?: () => void\n}\n\n// ============================================================================\n// Product detail invalidation\n// ============================================================================\n\nconst PRODUCT_DETAIL_INVALIDATING_COLLECTIONS = new Set([\n 'products',\n 'product-variants',\n 'product-options',\n 'product-option-values',\n 'product-categories',\n 'product-tags',\n 'product-collections',\n 'brands',\n 'brand-logos',\n 'images',\n])\n\n// ============================================================================\n// Collection Hooks Mixin\n// ============================================================================\n\nconst DEFAULT_PAGE_SIZE = 20\n\nexport class CollectionHooks<TCollection extends ServerCollection = PublicCollection> {\n protected queryClient: QueryClient\n protected collectionClient: CollectionClient<TCollection>\n\n constructor(\n queryClient: QueryClient,\n collectionClient: CollectionClient<TCollection>,\n ) {\n this.queryClient = queryClient\n this.collectionClient = collectionClient\n }\n\n // ===== useQuery =====\n useQuery<\n T extends TCollection,\n TData = PayloadFindResponse<CollectionType<T>>,\n >(\n params: CollectionQueryParams<T>,\n options?: QueryOptions<PayloadFindResponse<CollectionType<T>>, TData>,\n ): UseQueryResult<TData> {\n const { collection, options: queryOptions } = params\n const { placeholderData, ...restOptions } = (options ?? {}) as QueryOptions<\n PayloadFindResponse<CollectionType<T>>,\n TData\n >\n\n return useQueryOriginal({\n queryKey: collectionKeys(collection).list(queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .find(queryOptions)\n },\n ...restOptions,\n // NonFunctionGuard<T> incompatible with generic union types — safe cast\n ...(placeholderData !== undefined && {\n placeholderData: placeholderData as never,\n }),\n })\n }\n\n // ===== useSuspenseQuery =====\n useSuspenseQuery<\n T extends TCollection,\n TData = PayloadFindResponse<CollectionType<T>>,\n >(\n params: CollectionQueryParams<T>,\n options?: SuspenseQueryOptions<\n PayloadFindResponse<CollectionType<T>>,\n TData\n >,\n ): UseSuspenseQueryResult<TData> {\n const { collection, options: queryOptions } = params\n\n return useSuspenseQueryOriginal({\n queryKey: collectionKeys(collection).list(queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .find(queryOptions)\n },\n ...options,\n })\n }\n\n // ===== useQueryById =====\n useQueryById<T extends TCollection, TData = CollectionType<T>>(\n params: CollectionDetailQueryParams<T>,\n options?: QueryOptions<CollectionType<T>, TData>,\n ): UseQueryResult<TData> {\n const { collection, id, options: queryOptions } = params\n const { placeholderData, ...restOptions } = (options ?? {}) as QueryOptions<\n CollectionType<T>,\n TData\n >\n\n return useQueryOriginal({\n queryKey: collectionKeys(collection).detail(id, queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .findById(id, queryOptions)\n },\n ...restOptions,\n // NonFunctionGuard<T> incompatible with generic union types — safe cast\n ...(placeholderData !== undefined && {\n placeholderData: placeholderData as never,\n }),\n })\n }\n\n // ===== useSuspenseQueryById =====\n useSuspenseQueryById<T extends TCollection, TData = CollectionType<T>>(\n params: CollectionDetailQueryParams<T>,\n options?: SuspenseQueryOptions<CollectionType<T>, TData>,\n ): UseSuspenseQueryResult<TData> {\n const { collection, id, options: queryOptions } = params\n\n return useSuspenseQueryOriginal({\n queryKey: collectionKeys(collection).detail(id, queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .findById(id, queryOptions)\n },\n ...options,\n })\n }\n\n // ===== useInfiniteQuery =====\n useInfiniteQuery<\n T extends TCollection,\n TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>,\n >(\n params: CollectionInfiniteQueryParams<T>,\n options?: InfiniteQueryOptions<\n PayloadFindResponse<CollectionType<T>>,\n TData\n >,\n ): UseInfiniteQueryResult<TData> {\n const {\n collection,\n options: queryOptions,\n pageSize = DEFAULT_PAGE_SIZE,\n } = params\n\n return useInfiniteQueryOriginal({\n queryKey: collectionKeys(collection).infinite(queryOptions),\n queryFn: async ({ pageParam }) => {\n const response = await this.collectionClient\n .from(collection)\n .find({ ...queryOptions, page: pageParam, limit: pageSize })\n return response\n },\n initialPageParam: 1,\n getNextPageParam: (lastPage: PayloadFindResponse<CollectionType<T>>) => {\n return lastPage.hasNextPage ? lastPage.nextPage : undefined\n },\n ...options,\n })\n }\n\n // ===== useSuspenseInfiniteQuery =====\n useSuspenseInfiniteQuery<\n T extends TCollection,\n TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>,\n >(\n params: CollectionInfiniteQueryParams<T>,\n options?: SuspenseInfiniteQueryOptions<\n PayloadFindResponse<CollectionType<T>>,\n TData\n >,\n ): UseSuspenseInfiniteQueryResult<TData> {\n const {\n collection,\n options: queryOptions,\n pageSize = DEFAULT_PAGE_SIZE,\n } = params\n\n return useSuspenseInfiniteQueryOriginal({\n queryKey: collectionKeys(collection).infinite(queryOptions),\n queryFn: async ({ pageParam }) => {\n const response = await this.collectionClient\n .from(collection)\n .find({ ...queryOptions, page: pageParam, limit: pageSize })\n return response\n },\n initialPageParam: 1,\n getNextPageParam: (lastPage: PayloadFindResponse<CollectionType<T>>) => {\n return lastPage.hasNextPage ? lastPage.nextPage : undefined\n },\n ...options,\n })\n }\n\n // ===== prefetchQuery =====\n async prefetchQuery<T extends TCollection>(\n params: CollectionQueryParams<T>,\n options?: { staleTime?: number },\n ) {\n const { collection, options: queryOptions } = params\n\n return this.queryClient.prefetchQuery({\n queryKey: collectionKeys(collection).list(queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .find(queryOptions)\n },\n ...options,\n })\n }\n\n // ===== prefetchQueryById =====\n async prefetchQueryById<T extends TCollection>(\n params: CollectionDetailQueryParams<T>,\n options?: { staleTime?: number },\n ) {\n const { collection, id, options: queryOptions } = params\n\n return this.queryClient.prefetchQuery({\n queryKey: collectionKeys(collection).detail(id, queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .findById(id, queryOptions)\n },\n ...options,\n })\n }\n\n // ===== prefetchInfiniteQuery =====\n async prefetchInfiniteQuery<T extends TCollection>(\n params: CollectionInfiniteQueryParams<T>,\n options?: { pages?: number; staleTime?: number },\n ) {\n const {\n collection,\n options: queryOptions,\n pageSize = DEFAULT_PAGE_SIZE,\n } = params\n\n return this.queryClient.prefetchInfiniteQuery({\n queryKey: collectionKeys(collection).infinite(queryOptions),\n queryFn: async ({ pageParam }) => {\n const response = await this.collectionClient\n .from(collection)\n .find({ ...queryOptions, page: pageParam, limit: pageSize })\n return response\n },\n initialPageParam: 1,\n getNextPageParam: (lastPage: PayloadFindResponse<CollectionType<T>>) => {\n return lastPage.hasNextPage ? lastPage.nextPage : undefined\n },\n pages: options?.pages ?? 1,\n staleTime: options?.staleTime,\n })\n }\n\n // ===== Mutation Hooks =====\n\n useCreate<T extends TCollection>(\n params: { collection: T },\n options?: MutationCallbacks<PayloadMutationResponse<CollectionType<T>>>,\n ) {\n const { collection } = params\n\n return useMutationOriginal<\n PayloadMutationResponse<CollectionType<T>>,\n SDKError,\n {\n data: Partial<CollectionType<T>>\n file?: File | Blob\n filename?: string\n }\n >({\n mutationFn: async (variables) => {\n return await this.collectionClient\n .from(collection)\n .create(\n variables.data,\n variables.file\n ? { file: variables.file, filename: variables.filename }\n : undefined,\n )\n },\n onSuccess: (data) => {\n this.queryClient.invalidateQueries({\n queryKey: collectionKeys(collection).all,\n })\n if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {\n this.queryClient.invalidateQueries({ queryKey: ['products', 'detail'] })\n }\n options?.onSuccess?.(data)\n },\n onError: options?.onError,\n onSettled: options?.onSettled,\n })\n }\n\n useUpdate<T extends TCollection>(\n params: { collection: T },\n options?: MutationCallbacks<PayloadMutationResponse<CollectionType<T>>>,\n ) {\n const { collection } = params\n\n return useMutationOriginal<\n PayloadMutationResponse<CollectionType<T>>,\n SDKError,\n {\n id: string\n data: Partial<CollectionType<T>>\n file?: File | Blob\n filename?: string\n }\n >({\n mutationFn: async (variables) => {\n return await this.collectionClient\n .from(collection)\n .update(\n variables.id,\n variables.data,\n variables.file\n ? { file: variables.file, filename: variables.filename }\n : undefined,\n )\n },\n onSuccess: (data) => {\n this.queryClient.invalidateQueries({\n queryKey: collectionKeys(collection).all,\n })\n if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {\n this.queryClient.invalidateQueries({ queryKey: ['products', 'detail'] })\n }\n options?.onSuccess?.(data)\n },\n onError: options?.onError,\n onSettled: options?.onSettled,\n })\n }\n\n useRemove<T extends TCollection>(\n params: { collection: T },\n options?: MutationCallbacks<CollectionType<T>>,\n ) {\n const { collection } = params\n\n return useMutationOriginal<CollectionType<T>, SDKError, string>({\n mutationFn: async (id) => {\n return await this.collectionClient.from(collection).remove(id)\n },\n onSuccess: (data) => {\n this.queryClient.invalidateQueries({\n queryKey: collectionKeys(collection).all,\n })\n if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {\n this.queryClient.invalidateQueries({ queryKey: ['products', 'detail'] })\n }\n options?.onSuccess?.(data)\n },\n onError: options?.onError,\n onSettled: options?.onSettled,\n })\n }\n\n // ===== Cache Utilities =====\n\n invalidateQueries<T extends TCollection>(\n collection: T,\n type?: 'list' | 'detail' | 'infinite',\n ) {\n const queryKey = type ? [collection, type] : [collection]\n return this.queryClient.invalidateQueries({ queryKey })\n }\n\n getQueryData<T extends TCollection>(\n collection: T,\n type: 'list',\n options?: ApiQueryOptions,\n ): PayloadFindResponse<CollectionType<T>> | undefined\n getQueryData<T extends TCollection>(\n collection: T,\n type: 'detail',\n id: string,\n options?: ApiQueryOptions,\n ): CollectionType<T> | null | undefined\n getQueryData<T extends TCollection>(\n collection: T,\n type: 'list' | 'detail',\n idOrOptions?: string | ApiQueryOptions,\n options?: ApiQueryOptions,\n ) {\n if (type === 'list') {\n return this.queryClient.getQueryData(\n collectionKeys(collection).list(idOrOptions as ApiQueryOptions),\n )\n }\n return this.queryClient.getQueryData(\n collectionKeys(collection).detail(idOrOptions as string, options),\n )\n }\n\n setQueryData<T extends TCollection>(\n collection: T,\n type: 'list',\n data: PayloadFindResponse<CollectionType<T>>,\n options?: ApiQueryOptions,\n ): void\n setQueryData<T extends TCollection>(\n collection: T,\n type: 'detail',\n id: string,\n data: CollectionType<T> | null,\n options?: ApiQueryOptions,\n ): void\n setQueryData<T extends TCollection>(\n collection: T,\n type: 'list' | 'detail',\n dataOrId: PayloadFindResponse<CollectionType<T>> | string,\n dataOrOptions?: CollectionType<T> | null | ApiQueryOptions,\n options?: ApiQueryOptions,\n ) {\n if (type === 'list') {\n this.queryClient.setQueryData(\n collectionKeys(collection).list(dataOrOptions as ApiQueryOptions),\n dataOrId as PayloadFindResponse<CollectionType<T>>,\n )\n } else {\n this.queryClient.setQueryData(\n collectionKeys(collection).detail(dataOrId as string, options),\n dataOrOptions as CollectionType<T> | null,\n )\n }\n }\n}\n","import {\n QueryClient,\n useQuery as useQueryOriginal,\n useMutation as useMutationOriginal,\n} from '@tanstack/react-query'\nimport type { CustomerAuth } from '../customer/customer-auth'\nimport type {\n CustomerAuthResponse,\n CustomerRefreshResponse,\n CustomerProfile,\n CustomerRegisterData,\n CustomerLoginData,\n UpdateProfileData,\n} from '../customer/types'\nimport { createConfigError, SDKError } from '../internal/errors'\nimport { customerKeys } from './query-keys'\n\n// ============================================================================\n// Mutation helper\n// ============================================================================\n\ninterface MutationCallbacks<TData> {\n onSuccess?: (data: TData) => void\n onError?: (error: SDKError) => void\n onSettled?: () => void\n}\n\nfunction createMutation<TData, TVariables>(\n mutationFn: (variables: TVariables) => Promise<TData>,\n callbacks?: MutationCallbacks<TData>,\n onSuccessExtra?: (data: TData) => void,\n) {\n return useMutationOriginal({\n mutationFn,\n onSuccess: (data) => {\n onSuccessExtra?.(data)\n callbacks?.onSuccess?.(data)\n },\n onError: callbacks?.onError,\n onSettled: callbacks?.onSettled,\n })\n}\n\n// ============================================================================\n// Customer Hooks Mixin\n// ============================================================================\n\nexport class CustomerHooks {\n private queryClient: QueryClient\n private customerAuth?: CustomerAuth\n\n constructor(queryClient: QueryClient, customerAuth?: CustomerAuth) {\n this.queryClient = queryClient\n this.customerAuth = customerAuth\n }\n\n private ensureCustomerAuth(): CustomerAuth {\n if (!this.customerAuth) {\n throw createConfigError(\n 'Customer hooks require Client. Use createClient() instead of createServerClient().',\n )\n }\n return this.customerAuth\n }\n\n private invalidateMe = () => {\n this.queryClient.invalidateQueries({ queryKey: customerKeys.me() })\n }\n\n // ===== useCustomerMe =====\n useCustomerMe(options?: {\n enabled?: boolean\n staleTime?: number\n gcTime?: number\n refetchOnWindowFocus?: boolean\n refetchOnMount?: boolean | 'always'\n refetchInterval?: number | false\n retry?: boolean | number\n }) {\n return useQueryOriginal({\n queryKey: customerKeys.me(),\n queryFn: async () => {\n return await this.ensureCustomerAuth().me()\n },\n ...options,\n enabled:\n (options?.enabled ?? true) && !!this.customerAuth?.isAuthenticated(),\n })\n }\n\n // ===== Mutations =====\n\n useCustomerLogin(options?: MutationCallbacks<CustomerAuthResponse>) {\n return createMutation(\n (data: CustomerLoginData) => this.ensureCustomerAuth().login(data),\n options,\n this.invalidateMe,\n )\n }\n\n useCustomerRegister(\n options?: MutationCallbacks<{ customer: CustomerProfile }>,\n ) {\n return createMutation(\n (data: CustomerRegisterData) => this.ensureCustomerAuth().register(data),\n options,\n )\n }\n\n useCustomerLogout(options?: MutationCallbacks<void>) {\n return useMutationOriginal({\n mutationFn: async () => {\n this.ensureCustomerAuth().logout()\n },\n onSuccess: () => {\n this.queryClient.removeQueries({ queryKey: customerKeys.all })\n options?.onSuccess?.()\n },\n onError: options?.onError,\n onSettled: options?.onSettled,\n })\n }\n\n useCustomerForgotPassword(options?: MutationCallbacks<void>) {\n return createMutation(\n (email: string) =>\n this.ensureCustomerAuth()\n .forgotPassword(email)\n .then(() => {}),\n options,\n )\n }\n\n useCustomerResetPassword(options?: MutationCallbacks<void>) {\n return createMutation(\n (data: { token: string; password: string }) =>\n this.ensureCustomerAuth()\n .resetPassword(data.token, data.password)\n .then(() => {}),\n options,\n )\n }\n\n useCustomerRefreshToken(\n options?: MutationCallbacks<CustomerRefreshResponse>,\n ) {\n return createMutation(\n () => this.ensureCustomerAuth().refreshToken(),\n options,\n this.invalidateMe,\n )\n }\n\n useCustomerUpdateProfile(options?: MutationCallbacks<CustomerProfile>) {\n return createMutation(\n (data: UpdateProfileData) =>\n this.ensureCustomerAuth().updateProfile(data),\n options,\n this.invalidateMe,\n )\n }\n\n useCustomerChangePassword(options?: MutationCallbacks<void>) {\n return createMutation(\n (data: { currentPassword: string; newPassword: string }) =>\n this.ensureCustomerAuth()\n .changePassword(data.currentPassword, data.newPassword)\n .then(() => {}),\n options,\n )\n }\n\n // ===== Customer Cache Utilities =====\n\n invalidateCustomerQueries() {\n return this.queryClient.invalidateQueries({ queryKey: customerKeys.all })\n }\n\n getCustomerData(): CustomerProfile | null | undefined {\n return this.queryClient.getQueryData(customerKeys.me())\n }\n\n setCustomerData(data: CustomerProfile | null) {\n this.queryClient.setQueryData(customerKeys.me(), data)\n }\n}\n","export class SDKError extends Error {\n readonly code: string\n readonly status?: number\n readonly details?: unknown\n readonly userMessage?: string\n readonly suggestion?: string\n readonly requestId?: string\n\n constructor(\n code: string,\n message: string,\n status?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(message)\n this.name = 'SDKError'\n this.code = code\n this.status = status\n this.details = details\n this.userMessage = userMessage\n this.suggestion = suggestion\n this.requestId = requestId\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, new.target)\n }\n }\n\n getUserMessage(): string {\n return this.userMessage || this.message\n }\n\n toJSON() {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n status: this.status,\n details: this.details,\n userMessage: this.userMessage,\n suggestion: this.suggestion,\n ...(this.requestId !== undefined && { requestId: this.requestId }),\n }\n }\n}\n\nexport class NetworkError extends SDKError {\n constructor(\n message: string,\n status?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super('NETWORK_ERROR', message, status, details, userMessage, suggestion)\n this.name = 'NetworkError'\n }\n}\n\nexport class ValidationError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n status = 400,\n ) {\n super('VALIDATION_ERROR', message, status, details, userMessage, suggestion)\n this.name = 'ValidationError'\n }\n}\n\nexport class ApiError extends SDKError {\n constructor(\n message: string,\n status: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(\n 'API_ERROR',\n message,\n status,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n this.name = 'ApiError'\n }\n}\n\nexport class ConfigError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super('CONFIG_ERROR', message, undefined, details, userMessage, suggestion)\n this.name = 'ConfigError'\n }\n}\n\nexport class TimeoutError extends SDKError {\n constructor(\n message = 'Request timed out.',\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super('TIMEOUT_ERROR', message, 408, details, userMessage, suggestion)\n this.name = 'TimeoutError'\n }\n}\n\nexport class GoneError extends SDKError {\n constructor(\n message = 'The requested resource is no longer available.',\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super('GONE_ERROR', message, 410, details, userMessage, suggestion)\n this.name = 'GoneError'\n }\n}\n\nexport class ServiceUnavailableError extends SDKError {\n readonly retryAfter?: number\n\n constructor(\n message = 'Service temporarily unavailable.',\n retryAfter?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super(\n 'SERVICE_UNAVAILABLE_ERROR',\n message,\n 503,\n details,\n userMessage,\n suggestion,\n )\n this.name = 'ServiceUnavailableError'\n this.retryAfter = retryAfter\n }\n}\n\nexport class UsageLimitError extends SDKError {\n readonly usage: { limit: number; current: number; remaining: number }\n\n constructor(\n message: string,\n usage: { limit: number; current: number; remaining: number },\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super('USAGE_LIMIT_ERROR', message, 429, details, userMessage, suggestion)\n this.name = 'UsageLimitError'\n this.usage = usage\n }\n\n toJSON() {\n return {\n ...super.toJSON(),\n usage: this.usage,\n }\n }\n}\n\nexport class AuthError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(\n 'auth_error',\n message,\n 401,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n this.name = 'AuthError'\n }\n}\n\nexport class PermissionError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(\n 'permission_error',\n message,\n 403,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n this.name = 'PermissionError'\n }\n}\n\nexport class NotFoundError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(\n 'not_found',\n message,\n 404,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n this.name = 'NotFoundError'\n }\n}\n\nexport class ConflictError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super('conflict', message, 409, details, userMessage, suggestion, requestId)\n this.name = 'ConflictError'\n }\n}\n\nexport class RateLimitError extends SDKError {\n readonly retryAfter?: number\n\n constructor(\n message: string,\n retryAfter?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(\n 'rate_limit_exceeded',\n message,\n 429,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n this.name = 'RateLimitError'\n this.retryAfter = retryAfter\n }\n}\n\nexport function isSDKError(error: unknown): error is SDKError {\n return error instanceof SDKError\n}\n\nexport function isNetworkError(error: unknown): error is NetworkError {\n return error instanceof NetworkError\n}\n\nexport function isValidationError(error: unknown): error is ValidationError {\n return error instanceof ValidationError\n}\n\nexport function isApiError(error: unknown): error is ApiError {\n return error instanceof ApiError\n}\n\nexport function isConfigError(error: unknown): error is ConfigError {\n return error instanceof ConfigError\n}\n\nexport function isTimeoutError(error: unknown): error is TimeoutError {\n return error instanceof TimeoutError\n}\n\nexport function isGoneError(error: unknown): error is GoneError {\n return error instanceof GoneError\n}\n\nexport function isServiceUnavailableError(\n error: unknown,\n): error is ServiceUnavailableError {\n return error instanceof ServiceUnavailableError\n}\n\nexport function isUsageLimitError(error: unknown): error is UsageLimitError {\n return error instanceof UsageLimitError\n}\n\nexport function isAuthError(error: unknown): error is AuthError {\n return error instanceof AuthError\n}\n\nexport function isPermissionError(error: unknown): error is PermissionError {\n return error instanceof PermissionError\n}\n\nexport function isNotFoundError(error: unknown): error is NotFoundError {\n return error instanceof NotFoundError\n}\n\nexport function isConflictError(error: unknown): error is ConflictError {\n return error instanceof ConflictError\n}\n\nexport function isRateLimitError(error: unknown): error is RateLimitError {\n return error instanceof RateLimitError\n}\n\nexport const createNetworkError = (\n message: string,\n status?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) => new NetworkError(message, status, details, userMessage, suggestion)\n\nexport const createValidationError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n status?: number,\n) => new ValidationError(message, details, userMessage, suggestion, status)\n\nexport const createApiError = (\n message: string,\n status: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) => new ApiError(message, status, details, userMessage, suggestion, requestId)\n\nexport const createConfigError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) => new ConfigError(message, details, userMessage, suggestion)\n\nexport const createTimeoutError = (\n message?: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) => new TimeoutError(message, details, userMessage, suggestion)\n\nexport const createGoneError = (\n message?: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) => new GoneError(message, details, userMessage, suggestion)\n\nexport const createServiceUnavailableError = (\n message?: string,\n retryAfter?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) =>\n new ServiceUnavailableError(\n message,\n retryAfter,\n details,\n userMessage,\n suggestion,\n )\n\nexport const createUsageLimitError = (\n message: string,\n usage: { limit: number; current: number; remaining: number },\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) => new UsageLimitError(message, usage, details, userMessage, suggestion)\n\nexport const createAuthError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) => new AuthError(message, details, userMessage, suggestion, requestId)\n\nexport const createPermissionError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) => new PermissionError(message, details, userMessage, suggestion, requestId)\n\nexport const createNotFoundError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) => new NotFoundError(message, details, userMessage, suggestion, requestId)\n\nexport const createConflictError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) => new ConflictError(message, details, userMessage, suggestion, requestId)\n\nexport const createRateLimitError = (\n message: string,\n retryAfter?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) =>\n new RateLimitError(\n message,\n retryAfter,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n","import {\n QueryClient,\n useInfiniteQuery as useInfiniteQueryOriginal,\n useQuery as useQueryOriginal,\n useSuspenseInfiniteQuery as useSuspenseInfiniteQueryOriginal,\n useSuspenseQuery as useSuspenseQueryOriginal,\n} from '@tanstack/react-query'\nimport type {\n InfiniteData,\n UseInfiniteQueryResult,\n UseQueryResult,\n UseSuspenseInfiniteQueryResult,\n UseSuspenseQueryResult,\n} from '@tanstack/react-query'\nimport type {\n ApiQueryOptions,\n PayloadFindResponse,\n PublicCollection,\n ServerCollection,\n} from '../client/types'\nimport type { CustomerAuth } from '../customer/customer-auth'\nimport type { CollectionClient } from '../collection'\nimport type {\n ProductDetailParams,\n ProductDetailResult,\n ProductListingGroupsCatalogItem,\n ProductListingGroupsItem,\n} from '../api'\nimport {\n CollectionHooks,\n type InfiniteQueryOptions,\n type QueryOptions,\n type SuspenseInfiniteQueryOptions,\n type SuspenseQueryOptions,\n} from './collection-hooks'\nimport { CustomerHooks } from './customer-hooks'\nimport { listingGroupsQueryCatalogUrl } from '../internal/utils/query-string'\nimport { productKeys } from './query-keys'\n\n// Re-export everything from sub-modules for barrel compatibility\nexport { collectionKeys, customerKeys } from './query-keys'\nexport { productKeys } from './query-keys'\nexport type {\n CollectionQueryParams,\n CollectionDetailQueryParams,\n CollectionInfiniteQueryParams,\n QueryOptions,\n SuspenseQueryOptions,\n InfiniteQueryOptions,\n SuspenseInfiniteQueryOptions,\n} from './collection-hooks'\n\nexport type ProductListingGroupsQueryOptions = Pick<\n ApiQueryOptions,\n 'page' | 'limit' | 'sort' | 'where'\n>\n\nexport type ReadOnlyQueryHooks = Omit<\n QueryHooks<PublicCollection>,\n 'useCreate' | 'useUpdate' | 'useRemove'\n>\n\n/**\n * Composes CollectionHooks + CustomerHooks into a single API surface.\n * All methods are delegated; no logic lives here.\n */\ninterface ProductDetailCallable {\n product: {\n detail: (params: ProductDetailParams) => Promise<ProductDetailResult>\n }\n}\n\nconst LISTING_GROUPS_QUERY_PATH = '/api/products/listing-groups/query'\n\nfunction fetchProductListingGroupsQuery(\n collectionClient: CollectionClient,\n queryOptions?: ProductListingGroupsQueryOptions,\n) {\n return collectionClient.requestFindEndpoint<ProductListingGroupsItem>(\n LISTING_GROUPS_QUERY_PATH,\n { options: queryOptions },\n )\n}\n\nfunction fetchProductListingGroupsCatalogQuery(\n collectionClient: CollectionClient,\n queryOptions?: ProductListingGroupsQueryOptions,\n) {\n return collectionClient.requestFindEndpointGet<ProductListingGroupsCatalogItem>(\n listingGroupsQueryCatalogUrl(queryOptions),\n )\n}\n\nexport class QueryHooks<\n TCollection extends ServerCollection = PublicCollection,\n> extends CollectionHooks<TCollection> {\n private _customer: CustomerHooks\n private _commerce?: ProductDetailCallable\n\n constructor(\n queryClient: QueryClient,\n collectionClient: CollectionClient<TCollection>,\n customerAuth?: CustomerAuth,\n commerceClient?: ProductDetailCallable,\n ) {\n super(queryClient, collectionClient)\n this._customer = new CustomerHooks(queryClient, customerAuth)\n this._commerce = commerceClient\n }\n\n // --- Customer hooks delegation ---\n useCustomerMe: CustomerHooks['useCustomerMe'] = (...args) =>\n this._customer.useCustomerMe(...args)\n useCustomerLogin: CustomerHooks['useCustomerLogin'] = (...args) =>\n this._customer.useCustomerLogin(...args)\n useCustomerRegister: CustomerHooks['useCustomerRegister'] = (...args) =>\n this._customer.useCustomerRegister(...args)\n useCustomerLogout: CustomerHooks['useCustomerLogout'] = (...args) =>\n this._customer.useCustomerLogout(...args)\n useCustomerForgotPassword: CustomerHooks['useCustomerForgotPassword'] = (\n ...args\n ) => this._customer.useCustomerForgotPassword(...args)\n useCustomerResetPassword: CustomerHooks['useCustomerResetPassword'] = (\n ...args\n ) => this._customer.useCustomerResetPassword(...args)\n useCustomerRefreshToken: CustomerHooks['useCustomerRefreshToken'] = (\n ...args\n ) => this._customer.useCustomerRefreshToken(...args)\n useCustomerUpdateProfile: CustomerHooks['useCustomerUpdateProfile'] = (\n ...args\n ) => this._customer.useCustomerUpdateProfile(...args)\n useCustomerChangePassword: CustomerHooks['useCustomerChangePassword'] = (\n ...args\n ) => this._customer.useCustomerChangePassword(...args)\n\n // --- Customer cache delegation ---\n invalidateCustomerQueries: CustomerHooks['invalidateCustomerQueries'] = () =>\n this._customer.invalidateCustomerQueries()\n getCustomerData: CustomerHooks['getCustomerData'] = () =>\n this._customer.getCustomerData()\n setCustomerData: CustomerHooks['setCustomerData'] = (data) =>\n this._customer.setCustomerData(data)\n\n useProductListingGroupsQuery<\n TData = PayloadFindResponse<ProductListingGroupsItem>,\n >(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: QueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>,\n ): UseQueryResult<TData> {\n const queryOptions = params.options\n const { placeholderData, ...restOptions } = (options ?? {}) as QueryOptions<\n PayloadFindResponse<ProductListingGroupsItem>,\n TData\n >\n\n return useQueryOriginal({\n queryKey: productKeys.listingGroups(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsQuery(this.collectionClient, queryOptions),\n ...restOptions,\n ...(placeholderData !== undefined && {\n placeholderData: placeholderData as never,\n }),\n })\n }\n\n useProductListingGroupsCatalogQuery<\n TData = PayloadFindResponse<ProductListingGroupsCatalogItem>,\n >(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: QueryOptions<\n PayloadFindResponse<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseQueryResult<TData> {\n const queryOptions = params.options\n const { placeholderData, ...restOptions } = (options ?? {}) as QueryOptions<\n PayloadFindResponse<ProductListingGroupsCatalogItem>,\n TData\n >\n\n return useQueryOriginal({\n queryKey: productKeys.listingGroupsCatalog(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsCatalogQuery(\n this.collectionClient,\n queryOptions,\n ),\n ...restOptions,\n ...(placeholderData !== undefined && {\n placeholderData: placeholderData as never,\n }),\n })\n }\n\n useSuspenseProductListingGroupsQuery<\n TData = PayloadFindResponse<ProductListingGroupsItem>,\n >(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: SuspenseQueryOptions<\n PayloadFindResponse<ProductListingGroupsItem>,\n TData\n >,\n ): UseSuspenseQueryResult<TData> {\n const queryOptions = params.options\n\n return useSuspenseQueryOriginal({\n queryKey: productKeys.listingGroups(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsQuery(this.collectionClient, queryOptions),\n ...options,\n })\n }\n\n useSuspenseProductListingGroupsCatalogQuery<\n TData = PayloadFindResponse<ProductListingGroupsCatalogItem>,\n >(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: SuspenseQueryOptions<\n PayloadFindResponse<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseSuspenseQueryResult<TData> {\n const queryOptions = params.options\n\n return useSuspenseQueryOriginal({\n queryKey: productKeys.listingGroupsCatalog(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsCatalogQuery(\n this.collectionClient,\n queryOptions,\n ),\n ...options,\n })\n }\n\n useInfiniteProductListingGroupsQuery<\n TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>,\n >(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: InfiniteQueryOptions<\n PayloadFindResponse<ProductListingGroupsItem>,\n TData\n >,\n ): UseInfiniteQueryResult<TData> {\n const {\n options: queryOptions,\n pageSize = 20,\n } = params\n\n return useInfiniteQueryOriginal({\n queryKey: productKeys.listingGroupsInfinite(queryOptions),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsCatalogItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n ...options,\n })\n }\n\n useInfiniteProductListingGroupsCatalogQuery<\n TData = InfiniteData<PayloadFindResponse<ProductListingGroupsCatalogItem>>,\n >(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: InfiniteQueryOptions<\n PayloadFindResponse<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseInfiniteQueryResult<TData> {\n const {\n options: queryOptions,\n pageSize = 20,\n } = params\n\n return useInfiniteQueryOriginal({\n queryKey: productKeys.listingGroupsCatalogInfinite(queryOptions),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsCatalogQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsCatalogItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n ...options,\n })\n }\n\n useSuspenseInfiniteProductListingGroupsQuery<\n TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>,\n >(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: SuspenseInfiniteQueryOptions<\n PayloadFindResponse<ProductListingGroupsItem>,\n TData\n >,\n ): UseSuspenseInfiniteQueryResult<TData> {\n const {\n options: queryOptions,\n pageSize = 20,\n } = params\n\n return useSuspenseInfiniteQueryOriginal({\n queryKey: productKeys.listingGroupsInfinite(queryOptions),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n ...options,\n })\n }\n\n useSuspenseInfiniteProductListingGroupsCatalogQuery<\n TData = InfiniteData<PayloadFindResponse<ProductListingGroupsCatalogItem>>,\n >(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: SuspenseInfiniteQueryOptions<\n PayloadFindResponse<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseSuspenseInfiniteQueryResult<TData> {\n const {\n options: queryOptions,\n pageSize = 20,\n } = params\n\n return useSuspenseInfiniteQueryOriginal({\n queryKey: productKeys.listingGroupsCatalogInfinite(queryOptions),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsCatalogQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n ...options,\n })\n }\n\n async prefetchProductListingGroupsQuery(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: { staleTime?: number },\n ) {\n const queryOptions = params.options\n\n return this.queryClient.prefetchQuery({\n queryKey: productKeys.listingGroups(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsQuery(this.collectionClient, queryOptions),\n ...options,\n })\n }\n\n async prefetchProductListingGroupsCatalogQuery(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: { staleTime?: number },\n ) {\n const queryOptions = params.options\n\n return this.queryClient.prefetchQuery({\n queryKey: productKeys.listingGroupsCatalog(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsCatalogQuery(\n this.collectionClient,\n queryOptions,\n ),\n ...options,\n })\n }\n\n async prefetchInfiniteProductListingGroupsQuery(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: { pages?: number; staleTime?: number },\n ) {\n const {\n options: queryOptions,\n pageSize = 20,\n } = params\n\n return this.queryClient.prefetchInfiniteQuery({\n queryKey: productKeys.listingGroupsInfinite(queryOptions),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n pages: options?.pages ?? 1,\n staleTime: options?.staleTime,\n })\n }\n\n async prefetchInfiniteProductListingGroupsCatalogQuery(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: { pages?: number; staleTime?: number },\n ) {\n const {\n options: queryOptions,\n pageSize = 20,\n } = params\n\n return this.queryClient.prefetchInfiniteQuery({\n queryKey: productKeys.listingGroupsCatalogInfinite(queryOptions),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsCatalogQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsCatalogItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n pages: options?.pages ?? 1,\n staleTime: options?.staleTime,\n })\n }\n\n useProductDetail(\n params: { slug: string } | { id: string },\n options?: QueryOptions<ProductDetailResult>,\n ): UseQueryResult<ProductDetailResult> {\n const discriminator = 'slug' in params ? params.slug : params.id\n const { enabled, ...restOptions } = options ?? {}\n const queryEnabled = enabled !== false && Boolean(discriminator)\n\n return useQueryOriginal({\n queryKey: productKeys.detail(params),\n queryFn: () => this._commerce!.product.detail(params),\n enabled: queryEnabled,\n ...restOptions,\n }) as UseQueryResult<ProductDetailResult>\n }\n\n useProductDetailBySlug(\n slug: string,\n options?: QueryOptions<ProductDetailResult>,\n ): UseQueryResult<ProductDetailResult> {\n return this.useProductDetail({ slug }, options)\n }\n\n useProductDetailById(\n id: string,\n options?: QueryOptions<ProductDetailResult>,\n ): UseQueryResult<ProductDetailResult> {\n return this.useProductDetail({ id }, options)\n }\n}\n","export function productDetailQuery(\n params: { slug: string } | { id: string },\n): string {\n const search = new URLSearchParams()\n if ('slug' in params) {\n search.set('slug', params.slug)\n } else {\n search.set('id', params.id)\n }\n return `/api/products/detail?${search}`\n}\n\nexport function productDetailCatalogQuery(\n params: { slug: string } | { id: string },\n): string {\n const search = new URLSearchParams()\n if ('slug' in params) {\n search.set('slug', params.slug)\n } else {\n search.set('id', params.id)\n }\n return `/api/products/detail/catalog?${search}`\n}\n\nexport function listingGroupsQuery(params: { productIds: string[] }): string {\n return `/api/products/listing-groups?ids=${params.productIds.map(encodeURIComponent).join(',')}`\n}\n\nexport function listingGroupsCatalogQuery(params: {\n productIds: string[]\n}): string {\n return `/api/products/listing-groups/catalog?ids=${params.productIds.map(encodeURIComponent).join(',')}`\n}\n\ntype ListingGroupsQueryUrlOptions = {\n page?: number\n limit?: number\n sort?: string | string[]\n where?: Record<string, unknown>\n}\n\nfunction appendListingGroupsQuerySearchParams(\n search: URLSearchParams,\n options?: ListingGroupsQueryUrlOptions,\n): void {\n if (options?.page != null) search.set('page', String(options.page))\n if (options?.limit != null) search.set('limit', String(options.limit))\n if (options?.sort != null) {\n const sort = options.sort\n search.set(\n 'sort',\n Array.isArray(sort) ? sort.join(',') : sort,\n )\n }\n if (options?.where != null) {\n search.set('whereJson', JSON.stringify(options.where))\n }\n}\n\n/** GET cacheable PLP listing-groups query (full variant stock fields). */\nexport function listingGroupsQueryUrl(\n options?: ListingGroupsQueryUrlOptions,\n): string {\n const search = new URLSearchParams()\n appendListingGroupsQuerySearchParams(search, options)\n const query = search.toString()\n return `/api/products/listing-groups/query${query ? `?${query}` : ''}`\n}\n\n/** GET cacheable PLP listing-groups query (catalog / CDN-friendly). */\nexport function listingGroupsQueryCatalogUrl(\n options?: ListingGroupsQueryUrlOptions,\n): string {\n const search = new URLSearchParams()\n appendListingGroupsQuerySearchParams(search, options)\n const query = search.toString()\n return `/api/products/listing-groups/query/catalog${query ? `?${query}` : ''}`\n}\n\nexport function stockSnapshotQuery(params: { variantIds: string[] }): string {\n return `/api/products/stock?variantIds=${params.variantIds.map(encodeURIComponent).join(',')}`\n}\n","/**\n * Fetch-based SSE connection manager for real-time collection change events.\n * Uses fetch + ReadableStream to support custom auth headers (unlike native EventSource).\n */\n\nexport interface RealtimeEvent {\n collection: string\n operation: string\n id: string | null\n timestamp: string\n}\n\nexport type RealtimeListener = (event: RealtimeEvent) => void\n\nconst INITIAL_RECONNECT_DELAY = 1_000\nconst MAX_RECONNECT_DELAY = 30_000\nconst RECONNECT_BACKOFF_FACTOR = 2\nconst MAX_NO_TOKEN_RETRIES = 5\n\nexport class RealtimeConnection {\n private abortController: AbortController | null = null\n private reconnectAttempt = 0\n private noTokenAttempts = 0\n private reconnectTimer: ReturnType<typeof setTimeout> | null = null\n private listeners = new Set<RealtimeListener>()\n private _connected = false\n\n constructor(\n private baseUrl: string,\n private publishableKey: string,\n private getToken: () => string | null,\n private collections?: string[],\n ) {}\n\n get connected(): boolean {\n return this._connected\n }\n\n addListener(fn: RealtimeListener): () => void {\n this.listeners.add(fn)\n return () => this.listeners.delete(fn)\n }\n\n connect(): void {\n if (this.abortController) return // Already connecting/connected\n\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }\n\n disconnect(): void {\n this._connected = false\n if (this.reconnectTimer) {\n clearTimeout(this.reconnectTimer)\n this.reconnectTimer = null\n }\n if (this.abortController) {\n this.abortController.abort()\n this.abortController = null\n }\n this.reconnectAttempt = 0\n this.noTokenAttempts = 0\n }\n\n private async startStream(signal: AbortSignal): Promise<void> {\n const token = this.getToken()\n if (!token) {\n this.noTokenAttempts++\n if (this.noTokenAttempts >= MAX_NO_TOKEN_RETRIES) {\n // Stop reconnecting — no token available after multiple attempts\n this._connected = false\n this.abortController = null\n return\n }\n this.scheduleReconnect()\n return\n }\n this.noTokenAttempts = 0\n\n const params = this.collections?.length\n ? `?collections=${this.collections.join(',')}`\n : ''\n const url = `${this.baseUrl}/api/events/stream${params}`\n\n try {\n const response = await fetch(url, {\n headers: {\n 'X-Publishable-Key': this.publishableKey,\n Authorization: `Bearer ${token}`,\n },\n signal,\n })\n\n if (!response.ok) {\n if (response.status === 401) {\n // Token expired — try reconnecting (will get fresh token)\n this.scheduleReconnect()\n return\n }\n throw new Error(`SSE connection failed: ${response.status}`)\n }\n\n if (!response.body) {\n throw new Error('SSE response has no body')\n }\n\n this._connected = true\n this.reconnectAttempt = 0\n\n await this.readStream(response.body, signal)\n } catch {\n if (signal.aborted) return // Intentional disconnect\n this._connected = false\n this.scheduleReconnect()\n }\n }\n\n private async readStream(\n body: ReadableStream<Uint8Array>,\n signal: AbortSignal,\n ): Promise<void> {\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n let currentEvent = ''\n let currentData = ''\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done || signal.aborted) break\n\n buffer += decoder.decode(value, { stream: true })\n const lines = buffer.split('\\n')\n buffer = lines.pop() ?? '' // Keep incomplete last line in buffer\n\n for (const line of lines) {\n if (line.startsWith('event: ')) {\n currentEvent = line.slice(7)\n } else if (line.startsWith('data: ')) {\n currentData += (currentData ? '\\n' : '') + line.slice(6)\n } else if (line === '') {\n // Empty line = end of event\n if (currentEvent === 'collection:change' && currentData) {\n try {\n const event: RealtimeEvent = JSON.parse(currentData)\n for (const listener of this.listeners) {\n try {\n listener(event)\n } catch {\n // Listener error — ignore\n }\n }\n } catch {\n // Malformed JSON — ignore\n }\n }\n currentEvent = ''\n currentData = ''\n }\n // Ignore comment lines (: heartbeat)\n }\n }\n } catch {\n // Stream read error\n } finally {\n reader.releaseLock()\n this._connected = false\n if (!signal.aborted) {\n this.scheduleReconnect()\n }\n }\n }\n\n private scheduleReconnect(): void {\n if (this.reconnectTimer) return\n\n const delay = Math.min(\n INITIAL_RECONNECT_DELAY *\n Math.pow(RECONNECT_BACKOFF_FACTOR, this.reconnectAttempt),\n MAX_RECONNECT_DELAY,\n )\n this.reconnectAttempt++\n\n this.reconnectTimer = setTimeout(() => {\n this.reconnectTimer = null\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }, delay)\n }\n}\n","import type {\n PublicCollection,\n RootClient,\n RootServerClient,\n ServerCollection,\n} from '../client/types'\nimport type { CollectionClient, ServerCollectionClient } from '../collection'\nimport { QueryHooks, type ReadOnlyQueryHooks } from './query-hooks'\nimport { getQueryClient } from './get-query-client'\nimport type { QueryClient } from '@tanstack/react-query'\n\nfunction createReadOnlyQueryHooksFacade(\n hooks: QueryHooks<PublicCollection>,\n): ReadOnlyQueryHooks {\n return {\n useQuery: hooks.useQuery.bind(hooks),\n useSuspenseQuery: hooks.useSuspenseQuery.bind(hooks),\n useQueryById: hooks.useQueryById.bind(hooks),\n useSuspenseQueryById: hooks.useSuspenseQueryById.bind(hooks),\n useInfiniteQuery: hooks.useInfiniteQuery.bind(hooks),\n useSuspenseInfiniteQuery: hooks.useSuspenseInfiniteQuery.bind(hooks),\n prefetchQuery: hooks.prefetchQuery.bind(hooks),\n prefetchQueryById: hooks.prefetchQueryById.bind(hooks),\n prefetchInfiniteQuery: hooks.prefetchInfiniteQuery.bind(hooks),\n invalidateQueries: hooks.invalidateQueries.bind(hooks),\n getQueryData: hooks.getQueryData.bind(hooks),\n setQueryData: hooks.setQueryData.bind(hooks),\n useCustomerMe: hooks.useCustomerMe.bind(hooks),\n useCustomerLogin: hooks.useCustomerLogin.bind(hooks),\n useCustomerRegister: hooks.useCustomerRegister.bind(hooks),\n useCustomerLogout: hooks.useCustomerLogout.bind(hooks),\n useCustomerForgotPassword: hooks.useCustomerForgotPassword.bind(hooks),\n useCustomerResetPassword: hooks.useCustomerResetPassword.bind(hooks),\n useCustomerRefreshToken: hooks.useCustomerRefreshToken.bind(hooks),\n useCustomerUpdateProfile: hooks.useCustomerUpdateProfile.bind(hooks),\n useCustomerChangePassword: hooks.useCustomerChangePassword.bind(hooks),\n invalidateCustomerQueries: hooks.invalidateCustomerQueries.bind(hooks),\n getCustomerData: hooks.getCustomerData.bind(hooks),\n setCustomerData: hooks.setCustomerData.bind(hooks),\n useProductListingGroupsQuery:\n hooks.useProductListingGroupsQuery.bind(hooks),\n useSuspenseProductListingGroupsQuery:\n hooks.useSuspenseProductListingGroupsQuery.bind(hooks),\n useInfiniteProductListingGroupsQuery:\n hooks.useInfiniteProductListingGroupsQuery.bind(hooks),\n useSuspenseInfiniteProductListingGroupsQuery:\n hooks.useSuspenseInfiniteProductListingGroupsQuery.bind(hooks),\n prefetchProductListingGroupsQuery:\n hooks.prefetchProductListingGroupsQuery.bind(hooks),\n prefetchInfiniteProductListingGroupsQuery:\n hooks.prefetchInfiniteProductListingGroupsQuery.bind(hooks),\n useProductDetail: hooks.useProductDetail.bind(hooks),\n useProductDetailBySlug: hooks.useProductDetailBySlug.bind(hooks),\n useProductDetailById: hooks.useProductDetailById.bind(hooks),\n } as ReadOnlyQueryHooks\n}\n\nexport function createQueryHooks(\n client: RootClient,\n queryClient: QueryClient = getQueryClient(),\n): ReadOnlyQueryHooks {\n const hooks = new QueryHooks<PublicCollection>(\n queryClient,\n client.collections as unknown as CollectionClient<PublicCollection>,\n client.customer.auth,\n client.commerce,\n )\n\n return createReadOnlyQueryHooksFacade(hooks)\n}\n\nexport function createServerQueryHooks(\n client: RootServerClient,\n queryClient: QueryClient = getQueryClient(),\n): QueryHooks<ServerCollection> {\n return new QueryHooks<ServerCollection>(\n queryClient,\n client.collections as ServerCollectionClient,\n undefined,\n client.commerce,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,yBAIO;AAEP,SAAS,kBAAkB;AACzB,SAAO,IAAI,+BAAY;AAAA,IACrB,gBAAgB;AAAA,MACd,SAAS;AAAA;AAAA;AAAA;AAAA,QAIP,WAAW,OAAO;AAAA,QAClB,s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A,IACjE,0BAA0B,MAAM,yBAAyB,KAAK,KAAK;AAAA,IACnE,2BAA2B,MAAM,0BAA0B,KAAK,KAAK;AAAA,IACrE,2BAA2B,MAAM,0BAA0B,KAAK,KAAK;AAAA,IACrE,iBAAiB,MAAM,gBAAgB,KAAK,KAAK;AAAA,IACjD,iBAAiB,MAAM,gBAAgB,KAAK,KAAK;AAAA,IACjD,8BACE,MAAM,6BAA6B,KAAK,KAAK;AAAA,IAC/C,sCACE,MAAM,qCAAqC,KAAK,KAAK;AAAA,IACvD,sCACE,MAAM,qCAAqC,KAAK,KAAK;AAAA,IACvD,8CACE,MAAM,6CAA6C,KAAK,KAAK;AAAA,IAC/D,mCACE,MAAM,kCAAkC,KAAK,KAAK;AAAA,IACpD,2CACE,MAAM,0CAA0C,KAAK,KAAK;AAAA,IAC5D,kBAAkB,MAAM,iBAAiB,KAAK,KAAK;AAAA,IACnD,wBAAwB,MAAM,uBAAuB,KAAK,KAAK;AAAA,IAC/D,sBAAsB,MAAM,qBAAqB,KAAK,KAAK;AAAA,EAC7D;AACF;AAEO,SAAS,iBACd,QACA,cAA2B,eAAe,GACtB;AACpB,QAAM,QAAQ,IAAI;AAAA,IAChB;AAAA,IACA,OAAO;AAAA,IACP,OAAO,SAAS;AAAA,IAChB,OAAO;AAAA,EACT;AAEA,SAAO,+BAA+B,KAAK;AAC7C;AAEO,SAAS,uBACd,QACA,cAA2B,eAAe,GACZ;AAC9B,SAAO,IAAI;AAAA,IACT;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,OAAO;AAAA,EACT;AACF;","names":["import_react_query","useQueryOriginal","useSuspenseQueryOriginal","useInfiniteQueryOriginal","useSuspenseInfiniteQueryOriginal","useMutationOriginal","import_react_query","useMutationOriginal","useQueryOriginal","import_react_query","useQueryOriginal","useSuspenseQueryOriginal","useInfiniteQueryOriginal","useSuspenseInfiniteQueryOriginal"]}
|
|
1
|
+
{"version":3,"sources":["../src/query.ts","../src/core/query/get-query-client.ts","../src/core/query/query-keys.ts","../src/core/query/collection-hooks.ts","../src/core/query/customer-hooks.ts","../src/core/errors.ts","../src/core/query/query-hooks.ts","../src/core/internal/utils/query-string.ts","../src/core/query/realtime.ts","../src/core/query/query-client.ts"],"sourcesContent":["export * from './core/query'\n","import {\n isServer,\n QueryClient,\n defaultShouldDehydrateQuery,\n} from '@tanstack/react-query'\n\nfunction makeQueryClient() {\n return new QueryClient({\n defaultOptions: {\n queries: {\n // Infinite staleTime: server-fetched data persists until explicitly invalidated.\n // For browser clients needing fresher data, override per-query:\n // useQuery({ ..., staleTime: 5 * 60 * 1000 })\n staleTime: Number.POSITIVE_INFINITY,\n refetchOnWindowFocus: false,\n },\n dehydrate: {\n shouldDehydrateQuery: (query) =>\n defaultShouldDehydrateQuery(query) ||\n query.state.status === 'pending',\n shouldRedactErrors: () => false,\n },\n },\n })\n}\n\nlet browserQueryClient: QueryClient | undefined\nlet browserStorefrontQueryClient: QueryClient | undefined\n\n/** Default React Query client (SSR hydration-friendly: infinite staleTime). */\nexport function getQueryClient() {\n if (isServer) {\n return makeQueryClient()\n }\n if (!browserQueryClient) {\n browserQueryClient = makeQueryClient()\n }\n return browserQueryClient\n}\n\nconst STOREFRONT_STALE_TIME_MS = 60_000\n\nfunction makeStorefrontQueryClient() {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STOREFRONT_STALE_TIME_MS,\n refetchOnWindowFocus: false,\n },\n dehydrate: {\n shouldDehydrateQuery: (query) =>\n defaultShouldDehydrateQuery(query) ||\n query.state.status === 'pending',\n shouldRedactErrors: () => false,\n },\n },\n })\n}\n\n/**\n * Browser storefront client: refetches catalog data after ~1 minute instead of\n * keeping SSR data fresh forever. Use with `createQueryHooks(client, queryClient)`.\n */\nexport function getStorefrontQueryClient() {\n if (isServer) {\n return makeStorefrontQueryClient()\n }\n if (!browserStorefrontQueryClient) {\n browserStorefrontQueryClient = makeStorefrontQueryClient()\n }\n return browserStorefrontQueryClient\n}\n","import type { ServerCollection, ApiQueryOptions } from '../client/types'\nimport type { ProductListingPageParams } from '../api'\nimport type { ProductListingGroupsQueryOptions } from './query-hooks'\n\ntype ProductListingPageKeyParams = {\n mode: 'catalog' | 'full'\n page?: number\n limit?: number\n search?: string\n sort?: ProductListingPageParams['sort']\n filters?: NonNullable<ProductListingPageParams['filters']>\n basePath?: string\n trailingSlash?: boolean\n emit?: ProductListingPageParams['emit']\n preferCompleteVariantFromHint?: ProductListingPageParams[\n 'preferCompleteVariantFromHint'\n ]\n}\n\nfunction nonEmpty(values: string[] | undefined): string[] | undefined {\n return values?.length ? values : undefined\n}\n\nfunction canonicalProductListingPageParams(\n params: ProductListingPageParams = {},\n limit?: number,\n): ProductListingPageKeyParams {\n const filters = params.filters\n const canonicalFilters: NonNullable<ProductListingPageParams['filters']> = {}\n const ids = nonEmpty(filters?.ids)\n if (ids) canonicalFilters.ids = ids\n const slugs = nonEmpty(filters?.slugs)\n if (slugs) canonicalFilters.slugs = slugs\n const handles = nonEmpty(filters?.handles)\n if (handles) canonicalFilters.handles = handles\n const categoryIds = nonEmpty(filters?.categoryIds)\n if (categoryIds) canonicalFilters.categoryIds = categoryIds\n const tagIds = nonEmpty(filters?.tagIds)\n if (tagIds) canonicalFilters.tagIds = tagIds\n if (filters?.price?.min != null || filters?.price?.max != null) {\n canonicalFilters.price = {\n ...(filters.price.min != null && { min: filters.price.min }),\n ...(filters.price.max != null && { max: filters.price.max }),\n }\n }\n if (filters?.availableForSale != null) {\n canonicalFilters.availableForSale = filters.availableForSale\n }\n\n const search = params.search?.trim()\n return {\n mode: params.mode ?? 'catalog',\n ...(params.page != null && { page: params.page }),\n ...(limit != null\n ? { limit }\n : params.limit != null\n ? { limit: params.limit }\n : {}),\n ...(search && { search }),\n ...(params.sort != null && { sort: params.sort }),\n ...(Object.keys(canonicalFilters).length > 0 && {\n filters: canonicalFilters,\n }),\n ...(params.basePath != null && { basePath: params.basePath }),\n ...(params.trailingSlash != null && { trailingSlash: params.trailingSlash }),\n ...(params.emit != null && { emit: params.emit }),\n ...(params.preferCompleteVariantFromHint != null && {\n preferCompleteVariantFromHint: params.preferCompleteVariantFromHint,\n }),\n }\n}\n\nexport function collectionKeys<T extends ServerCollection>(collection: T) {\n return {\n all: [collection] as const,\n lists: () => [collection, 'list'] as const,\n list: (options?: ApiQueryOptions) => [collection, 'list', options] as const,\n details: () => [collection, 'detail'] as const,\n detail: (id: string, options?: ApiQueryOptions) =>\n [collection, 'detail', id, options] as const,\n infinites: () => [collection, 'infinite'] as const,\n infinite: (options?: Omit<ApiQueryOptions, 'page'>, pageSize?: number) =>\n [\n collection,\n 'infinite',\n pageSize === undefined ? options : { ...options, limit: pageSize },\n ] as const,\n }\n}\n\nexport const customerKeys = {\n all: ['customer'] as const,\n me: () => ['customer', 'me'] as const,\n}\n\nexport const productKeys = {\n listingGroups: (options?: ProductListingGroupsQueryOptions) =>\n ['products', 'listing-groups', 'list', options] as const,\n listingGroupsCatalog: (options?: ProductListingGroupsQueryOptions) =>\n ['products', 'listing-groups', 'catalog', options] as const,\n listingGroupsInfinite: (\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>,\n pageSize?: number,\n ) =>\n [\n 'products',\n 'listing-groups',\n 'infinite',\n pageSize === undefined ? options : { ...options, limit: pageSize },\n ] as const,\n listingGroupsCatalogInfinite: (\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>,\n pageSize?: number,\n ) =>\n [\n 'products',\n 'listing-groups',\n 'catalog',\n 'infinite',\n pageSize === undefined ? options : { ...options, limit: pageSize },\n ] as const,\n listingPage: (params?: ProductListingPageParams) =>\n ['products', 'listing-page', canonicalProductListingPageParams(params)] as const,\n listingPageInfinite: (\n params?: Omit<ProductListingPageParams, 'page' | 'limit'>,\n pageSize?: number,\n ) =>\n [\n 'products',\n 'listing-page',\n 'infinite',\n canonicalProductListingPageParams(\n params as ProductListingPageParams | undefined,\n pageSize,\n ),\n ] as const,\n detail: (params: { slug: string } | { id: string }) =>\n ['products', 'detail', params] as const,\n detailAll: () => ['products', 'detail'] as const,\n}\n","import {\n QueryClient,\n useQuery as useQueryOriginal,\n useSuspenseQuery as useSuspenseQueryOriginal,\n useInfiniteQuery as useInfiniteQueryOriginal,\n useSuspenseInfiniteQuery as useSuspenseInfiniteQueryOriginal,\n useMutation as useMutationOriginal,\n} from '@tanstack/react-query'\nimport type {\n InfiniteData,\n UseInfiniteQueryResult,\n UseQueryResult,\n UseSuspenseInfiniteQueryResult,\n UseSuspenseQueryResult,\n} from '@tanstack/react-query'\nimport type {\n PublicCollection,\n ServerCollection,\n ApiQueryOptions,\n PublicReadQueryOptions,\n PayloadFindResponse,\n PayloadMutationResponse,\n} from '../client/types'\nimport { type CollectionClient, type CollectionType } from '../collection'\nimport { SDKError } from '../internal/errors'\nimport { collectionKeys } from './query-keys'\n\n// ============================================================================\n// Query Params Types\n// ============================================================================\n\ntype CollectionReadOptions<TCollection extends ServerCollection> =\n [TCollection] extends [PublicCollection]\n ? PublicReadQueryOptions\n : ApiQueryOptions\n\nexport interface CollectionQueryParams<\n T extends ServerCollection,\n Options extends ApiQueryOptions = ApiQueryOptions,\n> {\n collection: T\n options?: Options\n}\n\nexport interface CollectionDetailQueryParams<\n T extends ServerCollection,\n Options extends ApiQueryOptions = ApiQueryOptions,\n> {\n collection: T\n id: string\n options?: Options\n}\n\nexport interface CollectionInfiniteQueryParams<\n T extends ServerCollection,\n Options extends ApiQueryOptions = ApiQueryOptions,\n> {\n collection: T\n options?: Omit<Options, 'page'>\n pageSize?: number\n}\n\n// ============================================================================\n// Shared option types\n// ============================================================================\n\nexport interface QueryOptions<TQueryFnData = unknown, TData = TQueryFnData> {\n enabled?: boolean\n staleTime?: number\n gcTime?: number\n refetchOnWindowFocus?: boolean\n refetchOnMount?: boolean | 'always'\n refetchInterval?: number | false\n retry?: boolean | number\n select?: (data: TQueryFnData) => TData\n placeholderData?:\n | TQueryFnData\n | ((previousData: TData | undefined) => TQueryFnData | undefined)\n initialData?: TQueryFnData | (() => TQueryFnData)\n initialDataUpdatedAt?: number | (() => number | undefined)\n}\n\nexport type SuspenseQueryOptions<\n TQueryFnData = unknown,\n TData = TQueryFnData,\n> = Omit<QueryOptions<TQueryFnData, TData>, 'enabled' | 'placeholderData'>\n\n// placeholderData/initialData omitted: InfiniteData<T> structure is complex to construct\nexport interface InfiniteQueryOptions<\n TQueryFnData = unknown,\n TData = InfiniteData<TQueryFnData>,\n> {\n enabled?: boolean\n staleTime?: number\n gcTime?: number\n refetchOnWindowFocus?: boolean\n refetchOnMount?: boolean | 'always'\n refetchInterval?: number | false\n retry?: boolean | number\n select?: (data: InfiniteData<TQueryFnData>) => TData\n}\n\nexport type SuspenseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TData = InfiniteData<TQueryFnData>,\n> = Omit<InfiniteQueryOptions<TQueryFnData, TData>, 'enabled'>\n\ninterface MutationCallbacks<TData> {\n onSuccess?: (data: TData) => void\n onError?: (error: SDKError) => void\n onSettled?: () => void\n}\n\n// ============================================================================\n// Product detail invalidation\n// ============================================================================\n\nconst PRODUCT_DETAIL_INVALIDATING_COLLECTIONS = new Set([\n 'products',\n 'product-variants',\n 'product-options',\n 'product-option-values',\n 'product-categories',\n 'product-tags',\n 'product-collections',\n 'brands',\n 'brand-logos',\n 'images',\n])\n\n// ============================================================================\n// Collection Hooks Mixin\n// ============================================================================\n\nconst DEFAULT_PAGE_SIZE = 20\n\nexport class CollectionHooks<TCollection extends ServerCollection = PublicCollection> {\n protected queryClient: QueryClient\n protected collectionClient: CollectionClient<TCollection>\n\n constructor(\n queryClient: QueryClient,\n collectionClient: CollectionClient<TCollection>,\n ) {\n this.queryClient = queryClient\n this.collectionClient = collectionClient\n }\n\n // ===== useQuery =====\n useQuery<\n T extends TCollection,\n TData = PayloadFindResponse<CollectionType<T>>,\n >(\n params: CollectionQueryParams<T, CollectionReadOptions<TCollection>>,\n options?: QueryOptions<PayloadFindResponse<CollectionType<T>>, TData>,\n ): UseQueryResult<TData> {\n const { collection, options: queryOptions } = params\n const { placeholderData, ...restOptions } = (options ?? {}) as QueryOptions<\n PayloadFindResponse<CollectionType<T>>,\n TData\n >\n\n return useQueryOriginal({\n queryKey: collectionKeys(collection).list(queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .find(queryOptions)\n },\n ...restOptions,\n // NonFunctionGuard<T> incompatible with generic union types — safe cast\n ...(placeholderData !== undefined && {\n placeholderData: placeholderData as never,\n }),\n })\n }\n\n // ===== useSuspenseQuery =====\n useSuspenseQuery<\n T extends TCollection,\n TData = PayloadFindResponse<CollectionType<T>>,\n >(\n params: CollectionQueryParams<T, CollectionReadOptions<TCollection>>,\n options?: SuspenseQueryOptions<\n PayloadFindResponse<CollectionType<T>>,\n TData\n >,\n ): UseSuspenseQueryResult<TData> {\n const { collection, options: queryOptions } = params\n\n return useSuspenseQueryOriginal({\n queryKey: collectionKeys(collection).list(queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .find(queryOptions)\n },\n ...options,\n })\n }\n\n // ===== useQueryById =====\n useQueryById<T extends TCollection, TData = CollectionType<T>>(\n params: CollectionDetailQueryParams<T, CollectionReadOptions<TCollection>>,\n options?: QueryOptions<CollectionType<T>, TData>,\n ): UseQueryResult<TData> {\n const { collection, id, options: queryOptions } = params\n const { placeholderData, ...restOptions } = (options ?? {}) as QueryOptions<\n CollectionType<T>,\n TData\n >\n\n return useQueryOriginal({\n queryKey: collectionKeys(collection).detail(id, queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .findById(id, queryOptions)\n },\n ...restOptions,\n // NonFunctionGuard<T> incompatible with generic union types — safe cast\n ...(placeholderData !== undefined && {\n placeholderData: placeholderData as never,\n }),\n })\n }\n\n // ===== useSuspenseQueryById =====\n useSuspenseQueryById<T extends TCollection, TData = CollectionType<T>>(\n params: CollectionDetailQueryParams<T, CollectionReadOptions<TCollection>>,\n options?: SuspenseQueryOptions<CollectionType<T>, TData>,\n ): UseSuspenseQueryResult<TData> {\n const { collection, id, options: queryOptions } = params\n\n return useSuspenseQueryOriginal({\n queryKey: collectionKeys(collection).detail(id, queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .findById(id, queryOptions)\n },\n ...options,\n })\n }\n\n // ===== useInfiniteQuery =====\n useInfiniteQuery<\n T extends TCollection,\n TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>,\n >(\n params: CollectionInfiniteQueryParams<\n T,\n CollectionReadOptions<TCollection>\n >,\n options?: InfiniteQueryOptions<\n PayloadFindResponse<CollectionType<T>>,\n TData\n >,\n ): UseInfiniteQueryResult<TData> {\n const { collection, options: queryOptions } = params\n const explicitPageSize = params.pageSize\n const pageSize = explicitPageSize ?? DEFAULT_PAGE_SIZE\n\n return useInfiniteQueryOriginal({\n queryKey: collectionKeys(collection).infinite(\n queryOptions,\n explicitPageSize,\n ),\n queryFn: async ({ pageParam }) => {\n const response = await this.collectionClient\n .from(collection)\n .find({ ...queryOptions, page: pageParam, limit: pageSize })\n return response\n },\n initialPageParam: 1,\n getNextPageParam: (lastPage: PayloadFindResponse<CollectionType<T>>) => {\n return lastPage.hasNextPage ? lastPage.nextPage : undefined\n },\n ...options,\n })\n }\n\n // ===== useSuspenseInfiniteQuery =====\n useSuspenseInfiniteQuery<\n T extends TCollection,\n TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>,\n >(\n params: CollectionInfiniteQueryParams<\n T,\n CollectionReadOptions<TCollection>\n >,\n options?: SuspenseInfiniteQueryOptions<\n PayloadFindResponse<CollectionType<T>>,\n TData\n >,\n ): UseSuspenseInfiniteQueryResult<TData> {\n const { collection, options: queryOptions } = params\n const explicitPageSize = params.pageSize\n const pageSize = explicitPageSize ?? DEFAULT_PAGE_SIZE\n\n return useSuspenseInfiniteQueryOriginal({\n queryKey: collectionKeys(collection).infinite(\n queryOptions,\n explicitPageSize,\n ),\n queryFn: async ({ pageParam }) => {\n const response = await this.collectionClient\n .from(collection)\n .find({ ...queryOptions, page: pageParam, limit: pageSize })\n return response\n },\n initialPageParam: 1,\n getNextPageParam: (lastPage: PayloadFindResponse<CollectionType<T>>) => {\n return lastPage.hasNextPage ? lastPage.nextPage : undefined\n },\n ...options,\n })\n }\n\n // ===== prefetchQuery =====\n async prefetchQuery<T extends TCollection>(\n params: CollectionQueryParams<T, CollectionReadOptions<TCollection>>,\n options?: { staleTime?: number },\n ) {\n const { collection, options: queryOptions } = params\n\n return this.queryClient.prefetchQuery({\n queryKey: collectionKeys(collection).list(queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .find(queryOptions)\n },\n ...options,\n })\n }\n\n // ===== prefetchQueryById =====\n async prefetchQueryById<T extends TCollection>(\n params: CollectionDetailQueryParams<\n T,\n CollectionReadOptions<TCollection>\n >,\n options?: { staleTime?: number },\n ) {\n const { collection, id, options: queryOptions } = params\n\n return this.queryClient.prefetchQuery({\n queryKey: collectionKeys(collection).detail(id, queryOptions),\n queryFn: async () => {\n return await this.collectionClient\n .from(collection)\n .findById(id, queryOptions)\n },\n ...options,\n })\n }\n\n // ===== prefetchInfiniteQuery =====\n async prefetchInfiniteQuery<T extends TCollection>(\n params: CollectionInfiniteQueryParams<\n T,\n CollectionReadOptions<TCollection>\n >,\n options?: { pages?: number; staleTime?: number },\n ) {\n const { collection, options: queryOptions } = params\n const explicitPageSize = params.pageSize\n const pageSize = explicitPageSize ?? DEFAULT_PAGE_SIZE\n\n return this.queryClient.prefetchInfiniteQuery({\n queryKey: collectionKeys(collection).infinite(\n queryOptions,\n explicitPageSize,\n ),\n queryFn: async ({ pageParam }) => {\n const response = await this.collectionClient\n .from(collection)\n .find({ ...queryOptions, page: pageParam, limit: pageSize })\n return response\n },\n initialPageParam: 1,\n getNextPageParam: (lastPage: PayloadFindResponse<CollectionType<T>>) => {\n return lastPage.hasNextPage ? lastPage.nextPage : undefined\n },\n pages: options?.pages ?? 1,\n staleTime: options?.staleTime,\n })\n }\n\n // ===== Mutation Hooks =====\n\n useCreate<T extends TCollection>(\n params: { collection: T },\n options?: MutationCallbacks<PayloadMutationResponse<CollectionType<T>>>,\n ) {\n const { collection } = params\n\n return useMutationOriginal<\n PayloadMutationResponse<CollectionType<T>>,\n SDKError,\n {\n data: Partial<CollectionType<T>>\n file?: File | Blob\n filename?: string\n }\n >({\n mutationFn: async (variables) => {\n return await this.collectionClient\n .from(collection)\n .create(\n variables.data,\n variables.file\n ? { file: variables.file, filename: variables.filename }\n : undefined,\n )\n },\n onSuccess: (data) => {\n this.queryClient.invalidateQueries({\n queryKey: collectionKeys(collection).all,\n })\n if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {\n this.queryClient.invalidateQueries({ queryKey: ['products', 'detail'] })\n }\n options?.onSuccess?.(data)\n },\n onError: options?.onError,\n onSettled: options?.onSettled,\n })\n }\n\n useUpdate<T extends TCollection>(\n params: { collection: T },\n options?: MutationCallbacks<PayloadMutationResponse<CollectionType<T>>>,\n ) {\n const { collection } = params\n\n return useMutationOriginal<\n PayloadMutationResponse<CollectionType<T>>,\n SDKError,\n {\n id: string\n data: Partial<CollectionType<T>>\n file?: File | Blob\n filename?: string\n }\n >({\n mutationFn: async (variables) => {\n return await this.collectionClient\n .from(collection)\n .update(\n variables.id,\n variables.data,\n variables.file\n ? { file: variables.file, filename: variables.filename }\n : undefined,\n )\n },\n onSuccess: (data) => {\n this.queryClient.invalidateQueries({\n queryKey: collectionKeys(collection).all,\n })\n if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {\n this.queryClient.invalidateQueries({ queryKey: ['products', 'detail'] })\n }\n options?.onSuccess?.(data)\n },\n onError: options?.onError,\n onSettled: options?.onSettled,\n })\n }\n\n useRemove<T extends TCollection>(\n params: { collection: T },\n options?: MutationCallbacks<CollectionType<T>>,\n ) {\n const { collection } = params\n\n return useMutationOriginal<CollectionType<T>, SDKError, string>({\n mutationFn: async (id) => {\n return await this.collectionClient.from(collection).remove(id)\n },\n onSuccess: (data) => {\n this.queryClient.invalidateQueries({\n queryKey: collectionKeys(collection).all,\n })\n if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {\n this.queryClient.invalidateQueries({ queryKey: ['products', 'detail'] })\n }\n options?.onSuccess?.(data)\n },\n onError: options?.onError,\n onSettled: options?.onSettled,\n })\n }\n\n // ===== Cache Utilities =====\n\n invalidateQueries<T extends TCollection>(\n collection: T,\n type?: 'list' | 'detail' | 'infinite',\n ) {\n const queryKey = type ? [collection, type] : [collection]\n return this.queryClient.invalidateQueries({ queryKey })\n }\n\n getQueryData<T extends TCollection>(\n collection: T,\n type: 'list',\n options?: ApiQueryOptions,\n ): PayloadFindResponse<CollectionType<T>> | undefined\n getQueryData<T extends TCollection>(\n collection: T,\n type: 'detail',\n id: string,\n options?: ApiQueryOptions,\n ): CollectionType<T> | null | undefined\n getQueryData<T extends TCollection>(\n collection: T,\n type: 'list' | 'detail',\n idOrOptions?: string | ApiQueryOptions,\n options?: ApiQueryOptions,\n ) {\n if (type === 'list') {\n return this.queryClient.getQueryData(\n collectionKeys(collection).list(idOrOptions as ApiQueryOptions),\n )\n }\n return this.queryClient.getQueryData(\n collectionKeys(collection).detail(idOrOptions as string, options),\n )\n }\n\n setQueryData<T extends TCollection>(\n collection: T,\n type: 'list',\n data: PayloadFindResponse<CollectionType<T>>,\n options?: ApiQueryOptions,\n ): void\n setQueryData<T extends TCollection>(\n collection: T,\n type: 'detail',\n id: string,\n data: CollectionType<T> | null,\n options?: ApiQueryOptions,\n ): void\n setQueryData<T extends TCollection>(\n collection: T,\n type: 'list' | 'detail',\n dataOrId: PayloadFindResponse<CollectionType<T>> | string,\n dataOrOptions?: CollectionType<T> | null | ApiQueryOptions,\n options?: ApiQueryOptions,\n ) {\n if (type === 'list') {\n this.queryClient.setQueryData(\n collectionKeys(collection).list(dataOrOptions as ApiQueryOptions),\n dataOrId as PayloadFindResponse<CollectionType<T>>,\n )\n } else {\n this.queryClient.setQueryData(\n collectionKeys(collection).detail(dataOrId as string, options),\n dataOrOptions as CollectionType<T> | null,\n )\n }\n }\n}\n","import {\n QueryClient,\n useQuery as useQueryOriginal,\n useMutation as useMutationOriginal,\n} from '@tanstack/react-query'\nimport type { CustomerAuth } from '../customer/customer-auth'\nimport type {\n CustomerAuthResponse,\n CustomerRefreshResponse,\n CustomerProfile,\n CustomerRegisterData,\n CustomerLoginData,\n UpdateProfileData,\n} from '../customer/types'\nimport { createConfigError, SDKError } from '../internal/errors'\nimport { customerKeys } from './query-keys'\n\n// ============================================================================\n// Mutation helper\n// ============================================================================\n\ninterface MutationCallbacks<TData> {\n onSuccess?: (data: TData) => void\n onError?: (error: SDKError) => void\n onSettled?: () => void\n}\n\nfunction createMutation<TData, TVariables>(\n mutationFn: (variables: TVariables) => Promise<TData>,\n callbacks?: MutationCallbacks<TData>,\n onSuccessExtra?: (data: TData) => void,\n) {\n return useMutationOriginal({\n mutationFn,\n onSuccess: (data) => {\n onSuccessExtra?.(data)\n callbacks?.onSuccess?.(data)\n },\n onError: callbacks?.onError,\n onSettled: callbacks?.onSettled,\n })\n}\n\n// ============================================================================\n// Customer Hooks Mixin\n// ============================================================================\n\nexport class CustomerHooks {\n private queryClient: QueryClient\n private customerAuth?: CustomerAuth\n\n constructor(queryClient: QueryClient, customerAuth?: CustomerAuth) {\n this.queryClient = queryClient\n this.customerAuth = customerAuth\n }\n\n private ensureCustomerAuth(): CustomerAuth {\n if (!this.customerAuth) {\n throw createConfigError(\n 'Customer hooks require Client. Use createClient() instead of createServerClient().',\n )\n }\n return this.customerAuth\n }\n\n private invalidateMe = () => {\n this.queryClient.invalidateQueries({ queryKey: customerKeys.me() })\n }\n\n // ===== useCustomerMe =====\n useCustomerMe(options?: {\n enabled?: boolean\n staleTime?: number\n gcTime?: number\n refetchOnWindowFocus?: boolean\n refetchOnMount?: boolean | 'always'\n refetchInterval?: number | false\n retry?: boolean | number\n }) {\n return useQueryOriginal({\n queryKey: customerKeys.me(),\n queryFn: async () => {\n return await this.ensureCustomerAuth().me()\n },\n ...options,\n enabled:\n (options?.enabled ?? true) && !!this.customerAuth?.isAuthenticated(),\n })\n }\n\n // ===== Mutations =====\n\n useCustomerLogin(options?: MutationCallbacks<CustomerAuthResponse>) {\n return createMutation(\n (data: CustomerLoginData) => this.ensureCustomerAuth().login(data),\n options,\n this.invalidateMe,\n )\n }\n\n useCustomerRegister(\n options?: MutationCallbacks<{ customer: CustomerProfile }>,\n ) {\n return createMutation(\n (data: CustomerRegisterData) => this.ensureCustomerAuth().register(data),\n options,\n )\n }\n\n useCustomerLogout(options?: MutationCallbacks<void>) {\n return useMutationOriginal({\n mutationFn: async () => {\n this.ensureCustomerAuth().logout()\n },\n onSuccess: () => {\n this.queryClient.removeQueries({ queryKey: customerKeys.all })\n options?.onSuccess?.()\n },\n onError: options?.onError,\n onSettled: options?.onSettled,\n })\n }\n\n useCustomerForgotPassword(options?: MutationCallbacks<void>) {\n return createMutation(\n (email: string) =>\n this.ensureCustomerAuth()\n .forgotPassword(email)\n .then(() => {}),\n options,\n )\n }\n\n useCustomerResetPassword(options?: MutationCallbacks<void>) {\n return createMutation(\n (data: { token: string; password: string }) =>\n this.ensureCustomerAuth()\n .resetPassword(data.token, data.password)\n .then(() => {}),\n options,\n )\n }\n\n useCustomerRefreshToken(\n options?: MutationCallbacks<CustomerRefreshResponse>,\n ) {\n return createMutation(\n () => this.ensureCustomerAuth().refreshToken(),\n options,\n this.invalidateMe,\n )\n }\n\n useCustomerUpdateProfile(options?: MutationCallbacks<CustomerProfile>) {\n return createMutation(\n (data: UpdateProfileData) =>\n this.ensureCustomerAuth().updateProfile(data),\n options,\n this.invalidateMe,\n )\n }\n\n useCustomerChangePassword(options?: MutationCallbacks<void>) {\n return createMutation(\n (data: { currentPassword: string; newPassword: string }) =>\n this.ensureCustomerAuth()\n .changePassword(data.currentPassword, data.newPassword)\n .then(() => {}),\n options,\n )\n }\n\n // ===== Customer Cache Utilities =====\n\n invalidateCustomerQueries() {\n return this.queryClient.invalidateQueries({ queryKey: customerKeys.all })\n }\n\n getCustomerData(): CustomerProfile | null | undefined {\n return this.queryClient.getQueryData(customerKeys.me())\n }\n\n setCustomerData(data: CustomerProfile | null) {\n this.queryClient.setQueryData(customerKeys.me(), data)\n }\n}\n","export class SDKError extends Error {\n readonly code: string\n readonly status?: number\n readonly details?: unknown\n readonly userMessage?: string\n readonly suggestion?: string\n readonly requestId?: string\n\n constructor(\n code: string,\n message: string,\n status?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(message)\n this.name = 'SDKError'\n this.code = code\n this.status = status\n this.details = details\n this.userMessage = userMessage\n this.suggestion = suggestion\n this.requestId = requestId\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, new.target)\n }\n }\n\n getUserMessage(): string {\n return this.userMessage || this.message\n }\n\n toJSON() {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n status: this.status,\n details: this.details,\n userMessage: this.userMessage,\n suggestion: this.suggestion,\n ...(this.requestId !== undefined && { requestId: this.requestId }),\n }\n }\n}\n\nexport class NetworkError extends SDKError {\n constructor(\n message: string,\n status?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super('NETWORK_ERROR', message, status, details, userMessage, suggestion)\n this.name = 'NetworkError'\n }\n}\n\nexport class ValidationError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n status = 400,\n ) {\n super('VALIDATION_ERROR', message, status, details, userMessage, suggestion)\n this.name = 'ValidationError'\n }\n}\n\nexport class ApiError extends SDKError {\n constructor(\n message: string,\n status: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(\n 'API_ERROR',\n message,\n status,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n this.name = 'ApiError'\n }\n}\n\nexport class ConfigError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super('CONFIG_ERROR', message, undefined, details, userMessage, suggestion)\n this.name = 'ConfigError'\n }\n}\n\nexport class TimeoutError extends SDKError {\n constructor(\n message = 'Request timed out.',\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super('TIMEOUT_ERROR', message, 408, details, userMessage, suggestion)\n this.name = 'TimeoutError'\n }\n}\n\nexport class GoneError extends SDKError {\n constructor(\n message = 'The requested resource is no longer available.',\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super('GONE_ERROR', message, 410, details, userMessage, suggestion)\n this.name = 'GoneError'\n }\n}\n\nexport class ServiceUnavailableError extends SDKError {\n readonly retryAfter?: number\n\n constructor(\n message = 'Service temporarily unavailable.',\n retryAfter?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super(\n 'SERVICE_UNAVAILABLE_ERROR',\n message,\n 503,\n details,\n userMessage,\n suggestion,\n )\n this.name = 'ServiceUnavailableError'\n this.retryAfter = retryAfter\n }\n}\n\nexport class UsageLimitError extends SDKError {\n readonly usage: { limit: number; current: number; remaining: number }\n\n constructor(\n message: string,\n usage: { limit: number; current: number; remaining: number },\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n ) {\n super('USAGE_LIMIT_ERROR', message, 429, details, userMessage, suggestion)\n this.name = 'UsageLimitError'\n this.usage = usage\n }\n\n toJSON() {\n return {\n ...super.toJSON(),\n usage: this.usage,\n }\n }\n}\n\nexport class AuthError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(\n 'auth_error',\n message,\n 401,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n this.name = 'AuthError'\n }\n}\n\nexport class PermissionError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(\n 'permission_error',\n message,\n 403,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n this.name = 'PermissionError'\n }\n}\n\nexport class NotFoundError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(\n 'not_found',\n message,\n 404,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n this.name = 'NotFoundError'\n }\n}\n\nexport class ConflictError extends SDKError {\n constructor(\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super('conflict', message, 409, details, userMessage, suggestion, requestId)\n this.name = 'ConflictError'\n }\n}\n\nexport class RateLimitError extends SDKError {\n readonly retryAfter?: number\n\n constructor(\n message: string,\n retryAfter?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n ) {\n super(\n 'rate_limit_exceeded',\n message,\n 429,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n this.name = 'RateLimitError'\n this.retryAfter = retryAfter\n }\n}\n\nexport function isSDKError(error: unknown): error is SDKError {\n return error instanceof SDKError\n}\n\nexport function isNetworkError(error: unknown): error is NetworkError {\n return error instanceof NetworkError\n}\n\nexport function isValidationError(error: unknown): error is ValidationError {\n if (error instanceof ValidationError) return true\n if (error == null || typeof error !== 'object') return false\n\n const candidate = error as {\n code?: unknown\n name?: unknown\n message?: unknown\n getUserMessage?: unknown\n toJSON?: unknown\n }\n return (\n candidate.name === 'ValidationError' &&\n candidate.code === 'VALIDATION_ERROR' &&\n typeof candidate.message === 'string' &&\n typeof candidate.getUserMessage === 'function' &&\n typeof candidate.toJSON === 'function'\n )\n}\n\nexport function isApiError(error: unknown): error is ApiError {\n return error instanceof ApiError\n}\n\nexport function isConfigError(error: unknown): error is ConfigError {\n return error instanceof ConfigError\n}\n\nexport function isTimeoutError(error: unknown): error is TimeoutError {\n return error instanceof TimeoutError\n}\n\nexport function isGoneError(error: unknown): error is GoneError {\n return error instanceof GoneError\n}\n\nexport function isServiceUnavailableError(\n error: unknown,\n): error is ServiceUnavailableError {\n return error instanceof ServiceUnavailableError\n}\n\nexport function isUsageLimitError(error: unknown): error is UsageLimitError {\n return error instanceof UsageLimitError\n}\n\nexport function isAuthError(error: unknown): error is AuthError {\n return error instanceof AuthError\n}\n\nexport function isPermissionError(error: unknown): error is PermissionError {\n return error instanceof PermissionError\n}\n\nexport function isNotFoundError(error: unknown): error is NotFoundError {\n return error instanceof NotFoundError\n}\n\nexport function isConflictError(error: unknown): error is ConflictError {\n return error instanceof ConflictError\n}\n\nexport function isRateLimitError(error: unknown): error is RateLimitError {\n return error instanceof RateLimitError\n}\n\nexport const createNetworkError = (\n message: string,\n status?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) => new NetworkError(message, status, details, userMessage, suggestion)\n\nexport const createValidationError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n status?: number,\n) => new ValidationError(message, details, userMessage, suggestion, status)\n\nexport const createApiError = (\n message: string,\n status: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) => new ApiError(message, status, details, userMessage, suggestion, requestId)\n\nexport const createConfigError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) => new ConfigError(message, details, userMessage, suggestion)\n\nexport const createTimeoutError = (\n message?: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) => new TimeoutError(message, details, userMessage, suggestion)\n\nexport const createGoneError = (\n message?: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) => new GoneError(message, details, userMessage, suggestion)\n\nexport const createServiceUnavailableError = (\n message?: string,\n retryAfter?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) =>\n new ServiceUnavailableError(\n message,\n retryAfter,\n details,\n userMessage,\n suggestion,\n )\n\nexport const createUsageLimitError = (\n message: string,\n usage: { limit: number; current: number; remaining: number },\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n) => new UsageLimitError(message, usage, details, userMessage, suggestion)\n\nexport const createAuthError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) => new AuthError(message, details, userMessage, suggestion, requestId)\n\nexport const createPermissionError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) => new PermissionError(message, details, userMessage, suggestion, requestId)\n\nexport const createNotFoundError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) => new NotFoundError(message, details, userMessage, suggestion, requestId)\n\nexport const createConflictError = (\n message: string,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) => new ConflictError(message, details, userMessage, suggestion, requestId)\n\nexport const createRateLimitError = (\n message: string,\n retryAfter?: number,\n details?: unknown,\n userMessage?: string,\n suggestion?: string,\n requestId?: string,\n) =>\n new RateLimitError(\n message,\n retryAfter,\n details,\n userMessage,\n suggestion,\n requestId,\n )\n","import {\n QueryClient,\n useInfiniteQuery as useInfiniteQueryOriginal,\n useQuery as useQueryOriginal,\n useSuspenseInfiniteQuery as useSuspenseInfiniteQueryOriginal,\n useSuspenseQuery as useSuspenseQueryOriginal,\n} from '@tanstack/react-query'\nimport type {\n InfiniteData,\n UseInfiniteQueryResult,\n UseQueryResult,\n UseSuspenseInfiniteQueryResult,\n UseSuspenseQueryResult,\n} from '@tanstack/react-query'\nimport type {\n ApiQueryOptions,\n PayloadFindResponse,\n PublicCollection,\n ServerCollection,\n} from '../client/types'\nimport type { CustomerAuth } from '../customer/customer-auth'\nimport type { CollectionClient } from '../collection'\nimport type {\n ProductDetailParams,\n ProductDetailResult,\n ProductListingGroupsCatalogItem,\n ProductListingGroupsItem,\n ProductListingPageBaseParams,\n ProductListingPageCatalogParams,\n ProductListingPageFullParams,\n ProductListingPageParams,\n ProductListingPageResult,\n} from '../api'\nimport {\n CollectionHooks,\n type InfiniteQueryOptions,\n type QueryOptions,\n type SuspenseInfiniteQueryOptions,\n type SuspenseQueryOptions,\n} from './collection-hooks'\nimport { CustomerHooks } from './customer-hooks'\nimport { createConfigError } from '../internal/errors'\nimport { listingGroupsQueryCatalogUrl } from '../internal/utils/query-string'\nimport { productKeys } from './query-keys'\n\n// Re-export everything from sub-modules for barrel compatibility\nexport { collectionKeys, customerKeys } from './query-keys'\nexport { productKeys } from './query-keys'\nexport type {\n CollectionQueryParams,\n CollectionDetailQueryParams,\n CollectionInfiniteQueryParams,\n QueryOptions,\n SuspenseQueryOptions,\n InfiniteQueryOptions,\n SuspenseInfiniteQueryOptions,\n} from './collection-hooks'\n\nexport type ProductListingGroupsQueryOptions = Pick<\n ApiQueryOptions,\n 'page' | 'limit' | 'sort' | 'where'\n>\n\nexport type ReadOnlyQueryHooks = Omit<\n QueryHooks<PublicCollection>,\n | 'useCreate'\n | 'useUpdate'\n | 'useRemove'\n | 'useProductListingGroupsQuery'\n | 'useSuspenseProductListingGroupsQuery'\n | 'useInfiniteProductListingGroupsQuery'\n | 'useSuspenseInfiniteProductListingGroupsQuery'\n | 'prefetchProductListingGroupsQuery'\n | 'prefetchInfiniteProductListingGroupsQuery'\n | 'useProductListingPage'\n | 'useSuspenseProductListingPage'\n | 'useInfiniteProductListingPage'\n | 'prefetchProductListingPage'\n | 'prefetchInfiniteProductListingPage'\n> & {\n useProductListingPage<\n TData = ProductListingPageResult<ProductListingGroupsCatalogItem>,\n >(\n params?: ProductListingPageCatalogParams,\n options?: QueryOptions<\n ProductListingPageResult<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseQueryResult<TData>\n useSuspenseProductListingPage<\n TData = ProductListingPageResult<ProductListingGroupsCatalogItem>,\n >(\n params?: ProductListingPageCatalogParams,\n options?: SuspenseQueryOptions<\n ProductListingPageResult<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseSuspenseQueryResult<TData>\n useInfiniteProductListingPage<\n TData = InfiniteData<ProductListingPageResult<ProductListingGroupsCatalogItem>>,\n >(\n params?: ProductListingPageCatalogInfiniteParams,\n options?: InfiniteQueryOptions<\n ProductListingPageResult<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseInfiniteQueryResult<TData>\n prefetchProductListingPage(\n params?: ProductListingPageCatalogParams,\n options?: { staleTime?: number },\n ): Promise<void>\n prefetchInfiniteProductListingPage(\n params?: ProductListingPageCatalogInfiniteParams,\n options?: { pages?: number; staleTime?: number },\n ): Promise<void>\n}\n\n/**\n * Composes CollectionHooks + CustomerHooks into a single API surface.\n * All methods are delegated; no logic lives here.\n */\ninterface ProductDetailCallable {\n product: {\n detail: (params: ProductDetailParams) => Promise<ProductDetailResult>\n }\n}\n\ninterface ProductListingPageCatalogCallable {\n product: {\n listingPage: {\n (\n params?: ProductListingPageCatalogParams,\n ): Promise<ProductListingPageResult<ProductListingGroupsCatalogItem>>\n }\n }\n}\n\ninterface ProductListingPageCallable extends ProductListingPageCatalogCallable {\n product: ProductListingPageCatalogCallable['product'] & {\n listingPage: ProductListingPageCatalogCallable['product']['listingPage'] & {\n (\n params: ProductListingPageFullParams,\n ): Promise<ProductListingPageResult<ProductListingGroupsItem>>\n (\n params: ProductListingPageParams,\n ): Promise<\n | ProductListingPageResult<ProductListingGroupsCatalogItem>\n | ProductListingPageResult<ProductListingGroupsItem>\n >\n }\n }\n}\n\ntype ProductCommerceCallable = ProductDetailCallable & ProductListingPageCallable\n\ntype ProductListingPageCatalogResult =\n ProductListingPageResult<ProductListingGroupsCatalogItem>\ntype ProductListingPageFullResult =\n ProductListingPageResult<ProductListingGroupsItem>\ntype ProductListingPageUnionResult =\n | ProductListingPageCatalogResult\n | ProductListingPageFullResult\ntype ProductListingPageHookOptions<TData> =\n | QueryOptions<ProductListingPageCatalogResult, TData>\n | QueryOptions<ProductListingPageFullResult, TData>\n | QueryOptions<ProductListingPageUnionResult, TData>\ntype ProductListingPageSuspenseHookOptions<TData> =\n | SuspenseQueryOptions<ProductListingPageCatalogResult, TData>\n | SuspenseQueryOptions<ProductListingPageFullResult, TData>\n | SuspenseQueryOptions<ProductListingPageUnionResult, TData>\n\nexport type ProductListingPageInfiniteParams = Omit<\n ProductListingPageBaseParams,\n 'page' | 'limit'\n> & {\n mode?: ProductListingPageParams['mode']\n pageSize?: number\n}\n\nexport type ProductListingPageCatalogInfiniteParams = Omit<\n ProductListingPageInfiniteParams,\n 'mode'\n> & {\n mode?: 'catalog'\n}\n\nconst LISTING_GROUPS_QUERY_PATH = '/api/products/listing-groups/query'\n\nfunction fetchProductListingGroupsQuery(\n collectionClient: CollectionClient,\n queryOptions?: ProductListingGroupsQueryOptions,\n) {\n return collectionClient.requestFindEndpoint<ProductListingGroupsItem>(\n LISTING_GROUPS_QUERY_PATH,\n { options: queryOptions },\n )\n}\n\nfunction fetchProductListingGroupsCatalogQuery(\n collectionClient: CollectionClient,\n queryOptions?: ProductListingGroupsQueryOptions,\n) {\n return collectionClient.requestFindEndpointGet<ProductListingGroupsCatalogItem>(\n listingGroupsQueryCatalogUrl(queryOptions),\n )\n}\n\nexport function productListingPageQueryOptions(\n commerceClient: ProductListingPageCatalogCallable,\n params?: ProductListingPageCatalogParams,\n): {\n queryKey: ReturnType<typeof productKeys.listingPage>\n queryFn: () => Promise<\n ProductListingPageResult<ProductListingGroupsCatalogItem>\n >\n}\nexport function productListingPageQueryOptions(\n commerceClient: ProductListingPageCallable,\n params: ProductListingPageFullParams,\n): {\n queryKey: ReturnType<typeof productKeys.listingPage>\n queryFn: () => Promise<ProductListingPageResult<ProductListingGroupsItem>>\n}\nexport function productListingPageQueryOptions(\n commerceClient: ProductListingPageCallable,\n params: ProductListingPageParams,\n): {\n queryKey: ReturnType<typeof productKeys.listingPage>\n queryFn: () => Promise<\n | ProductListingPageResult<ProductListingGroupsCatalogItem>\n | ProductListingPageResult<ProductListingGroupsItem>\n >\n}\nexport function productListingPageQueryOptions(\n commerceClient: ProductListingPageCatalogCallable | ProductListingPageCallable,\n params: ProductListingPageParams = {},\n) {\n return {\n queryKey: productKeys.listingPage(params),\n queryFn: () =>\n commerceClient.product.listingPage(params as ProductListingPageCatalogParams),\n }\n}\n\nexport function productListingPageInfiniteQueryOptions(\n commerceClient: ProductListingPageCatalogCallable,\n params?: ProductListingPageCatalogInfiniteParams,\n): {\n queryKey: ReturnType<typeof productKeys.listingPageInfinite>\n queryFn: (args: { pageParam: number }) => Promise<\n ProductListingPageResult<ProductListingGroupsCatalogItem>\n >\n initialPageParam: number\n getNextPageParam: (\n lastPage: ProductListingPageResult<ProductListingGroupsCatalogItem>,\n ) => number | null | undefined\n}\nexport function productListingPageInfiniteQueryOptions(\n commerceClient: ProductListingPageCallable,\n params?: ProductListingPageInfiniteParams,\n): {\n queryKey: ReturnType<typeof productKeys.listingPageInfinite>\n queryFn: (args: { pageParam: number }) => Promise<\n | ProductListingPageResult<ProductListingGroupsCatalogItem>\n | ProductListingPageResult<ProductListingGroupsItem>\n >\n initialPageParam: number\n getNextPageParam: (\n lastPage: ProductListingPageResult<\n ProductListingGroupsCatalogItem | ProductListingGroupsItem\n >,\n ) => number | null | undefined\n}\nexport function productListingPageInfiniteQueryOptions(\n commerceClient: ProductListingPageCatalogCallable | ProductListingPageCallable,\n params: ProductListingPageInfiniteParams = {},\n) {\n const {\n pageSize: explicitPageSize,\n page: _page,\n limit: _limit,\n ...pageParams\n } = params as ProductListingPageInfiniteParams & {\n page?: number\n limit?: number\n }\n const pageSize = explicitPageSize ?? 20\n\n return {\n queryKey: productKeys.listingPageInfinite(pageParams, explicitPageSize),\n queryFn: ({ pageParam }: { pageParam: number }) =>\n commerceClient.product.listingPage({\n ...pageParams,\n page: pageParam,\n limit: pageSize,\n } as never),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: ProductListingPageResult<\n ProductListingGroupsCatalogItem | ProductListingGroupsItem\n >,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n }\n}\n\nexport function prefetchProductListingPage(\n queryClient: QueryClient,\n commerceClient: ProductListingPageCatalogCallable,\n params?: ProductListingPageCatalogParams,\n options?: { staleTime?: number },\n): Promise<void>\nexport function prefetchProductListingPage(\n queryClient: QueryClient,\n commerceClient: ProductListingPageCallable,\n params: ProductListingPageFullParams,\n options?: { staleTime?: number },\n): Promise<void>\nexport function prefetchProductListingPage(\n queryClient: QueryClient,\n commerceClient: ProductListingPageCallable,\n params: ProductListingPageParams,\n options?: { staleTime?: number },\n): Promise<void>\nexport function prefetchProductListingPage(\n queryClient: QueryClient,\n commerceClient: ProductListingPageCatalogCallable | ProductListingPageCallable,\n params: ProductListingPageParams = {},\n options?: { staleTime?: number },\n) {\n return queryClient.prefetchQuery({\n ...productListingPageQueryOptions(\n commerceClient as ProductListingPageCallable,\n params,\n ),\n ...options,\n })\n}\n\nexport function prefetchInfiniteProductListingPage(\n queryClient: QueryClient,\n commerceClient: ProductListingPageCatalogCallable,\n params?: ProductListingPageCatalogInfiniteParams,\n options?: { pages?: number; staleTime?: number },\n): Promise<void>\nexport function prefetchInfiniteProductListingPage(\n queryClient: QueryClient,\n commerceClient: ProductListingPageCallable,\n params?: ProductListingPageInfiniteParams,\n options?: { pages?: number; staleTime?: number },\n): Promise<void>\nexport function prefetchInfiniteProductListingPage(\n queryClient: QueryClient,\n commerceClient: ProductListingPageCatalogCallable | ProductListingPageCallable,\n params: ProductListingPageInfiniteParams = {},\n options?: { pages?: number; staleTime?: number },\n) {\n return queryClient.prefetchInfiniteQuery({\n ...productListingPageInfiniteQueryOptions(\n commerceClient as ProductListingPageCallable,\n params,\n ),\n pages: options?.pages ?? 1,\n staleTime: options?.staleTime,\n })\n}\n\nexport class QueryHooks<\n TCollection extends ServerCollection = PublicCollection,\n> extends CollectionHooks<TCollection> {\n private _customer: CustomerHooks\n private _commerce?: ProductCommerceCallable\n\n constructor(\n queryClient: QueryClient,\n collectionClient: CollectionClient<TCollection>,\n customerAuth?: CustomerAuth,\n commerceClient?: ProductCommerceCallable,\n ) {\n super(queryClient, collectionClient)\n this._customer = new CustomerHooks(queryClient, customerAuth)\n this._commerce = commerceClient\n }\n\n private ensureCommerce(): ProductCommerceCallable {\n if (!this._commerce) {\n throw createConfigError(\n 'Product listing page hooks require Client or ServerClient. Use createQueryHooks(client) or createServerQueryHooks(server) instead of constructing QueryHooks directly.',\n )\n }\n return this._commerce\n }\n\n // --- Customer hooks delegation ---\n useCustomerMe: CustomerHooks['useCustomerMe'] = (...args) =>\n this._customer.useCustomerMe(...args)\n useCustomerLogin: CustomerHooks['useCustomerLogin'] = (...args) =>\n this._customer.useCustomerLogin(...args)\n useCustomerRegister: CustomerHooks['useCustomerRegister'] = (...args) =>\n this._customer.useCustomerRegister(...args)\n useCustomerLogout: CustomerHooks['useCustomerLogout'] = (...args) =>\n this._customer.useCustomerLogout(...args)\n useCustomerForgotPassword: CustomerHooks['useCustomerForgotPassword'] = (\n ...args\n ) => this._customer.useCustomerForgotPassword(...args)\n useCustomerResetPassword: CustomerHooks['useCustomerResetPassword'] = (\n ...args\n ) => this._customer.useCustomerResetPassword(...args)\n useCustomerRefreshToken: CustomerHooks['useCustomerRefreshToken'] = (\n ...args\n ) => this._customer.useCustomerRefreshToken(...args)\n useCustomerUpdateProfile: CustomerHooks['useCustomerUpdateProfile'] = (\n ...args\n ) => this._customer.useCustomerUpdateProfile(...args)\n useCustomerChangePassword: CustomerHooks['useCustomerChangePassword'] = (\n ...args\n ) => this._customer.useCustomerChangePassword(...args)\n\n // --- Customer cache delegation ---\n invalidateCustomerQueries: CustomerHooks['invalidateCustomerQueries'] = () =>\n this._customer.invalidateCustomerQueries()\n getCustomerData: CustomerHooks['getCustomerData'] = () =>\n this._customer.getCustomerData()\n setCustomerData: CustomerHooks['setCustomerData'] = (data) =>\n this._customer.setCustomerData(data)\n\n useProductListingGroupsQuery<\n TData = PayloadFindResponse<ProductListingGroupsItem>,\n >(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: QueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>,\n ): UseQueryResult<TData> {\n const queryOptions = params.options\n const { placeholderData, ...restOptions } = (options ?? {}) as QueryOptions<\n PayloadFindResponse<ProductListingGroupsItem>,\n TData\n >\n\n return useQueryOriginal({\n queryKey: productKeys.listingGroups(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsQuery(this.collectionClient, queryOptions),\n ...restOptions,\n ...(placeholderData !== undefined && {\n placeholderData: placeholderData as never,\n }),\n })\n }\n\n useProductListingGroupsCatalogQuery<\n TData = PayloadFindResponse<ProductListingGroupsCatalogItem>,\n >(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: QueryOptions<\n PayloadFindResponse<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseQueryResult<TData> {\n const queryOptions = params.options\n const { placeholderData, ...restOptions } = (options ?? {}) as QueryOptions<\n PayloadFindResponse<ProductListingGroupsCatalogItem>,\n TData\n >\n\n return useQueryOriginal({\n queryKey: productKeys.listingGroupsCatalog(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsCatalogQuery(\n this.collectionClient,\n queryOptions,\n ),\n ...restOptions,\n ...(placeholderData !== undefined && {\n placeholderData: placeholderData as never,\n }),\n })\n }\n\n useSuspenseProductListingGroupsQuery<\n TData = PayloadFindResponse<ProductListingGroupsItem>,\n >(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: SuspenseQueryOptions<\n PayloadFindResponse<ProductListingGroupsItem>,\n TData\n >,\n ): UseSuspenseQueryResult<TData> {\n const queryOptions = params.options\n\n return useSuspenseQueryOriginal({\n queryKey: productKeys.listingGroups(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsQuery(this.collectionClient, queryOptions),\n ...options,\n })\n }\n\n useSuspenseProductListingGroupsCatalogQuery<\n TData = PayloadFindResponse<ProductListingGroupsCatalogItem>,\n >(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: SuspenseQueryOptions<\n PayloadFindResponse<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseSuspenseQueryResult<TData> {\n const queryOptions = params.options\n\n return useSuspenseQueryOriginal({\n queryKey: productKeys.listingGroupsCatalog(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsCatalogQuery(\n this.collectionClient,\n queryOptions,\n ),\n ...options,\n })\n }\n\n useInfiniteProductListingGroupsQuery<\n TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>,\n >(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: InfiniteQueryOptions<\n PayloadFindResponse<ProductListingGroupsItem>,\n TData\n >,\n ): UseInfiniteQueryResult<TData> {\n const { options: queryOptions } = params\n const explicitPageSize = params.pageSize\n const pageSize = explicitPageSize ?? 20\n\n return useInfiniteQueryOriginal({\n queryKey: productKeys.listingGroupsInfinite(\n queryOptions,\n explicitPageSize,\n ),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n ...options,\n })\n }\n\n useInfiniteProductListingGroupsCatalogQuery<\n TData = InfiniteData<PayloadFindResponse<ProductListingGroupsCatalogItem>>,\n >(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: InfiniteQueryOptions<\n PayloadFindResponse<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseInfiniteQueryResult<TData> {\n const { options: queryOptions } = params\n const explicitPageSize = params.pageSize\n const pageSize = explicitPageSize ?? 20\n\n return useInfiniteQueryOriginal({\n queryKey: productKeys.listingGroupsCatalogInfinite(\n queryOptions,\n explicitPageSize,\n ),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsCatalogQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsCatalogItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n ...options,\n })\n }\n\n useSuspenseInfiniteProductListingGroupsQuery<\n TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>,\n >(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: SuspenseInfiniteQueryOptions<\n PayloadFindResponse<ProductListingGroupsItem>,\n TData\n >,\n ): UseSuspenseInfiniteQueryResult<TData> {\n const { options: queryOptions } = params\n const explicitPageSize = params.pageSize\n const pageSize = explicitPageSize ?? 20\n\n return useSuspenseInfiniteQueryOriginal({\n queryKey: productKeys.listingGroupsInfinite(\n queryOptions,\n explicitPageSize,\n ),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n ...options,\n })\n }\n\n useSuspenseInfiniteProductListingGroupsCatalogQuery<\n TData = InfiniteData<PayloadFindResponse<ProductListingGroupsCatalogItem>>,\n >(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: SuspenseInfiniteQueryOptions<\n PayloadFindResponse<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseSuspenseInfiniteQueryResult<TData> {\n const { options: queryOptions } = params\n const explicitPageSize = params.pageSize\n const pageSize = explicitPageSize ?? 20\n\n return useSuspenseInfiniteQueryOriginal({\n queryKey: productKeys.listingGroupsCatalogInfinite(\n queryOptions,\n explicitPageSize,\n ),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsCatalogQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsCatalogItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n ...options,\n })\n }\n\n async prefetchProductListingGroupsQuery(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: { staleTime?: number },\n ) {\n const queryOptions = params.options\n\n return this.queryClient.prefetchQuery({\n queryKey: productKeys.listingGroups(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsQuery(this.collectionClient, queryOptions),\n ...options,\n })\n }\n\n async prefetchProductListingGroupsCatalogQuery(\n params: { options?: ProductListingGroupsQueryOptions },\n options?: { staleTime?: number },\n ) {\n const queryOptions = params.options\n\n return this.queryClient.prefetchQuery({\n queryKey: productKeys.listingGroupsCatalog(queryOptions),\n queryFn: async () =>\n fetchProductListingGroupsCatalogQuery(\n this.collectionClient,\n queryOptions,\n ),\n ...options,\n })\n }\n\n async prefetchInfiniteProductListingGroupsQuery(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: { pages?: number; staleTime?: number },\n ) {\n const { options: queryOptions } = params\n const explicitPageSize = params.pageSize\n const pageSize = explicitPageSize ?? 20\n\n return this.queryClient.prefetchInfiniteQuery({\n queryKey: productKeys.listingGroupsInfinite(\n queryOptions,\n explicitPageSize,\n ),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n pages: options?.pages ?? 1,\n staleTime: options?.staleTime,\n })\n }\n\n async prefetchInfiniteProductListingGroupsCatalogQuery(\n params: {\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>\n pageSize?: number\n },\n options?: { pages?: number; staleTime?: number },\n ) {\n const { options: queryOptions } = params\n const explicitPageSize = params.pageSize\n const pageSize = explicitPageSize ?? 20\n\n return this.queryClient.prefetchInfiniteQuery({\n queryKey: productKeys.listingGroupsCatalogInfinite(\n queryOptions,\n explicitPageSize,\n ),\n queryFn: async ({ pageParam }) =>\n fetchProductListingGroupsCatalogQuery(this.collectionClient, {\n ...queryOptions,\n page: pageParam,\n limit: pageSize,\n }),\n initialPageParam: 1,\n getNextPageParam: (\n lastPage: PayloadFindResponse<ProductListingGroupsCatalogItem>,\n ) => (lastPage.hasNextPage ? lastPage.nextPage : undefined),\n pages: options?.pages ?? 1,\n staleTime: options?.staleTime,\n })\n }\n\n useProductListingPage<\n TData = ProductListingPageResult<ProductListingGroupsCatalogItem>,\n >(\n params?: ProductListingPageCatalogParams,\n options?: QueryOptions<\n ProductListingPageResult<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseQueryResult<TData>\n useProductListingPage<\n TData = ProductListingPageResult<ProductListingGroupsItem>,\n >(\n params: ProductListingPageFullParams,\n options?: QueryOptions<\n ProductListingPageResult<ProductListingGroupsItem>,\n TData\n >,\n ): UseQueryResult<TData>\n useProductListingPage<\n TData =\n | ProductListingPageResult<ProductListingGroupsCatalogItem>\n | ProductListingPageResult<ProductListingGroupsItem>,\n >(\n params: ProductListingPageParams,\n options?: QueryOptions<\n | ProductListingPageResult<ProductListingGroupsCatalogItem>\n | ProductListingPageResult<ProductListingGroupsItem>,\n TData\n >,\n ): UseQueryResult<TData>\n useProductListingPage<TData = ProductListingPageUnionResult>(\n params: ProductListingPageParams = {},\n options?: ProductListingPageHookOptions<TData>,\n ): UseQueryResult<TData> {\n const { placeholderData, ...restOptions } = (options ?? {}) as QueryOptions<\n | ProductListingPageResult<ProductListingGroupsCatalogItem>\n | ProductListingPageResult<ProductListingGroupsItem>,\n unknown\n >\n\n return useQueryOriginal({\n ...productListingPageQueryOptions(this.ensureCommerce(), params),\n ...restOptions,\n ...(placeholderData !== undefined && {\n placeholderData: placeholderData as never,\n }),\n }) as UseQueryResult<TData>\n }\n\n useSuspenseProductListingPage<\n TData = ProductListingPageResult<ProductListingGroupsCatalogItem>,\n >(\n params?: ProductListingPageCatalogParams,\n options?: SuspenseQueryOptions<\n ProductListingPageResult<ProductListingGroupsCatalogItem>,\n TData\n >,\n ): UseSuspenseQueryResult<TData>\n useSuspenseProductListingPage<\n TData = ProductListingPageResult<ProductListingGroupsItem>,\n >(\n params: ProductListingPageFullParams,\n options?: SuspenseQueryOptions<\n ProductListingPageResult<ProductListingGroupsItem>,\n TData\n >,\n ): UseSuspenseQueryResult<TData>\n useSuspenseProductListingPage<\n TData =\n | ProductListingPageResult<ProductListingGroupsCatalogItem>\n | ProductListingPageResult<ProductListingGroupsItem>,\n >(\n params: ProductListingPageParams,\n options?: SuspenseQueryOptions<\n | ProductListingPageResult<ProductListingGroupsCatalogItem>\n | ProductListingPageResult<ProductListingGroupsItem>,\n TData\n >,\n ): UseSuspenseQueryResult<TData>\n useSuspenseProductListingPage<TData = ProductListingPageUnionResult>(\n params: ProductListingPageParams = {},\n options?: ProductListingPageSuspenseHookOptions<TData>,\n ): UseSuspenseQueryResult<TData> {\n const suspenseOptions = options as\n | SuspenseQueryOptions<ProductListingPageUnionResult, TData>\n | undefined\n\n return useSuspenseQueryOriginal({\n ...productListingPageQueryOptions(this.ensureCommerce(), params),\n ...suspenseOptions,\n }) as UseSuspenseQueryResult<TData>\n }\n\n useInfiniteProductListingPage<\n TData = InfiniteData<\n ProductListingPageResult<\n ProductListingGroupsCatalogItem | ProductListingGroupsItem\n >\n >,\n >(\n params: ProductListingPageInfiniteParams = {},\n options?: InfiniteQueryOptions<\n ProductListingPageResult<\n ProductListingGroupsCatalogItem | ProductListingGroupsItem\n >,\n TData\n >,\n ): UseInfiniteQueryResult<TData> {\n return useInfiniteQueryOriginal({\n ...productListingPageInfiniteQueryOptions(this.ensureCommerce(), params),\n ...options,\n }) as UseInfiniteQueryResult<TData>\n }\n\n async prefetchProductListingPage(\n params?: ProductListingPageCatalogParams,\n options?: { staleTime?: number },\n ): Promise<void>\n async prefetchProductListingPage(\n params: ProductListingPageFullParams,\n options?: { staleTime?: number },\n ): Promise<void>\n async prefetchProductListingPage(\n params: ProductListingPageParams,\n options?: { staleTime?: number },\n ): Promise<void>\n async prefetchProductListingPage(\n params: ProductListingPageParams = {},\n options?: { staleTime?: number },\n ) {\n return prefetchProductListingPage(\n this.queryClient,\n this.ensureCommerce(),\n params,\n options,\n )\n }\n\n async prefetchInfiniteProductListingPage(\n params: ProductListingPageInfiniteParams = {},\n options?: { pages?: number; staleTime?: number },\n ) {\n return prefetchInfiniteProductListingPage(\n this.queryClient,\n this.ensureCommerce(),\n params,\n options,\n )\n }\n\n useProductDetail(\n params: { slug: string } | { id: string },\n options?: QueryOptions<ProductDetailResult>,\n ): UseQueryResult<ProductDetailResult> {\n const discriminator = 'slug' in params ? params.slug : params.id\n const { enabled, ...restOptions } = options ?? {}\n const queryEnabled = enabled !== false && Boolean(discriminator)\n\n return useQueryOriginal({\n queryKey: productKeys.detail(params),\n queryFn: () => this._commerce!.product.detail(params),\n enabled: queryEnabled,\n ...restOptions,\n }) as UseQueryResult<ProductDetailResult>\n }\n\n useProductDetailBySlug(\n slug: string,\n options?: QueryOptions<ProductDetailResult>,\n ): UseQueryResult<ProductDetailResult> {\n return this.useProductDetail({ slug }, options)\n }\n\n useProductDetailById(\n id: string,\n options?: QueryOptions<ProductDetailResult>,\n ): UseQueryResult<ProductDetailResult> {\n return this.useProductDetail({ id }, options)\n }\n}\n","export function productDetailQuery(\n params: { slug: string } | { id: string },\n): string {\n const search = new URLSearchParams()\n if ('slug' in params) {\n search.set('slug', params.slug)\n } else {\n search.set('id', params.id)\n }\n return `/api/products/detail?${search}`\n}\n\nexport function productDetailCatalogQuery(\n params: { slug: string } | { id: string },\n): string {\n const search = new URLSearchParams()\n if ('slug' in params) {\n search.set('slug', params.slug)\n } else {\n search.set('id', params.id)\n }\n return `/api/products/detail/catalog?${search}`\n}\n\nexport function listingGroupsQuery(params: { productIds: string[] }): string {\n return `/api/products/listing-groups?ids=${params.productIds.map(encodeURIComponent).join(',')}`\n}\n\nexport function listingGroupsCatalogQuery(params: {\n productIds: string[]\n}): string {\n return `/api/products/listing-groups/catalog?ids=${params.productIds.map(encodeURIComponent).join(',')}`\n}\n\ntype ListingGroupsQueryUrlOptions = {\n page?: number\n limit?: number\n sort?: string | string[]\n where?: Record<string, unknown>\n}\n\nfunction appendListingGroupsQuerySearchParams(\n search: URLSearchParams,\n options?: ListingGroupsQueryUrlOptions,\n): void {\n if (options?.page != null) search.set('page', String(options.page))\n if (options?.limit != null) search.set('limit', String(options.limit))\n if (options?.sort != null) {\n const sort = options.sort\n search.set(\n 'sort',\n Array.isArray(sort) ? sort.join(',') : sort,\n )\n }\n if (options?.where != null) {\n search.set('whereJson', JSON.stringify(options.where))\n }\n}\n\n/** Server-auth GET PLP listing-groups query (full variant stock fields). */\nexport function listingGroupsQueryUrl(\n options?: ListingGroupsQueryUrlOptions,\n): string {\n const search = new URLSearchParams()\n appendListingGroupsQuerySearchParams(search, options)\n const query = search.toString()\n return `/api/products/listing-groups/query${query ? `?${query}` : ''}`\n}\n\n/** GET cacheable PLP listing-groups query (catalog / CDN-friendly). */\nexport function listingGroupsQueryCatalogUrl(\n options?: ListingGroupsQueryUrlOptions,\n): string {\n const search = new URLSearchParams()\n appendListingGroupsQuerySearchParams(search, options)\n const query = search.toString()\n return `/api/products/listing-groups/query/catalog${query ? `?${query}` : ''}`\n}\n\nexport function stockSnapshotQuery(params: { variantIds: string[] }): string {\n return `/api/products/stock?variantIds=${params.variantIds.map(encodeURIComponent).join(',')}`\n}\n","/**\n * Fetch-based SSE connection manager for real-time collection change events.\n * Uses fetch + ReadableStream to support custom auth headers (unlike native EventSource).\n */\n\nexport interface RealtimeEvent {\n collection: string\n operation: string\n id: string | null\n timestamp: string\n}\n\nexport type RealtimeListener = (event: RealtimeEvent) => void\n\nconst INITIAL_RECONNECT_DELAY = 1_000\nconst MAX_RECONNECT_DELAY = 30_000\nconst RECONNECT_BACKOFF_FACTOR = 2\nconst MAX_NO_TOKEN_RETRIES = 5\n\nexport class RealtimeConnection {\n private abortController: AbortController | null = null\n private reconnectAttempt = 0\n private noTokenAttempts = 0\n private reconnectTimer: ReturnType<typeof setTimeout> | null = null\n private listeners = new Set<RealtimeListener>()\n private _connected = false\n\n constructor(\n private baseUrl: string,\n private publishableKey: string,\n private getToken: () => string | null,\n private collections?: string[],\n ) {}\n\n get connected(): boolean {\n return this._connected\n }\n\n addListener(fn: RealtimeListener): () => void {\n this.listeners.add(fn)\n return () => this.listeners.delete(fn)\n }\n\n connect(): void {\n if (this.abortController) return // Already connecting/connected\n\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }\n\n disconnect(): void {\n this._connected = false\n if (this.reconnectTimer) {\n clearTimeout(this.reconnectTimer)\n this.reconnectTimer = null\n }\n if (this.abortController) {\n this.abortController.abort()\n this.abortController = null\n }\n this.reconnectAttempt = 0\n this.noTokenAttempts = 0\n }\n\n private async startStream(signal: AbortSignal): Promise<void> {\n const token = this.getToken()\n if (!token) {\n this.noTokenAttempts++\n if (this.noTokenAttempts >= MAX_NO_TOKEN_RETRIES) {\n // Stop reconnecting — no token available after multiple attempts\n this._connected = false\n this.abortController = null\n return\n }\n this.scheduleReconnect()\n return\n }\n this.noTokenAttempts = 0\n\n const params = this.collections?.length\n ? `?collections=${this.collections.join(',')}`\n : ''\n const url = `${this.baseUrl}/api/events/stream${params}`\n\n try {\n const response = await fetch(url, {\n headers: {\n 'X-Publishable-Key': this.publishableKey,\n Authorization: `Bearer ${token}`,\n },\n signal,\n })\n\n if (!response.ok) {\n if (response.status === 401) {\n // Token expired — try reconnecting (will get fresh token)\n this.scheduleReconnect()\n return\n }\n throw new Error(`SSE connection failed: ${response.status}`)\n }\n\n if (!response.body) {\n throw new Error('SSE response has no body')\n }\n\n this._connected = true\n this.reconnectAttempt = 0\n\n await this.readStream(response.body, signal)\n } catch {\n if (signal.aborted) return // Intentional disconnect\n this._connected = false\n this.scheduleReconnect()\n }\n }\n\n private async readStream(\n body: ReadableStream<Uint8Array>,\n signal: AbortSignal,\n ): Promise<void> {\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n let currentEvent = ''\n let currentData = ''\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done || signal.aborted) break\n\n buffer += decoder.decode(value, { stream: true })\n const lines = buffer.split('\\n')\n buffer = lines.pop() ?? '' // Keep incomplete last line in buffer\n\n for (const line of lines) {\n if (line.startsWith('event: ')) {\n currentEvent = line.slice(7)\n } else if (line.startsWith('data: ')) {\n currentData += (currentData ? '\\n' : '') + line.slice(6)\n } else if (line === '') {\n // Empty line = end of event\n if (currentEvent === 'collection:change' && currentData) {\n try {\n const event: RealtimeEvent = JSON.parse(currentData)\n for (const listener of this.listeners) {\n try {\n listener(event)\n } catch {\n // Listener error — ignore\n }\n }\n } catch {\n // Malformed JSON — ignore\n }\n }\n currentEvent = ''\n currentData = ''\n }\n // Ignore comment lines (: heartbeat)\n }\n }\n } catch {\n // Stream read error\n } finally {\n reader.releaseLock()\n this._connected = false\n if (!signal.aborted) {\n this.scheduleReconnect()\n }\n }\n }\n\n private scheduleReconnect(): void {\n if (this.reconnectTimer) return\n\n const delay = Math.min(\n INITIAL_RECONNECT_DELAY *\n Math.pow(RECONNECT_BACKOFF_FACTOR, this.reconnectAttempt),\n MAX_RECONNECT_DELAY,\n )\n this.reconnectAttempt++\n\n this.reconnectTimer = setTimeout(() => {\n this.reconnectTimer = null\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }, delay)\n }\n}\n","import type {\n PublicCollection,\n RootClient,\n RootServerClient,\n ServerCollection,\n} from '../client/types'\nimport type { CollectionClient, ServerCollectionClient } from '../collection'\nimport { QueryHooks, type ReadOnlyQueryHooks } from './query-hooks'\nimport { getQueryClient } from './get-query-client'\nimport type { QueryClient } from '@tanstack/react-query'\n\nfunction createReadOnlyQueryHooksFacade(\n hooks: QueryHooks<PublicCollection>,\n): ReadOnlyQueryHooks {\n return {\n useQuery: hooks.useQuery.bind(hooks),\n useSuspenseQuery: hooks.useSuspenseQuery.bind(hooks),\n useQueryById: hooks.useQueryById.bind(hooks),\n useSuspenseQueryById: hooks.useSuspenseQueryById.bind(hooks),\n useInfiniteQuery: hooks.useInfiniteQuery.bind(hooks),\n useSuspenseInfiniteQuery: hooks.useSuspenseInfiniteQuery.bind(hooks),\n prefetchQuery: hooks.prefetchQuery.bind(hooks),\n prefetchQueryById: hooks.prefetchQueryById.bind(hooks),\n prefetchInfiniteQuery: hooks.prefetchInfiniteQuery.bind(hooks),\n invalidateQueries: hooks.invalidateQueries.bind(hooks),\n getQueryData: hooks.getQueryData.bind(hooks),\n setQueryData: hooks.setQueryData.bind(hooks),\n useCustomerMe: hooks.useCustomerMe.bind(hooks),\n useCustomerLogin: hooks.useCustomerLogin.bind(hooks),\n useCustomerRegister: hooks.useCustomerRegister.bind(hooks),\n useCustomerLogout: hooks.useCustomerLogout.bind(hooks),\n useCustomerForgotPassword: hooks.useCustomerForgotPassword.bind(hooks),\n useCustomerResetPassword: hooks.useCustomerResetPassword.bind(hooks),\n useCustomerRefreshToken: hooks.useCustomerRefreshToken.bind(hooks),\n useCustomerUpdateProfile: hooks.useCustomerUpdateProfile.bind(hooks),\n useCustomerChangePassword: hooks.useCustomerChangePassword.bind(hooks),\n invalidateCustomerQueries: hooks.invalidateCustomerQueries.bind(hooks),\n getCustomerData: hooks.getCustomerData.bind(hooks),\n setCustomerData: hooks.setCustomerData.bind(hooks),\n useProductListingGroupsCatalogQuery:\n hooks.useProductListingGroupsCatalogQuery.bind(hooks),\n useSuspenseProductListingGroupsCatalogQuery:\n hooks.useSuspenseProductListingGroupsCatalogQuery.bind(hooks),\n useInfiniteProductListingGroupsCatalogQuery:\n hooks.useInfiniteProductListingGroupsCatalogQuery.bind(hooks),\n useSuspenseInfiniteProductListingGroupsCatalogQuery:\n hooks.useSuspenseInfiniteProductListingGroupsCatalogQuery.bind(hooks),\n prefetchProductListingGroupsCatalogQuery:\n hooks.prefetchProductListingGroupsCatalogQuery.bind(hooks),\n prefetchInfiniteProductListingGroupsCatalogQuery:\n hooks.prefetchInfiniteProductListingGroupsCatalogQuery.bind(hooks),\n useProductListingPage: hooks.useProductListingPage.bind(hooks),\n useSuspenseProductListingPage:\n hooks.useSuspenseProductListingPage.bind(hooks),\n useInfiniteProductListingPage:\n hooks.useInfiniteProductListingPage.bind(hooks),\n prefetchProductListingPage: hooks.prefetchProductListingPage.bind(hooks),\n prefetchInfiniteProductListingPage:\n hooks.prefetchInfiniteProductListingPage.bind(hooks),\n useProductDetail: hooks.useProductDetail.bind(hooks),\n useProductDetailBySlug: hooks.useProductDetailBySlug.bind(hooks),\n useProductDetailById: hooks.useProductDetailById.bind(hooks),\n } as ReadOnlyQueryHooks\n}\n\nexport function createQueryHooks(\n client: RootClient,\n queryClient: QueryClient = getQueryClient(),\n): ReadOnlyQueryHooks {\n const hooks = new QueryHooks<PublicCollection>(\n queryClient,\n client.collections as unknown as CollectionClient<PublicCollection>,\n client.customer.auth,\n client.commerce as never,\n )\n\n return createReadOnlyQueryHooksFacade(hooks)\n}\n\nexport function createServerQueryHooks(\n client: RootServerClient,\n queryClient: QueryClient = getQueryClient(),\n): QueryHooks<ServerCollection> {\n return new QueryHooks<ServerCollection>(\n queryClient,\n client.collections as ServerCollectionClient,\n undefined,\n client.commerce,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,yBAIO;AAEP,SAAS,kBAAkB;AACzB,SAAO,IAAI,+BAAY;AAAA,IACrB,gBAAgB;AAAA,MACd,SAAS;AAAA;AAAA;AAAA;AAAA,QAIP,WAAW,OAAO;AAAA,QAClB,sBAAsB;AAAA,MACxB;AAAA,MACA,WAAW;AAAA,QACT,sBAAsB,CAAC,cACrB,gDAA4B,KAAK,KACjC,MAAM,MAAM,WAAW;AAAA,QACzB,oBAAoB,MAAM;AAAA,MAC5B;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEA,IAAI;AACJ,IAAI;AAGG,SAAS,iBAAiB;AAC/B,MAAI,6BAAU;AACZ,WAAO,gBAAgB;AAAA,EACzB;AACA,MAAI,CAAC,oBAAoB;AACvB,yBAAqB,gBAAgB;AAAA,EAC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KAAK,KAAK;AAAA,EAC7D;AACF;AAEO,SAAS,iBACd,QACA,cAA2B,eAAe,GACtB;AACpB,QAAM,QAAQ,IAAI;AAAA,IAChB;AAAA,IACA,OAAO;AAAA,IACP,OAAO,SAAS;AAAA,IAChB,OAAO;AAAA,EACT;AAEA,SAAO,+BAA+B,KAAK;AAC7C;AAEO,SAAS,uBACd,QACA,cAA2B,eAAe,GACZ;AAC9B,SAAO,IAAI;AAAA,IACT;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,OAAO;AAAA,EACT;AACF;","names":["import_react_query","useQueryOriginal","useSuspenseQueryOriginal","useInfiniteQueryOriginal","useSuspenseInfiniteQueryOriginal","useMutationOriginal","import_react_query","useMutationOriginal","useQueryOriginal","import_react_query","useQueryOriginal","useSuspenseQueryOriginal","useInfiniteQueryOriginal","useSuspenseInfiniteQueryOriginal"]}
|