@burdenoff/microfe-atheletebridge 2026.1103.2 → 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.
- package/dist/atheletebridge/components/registration/OnlineCheckout.d.ts +11 -0
- package/dist/atheletebridge/components/registration/OnlineCheckout.d.ts.map +1 -0
- package/dist/atheletebridge/components/registration/OnlineCheckout.js +102 -0
- package/dist/atheletebridge/components/registration/OnlineCheckout.js.map +1 -0
- package/dist/atheletebridge/components/registration/OnlinePaymentsCard.d.ts +4 -0
- package/dist/atheletebridge/components/registration/OnlinePaymentsCard.d.ts.map +1 -0
- package/dist/atheletebridge/components/registration/OnlinePaymentsCard.js +150 -0
- package/dist/atheletebridge/components/registration/OnlinePaymentsCard.js.map +1 -0
- package/dist/atheletebridge/components/registration/RegistrationEntryFields.d.ts +6 -0
- package/dist/atheletebridge/components/registration/RegistrationEntryFields.d.ts.map +1 -1
- package/dist/atheletebridge/components/registration/RegistrationEntryFields.js +23 -11
- package/dist/atheletebridge/components/registration/RegistrationEntryFields.js.map +1 -1
- package/dist/atheletebridge/components/registration/entryRules.d.ts +2 -0
- package/dist/atheletebridge/components/registration/entryRules.d.ts.map +1 -1
- package/dist/atheletebridge/components/registration/entryRules.js +2 -1
- package/dist/atheletebridge/components/registration/entryRules.js.map +1 -1
- package/dist/atheletebridge/hooks/useRegistrationApi.d.ts +19 -2
- package/dist/atheletebridge/hooks/useRegistrationApi.d.ts.map +1 -1
- package/dist/atheletebridge/hooks/useRegistrationApi.js +76 -33
- package/dist/atheletebridge/hooks/useRegistrationApi.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.d.ts +3 -1
- package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.d.ts.map +1 -1
- package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.js +71 -64
- package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegisterPage.d.ts.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegisterPage.js +82 -77
- package/dist/atheletebridge/pages/registrations/RegisterPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationFormsListPage.d.ts.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationFormsListPage.js +49 -47
- package/dist/atheletebridge/pages/registrations/RegistrationFormsListPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.d.ts.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js +140 -109
- package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js.map +1 -1
- package/dist/atheletebridge/types/registration.d.ts +49 -0
- package/dist/atheletebridge/types/registration.d.ts.map +1 -1
- package/dist/atheletebridge/utils/onlineCheckout.d.ts +69 -0
- package/dist/atheletebridge/utils/onlineCheckout.d.ts.map +1 -0
- package/dist/atheletebridge/utils/onlineCheckout.js +61 -0
- package/dist/atheletebridge/utils/onlineCheckout.js.map +1 -0
- package/dist/atheletebridge/utils/registration.d.ts +19 -0
- package/dist/atheletebridge/utils/registration.d.ts.map +1 -1
- package/dist/atheletebridge/utils/registration.js +28 -1
- package/dist/atheletebridge/utils/registration.js.map +1 -1
- package/dist/generated/global-types.d.ts +6164 -1907
- package/dist/generated/global-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.d.ts +60796 -3422
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -9,15 +9,15 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
9
9
|
submissionCount createdAt updatedAt
|
|
10
10
|
fields { ${o} }
|
|
11
11
|
fees { ${s} }
|
|
12
|
-
`, l = "\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", u = "\n id submissionId amount refundedAmount netAmount currency method status\n reference note receivedAt voidedAt voidReason refundedAt refundReason\n createdBy createdAt\n", d = "\n formId submissionCount acceptedCount notRequiredCount unpaidCount\n partiallyPaidCount paidCount refundedCount\n totals { currency amountDue amountCollected amountRefunded amountOutstanding }\n", f = `
|
|
12
|
+
`, l = "\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", u = "\n id submissionId amount refundedAmount netAmount currency method processor status\n reference note receivedAt voidedAt voidReason refundedAt refundReason\n createdBy createdAt\n", d = "\n formId submissionCount acceptedCount notRequiredCount unpaidCount\n partiallyPaidCount paidCount refundedCount\n totals { currency amountDue amountCollected amountRefunded amountOutstanding }\n", f = `
|
|
13
13
|
id slug title description season currency opensAt closesAt waiverText isOpen
|
|
14
14
|
spotsRemaining
|
|
15
15
|
fields { ${o} }
|
|
16
16
|
fees { ${s} }
|
|
17
|
-
`, p = "\n id formId formTitle formSlug participantName status paymentStatus amountDue\n amountPaid amountOutstanding currency submittedAt\n", m = () => {
|
|
17
|
+
`, p = "\n id formId formTitle formSlug participantName status paymentStatus amountDue\n amountPaid amountOutstanding currency onlinePaymentAvailable submittedAt\n", m = "\n provider accountId chargesEnabled payoutsEnabled detailsSubmitted lastSyncedAt createdAt\n", h = () => {
|
|
18
18
|
let e = i();
|
|
19
19
|
return () => e.invalidateQueries({ queryKey: a });
|
|
20
|
-
},
|
|
20
|
+
}, g = (n = {}) => {
|
|
21
21
|
let { apiGatewayUrl: i, workspaceId: o } = e();
|
|
22
22
|
return r({
|
|
23
23
|
queryKey: [
|
|
@@ -33,7 +33,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
33
33
|
}
|
|
34
34
|
}`, { ...n }, i)).athListRegistrationForms
|
|
35
35
|
});
|
|
36
|
-
},
|
|
36
|
+
}, _ = (n) => {
|
|
37
37
|
let { apiGatewayUrl: i, workspaceId: o } = e();
|
|
38
38
|
return r({
|
|
39
39
|
queryKey: [
|
|
@@ -45,16 +45,16 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
45
45
|
queryFn: async () => (await t(`query AthRegistrationForm($id: ID!) { athRegistrationForm(id: $id) { ${c} } }`, { id: n }, i)).athRegistrationForm,
|
|
46
46
|
enabled: !!n
|
|
47
47
|
});
|
|
48
|
-
},
|
|
49
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
48
|
+
}, v = () => {
|
|
49
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
50
50
|
return n({
|
|
51
51
|
mutationFn: async (e) => (await t(`mutation AthCreateRegistrationForm($input: AthCreateRegistrationFormInput!) {
|
|
52
52
|
athCreateRegistrationForm(input: $input) { ${c} }
|
|
53
53
|
}`, { input: e }, r)).athCreateRegistrationForm,
|
|
54
54
|
onSuccess: () => void i()
|
|
55
55
|
});
|
|
56
|
-
},
|
|
57
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
56
|
+
}, y = () => {
|
|
57
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
58
58
|
return n({
|
|
59
59
|
mutationFn: async ({ id: e, input: n }) => (await t(`mutation AthUpdateRegistrationForm($id: ID!, $input: AthUpdateRegistrationFormInput!) {
|
|
60
60
|
athUpdateRegistrationForm(id: $id, input: $input) { ${c} }
|
|
@@ -64,7 +64,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
64
64
|
}, r)).athUpdateRegistrationForm,
|
|
65
65
|
onSuccess: () => void i()
|
|
66
66
|
});
|
|
67
|
-
},
|
|
67
|
+
}, b = {
|
|
68
68
|
publish: {
|
|
69
69
|
field: "athPublishRegistrationForm",
|
|
70
70
|
selection: `{ ${c} }`
|
|
@@ -77,16 +77,16 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
77
77
|
field: "athArchiveRegistrationForm",
|
|
78
78
|
selection: ""
|
|
79
79
|
}
|
|
80
|
-
},
|
|
81
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
80
|
+
}, x = () => {
|
|
81
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
82
82
|
return n({
|
|
83
83
|
mutationFn: async ({ id: e, action: n }) => {
|
|
84
|
-
let { field: i, selection: a } =
|
|
84
|
+
let { field: i, selection: a } = b[n];
|
|
85
85
|
return await t(`mutation AthRegistrationFormLifecycle($id: ID!) { ${i}(id: $id) ${a} }`, { id: e }, r), n;
|
|
86
86
|
},
|
|
87
87
|
onSuccess: () => void i()
|
|
88
88
|
});
|
|
89
|
-
},
|
|
89
|
+
}, S = (n, i = !0) => {
|
|
90
90
|
let { apiGatewayUrl: o, workspaceId: s } = e();
|
|
91
91
|
return r({
|
|
92
92
|
queryKey: [
|
|
@@ -113,7 +113,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
113
113
|
}`, { ...n }, o)).athListRegistrationSubmissions,
|
|
114
114
|
enabled: i
|
|
115
115
|
});
|
|
116
|
-
},
|
|
116
|
+
}, C = (n) => {
|
|
117
117
|
let { apiGatewayUrl: i, workspaceId: o } = e();
|
|
118
118
|
return r({
|
|
119
119
|
queryKey: [
|
|
@@ -127,16 +127,16 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
127
127
|
}`, { id: n }, i)).athRegistrationSubmission,
|
|
128
128
|
enabled: !!n
|
|
129
129
|
});
|
|
130
|
-
},
|
|
131
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
130
|
+
}, w = () => {
|
|
131
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
132
132
|
return n({
|
|
133
133
|
mutationFn: async (e) => (await t(`mutation AthRecordRegistration($input: AthRecordRegistrationInput!) {
|
|
134
134
|
athRecordRegistration(input: $input) { ${l} }
|
|
135
135
|
}`, { input: e }, r)).athRecordRegistration,
|
|
136
136
|
onSuccess: () => void i()
|
|
137
137
|
});
|
|
138
|
-
},
|
|
139
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
138
|
+
}, T = () => {
|
|
139
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
140
140
|
return n({
|
|
141
141
|
mutationFn: async ({ id: e, decision: n, notes: i }) => (await t(`mutation AthReviewRegistrationSubmission($id: ID!, $input: AthReviewRegistrationInput!) {
|
|
142
142
|
athReviewRegistrationSubmission(id: $id, input: $input) { ${l} }
|
|
@@ -149,7 +149,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
149
149
|
}, r)).athReviewRegistrationSubmission,
|
|
150
150
|
onSuccess: () => void i()
|
|
151
151
|
});
|
|
152
|
-
},
|
|
152
|
+
}, E = (n) => {
|
|
153
153
|
let { apiGatewayUrl: i, workspaceId: o } = e();
|
|
154
154
|
return r({
|
|
155
155
|
queryKey: [
|
|
@@ -164,7 +164,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
164
164
|
enabled: !!n,
|
|
165
165
|
retry: !1
|
|
166
166
|
});
|
|
167
|
-
},
|
|
167
|
+
}, D = (n) => {
|
|
168
168
|
let { apiGatewayUrl: i, workspaceId: o } = e();
|
|
169
169
|
return r({
|
|
170
170
|
queryKey: [
|
|
@@ -178,16 +178,16 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
178
178
|
}`, { formId: n ?? null }, i)).athRegistrationPaymentSummary,
|
|
179
179
|
retry: !1
|
|
180
180
|
});
|
|
181
|
-
},
|
|
182
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
181
|
+
}, O = () => {
|
|
182
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
183
183
|
return n({
|
|
184
184
|
mutationFn: async (e) => (await t(`mutation AthRecordRegistrationPayment($input: AthRecordRegistrationPaymentInput!) {
|
|
185
185
|
athRecordRegistrationPayment(input: $input) { ${u} }
|
|
186
186
|
}`, { input: e }, r)).athRecordRegistrationPayment,
|
|
187
187
|
onSuccess: () => void i()
|
|
188
188
|
});
|
|
189
|
-
},
|
|
190
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
189
|
+
}, k = () => {
|
|
190
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
191
191
|
return n({
|
|
192
192
|
mutationFn: async ({ id: e, reason: n }) => (await t(`mutation AthVoidRegistrationPayment($id: ID!, $reason: String!) {
|
|
193
193
|
athVoidRegistrationPayment(id: $id, reason: $reason) { ${u} }
|
|
@@ -197,8 +197,8 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
197
197
|
}, r)).athVoidRegistrationPayment,
|
|
198
198
|
onSuccess: () => void i()
|
|
199
199
|
});
|
|
200
|
-
},
|
|
201
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
200
|
+
}, A = () => {
|
|
201
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
202
202
|
return n({
|
|
203
203
|
mutationFn: async ({ id: e, amount: n, reason: i }) => (await t(`mutation AthRefundRegistrationPayment($id: ID!, $input: AthRefundRegistrationPaymentInput!) {
|
|
204
204
|
athRefundRegistrationPayment(id: $id, input: $input) { ${u} }
|
|
@@ -211,7 +211,39 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
211
211
|
}, r)).athRefundRegistrationPayment,
|
|
212
212
|
onSuccess: () => void i()
|
|
213
213
|
});
|
|
214
|
-
},
|
|
214
|
+
}, j = () => {
|
|
215
|
+
let { apiGatewayUrl: n, workspaceId: i } = e();
|
|
216
|
+
return r({
|
|
217
|
+
queryKey: [
|
|
218
|
+
...a,
|
|
219
|
+
i ?? null,
|
|
220
|
+
"online-payments"
|
|
221
|
+
],
|
|
222
|
+
queryFn: async () => (await t(`query AthOnlinePaymentsStatus {
|
|
223
|
+
athOnlinePaymentsStatus {
|
|
224
|
+
processorConfigured testMode onlineCheckoutAvailable
|
|
225
|
+
account { ${m} }
|
|
226
|
+
}
|
|
227
|
+
}`, {}, n)).athOnlinePaymentsStatus,
|
|
228
|
+
retry: !1
|
|
229
|
+
});
|
|
230
|
+
}, M = () => {
|
|
231
|
+
let { apiGatewayUrl: r } = e();
|
|
232
|
+
return n({ mutationFn: async (e) => (await t(`mutation AthConnectPaymentAccount($input: AthConnectPaymentAccountInput!) {
|
|
233
|
+
athConnectPaymentAccount(input: $input) {
|
|
234
|
+
url expiresAt
|
|
235
|
+
account { ${m} }
|
|
236
|
+
}
|
|
237
|
+
}`, { input: e }, r)).athConnectPaymentAccount });
|
|
238
|
+
}, N = () => {
|
|
239
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
240
|
+
return n({
|
|
241
|
+
mutationFn: async () => (await t(`mutation AthRefreshPaymentAccount {
|
|
242
|
+
athRefreshPaymentAccount { ${m} }
|
|
243
|
+
}`, {}, r)).athRefreshPaymentAccount,
|
|
244
|
+
onSuccess: () => void i()
|
|
245
|
+
});
|
|
246
|
+
}, P = (n) => {
|
|
215
247
|
let { apiGatewayUrl: i } = e();
|
|
216
248
|
return r({
|
|
217
249
|
queryKey: [
|
|
@@ -224,8 +256,8 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
224
256
|
}`, { slug: n }, i)).athRegistrationFormBySlug,
|
|
225
257
|
enabled: !!n
|
|
226
258
|
});
|
|
227
|
-
},
|
|
228
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
259
|
+
}, F = () => {
|
|
260
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
229
261
|
return n({
|
|
230
262
|
mutationFn: async ({ slug: e, input: n }) => (await t(`mutation AthSubmitRegistration($slug: String!, $input: AthSubmitRegistrationInput!) {
|
|
231
263
|
athSubmitRegistration(slug: $slug, input: $input) { ${p} }
|
|
@@ -235,7 +267,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
235
267
|
}, r)).athSubmitRegistration,
|
|
236
268
|
onSuccess: () => void i()
|
|
237
269
|
});
|
|
238
|
-
},
|
|
270
|
+
}, I = (n) => {
|
|
239
271
|
let { apiGatewayUrl: i } = e();
|
|
240
272
|
return r({
|
|
241
273
|
queryKey: [
|
|
@@ -250,16 +282,27 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
|
|
|
250
282
|
}
|
|
251
283
|
}`, { pagination: n ?? null }, i)).athMyRegistrations
|
|
252
284
|
});
|
|
253
|
-
},
|
|
254
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
285
|
+
}, L = () => {
|
|
286
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
255
287
|
return n({
|
|
256
288
|
mutationFn: async (e) => (await t(`mutation AthWithdrawMyRegistration($id: ID!) {
|
|
257
289
|
athWithdrawMyRegistration(id: $id) { ${p} }
|
|
258
290
|
}`, { id: e }, r)).athWithdrawMyRegistration,
|
|
259
291
|
onSuccess: () => void i()
|
|
260
292
|
});
|
|
293
|
+
}, R = () => {
|
|
294
|
+
let { apiGatewayUrl: r } = e();
|
|
295
|
+
return n({ mutationFn: async (e) => (await t("mutation AthStartRegistrationCheckout($input: AthStartRegistrationCheckoutInput!) {\n athStartRegistrationCheckout(input: $input) { checkoutId url amount currency expiresAt }\n }", { input: e }, r)).athStartRegistrationCheckout });
|
|
296
|
+
}, z = () => {
|
|
297
|
+
let { apiGatewayUrl: r } = e(), i = h();
|
|
298
|
+
return n({
|
|
299
|
+
mutationFn: async (e) => (await t(`mutation AthConfirmRegistrationCheckout($checkoutId: ID!) {
|
|
300
|
+
athConfirmRegistrationCheckout(checkoutId: $checkoutId) { ${p} }
|
|
301
|
+
}`, { checkoutId: e }, r)).athConfirmRegistrationCheckout,
|
|
302
|
+
onSuccess: () => void i()
|
|
303
|
+
});
|
|
261
304
|
};
|
|
262
305
|
//#endregion
|
|
263
|
-
export {
|
|
306
|
+
export { z as useConfirmRegistrationCheckout, M as useConnectPaymentAccount, v as useCreateRegistrationForm, I as useMyRegistrations, j as useOnlinePaymentsStatus, P as usePublicRegistrationForm, w as useRecordRegistration, O as useRecordRegistrationPayment, N as useRefreshPaymentAccount, A as useRefundRegistrationPayment, _ as useRegistrationForm, x as useRegistrationFormLifecycle, g as useRegistrationForms, D as useRegistrationPaymentSummary, E as useRegistrationPayments, C as useRegistrationSubmission, S as useRegistrationSubmissions, T as useReviewRegistration, R as useStartRegistrationCheckout, F as useSubmitRegistration, y as useUpdateRegistrationForm, k as useVoidRegistrationPayment, L as useWithdrawMyRegistration };
|
|
264
307
|
|
|
265
308
|
//# sourceMappingURL=useRegistrationApi.js.map
|
|
@@ -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 AthRegistrationEntryInput,\n AthRegistrationForm,\n AthRegistrationFormConnection,\n AthRegistrationFormStatus,\n AthRegistrationPayment,\n AthRegistrationPaymentStatus,\n AthRegistrationPaymentSummary,\n AthRegistrationSubmission,\n AthRegistrationSubmissionConnection,\n AthRegistrationSubmissionStatus,\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`;\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: AthRegistrationEntryInput }) => {\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,uTAOpB,IAAiB,gLAMjB,IAAiB,2MAMjB,IAAqB;;;aAGd,EAAa;WACf,EAAW;GAGhB,IAAyB,0IAMzB,UAAkC;CACtC,IAAM,IAAc,EAAe;CACnC,aAAa,EAAY,kBAAkB,EAAE,UAAU,EAAK,CAAC;AAC/D,GAYa,KAAwB,IAAmC,CAAC,MAAM;CAC7E,IAAM,EAAE,kBAAe,mBAAgB,EAAiB;CACxD,OAAO,EAAS;EACd,UAAU;GAAC,GAAG;GAAM,KAAe;GAAM;GAAS;EAAO;EACzD,SAAS,aAWA,MAVc,EACnB;;sB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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,EAAW;GAGhB,IAAyB,iKAKzB,IAAyB,kGAKzB,UAAkC;CACtC,IAAM,IAAc,EAAe;CACnC,aAAa,EAAY,kBAAkB,EAAE,UAAU,EAAK,CAAC;AAC/D,GAYa,KAAwB,IAAmC,CAAC,MAAM;CAC7E,IAAM,EAAE,kBAAe,mBAAgB,EAAiB;CACxD,OAAO,EAAS;EACd,UAAU;GAAC,GA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ACjB,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
|
|
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 {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
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
|
|
14
|
-
function
|
|
15
|
-
let [
|
|
16
|
-
limit:
|
|
17
|
-
offset:
|
|
18
|
-
}),
|
|
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
|
-
|
|
22
|
+
T(null);
|
|
21
23
|
try {
|
|
22
|
-
await
|
|
24
|
+
await C.mutateAsync(e);
|
|
23
25
|
} catch (e) {
|
|
24
|
-
|
|
26
|
+
T(e instanceof Error ? e.message : "Could not withdraw the registration.");
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
|
-
return /* @__PURE__ */
|
|
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: [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
className: "
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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.
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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 {
|
|
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":"
|
|
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;GACtF;EALa;CAMf;CAEA,OACE,kBAAC,GAAD;EACE,OAAM;EACN,aAAY;YAFd;GAIE,kBAAC,GAAD,CAAuB,CAAA;GACtB,KACC,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;cACvB;GACA,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;IACE,cAAa;IACb,MAAM,kBAAC,GAAD,EAAe,WAAU,YAAa,CAAA;IAC5C,OAAM;IACN,aAAY;GACb,CAAA,IAED,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,MAAD;IACE,WAAU;IACV,eAAY;cAEX,EAAM,KAAK,MACV,kBAAC,MAAD;KAEE,WAAU;eAFZ,CAIE,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACE,kBAAC,QAAD;OAAM,WAAU;iBAAuC,EAAI;MAAsB,CAAA,GACjF,kBAAC,QAAD;OAAM,WAAU;iBAAhB;QACG,EAAI;QAAU;QAAI,EAAW,EAAI,WAAW;OACzC;QACF;SACN,kBAAC,QAAD;MAAM,WAAU;gBAAhB;OACE,kBAAC,GAAD,EAAa,QAAQ,EAAI,OAAS,CAAA;OAClC,kBAAC,GAAD,EAAa,QAAQ,EAAI,cAAgB,CAAA;OACxC,EAAI,YAAY,KACf,kBAAC,QAAD;QAAM,WAAU;kBAAhB,CACG,EAAY,EAAI,mBAAmB,EAAI,QAAQ,GAAE,MAC9C;;OAEP,EAAa,CAAG,KAAK,kBAAC,GAAD,EAAiB,cAAc,EAAM,CAAA;OAC1D,EAAI,WAAW,eAAe,EAAI,eAAe,KAChD,kBAAC,UAAD;QACE,MAAK;QACL,UAAU,EAAS;QACnB,eAAe,KAAK,EAAW,EAAI,EAAE;QACrC,WAAU;kBAJZ,CAME,kBAAC,GAAD,EAAO,WAAU,UAAW,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;
|
|
1
|
+
{"version":3,"file":"RegisterPage.d.ts","sourceRoot":"","sources":["../../../../src/atheletebridge/pages/registrations/RegisterPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwBH,wBAAgB,YAAY,gCA2K3B"}
|