tf-checkout-react-native 2.0.0-beta.23 → 2.0.0-beta.25

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 (3) hide show
  1. package/README.md +896 -366
  2. package/docs/API.md +602 -0
  3. package/package.json +3 -2
package/docs/API.md ADDED
@@ -0,0 +1,602 @@
1
+ # React Native API reference
2
+
3
+ This reference describes the API and behavior shipped in
4
+ `tf-checkout-react-native@2.0.0-beta.25`. Read it alongside the
5
+ [package README](https://unpkg.com/tf-checkout-react-native@2.0.0-beta.25/README.md)
6
+ for installation, secure setup, complete examples, payment safety and
7
+ limitations. The [published declarations](https://unpkg.com/tf-checkout-react-native@2.0.0-beta.25/dist/index.d.ts)
8
+ are authoritative for exact types and include the remaining DTO fields.
9
+ The shared core is bundled; do not install its private workspace package.
10
+ Availability of any operation depends on the deployed backend, event, account,
11
+ provider and device.
12
+
13
+ All examples assume `configureCheckout` has completed after the host restored
14
+ its OS-protected synchronous storage adapter. Hooks using React Query need a
15
+ `QueryClientProvider` (provided inside `CheckoutProvider`). Do not put
16
+ confidential client secrets into the app.
17
+
18
+ **TypeScript troubleshooting:** beta.25 declarations reference a global
19
+ `Crypto` type. A host configuration excluding DOM and lacking a compatible
20
+ ambient `Crypto` type may report TS2304 while checking SDK declarations. Supply
21
+ compatible host type definitions where possible. `skipLibCheck` skips
22
+ declaration-file checks; if `Crypto` remains unresolved, affected types can
23
+ degrade to `any`, allowing invalid `newBundleIdempotencyKey` arguments to
24
+ compile. Neither a type declaration nor `skipLibCheck` installs runtime crypto.
25
+
26
+ ## Contents
27
+
28
+ - [Checkout components](#checkout-components)
29
+ - [Account and post-purchase components](#account-and-post-purchase-components)
30
+ - [Authentication forms](#authentication-forms)
31
+ - [Primitives](#primitives)
32
+ - [Hook catalog](#hook-catalog)
33
+ - [API facade](#api-facade)
34
+ - [Headless state, actions and ports](#headless-state-actions-and-ports)
35
+ - [Types and errors](#types-and-errors)
36
+
37
+ ## Checkout components
38
+
39
+ ### Provider and embedded flow
40
+
41
+ `EmbeddedCheckout` takes required `eventId`; optional `onComplete`,
42
+ `confirmationMode`, `confirmationChildren`, `initialView`, `onViewChange`,
43
+ `requireEmailConfirmation`, `collectTicketHolders`, `collectHolderContact`,
44
+ `onLogin`, `auth`, `skipBillingWhenProfileComplete`, `ttfOptInLabel`,
45
+ `brandOptInLabel`, `privacyPolicy`, `additionalConditions`, `initialPromoCode`,
46
+ `referrer`, `readAttributionFromUrl`, `pickImage`, `showTestCardHint` and
47
+ `theme`. Defaults and examples are in the README. Native URL attribution is a
48
+ no-op; an order result may be pending, and a result without `pending` is not
49
+ proof of settlement. The embedded component creates its own provider and does
50
+ not expose `options`, `paymentSheet` or `shareUrl` props. Use redirect/custom
51
+ routing and reconcile payment status when confirmed paid status is required.
52
+ Redirect omits inline verification: when `needIdVerification` is true, the host
53
+ must arrange it. Preserve `orderHash` and any `pendingVoucherUrl` for the
54
+ order-status journey, including navigation/restart.
55
+
56
+ `CheckoutProvider` takes required `children`, plus `value?: NativeUseCheckout`,
57
+ `queryClient?: QueryClient`, `theme?: CheckoutTheme`,
58
+ `pickImage?: CheckoutImagePicker`, `options?: CheckoutOptions` and
59
+ `paymentSheet?: NativePaymentSheetOptions`. Omit `value` to use its native
60
+ checkout hook, provider-page UI and installment picker. A controlled value must
61
+ itself be created with the required ports/options. `CheckoutThemeProvider` takes
62
+ `children` and optional `theme` and supplies only theme context.
63
+
64
+ `useCheckoutContext()` returns `NativeUseCheckout` within a checkout provider.
65
+ `useCheckoutValidation()` returns `{ attempt, requestValidation }`; composed
66
+ controls can reveal errors after a submit attempt. `useTheme()` returns the
67
+ resolved theme (light defaults outside a theme provider). The provider owns a
68
+ shared query client by default; pass `queryClient` to use yours. Native
69
+ `useCheckout()` and sections share one app checkout store; multiple hooks do not
70
+ imply separate concurrent carts.
71
+
72
+ ### Catalog and cart
73
+
74
+ Native `Tickets` has no password prompt or password prop. For a protected
75
+ event, a host may collect the password, call `ttf.events.authenticate(eventId,
76
+ password)`, handle wrong-password/session errors and refetch the event/catalog
77
+ in the same buyer/event context. Do not log passwords; verify this session and
78
+ unlock flow against the deployed backend rather than assuming API success is
79
+ sufficient.
80
+
81
+ `Tickets` requires `eventId` and accepts:
82
+
83
+ - `title?: string | false` (default `false`), `buttonLabel?: string` (default
84
+ `Get tickets`), `onContinue?: () => void` and `onSelectSeats?: () => void`.
85
+ `onContinue` follows a successful cart prime; the seat CTA is hidden without
86
+ `onSelectSeats`.
87
+ - `timeSlotDates?: string[]` for explicit ISO dates; without it event metadata
88
+ determines time-slot mode.
89
+ - `initialPromoCode?: string`, `referrer?: string | number`,
90
+ `readAttributionFromUrl?: boolean`. The last is accepted but does nothing on
91
+ native; classify and supply attribution yourself.
92
+ - `unstyled?: boolean`, `renderTicket?: (row) => ReactNode` and
93
+ `renderContinue?: (cta) => ReactNode`. The row has `ticket: TicketType`,
94
+ `quantity`, `range: { min, max, step }`, `unavailable`, `seated` and
95
+ `onQuantityChange(quantity)`. The CTA has `onPress`, `disabled`, `loading`
96
+ and `title`. Use those controls rather than bypassing cart rules.
97
+
98
+ `SeatMap` requires `eventId` and accepts `onContinue`. It handles internal and
99
+ Seats.io chart selection through WebView and the shared controller. Its use
100
+ requires a compatible deployed event/session/hold/cart backend. A working chart
101
+ is not by itself evidence that seats were reserved or sold.
102
+
103
+ `AddOns` requires `eventId`; it accepts `onContinue`, `onSkip`, `buttonLabel`,
104
+ `eyebrow` and `heading`. It can render nothing for no applicable or all sold-out
105
+ items. With no `onContinue`, it participates in a combined form. Required
106
+ add-ons prevent skipping and are checked before order placement.
107
+
108
+ `Bundles` requires `eventId`; accepts `onPurchased(orderHash)`,
109
+ `onComplete(order)`, `confirmationMode`, `visible`, `heading`, `locale`,
110
+ `messages`, `translate`. It makes its own bundle order, separate from the
111
+ normal ticket cart. Hide its native card field with `visible={false}` when the
112
+ section is hidden. The default confirmation mode is `inline`.
113
+
114
+ `Accommodation` takes `eventId`. Its shared flow owns stay drafts, server quotes
115
+ and reservation; render it only for a configured event. Missing quotes are not
116
+ zero-priced.
117
+
118
+ ### Buyer details and fulfillment
119
+
120
+ `BillingInfo` accepts `eventId`, `onContinue`, `heading`, `buttonLabel`,
121
+ `onLogin(email?)`, `skipWhenProfileComplete`, `requireEmailConfirmation`,
122
+ `collectTicketHolders`, `collectHolderContact`, `ttfOptInLabel`,
123
+ `brandOptInLabel`, `privacyPolicy`, `showPrivacyError` and `step`. Its
124
+ standalone email/holder/skip flags default to false. `step` is accepted but not
125
+ rendered. Without `onContinue` it mirrors edits into the combined form. A
126
+ `CheckoutPrivacyPolicy` is `{ url, brandName, linkLabel? }`. `Payment` must use
127
+ matching email/holder flags and `requirePrivacyPolicy` when the host requires
128
+ that checkbox. `onPrivacyRequired` lets the host reveal the inline error.
129
+
130
+ In beta.25 the stock `privacyPolicy` checkbox shares `consent.ttfOptIn`, sent
131
+ as `ttf_opt_in`; it does not capture independent privacy and marketing choices.
132
+ If both opt-in labels are explicitly empty, consent may not be committed and
133
+ the privacy gate can remain blocked. `skipWhenProfileComplete` (or embedded
134
+ `skipBillingWhenProfileComplete`) can hide the checkbox while Payment still
135
+ requires it. Avoid those combinations without a verified host workaround. A
136
+ host needing separate consent must use a custom flow and tested server contract.
137
+
138
+ During priming, failed event custom-field, checkout-config, add-on and condition
139
+ reads fall back to empty/default data. Neither stock UI nor engine can gate
140
+ requirements that were not loaded. Only non-404 waiver failures are recorded in
141
+ `unavailableDetails` and gated/retried. Verify failure behavior and implement
142
+ tested host safeguards for mandatory fields and acknowledgments; server answer
143
+ validation does not prove an acknowledgment was made.
144
+
145
+ `OrderSummary` accepts `eventId`, `locale`, `messages`, `translate` and uses
146
+ server-priced cart state. `WaiverSigning` requires `eventId` and accepts
147
+ `locale`, `messages`, `translate`; it returns no section if there is no waiver.
148
+ `IDVerification` takes no props and renders only when the current order requires
149
+ verification. The buyer must press its Verify button to open/poll the provider;
150
+ it does not run automatically on mount. A redirect/composed host must arrange
151
+ this component under the active checkout provider or a custom
152
+ `runIdVerification(orderHash)` flow. Verification is separate from payment
153
+ settlement. `Confirmation` takes `shareUrl`,
154
+ `shareMessage`, `viewOrderUrl`, `message`, `children`; it reads the current
155
+ order. For every non-pending order, a supplied `shareUrl` triggers stock
156
+ reward-promising copy without checking eligibility or generating a
157
+ buyer-specific URL. Omit it unless the host has verified both. Its non-pending
158
+ receipt can show confirmed copy before capture/settlement. It reads the original
159
+ `checkout.order.pending` and does not refresh that flag after later settlement;
160
+ use custom status UI backed by a fresh authoritative read for asynchronous
161
+ orders. These components use checkout context.
162
+
163
+ `Payment` accepts `onComplete`, `eventId`, `requireEmailConfirmation`,
164
+ `collectTicketHolders`, `requireHolderContact`, `additionalConditions`,
165
+ `requirePrivacyPolicy`, `onPrivacyRequired`, `showTestCardHint`, `locale`,
166
+ `messages`, `translate`. `eventId` is currently unused by native payment. All
167
+ its boolean props default false in standalone use. Its `onComplete` may receive
168
+ a pending result. `pending !== true` does not establish settlement: Stripe
169
+ `Processing` and `RequiresCapture` can return without that flag. It reads the
170
+ selected cart, renders server/device-eligible methods and uses provider-owned
171
+ card collection. Reconcile the authoritative backend/provider status before
172
+ fulfillment; use custom/redirect UI when the stock confirmed copy is premature.
173
+ `Payment` gates loaded event conditions, host `additionalConditions` and
174
+ requested privacy in its UI. Conditions render through filtered native
175
+ `RichText`, not full browser HTML, with HTTP(S)-only links. A headless
176
+ `placeOrder` checks loaded event conditions but does not receive host
177
+ `additionalConditions` or the privacy prop; the host must enforce its own
178
+ required acknowledgments. These client-side acceptances are not sent as separate
179
+ server fields.
180
+
181
+ `Rewards` takes `orderHash?`, `data?: RewardsPayload | null`, `locale?`,
182
+ `messages?`, `translate?`. Supply an order hash or data. It displays the
183
+ order-scoped reward experience and native share sheet. It uses the server's
184
+ `share_link` and renders nothing when `referrals_enabled` is explicitly false;
185
+ verify eligibility and the buyer-specific link against your deployed contract.
186
+ `RewardsLadder` requires `rows` and `translate`, and accepts async
187
+ `onSubmitDetails(awardId, details)`.
188
+ `RewardsTree` requires `tree` and accepts `size` (default 260). These can be
189
+ composed within `Confirmation`. Account-level `AccountRewardsSection` is a
190
+ separate read-only aggregate.
191
+
192
+ ## Account and post-purchase components
193
+
194
+ These exports are independent features, not implied by a checkout purchase.
195
+ They require matching backend support and appropriate account or order access.
196
+ Host-owned links, callbacks and sign-in should preserve buyer/session ownership
197
+ across asynchronous navigation. Many use React Query hooks and therefore need
198
+ a query provider. The optional `locale`, `translate`, `theme`, `style`,
199
+ `showHeader` and callbacks listed below customize each specific screen, not the
200
+ entire SDK. Inspect the linked declarations for the exact `Translate`, data and
201
+ flow types.
202
+
203
+ | Component | Required props | Optional props / behavior |
204
+ | --- | --- | --- |
205
+ | `TicketChange` | `ticketHash` | `orderHash`, `onChanged`, `openUrl`, `onLogin`, `locale`, `messages`, `translate`. `orderHash` supports an order-link guest; a paid change hands off to the hosted payment page. |
206
+ | `TicketRefund` | `ticketHash` | `onSubmitted`, `onDone`; the server supplies available refund options. |
207
+ | `TicketGift` | `ticketHash` | `onTicketsChanged`, `onDone`, `locale`; displays server gift eligibility/status and confirmation. |
208
+ | `Passes` | — | `onTicketsChanged`, `locale`; server-owned pass events, redemption and booking state. |
209
+ | `Trips` | `onOpen(url)`, `onPage(query)` | `data`, `locale`, `loading`, `errorMessage`, `onRetry`; the host loads data and owns authenticated navigation. |
210
+ | `AccountRewardsSection` | — | `locale`, `onBrowseEvents`, `onViewTickets`; read-only account aggregate, with no order-specific mutation. |
211
+ | `AccountInformationSection` | `orderId` | `title`, `target`, `locale`, `active`, `onSaved`; edit supported order information. |
212
+ | `AccountPaymentPlanSection` | `plan`, `orderHash`, `onOpen(url)` | `locale`, `onReturn`; host opens the server-provided plan URL. |
213
+ | `AccountDeletion` | — | `showHeader`, `showExplanation`, `onSignIn`, `onDone`, `onOpenTeam`, `locale`, `translate`, `theme`, `style`; shared flow handles proof and blockers. |
214
+ | `AccountDeletionView` | `deletion: AccountDeletionFlow` | Same remaining props as `AccountDeletion`; use when the host owns the flow. |
215
+ | `ProfileSettings` | `mode: 'links' \| 'visibility'` | `showHeader`, `onBack`, `onSignIn`, `locale`, `translate`, `renderLinkIcon`, `renderSaveButton`, `theme`, `style`. |
216
+ | `ProfileSettingsView` | `mode`, `settings: ReturnType<typeof hooks.useProfileSettings>` | Same remaining props as `ProfileSettings`. |
217
+ | `NotificationPreferences` | — | `locale`, `translate`, `showHeader`, `onBack`, `onSignIn`, `onSaved`, `theme`, `style`, `renderSaveButton`. |
218
+ | `NotificationPreferencesView` | `preferences: NotificationPreferencesFlow` | Same remaining props as `NotificationPreferences`. |
219
+ | `Streaming` | `onOpenMusic(url, provider)` | `onSignIn`, `locale`, `translate`, `renderProviderIcon`, `showHeader`, `theme`, `style`. The callback must resolve when the browser handoff returns. |
220
+ | `StreamingView` | `onOpenMusic`, `preferences: ReturnType<typeof hooks.useAccountPreferences>` | Same remaining props as `Streaming`. |
221
+ | `PhoneAuthentication` | `flow: PhoneAuthenticationFlow` | `locale`, `showHeader`, `allowCreation`, `allowPasswordReset`, `countryOptions`, `onOpenTerms`, `onOpenPrivacy`, `style`. |
222
+ | `AccountEmailEnrichment` | `flow: AccountEmailEnrichmentFlow` | `locale`, `showHeader`, `onDone`, `style`. |
223
+ | `EventDiscussionView` | `eventId`, `discussion: EventDiscussion` | `onLogin`, `pickImage`, `pickImages(remaining)`, `previewKey`, `locale`, `renderReplyIcon`, `renderImageCloseIcon`, `onModerationFilter`, `renderReactionIcon`. Discussion pickers return base64 strings or `null`, unlike checkout's object picker. |
224
+ | `PostReaction` | `postId: string \| number` | `onSignIn`, `renderIcon`, `translate`, `showFeedback`; creates its flow. |
225
+ | `PostReactionControls` | `flow: WordPostReactionFlow` | `onSignIn`, `renderIcon`, `translate`, `showFeedback`. |
226
+ | `PostReactionFeedback` | `flow` | `translate`. |
227
+
228
+ Use `hooks.useTicketChange`, `useTicketRefund`, `useTicketGift`,
229
+ `useCustomerPasses`, `useTrips`/`useTrip`, `useAccountDeletion`,
230
+ `useProfileSettings`, `useNotificationPreferences`, `useAccountPreferences`,
231
+ `usePhoneAuthentication`, `useAccountEmailEnrichment`, `useEventDiscussion`
232
+ and `useWordPostReaction` for custom presentations. Consult their individual
233
+ state/actions and server eligibility rather than assuming a mutation succeeded
234
+ because a screen closed.
235
+
236
+ ## Authentication forms
237
+
238
+ `AuthModal` requires `open: boolean` and `onClose: () => void`; optional props
239
+ are `checkoutEventId`, `onCheckoutAuthenticated`, `allowRegistration`,
240
+ `allowPasswordReset`, `requireRegistrationAddress`, `logoUrl`,
241
+ `onAuthenticated`, `initialEmail` and `message`. Checkout scope and
242
+ full-account scope are distinct. `EmbeddedCheckout` supplies its event ID to
243
+ the built-in modal. A host `onLogin` callback replaces the modal and must
244
+ preserve the guest cart and session owner itself.
245
+
246
+ The smaller forms can be composed with `hooks.useAuthFlow` or an authorized host
247
+ controller. Required callbacks are marked:
248
+
249
+ | Form | Props |
250
+ | --- | --- |
251
+ | `LoginForm` | **`onSubmit(input)`**; `initialEmail`, `errors`, `error`, `loading`, `allowPasswordReset`, `onForgotPassword(email)`, `onFieldChange(field)`. |
252
+ | `RegisterForm` | **`onSubmit(input, { requireState, termsAccepted? })`**; `initialEmail`, `locale`, `errors`, `error`, `loading`, `requireAddress`, `requireTerms`, `completionRefresh`, `onFieldChange`. `completionRefresh` supplies `retryAfter`, async `onRequest`, async `onVerify`. |
253
+ | `ForgotPasswordForm` | **`onSubmit(email)`**, **`onBackToLogin(email)`**; `initialEmail`, `errors`, `error`, `successMessage`, `loading`, `onFieldChange`. |
254
+ | `ResetPasswordForm` | **`token`** from the reset link; `onSuccess`, `onBackToLogin`. It drives its reset mutation. |
255
+ | `TwoFactorForm` | **`loading`**, **`error`**, **`successMessage`**, **`smsAvailable`**, **`smsRetryAfter`**, **`onSubmit(code)`**, **`onSendSms()`**, **`onCancel()`**. The async callbacks retain the controller's pending challenge. |
256
+ | `EmailCodeForm` | **`initialEmail`**, **`sent`**, **`target`**, **`retryAfter`**, **`loading`**, **`error`**, **`successMessage`**, **`onRequest(email)`**, **`onVerify(code)`**, **`onBack()`**. |
257
+ | `PasswordInput` | Same props as `Input` except `secureTextEntry`; it owns visibility. |
258
+
259
+ `AuthLoginInput` has `email` and `password`; `AuthRegistrationInput` includes
260
+ names, email, password/confirmation and optional contact/address fields. Do not
261
+ log passwords, verification codes, auth proofs, tokens or full profile data.
262
+ The host must restore/flush its secure adapter as described in the README.
263
+
264
+ ## Primitives
265
+
266
+ These native exports are theme-aware. Unless shown otherwise, fields below are
267
+ optional. They are controlled presentation; the host owns their state and
268
+ accessible context.
269
+
270
+ | Export | Props / behavior |
271
+ | --- | --- |
272
+ | `Loader` | `size?: 'small' \| 'large'`, `color?`. |
273
+ | `Card` | **`children`**, `style?: StyleProp<ViewStyle>`. |
274
+ | `SectionHeader` | **`title`**, `subtitle?`. |
275
+ | `Divider` | No props. |
276
+ | `BodyText`, `MutedText` | **`children`**, optional text `style`. |
277
+ | `ErrorText` | **`children`**. |
278
+ | `Button` | **`onPress`**, **`children`**, `loading?`, `disabled?`, `variant?: 'primary' \| 'ghost'`. |
279
+ | `FrozenFields` | **`children`**, `frozen?`; supported SDK controls stop input while frozen. `useFrozen()` reads the state. |
280
+ | `Field` | **`children`**, `label?`, `error?`, `required?`. |
281
+ | `Input` | **`value`**, **`onChangeText`**; `placeholder`, `keyboardType`, `autoCapitalize`, `secureTextEntry`, `editable`, `invalid`, `onBlur`, plus selected native `TextInputProps`: `textContentType`, `autoComplete`, `autoFocus`, `maxLength`, `onSubmitEditing`, `accessibilityLabel`, `multiline`. |
282
+ | `Checkbox` | **`checked`**, **`onChange(checked)`**, **`label`**, `invalid?`. |
283
+ | `Select<T>` | **`value: T \| null \| undefined`**, **`onChange(value)`**, **`options: { label: string; value: T }[]`**; `placeholder?`, `invalid?`, `disabled?`. |
284
+ | `QuantitySelect` | **`value`**, **`onChange(value)`**, `min?`, `max?`, `step?`, `disabled?`, `label?`. Zero is allowed as no selection even if a purchase has a minimum. Supply an accessible label. |
285
+ | `Timer` | **`seconds`**, `urgentAt?` (default 60), `label?`. |
286
+ | `TimerBanner` | `seconds?`, `urgentAt?` (default 60), `message?`; dismissible and hidden without a positive live reservation. |
287
+ | `PaymentMethods` | **`options: PaymentMethodOption[]`**, **`selected`**, **`onSelect(value)`**; `extraValues`, `onExtraChange`, `showValidation`, `inputSlotFor`, `children`. Renders options/extra fields, not payment submission. |
288
+ | `RichText` | **`html`**, `textStyle`, `tagsStyles`, `onLinkPress(href)`, `selectable`. Requires `react-native-render-html`. |
289
+ | `CardInput` | `onComplete(complete)`, `owner` (default `checkout`), `visible`. It is a provider card field, not an order result. `claimCardField(owner)` claims the matching field. |
290
+
291
+ `useInstallmentPicker()` returns `{ onInstallmentOffers, picker }` for a custom
292
+ provider: mount `picker` and pass its callback as the port. The self-provided
293
+ `CheckoutProvider` already handles this. `useStyles(resolvedTheme)` returns the
294
+ SDK primitive styles; `resolveTheme(partial)` resolves the light/dark tokens.
295
+
296
+ ## Hook catalog
297
+
298
+ Import these as `hooks.use…`, except the **top-level native** `useCheckout()`
299
+ and the context/theme hooks in the preceding sections. Parameters below describe
300
+ beta.25; consult the declarations for exact returned state, types, generics and
301
+ callbacks. Hook state is scoped to the active configuration/session. Avoid using
302
+ an old async result to mutate a newly signed-in buyer's UI. Some hooks return
303
+ React Query query/mutation results; flow hooks return their own state, commands
304
+ and queries, not a universal mutation interface.
305
+
306
+ ### Catalog, geography and engagement
307
+
308
+ | Hook | Parameters / role |
309
+ | --- | --- |
310
+ | `useEvent` | `(eventId, options?)`: event information. |
311
+ | `useTickets` | `(eventId, options?)`: current ticket types. |
312
+ | `useTicketsWithMeta` | `(eventId, options?)`: tickets plus catalog promo/access and waiting-list metadata. Refetch after applying a code. |
313
+ | `useTimeSlotTickets` | `(eventId, date, options?)`: one date's slot tickets. |
314
+ | `useEventAddons` | `(eventId, options?)`: event add-on catalog. |
315
+ | `useEventBundles` | `(eventId)`: event bundles. |
316
+ | `useTicketCatalog` | `(eventId, explicitDates?)`: ticket selection controller used by `Tickets`. |
317
+ | `useFeaturedEvents` | `(query?, options?)`: featured events. |
318
+ | `useCountries` | `(options?)`: country list. |
319
+ | `useStates` | `(countryId, options?)`: states for a country; gated on ID. |
320
+ | `useWaitingListForm` | `(eventId, definition, onJoin, prefill?)`: render a server-defined waiting list. |
321
+ | `useJoinWaitingList` | `(eventId, options?)`: waiting-list mutation. |
322
+ | `useAttributeReferrer` | `(eventId, options?)`: attribution mutation. Classify a link before calling. |
323
+ | `useSendRsvp` | `(eventId, options?)`: RSVP mutation where supported. |
324
+ | `useValidatePhone` | `(options?)`: phone validation mutation. |
325
+ | `useDiscoveryTravel` | `(publicPreferenceStorage?)`: discovery travel state; any supplied adapter is distinct from assumed secure credential storage. |
326
+
327
+ ### Cart, payment and checkout state
328
+
329
+ | Hook | Parameters / role |
330
+ | --- | --- |
331
+ | `useCheckout` | `(config: EngineConfig)`: **shared low-level hook** under `hooks`, requiring ports. Normally use the top-level native `useCheckout(options?)` instead. |
332
+ | `useAppCheckoutSession` | `()`: active app checkout session/store. |
333
+ | `useAddOnSelection` | `(eventId, checkout, { onContinue?, onSkip? })`: add-on drafts, capture and save. |
334
+ | `useSeatSelection` | `(eventId, checkout, onContinue?)`: internal seating controller. |
335
+ | `useSeatsIoSelection` | `(eventId, checkout, initial, onContinue?)`: Seats.io controller. |
336
+ | `useAccommodationSelection` | `(eventId, checkout)`: stay draft, quote and reservation. |
337
+ | `useCheckoutPaymentMethods` | `(store)`: pre-order method query for the store. |
338
+ | `useCheckoutImageField` | `({ value, onChange, pick?, identity, disabled? })`: validates the checkout image selection. |
339
+ | `useCheckoutPhoneIdentity` | `({ eventId?, whatsappAvailable?, currentPhone?, onVerified })`: checkout-scoped phone proof flow. |
340
+ | `useCheckoutBuyerProfile` | `(eventId?)`: checkout buyer profile query. |
341
+ | `useWaiverSigning` | `(eventId, waiver, attach, hold)`: signatures with cart/holder-bound holds. |
342
+ | `useTicketCardOwner` | `()`: per-mount field owner. |
343
+ | `useTicketCardForm` | `({ confirmer, store, owner, showsStripeField })`: coordinates the ticket card form. |
344
+ | `useTicketGatewayWait` | `(store)`: reason a shared confirmer is held. |
345
+ | `useConfirmerHolder` | `()`: current payment confirmer holder. |
346
+ | `useBundleStarting` | `(store)`: bundle gateway state. |
347
+ | `useBundlePurchase` | `(confirmer, scope?, onComplete?, checkoutStore?, visible?, section?)`: bundle purchase controller. |
348
+ | `useBundleFlow` | `(confirmer, eventId, options)`: bundle form, payment and completion controller. |
349
+ | `useOnEventChange` | `(eventId, onChange)`: notify a composed form of event change. |
350
+ | `useOnOrderReleased` | `(orderFixed, onRelease)`: restore/edit a form when a non-charged placement releases it. |
351
+
352
+ ### Identity, profile and account
353
+
354
+ | Hook | Parameters / role |
355
+ | --- | --- |
356
+ | `useAuthFlow` | `(options?)`: shared login/register/recovery/verification controller. |
357
+ | `useAuthSession` | `()`: observable auth/session state. |
358
+ | `useSessionAction` | `()`: capture a session assertion for async host actions. |
359
+ | `useLogin` | `(options?)`: login mutation; variables include `email`, `password`. |
360
+ | `useRegister` | `(options?)`: raw registration mutation. |
361
+ | `useRegisterAccount` | `(options?, handoff?)`: typed account-registration mutation. |
362
+ | `useLogout` | `(options?)`: logout mutation. |
363
+ | `useCheckEmailExists` | `(options?)`: email check mutation. |
364
+ | `useRestorePassword`, `useRestorePasswordRn` | `(options?)`: password recovery mutation. |
365
+ | `useResetPassword` | `(options?)`: variables `{ token, password, passwordConfirmation? }`. |
366
+ | `useVerifyTwoFactor` | `(options?)`: variables include `code`, `csrfToken`, `sessionEpoch`, optional expected customer ID. |
367
+ | `useSendTwoFactorSms` | `(options?)`: variables include the pending `csrfToken` and `sessionEpoch`. |
368
+ | `useRequestAccountEmailCode`, `useVerifyAccountEmailCode`, `useCompleteAccount` | Account email challenge/completion operations; preserve the original challenge and buyer. |
369
+ | `usePhoneAuthentication` | `(options?)`: phone authentication flow. |
370
+ | `useAccountEmailEnrichment` | `(options?)`: add/verify account email through its flow. |
371
+ | `useProfile` | `(options?)`: account profile query. |
372
+ | `useUpdateAccount`, `useUpdateProfile` | `(options?)`: account/profile mutations with `AccountUpdate` / `ProfileUpdate`. |
373
+ | `useSavePhone`, `useSendPhoneCode`, `useVerifyPhoneCode` | `(options?)`: account phone operations. |
374
+ | `useProfileGender` | `()`: profile gender state. |
375
+ | `useLinkedAccounts` | `(email)`: linked accounts flow. |
376
+ | `useAccountDeletion` | `()`: account deletion proof/blocker/submission flow. |
377
+ | `useAccountInformation` | `(orderId, target?, enabled?)`: order information editing flow. |
378
+ | `useAccountPlanManagement` | `(plan, orderHash, onOpen, onReturn?)`: hosted plan action flow. |
379
+ | `useNotificationPreferences` | `()`: notification preference flow. |
380
+ | `useAccountPreferences`, `useInterestSelection` | `(enabled?)` / `()`: account preferences and interests. |
381
+ | `useProfileSettings` | `()`: profile link/visibility editor flow. |
382
+
383
+ ### Orders, rewards, social and post-purchase
384
+
385
+ | Hook | Parameters / role |
386
+ | --- | --- |
387
+ | `useOrders` | `(query?, options?)`: account order list query. |
388
+ | `useOrder` | `(orderId, options?)`: order detail query. |
389
+ | `useTicketChangeOptions`, `useTicketChange` | `(access, options?)` / `(access, openUrl?, options?)`: server-offered changes, optional guest order link and handoff. |
390
+ | `useTicketRefund` | `(ticketHash, onSubmitted?)`: refund review/submission flow. |
391
+ | `useTicketGift` | `(ticketHash, onTicketsChanged?)`: gift flow. |
392
+ | `useTicketResale` | `(ticket, onListed?)`: resale flow for a supplied ticket. |
393
+ | `useCustomerPasses` | `(onTicketsChanged?)`: passes and redemptions. |
394
+ | `useTrips`, `useTrip` | `(accountKey, query?, options?)` / `(accountKey, eventId, query?, options?)`: account trips. |
395
+ | `useOrderRewards`, `useAccountRewards` | `(orderHash, options?)` / `(options?)`: order-specific and account aggregate queries. |
396
+ | `useReceiptRewards` | `({ orderHash, data })`: order reward presentation/controller. |
397
+ | `useSubmitPrizeDetails`, `useCreatePack`, `useJoinPack`, `useLeavePack`, `useRegenerateShareCard` | `(orderHash, options?)`: order-scoped reward mutations. |
398
+ | `useAccountRewardsSummary` | `(translate)`: account rewards view/controller. |
399
+ | `useEventComments`, `useEventDiscussion` | `(eventId, options?)`: comments and discussion flows. |
400
+ | `useEventCommentImage` | `(eventId, comment, previewKey?, index?)`: comment image query. |
401
+ | `useWordPostReaction` | `(postId, enabled?)`: post reaction flow. |
402
+ | `useFriends` | `(section?)`: friends flow. |
403
+ | `useFriendProfile` | `(id, section?, cursor?)`: profile. |
404
+ | `useSavedEvents`, `useSavedEvent` | `(cursor?, enabled?)` / `(eventId, enabled?)`: saved-event state. |
405
+
406
+ Advanced composition helpers are also in `hooks`: `useLiveScope(subject)`,
407
+ `useScopedState(scope, initial)`, `useHeldScopes(lock, scopes)`,
408
+ `useLockBusy(lock, scope)`, `ttfKeys`, `appCheckoutStore`,
409
+ `rotateAppCheckoutSession`, `confirmerGateway`, `checkoutStartLock`,
410
+ `whenConfirmerFree`, and other exported selection/gateway functions. Treat
411
+ these as coordination tools with the declared contracts, not as permission to
412
+ bypass a fixed order or an outstanding payment.
413
+
414
+ ## API facade
415
+
416
+ `ttf` groups configured API calls and helpers. Network calls usually return
417
+ promises; `ttf.events.filterAddonsForTickets` and
418
+ `ttf.order.mapProfileToBilling` are synchronous. Import `ttf` from the native
419
+ package after native setup. For example:
420
+
421
+ ```ts
422
+ import { ttf } from 'tf-checkout-react-native'
423
+
424
+ export async function loadCatalog(eventId: string) {
425
+ const [info, tickets] = await Promise.all([
426
+ ttf.events.info(eventId),
427
+ ttf.events.ticketsWithMeta(eventId),
428
+ ])
429
+ return { info, tickets }
430
+ }
431
+ ```
432
+
433
+ The facade is not a payment UI or a replacement for the engine's preflight,
434
+ confirmation and uncertainty handling. Some calls change server state and
435
+ require an authorized buyer, event, order or other proof. Its domain map:
436
+
437
+ | Domain | Methods |
438
+ | --- | --- |
439
+ | `ttf.events` | `featured`, `details`, `tickets`, `ticketsWithMeta`, `bundles`, `startBundlePurchase`, `info`, `conditions`, `timeSlotTickets`, `customFields`, `requiredCustomFieldLabels`, `addons`, `filterAddonsForTickets`, `submitPromoCode`, `setCurrency`, `authenticate`, `track`, `updateOrderDataCapture`, `updateTicketDataCapture` |
440
+ | `ttf.cart` | `add`, `addSeats`, `get`, `checkoutConfigs`, `price`, `priceBreakdown`, `paymentConfig`, `preOrderMethods`, `checkBuyerEmail` |
441
+ | `ttf.order` | `create`, `review`, `mapProfileToBilling`, `completeFreeRegistration`, `confirmSuccess`, `idVerificationStatus`, `verifyCustomer` |
442
+ | `ttf.payment` | `startAdyen`, `adyenPage`, `changeMethodType`, `confirmRedirect`, `prepareOxxo`, `xenditEWalletCharge`, `xenditCardCharge`, `installmentOffers`, `confirmInstallments`, `createPaymentPlan`, `chargeSavedCardPlan`, `changeMethod`, `paypalForm` |
443
+ | `ttf.auth` | `loginForCheckout`, `loginCheckoutWithVerifiedPhone`, `registerForCheckout`, `getCheckoutBuyerProfile`, checkout email/2FA methods, `logoutFromCheckout`, account deletion/linking, browser sign-in, account email/phone verification, `login`, `register`, `registerAccount`, `logout`, password recovery/reset, email check and identity verification methods |
444
+ | `ttf.profile` | `get`, `updateAccount`, `update`, `savePhone`, `sendPhoneCode`, `verifyPhoneCode` |
445
+ | `ttf.geo` | `countries`, `states` |
446
+ | `ttf.extras` | `accommodation`, `quoteAccommodation`, `reserve` |
447
+ | `ttf.orders` | `list`, `get`, `myTickets`, `updateOrderCustomFields`, `updateTicketHolderCustomFields`, `updateAddOnCustomFields` |
448
+ | `ttf.engagement` | `attributeReferrer`, `joinWaitingList`, `sendRsvp`, `validatePhone` |
449
+ | `ttf.seatmap` | `startSession`, `data`, `statuses`, `reserve`, `removeReserved`, `refreshReservation` |
450
+ | `ttf.ticketChanges` | `options`, `change`, `joinWaitlist`, `leaveWaitlist`, `history` |
451
+ | `ttf.refunds` | `options`, `submit` |
452
+ | `ttf.gifts` | `options`, `send`, `cancel` |
453
+ | `ttf.passes` | `list`, `get`, `events`, `bookings`, `redeem`, `cancel` |
454
+ | `ttf.trips` | `list`, `get` |
455
+ | `ttf.resale` | `sell`, `remove`, `process`, `decline` |
456
+ | `ttf.confirmation` | `get` |
457
+ | `ttf.rewards` | `forOrder`, `forAccount`, `submitPrizeDetails`, `createPack`, `joinPack`, `leavePack`, `regenerateShareCard` |
458
+ | `ttf.waivers` | `forCheckout`, `uploadSignatureImage` |
459
+ | `ttf.comments` | `list`, `image`, `create`, `update`, `remove`, `react`, `report`, `block`, `moderate` |
460
+ | `ttf.word` | `getReaction`, `setReaction` |
461
+ | `ttf.friends` | `list`, `preview`, `command`, `saveSettings`, `saveProfileSettings`, `matchContacts`, `profile` |
462
+ | `ttf.savedEvents` | `list`, `status`, `save` |
463
+ | `ttf.preferences` | `getNotifications`, `saveNotifications`, `get`, `save`, `connectAppleMusic`, `disconnectAppleMusic`, `connectSpotify`, `disconnectSpotify` |
464
+ | `ttf.preRegistration` | `confirm`, `influencers`, `confirmationPage`, `submitShareAction` |
465
+ | `ttf.delegation` | `checkCustomerExists`, `pageInfo`, `issueTicket` |
466
+
467
+ `api` exports raw API functions in a namespace; `ENDPOINTS` provides endpoint
468
+ constants. Use declarations to choose the exact method signature and response
469
+ envelope. Direct calls still require the right session and may not carry the
470
+ state-management guarantees of the checkout engine. Never store the raw
471
+ credentials or log authorization headers, payment secrets, buyer answers or
472
+ full provider payloads.
473
+
474
+ ## Headless state, actions and ports
475
+
476
+ `NativeUseCheckout` extends `UseCheckout` and `CheckoutSnapshot`. The top-level
477
+ native `useCheckout({ ports?, options?, paymentSheet? })` merges optional ports
478
+ over native defaults. `CheckoutProvider` creates it when `value` is omitted;
479
+ when a host passes `value`, configure the hook itself. Its snapshot is also
480
+ spread on the return value. Derived `isBusy`, `secondsLeft`,
481
+ `missingRequiredAddonNames`, `buyerFields` and `isLoggedIn` are useful for
482
+ custom UI. `isLoggedIn` can reflect an authenticated access/header-backed
483
+ session or an event-bound in-memory checkout buyer. It does not establish full
484
+ private-account scope.
485
+
486
+ Important actions:
487
+
488
+ ```text
489
+ // Signatures are descriptive; invoke these on a hook/engine, not at module scope.
490
+ setTickets(eventId, selections) // Promise<void>
491
+ setSeats(eventId, seatLines) // Promise<void>
492
+ setSeatsIo(eventId, selection) // Promise<void>
493
+ resumeCart(eventId, { isFromResale? }) // Promise<void>
494
+ setAddons({ [addOnId]: quantity }) // Promise<void>, reprices
495
+ setExtraItems(items) // Promise<void>
496
+ setExtraDraft(itemsOrUndefined) // void
497
+ setBilling(billing) // void
498
+ setHolders(holders, { backfilled? }) // void
499
+ setConsent({ ttfOptIn, brandOptIn }) // void
500
+ setAcceptedConditions({ [id]: boolean }) // void
501
+ acceptCondition(id, accepted) // void
502
+ setAddonDataCapture({ [addOnId]: values }) // void
503
+ holdWaiverSigning(index) // hold | null; release when done
504
+ setWaiverSignature(index, signatureOrNull, hold?) // boolean
505
+ checkBuyerEmail(email) // Promise<void>
506
+ reloadCheckoutDetails() // Promise<void>
507
+ syncCurrency(eventId, code?, options?) // Promise<CurrencySync>
508
+ placeOrder(method?, options?) // Promise<PlaceOrderResult>
509
+ runIdVerification(orderHash, options?) // Promise<IdVerificationStatus | undefined>
510
+ applyPromoCode(eventId, promo) // Promise<void>
511
+ attributeReferrer(eventId, referrerOrNull) // Promise<void>
512
+ joinWaitingList(eventId, entry) // Promise<void>
513
+ reset() // void
514
+ resetWhenSettled() // Promise<boolean>
515
+ ```
516
+
517
+ `placeOrder` accepts a simple card/wallet method or a `PaymentRequest` union;
518
+ review the README's payment section before constructing a custom selector. The
519
+ `options` can include `autoRunIdVerification`, `idVerification`, and
520
+ `claimCard`. After the order step returns, automatic ID-verification rejection
521
+ is swallowed. A pending order can also request verification; failure of that
522
+ separate step proves neither payment failure nor settlement. Present its status
523
+ independently. When money may have moved, preserve and reconcile the original
524
+ order. `resetWhenSettled`
525
+ returns false for a retained or retired checkout. A provider page, picker or
526
+ other custom port must settle on all close/cancel/unmount paths.
527
+
528
+ For zero-total orders, this SDK ignores the free-registration response body and
529
+ reports `needIdVerification: false`. Verification or approval may still be
530
+ required; `free: true` is not proof of ticket issuance. The default inline
531
+ `EmbeddedCheckout` can nevertheless say registration is complete and the buyer
532
+ is registered while approval or verification is still outstanding. Use
533
+ `confirmationMode="redirect"` with host-owned authoritative order and
534
+ verification status, or a custom composed confirmation gated on that status.
535
+ If status is unavailable, contact support. Do not retry payment for a free order.
536
+
537
+ `CheckoutOptions` has `stripePublishableKey`, `merchantIdentifier`,
538
+ `merchantCountryCode`, `merchantName`, `googlePayTestEnv`, `redirectReturnUrl`
539
+ and `urlScheme`. The native `Payment` Google Pay support probe derives test
540
+ mode from `env` (`STAG`/`DEV`), while confirmation uses `googlePayTestEnv`.
541
+ Set them consistently and test both on device; `baseUrl` does not set `env`.
542
+ The wallet merchant country comes from the order review.
543
+ `NativePaymentSheetOptions` requires `merchantDisplayName` and
544
+ `returnURL`; it is a limited opt-in and requires matching registered scheme,
545
+ callback routing and provider eligibility. `CheckoutPorts` requires a
546
+ `confirmer: PaymentConfirmer` and has optional `claimDefaultCardField`,
547
+ `providerPage`, `openUrl`, `onInstallmentOffers`, `tokenizeXenditCard` and
548
+ payment-specific `PaymentConfirmerExtras`. `createRnStripeConfirmer()` and
549
+ `createRnPorts()` create native adapters; `rnConfirmer` and `rnPorts` are the
550
+ package instances. `rnPorts` includes native Stripe rails and Linking but no
551
+ provider-page presentation. `Payment` inside a self-providing
552
+ `CheckoutProvider` includes the provider page and installment picker; a
553
+ headless/controlled host supplies them.
554
+
555
+ For advanced non-React use, `createEngine({ ports, options?, store? })` returns
556
+ `store`, `getSnapshot`, `subscribe`, `prime`, `primeSeats`, `primeSeatsIo`,
557
+ `resumeCart`, the setters, `placeOrder`, `syncCurrency`, `runIdVerification`,
558
+ `reset`, `resetWhenSettled` and `expireCart`. `createCheckoutStore(initial?)`
559
+ constructs a store. A separate custom store is an explicit ownership decision;
560
+ do not run competing flows against the same buyer/cart or provider UI. The
561
+ shared confirmer returns Stripe-style intent statuses; a custom confirmer must
562
+ use accurate `paymentProviderError` outcome classifications and retain unknown
563
+ outcomes. See the declarations for all method contracts and status types.
564
+
565
+ ## Types and errors
566
+
567
+ Key shapes:
568
+
569
+ - `TicketSelection`: `id`, `name`, `optionName`, `price`, `quantity`, `currency`.
570
+ - `SeatLine`: `seatId`, `tierId`, `ticketTypeId`, `optionName`, `price`, optional
571
+ `guests`; only for a seat already reserved through the appropriate flow.
572
+ - `CheckoutBilling`: required `firstName`, `lastName`, `email`; optional email
573
+ confirmation, phone, address, IDs/codes, DOB, event-gated fields and
574
+ `dataCapture`.
575
+ - `CheckoutHolder`: required `firstName`, `lastName`, `email`; optional `phone`,
576
+ numeric ticket-type ID encoded as string, and `ticketDataCapture`.
577
+ - `CheckoutConsent`: `ttfOptIn`, `brandOptIn` booleans. `EventCondition`:
578
+ `id`, `name`, `content`, `isRequired`.
579
+ - `CheckoutImagePicker`: asynchronous picker returning raw base64 and optional
580
+ dimensions, or `null`. The SDK checks base64 encoding and image signature,
581
+ the 2 MiB maximum and supplied dimensions (at most 4096 pixels per side); the
582
+ server validates decoded bytes. The host owns OS permissions and storage.
583
+ - `PlaceOrderResult`: `orderHash`, `free`, `needIdVerification`, with optional
584
+ `currency`, `paymentIntentId`, `alreadyPaid`, `pending`, `pendingVoucherUrl`.
585
+ `pending: true` is not a paid receipt; absence of that flag does not prove
586
+ settlement. Stripe `Processing` or `RequiresCapture` may omit it.
587
+ - `CheckoutStatus`: `idle`, `priming`, `ready`, `repricing`, `placing`,
588
+ `succeeded`, `expired`, `error`. Consult the full snapshot for order/payment
589
+ ownership; a status alone is not a provider settlement statement.
590
+ - `TtfError`: `message`, `status`, optional `code`, `data`, `retryAfter`.
591
+ `status === 0` indicates a transport/network error. `errorMessage` and
592
+ `isCartExpiredError` help present errors.
593
+
594
+ Other useful exports include `CartChangedError`, `ConfirmerBusyError`,
595
+ `CardClaimError`, `PAID_ORDER_PENDING_MESSAGE`, `CART_CHANGED_MESSAGE`,
596
+ `paymentProviderError`, `createMemoryStorage`, `getConfig`, `isConfigured`,
597
+ `clearSession`, `clearCheckoutGuestSession`, `isAuthenticated`,
598
+ `captureSessionAction`, `createTranslator`, `resolveLocale` and
599
+ `registerCatalogue`. Memory storage is for tests, not secure persistence;
600
+ clearing session or resetting an order must respect any in-flight operation.
601
+ Consult the versioned declarations for the complete named type, logic and helper
602
+ surface.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tf-checkout-react-native",
3
- "version": "2.0.0-beta.23",
3
+ "version": "2.0.0-beta.25",
4
4
  "description": "TheTicketFairy ReactNative Checkout library",
5
5
  "homepage": "https://github.com/theticketfairy/tf-shared-libraries#readme",
6
6
  "author": "The Ticket Fairy",
@@ -39,7 +39,8 @@
39
39
  "!scripts/verify-provider-uri.cjs",
40
40
  "!scripts/verify-native-textarea.cjs",
41
41
  "!scripts/verify-frozen-select.cjs",
42
- "!scripts/verify-payment-sheet.cjs"
42
+ "!scripts/verify-payment-sheet.cjs",
43
+ "docs"
43
44
  ],
44
45
  "scripts": {
45
46
  "test": "node scripts/verify-discussion-support.cjs && node scripts/verify-wallet-context.cjs && node scripts/verify-provider-uri.cjs && node scripts/verify-native-textarea.cjs && node scripts/verify-frozen-select.cjs && node scripts/verify-payment-sheet.cjs && jest --passWithNoTests",