tf-checkout-react-native 2.0.0-beta.0 → 2.0.0-beta.5
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 +92 -8
- package/dist/index.d.mts +7374 -288
- package/dist/index.d.ts +7374 -288
- package/dist/index.js +23316 -5980
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23461 -6058
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -10
- package/scripts/build-seat-map.mjs +31 -0
- package/scripts/seat-map-entry.jsx +22 -0
- package/src/CardInput.tsx +64 -3
- package/src/EmbeddedCheckout.tsx +129 -36
- package/src/auth/AuthModal.tsx +90 -6
- package/src/auth/EmailCodeForm.tsx +91 -0
- package/src/auth/RegisterForm.tsx +91 -5
- package/src/auth/TwoFactorForm.tsx +74 -0
- package/src/auth/index.ts +4 -0
- package/src/configure.ts +8 -1
- package/src/confirmer.ts +112 -20
- package/src/generated/seatMapWidget.ts +3 -0
- package/src/index.tsx +1 -1
- package/src/sections/Accommodation.tsx +57 -0
- package/src/sections/AccountRewards.tsx +108 -0
- package/src/sections/AddOns.tsx +99 -148
- package/src/sections/BillingInfo.tsx +63 -64
- package/src/sections/Bundles.tsx +467 -0
- package/src/sections/EventDiscussionView.tsx +633 -0
- package/src/sections/Passes.tsx +177 -0
- package/src/sections/Payment.tsx +169 -52
- package/src/sections/PostReaction.tsx +122 -0
- package/src/sections/Rewards.tsx +320 -0
- package/src/sections/SeatMap.tsx +225 -0
- package/src/sections/SeatsIoMap.tsx +110 -0
- package/src/sections/TicketChange.tsx +379 -0
- package/src/sections/TicketGift.tsx +206 -0
- package/src/sections/TicketRefund.tsx +104 -0
- package/src/sections/Tickets.tsx +289 -208
- package/src/sections/Trips.tsx +87 -0
- package/src/sections/WaiverSigning.tsx +429 -0
- package/src/sections/billing/PhoneIdentity.tsx +169 -0
- package/src/sections/discussion/CommentImages.tsx +342 -0
- package/src/sections/discussion/SwipeReply.tsx +88 -0
- package/src/sections/index.ts +20 -0
- package/src/sections/rewards/RewardsLadder.tsx +167 -0
- package/src/sections/rewards/RewardsTree.tsx +117 -0
- package/src/storage.ts +8 -9
- package/src/ui/CheckoutProvider.tsx +25 -13
- package/src/ui/Field.tsx +21 -3
- package/src/ui/Frozen.tsx +22 -0
- package/src/ui/InstallmentPicker.tsx +15 -18
- package/src/ui/PaymentMethods.tsx +6 -3
- package/src/ui/ProviderPages.tsx +134 -0
- package/src/ui/QuantitySelect.tsx +26 -2
- package/src/ui/Select.tsx +4 -1
- package/src/ui/SignaturePad.tsx +218 -0
- package/src/ui/index.ts +1 -0
- package/src/ui/primitives.tsx +13 -2
- package/src/ui/useAccountT.ts +16 -0
- package/src/useCheckout.ts +3 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { type FC } from 'react'
|
|
2
|
+
import { Pressable, View } from 'react-native'
|
|
3
|
+
import { hooks, ticketRefundConsequences } from 'tf-checkout-shared'
|
|
4
|
+
import {
|
|
5
|
+
BodyText,
|
|
6
|
+
Button,
|
|
7
|
+
Card,
|
|
8
|
+
ErrorText,
|
|
9
|
+
Loader,
|
|
10
|
+
MutedText,
|
|
11
|
+
SectionHeader,
|
|
12
|
+
} from '../ui/primitives'
|
|
13
|
+
import { Checkbox } from '../ui/Field'
|
|
14
|
+
import { FrozenFields } from '../ui/Frozen'
|
|
15
|
+
|
|
16
|
+
export interface TicketRefundProps {
|
|
17
|
+
ticketHash: string
|
|
18
|
+
onSubmitted?: () => void
|
|
19
|
+
onDone?: () => void
|
|
20
|
+
}
|
|
21
|
+
export const TicketRefund: FC<TicketRefundProps> = ({
|
|
22
|
+
ticketHash,
|
|
23
|
+
onSubmitted,
|
|
24
|
+
onDone,
|
|
25
|
+
}) => {
|
|
26
|
+
const refund = hooks.useTicketRefund(ticketHash, onSubmitted)
|
|
27
|
+
if (refund.result)
|
|
28
|
+
return (
|
|
29
|
+
<Card>
|
|
30
|
+
<SectionHeader title="Refund requested" />
|
|
31
|
+
<BodyText>
|
|
32
|
+
Your refund request has been submitted. We’ll email you when it is complete.
|
|
33
|
+
</BodyText>
|
|
34
|
+
{onDone && <Button onPress={onDone}>View my tickets</Button>}
|
|
35
|
+
</Card>
|
|
36
|
+
)
|
|
37
|
+
if (refund.query.isLoading) return <Loader />
|
|
38
|
+
if (refund.query.isError)
|
|
39
|
+
return (
|
|
40
|
+
<Card>
|
|
41
|
+
<ErrorText>{refund.query.error.message}</ErrorText>
|
|
42
|
+
<Button onPress={() => void refund.query.refetch()}>Try again</Button>
|
|
43
|
+
</Card>
|
|
44
|
+
)
|
|
45
|
+
const options = refund.query.data?.options ?? []
|
|
46
|
+
return (
|
|
47
|
+
<Card>
|
|
48
|
+
<SectionHeader title="Refund ticket" />
|
|
49
|
+
{!options.length && (
|
|
50
|
+
<BodyText>
|
|
51
|
+
{refund.query.data?.eligibility_reason ||
|
|
52
|
+
'No refund choices are available for this ticket.'}
|
|
53
|
+
</BodyText>
|
|
54
|
+
)}
|
|
55
|
+
{options.map((option) => (
|
|
56
|
+
<Pressable
|
|
57
|
+
key={option.option_id}
|
|
58
|
+
accessibilityRole="radio"
|
|
59
|
+
accessibilityState={{
|
|
60
|
+
checked: refund.selected?.option_id === option.option_id,
|
|
61
|
+
disabled: refund.busy || refund.commandPending,
|
|
62
|
+
}}
|
|
63
|
+
disabled={refund.busy || refund.commandPending}
|
|
64
|
+
onPress={() => refund.select(option.option_id)}
|
|
65
|
+
>
|
|
66
|
+
<BodyText>
|
|
67
|
+
{refund.selected?.option_id === option.option_id ? '● ' : '○ '}
|
|
68
|
+
{option.currency} {option.amount}
|
|
69
|
+
</BodyText>
|
|
70
|
+
</Pressable>
|
|
71
|
+
))}
|
|
72
|
+
{refund.selected && (
|
|
73
|
+
<View style={{ gap: 8 }}>
|
|
74
|
+
<BodyText>
|
|
75
|
+
You’ll receive {refund.selected.currency} {refund.selected.amount}.
|
|
76
|
+
</BodyText>
|
|
77
|
+
<MutedText>
|
|
78
|
+
Amount retained: {refund.selected.currency} {refund.selected.retained_amount}
|
|
79
|
+
</MutedText>
|
|
80
|
+
{ticketRefundConsequences(refund.selected).map((line) => (
|
|
81
|
+
<BodyText key={line}>{line}</BodyText>
|
|
82
|
+
))}
|
|
83
|
+
<FrozenFields frozen={refund.busy || refund.commandPending}>
|
|
84
|
+
<Checkbox
|
|
85
|
+
label="I have reviewed this refund and its effect on my ticket and add-ons."
|
|
86
|
+
checked={refund.confirmed}
|
|
87
|
+
onChange={refund.confirm}
|
|
88
|
+
/>
|
|
89
|
+
</FrozenFields>
|
|
90
|
+
</View>
|
|
91
|
+
)}
|
|
92
|
+
{refund.error && <ErrorText>{refund.error}</ErrorText>}
|
|
93
|
+
{(refund.selected || refund.commandPending) && (
|
|
94
|
+
<Button
|
|
95
|
+
onPress={() => void refund.submit()}
|
|
96
|
+
loading={refund.busy}
|
|
97
|
+
disabled={refund.busy || (!refund.commandPending && !refund.confirmed)}
|
|
98
|
+
>
|
|
99
|
+
{refund.commandPending ? 'Check refund request' : 'Confirm refund'}
|
|
100
|
+
</Button>
|
|
101
|
+
)}
|
|
102
|
+
</Card>
|
|
103
|
+
)
|
|
104
|
+
}
|