tf-checkout-react 1.0.75 → 1.0.79
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/api/index.d.ts +1 -0
- package/dist/components/billing-info-container/index.d.ts +7 -2
- package/dist/components/billing-info-container/utils.d.ts +1 -0
- package/dist/components/common/FormikPhoneNumberField.d.ts +1 -1
- package/dist/components/countdown/index.d.ts +11 -0
- package/dist/components/orderDetailsContainer/ticketsTable.d.ts +13 -1
- package/dist/components/paymentContainer/index.d.ts +9 -2
- package/dist/components/ticketsContainer/index.d.ts +9 -1
- package/dist/components/waitingList/index.d.ts +1 -2
- package/dist/tf-checkout-react.cjs.development.js +505 -177
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +498 -170
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +7 -0
- package/dist/utils/downloadPDF.d.ts +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/package.json +2 -1
- package/src/api/index.ts +9 -0
- package/src/components/billing-info-container/index.tsx +25 -27
- package/src/components/billing-info-container/utils.ts +2 -1
- package/src/components/common/CheckboxField.tsx +19 -8
- package/src/components/common/CustomField.tsx +7 -0
- package/src/components/common/FormikPhoneNumberField.tsx +11 -1
- package/src/components/common/SelectField.tsx +5 -1
- package/src/components/countdown/index.tsx +89 -0
- package/src/components/countdown/style.css +10 -0
- package/src/components/loginModal/index.tsx +2 -0
- package/src/components/orderDetailsContainer/ticketsTable.tsx +66 -60
- package/src/components/paymentContainer/index.tsx +9 -11
- package/src/components/stripePayment/index.tsx +4 -4
- package/src/components/ticketsContainer/PromoCodeSection.tsx +3 -2
- package/src/components/ticketsContainer/TicketsSection.tsx +10 -6
- package/src/components/ticketsContainer/index.tsx +236 -76
- package/src/components/ticketsContainer/style.css +7 -0
- package/src/components/waitingList/index.tsx +3 -9
- package/src/components/waitingList/style.css +4 -2
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +51 -0
- package/src/utils/downloadPDF.tsx +22 -0
- package/src/utils/index.ts +2 -0
|
@@ -6,13 +6,14 @@ import TableContainer from '@mui/material/TableContainer'
|
|
|
6
6
|
import TableHead from '@mui/material/TableHead'
|
|
7
7
|
import TableRow from '@mui/material/TableRow'
|
|
8
8
|
import Paper from '@mui/material/Paper'
|
|
9
|
+
import { downloadPDF } from '../../utils'
|
|
9
10
|
|
|
10
|
-
interface
|
|
11
|
-
|
|
11
|
+
interface IAddOnTypes {
|
|
12
|
+
name: string;
|
|
13
|
+
status: string;
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
add_ons: any[];
|
|
15
|
+
interface ITicketTypes {
|
|
16
|
+
add_ons?: IAddOnTypes[];
|
|
16
17
|
hash: string;
|
|
17
18
|
ticket_type: string;
|
|
18
19
|
holder_name: string;
|
|
@@ -20,67 +21,72 @@ interface TicketTypes {
|
|
|
20
21
|
pdf_link: string;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
interface
|
|
24
|
-
|
|
25
|
-
status: string;
|
|
24
|
+
interface TicketsTableTypes {
|
|
25
|
+
tickets: ITicketTypes[];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const TicketsTable = ({ tickets = [] }: TicketsTableTypes) =>
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
<
|
|
28
|
+
const TicketsTable = ({ tickets = [] }: TicketsTableTypes) => (
|
|
29
|
+
<div className="tickets-box">
|
|
30
|
+
<h4 className="sub-title">Your Tickets</h4>
|
|
31
|
+
<TableContainer component={Paper}>
|
|
32
|
+
<Table aria-label="collapsible table">
|
|
33
|
+
<TableHead>
|
|
34
|
+
<TableRow>
|
|
35
|
+
<TableCell>Ticket ID</TableCell>
|
|
36
|
+
<TableCell>Ticket Type</TableCell>
|
|
37
|
+
<TableCell>Ticket Holder Name</TableCell>
|
|
38
|
+
<TableCell>Status</TableCell>
|
|
39
|
+
<TableCell>Download</TableCell>
|
|
40
|
+
</TableRow>
|
|
41
|
+
</TableHead>
|
|
42
|
+
<TableBody>
|
|
43
|
+
{tickets.map((ticket: ITicketTypes, index: number) => (
|
|
44
|
+
<Fragment key={index}>
|
|
45
|
+
<TableRow>
|
|
46
|
+
<TableCell>{ticket.hash}</TableCell>
|
|
47
|
+
<TableCell>{ticket.ticket_type}</TableCell>
|
|
48
|
+
<TableCell>{ticket.holder_name}</TableCell>
|
|
49
|
+
<TableCell>{ticket.status}</TableCell>
|
|
50
|
+
<TableCell>
|
|
51
|
+
<span
|
|
52
|
+
aria-hidden={true}
|
|
53
|
+
className="download-button"
|
|
54
|
+
onClick={() => downloadPDF(ticket.pdf_link)}
|
|
55
|
+
>
|
|
56
|
+
Download
|
|
57
|
+
</span>
|
|
58
|
+
</TableCell>
|
|
59
|
+
</TableRow>
|
|
60
|
+
{!!ticket.add_ons?.length && (
|
|
46
61
|
<TableRow>
|
|
47
|
-
<TableCell
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<Table className='ticket-add-on-table'>
|
|
59
|
-
<TableHead>
|
|
60
|
-
<TableRow>
|
|
61
|
-
<TableCell>Add-On</TableCell>
|
|
62
|
-
<TableCell>Status</TableCell>
|
|
63
|
-
</TableRow>
|
|
64
|
-
</TableHead>
|
|
65
|
-
<TableBody>
|
|
66
|
-
{ticket.add_ons.map((add_on: AddOnTypes, index: number) => (
|
|
62
|
+
<TableCell colSpan={5}>
|
|
63
|
+
<Table className="ticket-add-on-table">
|
|
64
|
+
<TableHead>
|
|
65
|
+
<TableRow>
|
|
66
|
+
<TableCell>Add-On</TableCell>
|
|
67
|
+
<TableCell>Status</TableCell>
|
|
68
|
+
</TableRow>
|
|
69
|
+
</TableHead>
|
|
70
|
+
<TableBody>
|
|
71
|
+
{ticket.add_ons.map(
|
|
72
|
+
(add_on: IAddOnTypes, index: number) => (
|
|
67
73
|
<TableRow key={index}>
|
|
68
74
|
<TableCell>{add_on.name}</TableCell>
|
|
69
75
|
<TableCell>{add_on.status}</TableCell>
|
|
70
76
|
</TableRow>
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
</
|
|
74
|
-
</
|
|
75
|
-
</
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</
|
|
81
|
-
</
|
|
82
|
-
</
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
)
|
|
78
|
+
)}
|
|
79
|
+
</TableBody>
|
|
80
|
+
</Table>
|
|
81
|
+
</TableCell>
|
|
82
|
+
</TableRow>
|
|
83
|
+
)}
|
|
84
|
+
</Fragment>
|
|
85
|
+
))}
|
|
86
|
+
</TableBody>
|
|
87
|
+
</Table>
|
|
88
|
+
</TableContainer>
|
|
89
|
+
</div>
|
|
90
|
+
)
|
|
85
91
|
|
|
86
92
|
export default TicketsTable
|
|
@@ -4,7 +4,7 @@ import Container from '@mui/material/Container'
|
|
|
4
4
|
import CircularProgress from '@mui/material/CircularProgress'
|
|
5
5
|
import Alert from '@mui/material/Alert'
|
|
6
6
|
import { Elements } from '@stripe/react-stripe-js'
|
|
7
|
-
import { loadStripe, StripeConstructorOptions } from '@stripe/stripe-js'
|
|
7
|
+
import { loadStripe, StripeConstructorOptions, StripeElementsOptions } from '@stripe/stripe-js'
|
|
8
8
|
import _map from 'lodash/map'
|
|
9
9
|
import _get from 'lodash/get'
|
|
10
10
|
import _identity from 'lodash/identity'
|
|
@@ -19,6 +19,8 @@ import { IOrderData, IPaymentField } from '../../types'
|
|
|
19
19
|
import { getPaymentData, handlePaymentSuccess, getConditions } from '../../api'
|
|
20
20
|
import { StripeCardNumberElementOptions } from '@stripe/stripe-js'
|
|
21
21
|
import { ThemeProvider, createTheme } from '@mui/material/styles'
|
|
22
|
+
import { ThemeOptions } from '@mui/material'
|
|
23
|
+
import { CSSProperties } from "@mui/styles"
|
|
22
24
|
|
|
23
25
|
const publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || ''
|
|
24
26
|
|
|
@@ -59,7 +61,8 @@ export interface IPaymentPage {
|
|
|
59
61
|
onPaymentError: (value: AxiosError) => void;
|
|
60
62
|
stripeCardOptions?: StripeCardNumberElementOptions;
|
|
61
63
|
disableZipSection: boolean;
|
|
62
|
-
|
|
64
|
+
themeOptions?: ThemeOptions & { input?: CSSProperties; checkbox?: CSSProperties };
|
|
65
|
+
elementsOptions?: StripeElementsOptions;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
const initialOrderValues: IOrderData = {
|
|
@@ -92,7 +95,8 @@ export const PaymentContainer = ({
|
|
|
92
95
|
onPaymentError = () => {},
|
|
93
96
|
stripeCardOptions = {},
|
|
94
97
|
disableZipSection = false,
|
|
95
|
-
|
|
98
|
+
themeOptions,
|
|
99
|
+
elementsOptions
|
|
96
100
|
}: IPaymentPage) => {
|
|
97
101
|
const [reviewData, setReviewData] = useState(initialReviewValues)
|
|
98
102
|
const [orderData, setOrderData] = useState(initialOrderValues)
|
|
@@ -184,13 +188,7 @@ export const PaymentContainer = ({
|
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
190
|
|
|
187
|
-
const themeMui = createTheme(
|
|
188
|
-
typography: {
|
|
189
|
-
allVariants: {
|
|
190
|
-
fontFamily,
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
})
|
|
191
|
+
const themeMui = createTheme(themeOptions)
|
|
194
192
|
|
|
195
193
|
return (
|
|
196
194
|
<ThemeProvider theme={themeMui}>
|
|
@@ -231,7 +229,7 @@ export const PaymentContainer = ({
|
|
|
231
229
|
<p className="payment_info__error">{errorText}</p>
|
|
232
230
|
)}
|
|
233
231
|
<div>
|
|
234
|
-
<Elements stripe={getStripePromise(reviewData)}>
|
|
232
|
+
<Elements stripe={getStripePromise(reviewData)} options={elementsOptions}>
|
|
235
233
|
<StripePayment
|
|
236
234
|
stripe_client_secret={_get(
|
|
237
235
|
reviewData,
|
|
@@ -191,7 +191,7 @@ const CheckoutForm = ({
|
|
|
191
191
|
<label className="card_number_element">
|
|
192
192
|
<span className="card_label_text">Card number</span>
|
|
193
193
|
<CardNumberElement
|
|
194
|
-
options={{ ...options
|
|
194
|
+
options={{ ...options, ...stripeCardOptions, }}
|
|
195
195
|
onReady={_identity}
|
|
196
196
|
onChange={_identity}
|
|
197
197
|
onBlur={_identity}
|
|
@@ -200,11 +200,11 @@ const CheckoutForm = ({
|
|
|
200
200
|
</label>
|
|
201
201
|
<label className="expiration_element">
|
|
202
202
|
<span className="card_label_text">Expiration date</span>
|
|
203
|
-
<CardExpiryElement options={{ ...options
|
|
203
|
+
<CardExpiryElement options={{ ...options, ...stripeCardOptions }} />
|
|
204
204
|
</label>
|
|
205
205
|
<label className="cvc_element">
|
|
206
206
|
<span className="card_label_text">CVC</span>
|
|
207
|
-
<CardCvcElement options={{ ...options
|
|
207
|
+
<CardCvcElement options={{ ...options, ...stripeCardOptions }} />
|
|
208
208
|
</label>
|
|
209
209
|
{!disableZipSection && (
|
|
210
210
|
<label className="zip_element">
|
|
@@ -239,7 +239,7 @@ const CheckoutForm = ({
|
|
|
239
239
|
>
|
|
240
240
|
<button disabled={buttonIsDiabled} type="submit">
|
|
241
241
|
{isLoading ? (
|
|
242
|
-
<CircularProgress />
|
|
242
|
+
<CircularProgress size={26} />
|
|
243
243
|
) : (
|
|
244
244
|
`Pay ${getCurrencySymbolByCurrency(currency)}${total}`
|
|
245
245
|
)}
|
|
@@ -34,13 +34,14 @@ export const PromoCodeSection = ({
|
|
|
34
34
|
src={getImage('done.svg')}
|
|
35
35
|
preProcessor={(code) => code.replace(/fill=".*?"/g, 'fill="currentColor"')}
|
|
36
36
|
/>
|
|
37
|
-
<p>PROMO CODE APPLIED SUCCESSFULLY</p>
|
|
37
|
+
<p className="promo-code-success">PROMO CODE APPLIED SUCCESSFULLY</p>
|
|
38
38
|
</div>
|
|
39
39
|
) : null}
|
|
40
40
|
{showPromoInput && (
|
|
41
41
|
<div className="promo-code-block">
|
|
42
|
+
<label>PROMO CODE</label>
|
|
42
43
|
<input
|
|
43
|
-
placeholder="
|
|
44
|
+
placeholder=""
|
|
44
45
|
onChange={e => {
|
|
45
46
|
setPromoCode(e.target.value)
|
|
46
47
|
}}
|
|
@@ -66,12 +66,16 @@ export const TicketsSection = ({
|
|
|
66
66
|
className="event-detail__tier-state"
|
|
67
67
|
style={{ minWidth: 55 }}
|
|
68
68
|
>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
{ticket.salesStarted ? (
|
|
70
|
+
<TicketRow
|
|
71
|
+
ticketTier={ticket}
|
|
72
|
+
prevTicketTier={arr[i - 1]}
|
|
73
|
+
selectedTickets={selectedTickets}
|
|
74
|
+
handleTicketSelect={ticketSelect}
|
|
75
|
+
/>
|
|
76
|
+
) : (
|
|
77
|
+
<p className='ticket-not-started-message'>Sales not started</p>
|
|
78
|
+
)}
|
|
75
79
|
</div>
|
|
76
80
|
</div>
|
|
77
81
|
</div>
|