tf-checkout-react 2.0.0-beta.25 → 2.0.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +550 -102
- package/docs/API.html +1002 -0
- package/docs/API.md +73 -12
- package/docs/GUIDE.html +2194 -0
- package/package.json +1 -1
package/docs/API.md
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
# React checkout API reference
|
|
2
2
|
|
|
3
3
|
This reference describes the public surface of `tf-checkout-react` version
|
|
4
|
-
`2.0.0-beta.
|
|
4
|
+
`2.0.0-beta.27`. It supplements the package's npm README with examples and an
|
|
5
5
|
inventory of the shared facade and hooks. The package's installed
|
|
6
6
|
`dist/index.d.ts` is the exact versioned source for complete signatures and
|
|
7
7
|
DTO fields. A named export or a typed payment method does not establish that
|
|
8
8
|
the matching backend feature, account permission or payment provider is enabled.
|
|
9
9
|
|
|
10
|
+
For installation, a complete quick start, and examples of the ready-made,
|
|
11
|
+
single-page and step-by-step layouts, start with the [checkout guide](https://unpkg.com/tf-checkout-react@2.0.0-beta.27/docs/GUIDE.html#choose-a-checkout-layout).
|
|
12
|
+
This file is the detailed component, engine and API reference.
|
|
13
|
+
|
|
10
14
|
All examples assume `configureCheckout` has run, and React Query examples are
|
|
11
15
|
under a host `QueryClientProvider`. Use a registered public SDK client ID and
|
|
12
16
|
an empty `clientSecret` in a browser. Never ship a confidential client secret.
|
|
@@ -61,8 +65,11 @@ appropriate authorized logout flow where a backend session must also end.
|
|
|
61
65
|
|
|
62
66
|
`Tickets` and `SeatMap` report when a cart is ready; the host owns navigation
|
|
63
67
|
when composing individual sections. This skeleton connects seated selection to
|
|
64
|
-
its view.
|
|
65
|
-
`QueryClientProvider`.
|
|
68
|
+
its view. This wiring recipe is not a standalone app: configure and mount it
|
|
69
|
+
under `QueryClientProvider`. Its seat Back changes views only; it does not itself
|
|
70
|
+
release held seats or cancel an in-flight reservation or cart priming. Before
|
|
71
|
+
allowing a conflicting selection, coordinate that work and hold expiry or
|
|
72
|
+
release under your deployed backend contract.
|
|
66
73
|
|
|
67
74
|
```tsx
|
|
68
75
|
import { useState } from 'react'
|
|
@@ -75,15 +82,18 @@ export function CheckoutLayout({ eventId }: { eventId: string }) {
|
|
|
75
82
|
const [notice, setNotice] = useState('')
|
|
76
83
|
return (
|
|
77
84
|
<CheckoutProvider>
|
|
78
|
-
{view
|
|
85
|
+
<div hidden={view !== 'tickets'}>
|
|
79
86
|
<Tickets
|
|
80
87
|
eventId={eventId}
|
|
81
88
|
onSelectSeats={() => setView('seats')}
|
|
82
89
|
onContinue={() => setView('checkout')}
|
|
83
90
|
/>
|
|
84
|
-
|
|
91
|
+
</div>
|
|
85
92
|
{view === 'seats' && (
|
|
86
|
-
|
|
93
|
+
<>
|
|
94
|
+
<button type="button" onClick={() => setView('tickets')}>Back to tickets</button>
|
|
95
|
+
<SeatMap eventId={eventId} onContinue={() => setView('checkout')} />
|
|
96
|
+
</>
|
|
87
97
|
)}
|
|
88
98
|
{view === 'checkout' && (
|
|
89
99
|
<>
|
|
@@ -101,10 +111,11 @@ export function CheckoutLayout({ eventId }: { eventId: string }) {
|
|
|
101
111
|
}
|
|
102
112
|
```
|
|
103
113
|
|
|
104
|
-
Real navigation must also
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
114
|
+
Real navigation must also implement checkout Edit/Back, preserve entered
|
|
115
|
+
details, and handle expiry, payment in flight, retained orders and buyer/session
|
|
116
|
+
changes. Do not unconditionally discard or replace a cart on Back during a
|
|
117
|
+
payment. Use `EmbeddedCheckout` for its built-in Back and guarded Edit behavior;
|
|
118
|
+
when building your own, preserve validation and server reservation behavior. The
|
|
108
119
|
host can use `useCheckoutContext()` inside the provider to read the shared
|
|
109
120
|
checkout and `useCheckoutValidation()` to coordinate section validation.
|
|
110
121
|
|
|
@@ -231,8 +242,18 @@ validate on the deployed server too. In this beta the backend owns conditional
|
|
|
231
242
|
requiredness and hosted-checkout conditional visibility is not fully reproduced.
|
|
232
243
|
Test the actual event's branches before release.
|
|
233
244
|
|
|
245
|
+
During priming, failed custom-field, checkout-config, add-on or event-condition
|
|
246
|
+
reads fall back to empty/default data and are not recorded in `unavailableDetails`.
|
|
247
|
+
The engine and stock UI cannot gate requirements they did not load. Do not treat
|
|
248
|
+
an empty list as proof that no requirement exists; verify failure behavior and
|
|
249
|
+
implement tested host safeguards for mandatory fields and acknowledgments. Server
|
|
250
|
+
answer validation is not proof that a condition was acknowledged.
|
|
251
|
+
|
|
234
252
|
If `unavailableDetails` includes `'waiver'`, the read failed without establishing
|
|
235
|
-
whether a waiver exists.
|
|
253
|
+
whether a waiver exists. Before money may have moved, placement retries that
|
|
254
|
+
read and blocks if it remains unknown; `reloadCheckoutDetails()` also retries it.
|
|
255
|
+
A retained order with a possible payment follows separate recovery and needs
|
|
256
|
+
reconciliation. For a custom
|
|
236
257
|
waiver UI, `holdWaiverSigning(index)` returns a hold or `null`; complete or
|
|
237
258
|
cancel the upload, attach via `setWaiverSignature(index, signature, hold)` only
|
|
238
259
|
while the binding remains current, and release the hold. The standard
|
|
@@ -258,7 +279,34 @@ If status is unavailable, contact support. Do not retry payment for a free order
|
|
|
258
279
|
`OrderConfirmation` does not check payment status before rendering its default
|
|
259
280
|
confirmed/ticket-availability copy. Gate it on authoritative appropriate status;
|
|
260
281
|
when the result is pending, show pending UI and any voucher instead. The
|
|
261
|
-
in-flow `Confirmation` component reads the current result's pending state
|
|
282
|
+
in-flow `Confirmation` component reads the current result's pending state but
|
|
283
|
+
shows confirmed copy when `pending` is absent or false, even for paid orders
|
|
284
|
+
whose final settlement has not been independently verified. Use a host-owned
|
|
285
|
+
status route with `confirmationMode="redirect"` or a custom composed
|
|
286
|
+
confirmation gated on authoritative order and provider status. Redirect omits
|
|
287
|
+
inline ID verification; arrange it when `needIdVerification` is true.
|
|
288
|
+
For `EmbeddedCheckout` in redirect mode, provide `onComplete` to route the
|
|
289
|
+
result. `ResumedCheckout` defaults to redirect and likewise needs that callback;
|
|
290
|
+
otherwise its successful flow remains in the loading transition. Inline mode
|
|
291
|
+
has the confirmation and verification-copy limitations described here.
|
|
292
|
+
The stock `IDVerification` and routed `OrderIDVerification` verified messages
|
|
293
|
+
say tickets are on their way but do not verify settlement or issuance. Use a
|
|
294
|
+
host-owned neutral verification and status UI when appropriate. If `onComplete`
|
|
295
|
+
navigates away or unmounts the checkout, inline verification will not appear;
|
|
296
|
+
keep the provider mounted or handle verification at the destination.
|
|
297
|
+
|
|
298
|
+
For custom verification, `runIdVerification(orderHash, options)` does not
|
|
299
|
+
open a URL by itself. Supply `openUrl`, validate the provider URL and open it
|
|
300
|
+
in the browser; handle a missing URL or blocked/failed opening. The engine
|
|
301
|
+
swallows asynchronous `openUrl` rejections, so catch and record failures in
|
|
302
|
+
that callback while showing neutral status. Handle `onPhase` and browser
|
|
303
|
+
returns; `registerForegroundListener` can recheck on return and returns an
|
|
304
|
+
unsubscribe function. Alternatively, return `true` from `onRequired` to take
|
|
305
|
+
over: the engine resolves `undefined` and neither opens nor polls. A timeout or
|
|
306
|
+
poll error rejects with copy promising payment is safe and tickets will be
|
|
307
|
+
emailed; replace it with neutral status and reconcile authoritative payment,
|
|
308
|
+
verification and issuance. Verification alone proves neither settlement nor
|
|
309
|
+
issuance.
|
|
262
310
|
|
|
263
311
|
For a custom Stripe card step, the following demonstrates the boundary between
|
|
264
312
|
host-collected data and SDK placement. Render it only after reserving a cart and
|
|
@@ -350,6 +398,15 @@ no-charge outcomes as `declined`, `cancelled` or `notStarted`, with `unknown`
|
|
|
350
398
|
for uncertainty. `UNSUPPORTED_GATEWAY` indicates the necessary platform
|
|
351
399
|
capability is not available, not that every provider failure is safe to retry.
|
|
352
400
|
|
|
401
|
+
The beta.27 declaration comments for `reset` and `PAID_ORDER_PENDING_MESSAGE`
|
|
402
|
+
say pressing Pay again finishes an unconfirmed order; the `resetWhenSettled`
|
|
403
|
+
comment omits retired checkouts as a reason for `false`. Those comments do not
|
|
404
|
+
establish that a retry is safe; check the current session and reconcile first.
|
|
405
|
+
Stock `Payment` can also display an engine message telling the buyer to press
|
|
406
|
+
Pay again when payment is unconfirmed. That wording does not prove a retry is
|
|
407
|
+
safe. If neutral guidance is required, use a custom payment flow with
|
|
408
|
+
host-controlled error UI, retain the order and reconcile before recovery.
|
|
409
|
+
|
|
353
410
|
## Auth component contracts
|
|
354
411
|
|
|
355
412
|
`AuthModal` owns a complete modal flow. Supply `open`, `onClose` and, for
|
|
@@ -464,6 +521,10 @@ preflight, state and payment coordination. Raw functions are also exported in
|
|
|
464
521
|
the `api` namespace. Calling a low-level endpoint directly does not grant a
|
|
465
522
|
buyer permission or guarantee a safe payment retry.
|
|
466
523
|
|
|
524
|
+
`ttf.events.requiredCustomFieldLabels(eventId)` returns `[]` if its lookup
|
|
525
|
+
fails as well as when no matching required order/ticket labels exist. An empty
|
|
526
|
+
result is not proof that the event has no required custom fields.
|
|
527
|
+
|
|
467
528
|
| Namespace | Methods |
|
|
468
529
|
| --- | --- |
|
|
469
530
|
| `ttf.events` | `featured`, `details`, `tickets`, `ticketsWithMeta`, `bundles`, `startBundlePurchase`, `info`, `conditions`, `timeSlotTickets`, `customFields`, `requiredCustomFieldLabels`, `addons`, `filterAddonsForTickets`, `submitPromoCode`, `setCurrency`, `authenticate`, `track`, `updateOrderDataCapture`, `updateTicketDataCapture`. |
|