tf-checkout-react 1.0.78 → 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/components/billing-info-container/index.d.ts +1 -1
- package/dist/components/paymentContainer/index.d.ts +5 -2
- package/dist/components/ticketsContainer/index.d.ts +7 -1
- package/dist/tf-checkout-react.cjs.development.js +22 -11
- 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 +23 -12
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/billing-info-container/index.tsx +1 -1
- package/src/components/common/CheckboxField.tsx +13 -9
- package/src/components/paymentContainer/index.tsx +6 -3
- package/src/components/stripePayment/index.tsx +3 -3
- package/src/components/ticketsContainer/index.tsx +94 -85
package/package.json
CHANGED
|
@@ -47,7 +47,7 @@ import { SelectField } from '../common/SelectField'
|
|
|
47
47
|
import { ErrorFocus } from '../../utils/formikErrorFocus'
|
|
48
48
|
import { FormikPhoneNumberField } from '../common/FormikPhoneNumberField'
|
|
49
49
|
import { ThemeProvider, createTheme } from '@mui/material/styles'
|
|
50
|
-
import { CSSProperties } from '@mui/
|
|
50
|
+
import { CSSProperties } from '@mui/styles'
|
|
51
51
|
|
|
52
52
|
export interface IBillingInfoPage {
|
|
53
53
|
data?: IBillingInfoData[];
|
|
@@ -4,6 +4,7 @@ import FormControlLabel from '@mui/material/FormControlLabel'
|
|
|
4
4
|
import Checkbox from '@mui/material/Checkbox'
|
|
5
5
|
import { FieldInputProps } from 'formik'
|
|
6
6
|
import { useTheme } from '@mui/styles'
|
|
7
|
+
import { FormControl, FormHelperText } from '@mui/material'
|
|
7
8
|
|
|
8
9
|
export interface ICheckboxField {
|
|
9
10
|
label: string | number | JSX.Element;
|
|
@@ -24,14 +25,17 @@ export const CheckboxField = ({
|
|
|
24
25
|
}: ICheckboxField & IOtherProps) => {
|
|
25
26
|
const customTheme: any = useTheme()
|
|
26
27
|
return (
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
<FormControl error={!!(rest?.form?.errors && rest.form.errors[field?.name ?? ""])}>
|
|
29
|
+
<FormGroup>
|
|
30
|
+
<FormControlLabel
|
|
31
|
+
control={<Checkbox {...field} {...rest} />}
|
|
32
|
+
label={label}
|
|
33
|
+
componentsProps={{
|
|
34
|
+
typography: customTheme?.checkbox
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
</FormGroup>
|
|
38
|
+
{!!(rest?.form?.errors && rest.form.errors[field?.name ?? ""]) ? <FormHelperText>Required</FormHelperText> : null}
|
|
39
|
+
</FormControl>
|
|
36
40
|
)
|
|
37
41
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import { AxiosError } from 'axios'
|
|
3
3
|
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'
|
|
@@ -20,6 +20,7 @@ import { getPaymentData, handlePaymentSuccess, getConditions } from '../../api'
|
|
|
20
20
|
import { StripeCardNumberElementOptions } from '@stripe/stripe-js'
|
|
21
21
|
import { ThemeProvider, createTheme } from '@mui/material/styles'
|
|
22
22
|
import { ThemeOptions } from '@mui/material'
|
|
23
|
+
import { CSSProperties } from "@mui/styles"
|
|
23
24
|
|
|
24
25
|
const publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || ''
|
|
25
26
|
|
|
@@ -61,6 +62,7 @@ export interface IPaymentPage {
|
|
|
61
62
|
stripeCardOptions?: StripeCardNumberElementOptions;
|
|
62
63
|
disableZipSection: boolean;
|
|
63
64
|
themeOptions?: ThemeOptions & { input?: CSSProperties; checkbox?: CSSProperties };
|
|
65
|
+
elementsOptions?: StripeElementsOptions;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
const initialOrderValues: IOrderData = {
|
|
@@ -94,6 +96,7 @@ export const PaymentContainer = ({
|
|
|
94
96
|
stripeCardOptions = {},
|
|
95
97
|
disableZipSection = false,
|
|
96
98
|
themeOptions,
|
|
99
|
+
elementsOptions
|
|
97
100
|
}: IPaymentPage) => {
|
|
98
101
|
const [reviewData, setReviewData] = useState(initialReviewValues)
|
|
99
102
|
const [orderData, setOrderData] = useState(initialOrderValues)
|
|
@@ -226,7 +229,7 @@ export const PaymentContainer = ({
|
|
|
226
229
|
<p className="payment_info__error">{errorText}</p>
|
|
227
230
|
)}
|
|
228
231
|
<div>
|
|
229
|
-
<Elements stripe={getStripePromise(reviewData)}>
|
|
232
|
+
<Elements stripe={getStripePromise(reviewData)} options={elementsOptions}>
|
|
230
233
|
<StripePayment
|
|
231
234
|
stripe_client_secret={_get(
|
|
232
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">
|
|
@@ -22,6 +22,9 @@ import { PromoCodeSection } from './PromoCodeSection'
|
|
|
22
22
|
import { LoginModal } from '../loginModal'
|
|
23
23
|
import Countdown from '../countdown'
|
|
24
24
|
import { createCheckoutDataBodyWithDefaultHolder } from '../../utils'
|
|
25
|
+
import { ThemeProvider } from '@mui/private-theming'
|
|
26
|
+
import { createTheme, ThemeOptions } from '@mui/material'
|
|
27
|
+
import { CSSProperties } from '@mui/styles'
|
|
25
28
|
|
|
26
29
|
function Loader() {
|
|
27
30
|
return (
|
|
@@ -52,6 +55,7 @@ export interface IGetTickets {
|
|
|
52
55
|
theme?: 'light' | 'dark';
|
|
53
56
|
queryPromoCode?: string;
|
|
54
57
|
isPromotionsEnabled?: boolean;
|
|
58
|
+
themeOptions?: ThemeOptions & { input?: CSSProperties; checkbox?: CSSProperties }
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
export interface ITicket {
|
|
@@ -75,6 +79,7 @@ export const TicketsContainer = ({
|
|
|
75
79
|
theme = 'light',
|
|
76
80
|
queryPromoCode = '',
|
|
77
81
|
isPromotionsEnabled = true,
|
|
82
|
+
themeOptions,
|
|
78
83
|
}: IGetTickets) => {
|
|
79
84
|
const [selectedTickets, setSelectedTickets] = useState(
|
|
80
85
|
{} as ISelectedTickets
|
|
@@ -274,6 +279,8 @@ export const TicketsContainer = ({
|
|
|
274
279
|
item => !(item.sold_out || item.soldOut)
|
|
275
280
|
)
|
|
276
281
|
|
|
282
|
+
const themeMui = createTheme(themeOptions)
|
|
283
|
+
|
|
277
284
|
useEffect(() => {
|
|
278
285
|
isWindowDefined &&
|
|
279
286
|
window.document.addEventListener('custom-logout', handleLogout)
|
|
@@ -296,91 +303,93 @@ export const TicketsContainer = ({
|
|
|
296
303
|
}, [])
|
|
297
304
|
|
|
298
305
|
return (
|
|
299
|
-
<
|
|
300
|
-
{
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
<
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
{event?.salesEnded ? (
|
|
311
|
-
<p>Sales for this event are closed.</p>
|
|
312
|
-
) : event?.salesStart ? (
|
|
313
|
-
<Countdown
|
|
314
|
-
startDate={event.salesStart}
|
|
315
|
-
timezone={event.timezone}
|
|
316
|
-
title="Sales start in:"
|
|
317
|
-
message="No tickets are currently available for this event."
|
|
318
|
-
callback={updateTickets}
|
|
306
|
+
<ThemeProvider theme={themeMui}>
|
|
307
|
+
<div className={`get-tickets-page ${theme}`} style={contentStyle}>
|
|
308
|
+
{isLoading ? (
|
|
309
|
+
<Loader />
|
|
310
|
+
) : (
|
|
311
|
+
<div>
|
|
312
|
+
<TicketsSection
|
|
313
|
+
ticketsList={tickets}
|
|
314
|
+
selectedTickets={selectedTickets}
|
|
315
|
+
handleTicketSelect={handleTicketSelect}
|
|
316
|
+
promoCodeIsApplied={promoCodeIsApplied}
|
|
319
317
|
/>
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
<
|
|
367
|
-
<
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
318
|
+
{event?.salesEnded ? (
|
|
319
|
+
<p>Sales for this event are closed.</p>
|
|
320
|
+
) : event?.salesStart ? (
|
|
321
|
+
<Countdown
|
|
322
|
+
startDate={event.salesStart}
|
|
323
|
+
timezone={event.timezone}
|
|
324
|
+
title="Sales start in:"
|
|
325
|
+
message="No tickets are currently available for this event."
|
|
326
|
+
callback={updateTickets}
|
|
327
|
+
/>
|
|
328
|
+
) : null}
|
|
329
|
+
{showWaitingList && event.salesStarted && (
|
|
330
|
+
<WaitingList tickets={tickets} eventId={eventId} />
|
|
331
|
+
)}
|
|
332
|
+
<PromoCodeSection
|
|
333
|
+
promoCode={promoCode}
|
|
334
|
+
promoCodeIsApplied={promoCodeIsApplied}
|
|
335
|
+
showPromoInput={showPromoInput}
|
|
336
|
+
setPromoCode={setPromoCode}
|
|
337
|
+
setPromoCodeUpdated={setPromoCodeUpdated}
|
|
338
|
+
setShowPromoInput={setShowPromoInput}
|
|
339
|
+
isPromotionsEnabled={isPromotionsEnabled}
|
|
340
|
+
isAllTicketsSoldOut={isAllTicketsSoldOut}
|
|
341
|
+
/>
|
|
342
|
+
{!isAllTicketsSoldOut && (
|
|
343
|
+
<Button
|
|
344
|
+
aria-hidden={true}
|
|
345
|
+
className={`book-button ${
|
|
346
|
+
handleBookIsLoading ||
|
|
347
|
+
_isEmpty(selectedTickets) ||
|
|
348
|
+
Object.values(selectedTickets)[0] === 0
|
|
349
|
+
? 'disabled'
|
|
350
|
+
: ''
|
|
351
|
+
}`}
|
|
352
|
+
onClick={
|
|
353
|
+
!handleBookIsLoading &&
|
|
354
|
+
!_isEmpty(selectedTickets) &&
|
|
355
|
+
Object.values(selectedTickets)[0] > 0
|
|
356
|
+
? handleBook
|
|
357
|
+
: () => {}
|
|
358
|
+
}
|
|
359
|
+
>
|
|
360
|
+
{getTicketsLabel || 'GET TICKETS'}
|
|
361
|
+
</Button>
|
|
362
|
+
)}
|
|
363
|
+
{isLogged ? (
|
|
364
|
+
<div className="session-wrapper">
|
|
365
|
+
<span className="session-container">
|
|
366
|
+
<Button
|
|
367
|
+
variant="outline-light"
|
|
368
|
+
className="session-buttons"
|
|
369
|
+
onClick={handleOrdersClick}
|
|
370
|
+
>
|
|
371
|
+
My Orders
|
|
372
|
+
</Button>
|
|
373
|
+
</span>
|
|
374
|
+
<span className="session-container">
|
|
375
|
+
<Button
|
|
376
|
+
variant="outline-light"
|
|
377
|
+
className="session-buttons"
|
|
378
|
+
onClick={handleLogout}
|
|
379
|
+
>
|
|
380
|
+
Log out
|
|
381
|
+
</Button>
|
|
382
|
+
</span>
|
|
383
|
+
</div>
|
|
384
|
+
) : (
|
|
385
|
+
''
|
|
386
|
+
)}
|
|
387
|
+
</div>
|
|
388
|
+
)}
|
|
389
|
+
{showLoginModal ? (
|
|
390
|
+
<LoginModal onClose={handleOnClose} onLogin={handleOnLogin} />
|
|
391
|
+
) : null}
|
|
392
|
+
</div>
|
|
393
|
+
</ThemeProvider>
|
|
385
394
|
)
|
|
386
395
|
}
|