@burdenoff/microfe-atheletebridge 2026.1110.1 → 2026.1110.2

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 (27) hide show
  1. package/dist/atheletebridge/AthleteBridgeRoutes.js +22 -6
  2. package/dist/atheletebridge/AthleteBridgeRoutes.js.map +1 -1
  3. package/dist/atheletebridge/components/StatusBadge.js +8 -0
  4. package/dist/atheletebridge/components/StatusBadge.js.map +1 -1
  5. package/dist/atheletebridge/hooks/useAuditApi.d.ts +14 -0
  6. package/dist/atheletebridge/hooks/useAuditApi.js +38 -0
  7. package/dist/atheletebridge/hooks/useAuditApi.js.map +1 -0
  8. package/dist/atheletebridge/hooks/useRegistrationApi.d.ts +15 -0
  9. package/dist/atheletebridge/hooks/useRegistrationApi.js +38 -19
  10. package/dist/atheletebridge/hooks/useRegistrationApi.js.map +1 -1
  11. package/dist/atheletebridge/pages/audit/AuditLogPage.d.ts +11 -0
  12. package/dist/atheletebridge/pages/audit/AuditLogPage.js +277 -0
  13. package/dist/atheletebridge/pages/audit/AuditLogPage.js.map +1 -0
  14. package/dist/atheletebridge/pages/control/ClubControlPage.d.ts +11 -0
  15. package/dist/atheletebridge/pages/control/ClubControlPage.js +208 -0
  16. package/dist/atheletebridge/pages/control/ClubControlPage.js.map +1 -0
  17. package/dist/atheletebridge/pages/fixtures/FixtureDetailPage.js +126 -65
  18. package/dist/atheletebridge/pages/fixtures/FixtureDetailPage.js.map +1 -1
  19. package/dist/atheletebridge/pages/registrations/RegistrationFormBuilderPage.js +243 -217
  20. package/dist/atheletebridge/pages/registrations/RegistrationFormBuilderPage.js.map +1 -1
  21. package/dist/atheletebridge/pages/registrations/RegistrationFormDetailPage.js +136 -83
  22. package/dist/atheletebridge/pages/registrations/RegistrationFormDetailPage.js.map +1 -1
  23. package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js +173 -146
  24. package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js.map +1 -1
  25. package/dist/atheletebridge/types/audit.d.ts +47 -0
  26. package/dist/atheletebridge/types/registration.d.ts +22 -1
  27. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useRegistrationApi.js","names":["ROOT","FIELD_FIELDS","FEE_FIELDS","FORM_FIELDS","SUBMISSION_FIELDS","PAYMENT_FIELDS","SUMMARY_FIELDS","PUBLIC_FORM_FIELDS","MY_REGISTRATION_FIELDS","PAYMENT_ACCOUNT_FIELDS","useInvalidateRegistration","queryClient","useQueryClient","useRegistrationForms","useAthleteBridge","useQuery","workspaceId","filters","athQuery","apiGatewayUrl","useRegistrationForm","id","useCreateRegistrationForm","invalidate","useMutation","useUpdateRegistrationForm","LIFECYCLE_MUTATIONS","useRegistrationFormLifecycle","action","field","selection","useRegistrationSubmissions","useRegistrationSubmission","useRecordRegistration","useReviewRegistration","useRegistrationPayments","submissionId","useRegistrationPaymentSummary","formId","useRecordRegistrationPayment","useVoidRegistrationPayment","useRefundRegistrationPayment","useOnlinePaymentsStatus","useConnectPaymentAccount","useRefreshPaymentAccount","usePublicRegistrationForm","slug","useSubmitRegistration","useMyRegistrations","pagination","useWithdrawMyRegistration","useStartRegistrationCheckout","useConfirmRegistrationCheckout"],"sources":["../../../src/atheletebridge/hooks/useRegistrationApi.ts"],"sourcesContent":["/**\n * Club registration & payments API hooks (BOFF-4135).\n *\n * react-query wrappers over the `wspace-atheletebridge-svc` registration\n * module, reached through the workspace gateway like every other hook in this\n * package. Staff hooks are gated by `atheletebridge-registration` /\n * `atheletebridge-registration-payment`; the family-facing hooks\n * (`usePublicRegistrationForm`, `useSubmitRegistration`, `useMyRegistrations`,\n * `useWithdrawMyRegistration`) are self-scoped and work for any signed-in user.\n *\n * @module atheletebridge/hooks/registration\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useAthleteBridge } from '../context';\nimport type { PaginationInput } from '../types';\nimport type {\n AthCreateRegistrationFormInput,\n AthMyRegistration,\n AthMyRegistrationConnection,\n AthOnlinePaymentsStatus,\n AthPaymentAccount,\n AthPaymentAccountLink,\n AthPublicRegistrationForm,\n AthRecordRegistrationInput,\n AthRecordRegistrationPaymentInput,\n AthRegistrationCheckoutSession,\n AthRegistrationDecision,\n AthRegistrationForm,\n AthRegistrationFormConnection,\n AthRegistrationFormStatus,\n AthRegistrationPayment,\n AthRegistrationPaymentStatus,\n AthRegistrationPaymentSummary,\n AthRegistrationSubmission,\n AthRegistrationSubmissionConnection,\n AthRegistrationSubmissionStatus,\n AthSubmitRegistrationInput,\n AthUpdateRegistrationFormInput,\n} from '../types/registration';\nimport { athQuery } from './useAthleteBridgeApi';\n\n// Workspace-scoped reads put the active workspace right after ROOT: the\n// QueryClient outlives a workspace switch, and one club's registrations or\n// ledger must never be served from cache to another club. Invalidating ROOT\n// still clears every workspace's entries.\nconst ROOT = ['atheletebridge', 'registration'] as const;\n\nconst FIELD_FIELDS = `id key label fieldType required options helpText position`;\nconst FEE_FIELDS = `id name description amount feeType position`;\n\nconst FORM_FIELDS = `\n id workspaceId title description season teamId programId slug status currency\n opensAt closesAt maxSubmissions waiverText publishedAt closedAt isOpen\n submissionCount createdAt updatedAt\n fields { ${FIELD_FIELDS} }\n fees { ${FEE_FIELDS} }\n`;\n\nconst SUBMISSION_FIELDS = `\n id workspaceId formId formTitle source submittedByUserId participantName\n participantUserId contactName contactEmail contactPhone answers selectedFeeIds\n status paymentStatus amountDue amountPaid amountOutstanding currency\n waiverAcceptedAt reviewNotes reviewedAt submittedAt createdAt updatedAt\n participantIsRegistrant rosterOutcome rosterMemberId rosterTeamId rosterTeamName\n`;\n\nconst PAYMENT_FIELDS = `\n id submissionId amount refundedAmount netAmount currency method processor status\n reference note receivedAt voidedAt voidReason refundedAt refundReason\n createdBy createdAt\n`;\n\nconst SUMMARY_FIELDS = `\n formId submissionCount acceptedCount notRequiredCount unpaidCount\n partiallyPaidCount paidCount refundedCount\n totals { currency amountDue amountCollected amountRefunded amountOutstanding }\n`;\n\nconst PUBLIC_FORM_FIELDS = `\n id slug title description season currency opensAt closesAt waiverText isOpen\n spotsRemaining\n fields { ${FIELD_FIELDS} }\n fees { ${FEE_FIELDS} }\n`;\n\nconst MY_REGISTRATION_FIELDS = `\n id formId formTitle formSlug participantName status paymentStatus amountDue\n amountPaid amountOutstanding currency onlinePaymentAvailable submittedAt\n`;\n\nconst PAYMENT_ACCOUNT_FIELDS = `\n provider accountId chargesEnabled payoutsEnabled detailsSubmitted lastSyncedAt createdAt\n`;\n\n/** Every registration read is invalidated together after any write. */\nconst useInvalidateRegistration = () => {\n const queryClient = useQueryClient();\n return () => queryClient.invalidateQueries({ queryKey: ROOT });\n};\n\n// ============================================================================\n// Forms (staff)\n// ============================================================================\n\nexport interface RegistrationFormFilters {\n status?: AthRegistrationFormStatus;\n season?: string;\n pagination?: PaginationInput;\n}\n\nexport const useRegistrationForms = (filters: RegistrationFormFilters = {}) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'forms', filters],\n queryFn: async () => {\n const result = await athQuery<{ athListRegistrationForms: AthRegistrationFormConnection }>(\n `query AthListRegistrationForms($status: AthRegistrationFormStatus, $season: String, $pagination: PaginationInput) {\n athListRegistrationForms(status: $status, season: $season, pagination: $pagination) {\n items { ${FORM_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { ...filters },\n apiGatewayUrl\n );\n return result.athListRegistrationForms;\n },\n });\n};\n\nexport const useRegistrationForm = (id: string | undefined) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'form', id],\n queryFn: async () => {\n const result = await athQuery<{ athRegistrationForm: AthRegistrationForm | null }>(\n `query AthRegistrationForm($id: ID!) { athRegistrationForm(id: $id) { ${FORM_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return result.athRegistrationForm;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateRegistrationForm = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async (input: AthCreateRegistrationFormInput) => {\n const result = await athQuery<{ athCreateRegistrationForm: AthRegistrationForm }>(\n `mutation AthCreateRegistrationForm($input: AthCreateRegistrationFormInput!) {\n athCreateRegistrationForm(input: $input) { ${FORM_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.athCreateRegistrationForm;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport const useUpdateRegistrationForm = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: AthUpdateRegistrationFormInput }) => {\n const result = await athQuery<{ athUpdateRegistrationForm: AthRegistrationForm }>(\n `mutation AthUpdateRegistrationForm($id: ID!, $input: AthUpdateRegistrationFormInput!) {\n athUpdateRegistrationForm(id: $id, input: $input) { ${FORM_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return result.athUpdateRegistrationForm;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport type RegistrationFormLifecycleAction = 'publish' | 'close' | 'archive';\n\nconst LIFECYCLE_MUTATIONS: Record<\n RegistrationFormLifecycleAction,\n { field: string; selection: string }\n> = {\n publish: { field: 'athPublishRegistrationForm', selection: `{ ${FORM_FIELDS} }` },\n close: { field: 'athCloseRegistrationForm', selection: `{ ${FORM_FIELDS} }` },\n archive: { field: 'athArchiveRegistrationForm', selection: '' },\n};\n\nexport const useRegistrationFormLifecycle = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ id, action }: { id: string; action: RegistrationFormLifecycleAction }) => {\n const { field, selection } = LIFECYCLE_MUTATIONS[action];\n await athQuery<Record<string, unknown>>(\n `mutation AthRegistrationFormLifecycle($id: ID!) { ${field}(id: $id) ${selection} }`,\n { id },\n apiGatewayUrl\n );\n return action;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Submissions (staff)\n// ============================================================================\n\nexport interface RegistrationSubmissionFilters {\n formId?: string;\n status?: AthRegistrationSubmissionStatus;\n paymentStatus?: AthRegistrationPaymentStatus;\n pagination?: PaginationInput;\n}\n\nexport const useRegistrationSubmissions = (\n filters: RegistrationSubmissionFilters,\n enabled = true\n) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'submissions', filters],\n queryFn: async () => {\n const result = await athQuery<{\n athListRegistrationSubmissions: AthRegistrationSubmissionConnection;\n }>(\n `query AthListRegistrationSubmissions(\n $formId: ID\n $status: AthRegistrationSubmissionStatus\n $paymentStatus: AthRegistrationPaymentStatus\n $pagination: PaginationInput\n ) {\n athListRegistrationSubmissions(\n formId: $formId\n status: $status\n paymentStatus: $paymentStatus\n pagination: $pagination\n ) {\n items { ${SUBMISSION_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { ...filters },\n apiGatewayUrl\n );\n return result.athListRegistrationSubmissions;\n },\n enabled,\n });\n};\n\nexport const useRegistrationSubmission = (id: string | undefined) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'submission', id],\n queryFn: async () => {\n const result = await athQuery<{\n athRegistrationSubmission: AthRegistrationSubmission | null;\n }>(\n `query AthRegistrationSubmission($id: ID!) {\n athRegistrationSubmission(id: $id) { ${SUBMISSION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.athRegistrationSubmission;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useRecordRegistration = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async (input: AthRecordRegistrationInput) => {\n const result = await athQuery<{ athRecordRegistration: AthRegistrationSubmission }>(\n `mutation AthRecordRegistration($input: AthRecordRegistrationInput!) {\n athRecordRegistration(input: $input) { ${SUBMISSION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.athRecordRegistration;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport const useReviewRegistration = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({\n id,\n decision,\n notes,\n }: {\n id: string;\n decision: AthRegistrationDecision;\n notes?: string;\n }) => {\n const result = await athQuery<{ athReviewRegistrationSubmission: AthRegistrationSubmission }>(\n `mutation AthReviewRegistrationSubmission($id: ID!, $input: AthReviewRegistrationInput!) {\n athReviewRegistrationSubmission(id: $id, input: $input) { ${SUBMISSION_FIELDS} }\n }`,\n { id, input: { decision, notes } },\n apiGatewayUrl\n );\n return result.athReviewRegistrationSubmission;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Payments (staff)\n// ============================================================================\n\nexport const useRegistrationPayments = (submissionId: string | undefined) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'payments', submissionId],\n queryFn: async () => {\n const result = await athQuery<{ athListRegistrationPayments: AthRegistrationPayment[] }>(\n `query AthListRegistrationPayments($submissionId: ID!) {\n athListRegistrationPayments(submissionId: $submissionId) { ${PAYMENT_FIELDS} }\n }`,\n { submissionId },\n apiGatewayUrl\n );\n return result.athListRegistrationPayments;\n },\n enabled: Boolean(submissionId),\n retry: false,\n });\n};\n\nexport const useRegistrationPaymentSummary = (formId?: string) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'summary', formId ?? null],\n queryFn: async () => {\n const result = await athQuery<{\n athRegistrationPaymentSummary: AthRegistrationPaymentSummary;\n }>(\n `query AthRegistrationPaymentSummary($formId: ID) {\n athRegistrationPaymentSummary(formId: $formId) { ${SUMMARY_FIELDS} }\n }`,\n { formId: formId ?? null },\n apiGatewayUrl\n );\n return result.athRegistrationPaymentSummary;\n },\n // A coach can read submissions without the payment ledger; a FORBIDDEN\n // here just hides the money panel, so never retry it.\n retry: false,\n });\n};\n\nexport const useRecordRegistrationPayment = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async (input: AthRecordRegistrationPaymentInput) => {\n const result = await athQuery<{ athRecordRegistrationPayment: AthRegistrationPayment }>(\n `mutation AthRecordRegistrationPayment($input: AthRecordRegistrationPaymentInput!) {\n athRecordRegistrationPayment(input: $input) { ${PAYMENT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.athRecordRegistrationPayment;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport const useVoidRegistrationPayment = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ id, reason }: { id: string; reason: string }) => {\n const result = await athQuery<{ athVoidRegistrationPayment: AthRegistrationPayment }>(\n `mutation AthVoidRegistrationPayment($id: ID!, $reason: String!) {\n athVoidRegistrationPayment(id: $id, reason: $reason) { ${PAYMENT_FIELDS} }\n }`,\n { id, reason },\n apiGatewayUrl\n );\n return result.athVoidRegistrationPayment;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport const useRefundRegistrationPayment = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ id, amount, reason }: { id: string; amount: number; reason: string }) => {\n const result = await athQuery<{ athRefundRegistrationPayment: AthRegistrationPayment }>(\n `mutation AthRefundRegistrationPayment($id: ID!, $input: AthRefundRegistrationPaymentInput!) {\n athRefundRegistrationPayment(id: $id, input: $input) { ${PAYMENT_FIELDS} }\n }`,\n { id, input: { amount, reason } },\n apiGatewayUrl\n );\n return result.athRefundRegistrationPayment;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Online payments setup (staff, BOFF-10902)\n// ============================================================================\n\nexport const useOnlinePaymentsStatus = () => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'online-payments'],\n queryFn: async () => {\n const result = await athQuery<{ athOnlinePaymentsStatus: AthOnlinePaymentsStatus }>(\n `query AthOnlinePaymentsStatus {\n athOnlinePaymentsStatus {\n processorConfigured testMode onlineCheckoutAvailable\n account { ${PAYMENT_ACCOUNT_FIELDS} }\n }\n }`,\n {},\n apiGatewayUrl\n );\n return result.athOnlinePaymentsStatus;\n },\n // Staff without payment-ledger access get FORBIDDEN: hide the card, never retry.\n retry: false,\n });\n};\n\n/**\n * Create (first call) or resume the club's processor onboarding. Resolves to\n * the hosted onboarding link; the caller redirects the browser to it.\n */\nexport const useConnectPaymentAccount = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n return useMutation({\n mutationFn: async (input: { returnUrl: string; email?: string }) => {\n const result = await athQuery<{ athConnectPaymentAccount: AthPaymentAccountLink }>(\n `mutation AthConnectPaymentAccount($input: AthConnectPaymentAccountInput!) {\n athConnectPaymentAccount(input: $input) {\n url expiresAt\n account { ${PAYMENT_ACCOUNT_FIELDS} }\n }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.athConnectPaymentAccount;\n },\n });\n};\n\nexport const useRefreshPaymentAccount = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async () => {\n const result = await athQuery<{ athRefreshPaymentAccount: AthPaymentAccount }>(\n `mutation AthRefreshPaymentAccount {\n athRefreshPaymentAccount { ${PAYMENT_ACCOUNT_FIELDS} }\n }`,\n {},\n apiGatewayUrl\n );\n return result.athRefreshPaymentAccount;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Family-facing (self-scoped)\n// ============================================================================\n\nexport const usePublicRegistrationForm = (slug: string | undefined) => {\n const { apiGatewayUrl } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, 'public', slug],\n queryFn: async () => {\n const result = await athQuery<{\n athRegistrationFormBySlug: AthPublicRegistrationForm | null;\n }>(\n `query AthRegistrationFormBySlug($slug: String!) {\n athRegistrationFormBySlug(slug: $slug) { ${PUBLIC_FORM_FIELDS} }\n }`,\n { slug },\n apiGatewayUrl\n );\n return result.athRegistrationFormBySlug;\n },\n enabled: Boolean(slug),\n });\n};\n\nexport const useSubmitRegistration = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ slug, input }: { slug: string; input: AthSubmitRegistrationInput }) => {\n const result = await athQuery<{ athSubmitRegistration: AthMyRegistration }>(\n `mutation AthSubmitRegistration($slug: String!, $input: AthSubmitRegistrationInput!) {\n athSubmitRegistration(slug: $slug, input: $input) { ${MY_REGISTRATION_FIELDS} }\n }`,\n { slug, input },\n apiGatewayUrl\n );\n return result.athSubmitRegistration;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport const useMyRegistrations = (pagination?: PaginationInput) => {\n const { apiGatewayUrl } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, 'mine', pagination ?? null],\n queryFn: async () => {\n const result = await athQuery<{ athMyRegistrations: AthMyRegistrationConnection }>(\n `query AthMyRegistrations($pagination: PaginationInput) {\n athMyRegistrations(pagination: $pagination) {\n items { ${MY_REGISTRATION_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { pagination: pagination ?? null },\n apiGatewayUrl\n );\n return result.athMyRegistrations;\n },\n });\n};\n\nexport const useWithdrawMyRegistration = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await athQuery<{ athWithdrawMyRegistration: AthMyRegistration }>(\n `mutation AthWithdrawMyRegistration($id: ID!) {\n athWithdrawMyRegistration(id: $id) { ${MY_REGISTRATION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.athWithdrawMyRegistration;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Online checkout (family-facing, self-scoped, BOFF-10902)\n// ============================================================================\n\n/** Open a processor checkout for the outstanding balance of one of your registrations. */\nexport const useStartRegistrationCheckout = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n return useMutation({\n mutationFn: async (input: { submissionId: string; returnUrl: string }) => {\n const result = await athQuery<{\n athStartRegistrationCheckout: AthRegistrationCheckoutSession;\n }>(\n `mutation AthStartRegistrationCheckout($input: AthStartRegistrationCheckoutInput!) {\n athStartRegistrationCheckout(input: $input) { checkoutId url amount currency expiresAt }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.athStartRegistrationCheckout;\n },\n });\n};\n\n/** Settle a checkout after the processor sends the family back (the server re-reads it). */\nexport const useConfirmRegistrationCheckout = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async (checkoutId: string) => {\n const result = await athQuery<{ athConfirmRegistrationCheckout: AthMyRegistration }>(\n `mutation AthConfirmRegistrationCheckout($checkoutId: ID!) {\n athConfirmRegistrationCheckout(checkoutId: $checkoutId) { ${MY_REGISTRATION_FIELDS} }\n }`,\n { checkoutId },\n apiGatewayUrl\n );\n return result.athConfirmRegistrationCheckout;\n },\n onSuccess: () => void invalidate(),\n });\n};\n"],"mappings":";;;;;AA+CA,IAAMA,IAAO,CAAC,kBAAkB,cAAc,GAExCC,IAAe,6DACfC,IAAa,+CAEbC,IAAc;;;;aAIPF,EAAa;WACfC,EAAW;GAGhBE,IAAoB,2YAQpBC,IAAiB,0LAMjBC,IAAiB,2MAMjBC,IAAqB;;;aAGdN,EAAa;WACfC,EAAW;GAGhBM,IAAyB,iKAKzBC,IAAyB,kGAKzBC,UAAkC;CACtC,IAAMC,IAAcC,EAAe;CACnC,aAAaD,EAAY,kBAAkB,EAAE,UAAUX,EAAK,CAAC;AAC/D,GAYaa,KAAwB,IAAmC,CAAC,MAAM;CAC7E,IAAM,EAAE,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E/E;GAAE;GAAM;EAAM,GACdW,CACF,EAAA,CACc;EAEhB,iBAAiB,KAAKI,EAAW;CACnC,CAAC;AACH,GAEayB,KAAsB,MAAiC;CAClE,IAAM,EAAE,qBAAkBlC,EAAiB;CAC3C,OAAOC,EAAS;EACd,UAAU;GAAC,GAAGf;GAAM;GAAQiD,KAAc;EAAI;EAC9C,SAAS,aAWA,MAVc/B,EACnB;;sBAEcV,EAAuB;;;YAIrC,EAAE,YAAYyC,KAAc,KAAK,GACjC9B,CACF,EAAA,CACc;CAElB,CAAC;AACH,GAEa+B,UAAkC;CAC7C,IAAM,EAAE,qBAAkBpC,EAAiB,GACrCS,IAAab,EAA0B;CAC7C,OAAOc,EAAY;EACjB,YAAY,OAAO,OAQV,MAPcN,EACnB;iDACyCV,EAAuB;YAEhE,EAAE,MAAG,GACLW,CACF,EAAA,CACc;EAEhB,iBAAiB,KAAKI,EAAW;CACnC,CAAC;AACH,GAOa4B,UAAqC;CAChD,IAAM,EAAE,qBAAkBrC,EAAiB;CAC3C,OAAOU,EAAY,EACjB,YAAY,OAAO,OAUV,MATcN,EAGnB,sMAGA,EAAE,SAAM,GACRC,CACF,EAAA,CACc,6BAElB,CAAC;AACH,GAGaiC,UAAuC;CAClD,IAAM,EAAE,qBAAkBtC,EAAiB,GACrCS,IAAab,EAA0B;CAC7C,OAAOc,EAAY;EACjB,YAAY,OAAO,OAQV,MAPcN,EACnB;sEAC8DV,EAAuB;YAErF,EAAE,cAAW,GACbW,CACF,EAAA,CACc;EAEhB,iBAAiB,KAAKI,EAAW;CACnC,CAAC;AACH"}
