@burdenoff/microfe-hookmovies 2026.626.2 → 2026.628.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/hookmovies/HookMoviesRoot.js +70 -118
  2. package/dist/hookmovies/HookMoviesRoot.js.map +1 -1
  3. package/dist/hookmovies/HookMoviesRoutes.js +63 -183
  4. package/dist/hookmovies/HookMoviesRoutes.js.map +1 -1
  5. package/dist/hookmovies/components/MetricsCard.js.map +1 -1
  6. package/dist/hookmovies/components/Pagination.js +36 -0
  7. package/dist/hookmovies/components/Pagination.js.map +1 -0
  8. package/dist/hookmovies/components/StateViews.js +36 -0
  9. package/dist/hookmovies/components/StateViews.js.map +1 -0
  10. package/dist/hookmovies/components/StatusBadge.js +26 -14
  11. package/dist/hookmovies/components/StatusBadge.js.map +1 -1
  12. package/dist/hookmovies/context/HookMoviesContext.js +22 -30
  13. package/dist/hookmovies/context/HookMoviesContext.js.map +1 -1
  14. package/dist/hookmovies/hooks/index.js +1 -0
  15. package/dist/hookmovies/hooks/useHookMoviesApi.js +463 -169
  16. package/dist/hookmovies/hooks/useHookMoviesApi.js.map +1 -1
  17. package/dist/hookmovies/index.js +2 -2
  18. package/dist/hookmovies/pages/HomePage.js +206 -885
  19. package/dist/hookmovies/pages/HomePage.js.map +1 -1
  20. package/dist/hookmovies/pages/auditions/AuditionCreatePage.js +206 -0
  21. package/dist/hookmovies/pages/auditions/AuditionCreatePage.js.map +1 -0
  22. package/dist/hookmovies/pages/auditions/AuditionDetailPage.js +266 -0
  23. package/dist/hookmovies/pages/auditions/AuditionDetailPage.js.map +1 -0
  24. package/dist/hookmovies/pages/auditions/AuditionsPage.js +137 -0
  25. package/dist/hookmovies/pages/auditions/AuditionsPage.js.map +1 -0
  26. package/dist/hookmovies/pages/catalog/PeoplePage.js +175 -0
  27. package/dist/hookmovies/pages/catalog/PeoplePage.js.map +1 -0
  28. package/dist/hookmovies/pages/catalog/StudiosPage.js +173 -0
  29. package/dist/hookmovies/pages/catalog/StudiosPage.js.map +1 -0
  30. package/dist/hookmovies/pages/catalog/TitleCreatePage.js +251 -0
  31. package/dist/hookmovies/pages/catalog/TitleCreatePage.js.map +1 -0
  32. package/dist/hookmovies/pages/catalog/TitleDetailPage.js +323 -0
  33. package/dist/hookmovies/pages/catalog/TitleDetailPage.js.map +1 -0
  34. package/dist/hookmovies/pages/catalog/TitlesPage.js +158 -0
  35. package/dist/hookmovies/pages/catalog/TitlesPage.js.map +1 -0
  36. package/dist/hookmovies/pages/distribution/RightsWindowsPage.js +294 -0
  37. package/dist/hookmovies/pages/distribution/RightsWindowsPage.js.map +1 -0
  38. package/dist/hookmovies/pages/engagement/ReviewsPage.js +242 -0
  39. package/dist/hookmovies/pages/engagement/ReviewsPage.js.map +1 -0
  40. package/dist/hookmovies/pages/library/EntitlementsPage.js +90 -0
  41. package/dist/hookmovies/pages/library/EntitlementsPage.js.map +1 -0
  42. package/dist/hookmovies/pages/library/ListsPage.js +209 -0
  43. package/dist/hookmovies/pages/library/ListsPage.js.map +1 -0
  44. package/dist/hookmovies/pages/productions/ProductionCreatePage.js +204 -0
  45. package/dist/hookmovies/pages/productions/ProductionCreatePage.js.map +1 -0
  46. package/dist/hookmovies/pages/productions/ProductionDetailPage.js +234 -0
  47. package/dist/hookmovies/pages/productions/ProductionDetailPage.js.map +1 -0
  48. package/dist/hookmovies/pages/productions/ProductionsPage.js +135 -0
  49. package/dist/hookmovies/pages/productions/ProductionsPage.js.map +1 -0
  50. package/dist/hookmovies/utils/formatters.js +14 -9
  51. package/dist/hookmovies/utils/formatters.js.map +1 -1
  52. package/dist/index.js +4 -4
  53. package/package.json +1 -1
  54. package/dist/hookmovies/components/InvestmentCard.js +0 -97
  55. package/dist/hookmovies/components/InvestmentCard.js.map +0 -1
  56. package/dist/hookmovies/mocks/data.js +0 -1517
  57. package/dist/hookmovies/mocks/data.js.map +0 -1
  58. package/dist/hookmovies/mocks/users.js +0 -34
  59. package/dist/hookmovies/mocks/users.js.map +0 -1
  60. package/dist/hookmovies/pages/admin/AdminAnalyticsPage.js +0 -646
  61. package/dist/hookmovies/pages/admin/AdminAnalyticsPage.js.map +0 -1
  62. package/dist/hookmovies/pages/admin/AdminDashboard.js +0 -671
  63. package/dist/hookmovies/pages/admin/AdminDashboard.js.map +0 -1
  64. package/dist/hookmovies/pages/admin/AdminFinancialPage.js +0 -422
  65. package/dist/hookmovies/pages/admin/AdminFinancialPage.js.map +0 -1
  66. package/dist/hookmovies/pages/admin/AdminOrdersPage.js +0 -661
  67. package/dist/hookmovies/pages/admin/AdminOrdersPage.js.map +0 -1
  68. package/dist/hookmovies/pages/admin/AdminProfilePage.js +0 -262
  69. package/dist/hookmovies/pages/admin/AdminProfilePage.js.map +0 -1
  70. package/dist/hookmovies/pages/admin/AdminSettingsPage.js +0 -650
  71. package/dist/hookmovies/pages/admin/AdminSettingsPage.js.map +0 -1
  72. package/dist/hookmovies/pages/admin/CartManagementPage.js +0 -869
  73. package/dist/hookmovies/pages/admin/CartManagementPage.js.map +0 -1
  74. package/dist/hookmovies/pages/admin/UserManagementPage.js +0 -893
  75. package/dist/hookmovies/pages/admin/UserManagementPage.js.map +0 -1
  76. package/dist/hookmovies/pages/cart-owner/AnalyticsDashboard.js +0 -836
  77. package/dist/hookmovies/pages/cart-owner/AnalyticsDashboard.js.map +0 -1
  78. package/dist/hookmovies/pages/cart-owner/BusinessSettingsPage.js +0 -704
  79. package/dist/hookmovies/pages/cart-owner/BusinessSettingsPage.js.map +0 -1
  80. package/dist/hookmovies/pages/cart-owner/CartOwnerDashboard.js +0 -801
  81. package/dist/hookmovies/pages/cart-owner/CartOwnerDashboard.js.map +0 -1
  82. package/dist/hookmovies/pages/cart-owner/CartOwnerProfilePage.js +0 -888
  83. package/dist/hookmovies/pages/cart-owner/CartOwnerProfilePage.js.map +0 -1
  84. package/dist/hookmovies/pages/cart-owner/CartServiceConfigPage.js +0 -635
  85. package/dist/hookmovies/pages/cart-owner/CartServiceConfigPage.js.map +0 -1
  86. package/dist/hookmovies/pages/cart-owner/InventoryManagementPage.js +0 -912
  87. package/dist/hookmovies/pages/cart-owner/InventoryManagementPage.js.map +0 -1
  88. package/dist/hookmovies/pages/cart-owner/OrderManagementPage.js +0 -913
  89. package/dist/hookmovies/pages/cart-owner/OrderManagementPage.js.map +0 -1
  90. package/dist/hookmovies/pages/cart-owner/StaffManagementPage.js +0 -832
  91. package/dist/hookmovies/pages/cart-owner/StaffManagementPage.js.map +0 -1
  92. package/dist/hookmovies/pages/common/HelpSupportPage.js +0 -1321
  93. package/dist/hookmovies/pages/common/HelpSupportPage.js.map +0 -1
  94. package/dist/hookmovies/pages/common/NotificationCenterPage.js +0 -666
  95. package/dist/hookmovies/pages/common/NotificationCenterPage.js.map +0 -1
  96. package/dist/hookmovies/pages/common/SettingsPage.js +0 -965
  97. package/dist/hookmovies/pages/common/SettingsPage.js.map +0 -1
  98. package/dist/hookmovies/pages/customer/BookingDetailsPage.js +0 -622
  99. package/dist/hookmovies/pages/customer/BookingDetailsPage.js.map +0 -1
  100. package/dist/hookmovies/pages/customer/CartDetailPage.js +0 -653
  101. package/dist/hookmovies/pages/customer/CartDetailPage.js.map +0 -1
  102. package/dist/hookmovies/pages/customer/CartDiscoveryPage.js +0 -557
  103. package/dist/hookmovies/pages/customer/CartDiscoveryPage.js.map +0 -1
  104. package/dist/hookmovies/pages/customer/CheckoutPage.js +0 -526
  105. package/dist/hookmovies/pages/customer/CheckoutPage.js.map +0 -1
  106. package/dist/hookmovies/pages/customer/CustomerDashboard.js +0 -537
  107. package/dist/hookmovies/pages/customer/CustomerDashboard.js.map +0 -1
  108. package/dist/hookmovies/pages/customer/CustomerProfilePage.js +0 -623
  109. package/dist/hookmovies/pages/customer/CustomerProfilePage.js.map +0 -1
  110. package/dist/hookmovies/pages/customer/DirectServiceBookingPage.js +0 -627
  111. package/dist/hookmovies/pages/customer/DirectServiceBookingPage.js.map +0 -1
  112. package/dist/hookmovies/pages/customer/FavoritesPage.js +0 -479
  113. package/dist/hookmovies/pages/customer/FavoritesPage.js.map +0 -1
  114. package/dist/hookmovies/pages/customer/OrderHistoryPage.js +0 -442
  115. package/dist/hookmovies/pages/customer/OrderHistoryPage.js.map +0 -1
  116. package/dist/hookmovies/pages/customer/OrderTrackingPage.js +0 -390
  117. package/dist/hookmovies/pages/customer/OrderTrackingPage.js.map +0 -1
  118. package/dist/hookmovies/pages/customer/PaymentMethodsPage.js +0 -490
  119. package/dist/hookmovies/pages/customer/PaymentMethodsPage.js.map +0 -1
  120. package/dist/hookmovies/pages/customer/ReviewsPage.js +0 -607
  121. package/dist/hookmovies/pages/customer/ReviewsPage.js.map +0 -1
  122. package/dist/hookmovies/pages/customer/SavedAddressesPage.js +0 -450
  123. package/dist/hookmovies/pages/customer/SavedAddressesPage.js.map +0 -1
  124. package/dist/hookmovies/pages/investor/InvestmentDetailsPage.js +0 -880
  125. package/dist/hookmovies/pages/investor/InvestmentDetailsPage.js.map +0 -1
  126. package/dist/hookmovies/pages/investor/InvestmentOpportunitiesPage.js +0 -940
  127. package/dist/hookmovies/pages/investor/InvestmentOpportunitiesPage.js.map +0 -1
  128. package/dist/hookmovies/pages/investor/InvestorAnalyticsPage.js +0 -683
  129. package/dist/hookmovies/pages/investor/InvestorAnalyticsPage.js.map +0 -1
  130. package/dist/hookmovies/pages/investor/InvestorDashboard.js +0 -457
  131. package/dist/hookmovies/pages/investor/InvestorDashboard.js.map +0 -1
  132. package/dist/hookmovies/pages/investor/InvestorInvestmentsPage.js +0 -401
  133. package/dist/hookmovies/pages/investor/InvestorInvestmentsPage.js.map +0 -1
  134. package/dist/hookmovies/pages/investor/InvestorPortfolioPage.js +0 -571
  135. package/dist/hookmovies/pages/investor/InvestorPortfolioPage.js.map +0 -1
  136. package/dist/hookmovies/pages/investor/InvestorProfilePage.js +0 -1067
  137. package/dist/hookmovies/pages/investor/InvestorProfilePage.js.map +0 -1
  138. package/dist/hookmovies/pages/worker/TaskDetailsPage.js +0 -528
  139. package/dist/hookmovies/pages/worker/TaskDetailsPage.js.map +0 -1
  140. package/dist/hookmovies/pages/worker/WorkerDashboard.js +0 -670
  141. package/dist/hookmovies/pages/worker/WorkerDashboard.js.map +0 -1
  142. package/dist/hookmovies/pages/worker/WorkerOrdersPage.js +0 -676
  143. package/dist/hookmovies/pages/worker/WorkerOrdersPage.js.map +0 -1
  144. package/dist/hookmovies/pages/worker/WorkerProfilePage.js +0 -689
  145. package/dist/hookmovies/pages/worker/WorkerProfilePage.js.map +0 -1
  146. package/dist/hookmovies/pages/worker/WorkerSchedulePage.js +0 -579
  147. package/dist/hookmovies/pages/worker/WorkerSchedulePage.js.map +0 -1
  148. package/dist/hookmovies/store/hookmoviesStore.js +0 -38
  149. package/dist/hookmovies/store/hookmoviesStore.js.map +0 -1
  150. package/dist/hookmovies/store/index.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useHookMoviesApi.js","names":[],"sources":["../../../src/hookmovies/hooks/useHookMoviesApi.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useHookMovies } from '../context';\nimport type {\n MockCart,\n MockOrder,\n InvestmentOpportunity,\n Investment,\n DashboardStats,\n AdminAnalytics,\n WorkerTask,\n} from '../types';\n\nconst hookmoviesQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'GraphQL request failed');\n }\n\n if (!response.data) {\n throw new Error('GraphQL response did not include data');\n }\n\n return response.data;\n};\n\n// ============================================================================\n// Service Providers (Carts)\n// ============================================================================\n\nexport const useProviders = (query?: string) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'providers', query],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ listServiceProviders: any[] }>(\n `query Providers($filter: HookMoviesProviderFilterInput) {\n listServiceProviders(filter: $filter, limit: 200) {\n id name slug category status rating totalRatings averageOrderValue serviceTypes location businessHours createdAt\n }\n }`,\n {\n filter: query\n ? {\n query,\n }\n : undefined,\n },\n apiGatewayUrl\n );\n\n return result.listServiceProviders.map((p) => ({\n ...p,\n image: `https://images.unsplash.com/photo-1567620905732-2d1ec7ab7445?w=400`, // Placeholder\n images: [`https://images.unsplash.com/photo-1567620905732-2d1ec7ab7445?w=400`],\n isOpen: p.status === 'ACTIVE' || p.status === 'VERIFIED',\n isVerified: p.status === 'VERIFIED',\n distance: 0.5, // Mock\n estimatedTime: 20, // Mock\n createdAt: p.createdAt,\n })) as MockCart[];\n },\n });\n};\n\nexport const useOfferings = (providerId?: string) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'offerings', providerId],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ listOfferings: any[] }>(\n `query Offerings($providerId: String) {\n listOfferings(providerId: $providerId, limit: 300) {\n id providerId kind name slug category description price originalPrice stock durationMinutes serviceType tags isAvailable metadata media\n }\n }`,\n { providerId },\n apiGatewayUrl\n );\n return result.listOfferings;\n },\n enabled: Boolean(providerId),\n });\n};\n\n// ============================================================================\n// Orders\n// ============================================================================\n\nexport const useOrders = (input: { providerId?: string; customerId?: string } = {}) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'orders', input.providerId, input.customerId],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ listOrders: any[] }>(\n `query Orders($providerId: String, $customerId: String) {\n listOrders(providerId: $providerId, customerId: $customerId, limit: 200) {\n id orderNumber providerId customerId status paymentStatus fulfillmentType subtotal tax deliveryFee discount total notes timeline paymentMethod deliveryAddress createdAt\n provider { name }\n items { id offeringId name quantity unitPrice totalPrice customizations }\n }\n }`,\n input,\n apiGatewayUrl\n );\n\n return result.listOrders.map((o) => ({\n id: o.id,\n cartId: o.providerId,\n cartName: o.provider?.name || 'Unknown Cart',\n cartImage: `https://images.unsplash.com/photo-1567620905732-2d1ec7ab7445?w=100`, // Placeholder\n items: o.items.map((i: any) => ({\n id: i.id,\n name: i.name,\n quantity: i.quantity,\n price: i.unitPrice,\n customizations: i.customizations,\n })),\n total: o.total,\n subtotal: o.subtotal,\n taxes: o.tax,\n deliveryFee: o.deliveryFee,\n discount: o.discount,\n status: o.status.toLowerCase(),\n orderDate: o.createdAt,\n deliveryAddress: o.deliveryAddress,\n paymentMethod: o.paymentMethod || 'Cash',\n paymentStatus: o.paymentStatus.toLowerCase(),\n timeline: o.timeline || [],\n })) as MockOrder[];\n },\n });\n};\n\n// ============================================================================\n// Analytics & Stats\n// ============================================================================\n\nexport const useDashboardStats = () => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'dashboard-stats'],\n queryFn: async () => {\n const result = await hookmoviesQuery<{\n hookmoviesDashboardStats: DashboardStats;\n }>(\n `query DashboardStats { hookmoviesDashboardStats { totalOrders totalRevenue activeProviders activeCustomers avgRating pendingOrders } }`,\n {},\n apiGatewayUrl\n );\n return result.hookmoviesDashboardStats;\n },\n });\n};\n\nexport const useAdminAnalytics = () => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'admin-analytics'],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hookmoviesAdminAnalytics: AdminAnalytics }>(\n `query AdminAnalytics { hookmoviesAdminAnalytics { revenueByCategory orderTrends topProviders customerGrowth categoryDistribution } }`,\n {},\n apiGatewayUrl\n );\n return result.hookmoviesAdminAnalytics;\n },\n });\n};\n\n// ============================================================================\n// Investments\n// ============================================================================\n\nexport const useInvestmentOpportunities = () => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'investment-opportunities'],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ listInvestmentOpportunities: any[] }>(\n `query Opportunities {\n listInvestmentOpportunities(limit: 200) {\n id providerId title description targetAmount raisedAmount minimumInvestment expectedReturnsPct lockInMonths riskLevel status expiresAt terms businessMetrics createdAt\n provider { name }\n }\n }`,\n {},\n apiGatewayUrl\n );\n\n return result.listInvestmentOpportunities.map((o) => ({\n id: o.id,\n cartId: o.providerId,\n cartName: o.provider?.name || 'Unknown Cart',\n businessOwner: 'Owner', // Mock\n targetAmount: o.targetAmount,\n raisedAmount: o.raisedAmount,\n minimumInvestment: o.minimumInvestment,\n expectedReturns: o.expectedReturnsPct,\n investmentPeriod: o.lockInMonths,\n riskLevel: o.riskLevel.toLowerCase(),\n description: o.description,\n businessPlan: '',\n financialProjections: [],\n documents: [],\n investors: [],\n status: o.status.toLowerCase(),\n createdAt: o.createdAt,\n expiresAt: o.expiresAt,\n })) as InvestmentOpportunity[];\n },\n });\n};\n\nexport const useInvestments = (investorId: string) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'investments', investorId],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ listInvestments: any[] }>(\n `query Investments($investorId: String!) {\n listInvestments(investorId: $investorId) {\n id opportunityId amount currentValue expectedReturnsPct status investedAt maturedAt realizedReturns\n opportunity { provider { name } }\n }\n }`,\n { investorId },\n apiGatewayUrl\n );\n\n return result.listInvestments.map((i) => ({\n id: i.id,\n opportunityId: i.opportunityId,\n cartName: i.opportunity?.provider?.name || 'Unknown Cart',\n investedAmount: i.amount,\n currentValue: i.currentValue,\n returns: i.realizedReturns,\n returnsPercentage: i.expectedReturnsPct,\n investmentDate: i.investedAt,\n status: i.status.toLowerCase(),\n })) as Investment[];\n },\n enabled: Boolean(investorId),\n });\n};\n\n// ============================================================================\n// Workers & Tasks\n// ============================================================================\n\nexport const useWorkerTasks = (workerId: string) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'worker-tasks', workerId],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ listWorkerTasks: any[] }>(\n `query WorkerTasks($workerId: String!) {\n listWorkerTasks(workerId: $workerId, limit: 100) {\n id orderId providerId type description priority status assignedAt dueAt completedAt customerName customerPhone earnings distance notes\n provider { name }\n order { deliveryAddress }\n }\n }`,\n { workerId },\n apiGatewayUrl\n );\n\n return result.listWorkerTasks.map((t) => ({\n id: t.id,\n orderId: t.orderId,\n cartId: t.providerId,\n cartName: t.provider?.name || 'Unknown Cart',\n type: t.type.toLowerCase(),\n description: t.description,\n priority: t.priority.toLowerCase(),\n status: t.status.toLowerCase(),\n assignedAt: t.assignedAt,\n dueAt: t.dueAt,\n completedAt: t.completedAt,\n customerName: t.customerName,\n customerPhone: t.customerPhone,\n deliveryAddress: t.order?.deliveryAddress,\n earnings: t.earnings,\n distance: t.distance,\n notes: t.notes,\n })) as WorkerTask[];\n },\n enabled: Boolean(workerId),\n });\n};\n\nexport const useWorkerStats = (workerId: string) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'worker-stats', workerId],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hookmoviesWorkerStats: any }>(\n `query WorkerStats($workerId: String!) {\n hookmoviesWorkerStats(workerId: $workerId) {\n totalDeliveries totalEarnings averageRating completionRate todayTasks todayEarnings\n }\n }`,\n { workerId },\n apiGatewayUrl\n );\n return result.hookmoviesWorkerStats;\n },\n enabled: Boolean(workerId),\n });\n};\n\nexport const useWorkerSchedules = (workerId: string) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'worker-schedules', workerId],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ listWorkerSchedules: any[] }>(\n `query WorkerSchedules($workerId: String!) {\n listWorkerSchedules(workerId: $workerId) {\n id date startTime endTime providerId status tasksCompleted totalEarnings\n provider { name }\n }\n }`,\n { workerId },\n apiGatewayUrl\n );\n\n return result.listWorkerSchedules.map((s) => ({\n id: s.id,\n date: s.date,\n startTime: s.startTime,\n endTime: s.endTime,\n cartId: s.providerId,\n cartName: s.provider?.name || 'Unknown Cart',\n status: s.status.toLowerCase(),\n tasksCompleted: s.tasksCompleted,\n totalEarnings: s.totalEarnings,\n }));\n },\n enabled: Boolean(workerId),\n });\n};\n\n// ============================================================================\n// Reviews\n// ============================================================================\n\nexport const useReviews = (providerId: string) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'reviews', providerId],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ listReviews: any[] }>(\n `query Reviews($providerId: String!) {\n listReviews(providerId: $providerId) {\n id providerId customerId rating review response createdAt updatedAt\n }\n }`,\n { providerId },\n apiGatewayUrl\n );\n return result.listReviews;\n },\n enabled: Boolean(providerId),\n });\n};\n\n// ============================================================================\n// Mutations\n// ============================================================================\n\nexport const usePlaceOrder = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n\n return useMutation({\n mutationFn: async (input: Record<string, unknown>) => {\n const result = await hookmoviesQuery<{ placeOrder: any }>(\n `mutation PlaceOrder($input: HookMoviesPlaceOrderInput!) {\n placeOrder(input: $input) {\n id orderNumber status total createdAt\n }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.placeOrder;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['hookmovies', 'orders'] });\n void queryClient.invalidateQueries({ queryKey: ['hookmovies', 'dashboard-stats'] });\n },\n });\n};\n\nexport const useCreateProvider = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n\n return useMutation({\n mutationFn: async (input: Record<string, unknown>) => {\n const result = await hookmoviesQuery<{ hookmoviesCreateServiceProvider: any }>(\n `mutation CreateProvider($input: HookMoviesCreateServiceProviderInput!) {\n hookmoviesCreateServiceProvider(input: $input) {\n id name slug status category location rating\n }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.hookmoviesCreateServiceProvider;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['hookmovies', 'providers'] });\n void queryClient.invalidateQueries({ queryKey: ['hookmovies', 'dashboard-stats'] });\n },\n });\n};\n\nexport const useUpdateWorkerTaskStatus = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n\n return useMutation({\n mutationFn: async ({ taskId, status }: { taskId: string; status: string }) => {\n const result = await hookmoviesQuery<{ hookmoviesUpdateWorkerTaskStatus: any }>(\n `mutation UpdateTaskStatus($taskId: String!, $status: HookMoviesWorkerTaskStatus!) {\n hookmoviesUpdateWorkerTaskStatus(taskId: $taskId, status: $status) {\n id status\n }\n }`,\n { taskId, status },\n apiGatewayUrl\n );\n return result.hookmoviesUpdateWorkerTaskStatus;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['hookmovies', 'worker-tasks'] });\n void queryClient.invalidateQueries({ queryKey: ['hookmovies', 'worker-stats'] });\n },\n });\n};\n\nexport const useWorkerClockInOut = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n\n return useMutation({\n mutationFn: async ({\n workerId,\n action,\n }: {\n workerId: string;\n action: 'CLOCK_IN' | 'CLOCK_OUT';\n }) => {\n const result = await hookmoviesQuery<{ hookmoviesWorkerClockInOut: any }>(\n `mutation ClockInOut($workerId: String!, $action: HookMoviesClockAction!) {\n hookmoviesWorkerClockInOut(workerId: $workerId, action: $action) {\n success message\n }\n }`,\n { workerId, action },\n apiGatewayUrl\n );\n return result.hookmoviesWorkerClockInOut;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['hookmovies', 'worker-schedules'] });\n },\n });\n};\n\n// ============================================================================\n// Main Hook\n// ============================================================================\n\nexport const useHookMoviesApi = () => {\n const { currentUser } = useHookMovies();\n const providers = useProviders();\n const orders = useOrders({ customerId: currentUser?.id });\n const dashboardStats = useDashboardStats();\n const investmentOpportunities = useInvestmentOpportunities();\n const investments = useInvestments(currentUser?.id || '');\n\n return useMemo(\n () => ({\n providers,\n orders,\n dashboardStats,\n investmentOpportunities,\n investments,\n }),\n [providers, orders, dashboardStats, investmentOpportunities, investments]\n );\n};\n"],"mappings":";;;;;;AAgBA,IAAM,IAAkB,OACtB,GACA,GACA,MACmB;CACnB,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;EACjB,CAAC;AAEF,KAAI,EAAS,QAAQ,OACnB,OAAU,MAAM,EAAS,OAAO,IAAI,WAAW,yBAAyB;AAG1E,KAAI,CAAC,EAAS,KACZ,OAAU,MAAM,wCAAwC;AAG1D,QAAO,EAAS;GAOL,KAAgB,MAAmB;CAC9C,IAAM,EAAE,qBAAkB,GAAe;AACzC,QAAO,EAAS;EACd,UAAU;GAAC;GAAc;GAAa;GAAM;EAC5C,SAAS,aACQ,MAAM,EACnB,kRAKA,EACE,QAAQ,IACJ,EACE,UACD,GACD,KAAA,GACL,EACD,EACD,EAEa,qBAAqB,KAAK,OAAO;GAC7C,GAAG;GACH,OAAO;GACP,QAAQ,CAAC,qEAAqE;GAC9E,QAAQ,EAAE,WAAW,YAAY,EAAE,WAAW;GAC9C,YAAY,EAAE,WAAW;GACzB,UAAU;GACV,eAAe;GACf,WAAW,EAAE;GACd,EAAE;EAEN,CAAC;GAGS,KAAgB,MAAwB;CACnD,IAAM,EAAE,qBAAkB,GAAe;AACzC,QAAO,EAAS;EACd,UAAU;GAAC;GAAc;GAAa;GAAW;EACjD,SAAS,aACQ,MAAM,EACnB,uRAKA,EAAE,eAAY,EACd,EACD,EACa;EAEhB,SAAS,EAAQ;EAClB,CAAC;GAOS,KAAa,IAAsD,EAAE,KAAK;CACrF,IAAM,EAAE,qBAAkB,GAAe;AACzC,QAAO,EAAS;EACd,UAAU;GAAC;GAAc;GAAU,EAAM;GAAY,EAAM;GAAW;EACtE,SAAS,aACQ,MAAM,EACnB,sdAOA,GACA,EACD,EAEa,WAAW,KAAK,OAAO;GACnC,IAAI,EAAE;GACN,QAAQ,EAAE;G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oviesApi.ts"],"sourcesContent":["/**\n * HookMovies API hooks\n * @module hookmovies/hooks\n *\n * Real data layer for the HookMovies workspace subgraph (`hookmovies` Hive\n * service / `wspace-hookmovies-svc`). Every hook talks to the live workspace\n * GraphQL gateway via {@link graphqlFetch} with inline operations whose fields\n * mirror `.hive-schema.graphql` exactly. No mocks.\n *\n * Conventions (mirrors microfe-kadaikodi):\n * - `hookmoviesQuery` wraps graphqlFetch({ gateway: 'workspace', workspaceToken: true })\n * and throws on GraphQL errors / missing data.\n * - One react-query `useQuery` per read op and `useMutation` per write op.\n * - Strict hand-written result interfaces — no `any`.\n * - Pagination uses the subgraph's `PaginationInput` (limit/offset/cursor) and\n * `Hok*Connection { items, pageInfo { cursor hasMore } }` shapes verbatim.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useHookMovies } from '../context';\n\n// ============================================================================\n// Low-level query runner\n// ============================================================================\n\nconst hookmoviesQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'GraphQL request failed');\n }\n\n if (!response.data) {\n throw new Error('GraphQL response did not include data');\n }\n\n return response.data;\n};\n\nconst QK = 'hookmovies' as const;\n\n// ============================================================================\n// Shared scalar / enum types (mirror .hive-schema.graphql)\n// ============================================================================\n\nexport interface HokPaginationInput {\n cursor?: string | null;\n limit?: number | null;\n offset?: number | null;\n}\n\nexport interface HokPageInfo {\n cursor: string | null;\n hasMore: boolean;\n}\n\nexport type HokTitleType =\n | 'MOVIE'\n | 'SERIES'\n | 'SHORT_FILM'\n | 'DOCUMENTARY'\n | 'ANIME'\n | 'SHORT_FORM'\n | 'LONG_FORM'\n | 'LIVE_EVENT'\n | 'TRAILER'\n | 'COLLECTION'\n | 'FAST_CHANNEL';\n\nexport type HokTitleStatus =\n | 'DRAFT'\n | 'IN_REVIEW'\n | 'SCHEDULED'\n | 'PUBLISHED'\n | 'UNPUBLISHED'\n | 'ARCHIVED';\n\nexport type HokProductionStatus =\n | 'DEVELOPMENT'\n | 'GREENLIT'\n | 'IN_PRODUCTION'\n | 'POST_PRODUCTION'\n | 'RELEASED'\n | 'SHELVED';\n\nexport type HokAuditionStatus = 'OPEN' | 'REVIEWING' | 'CALLBACKS' | 'CLOSED' | 'CANCELLED';\n\nexport type HokApplicationStatus =\n | 'SUBMITTED'\n | 'SHORTLISTED'\n | 'CALLBACK'\n | 'OFFERED'\n | 'REJECTED'\n | 'WITHDRAWN';\n\nexport type HokCreditRole =\n | 'ACTOR'\n | 'DIRECTOR'\n | 'WRITER'\n | 'PRODUCER'\n | 'CINEMATOGRAPHER'\n | 'EDITOR'\n | 'COMPOSER'\n | 'VOICE_ACTOR'\n | 'CREW';\n\nexport type HokReviewStatus = 'PENDING' | 'PUBLISHED' | 'HIDDEN' | 'REMOVED';\n\nexport type HokRightsWindowStatus = 'DRAFT' | 'PENDING' | 'ACTIVE' | 'EXPIRED' | 'REVOKED';\n\nexport type HokMonetizationMode =\n | 'FREE_AVOD'\n | 'SVOD'\n | 'TVOD_RENT'\n | 'TVOD_BUY'\n | 'PPV'\n | 'FAST';\n\nexport type HokEntitlementSource = 'SUBSCRIPTION' | 'PURCHASE' | 'RENTAL' | 'PROMO' | 'FREE';\n\nexport type HokEntitlementStatus = 'ACTIVE' | 'EXPIRED' | 'REVOKED';\n\nexport type HokListKind = 'WATCHLIST' | 'PLAYLIST';\n\nexport type HokListVisibility = 'PRIVATE' | 'UNLISTED' | 'PUBLIC';\n\n// ============================================================================\n// Domain object types\n// ============================================================================\n\nexport interface HokStudio {\n id: string;\n name: string;\n slug: string | null;\n description: string | null;\n country: string | null;\n websiteUrl: string | null;\n isVerified: boolean;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface HokPerson {\n id: string;\n name: string;\n biography: string | null;\n knownFor: string | null;\n primaryLanguage: string | null;\n portfolioRef: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface HokCredit {\n id: string;\n personId: string;\n titleId: string;\n role: HokCreditRole;\n characterName: string | null;\n billingOrder: number;\n person: Pick<HokPerson, 'id' | 'name' | 'knownFor'> | null;\n}\n\nexport interface HokEpisodeSummary {\n id: string;\n name: string;\n number: number;\n seasonId: string | null;\n synopsis: string | null;\n runtimeMinutes: number | null;\n airDate: string | null;\n}\n\nexport interface HokSeasonSummary {\n id: string;\n name: string | null;\n number: number;\n synopsis: string | null;\n}\n\nexport interface HokTitle {\n id: string;\n title: string;\n slug: string | null;\n type: HokTitleType;\n status: HokTitleStatus;\n synopsis: string | null;\n genres: string[];\n tags: string[];\n originalLanguage: string | null;\n originCountry: string | null;\n releaseYear: number | null;\n releaseDate: string | null;\n runtimeMinutes: number | null;\n certification: string | null;\n aiDisclosure: boolean;\n studioId: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface HokTitleDetail extends HokTitle {\n studio: Pick<HokStudio, 'id' | 'name'> | null;\n credits: HokCredit[];\n seasons: HokSeasonSummary[];\n episodes: HokEpisodeSummary[];\n}\n\nexport interface HokProduction {\n id: string;\n title: string;\n logline: string | null;\n synopsis: string | null;\n status: HokProductionStatus;\n currency: string;\n budgetMinorUnits: string;\n studioId: string | null;\n producerId: string | null;\n resultingTitleId: string | null;\n artistrybaseProjectRef: string | null;\n tags: string[];\n startDate: string | null;\n endDate: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface HokAuditionSummary {\n id: string;\n roleName: string;\n status: HokAuditionStatus;\n isMinorRole: boolean;\n payMinorUnits: string;\n currency: string;\n location: string | null;\n language: string | null;\n submissionDeadline: string | null;\n}\n\nexport interface HokProductionDetail extends HokProduction {\n auditions: HokAuditionSummary[];\n}\n\nexport interface HokAudition {\n id: string;\n productionId: string;\n roleName: string;\n description: string | null;\n status: HokAuditionStatus;\n isMinorRole: boolean;\n payMinorUnits: string;\n currency: string;\n location: string | null;\n language: string | null;\n submissionDeadline: string | null;\n createdAt: string;\n updatedAt: string;\n production: Pick<HokProduction, 'id' | 'title'> | null;\n}\n\nexport interface HokApplication {\n id: string;\n auditionId: string;\n applicantId: string;\n coverNote: string | null;\n score: number | null;\n status: HokApplicationStatus;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface HokReview {\n id: string;\n titleId: string;\n authorId: string;\n score: number;\n body: string | null;\n hasSpoilers: boolean;\n helpfulCount: number;\n verifiedWatch: boolean;\n status: HokReviewStatus;\n createdAt: string;\n updatedAt: string;\n title: Pick<HokTitle, 'id' | 'title'> | null;\n}\n\nexport interface HokRightsWindow {\n id: string;\n titleId: string;\n status: HokRightsWindowStatus;\n modes: HokMonetizationMode[];\n territories: string[];\n exclusive: boolean;\n currency: string;\n licenseeId: string | null;\n startsAt: string | null;\n endsAt: string | null;\n createdAt: string;\n updatedAt: string;\n title: Pick<HokTitle, 'id' | 'title'> | null;\n}\n\nexport interface HokEntitlement {\n id: string;\n titleId: string;\n userId: string;\n mode: HokMonetizationMode;\n source: HokEntitlementSource;\n status: HokEntitlementStatus;\n territory: string | null;\n expiresAt: string | null;\n createdAt: string;\n updatedAt: string;\n title: Pick<HokTitle, 'id' | 'title'> | null;\n}\n\nexport interface HokList {\n id: string;\n name: string;\n description: string | null;\n kind: HokListKind;\n visibility: HokListVisibility;\n ownerId: string;\n itemCount: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface HokWatchProgress {\n id: string;\n titleId: string;\n episodeId: string | null;\n positionSeconds: number;\n completed: boolean;\n lastDevice: string | null;\n updatedAt: string;\n title: Pick<HokTitle, 'id' | 'title' | 'type'> | null;\n}\n\n// ============================================================================\n// Connection wrappers\n// ============================================================================\n\ninterface HokConnection<TItem> {\n items: TItem[];\n pageInfo: HokPageInfo;\n}\n\n// ============================================================================\n// Inline field selections (reused across ops)\n// ============================================================================\n\nconst TITLE_FIELDS = `\n id title slug type status synopsis genres tags originalLanguage originCountry\n releaseYear releaseDate runtimeMinutes certification aiDisclosure studioId\n createdAt updatedAt\n`;\n\nconst STUDIO_FIELDS = `\n id name slug description country websiteUrl isVerified tags createdAt updatedAt\n`;\n\nconst PERSON_FIELDS = `\n id name biography knownFor primaryLanguage portfolioRef tags createdAt updatedAt\n`;\n\nconst PRODUCTION_FIELDS = `\n id title logline synopsis status currency budgetMinorUnits studioId producerId\n resultingTitleId artistrybaseProjectRef tags startDate endDate createdAt updatedAt\n`;\n\nconst AUDITION_FIELDS = `\n id productionId roleName description status isMinorRole payMinorUnits currency\n location language submissionDeadline createdAt updatedAt\n`;\n\nconst REVIEW_FIELDS = `\n id titleId authorId score body hasSpoilers helpfulCount verifiedWatch status\n createdAt updatedAt\n`;\n\nconst RIGHTS_FIELDS = `\n id titleId status modes territories exclusive currency licenseeId startsAt endsAt\n createdAt updatedAt\n`;\n\nconst LIST_FIELDS = `\n id name description kind visibility ownerId itemCount createdAt updatedAt\n`;\n\nconst PAGE_INFO = `pageInfo { cursor hasMore }`;\n\n// ============================================================================\n// Titles\n// ============================================================================\n\nexport interface HokTitleFilters {\n status?: HokTitleStatus;\n type?: HokTitleType;\n studioId?: string;\n}\n\nexport const useTitles = (\n filters: HokTitleFilters = {},\n pagination: HokPaginationInput = { limit: 50, offset: 0 }\n) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'titles', filters, pagination],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokListTitles: HokConnection<HokTitle> }>(\n `query HokTitles($pagination: PaginationInput, $status: HokTitleStatus, $type: HokTitleType, $studioId: ID) {\n hokListTitles(pagination: $pagination, status: $status, type: $type, studioId: $studioId) {\n items { ${TITLE_FIELDS} }\n ${PAGE_INFO}\n }\n }`,\n {\n pagination,\n status: filters.status,\n type: filters.type,\n studioId: filters.studioId,\n },\n apiGatewayUrl\n );\n return result.hokListTitles;\n },\n });\n};\n\nexport const useTitle = (id: string | undefined) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'title', id],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokTitle: HokTitleDetail | null }>(\n `query HokTitle($id: ID!) {\n hokTitle(id: $id) {\n ${TITLE_FIELDS}\n studio { id name }\n credits {\n id personId titleId role characterName billingOrder\n person { id name knownFor }\n }\n seasons { id name number synopsis }\n episodes { id name number seasonId synopsis runtimeMinutes airDate }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.hokTitle;\n },\n enabled: Boolean(id),\n });\n};\n\nexport interface CreateTitleInput {\n title: string;\n type?: HokTitleType;\n synopsis?: string;\n genres?: string[];\n tags?: string[];\n originalLanguage?: string;\n originCountry?: string;\n releaseYear?: number;\n runtimeMinutes?: number;\n certification?: string;\n slug?: string;\n studioId?: string;\n aiDisclosure?: boolean;\n}\n\nexport const useCreateTitle = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (input: CreateTitleInput) => {\n const result = await hookmoviesQuery<{ hokCreateTitle: HokTitle }>(\n `mutation HokCreateTitle($input: HokCreateTitleInput!) {\n hokCreateTitle(input: $input) { ${TITLE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.hokCreateTitle;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'titles'] });\n },\n });\n};\n\nexport interface UpdateTitleInput {\n title?: string;\n type?: HokTitleType;\n synopsis?: string;\n genres?: string[];\n tags?: string[];\n originalLanguage?: string;\n originCountry?: string;\n releaseYear?: number;\n runtimeMinutes?: number;\n certification?: string;\n slug?: string;\n studioId?: string;\n aiDisclosure?: boolean;\n}\n\nexport const useUpdateTitle = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: UpdateTitleInput }) => {\n const result = await hookmoviesQuery<{ hokUpdateTitle: HokTitle }>(\n `mutation HokUpdateTitle($id: ID!, $input: HokUpdateTitleInput!) {\n hokUpdateTitle(id: $id, input: $input) { ${TITLE_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return result.hokUpdateTitle;\n },\n onSuccess: (data) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'titles'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'title', data.id] });\n },\n });\n};\n\nexport const useTransitionTitle = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: HokTitleStatus }) => {\n const result = await hookmoviesQuery<{ hokTransitionTitle: HokTitle }>(\n `mutation HokTransitionTitle($id: ID!, $status: HokTitleStatus!) {\n hokTransitionTitle(id: $id, status: $status) { ${TITLE_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return result.hokTransitionTitle;\n },\n onSuccess: (data) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'titles'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'title', data.id] });\n },\n });\n};\n\nexport const useArchiveTitle = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await hookmoviesQuery<{ hokArchiveTitle: boolean }>(\n `mutation HokArchiveTitle($id: ID!) { hokArchiveTitle(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return result.hokArchiveTitle;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'titles'] });\n },\n });\n};\n\n// ============================================================================\n// Studios\n// ============================================================================\n\nexport const useStudios = (pagination: HokPaginationInput = { limit: 50, offset: 0 }) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'studios', pagination],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokListStudios: HokConnection<HokStudio> }>(\n `query HokStudios($pagination: PaginationInput) {\n hokListStudios(pagination: $pagination) {\n items { ${STUDIO_FIELDS} }\n ${PAGE_INFO}\n }\n }`,\n { pagination },\n apiGatewayUrl\n );\n return result.hokListStudios;\n },\n });\n};\n\nexport interface CreateStudioInput {\n name: string;\n slug?: string;\n description?: string;\n country?: string;\n websiteUrl?: string;\n tags?: string[];\n}\n\nexport const useCreateStudio = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (input: CreateStudioInput) => {\n const result = await hookmoviesQuery<{ hokCreateStudio: HokStudio }>(\n `mutation HokCreateStudio($input: HokCreateStudioInput!) {\n hokCreateStudio(input: $input) { ${STUDIO_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.hokCreateStudio;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'studios'] });\n },\n });\n};\n\n// ============================================================================\n// People\n// ============================================================================\n\nexport const usePeople = (pagination: HokPaginationInput = { limit: 50, offset: 0 }) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'people', pagination],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokListPeople: HokConnection<HokPerson> }>(\n `query HokPeople($pagination: PaginationInput) {\n hokListPeople(pagination: $pagination) {\n items { ${PERSON_FIELDS} }\n ${PAGE_INFO}\n }\n }`,\n { pagination },\n apiGatewayUrl\n );\n return result.hokListPeople;\n },\n });\n};\n\nexport interface CreatePersonInput {\n name: string;\n biography?: string;\n knownFor?: string;\n primaryLanguage?: string;\n portfolioRef?: string;\n tags?: string[];\n}\n\nexport const useCreatePerson = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (input: CreatePersonInput) => {\n const result = await hookmoviesQuery<{ hokCreatePerson: HokPerson }>(\n `mutation HokCreatePerson($input: HokCreatePersonInput!) {\n hokCreatePerson(input: $input) { ${PERSON_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.hokCreatePerson;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'people'] });\n },\n });\n};\n\n// ============================================================================\n// Productions\n// ============================================================================\n\nexport interface HokProductionFilters {\n status?: HokProductionStatus;\n studioId?: string;\n}\n\nexport const useProductions = (\n filters: HokProductionFilters = {},\n pagination: HokPaginationInput = { limit: 50, offset: 0 }\n) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'productions', filters, pagination],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokListProductions: HokConnection<HokProduction> }>(\n `query HokProductions($pagination: PaginationInput, $status: HokProductionStatus, $studioId: ID) {\n hokListProductions(pagination: $pagination, status: $status, studioId: $studioId) {\n items { ${PRODUCTION_FIELDS} }\n ${PAGE_INFO}\n }\n }`,\n { pagination, status: filters.status, studioId: filters.studioId },\n apiGatewayUrl\n );\n return result.hokListProductions;\n },\n });\n};\n\nexport const useProduction = (id: string | undefined) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'production', id],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokProduction: HokProductionDetail | null }>(\n `query HokProduction($id: ID!) {\n hokProduction(id: $id) {\n ${PRODUCTION_FIELDS}\n auditions {\n id roleName status isMinorRole payMinorUnits currency location language submissionDeadline\n }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.hokProduction;\n },\n enabled: Boolean(id),\n });\n};\n\nexport interface CreateProductionInput {\n title: string;\n logline?: string;\n synopsis?: string;\n currency?: string;\n budgetMinorUnits?: string;\n studioId?: string;\n producerId?: string;\n artistrybaseProjectRef?: string;\n tags?: string[];\n startDate?: string;\n endDate?: string;\n}\n\nexport const useCreateProduction = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (input: CreateProductionInput) => {\n const result = await hookmoviesQuery<{ hokCreateProduction: HokProduction }>(\n `mutation HokCreateProduction($input: HokCreateProductionInput!) {\n hokCreateProduction(input: $input) { ${PRODUCTION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.hokCreateProduction;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'productions'] });\n },\n });\n};\n\nexport const useTransitionProduction = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: HokProductionStatus }) => {\n const result = await hookmoviesQuery<{ hokTransitionProduction: HokProduction }>(\n `mutation HokTransitionProduction($id: ID!, $status: HokProductionStatus!) {\n hokTransitionProduction(id: $id, status: $status) { ${PRODUCTION_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return result.hokTransitionProduction;\n },\n onSuccess: (data) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'productions'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'production', data.id] });\n },\n });\n};\n\n// ============================================================================\n// Auditions & Applications\n// ============================================================================\n\nexport interface HokAuditionFilters {\n status?: HokAuditionStatus;\n productionId?: string;\n}\n\nexport const useAuditions = (\n filters: HokAuditionFilters = {},\n pagination: HokPaginationInput = { limit: 50, offset: 0 }\n) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'auditions', filters, pagination],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokListAuditions: HokConnection<HokAudition> }>(\n `query HokAuditions($pagination: PaginationInput, $status: HokAuditionStatus, $productionId: ID) {\n hokListAuditions(pagination: $pagination, status: $status, productionId: $productionId) {\n items {\n ${AUDITION_FIELDS}\n production { id title }\n }\n ${PAGE_INFO}\n }\n }`,\n { pagination, status: filters.status, productionId: filters.productionId },\n apiGatewayUrl\n );\n return result.hokListAuditions;\n },\n });\n};\n\n/**\n * Resolve a single audition by id. The subgraph exposes no `hokAudition(id)`\n * root field, so we read the (workspace-scoped) audition list and pick the row.\n * Fetched with a generous page size since auditions are workspace-bounded.\n */\nexport const useAuditionById = (id: string | undefined) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'audition-by-id', id],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokListAuditions: HokConnection<HokAudition> }>(\n `query HokAuditionLookup($pagination: PaginationInput) {\n hokListAuditions(pagination: $pagination) {\n items {\n ${AUDITION_FIELDS}\n production { id title }\n }\n ${PAGE_INFO}\n }\n }`,\n { pagination: { limit: 200, offset: 0 } },\n apiGatewayUrl\n );\n return result.hokListAuditions.items.find((a) => a.id === id) ?? null;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useAuditionApplications = (auditionId: string | undefined) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'applications', auditionId],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokListApplications: HokApplication[] }>(\n `query HokApplications($auditionId: ID!) {\n hokListApplications(auditionId: $auditionId) {\n id auditionId applicantId coverNote score status createdAt updatedAt\n }\n }`,\n { auditionId },\n apiGatewayUrl\n );\n return result.hokListApplications;\n },\n enabled: Boolean(auditionId),\n });\n};\n\nexport interface CreateAuditionInput {\n productionId: string;\n roleName: string;\n description?: string;\n payMinorUnits?: string;\n currency?: string;\n location?: string;\n language?: string;\n isMinorRole?: boolean;\n submissionDeadline?: string;\n}\n\nexport const useCreateAudition = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (input: CreateAuditionInput) => {\n const result = await hookmoviesQuery<{ hokCreateAudition: HokAudition }>(\n `mutation HokCreateAudition($input: HokCreateAuditionInput!) {\n hokCreateAudition(input: $input) { ${AUDITION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.hokCreateAudition;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'auditions'] });\n },\n });\n};\n\nexport const useCloseAudition = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await hookmoviesQuery<{ hokCloseAudition: HokAudition }>(\n `mutation HokCloseAudition($id: ID!) {\n hokCloseAudition(id: $id) { ${AUDITION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.hokCloseAudition;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'auditions'] });\n },\n });\n};\n\nexport interface ApplyToAuditionInput {\n auditionId: string;\n coverNote?: string;\n selfTapeFileId?: string;\n}\n\nexport const useApplyToAudition = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (input: ApplyToAuditionInput) => {\n const result = await hookmoviesQuery<{ hokApplyToAudition: HokApplication }>(\n `mutation HokApplyToAudition($input: HokApplyToAuditionInput!) {\n hokApplyToAudition(input: $input) {\n id auditionId applicantId coverNote score status createdAt updatedAt\n }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.hokApplyToAudition;\n },\n onSuccess: (data) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'applications', data.auditionId] });\n },\n });\n};\n\nexport const useScoreApplication = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async ({ id, score }: { id: string; score: number }) => {\n const result = await hookmoviesQuery<{ hokScoreApplication: HokApplication }>(\n `mutation HokScoreApplication($id: ID!, $score: Int!) {\n hokScoreApplication(id: $id, score: $score) {\n id auditionId applicantId coverNote score status createdAt updatedAt\n }\n }`,\n { id, score },\n apiGatewayUrl\n );\n return result.hokScoreApplication;\n },\n onSuccess: (data) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'applications', data.auditionId] });\n },\n });\n};\n\n// ============================================================================\n// Reviews\n// ============================================================================\n\nexport interface HokReviewFilters {\n status?: HokReviewStatus;\n titleId?: string;\n}\n\nexport const useReviews = (\n filters: HokReviewFilters = {},\n pagination: HokPaginationInput = { limit: 50, offset: 0 }\n) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'reviews', filters, pagination],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokListReviews: HokConnection<HokReview> }>(\n `query HokReviews($pagination: PaginationInput, $status: HokReviewStatus, $titleId: ID) {\n hokListReviews(pagination: $pagination, status: $status, titleId: $titleId) {\n items {\n ${REVIEW_FIELDS}\n title { id title }\n }\n ${PAGE_INFO}\n }\n }`,\n { pagination, status: filters.status, titleId: filters.titleId },\n apiGatewayUrl\n );\n return result.hokListReviews;\n },\n });\n};\n\nexport interface CreateReviewInput {\n titleId: string;\n score: number;\n body?: string;\n hasSpoilers?: boolean;\n aspectScores?: Record<string, unknown>;\n}\n\nexport const useCreateReview = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (input: CreateReviewInput) => {\n const result = await hookmoviesQuery<{ hokCreateReview: HokReview }>(\n `mutation HokCreateReview($input: HokCreateReviewInput!) {\n hokCreateReview(input: $input) { ${REVIEW_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.hokCreateReview;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'reviews'] });\n },\n });\n};\n\nexport const useDeleteReview = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await hookmoviesQuery<{ hokDeleteReview: boolean }>(\n `mutation HokDeleteReview($id: ID!) { hokDeleteReview(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return result.hokDeleteReview;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'reviews'] });\n },\n });\n};\n\n// ============================================================================\n// Rights Windows\n// ============================================================================\n\nexport interface HokRightsFilters {\n status?: HokRightsWindowStatus;\n titleId?: string;\n}\n\nexport const useRightsWindows = (\n filters: HokRightsFilters = {},\n pagination: HokPaginationInput = { limit: 50, offset: 0 }\n) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'rights', filters, pagination],\n queryFn: async () => {\n const result = await hookmoviesQuery<{\n hokListRightsWindows: HokConnection<HokRightsWindow>;\n }>(\n `query HokRightsWindows($pagination: PaginationInput, $status: HokRightsWindowStatus, $titleId: ID) {\n hokListRightsWindows(pagination: $pagination, status: $status, titleId: $titleId) {\n items {\n ${RIGHTS_FIELDS}\n title { id title }\n }\n ${PAGE_INFO}\n }\n }`,\n { pagination, status: filters.status, titleId: filters.titleId },\n apiGatewayUrl\n );\n return result.hokListRightsWindows;\n },\n });\n};\n\nexport interface CreateRightsWindowInput {\n titleId: string;\n modes: HokMonetizationMode[];\n territories?: string[];\n exclusive?: boolean;\n currency?: string;\n licenseeId?: string;\n startsAt?: string;\n endsAt?: string;\n contractFileId?: string;\n priceMinorUnits?: Record<string, unknown>;\n}\n\nexport const useCreateRightsWindow = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (input: CreateRightsWindowInput) => {\n const result = await hookmoviesQuery<{ hokCreateRightsWindow: HokRightsWindow }>(\n `mutation HokCreateRightsWindow($input: HokCreateRightsWindowInput!) {\n hokCreateRightsWindow(input: $input) { ${RIGHTS_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.hokCreateRightsWindow;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'rights'] });\n },\n });\n};\n\nexport const useTransitionRightsWindow = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: HokRightsWindowStatus }) => {\n const result = await hookmoviesQuery<{ hokTransitionRightsWindow: HokRightsWindow }>(\n `mutation HokTransitionRightsWindow($id: ID!, $status: HokRightsWindowStatus!) {\n hokTransitionRightsWindow(id: $id, status: $status) { ${RIGHTS_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return result.hokTransitionRightsWindow;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'rights'] });\n },\n });\n};\n\nexport const useRevokeEntitlement = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await hookmoviesQuery<{ hokRevokeEntitlement: boolean }>(\n `mutation HokRevokeEntitlement($id: ID!) { hokRevokeEntitlement(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return result.hokRevokeEntitlement;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-entitlements'] });\n },\n });\n};\n\n// ============================================================================\n// Entitlements (self-scoped)\n// ============================================================================\n\nexport const useMyEntitlements = (titleId?: string) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'my-entitlements', titleId],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokMyEntitlements: HokEntitlement[] }>(\n `query HokMyEntitlements($titleId: ID) {\n hokMyEntitlements(titleId: $titleId) {\n id titleId userId mode source status territory expiresAt createdAt updatedAt\n title { id title }\n }\n }`,\n { titleId },\n apiGatewayUrl\n );\n return result.hokMyEntitlements;\n },\n });\n};\n\n// ============================================================================\n// Lists / Watchlists (self-scoped)\n// ============================================================================\n\nexport const useMyLists = (\n kind?: HokListKind,\n pagination: HokPaginationInput = { limit: 50, offset: 0 }\n) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'my-lists', kind, pagination],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokMyLists: HokConnection<HokList> }>(\n `query HokMyLists($kind: HokListKind, $pagination: PaginationInput) {\n hokMyLists(kind: $kind, pagination: $pagination) {\n items { ${LIST_FIELDS} }\n ${PAGE_INFO}\n }\n }`,\n { kind, pagination },\n apiGatewayUrl\n );\n return result.hokMyLists;\n },\n });\n};\n\nexport interface CreateListInput {\n name: string;\n description?: string;\n kind?: HokListKind;\n visibility?: HokListVisibility;\n items?: Record<string, unknown>;\n}\n\nexport const useCreateList = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (input: CreateListInput) => {\n const result = await hookmoviesQuery<{ hokCreateList: HokList }>(\n `mutation HokCreateList($input: HokCreateListInput!) {\n hokCreateList(input: $input) { ${LIST_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.hokCreateList;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-lists'] });\n },\n });\n};\n\nexport const useDeleteList = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useHookMovies();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await hookmoviesQuery<{ hokDeleteList: boolean }>(\n `mutation HokDeleteList($id: ID!) { hokDeleteList(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return result.hokDeleteList;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-lists'] });\n },\n });\n};\n\n// ============================================================================\n// Watch progress / Continue Watching (self-scoped)\n// ============================================================================\n\nexport const useMyWatchProgress = (titleId?: string) => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'my-watch-progress', titleId],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokMyWatchProgress: HokWatchProgress[] }>(\n `query HokMyWatchProgress($titleId: ID) {\n hokMyWatchProgress(titleId: $titleId) {\n id titleId episodeId positionSeconds completed lastDevice updatedAt\n title { id title type }\n }\n }`,\n { titleId },\n apiGatewayUrl\n );\n return result.hokMyWatchProgress;\n },\n });\n};\n\n// ============================================================================\n// Health probe (used by the dashboard service-status card)\n// ============================================================================\n\nexport const useHealth = () => {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: [QK, 'health'],\n queryFn: async () => {\n const result = await hookmoviesQuery<{ hokHealth: string }>(\n `query HokHealth { hokHealth }`,\n {},\n apiGatewayUrl\n );\n return result.hokHealth;\n },\n staleTime: 60 * 1000,\n });\n};\n"],"mappings":";;;;;AA4BA,IAAM,IAAkB,OACtB,GACA,GACA,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AAsB;CACjC,IAAM,IAAc,GAAgB,EAC9B,EAAE,qBAAkB,GAAe;AACzC,QAAO,EAAY;EACjB,YAAY,OAAO,OACF,MAAM,EACnB;2CACmC,EAAY;YAE/C,EAAE,UAAO,EACT,EACD,EACa;EAEhB,iBAAiB;AACV,KAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,WAAW,EAAE,CAAC;;EAErE,CAAC;GAGS,UAAsB;CACjC,IAAM,IAAc,GAAgB,EAC9B,EAAE,qBAAkB,GAAe;AACzC,QAAO,EAAY;EACjB,YAAY,OAAO,OACF,MAAM,EACnB,+DACA,EAAE,OAAI,EACN,EACD,EACa;EAEhB,iBAAiB;AACV,KAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,WAAW,EAAE,CAAC;;EAErE,CAAC;GAOS,KAAsB,MAAqB;CACtD,IAAM,EAAE,qBAAkB,GAAe;AACzC,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAqB;GAAQ;EAC5C,SAAS,aACQ,MAAM,EACnB,6OAMA,EAAE,YAAS,EACX,EACD,EACa;EAEjB,CAAC;GAOS,UAAkB;CAC7B,IAAM,EAAE,qBAAkB,GAAe;AACzC,QAAO,EAAS;EACd,UAAU,CAAC,GAAI,SAAS;EACxB,SAAS,aACQ,MAAM,EACnB,iCACA,EAAE,EACF,EACD,EACa;EAEhB,WAAW,KAAK;EACjB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import "./context/HookMoviesContext.js";
2
2
  import "./utils/cn.js";
3
3
  import "./context/index.js";
4
+ import "./hooks/useHookMoviesApi.js";
4
5
  import "./utils/formatters.js";
5
6
  import "./HookMoviesRoot.js";
6
- import "./store/hookmoviesStore.js";
7
- import "./store/index.js";
7
+ import "./hooks/index.js";