@burdenoff/microfe-atheletebridge 2026.1107.1 → 2026.1108.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 (36) hide show
  1. package/dist/atheletebridge/components/registration/OnlineCheckout.d.ts +11 -0
  2. package/dist/atheletebridge/components/registration/OnlineCheckout.d.ts.map +1 -0
  3. package/dist/atheletebridge/components/registration/OnlineCheckout.js +102 -0
  4. package/dist/atheletebridge/components/registration/OnlineCheckout.js.map +1 -0
  5. package/dist/atheletebridge/components/registration/OnlinePaymentsCard.d.ts +4 -0
  6. package/dist/atheletebridge/components/registration/OnlinePaymentsCard.d.ts.map +1 -0
  7. package/dist/atheletebridge/components/registration/OnlinePaymentsCard.js +150 -0
  8. package/dist/atheletebridge/components/registration/OnlinePaymentsCard.js.map +1 -0
  9. package/dist/atheletebridge/hooks/useRegistrationApi.d.ts +18 -1
  10. package/dist/atheletebridge/hooks/useRegistrationApi.d.ts.map +1 -1
  11. package/dist/atheletebridge/hooks/useRegistrationApi.js +76 -33
  12. package/dist/atheletebridge/hooks/useRegistrationApi.js.map +1 -1
  13. package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.d.ts +3 -1
  14. package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.d.ts.map +1 -1
  15. package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.js +71 -64
  16. package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.js.map +1 -1
  17. package/dist/atheletebridge/pages/registrations/RegisterPage.d.ts.map +1 -1
  18. package/dist/atheletebridge/pages/registrations/RegisterPage.js +81 -78
  19. package/dist/atheletebridge/pages/registrations/RegisterPage.js.map +1 -1
  20. package/dist/atheletebridge/pages/registrations/RegistrationFormsListPage.d.ts.map +1 -1
  21. package/dist/atheletebridge/pages/registrations/RegistrationFormsListPage.js +49 -47
  22. package/dist/atheletebridge/pages/registrations/RegistrationFormsListPage.js.map +1 -1
  23. package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.d.ts.map +1 -1
  24. package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js +120 -114
  25. package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js.map +1 -1
  26. package/dist/atheletebridge/types/registration.d.ts +38 -0
  27. package/dist/atheletebridge/types/registration.d.ts.map +1 -1
  28. package/dist/atheletebridge/utils/onlineCheckout.d.ts +69 -0
  29. package/dist/atheletebridge/utils/onlineCheckout.d.ts.map +1 -0
  30. package/dist/atheletebridge/utils/onlineCheckout.js +61 -0
  31. package/dist/atheletebridge/utils/onlineCheckout.js.map +1 -0
  32. package/dist/generated/global-types.d.ts +6164 -1907
  33. package/dist/generated/global-types.d.ts.map +1 -1
  34. package/dist/generated/wspace-types.d.ts +60796 -3422
  35. package/dist/generated/wspace-types.d.ts.map +1 -1
  36. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useRegistrationApi.js","names":[],"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 AthPublicRegistrationForm,\n AthRecordRegistrationInput,\n AthRecordRegistrationPaymentInput,\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 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 submittedAt\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// 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"],"mappings":";;;;;AA2CA,IAAM,IAAO,CAAC,kBAAkB,cAAc,GAExC,IAAe,6DACf,IAAa,+CAEb,IAAc;;;;aAIP,EAAa;WACf,EAAW;GAGhB,IAAoB,2YAQpB,IAAiB,gLAMjB,IAAiB,2MAMjB,IAAqB;;;aAGd,EAAa;WACf,EAAW;GAGhB,IAAyB,0IAMzB,UAAkC;CACtC,IAAM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W;CACnC,CAAC;AACH,GAMa,KAA6B,MAA6B;CACrE,IAAM,EAAE,qBAAkB,EAAiB;CAC3C,OAAO,EAAS;EACd,UAAU;GAAC,GAAG;GAAM;GAAU;EAAI;EAClC,SAAS,aAUA,MATc,EAGnB;qDAC6C,EAAmB;YAEhE,EAAE,QAAK,GACP,CACF,GACc;EAEhB,SAAS,EAAQ;CACnB,CAAC;AACH,GAEa,UAA8B;CACzC,IAAM,EAAE,qBAAkB,EAAiB,GACrC,IAAa,EAA0B;CAC7C,OAAO,EAAY;EACjB,YAAY,OAAO,EAAE,SAAM,gBAQlB,MAPc,EACnB;gEACwD,EAAuB;YAE/E;GAAE;GAAM;EAAM,GACd,CACF,GACc;EAEhB,iBAAiB,KAAK,EAAW;CACnC,CAAC;AACH,GAEa,KAAsB,MAAiC;CAClE,IAAM,EAAE,qBAAkB,EAAiB;CAC3C,OAAO,EAAS;EACd,UAAU;GAAC,GAAG;GAAM;GAAQ,KAAc;EAAI;EAC9C,SAAS,aAWA,MAVc,EACnB;;sBAEc,EAAuB;;;YAIrC,EAAE,YAAY,KAAc,KAAK,GACjC,CACF,GACc;CAElB,CAAC;AACH,GAEa,UAAkC;CAC7C,IAAM,EAAE,qBAAkB,EAAiB,GACrC,IAAa,EAA0B;CAC7C,OAAO,EAAY;EACjB,YAAY,OAAO,OAQV,MAPc,EACnB;iDACyC,EAAuB;YAEhE,EAAE,MAAG,GACL,CACF,GACc;EAEhB,iBAAiB,KAAK,EAAW;CACnC,CAAC;AACH"}