1
+ {"version":3,"file":"useRegistrationApi.js","names":["ROOT","FIELD_FIELDS","FEE_FIELDS","FORM_FIELDS","SUBMISSION_FIELDS","PAYMENT_FIELDS","SUMMARY_FIELDS","PUBLIC_FORM_FIELDS","MY_REGISTRATION_FIELDS","PAYMENT_ACCOUNT_FIELDS","useInvalidateRegistration","queryClient","useQueryClient","useRegistrationForms","useAthleteBridge","useQuery","workspaceId","filters","athQuery","apiGatewayUrl","useRegistrationForm","id","useCreateRegistrationForm","invalidate","useMutation","useUpdateRegistrationForm","LIFECYCLE_MUTATIONS","useRegistrationFormLifecycle","action","field","selection","useRegistrationSubmissions","useRegistrationSubmission","useRecordRegistration","useReviewRegistration","useRegistrationCheckIn","checkedIn","useRegistrationPayments","submissionId","useRegistrationPaymentSummary","formId","useRecordRegistrationPayment","useVoidRegistrationPayment","useRefundRegistrationPayment","useOnlinePaymentsStatus","useConnectPaymentAccount","useRefreshPaymentAccount","usePublicRegistrationForm","slug","useSubmitRegistration","useMyRegistrations","pagination","useWithdrawMyRegistration","useStartRegistrationCheckout","useConfirmRegistrationCheckout"],"sources":["../../../src/atheletebridge/hooks/useRegistrationApi.ts"],"sourcesContent":["/**\n * Club registration & payments API hooks (BOFF-4135).\n *\n * react-query wrappers over the `wspace-atheletebridge-svc` registration\n * module, reached through the workspace gateway like every other hook in this\n * package. Staff hooks are gated by `atheletebridge-registration` /\n * `atheletebridge-registration-payment`; the family-facing hooks\n * (`usePublicRegistrationForm`, `useSubmitRegistration`, `useMyRegistrations`,\n * `useWithdrawMyRegistration`) are self-scoped and work for any signed-in user.\n *\n * @module atheletebridge/hooks/registration\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useAthleteBridge } from '../context';\nimport type { PaginationInput } from '../types';\nimport type {\n AthCreateRegistrationFormInput,\n AthMyRegistration,\n AthMyRegistrationConnection,\n AthOnlinePaymentsStatus,\n AthPaymentAccount,\n AthPaymentAccountLink,\n AthPublicRegistrationForm,\n AthRecordRegistrationInput,\n AthRecordRegistrationPaymentInput,\n AthRegistrationCheckoutSession,\n AthRegistrationDecision,\n AthRegistrationForm,\n AthRegistrationFormConnection,\n AthRegistrationFormStatus,\n AthRegistrationPayment,\n AthRegistrationPaymentStatus,\n AthRegistrationPaymentSummary,\n AthRegistrationSubmission,\n AthRegistrationSubmissionConnection,\n AthRegistrationSubmissionStatus,\n AthSubmitRegistrationInput,\n AthUpdateRegistrationFormInput,\n} from '../types/registration';\nimport { athQuery } from './useAthleteBridgeApi';\n\n// Workspace-scoped reads put the active workspace right after ROOT: the\n// QueryClient outlives a workspace switch, and one club's registrations or\n// ledger must never be served from cache to another club. Invalidating ROOT\n// still clears every workspace's entries.\nconst ROOT = ['atheletebridge', 'registration'] as const;\n\nconst FIELD_FIELDS = `id key label fieldType required options helpText position`;\nconst FEE_FIELDS = `id name description amount feeType position`;\n\nconst FORM_FIELDS = `\n id workspaceId title description season teamId programId fixtureId slug status currency\n opensAt closesAt maxSubmissions waiverText publishedAt closedAt isOpen\n submissionCount createdAt updatedAt\n fixture { id competition type status scheduledAt venue }\n fields { ${FIELD_FIELDS} }\n fees { ${FEE_FIELDS} }\n`;\n\nconst SUBMISSION_FIELDS = `\n id workspaceId formId formTitle source submittedByUserId participantName\n participantUserId contactName contactEmail contactPhone answers selectedFeeIds\n status paymentStatus amountDue amountPaid amountOutstanding currency\n waiverAcceptedAt reviewNotes reviewedAt submittedAt createdAt updatedAt\n participantIsRegistrant rosterOutcome rosterMemberId rosterTeamId rosterTeamName\n checkInStatus checkedInAt checkedInBy\n`;\n\nconst PAYMENT_FIELDS = `\n id submissionId amount refundedAmount netAmount currency method processor status\n reference note receivedAt voidedAt voidReason refundedAt refundReason\n createdBy createdAt\n`;\n\nconst SUMMARY_FIELDS = `\n formId submissionCount acceptedCount notRequiredCount unpaidCount\n partiallyPaidCount paidCount refundedCount\n totals { currency amountDue amountCollected amountRefunded amountOutstanding }\n`;\n\nconst PUBLIC_FORM_FIELDS = `\n id slug title description season currency opensAt closesAt waiverText isOpen\n spotsRemaining\n fields { ${FIELD_FIELDS} }\n fees { ${FEE_FIELDS} }\n`;\n\nconst MY_REGISTRATION_FIELDS = `\n id formId formTitle formSlug participantName status paymentStatus amountDue\n amountPaid amountOutstanding currency onlinePaymentAvailable submittedAt\n`;\n\nconst PAYMENT_ACCOUNT_FIELDS = `\n provider accountId chargesEnabled payoutsEnabled detailsSubmitted lastSyncedAt createdAt\n`;\n\n/** Every registration read is invalidated together after any write. */\nconst useInvalidateRegistration = () => {\n const queryClient = useQueryClient();\n return () => queryClient.invalidateQueries({ queryKey: ROOT });\n};\n\n// ============================================================================\n// Forms (staff)\n// ============================================================================\n\nexport interface RegistrationFormFilters {\n status?: AthRegistrationFormStatus;\n season?: string;\n /** Only forms taking sign-ups for this fixture (BOFF-5863). */\n fixtureId?: string;\n pagination?: PaginationInput;\n}\n\nexport const useRegistrationForms = (filters: RegistrationFormFilters = {}) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'forms', filters],\n queryFn: async () => {\n const result = await athQuery<{ athListRegistrationForms: AthRegistrationFormConnection }>(\n `query AthListRegistrationForms(\n $status: AthRegistrationFormStatus\n $season: String\n $fixtureId: ID\n $pagination: PaginationInput\n ) {\n athListRegistrationForms(status: $status, season: $season, fixtureId: $fixtureId, pagination: $pagination) {\n items { ${FORM_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { ...filters },\n apiGatewayUrl\n );\n return result.athListRegistrationForms;\n },\n });\n};\n\nexport const useRegistrationForm = (id: string | undefined) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'form', id],\n queryFn: async () => {\n const result = await athQuery<{ athRegistrationForm: AthRegistrationForm | null }>(\n `query AthRegistrationForm($id: ID!) { athRegistrationForm(id: $id) { ${FORM_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return result.athRegistrationForm;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateRegistrationForm = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async (input: AthCreateRegistrationFormInput) => {\n const result = await athQuery<{ athCreateRegistrationForm: AthRegistrationForm }>(\n `mutation AthCreateRegistrationForm($input: AthCreateRegistrationFormInput!) {\n athCreateRegistrationForm(input: $input) { ${FORM_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.athCreateRegistrationForm;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport const useUpdateRegistrationForm = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: AthUpdateRegistrationFormInput }) => {\n const result = await athQuery<{ athUpdateRegistrationForm: AthRegistrationForm }>(\n `mutation AthUpdateRegistrationForm($id: ID!, $input: AthUpdateRegistrationFormInput!) {\n athUpdateRegistrationForm(id: $id, input: $input) { ${FORM_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return result.athUpdateRegistrationForm;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport type RegistrationFormLifecycleAction = 'publish' | 'close' | 'archive';\n\nconst LIFECYCLE_MUTATIONS: Record<\n RegistrationFormLifecycleAction,\n { field: string; selection: string }\n> = {\n publish: { field: 'athPublishRegistrationForm', selection: `{ ${FORM_FIELDS} }` },\n close: { field: 'athCloseRegistrationForm', selection: `{ ${FORM_FIELDS} }` },\n archive: { field: 'athArchiveRegistrationForm', selection: '' },\n};\n\nexport const useRegistrationFormLifecycle = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ id, action }: { id: string; action: RegistrationFormLifecycleAction }) => {\n const { field, selection } = LIFECYCLE_MUTATIONS[action];\n await athQuery<Record<string, unknown>>(\n `mutation AthRegistrationFormLifecycle($id: ID!) { ${field}(id: $id) ${selection} }`,\n { id },\n apiGatewayUrl\n );\n return action;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Submissions (staff)\n// ============================================================================\n\nexport interface RegistrationSubmissionFilters {\n formId?: string;\n status?: AthRegistrationSubmissionStatus;\n paymentStatus?: AthRegistrationPaymentStatus;\n /** Only sign-ups for forms targeting this fixture (BOFF-5863). */\n fixtureId?: string;\n /** Filter by tournament check-in state (BOFF-5863). */\n checkedIn?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useRegistrationSubmissions = (\n filters: RegistrationSubmissionFilters,\n enabled = true\n) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'submissions', filters],\n queryFn: async () => {\n const result = await athQuery<{\n athListRegistrationSubmissions: AthRegistrationSubmissionConnection;\n }>(\n `query AthListRegistrationSubmissions(\n $formId: ID\n $status: AthRegistrationSubmissionStatus\n $paymentStatus: AthRegistrationPaymentStatus\n $fixtureId: ID\n $checkedIn: Boolean\n $pagination: PaginationInput\n ) {\n athListRegistrationSubmissions(\n formId: $formId\n status: $status\n paymentStatus: $paymentStatus\n fixtureId: $fixtureId\n checkedIn: $checkedIn\n pagination: $pagination\n ) {\n items { ${SUBMISSION_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { ...filters },\n apiGatewayUrl\n );\n return result.athListRegistrationSubmissions;\n },\n enabled,\n });\n};\n\nexport const useRegistrationSubmission = (id: string | undefined) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'submission', id],\n queryFn: async () => {\n const result = await athQuery<{\n athRegistrationSubmission: AthRegistrationSubmission | null;\n }>(\n `query AthRegistrationSubmission($id: ID!) {\n athRegistrationSubmission(id: $id) { ${SUBMISSION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.athRegistrationSubmission;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useRecordRegistration = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async (input: AthRecordRegistrationInput) => {\n const result = await athQuery<{ athRecordRegistration: AthRegistrationSubmission }>(\n `mutation AthRecordRegistration($input: AthRecordRegistrationInput!) {\n athRecordRegistration(input: $input) { ${SUBMISSION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.athRecordRegistration;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport const useReviewRegistration = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({\n id,\n decision,\n notes,\n }: {\n id: string;\n decision: AthRegistrationDecision;\n notes?: string;\n }) => {\n const result = await athQuery<{ athReviewRegistrationSubmission: AthRegistrationSubmission }>(\n `mutation AthReviewRegistrationSubmission($id: ID!, $input: AthReviewRegistrationInput!) {\n athReviewRegistrationSubmission(id: $id, input: $input) { ${SUBMISSION_FIELDS} }\n }`,\n { id, input: { decision, notes } },\n apiGatewayUrl\n );\n return result.athReviewRegistrationSubmission;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Tournament check-in (BOFF-5863)\n// ============================================================================\n\n/**\n * Check an accepted sign-up in at the fixture, or undo a check-in. Both\n * mutations return the refreshed submission; `checkedIn` picks which one runs.\n * The service is idempotent, so a double-tap is a re-read, never a duplicate.\n */\nexport const useRegistrationCheckIn = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ id, checkedIn }: { id: string; checkedIn: boolean }) => {\n const field = checkedIn ? 'athCheckInRegistration' : 'athUndoRegistrationCheckIn';\n const result = await athQuery<{ [key: string]: AthRegistrationSubmission }>(\n `mutation AthRegistrationCheckIn($id: ID!) { ${field}(id: $id) { ${SUBMISSION_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return result[field];\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Payments (staff)\n// ============================================================================\n\nexport const useRegistrationPayments = (submissionId: string | undefined) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'payments', submissionId],\n queryFn: async () => {\n const result = await athQuery<{ athListRegistrationPayments: AthRegistrationPayment[] }>(\n `query AthListRegistrationPayments($submissionId: ID!) {\n athListRegistrationPayments(submissionId: $submissionId) { ${PAYMENT_FIELDS} }\n }`,\n { submissionId },\n apiGatewayUrl\n );\n return result.athListRegistrationPayments;\n },\n enabled: Boolean(submissionId),\n retry: false,\n });\n};\n\nexport const useRegistrationPaymentSummary = (formId?: string) => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'summary', formId ?? null],\n queryFn: async () => {\n const result = await athQuery<{\n athRegistrationPaymentSummary: AthRegistrationPaymentSummary;\n }>(\n `query AthRegistrationPaymentSummary($formId: ID) {\n athRegistrationPaymentSummary(formId: $formId) { ${SUMMARY_FIELDS} }\n }`,\n { formId: formId ?? null },\n apiGatewayUrl\n );\n return result.athRegistrationPaymentSummary;\n },\n // A coach can read submissions without the payment ledger; a FORBIDDEN\n // here just hides the money panel, so never retry it.\n retry: false,\n });\n};\n\nexport const useRecordRegistrationPayment = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async (input: AthRecordRegistrationPaymentInput) => {\n const result = await athQuery<{ athRecordRegistrationPayment: AthRegistrationPayment }>(\n `mutation AthRecordRegistrationPayment($input: AthRecordRegistrationPaymentInput!) {\n athRecordRegistrationPayment(input: $input) { ${PAYMENT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.athRecordRegistrationPayment;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport const useVoidRegistrationPayment = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ id, reason }: { id: string; reason: string }) => {\n const result = await athQuery<{ athVoidRegistrationPayment: AthRegistrationPayment }>(\n `mutation AthVoidRegistrationPayment($id: ID!, $reason: String!) {\n athVoidRegistrationPayment(id: $id, reason: $reason) { ${PAYMENT_FIELDS} }\n }`,\n { id, reason },\n apiGatewayUrl\n );\n return result.athVoidRegistrationPayment;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport const useRefundRegistrationPayment = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ id, amount, reason }: { id: string; amount: number; reason: string }) => {\n const result = await athQuery<{ athRefundRegistrationPayment: AthRegistrationPayment }>(\n `mutation AthRefundRegistrationPayment($id: ID!, $input: AthRefundRegistrationPaymentInput!) {\n athRefundRegistrationPayment(id: $id, input: $input) { ${PAYMENT_FIELDS} }\n }`,\n { id, input: { amount, reason } },\n apiGatewayUrl\n );\n return result.athRefundRegistrationPayment;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Online payments setup (staff, BOFF-10902)\n// ============================================================================\n\nexport const useOnlinePaymentsStatus = () => {\n const { apiGatewayUrl, workspaceId } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, workspaceId ?? null, 'online-payments'],\n queryFn: async () => {\n const result = await athQuery<{ athOnlinePaymentsStatus: AthOnlinePaymentsStatus }>(\n `query AthOnlinePaymentsStatus {\n athOnlinePaymentsStatus {\n processorConfigured testMode onlineCheckoutAvailable\n account { ${PAYMENT_ACCOUNT_FIELDS} }\n }\n }`,\n {},\n apiGatewayUrl\n );\n return result.athOnlinePaymentsStatus;\n },\n // Staff without payment-ledger access get FORBIDDEN: hide the card, never retry.\n retry: false,\n });\n};\n\n/**\n * Create (first call) or resume the club's processor onboarding. Resolves to\n * the hosted onboarding link; the caller redirects the browser to it.\n */\nexport const useConnectPaymentAccount = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n return useMutation({\n mutationFn: async (input: { returnUrl: string; email?: string }) => {\n const result = await athQuery<{ athConnectPaymentAccount: AthPaymentAccountLink }>(\n `mutation AthConnectPaymentAccount($input: AthConnectPaymentAccountInput!) {\n athConnectPaymentAccount(input: $input) {\n url expiresAt\n account { ${PAYMENT_ACCOUNT_FIELDS} }\n }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.athConnectPaymentAccount;\n },\n });\n};\n\nexport const useRefreshPaymentAccount = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async () => {\n const result = await athQuery<{ athRefreshPaymentAccount: AthPaymentAccount }>(\n `mutation AthRefreshPaymentAccount {\n athRefreshPaymentAccount { ${PAYMENT_ACCOUNT_FIELDS} }\n }`,\n {},\n apiGatewayUrl\n );\n return result.athRefreshPaymentAccount;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Family-facing (self-scoped)\n// ============================================================================\n\nexport const usePublicRegistrationForm = (slug: string | undefined) => {\n const { apiGatewayUrl } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, 'public', slug],\n queryFn: async () => {\n const result = await athQuery<{\n athRegistrationFormBySlug: AthPublicRegistrationForm | null;\n }>(\n `query AthRegistrationFormBySlug($slug: String!) {\n athRegistrationFormBySlug(slug: $slug) { ${PUBLIC_FORM_FIELDS} }\n }`,\n { slug },\n apiGatewayUrl\n );\n return result.athRegistrationFormBySlug;\n },\n enabled: Boolean(slug),\n });\n};\n\nexport const useSubmitRegistration = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async ({ slug, input }: { slug: string; input: AthSubmitRegistrationInput }) => {\n const result = await athQuery<{ athSubmitRegistration: AthMyRegistration }>(\n `mutation AthSubmitRegistration($slug: String!, $input: AthSubmitRegistrationInput!) {\n athSubmitRegistration(slug: $slug, input: $input) { ${MY_REGISTRATION_FIELDS} }\n }`,\n { slug, input },\n apiGatewayUrl\n );\n return result.athSubmitRegistration;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\nexport const useMyRegistrations = (pagination?: PaginationInput) => {\n const { apiGatewayUrl } = useAthleteBridge();\n return useQuery({\n queryKey: [...ROOT, 'mine', pagination ?? null],\n queryFn: async () => {\n const result = await athQuery<{ athMyRegistrations: AthMyRegistrationConnection }>(\n `query AthMyRegistrations($pagination: PaginationInput) {\n athMyRegistrations(pagination: $pagination) {\n items { ${MY_REGISTRATION_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { pagination: pagination ?? null },\n apiGatewayUrl\n );\n return result.athMyRegistrations;\n },\n });\n};\n\nexport const useWithdrawMyRegistration = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await athQuery<{ athWithdrawMyRegistration: AthMyRegistration }>(\n `mutation AthWithdrawMyRegistration($id: ID!) {\n athWithdrawMyRegistration(id: $id) { ${MY_REGISTRATION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.athWithdrawMyRegistration;\n },\n onSuccess: () => void invalidate(),\n });\n};\n\n// ============================================================================\n// Online checkout (family-facing, self-scoped, BOFF-10902)\n// ============================================================================\n\n/** Open a processor checkout for the outstanding balance of one of your registrations. */\nexport const useStartRegistrationCheckout = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n return useMutation({\n mutationFn: async (input: { submissionId: string; returnUrl: string }) => {\n const result = await athQuery<{\n athStartRegistrationCheckout: AthRegistrationCheckoutSession;\n }>(\n `mutation AthStartRegistrationCheckout($input: AthStartRegistrationCheckoutInput!) {\n athStartRegistrationCheckout(input: $input) { checkoutId url amount currency expiresAt }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.athStartRegistrationCheckout;\n },\n });\n};\n\n/** Settle a checkout after the processor sends the family back (the server re-reads it). */\nexport const useConfirmRegistrationCheckout = () => {\n const { apiGatewayUrl } = useAthleteBridge();\n const invalidate = useInvalidateRegistration();\n return useMutation({\n mutationFn: async (checkoutId: string) => {\n const result = await athQuery<{ athConfirmRegistrationCheckout: AthMyRegistration }>(\n `mutation AthConfirmRegistrationCheckout($checkoutId: ID!) {\n athConfirmRegistrationCheckout(checkoutId: $checkoutId) { ${MY_REGISTRATION_FIELDS} }\n }`,\n { checkoutId },\n apiGatewayUrl\n );\n return result.athConfirmRegistrationCheckout;\n },\n onSuccess: () => void invalidate(),\n });\n};\n"],"mappings":";;;;;AA+CA,IAAMA,IAAO,CAAC,kBAAkB,cAAc,GAExCC,IAAe,6DACfC,IAAa,+CAEbC,IAAc;;;;;aAKPF,EAAa;WACfC,EAAW;GAGhBE,IAAoB,obASpBC,IAAiB,0LAMjBC,IAAiB,2MAMjBC,IAAqB;;;aAGdN,EAAa;WACfC,EAAW;GAGhBM,IAAyB,iKAKzBC,IAAyB,kGAKzBC,UAAkC;CACtC,IAAMC,IAAcC,EAAe;CACnC,aAAaD,EAAY,kBAAkB,EAAE,UAAUX,EAAK,CAAC;AAC/D,GAcaa,KAAwB,IAAmC,CAAC,MAAM;CAC7E,IAAM,EAAE,kBAAe,mBAAgBC,EAAiB;CACxD,OAAOC,EAAS;EACd,UAAU;GAAC,GAAGf;GAAMgB,KAAe;GAAM;GAASC;EAAO;EACzD,SAAS,aAgBA,MAfcC,EACnB;;;;;;;sBAOcf,EAAY;;;YAI1B,EAAE,GAAGc,EAAQ,GACbE,CACF,EAAA,CACc;CAElB,CAAC;AACH,GAEaC,KAAuB,MAA2B;CAC7D,IAAM,EAAE,kBAAe,mBAAgBN,EAAiB;CACxD,OAAOC,EAAS;EACd,UAAU;GAAC,GAAGf;GAAMgB,KAAe;GAAM;GAAQK;EAAE;EACnD,SAAS,aAMA,MALcH,EACnB,wEAAwEf,EAAY,OACpF,EAAE,MAAG,GACLgB,CACF,EAAA,CACc;EAEhB,SAAS,EAAQE;CACnB,CAAC;AACH,GAEaC,UAAkC;CAC7C,IAAM,EAAE,qBAAkBR,EAAiB,GACrCS,IAAab,EAA0B;CAC7C,OAAOc,EAAY;EACjB,YAAY,OAAO,OAQV,MAPcN,EACnB;uDAC+Cf,EAAY;YAE3D,EAAE,SAAM,GACRgB,CACF,EAAA,CACc;EAEhB,iBAAiB,KAAKI,EAAW;CACnC,CAAC;AACH,GAEaE,UAAkC;CAC7C,IAAM,EA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7C,OAAOc,EAAY;EACjB,YAAY,OAAO,OAQV,MAPcN,EACnB;iDACyCV,EAAuB;YAEhE,EAAE,MAAG,GACLW,CACF,EAAA,CACc;EAEhB,iBAAiB,KAAKI,EAAW;CACnC,CAAC;AACH,GAOa8B,UAAqC;CAChD,IAAM,EAAE,qBAAkBvC,EAAiB;CAC3C,OAAOU,EAAY,EACjB,YAAY,OAAO,OAUV,MATcN,EAGnB,sMAGA,EAAE,SAAM,GACRC,CACF,EAAA,CACc,6BAElB,CAAC;AACH,GAGamC,UAAuC;CAClD,IAAM,EAAE,qBAAkBxC,EAAiB,GACrCS,IAAab,EAA0B;CAC7C,OAAOc,EAAY;EACjB,YAAY,OAAO,OAQV,MAPcN,EACnB;sEAC8DV,EAAuB;YAErF,EAAE,cAAW,GACbW,CACF,EAAA,CACc;EAEhB,iBAAiB,KAAKI,EAAW;CACnC,CAAC;AACH"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Audit log (BOFF-5863)
3
+ * @module atheletebridge/pages/audit
4
+ *
5
+ * The canonical, append-only AthleteBridge audit trail for workspace admins:
6
+ * filter by action / resource / actor / date / free text, page through the
7
+ * newest events, and export the matching rows as CSV or JSON. Rows are
8
+ * written by the service's audit consumer from the domain event stream, so
9
+ * everything shown here actually happened — there is nothing to edit.
10
+ */
11
+ export declare function AuditLogPage(): import('react').JSX.Element;
@@ -0,0 +1,277 @@
1
+ import { PageLayout as e } from "../../components/PageLayout.js";
2
+ import { EmptyState as t } from "../../components/EmptyState.js";
3
+ import { ErrorState as n, LoadingState as r } from "../../components/LoadingState.js";
4
+ import { FilterSelect as i } from "../../components/FilterSelect.js";
5
+ import { CursorPager as a } from "../../components/CursorPager.js";
6
+ import { StatusBadge as o } from "../../components/StatusBadge.js";
7
+ import { useUsersByIds as s } from "../../hooks/useAthleteBridgeApi.js";
8
+ import { downloadAuditExport as c, useAuditLogs as l, useExportAuditLogs as u } from "../../hooks/useAuditApi.js";
9
+ import { useAbTranslate as d } from "../../i18n.js";
10
+ import { formatDate as f } from "../../utils/formatters.js";
11
+ import { useState as p } from "react";
12
+ import { Download as m, ScrollText as h } from "lucide-react";
13
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
14
+ // src/atheletebridge/pages/audit/AuditLogPage.tsx
15
+ var y = 25, b = [
16
+ {
17
+ value: "CREATE",
18
+ label: "Created"
19
+ },
20
+ {
21
+ value: "UPDATE",
22
+ label: "Updated"
23
+ },
24
+ {
25
+ value: "DELETE",
26
+ label: "Deleted / archived"
27
+ },
28
+ {
29
+ value: "EXECUTE",
30
+ label: "Action run"
31
+ },
32
+ {
33
+ value: "EXPORT",
34
+ label: "Exported"
35
+ },
36
+ {
37
+ value: "CHECK_IN",
38
+ label: "Checked in"
39
+ },
40
+ {
41
+ value: "CHECK_OUT",
42
+ label: "Check-in undone"
43
+ },
44
+ {
45
+ value: "RESTORE",
46
+ label: "Restored"
47
+ }
48
+ ], x = [
49
+ {
50
+ value: "TEAM",
51
+ label: "Teams"
52
+ },
53
+ {
54
+ value: "MEMBER",
55
+ label: "Roster members"
56
+ },
57
+ {
58
+ value: "FIXTURE",
59
+ label: "Fixtures"
60
+ },
61
+ {
62
+ value: "PROGRAM",
63
+ label: "Programs"
64
+ },
65
+ {
66
+ value: "SESSION",
67
+ label: "Sessions"
68
+ },
69
+ {
70
+ value: "REGISTRATION_FORM",
71
+ label: "Registration forms"
72
+ },
73
+ {
74
+ value: "REGISTRATION_SUBMISSION",
75
+ label: "Registrations"
76
+ },
77
+ {
78
+ value: "REGISTRATION_PAYMENT",
79
+ label: "Payments"
80
+ },
81
+ {
82
+ value: "AUDIT_LOG",
83
+ label: "Audit exports"
84
+ }
85
+ ], S = "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50";
86
+ function C() {
87
+ let C = d(), [w, T] = p(""), [E, D] = p(""), [O, k] = p(""), [A, j] = p(""), [M, N] = p(""), [P, F] = p(0), [I, L] = p(null), R = {
88
+ action: w || void 0,
89
+ resourceType: E || void 0,
90
+ search: O.trim() || void 0,
91
+ dateFrom: A ? (/* @__PURE__ */ new Date(`${A}T00:00:00`)).toISOString() : void 0,
92
+ dateTo: M ? (/* @__PURE__ */ new Date(`${M}T23:59:59.999`)).toISOString() : void 0
93
+ }, z = l(R, {
94
+ limit: y,
95
+ offset: P * y
96
+ }), B = u(), V = z.data?.items ?? [], H = s(V.map((e) => e.actorId)), U = (e) => H.data?.[e]?.name ?? e, W = async (e) => {
97
+ L(null);
98
+ try {
99
+ let t = await B.mutateAsync({
100
+ filter: R,
101
+ format: e
102
+ });
103
+ c(t);
104
+ } catch (e) {
105
+ L(e instanceof Error ? e.message : C("atheletebridge.pages.audit.exportFailed", "Export failed."));
106
+ }
107
+ }, G = () => F(0);
108
+ return /* @__PURE__ */ v(e, {
109
+ title: C("atheletebridge.pages.audit.title", "Audit log"),
110
+ description: C("atheletebridge.pages.audit.description", "Who did what across your club — every change is recorded by the platform and cannot be edited or deleted."),
111
+ hero: !0,
112
+ gradientTitle: !0,
113
+ actions: /* @__PURE__ */ v("div", {
114
+ className: "flex flex-wrap gap-2",
115
+ children: [/* @__PURE__ */ v("button", {
116
+ type: "button",
117
+ className: S,
118
+ disabled: B.isPending,
119
+ onClick: () => void W("CSV"),
120
+ children: [
121
+ /* @__PURE__ */ _(m, { className: "h-4 w-4" }),
122
+ " ",
123
+ C("atheletebridge.pages.audit.exportCsv", "Export CSV")
124
+ ]
125
+ }), /* @__PURE__ */ v("button", {
126
+ type: "button",
127
+ className: S,
128
+ disabled: B.isPending,
129
+ onClick: () => void W("JSON"),
130
+ children: [
131
+ /* @__PURE__ */ _(m, { className: "h-4 w-4" }),
132
+ " ",
133
+ C("atheletebridge.pages.audit.exportJson", "Export JSON")
134
+ ]
135
+ })]
136
+ }),
137
+ children: [
138
+ I && /* @__PURE__ */ _("p", {
139
+ role: "alert",
140
+ className: "mb-4 text-sm text-status-error-text",
141
+ children: I
142
+ }),
143
+ /* @__PURE__ */ v("div", {
144
+ className: "mb-4 flex flex-wrap items-center gap-3",
145
+ children: [
146
+ /* @__PURE__ */ _(i, {
147
+ ariaLabel: C("atheletebridge.pages.audit.filterAction", "Filter by action"),
148
+ allLabel: C("atheletebridge.pages.audit.allActions", "All actions"),
149
+ value: w,
150
+ onChange: (e) => {
151
+ T(e), G();
152
+ },
153
+ options: b
154
+ }),
155
+ /* @__PURE__ */ _(i, {
156
+ ariaLabel: C("atheletebridge.pages.audit.filterResource", "Filter by resource"),
157
+ allLabel: C("atheletebridge.pages.audit.allResources", "All resources"),
158
+ value: E,
159
+ onChange: (e) => {
160
+ D(e), G();
161
+ },
162
+ options: x
163
+ }),
164
+ /* @__PURE__ */ _("input", {
165
+ type: "search",
166
+ value: O,
167
+ onChange: (e) => {
168
+ k(e.target.value), G();
169
+ },
170
+ placeholder: C("atheletebridge.pages.audit.searchPlaceholder", "Search name or description"),
171
+ "aria-label": C("atheletebridge.pages.audit.searchLabel", "Search the audit trail"),
172
+ className: "min-w-52 rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
173
+ }),
174
+ /* @__PURE__ */ v("label", {
175
+ className: "flex items-center gap-1.5 text-xs text-text-secondary",
176
+ children: [C("atheletebridge.pages.audit.from", "From"), /* @__PURE__ */ _("input", {
177
+ type: "date",
178
+ value: A,
179
+ onChange: (e) => {
180
+ j(e.target.value), G();
181
+ },
182
+ className: "rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
183
+ })]
184
+ }),
185
+ /* @__PURE__ */ v("label", {
186
+ className: "flex items-center gap-1.5 text-xs text-text-secondary",
187
+ children: [C("atheletebridge.pages.audit.to", "To"), /* @__PURE__ */ _("input", {
188
+ type: "date",
189
+ value: M,
190
+ onChange: (e) => {
191
+ N(e.target.value), G();
192
+ },
193
+ className: "rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
194
+ })]
195
+ })
196
+ ]
197
+ }),
198
+ z.isLoading ? /* @__PURE__ */ _(r, { label: C("atheletebridge.pages.audit.loading", "Loading the audit trail…") }) : z.isError ? /* @__PURE__ */ _(n, { onRetry: () => void z.refetch() }) : V.length === 0 ? /* @__PURE__ */ _(t, {
199
+ illustration: "empty-data",
200
+ icon: /* @__PURE__ */ _(h, { className: "h-10 w-10" }),
201
+ title: C("atheletebridge.pages.audit.empty", "No audit events match"),
202
+ description: C("atheletebridge.pages.audit.emptyHint", "Try widening the filters. Events appear here as club staff make changes.")
203
+ }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("div", {
204
+ className: "overflow-x-auto rounded-lg border border-border-seam",
205
+ children: /* @__PURE__ */ v("table", {
206
+ className: "w-full text-sm",
207
+ "data-testid": "audit-log",
208
+ children: [/* @__PURE__ */ _("thead", {
209
+ className: "bg-bg-sunken text-left text-xs uppercase tracking-wide text-text-secondary",
210
+ children: /* @__PURE__ */ v("tr", { children: [
211
+ /* @__PURE__ */ _("th", {
212
+ className: "px-4 py-2 font-medium",
213
+ children: C("atheletebridge.pages.audit.colWhen", "When")
214
+ }),
215
+ /* @__PURE__ */ _("th", {
216
+ className: "px-4 py-2 font-medium",
217
+ children: C("atheletebridge.pages.audit.colActor", "Who")
218
+ }),
219
+ /* @__PURE__ */ _("th", {
220
+ className: "px-4 py-2 font-medium",
221
+ children: C("atheletebridge.pages.audit.colAction", "Action")
222
+ }),
223
+ /* @__PURE__ */ _("th", {
224
+ className: "px-4 py-2 font-medium",
225
+ children: C("atheletebridge.pages.audit.colResource", "Resource")
226
+ }),
227
+ /* @__PURE__ */ _("th", {
228
+ className: "px-4 py-2 font-medium",
229
+ children: C("atheletebridge.pages.audit.colDetails", "Details")
230
+ })
231
+ ] })
232
+ }), /* @__PURE__ */ _("tbody", {
233
+ className: "divide-y divide-border-seam bg-bg-surface",
234
+ children: V.map((e) => /* @__PURE__ */ v("tr", {
235
+ className: "text-text-primary",
236
+ children: [
237
+ /* @__PURE__ */ _("td", {
238
+ className: "whitespace-nowrap px-4 py-2 text-text-secondary",
239
+ children: f(e.createdAt)
240
+ }),
241
+ /* @__PURE__ */ _("td", {
242
+ className: "px-4 py-2",
243
+ children: U(e.actorId)
244
+ }),
245
+ /* @__PURE__ */ _("td", {
246
+ className: "px-4 py-2",
247
+ children: /* @__PURE__ */ _(o, { status: e.action })
248
+ }),
249
+ /* @__PURE__ */ v("td", {
250
+ className: "px-4 py-2 text-text-secondary",
251
+ children: [x.find((t) => t.value === e.resourceType)?.label ?? e.resourceType, e.resourceName ? ` — ${e.resourceName}` : ""]
252
+ }),
253
+ /* @__PURE__ */ _("td", {
254
+ className: "px-4 py-2 text-text-secondary",
255
+ children: e.description ?? "—"
256
+ })
257
+ ]
258
+ }, e.id))
259
+ })]
260
+ })
261
+ }), /* @__PURE__ */ _(a, {
262
+ className: "mt-6",
263
+ page: P,
264
+ hasMore: z.data?.pageInfo.hasMore ?? !1,
265
+ onPrev: () => F((e) => Math.max(0, e - 1)),
266
+ onNext: () => F((e) => e + 1)
267
+ })] }),
268
+ /* @__PURE__ */ _("p", {
269
+ className: "mt-6 text-xs text-text-secondary",
270
+ children: C("atheletebridge.pages.audit.footer", "Exports are capped; page through the list for the complete trail. Exporting is itself recorded in the audit log.")
271
+ })
272
+ ]
273
+ });
274
+ }
275
+ export { C as AuditLogPage };
276
+
277
+ //# sourceMappingURL=AuditLogPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuditLogPage.js","names":["_Fragment","PAGE_SIZE","ACTION_OPTS","RESOURCE_OPTS","secondaryButton","AuditLogPage","tr","useAbTranslate","action","setAction","useState","resourceType","setResourceType","search","setSearch","dateFrom","setDateFrom","dateTo","setDateTo","page","setPage","exportError","setExportError","filter","logs","useAuditLogs","exporter","useExportAuditLogs","items","directory","useUsersByIds","row","actorName","actorId","runExport","payload","error","resetPage","PageLayout","Download","FilterSelect","v","LoadingState","ErrorState","EmptyState","ScrollText","Fragment","formatDate","StatusBadge","opt","CursorPager","p"],"sources":["../../../../src/atheletebridge/pages/audit/AuditLogPage.tsx"],"sourcesContent":["/**\n * Audit log (BOFF-5863)\n * @module atheletebridge/pages/audit\n *\n * The canonical, append-only AthleteBridge audit trail for workspace admins:\n * filter by action / resource / actor / date / free text, page through the\n * newest events, and export the matching rows as CSV or JSON. Rows are\n * written by the service's audit consumer from the domain event stream, so\n * everything shown here actually happened — there is nothing to edit.\n */\n\nimport { useState } from 'react';\nimport { Download, ScrollText } from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { EmptyState } from '../../components/EmptyState';\nimport { LoadingState, ErrorState } from '../../components/LoadingState';\nimport { FilterSelect } from '../../components/FilterSelect';\nimport { CursorPager } from '../../components/CursorPager';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { useUsersByIds } from '../../hooks/useAthleteBridgeApi';\nimport { downloadAuditExport, useAuditLogs, useExportAuditLogs } from '../../hooks/useAuditApi';\nimport { useAbTranslate } from '../../i18n';\nimport { formatDate } from '../../utils/formatters';\nimport type { AthAuditAction, AthAuditExportFormat, AthAuditResourceType } from '../../types/audit';\n\nconst PAGE_SIZE = 25;\n\nconst ACTION_OPTS: ReadonlyArray<{ value: AthAuditAction; label: string }> = [\n { value: 'CREATE', label: 'Created' },\n { value: 'UPDATE', label: 'Updated' },\n { value: 'DELETE', label: 'Deleted / archived' },\n { value: 'EXECUTE', label: 'Action run' },\n { value: 'EXPORT', label: 'Exported' },\n { value: 'CHECK_IN', label: 'Checked in' },\n { value: 'CHECK_OUT', label: 'Check-in undone' },\n { value: 'RESTORE', label: 'Restored' },\n];\n\nconst RESOURCE_OPTS: ReadonlyArray<{ value: AthAuditResourceType; label: string }> = [\n { value: 'TEAM', label: 'Teams' },\n { value: 'MEMBER', label: 'Roster members' },\n { value: 'FIXTURE', label: 'Fixtures' },\n { value: 'PROGRAM', label: 'Programs' },\n { value: 'SESSION', label: 'Sessions' },\n { value: 'REGISTRATION_FORM', label: 'Registration forms' },\n { value: 'REGISTRATION_SUBMISSION', label: 'Registrations' },\n { value: 'REGISTRATION_PAYMENT', label: 'Payments' },\n { value: 'AUDIT_LOG', label: 'Audit exports' },\n];\n\nconst secondaryButton =\n 'inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50';\n\nexport function AuditLogPage() {\n const tr = useAbTranslate();\n\n const [action, setAction] = useState<AthAuditAction | ''>('');\n const [resourceType, setResourceType] = useState<AthAuditResourceType | ''>('');\n const [search, setSearch] = useState('');\n const [dateFrom, setDateFrom] = useState('');\n const [dateTo, setDateTo] = useState('');\n const [page, setPage] = useState(0);\n const [exportError, setExportError] = useState<string | null>(null);\n\n const filter = {\n action: action || undefined,\n resourceType: resourceType || undefined,\n search: search.trim() || undefined,\n dateFrom: dateFrom ? new Date(`${dateFrom}T00:00:00`).toISOString() : undefined,\n dateTo: dateTo ? new Date(`${dateTo}T23:59:59.999`).toISOString() : undefined,\n };\n\n const logs = useAuditLogs(filter, { limit: PAGE_SIZE, offset: page * PAGE_SIZE });\n const exporter = useExportAuditLogs();\n\n const items = logs.data?.items ?? [];\n const directory = useUsersByIds(items.map((row) => row.actorId));\n const actorName = (actorId: string): string => directory.data?.[actorId]?.name ?? actorId;\n\n const runExport = async (format: AthAuditExportFormat) => {\n setExportError(null);\n try {\n const payload = await exporter.mutateAsync({ filter, format });\n downloadAuditExport(payload);\n } catch (error) {\n setExportError(\n error instanceof Error\n ? error.message\n : tr('atheletebridge.pages.audit.exportFailed', 'Export failed.')\n );\n }\n };\n\n const resetPage = () => setPage(0);\n\n return (\n <PageLayout\n title={tr('atheletebridge.pages.audit.title', 'Audit log')}\n description={tr(\n 'atheletebridge.pages.audit.description',\n 'Who did what across your club — every change is recorded by the platform and cannot be edited or deleted.'\n )}\n hero\n gradientTitle\n actions={\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n className={secondaryButton}\n disabled={exporter.isPending}\n onClick={() => void runExport('CSV')}\n >\n <Download className=\"h-4 w-4\" />{' '}\n {tr('atheletebridge.pages.audit.exportCsv', 'Export CSV')}\n </button>\n <button\n type=\"button\"\n className={secondaryButton}\n disabled={exporter.isPending}\n onClick={() => void runExport('JSON')}\n >\n <Download className=\"h-4 w-4\" />{' '}\n {tr('atheletebridge.pages.audit.exportJson', 'Export JSON')}\n </button>\n </div>\n }\n >\n {exportError && (\n <p role=\"alert\" className=\"mb-4 text-sm text-status-error-text\">\n {exportError}\n </p>\n )}\n\n <div className=\"mb-4 flex flex-wrap items-center gap-3\">\n <FilterSelect\n ariaLabel={tr('atheletebridge.pages.audit.filterAction', 'Filter by action')}\n allLabel={tr('atheletebridge.pages.audit.allActions', 'All actions')}\n value={action}\n onChange={(v) => {\n setAction(v);\n resetPage();\n }}\n options={ACTION_OPTS}\n />\n <FilterSelect\n ariaLabel={tr('atheletebridge.pages.audit.filterResource', 'Filter by resource')}\n allLabel={tr('atheletebridge.pages.audit.allResources', 'All resources')}\n value={resourceType}\n onChange={(v) => {\n setResourceType(v);\n resetPage();\n }}\n options={RESOURCE_OPTS}\n />\n <input\n type=\"search\"\n value={search}\n onChange={(e) => {\n setSearch(e.target.value);\n resetPage();\n }}\n placeholder={tr(\n 'atheletebridge.pages.audit.searchPlaceholder',\n 'Search name or description'\n )}\n aria-label={tr('atheletebridge.pages.audit.searchLabel', 'Search the audit trail')}\n className=\"min-w-52 rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n <label className=\"flex items-center gap-1.5 text-xs text-text-secondary\">\n {tr('atheletebridge.pages.audit.from', 'From')}\n <input\n type=\"date\"\n value={dateFrom}\n onChange={(e) => {\n setDateFrom(e.target.value);\n resetPage();\n }}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </label>\n <label className=\"flex items-center gap-1.5 text-xs text-text-secondary\">\n {tr('atheletebridge.pages.audit.to', 'To')}\n <input\n type=\"date\"\n value={dateTo}\n onChange={(e) => {\n setDateTo(e.target.value);\n resetPage();\n }}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </label>\n </div>\n\n {logs.isLoading ? (\n <LoadingState\n label={tr('atheletebridge.pages.audit.loading', 'Loading the audit trail…')}\n />\n ) : logs.isError ? (\n <ErrorState onRetry={() => void logs.refetch()} />\n ) : items.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<ScrollText className=\"h-10 w-10\" />}\n title={tr('atheletebridge.pages.audit.empty', 'No audit events match')}\n description={tr(\n 'atheletebridge.pages.audit.emptyHint',\n 'Try widening the filters. Events appear here as club staff make changes.'\n )}\n />\n ) : (\n <>\n <div className=\"overflow-x-auto rounded-lg border border-border-seam\">\n <table className=\"w-full text-sm\" data-testid=\"audit-log\">\n <thead className=\"bg-bg-sunken text-left text-xs uppercase tracking-wide text-text-secondary\">\n <tr>\n <th className=\"px-4 py-2 font-medium\">\n {tr('atheletebridge.pages.audit.colWhen', 'When')}\n </th>\n <th className=\"px-4 py-2 font-medium\">\n {tr('atheletebridge.pages.audit.colActor', 'Who')}\n </th>\n <th className=\"px-4 py-2 font-medium\">\n {tr('atheletebridge.pages.audit.colAction', 'Action')}\n </th>\n <th className=\"px-4 py-2 font-medium\">\n {tr('atheletebridge.pages.audit.colResource', 'Resource')}\n </th>\n <th className=\"px-4 py-2 font-medium\">\n {tr('atheletebridge.pages.audit.colDetails', 'Details')}\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-border-seam bg-bg-surface\">\n {items.map((row) => (\n <tr key={row.id} className=\"text-text-primary\">\n <td className=\"whitespace-nowrap px-4 py-2 text-text-secondary\">\n {formatDate(row.createdAt)}\n </td>\n <td className=\"px-4 py-2\">{actorName(row.actorId)}</td>\n <td className=\"px-4 py-2\">\n <StatusBadge status={row.action} />\n </td>\n <td className=\"px-4 py-2 text-text-secondary\">\n {RESOURCE_OPTS.find((opt) => opt.value === row.resourceType)?.label ??\n row.resourceType}\n {row.resourceName ? ` — ${row.resourceName}` : ''}\n </td>\n <td className=\"px-4 py-2 text-text-secondary\">{row.description ?? '—'}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <CursorPager\n className=\"mt-6\"\n page={page}\n hasMore={logs.data?.pageInfo.hasMore ?? false}\n onPrev={() => setPage((p) => Math.max(0, p - 1))}\n onNext={() => setPage((p) => p + 1)}\n />\n </>\n )}\n\n <p className=\"mt-6 text-xs text-text-secondary\">\n {tr(\n 'atheletebridge.pages.audit.footer',\n 'Exports are capped; page through the list for the complete trail. Exporting is itself recorded in the audit log.'\n )}\n </p>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAyBA,IAAMC,IAAY,IAEZC,IAAuE;CAC3E;EAAE,OAAO;EAAU,OAAO;CAAU;CACpC;EAAE,OAAO;EAAU,OAAO;CAAU;CACpC;EAAE,OAAO;EAAU,OAAO;CAAqB;CAC/C;EAAE,OAAO;EAAW,OAAO;CAAa;CACxC;EAAE,OAAO;EAAU,OAAO;CAAW;CACrC;EAAE,OAAO;EAAY,OAAO;CAAa;CACzC;EAAE,OAAO;EAAa,OAAO;CAAkB;CAC/C;EAAE,OAAO;EAAW,OAAO;CAAW;AACxC,GAEMC,IAA+E;CACnF;EAAE,OAAO;EAAQ,OAAO;CAAQ;CAChC;EAAE,OAAO;EAAU,OAAO;CAAiB;CAC3C;EAAE,OAAO;EAAW,OAAO;CAAW;CACtC;EAAE,OAAO;EAAW,OAAO;CAAW;CACtC;EAAE,OAAO;EAAW,OAAO;CAAW;CACtC;EAAE,O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
+ /**
2
+ * Club control room (BOFF-5863)
3
+ * @module atheletebridge/pages/control
4
+ *
5
+ * The multi-squad oversight surface for a club or academy: workspace-level
6
+ * KPIs plus one row per squad derived ENTIRELY from records already loaded
7
+ * through the real gateway queries — no invented metrics. A squad's
8
+ * W/D/L record uses full-time scores (knockout extra-time / penalty deciders
9
+ * are deliberately not folded into the league-style record).
10
+ */
11
+ export declare function ClubControlPage(): import('react').JSX.Element;