tf-checkout-react 1.0.103 → 1.0.106
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 +3 -1
- package/dist/components/common/CustomField.d.ts +1 -1
- package/dist/components/common/DatePickerField.d.ts +14 -0
- package/dist/components/common/RedirectModal.d.ts +7 -0
- package/dist/components/countdown/index.d.ts +3 -1
- package/dist/components/orderDetailsContainer/ticketsTable.d.ts +2 -0
- package/dist/components/rsvpContainer/index.d.ts +7 -0
- package/dist/components/ticketResale/index.d.ts +5 -3
- package/dist/components/ticketsContainer/AccessCodeSection.d.ts +7 -0
- package/dist/components/ticketsContainer/PromoCodeSection.d.ts +5 -9
- package/dist/components/ticketsContainer/TicketsSection.d.ts +6 -3
- package/dist/components/ticketsContainer/index.d.ts +9 -2
- package/dist/components/timerWidget/index.d.ts +3 -3
- package/dist/images/cross.svg +44 -0
- package/dist/images/done.svg +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/tf-checkout-react.cjs.development.js +639 -223
- 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 +645 -231
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/package.json +89 -89
- package/src/.DS_Store +0 -0
- package/src/.d.ts +2 -2
- package/src/api/index.ts +300 -278
- package/src/assets/images/cross.svg +44 -0
- package/src/assets/images/done.svg +3 -3
- package/src/components/.DS_Store +0 -0
- package/src/components/billing-info-container/index.tsx +811 -799
- package/src/components/billing-info-container/style.css +105 -105
- package/src/components/billing-info-container/utils.ts +225 -224
- package/src/components/common/CheckboxField.tsx +41 -41
- package/src/components/common/CustomField.tsx +87 -84
- package/src/components/common/DatePickerField.tsx +98 -0
- package/src/components/common/FormikPhoneNumberField.tsx +51 -51
- package/src/components/common/Loader.tsx +9 -9
- package/src/components/common/RadioField.tsx +35 -35
- package/src/components/common/RedirectModal.tsx +43 -0
- package/src/components/common/SelectField.tsx +80 -80
- package/src/components/common/SnackbarAlert.tsx +53 -53
- package/src/components/common/index.tsx +4 -4
- package/src/components/confirmModal/index.tsx +51 -51
- package/src/components/confirmModal/style.css +21 -21
- package/src/components/confirmationContainer/config.ts +72 -72
- package/src/components/confirmationContainer/index.tsx +197 -197
- package/src/components/confirmationContainer/social-buttons.tsx +94 -94
- package/src/components/confirmationContainer/style.css +202 -202
- package/src/components/countdown/index.tsx +98 -89
- package/src/components/countdown/style.css +9 -9
- package/src/components/index.ts +7 -7
- package/src/components/loginModal/index.tsx +209 -209
- package/src/components/loginModal/style.css +71 -71
- package/src/components/myTicketsContainer/index.tsx +196 -196
- package/src/components/myTicketsContainer/row.tsx +41 -41
- package/src/components/myTicketsContainer/style.css +39 -39
- package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
- package/src/components/orderDetailsContainer/index.tsx +252 -249
- package/src/components/orderDetailsContainer/style.css +72 -72
- package/src/components/orderDetailsContainer/ticketsTable.tsx +130 -124
- package/src/components/paymentContainer/index.tsx +285 -284
- package/src/components/registerModal/index.tsx +190 -190
- package/src/components/rsvpContainer/index.tsx +126 -0
- package/src/components/stripePayment/index.tsx +254 -253
- package/src/components/stripePayment/style.css +59 -59
- package/src/components/ticketResale/index.tsx +74 -56
- package/src/components/ticketResaleModal/index.tsx +215 -210
- package/src/components/ticketResaleModal/style.css +28 -28
- package/src/components/ticketsContainer/AccessCodeSection.tsx +50 -0
- package/src/components/ticketsContainer/PromoCodeSection.tsx +88 -99
- package/src/components/ticketsContainer/ReferralLogic.tsx +31 -33
- package/src/components/ticketsContainer/TicketRow.tsx +83 -83
- package/src/components/ticketsContainer/TicketsSection.tsx +90 -81
- package/src/components/ticketsContainer/index.tsx +464 -430
- package/src/components/ticketsContainer/style.css +181 -181
- package/src/components/ticketsContainer/utils.ts +11 -11
- package/src/components/timerWidget/index.tsx +87 -70
- package/src/components/timerWidget/style.css +34 -26
- package/src/components/waitingList/index.tsx +178 -178
- package/src/components/waitingList/style.css +26 -26
- package/src/env.ts +20 -20
- package/src/index.ts +15 -13
- package/src/normalizers/index.ts +45 -45
- package/src/types/billing-info-data.ts +37 -37
- package/src/types/payment-field.ts +7 -7
- package/src/types/referral-promotion.ts +7 -7
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
- package/src/utils/downloadPDF.tsx +30 -30
- package/src/utils/formikErrorFocus.ts +24 -24
- package/src/utils/getImage.ts +14 -14
- package/src/utils/getQueryVariable.ts +13 -13
- package/src/utils/index.ts +5 -5
- package/src/utils/setConfigs.ts +26 -26
- package/src/utils/showZero.tsx +10 -10
- package/src/validators/index.ts +20 -20
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Button from 'react-bootstrap/Button'
|
|
3
|
+
|
|
4
|
+
export interface IAccessCodeSectionProps {
|
|
5
|
+
code: string;
|
|
6
|
+
setCode: (value: string) => void;
|
|
7
|
+
updateTickets: (value: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// This section is seperate because additional changes layter may be applied to Access Code
|
|
11
|
+
|
|
12
|
+
export const AccessCodeSection = ({
|
|
13
|
+
code,
|
|
14
|
+
setCode,
|
|
15
|
+
updateTickets
|
|
16
|
+
}: IAccessCodeSectionProps) => {
|
|
17
|
+
const isAccessCodeHasValue = !!code.trim()
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className="access-code-block">
|
|
21
|
+
<div className="access-code-block">
|
|
22
|
+
<p className="access-code-text">
|
|
23
|
+
Access code required
|
|
24
|
+
</p>
|
|
25
|
+
</div>
|
|
26
|
+
<input
|
|
27
|
+
className="access-code-input"
|
|
28
|
+
placeholder=""
|
|
29
|
+
onChange={e => {
|
|
30
|
+
setCode(e.target.value)
|
|
31
|
+
}}
|
|
32
|
+
onKeyPress={event => {
|
|
33
|
+
if (event.key === 'Enter' && isAccessCodeHasValue) {
|
|
34
|
+
updateTickets(true)
|
|
35
|
+
}
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
<Button
|
|
39
|
+
className="access-submit-button"
|
|
40
|
+
onClick={() => {
|
|
41
|
+
if (isAccessCodeHasValue) {
|
|
42
|
+
updateTickets(true)
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
ENTER
|
|
47
|
+
</Button>
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -1,99 +1,88 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import Button from 'react-bootstrap/Button'
|
|
3
|
-
import SVG from 'react-inlinesvg'
|
|
4
|
-
import { getImage } from '../../utils/getImage'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
setShowPromoInput(true)
|
|
90
|
-
}}
|
|
91
|
-
>
|
|
92
|
-
Got a promo code? Click here
|
|
93
|
-
</Button>
|
|
94
|
-
) : !isPromotionsEnabled && !showPromoInput && isAccessCodeEnabled && !promoCodeIsApplied ? renderInputField() :
|
|
95
|
-
null
|
|
96
|
-
}
|
|
97
|
-
</div>
|
|
98
|
-
)
|
|
99
|
-
}
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Button from 'react-bootstrap/Button'
|
|
3
|
+
import SVG from 'react-inlinesvg'
|
|
4
|
+
import { getImage } from '../../utils/getImage'
|
|
5
|
+
|
|
6
|
+
export interface IPromoCodeSectionProps {
|
|
7
|
+
code: string;
|
|
8
|
+
codeIsApplied: boolean;
|
|
9
|
+
showPromoInput: boolean;
|
|
10
|
+
setCode: (value: string) => void;
|
|
11
|
+
setShowPromoInput: (value: boolean) => void;
|
|
12
|
+
updateTickets: (value: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const PromoCodeSection = ({
|
|
16
|
+
code,
|
|
17
|
+
codeIsApplied,
|
|
18
|
+
showPromoInput,
|
|
19
|
+
setCode,
|
|
20
|
+
setShowPromoInput,
|
|
21
|
+
updateTickets
|
|
22
|
+
}: IPromoCodeSectionProps) => {
|
|
23
|
+
const isPromoCodeHasValue = !!code.trim()
|
|
24
|
+
|
|
25
|
+
const renderInputField = () => {
|
|
26
|
+
return (
|
|
27
|
+
<div className="promo-code-block">
|
|
28
|
+
<div className="promo-code-block">
|
|
29
|
+
<p className="promo-code-text">
|
|
30
|
+
Promo code
|
|
31
|
+
</p>
|
|
32
|
+
</div>
|
|
33
|
+
<input
|
|
34
|
+
className="promo-code-input"
|
|
35
|
+
placeholder=""
|
|
36
|
+
onChange={e => {
|
|
37
|
+
setCode(e.target.value)
|
|
38
|
+
}}
|
|
39
|
+
onKeyPress={event => {
|
|
40
|
+
if (event.key === 'Enter' && isPromoCodeHasValue) {
|
|
41
|
+
setShowPromoInput(false)
|
|
42
|
+
updateTickets(true)
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
46
|
+
<Button
|
|
47
|
+
className="promo-submit-button"
|
|
48
|
+
onClick={() => {
|
|
49
|
+
if (isPromoCodeHasValue) {
|
|
50
|
+
setShowPromoInput(false)
|
|
51
|
+
updateTickets(true)
|
|
52
|
+
}
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
APPLY
|
|
56
|
+
</Button>
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div>
|
|
63
|
+
{codeIsApplied ? (
|
|
64
|
+
<div className="alert-info">
|
|
65
|
+
<SVG
|
|
66
|
+
src={getImage('done.svg')}
|
|
67
|
+
preProcessor={code =>
|
|
68
|
+
code.replace(/fill=".*?"/g, 'fill="currentColor"')
|
|
69
|
+
}
|
|
70
|
+
/>
|
|
71
|
+
<p className="promo-code-success">PROMO CODE APPLIED SUCCESSFULLY</p>
|
|
72
|
+
</div>
|
|
73
|
+
) : null}
|
|
74
|
+
{!showPromoInput && (
|
|
75
|
+
<Button
|
|
76
|
+
className="promo-code-button"
|
|
77
|
+
placeholder="Promo Codes"
|
|
78
|
+
onClick={() => {
|
|
79
|
+
setShowPromoInput(true)
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
Got a promo code? Click here
|
|
83
|
+
</Button>
|
|
84
|
+
)}
|
|
85
|
+
{showPromoInput && renderInputField()}
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
import { useEffect } from 'react'
|
|
2
|
-
import { postReferralVisits } from '../../api'
|
|
3
|
-
|
|
4
|
-
interface IReferralLogicProps {
|
|
5
|
-
eventId: string | number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const ReferralLogic = (props: IReferralLogicProps) => {
|
|
9
|
-
const { eventId } = props
|
|
10
|
-
const isWindowDefined = typeof window !== 'undefined'
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (isWindowDefined) {
|
|
14
|
-
const params: URLSearchParams = new URL(`${window.location}`).searchParams
|
|
15
|
-
const referralId = params.get('ttf_r') || ''
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return null
|
|
33
|
-
}
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
|
+
import { postReferralVisits } from '../../api'
|
|
3
|
+
|
|
4
|
+
interface IReferralLogicProps {
|
|
5
|
+
eventId: string | number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const ReferralLogic = (props: IReferralLogicProps) => {
|
|
9
|
+
const { eventId } = props
|
|
10
|
+
const isWindowDefined = typeof window !== 'undefined'
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (isWindowDefined) {
|
|
14
|
+
const params: URLSearchParams = new URL(`${window.location}`).searchParams
|
|
15
|
+
const referralId = params.get('ttf_r') || ''
|
|
16
|
+
const referralValue = [eventId, '.', referralId].join('')
|
|
17
|
+
const isAlreadyCounted = localStorage.getItem('referral_key') === referralValue
|
|
18
|
+
|
|
19
|
+
if (referralId && eventId && !isAlreadyCounted) {
|
|
20
|
+
(async () => {
|
|
21
|
+
try {
|
|
22
|
+
await postReferralVisits(`${eventId}`, referralId)
|
|
23
|
+
localStorage.setItem('referral_key', referralValue)
|
|
24
|
+
} catch (error) {}
|
|
25
|
+
})()
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, [])
|
|
29
|
+
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import './style.css'
|
|
3
|
-
import _has from 'lodash/has'
|
|
4
|
-
import _get from 'lodash/get'
|
|
5
|
-
import Box from '@mui/material/Box'
|
|
6
|
-
import FormControl from '@mui/material/FormControl'
|
|
7
|
-
import MenuItem from '@mui/material/MenuItem'
|
|
8
|
-
import Select from '@mui/material/Select'
|
|
9
|
-
|
|
10
|
-
import { getTicketSelectOptions } from './utils'
|
|
11
|
-
|
|
12
|
-
interface ITicketRowProps {
|
|
13
|
-
ticketTier: any;
|
|
14
|
-
prevTicketTier: any;
|
|
15
|
-
selectedTickets: any;
|
|
16
|
-
handleTicketSelect: any;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const TicketRow = ({
|
|
20
|
-
ticketTier,
|
|
21
|
-
prevTicketTier,
|
|
22
|
-
selectedTickets,
|
|
23
|
-
handleTicketSelect,
|
|
24
|
-
}: ITicketRowProps) => {
|
|
25
|
-
const soldOutMessage = ticketTier.soldOutMessage
|
|
26
|
-
? `${ticketTier.soldOutMessage}`.toUpperCase()
|
|
27
|
-
: 'SOLD OUT'
|
|
28
|
-
const isSalesClosed = !ticketTier.salesStarted || ticketTier.salesEnded
|
|
29
|
-
const options = getTicketSelectOptions(
|
|
30
|
-
ticketTier.maxQuantity,
|
|
31
|
-
ticketTier.minQuantity,
|
|
32
|
-
ticketTier.multiplier
|
|
33
|
-
)
|
|
34
|
-
const ticketsClosedMessage = !ticketTier.salesStarted ? 'Sales not started' : 'Sales Ended'
|
|
35
|
-
|
|
36
|
-
const onSaleContent = isSalesClosed ? ticketsClosedMessage : (
|
|
37
|
-
<div className="get-tickets">
|
|
38
|
-
<Box className="get-tickets__selectbox">
|
|
39
|
-
<FormControl fullWidth>
|
|
40
|
-
<Select
|
|
41
|
-
sx={{
|
|
42
|
-
borderRadius: 0,
|
|
43
|
-
}}
|
|
44
|
-
value={
|
|
45
|
-
selectedTickets[ticketTier.id]
|
|
46
|
-
? selectedTickets[ticketTier.id]
|
|
47
|
-
: 0
|
|
48
|
-
}
|
|
49
|
-
onChange={handleTicketSelect}
|
|
50
|
-
displayEmpty
|
|
51
|
-
inputProps={{ 'aria-label': 'Without label' }}
|
|
52
|
-
MenuProps={{
|
|
53
|
-
PaperProps: {
|
|
54
|
-
sx: { maxHeight: 150 },
|
|
55
|
-
className: 'get-tickets-paper',
|
|
56
|
-
},
|
|
57
|
-
}}
|
|
58
|
-
>
|
|
59
|
-
{options.map((option, index) => (
|
|
60
|
-
<MenuItem key={index} value={option.value}>
|
|
61
|
-
{option.value}
|
|
62
|
-
</MenuItem>
|
|
63
|
-
))}
|
|
64
|
-
</Select>
|
|
65
|
-
</FormControl>
|
|
66
|
-
</Box>
|
|
67
|
-
</div>
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
let returnValue: any = ''
|
|
71
|
-
|
|
72
|
-
if (ticketTier.sold_out || !ticketTier.displayTicket || ticketTier.soldOut) {
|
|
73
|
-
returnValue = soldOutMessage
|
|
74
|
-
}
|
|
75
|
-
if (ticketTier.displayTicket) {
|
|
76
|
-
returnValue = onSaleContent
|
|
77
|
-
}
|
|
78
|
-
if (_get(prevTicketTier, 'in_stock')) {
|
|
79
|
-
returnValue = 'SOON'
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return <>{returnValue} </>
|
|
83
|
-
}
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './style.css'
|
|
3
|
+
import _has from 'lodash/has'
|
|
4
|
+
import _get from 'lodash/get'
|
|
5
|
+
import Box from '@mui/material/Box'
|
|
6
|
+
import FormControl from '@mui/material/FormControl'
|
|
7
|
+
import MenuItem from '@mui/material/MenuItem'
|
|
8
|
+
import Select from '@mui/material/Select'
|
|
9
|
+
|
|
10
|
+
import { getTicketSelectOptions } from './utils'
|
|
11
|
+
|
|
12
|
+
interface ITicketRowProps {
|
|
13
|
+
ticketTier: any;
|
|
14
|
+
prevTicketTier: any;
|
|
15
|
+
selectedTickets: any;
|
|
16
|
+
handleTicketSelect: any;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const TicketRow = ({
|
|
20
|
+
ticketTier,
|
|
21
|
+
prevTicketTier,
|
|
22
|
+
selectedTickets,
|
|
23
|
+
handleTicketSelect,
|
|
24
|
+
}: ITicketRowProps) => {
|
|
25
|
+
const soldOutMessage = ticketTier.soldOutMessage
|
|
26
|
+
? `${ticketTier.soldOutMessage}`.toUpperCase()
|
|
27
|
+
: 'SOLD OUT'
|
|
28
|
+
const isSalesClosed = !ticketTier.salesStarted || ticketTier.salesEnded
|
|
29
|
+
const options = getTicketSelectOptions(
|
|
30
|
+
ticketTier.maxQuantity,
|
|
31
|
+
ticketTier.minQuantity,
|
|
32
|
+
ticketTier.multiplier
|
|
33
|
+
)
|
|
34
|
+
const ticketsClosedMessage = !ticketTier.salesStarted ? 'Sales not started' : 'Sales Ended'
|
|
35
|
+
|
|
36
|
+
const onSaleContent = isSalesClosed ? ticketsClosedMessage : (
|
|
37
|
+
<div className="get-tickets">
|
|
38
|
+
<Box className="get-tickets__selectbox">
|
|
39
|
+
<FormControl fullWidth>
|
|
40
|
+
<Select
|
|
41
|
+
sx={{
|
|
42
|
+
borderRadius: 0,
|
|
43
|
+
}}
|
|
44
|
+
value={
|
|
45
|
+
selectedTickets[ticketTier.id]
|
|
46
|
+
? selectedTickets[ticketTier.id]
|
|
47
|
+
: 0
|
|
48
|
+
}
|
|
49
|
+
onChange={handleTicketSelect}
|
|
50
|
+
displayEmpty
|
|
51
|
+
inputProps={{ 'aria-label': 'Without label' }}
|
|
52
|
+
MenuProps={{
|
|
53
|
+
PaperProps: {
|
|
54
|
+
sx: { maxHeight: 150 },
|
|
55
|
+
className: 'get-tickets-paper',
|
|
56
|
+
},
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{options.map((option, index) => (
|
|
60
|
+
<MenuItem key={index} value={option.value}>
|
|
61
|
+
{option.value}
|
|
62
|
+
</MenuItem>
|
|
63
|
+
))}
|
|
64
|
+
</Select>
|
|
65
|
+
</FormControl>
|
|
66
|
+
</Box>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
let returnValue: any = ''
|
|
71
|
+
|
|
72
|
+
if (ticketTier.sold_out || !ticketTier.displayTicket || ticketTier.soldOut) {
|
|
73
|
+
returnValue = soldOutMessage
|
|
74
|
+
}
|
|
75
|
+
if (ticketTier.displayTicket) {
|
|
76
|
+
returnValue = onSaleContent
|
|
77
|
+
}
|
|
78
|
+
if (_get(prevTicketTier, 'in_stock')) {
|
|
79
|
+
returnValue = 'SOON'
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return <>{returnValue} </>
|
|
83
|
+
}
|
|
@@ -1,81 +1,90 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import './style.css'
|
|
3
|
-
|
|
4
|
-
import _sortBy from 'lodash/sortBy'
|
|
5
|
-
import { TicketRow } from './TicketRow'
|
|
6
|
-
|
|
7
|
-
interface ITicketsSectionProps {
|
|
8
|
-
ticketsList: any;
|
|
9
|
-
selectedTickets: any;
|
|
10
|
-
handleTicketSelect: any;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
1
|
+
import React, { ReactNode } from 'react'
|
|
2
|
+
import './style.css'
|
|
3
|
+
|
|
4
|
+
import _sortBy from 'lodash/sortBy'
|
|
5
|
+
import { TicketRow } from './TicketRow'
|
|
6
|
+
|
|
7
|
+
interface ITicketsSectionProps {
|
|
8
|
+
ticketsList: any;
|
|
9
|
+
selectedTickets: any;
|
|
10
|
+
handleTicketSelect: any;
|
|
11
|
+
codeIsApplied: boolean;
|
|
12
|
+
sortBySoldOut: boolean;
|
|
13
|
+
ticketsHeaderComponent?: ReactNode,
|
|
14
|
+
hideTicketsHeader: boolean,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const TicketsSection = ({
|
|
18
|
+
ticketsList,
|
|
19
|
+
selectedTickets,
|
|
20
|
+
handleTicketSelect,
|
|
21
|
+
codeIsApplied,
|
|
22
|
+
sortBySoldOut,
|
|
23
|
+
ticketsHeaderComponent,
|
|
24
|
+
hideTicketsHeader
|
|
25
|
+
}: ITicketsSectionProps) => {
|
|
26
|
+
const sortedTicketsList = sortBySoldOut
|
|
27
|
+
? _sortBy(_sortBy(ticketsList, 'sortOrder'), 'soldOut')
|
|
28
|
+
: _sortBy(ticketsList, 'sortOrder')
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
{!hideTicketsHeader && ticketsHeaderComponent}
|
|
32
|
+
{sortedTicketsList.map((ticket, i, arr) => {
|
|
33
|
+
const isSoldOut =
|
|
34
|
+
ticket.sold_out || !ticket.displayTicket || ticket.soldOut
|
|
35
|
+
const ticketSelect = (event: any) => {
|
|
36
|
+
const { value } = event.target
|
|
37
|
+
handleTicketSelect(ticket.id, value)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let ticketIsDiscounted = false
|
|
41
|
+
if (
|
|
42
|
+
ticket.oldPrice &&
|
|
43
|
+
codeIsApplied &&
|
|
44
|
+
!isSoldOut &&
|
|
45
|
+
ticket.oldPrice !== ticket.price
|
|
46
|
+
) {
|
|
47
|
+
ticketIsDiscounted = true
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const ticketIsFree = +ticket.price === 0
|
|
51
|
+
const ticketPrice = isSoldOut ? 'SOLD OUT' : ticketIsFree ? 'FREE' : `$ ${(+ticket.price).toFixed(2)}`
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
key={ticket.id || ticket.name}
|
|
56
|
+
className={`event-detail__tier ${isSoldOut ? 'disabled' : ''}`}
|
|
57
|
+
>
|
|
58
|
+
<div className="event-detail__tier-name">
|
|
59
|
+
{ticket.displayName || ticket.name}
|
|
60
|
+
</div>
|
|
61
|
+
<div className="event-tickets-container">
|
|
62
|
+
<div className="event-detail__tier-price">
|
|
63
|
+
{ticketIsDiscounted && (
|
|
64
|
+
<p className="old-price">$ {(+ticket.oldPrice).toFixed(2)}</p>
|
|
65
|
+
)}
|
|
66
|
+
<p>{ticketPrice}</p>
|
|
67
|
+
{!isSoldOut && !ticketIsFree && (
|
|
68
|
+
<p className="fees">
|
|
69
|
+
{ticket.feeIncluded ? '(incl. Fees)' : '(excl. Fees)'}
|
|
70
|
+
</p>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
<div
|
|
74
|
+
className="event-detail__tier-state"
|
|
75
|
+
style={{ minWidth: 55 }}
|
|
76
|
+
>
|
|
77
|
+
<TicketRow
|
|
78
|
+
ticketTier={ticket}
|
|
79
|
+
prevTicketTier={arr[i - 1]}
|
|
80
|
+
selectedTickets={selectedTickets}
|
|
81
|
+
handleTicketSelect={ticketSelect}
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
)
|
|
87
|
+
})}
|
|
88
|
+
</>
|
|
89
|
+
)
|
|
90
|
+
}
|