1
+ {"version":3,"file":"useRegistrationApi.js","names":[],"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,IAAM,IAAO,CAAC,kBAAkB,cAAc,GAExC,IAAe,6DACf,IAAa,+CAEb,IAAc;;;;aAIP,EAAa;WACf,EAAW;GAGhB,IAAoB,2YAQpB,IAAiB,0LAMjB,IAAiB,2MAMjB,IAAqB;;;aAGd,EAAa;WACf,EA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AAU;GAAC,GAAG;GAAM;GAAQ,KAAc;EAAI;EAC9C,SAAS,aAWA,MAVc,EACnB;;sBAEc,EAAuB;;;YAIrC,EAAE,YAAY,KAAc,KAAK,GACjC,CACF,GACc;CAElB,CAAC;AACH,GAEa,UAAkC;CAC7C,IAAM,EAAE,qBAAkB,EAAiB,GACrC,IAAa,EAA0B;CAC7C,OAAO,EAAY;EACjB,YAAY,OAAO,OAQV,MAPc,EACnB;iDACyC,EAAuB;YAEhE,EAAE,MAAG,GACL,CACF,GACc;EAEhB,iBAAiB,KAAK,EAAW;CACnC,CAAC;AACH,GAOa,UAAqC;CAChD,IAAM,EAAE,qBAAkB,EAAiB;CAC3C,OAAO,EAAY,EACjB,YAAY,OAAO,OAUV,MATc,EAGnB,sMAGA,EAAE,SAAM,GACR,CACF,GACc,6BAElB,CAAC;AACH,GAGa,UAAuC;CAClD,IAAM,EAAE,qBAAkB,EAAiB,GACrC,IAAa,EAA0B;CAC7C,OAAO,EAAY;EACjB,YAAY,OAAO,OAQV,MAPc,EACnB;sEAC8D,EAAuB;YAErF,EAAE,cAAW,GACb,CACF,GACc;EAEhB,iBAAiB,KAAK,EAAW;CACnC,CAAC;AACH"}
@@ -4,7 +4,9 @@
4
4
  *
5
5
  * Every registration the signed-in user submitted through a club's share
6
6
  * link, with its review and payment status (BOFF-4135). Unpaid registrations
7
- * the club has not reviewed yet can be withdrawn here.
7
+ * the club has not reviewed yet can be withdrawn here. When the club takes
8
+ * online payments, anything still due can be paid by card (BOFF-10902); the
9
+ * processor sends the family back here to settle the checkout.
8
10
  */
9
11
  export declare function MyRegistrationsPage(): import("react").JSX.Element;
10
12
  //# sourceMappingURL=MyRegistrationsPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MyRegistrationsPage.d.ts","sourceRoot":"","sources":["../../../../src/atheletebridge/pages/registrations/MyRegistrationsPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,wBAAgB,mBAAmB,gCAwFlC"}
1
+ {"version":3,"file":"MyRegistrationsPage.d.ts","sourceRoot":"","sources":["../../../../src/atheletebridge/pages/registrations/MyRegistrationsPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoBH,wBAAgB,mBAAmB,gCA0FlC"}
@@ -6,84 +6,91 @@ import { ErrorState as i, LoadingState as a } from "../../components/LoadingStat
6
6
  import { CursorPager as o } from "../../components/CursorPager.js";
7
7
  import { useMyRegistrations as s, useWithdrawMyRegistration as c } from "../../hooks/useRegistrationApi.js";
8
8
  import { formatMoney as l } from "../../utils/money.js";
9
- import { useState as u } from "react";
10
- import { ClipboardList as d, Undo2 as f } from "lucide-react";
11
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ import { canPayOnline as u } from "../../utils/onlineCheckout.js";
10
+ import { CheckoutReturnNotice as d, PayOnlineButton as f } from "../../components/registration/OnlineCheckout.js";
11
+ import { useState as p } from "react";
12
+ import { ClipboardList as m, Undo2 as h } from "lucide-react";
13
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
12
14
  //#region src/atheletebridge/pages/registrations/MyRegistrationsPage.tsx
13
- var g = 20;
14
- function _() {
15
- let [_, v] = u(0), y = s({
16
- limit: g,
17
- offset: _ * g
18
- }), b = c(), [x, S] = u(null), C = y.data?.items ?? [], w = async (e) => {
15
+ var y = 20;
16
+ function b() {
17
+ let [b, x] = p(0), S = s({
18
+ limit: y,
19
+ offset: b * y
20
+ }), C = c(), [w, T] = p(null), E = S.data?.items ?? [], D = async (e) => {
19
21
  if (window.confirm("Withdraw this registration?")) {
20
- S(null);
22
+ T(null);
21
23
  try {
22
- await b.mutateAsync(e);
24
+ await C.mutateAsync(e);
23
25
  } catch (e) {
24
- S(e instanceof Error ? e.message : "Could not withdraw the registration.");
26
+ T(e instanceof Error ? e.message : "Could not withdraw the registration.");
25
27
  }
26
28
  }
27
29
  };
28
- return /* @__PURE__ */ h(e, {
30
+ return /* @__PURE__ */ v(e, {
29
31
  title: "My registrations",
30
32
  description: "Registrations you have submitted to clubs and academies, and what is still due.",
31
- children: [x && /* @__PURE__ */ m("p", {
32
- role: "alert",
33
- className: "mb-4 text-sm text-status-error-text",
34
- children: x
35
- }), y.isLoading ? /* @__PURE__ */ m(a, { label: "Loading your registrations…" }) : y.isError ? /* @__PURE__ */ m(i, { onRetry: () => void y.refetch() }) : C.length === 0 ? /* @__PURE__ */ m(r, {
36
- illustration: "empty-data",
37
- icon: /* @__PURE__ */ m(d, { className: "h-10 w-10" }),
38
- title: "No registrations yet",
39
- description: "When you register through a club's link, it shows up here."
40
- }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("ul", {
41
- className: "divide-y divide-border-seam rounded-lg border border-border-seam bg-bg-surface",
42
- "data-testid": "my-registrations",
43
- children: C.map((e) => /* @__PURE__ */ h("li", {
44
- className: "flex flex-wrap items-center justify-between gap-3 px-4 py-3",
45
- children: [/* @__PURE__ */ h("span", {
46
- className: "min-w-0",
47
- children: [/* @__PURE__ */ m("span", {
48
- className: "block font-medium text-text-primary",
49
- children: e.participantName
50
- }), /* @__PURE__ */ h("span", {
51
- className: "block text-xs text-text-secondary",
33
+ children: [
34
+ /* @__PURE__ */ _(d, {}),
35
+ w && /* @__PURE__ */ _("p", {
36
+ role: "alert",
37
+ className: "mb-4 text-sm text-status-error-text",
38
+ children: w
39
+ }),
40
+ S.isLoading ? /* @__PURE__ */ _(a, { label: "Loading your registrations…" }) : S.isError ? /* @__PURE__ */ _(i, { onRetry: () => void S.refetch() }) : E.length === 0 ? /* @__PURE__ */ _(r, {
41
+ illustration: "empty-data",
42
+ icon: /* @__PURE__ */ _(m, { className: "h-10 w-10" }),
43
+ title: "No registrations yet",
44
+ description: "When you register through a club's link, it shows up here."
45
+ }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("ul", {
46
+ className: "divide-y divide-border-seam rounded-lg border border-border-seam bg-bg-surface",
47
+ "data-testid": "my-registrations",
48
+ children: E.map((e) => /* @__PURE__ */ v("li", {
49
+ className: "flex flex-wrap items-center justify-between gap-3 px-4 py-3",
50
+ children: [/* @__PURE__ */ v("span", {
51
+ className: "min-w-0",
52
+ children: [/* @__PURE__ */ _("span", {
53
+ className: "block font-medium text-text-primary",
54
+ children: e.participantName
55
+ }), /* @__PURE__ */ v("span", {
56
+ className: "block text-xs text-text-secondary",
57
+ children: [
58
+ e.formTitle,
59
+ " · ",
60
+ n(e.submittedAt)
61
+ ]
62
+ })]
63
+ }), /* @__PURE__ */ v("span", {
64
+ className: "flex flex-wrap items-center gap-2",
52
65
  children: [
53
- e.formTitle,
54
- " · ",
55
- n(e.submittedAt)
66
+ /* @__PURE__ */ _(t, { status: e.status }),
67
+ /* @__PURE__ */ _(t, { status: e.paymentStatus }),
68
+ e.amountDue > 0 && /* @__PURE__ */ v("span", {
69
+ className: "text-sm tabular-nums text-text-secondary",
70
+ children: [l(e.amountOutstanding, e.currency), " due"]
71
+ }),
72
+ u(e) && /* @__PURE__ */ _(f, { registration: e }),
73
+ e.status === "SUBMITTED" && e.amountPaid === 0 && /* @__PURE__ */ v("button", {
74
+ type: "button",
75
+ disabled: C.isPending,
76
+ onClick: () => void D(e.id),
77
+ className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50",
78
+ children: [/* @__PURE__ */ _(h, { className: "h-4 w-4" }), " Withdraw"]
79
+ })
56
80
  ]
57
81
  })]
58
- }), /* @__PURE__ */ h("span", {
59
- className: "flex flex-wrap items-center gap-2",
60
- children: [
61
- /* @__PURE__ */ m(t, { status: e.status }),
62
- /* @__PURE__ */ m(t, { status: e.paymentStatus }),
63
- e.amountDue > 0 && /* @__PURE__ */ h("span", {
64
- className: "text-sm tabular-nums text-text-secondary",
65
- children: [l(e.amountOutstanding, e.currency), " due"]
66
- }),
67
- e.status === "SUBMITTED" && e.amountPaid === 0 && /* @__PURE__ */ h("button", {
68
- type: "button",
69
- disabled: b.isPending,
70
- onClick: () => void w(e.id),
71
- className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50",
72
- children: [/* @__PURE__ */ m(f, { className: "h-4 w-4" }), " Withdraw"]
73
- })
74
- ]
75
- })]
76
- }, e.id))
77
- }), /* @__PURE__ */ m(o, {
78
- className: "mt-6",
79
- page: _,
80
- hasMore: y.data?.pageInfo.hasMore ?? !1,
81
- onPrev: () => v((e) => Math.max(0, e - 1)),
82
- onNext: () => v((e) => e + 1)
83
- })] })]
82
+ }, e.id))
83
+ }), /* @__PURE__ */ _(o, {
84
+ className: "mt-6",
85
+ page: b,
86
+ hasMore: S.data?.pageInfo.hasMore ?? !1,
87
+ onPrev: () => x((e) => Math.max(0, e - 1)),
88
+ onNext: () => x((e) => e + 1)
89
+ })] })
90
+ ]
84
91
  });
85
92
  }
86
93
  //#endregion
87
- export { _ as MyRegistrationsPage };
94
+ export { b as MyRegistrationsPage };
88
95
 
89
96
  //# sourceMappingURL=MyRegistrationsPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MyRegistrationsPage.js","names":[],"sources":["../../../../src/atheletebridge/pages/registrations/MyRegistrationsPage.tsx"],"sourcesContent":["/**\n * My registrations (families)\n * @module atheletebridge/pages/registrations\n *\n * Every registration the signed-in user submitted through a club's share\n * link, with its review and payment status (BOFF-4135). Unpaid registrations\n * the club has not reviewed yet can be withdrawn here.\n */\n\nimport { useState } from 'react';\nimport { ClipboardList, Undo2 } from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { EmptyState } from '../../components/EmptyState';\nimport { LoadingState, ErrorState } from '../../components/LoadingState';\nimport { CursorPager } from '../../components/CursorPager';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { useMyRegistrations, useWithdrawMyRegistration } from '../../hooks/useRegistrationApi';\nimport { formatDate } from '../../utils/formatters';\nimport { formatMoney } from '../../utils/money';\n\nconst PAGE_SIZE = 20;\n\nexport function MyRegistrationsPage() {\n const [page, setPage] = useState(0);\n const mine = useMyRegistrations({ limit: PAGE_SIZE, offset: page * PAGE_SIZE });\n const withdraw = useWithdrawMyRegistration();\n const [error, setError] = useState<string | null>(null);\n const items = mine.data?.items ?? [];\n\n const onWithdraw = async (id: string) => {\n if (!window.confirm('Withdraw this registration?')) return;\n setError(null);\n try {\n await withdraw.mutateAsync(id);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Could not withdraw the registration.');\n }\n };\n\n return (\n <PageLayout\n title=\"My registrations\"\n description=\"Registrations you have submitted to clubs and academies, and what is still due.\"\n >\n {error && (\n <p role=\"alert\" className=\"mb-4 text-sm text-status-error-text\">\n {error}\n </p>\n )}\n {mine.isLoading ? (\n <LoadingState label=\"Loading your registrations…\" />\n ) : mine.isError ? (\n <ErrorState onRetry={() => void mine.refetch()} />\n ) : items.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<ClipboardList className=\"h-10 w-10\" />}\n title=\"No registrations yet\"\n description=\"When you register through a club's link, it shows up here.\"\n />\n ) : (\n <>\n <ul\n className=\"divide-y divide-border-seam rounded-lg border border-border-seam bg-bg-surface\"\n data-testid=\"my-registrations\"\n >\n {items.map((row) => (\n <li\n key={row.id}\n className=\"flex flex-wrap items-center justify-between gap-3 px-4 py-3\"\n >\n <span className=\"min-w-0\">\n <span className=\"block font-medium text-text-primary\">{row.participantName}</span>\n <span className=\"block text-xs text-text-secondary\">\n {row.formTitle} · {formatDate(row.submittedAt)}\n </span>\n </span>\n <span className=\"flex flex-wrap items-center gap-2\">\n <StatusBadge status={row.status} />\n <StatusBadge status={row.paymentStatus} />\n {row.amountDue > 0 && (\n <span className=\"text-sm tabular-nums text-text-secondary\">\n {formatMoney(row.amountOutstanding, row.currency)} due\n </span>\n )}\n {row.status === 'SUBMITTED' && row.amountPaid === 0 && (\n <button\n type=\"button\"\n disabled={withdraw.isPending}\n onClick={() => void onWithdraw(row.id)}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50\"\n >\n <Undo2 className=\"h-4 w-4\" /> Withdraw\n </button>\n )}\n </span>\n </li>\n ))}\n </ul>\n <CursorPager\n className=\"mt-6\"\n page={page}\n hasMore={mine.data?.pageInfo.hasMore ?? false}\n onPrev={() => setPage((p) => Math.max(0, p - 1))}\n onNext={() => setPage((p) => p + 1)}\n />\n </>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAM,IAAY;AAElB,SAAgB,IAAsB;CACpC,IAAM,CAAC,GAAM,KAAW,EAAS,CAAC,GAC5B,IAAO,EAAmB;EAAE,OAAO;EAAW,QAAQ,IAAO;CAAU,CAAC,GACxE,IAAW,EAA0B,GACrC,CAAC,GAAO,KAAY,EAAwB,IAAI,GAChD,IAAQ,EAAK,MAAM,SAAS,CAAC,GAE7B,IAAa,OAAO,MAAe;EAClC,WAAO,QAAQ,6BAA6B,GACjD;KAAS,IAAI;GACb,IAAI;IACF,MAAM,EAAS,YAAY,CAAE;GAC/B,SAAS,GAAK;IACZ,EAAS,aAAe,QAAQ,EAAI,UAAU,sCAAsC;GACtF;EALa;CAMf;CAEA,OACE,kBAAC,GAAD;EACE,OAAM;EACN,aAAY;YAFd,CAIG,KACC,kBAAC,KAAD;GAAG,MAAK;GAAQ,WAAU;aACvB;EACA,CAAA,GAEJ,EAAK,YACJ,kBAAC,GAAD,EAAc,OAAM,8BAA+B,CAAA,IACjD,EAAK,UACP,kBAAC,GAAD,EAAY,eAAe,KAAK,EAAK,QAAQ,EAAI,CAAA,IAC/C,EAAM,WAAW,IACnB,kBAAC,GAAD;GACE,cAAa;GACb,MAAM,kBAAC,GAAD,EAAe,WAAU,YAAa,CAAA;GAC5C,OAAM;GACN,aAAY;EACb,CAAA,IAED,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,MAAD;GACE,WAAU;GACV,eAAY;aAEX,EAAM,KAAK,MACV,kBAAC,MAAD;IAEE,WAAU;cAFZ,CAIE,kBAAC,QAAD;KAAM,WAAU;eAAhB,CACE,kBAAC,QAAD;MAAM,WAAU;gBAAuC,EAAI;KAAsB,CAAA,GACjF,kBAAC,QAAD;MAAM,WAAU;gBAAhB;OACG,EAAI;OAAU;OAAI,EAAW,EAAI,WAAW;MACzC;OACF;QACN,kBAAC,QAAD;KAAM,WAAU;eAAhB;MACE,kBAAC,GAAD,EAAa,QAAQ,EAAI,OAAS,CAAA;MAClC,kBAAC,GAAD,EAAa,QAAQ,EAAI,cAAgB,CAAA;MACxC,EAAI,YAAY,KACf,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CACG,EAAY,EAAI,mBAAmB,EAAI,QAAQ,GAAE,MAC9C;;MAEP,EAAI,WAAW,eAAe,EAAI,eAAe,KAChD,kBAAC,UAAD;OACE,MAAK;OACL,UAAU,EAAS;OACnB,eAAe,KAAK,EAAW,EAAI,EAAE;OACrC,WAAU;iBAJZ,CAME,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA,GAAC,WACvB;;KAEN;MACJ;MA5BG,EAAI,EA4BP,CACL;EACC,CAAA,GACJ,kBAAC,GAAD;GACE,WAAU;GACJ;GACN,SAAS,EAAK,MAAM,SAAS,WAAW;GACxC,cAAc,GAAS,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC,CAAC;GAC/C,cAAc,GAAS,MAAM,IAAI,CAAC;EACnC,CAAA,CACD,EAAA,CAAA,CAEM;;AAEhB"}
1
+ {"version":3,"file":"MyRegistrationsPage.js","names":[],"sources":["../../../../src/atheletebridge/pages/registrations/MyRegistrationsPage.tsx"],"sourcesContent":["/**\n * My registrations (families)\n * @module atheletebridge/pages/registrations\n *\n * Every registration the signed-in user submitted through a club's share\n * link, with its review and payment status (BOFF-4135). Unpaid registrations\n * the club has not reviewed yet can be withdrawn here. When the club takes\n * online payments, anything still due can be paid by card (BOFF-10902); the\n * processor sends the family back here to settle the checkout.\n */\n\nimport { useState } from 'react';\nimport { ClipboardList, Undo2 } from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { EmptyState } from '../../components/EmptyState';\nimport { LoadingState, ErrorState } from '../../components/LoadingState';\nimport { CursorPager } from '../../components/CursorPager';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport {\n CheckoutReturnNotice,\n PayOnlineButton,\n} from '../../components/registration/OnlineCheckout';\nimport { useMyRegistrations, useWithdrawMyRegistration } from '../../hooks/useRegistrationApi';\nimport { formatDate } from '../../utils/formatters';\nimport { formatMoney } from '../../utils/money';\nimport { canPayOnline } from '../../utils/onlineCheckout';\n\nconst PAGE_SIZE = 20;\n\nexport function MyRegistrationsPage() {\n const [page, setPage] = useState(0);\n const mine = useMyRegistrations({ limit: PAGE_SIZE, offset: page * PAGE_SIZE });\n const withdraw = useWithdrawMyRegistration();\n const [error, setError] = useState<string | null>(null);\n const items = mine.data?.items ?? [];\n\n const onWithdraw = async (id: string) => {\n if (!window.confirm('Withdraw this registration?')) return;\n setError(null);\n try {\n await withdraw.mutateAsync(id);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Could not withdraw the registration.');\n }\n };\n\n return (\n <PageLayout\n title=\"My registrations\"\n description=\"Registrations you have submitted to clubs and academies, and what is still due.\"\n >\n <CheckoutReturnNotice />\n {error && (\n <p role=\"alert\" className=\"mb-4 text-sm text-status-error-text\">\n {error}\n </p>\n )}\n {mine.isLoading ? (\n <LoadingState label=\"Loading your registrations…\" />\n ) : mine.isError ? (\n <ErrorState onRetry={() => void mine.refetch()} />\n ) : items.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<ClipboardList className=\"h-10 w-10\" />}\n title=\"No registrations yet\"\n description=\"When you register through a club's link, it shows up here.\"\n />\n ) : (\n <>\n <ul\n className=\"divide-y divide-border-seam rounded-lg border border-border-seam bg-bg-surface\"\n data-testid=\"my-registrations\"\n >\n {items.map((row) => (\n <li\n key={row.id}\n className=\"flex flex-wrap items-center justify-between gap-3 px-4 py-3\"\n >\n <span className=\"min-w-0\">\n <span className=\"block font-medium text-text-primary\">{row.participantName}</span>\n <span className=\"block text-xs text-text-secondary\">\n {row.formTitle} · {formatDate(row.submittedAt)}\n </span>\n </span>\n <span className=\"flex flex-wrap items-center gap-2\">\n <StatusBadge status={row.status} />\n <StatusBadge status={row.paymentStatus} />\n {row.amountDue > 0 && (\n <span className=\"text-sm tabular-nums text-text-secondary\">\n {formatMoney(row.amountOutstanding, row.currency)} due\n </span>\n )}\n {canPayOnline(row) && <PayOnlineButton registration={row} />}\n {row.status === 'SUBMITTED' && row.amountPaid === 0 && (\n <button\n type=\"button\"\n disabled={withdraw.isPending}\n onClick={() => void onWithdraw(row.id)}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50\"\n >\n <Undo2 className=\"h-4 w-4\" /> Withdraw\n </button>\n )}\n </span>\n </li>\n ))}\n </ul>\n <CursorPager\n className=\"mt-6\"\n page={page}\n hasMore={mine.data?.pageInfo.hasMore ?? false}\n onPrev={() => setPage((p) => Math.max(0, p - 1))}\n onNext={() => setPage((p) => p + 1)}\n />\n </>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA2BA,IAAM,IAAY;AAElB,SAAgB,IAAsB;CACpC,IAAM,CAAC,GAAM,KAAW,EAAS,CAAC,GAC5B,IAAO,EAAmB;EAAE,OAAO;EAAW,QAAQ,IAAO;CAAU,CAAC,GACxE,IAAW,EAA0B,GACrC,CAAC,GAAO,KAAY,EAAwB,IAAI,GAChD,IAAQ,EAAK,MAAM,SAAS,CAAC,GAE7B,IAAa,OAAO,MAAe;EAClC,WAAO,QAAQ,6BAA6B,GACjD;KAAS,IAAI;GACb,IAAI;IACF,MAAM,EAAS,YAAY,CAAE;GAC/B,SAAS,GAAK;IACZ,EAAS,aAAe,QAAQ,EAAI,UAAU,sCAAsC;GAC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CAAA,GAAC,WACvB;;MAEN;OACJ;OA7BG,EAAI,EA6BP,CACL;GACC,CAAA,GACJ,kBAAC,GAAD;IACE,WAAU;IACJ;IACN,SAAS,EAAK,MAAM,SAAS,WAAW;IACxC,cAAc,GAAS,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC,CAAC;IAC/C,cAAc,GAAS,MAAM,IAAI,CAAC;GACnC,CAAA,CACD,EAAA,CAAA;EAEM;;AAEhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"RegisterPage.d.ts","sourceRoot":"","sources":["../../../../src/atheletebridge/pages/registrations/RegisterPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsBH,wBAAgB,YAAY,gCAkK3B"}
1
+ {"version":3,"file":"RegisterPage.d.ts","sourceRoot":"","sources":["../../../../src/atheletebridge/pages/registrations/RegisterPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwBH,wBAAgB,YAAY,gCA2K3B"}
@@ -6,150 +6,153 @@ import { EmptyState as i } from "../../components/EmptyState.js";
6
6
  import { ErrorState as a, LoadingState as o } from "../../components/LoadingState.js";
7
7
  import { usePublicRegistrationForm as s, useSubmitRegistration as c } from "../../hooks/useRegistrationApi.js";
8
8
  import { formatMoney as l } from "../../utils/money.js";
9
- import { EMPTY_REGISTRATION_ENTRY as u, cleanAnswers as d, missingRequiredAnswer as f } from "../../components/registration/entryRules.js";
10
- import { RegistrationEntryFields as p } from "../../components/registration/RegistrationEntryFields.js";
11
- import { useState as m } from "react";
12
- import { CheckCircle2 as h, ClipboardX as g, Loader2 as _, Send as v } from "lucide-react";
13
- import { useParams as y } from "react-router";
14
- import { jsx as b, jsxs as x } from "react/jsx-runtime";
9
+ import { canPayOnline as u } from "../../utils/onlineCheckout.js";
10
+ import { PayOnlineButton as d } from "../../components/registration/OnlineCheckout.js";
11
+ import { EMPTY_REGISTRATION_ENTRY as f, cleanAnswers as p, missingRequiredAnswer as m } from "../../components/registration/entryRules.js";
12
+ import { RegistrationEntryFields as h } from "../../components/registration/RegistrationEntryFields.js";
13
+ import { useState as g } from "react";
14
+ import { CheckCircle2 as _, ClipboardX as v, Loader2 as y, Send as b } from "lucide-react";
15
+ import { useParams as x } from "react-router";
16
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
15
17
  //#region src/atheletebridge/pages/registrations/RegisterPage.tsx
16
- function S() {
17
- let { slug: S } = y(), { navigateTo: C } = e(), w = s(S), T = c(), [E, D] = m(u), [O, k] = m(null), [A, j] = m(null);
18
- if (w.isLoading) return /* @__PURE__ */ b(t, {
18
+ function w() {
19
+ let { slug: w } = x(), { navigateTo: T } = e(), E = s(w), D = c(), [O, k] = g(f), [A, j] = g(null), [M, N] = g(null);
20
+ if (E.isLoading) return /* @__PURE__ */ S(t, {
19
21
  title: "Registration",
20
- children: /* @__PURE__ */ b(o, { label: "Loading registration form…" })
22
+ children: /* @__PURE__ */ S(o, { label: "Loading registration form…" })
21
23
  });
22
- if (w.isError) return /* @__PURE__ */ b(t, {
24
+ if (E.isError) return /* @__PURE__ */ S(t, {
23
25
  title: "Registration",
24
- children: /* @__PURE__ */ b(a, { onRetry: () => void w.refetch() })
26
+ children: /* @__PURE__ */ S(a, { onRetry: () => void E.refetch() })
25
27
  });
26
- if (!w.data || !S) return /* @__PURE__ */ b(t, {
28
+ if (!E.data || !w) return /* @__PURE__ */ S(t, {
27
29
  title: "Registration",
28
- children: /* @__PURE__ */ b(i, {
30
+ children: /* @__PURE__ */ S(i, {
29
31
  illustration: "empty-data",
30
- icon: /* @__PURE__ */ b(g, { className: "h-10 w-10" }),
32
+ icon: /* @__PURE__ */ S(v, { className: "h-10 w-10" }),
31
33
  title: "This registration link is not available",
32
34
  description: "The club may not have published it yet, or the link is incorrect. Check the link with the club."
33
35
  })
34
36
  });
35
- let M = w.data;
36
- if (A) return /* @__PURE__ */ b(t, {
37
- title: M.title,
38
- children: /* @__PURE__ */ x("div", {
37
+ let P = E.data;
38
+ if (M) return /* @__PURE__ */ S(t, {
39
+ title: P.title,
40
+ children: /* @__PURE__ */ C("div", {
39
41
  className: "max-w-xl space-y-4 rounded-lg border border-border-seam bg-bg-surface p-6",
40
42
  "data-testid": "registration-receipt",
41
43
  children: [
42
- /* @__PURE__ */ x("p", {
44
+ /* @__PURE__ */ C("p", {
43
45
  className: "flex items-center gap-2 text-lg font-semibold text-text-primary",
44
- children: [/* @__PURE__ */ b(h, { className: "h-6 w-6 text-status-success-text" }), " Registration received"]
46
+ children: [/* @__PURE__ */ S(_, { className: "h-6 w-6 text-status-success-text" }), " Registration received"]
45
47
  }),
46
- /* @__PURE__ */ x("p", {
48
+ /* @__PURE__ */ C("p", {
47
49
  className: "text-sm text-text-secondary",
48
50
  children: [
49
- A.participantName,
51
+ M.participantName,
50
52
  " is registered for ",
51
- A.formTitle,
52
- ". The club will review it",
53
- A.amountDue > 0 ? " and confirm payment details with you" : "",
54
- "."
53
+ M.formTitle,
54
+ ".",
55
+ " ",
56
+ u(M) ? "The club will review it. You can pay the fee online now, or later from My registrations." : M.amountDue > 0 ? "The club will review it and confirm payment details with you." : "The club will review it."
55
57
  ]
56
58
  }),
57
- /* @__PURE__ */ x("div", {
59
+ /* @__PURE__ */ C("div", {
58
60
  className: "flex flex-wrap items-center gap-2 text-sm",
59
61
  children: [
60
- /* @__PURE__ */ b(n, { status: A.status }),
61
- /* @__PURE__ */ b(n, { status: A.paymentStatus }),
62
- A.amountDue > 0 && /* @__PURE__ */ x("span", {
62
+ /* @__PURE__ */ S(n, { status: M.status }),
63
+ /* @__PURE__ */ S(n, { status: M.paymentStatus }),
64
+ M.amountDue > 0 && /* @__PURE__ */ C("span", {
63
65
  className: "tabular-nums text-text-primary",
64
- children: [l(A.amountOutstanding, A.currency), " due"]
66
+ children: [l(M.amountOutstanding, M.currency), " due"]
65
67
  })
66
68
  ]
67
69
  }),
68
- /* @__PURE__ */ b("button", {
70
+ u(M) && /* @__PURE__ */ S("div", { children: /* @__PURE__ */ S(d, { registration: M }) }),
71
+ /* @__PURE__ */ S("button", {
69
72
  type: "button",
70
- onClick: () => C("/my-registrations"),
73
+ onClick: () => T("/my-registrations"),
71
74
  className: "inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90",
72
75
  children: "View my registrations"
73
76
  })
74
77
  ]
75
78
  })
76
79
  });
77
- let N = async (e) => {
78
- e.preventDefault(), k(null);
79
- let t = f(M.fields, E);
80
+ let F = async (e) => {
81
+ e.preventDefault(), j(null);
82
+ let t = m(P.fields, O);
80
83
  if (t) {
81
- k(`Please answer "${t}".`);
84
+ j(`Please answer "${t}".`);
82
85
  return;
83
86
  }
84
- if (M.waiverText && !E.waiverAccepted) {
85
- k("Please accept the waiver to register.");
87
+ if (P.waiverText && !O.waiverAccepted) {
88
+ j("Please accept the waiver to register.");
86
89
  return;
87
90
  }
88
91
  try {
89
- j(await T.mutateAsync({
90
- slug: S,
92
+ N(await D.mutateAsync({
93
+ slug: w,
91
94
  input: {
92
- participantName: E.participantName.trim(),
93
- contactName: E.contactName.trim() || void 0,
94
- contactEmail: E.contactEmail.trim() || void 0,
95
- contactPhone: E.contactPhone.trim() || void 0,
96
- answers: d(E.answers),
97
- selectedFeeIds: E.optionalFeeIds,
98
- waiverAccepted: E.waiverAccepted,
99
- participantIsRegistrant: E.participantIsRegistrant
95
+ participantName: O.participantName.trim(),
96
+ contactName: O.contactName.trim() || void 0,
97
+ contactEmail: O.contactEmail.trim() || void 0,
98
+ contactPhone: O.contactPhone.trim() || void 0,
99
+ answers: p(O.answers),
100
+ selectedFeeIds: O.optionalFeeIds,
101
+ waiverAccepted: O.waiverAccepted,
102
+ participantIsRegistrant: O.participantIsRegistrant
100
103
  }
101
104
  }));
102
105
  } catch (e) {
103
- k(e instanceof Error ? e.message : "Could not submit the registration.");
106
+ j(e instanceof Error ? e.message : "Could not submit the registration.");
104
107
  }
105
- }, P = [
106
- M.season,
107
- M.closesAt ? `Closes ${r(M.closesAt)}` : null,
108
- M.spotsRemaining == null ? null : `${M.spotsRemaining} places left`
108
+ }, I = [
109
+ P.season,
110
+ P.closesAt ? `Closes ${r(P.closesAt)}` : null,
111
+ P.spotsRemaining == null ? null : `${P.spotsRemaining} places left`
109
112
  ].filter(Boolean).join(" · ");
110
- return /* @__PURE__ */ b(t, {
111
- title: M.title,
112
- description: P || void 0,
113
- children: /* @__PURE__ */ x("div", {
113
+ return /* @__PURE__ */ S(t, {
114
+ title: P.title,
115
+ description: I || void 0,
116
+ children: /* @__PURE__ */ C("div", {
114
117
  className: "max-w-2xl space-y-6",
115
- children: [M.description && /* @__PURE__ */ b("p", {
118
+ children: [P.description && /* @__PURE__ */ S("p", {
116
119
  className: "whitespace-pre-line text-sm text-text-secondary",
117
- children: M.description
118
- }), M.isOpen ? /* @__PURE__ */ x("form", {
119
- onSubmit: N,
120
+ children: P.description
121
+ }), P.isOpen ? /* @__PURE__ */ C("form", {
122
+ onSubmit: F,
120
123
  className: "space-y-6",
121
124
  children: [
122
- /* @__PURE__ */ b(p, {
123
- fields: M.fields,
124
- fees: M.fees,
125
- currency: M.currency,
126
- waiverText: M.waiverText,
127
- state: E,
128
- onChange: D,
125
+ /* @__PURE__ */ S(h, {
126
+ fields: P.fields,
127
+ fees: P.fees,
128
+ currency: P.currency,
129
+ waiverText: P.waiverText,
130
+ state: O,
131
+ onChange: k,
129
132
  offerSelfRegistration: !0
130
133
  }),
131
- O && /* @__PURE__ */ b("p", {
134
+ A && /* @__PURE__ */ S("p", {
132
135
  role: "alert",
133
136
  className: "text-sm text-status-error-text",
134
- children: O
137
+ children: A
135
138
  }),
136
- /* @__PURE__ */ x("button", {
139
+ /* @__PURE__ */ C("button", {
137
140
  type: "submit",
138
- disabled: T.isPending,
141
+ disabled: D.isPending,
139
142
  className: "inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-60",
140
143
  children: [
141
- T.isPending ? /* @__PURE__ */ b(_, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ b(v, { className: "h-4 w-4" }),
144
+ D.isPending ? /* @__PURE__ */ S(y, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ S(b, { className: "h-4 w-4" }),
142
145
  " ",
143
146
  "Submit registration"
144
147
  ]
145
148
  })
146
149
  ]
147
- }) : /* @__PURE__ */ x("p", {
150
+ }) : /* @__PURE__ */ C("p", {
148
151
  role: "status",
149
152
  className: "rounded-lg border border-status-warning-border bg-status-warning-bg-subtle p-4 text-sm text-status-warning-text",
150
153
  children: [
151
154
  "This form is not accepting registrations right now",
152
- M.opensAt && new Date(M.opensAt) > /* @__PURE__ */ new Date() ? ` — it opens ${r(M.opensAt)}` : "",
155
+ P.opensAt && new Date(P.opensAt) > /* @__PURE__ */ new Date() ? ` — it opens ${r(P.opensAt)}` : "",
153
156
  "."
154
157
  ]
155
158
  })]
@@ -157,6 +160,6 @@ function S() {
157
160
  });
158
161
  }
159
162
  //#endregion
160
- export { S as RegisterPage };
163
+ export { w as RegisterPage };
161
164
 
162
165
  //# sourceMappingURL=RegisterPage.js.map