tf-checkout-react 1.0.96 → 1.0.98
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 -0
- package/dist/components/common/Loader.d.ts +2 -0
- package/dist/components/common/RadioField.d.ts +11 -0
- package/dist/components/common/index.d.ts +5 -0
- package/dist/components/confirmModal/index.d.ts +9 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/orderDetailsContainer/ticketsTable.d.ts +9 -2
- package/dist/components/ticketResale/index.d.ts +8 -0
- package/dist/components/ticketResaleModal/index.d.ts +18 -0
- package/dist/components/ticketsContainer/PromoCodeSection.d.ts +2 -1
- package/dist/images/email.svg +1 -0
- package/dist/images/user.svg +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +599 -137
- 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 +607 -146
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/package.json +3 -2
- package/src/.DS_Store +0 -0
- package/src/api/index.ts +21 -8
- package/src/assets/images/email.svg +1 -0
- package/src/assets/images/user.svg +1 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/billing-info-container/index.tsx +1 -4
- package/src/components/common/Loader.tsx +10 -0
- package/src/components/common/RadioField.tsx +35 -0
- package/src/components/common/index.tsx +5 -0
- package/src/components/confirmModal/index.tsx +51 -0
- package/src/components/confirmModal/style.css +21 -0
- package/src/components/index.ts +1 -0
- package/src/components/orderDetailsContainer/index.tsx +99 -4
- package/src/components/orderDetailsContainer/style.css +5 -4
- package/src/components/orderDetailsContainer/ticketsTable.tsx +36 -4
- package/src/components/paymentContainer/index.tsx +1 -7
- package/src/components/stripePayment/index.tsx +1 -1
- package/src/components/ticketResale/index.tsx +56 -0
- package/src/components/ticketResaleModal/index.tsx +210 -0
- package/src/components/ticketResaleModal/style.css +28 -0
- package/src/components/ticketsContainer/PromoCodeSection.tsx +4 -1
- package/src/components/ticketsContainer/index.tsx +8 -12
- package/src/components/waitingList/index.tsx +1 -1
- package/src/index.ts +1 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Field, Form, Formik } from 'formik'
|
|
3
|
+
import * as yup from 'yup';
|
|
4
|
+
import Modal from '@mui/material/Modal'
|
|
5
|
+
import Box from '@mui/material/Box'
|
|
6
|
+
import Button from '@mui/material/Button';
|
|
7
|
+
import { RadioField } from '../common/RadioField'
|
|
8
|
+
import { CheckboxField } from '../common/CheckboxField'
|
|
9
|
+
import { CustomField } from '../common/CustomField'
|
|
10
|
+
import SVG from 'react-inlinesvg'
|
|
11
|
+
import { getImage } from '../../utils/getImage'
|
|
12
|
+
import { ITicketTypes } from '../orderDetailsContainer/ticketsTable'
|
|
13
|
+
import './style.css'
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
ticket: ITicketTypes;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
onSubmit: (values: InitialValuesTypes) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface InitialValuesTypes {
|
|
22
|
+
to: string;
|
|
23
|
+
first_name: string;
|
|
24
|
+
last_name: string;
|
|
25
|
+
email: string;
|
|
26
|
+
confirm_email: string;
|
|
27
|
+
confirm: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const style: React.CSSProperties = {
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
top: '50%',
|
|
33
|
+
left: '50%',
|
|
34
|
+
transform: 'translate(-50%, -50%)',
|
|
35
|
+
minWidth: 480,
|
|
36
|
+
backgroundColor: '#e3e3e3',
|
|
37
|
+
border: '1px solid white',
|
|
38
|
+
outline: 'none',
|
|
39
|
+
padding: '14px',
|
|
40
|
+
maxHeight: '85vh',
|
|
41
|
+
overflow: 'auto'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const schema = yup.object().shape({
|
|
45
|
+
to: yup.string().required(),
|
|
46
|
+
first_name: yup.string().when('to', {
|
|
47
|
+
is: (to: string) => to === 'friend',
|
|
48
|
+
then: yup.string().required('First Name is required')
|
|
49
|
+
}),
|
|
50
|
+
last_name: yup.string().when('to', {
|
|
51
|
+
is: (to: string) => to === 'friend',
|
|
52
|
+
then: yup.string().required('Last Name is required')
|
|
53
|
+
}),
|
|
54
|
+
email: yup.string().when('to', {
|
|
55
|
+
is: (to: string) => to === 'friend',
|
|
56
|
+
then: yup.string().email('Invalid email').required('Email is required')
|
|
57
|
+
}),
|
|
58
|
+
confirm_email: yup.string().when('to', {
|
|
59
|
+
is: (to: string) => to === 'friend',
|
|
60
|
+
then: yup.string().email('Invalid email').oneOf([yup.ref('email'), null], 'Emails must match').required('Confirm Email is required')
|
|
61
|
+
}),
|
|
62
|
+
confirm: yup.boolean().oneOf([true])
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const initialValues: InitialValuesTypes = {
|
|
66
|
+
to: 'friend',
|
|
67
|
+
first_name: '',
|
|
68
|
+
last_name: '',
|
|
69
|
+
email: '',
|
|
70
|
+
confirm_email: '',
|
|
71
|
+
confirm: false
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const TicketResaleModal = ({
|
|
75
|
+
ticket = {} as ITicketTypes,
|
|
76
|
+
onClose = () => {},
|
|
77
|
+
onSubmit = () => {},
|
|
78
|
+
}: Props) => {
|
|
79
|
+
const { hash, holder_name, event_name, currency, resale_fee_amount } = ticket
|
|
80
|
+
return (
|
|
81
|
+
<Modal
|
|
82
|
+
open={true}
|
|
83
|
+
onClose={onClose}
|
|
84
|
+
aria-labelledby="modal-modal-title"
|
|
85
|
+
aria-describedby="modal-modal-description"
|
|
86
|
+
className='resale-modal'
|
|
87
|
+
>
|
|
88
|
+
<Box style={style}>
|
|
89
|
+
<h3>Sell Ticket</h3>
|
|
90
|
+
<div>
|
|
91
|
+
<h3>Ticket Details</h3>
|
|
92
|
+
<div>
|
|
93
|
+
<h4>Event</h4>
|
|
94
|
+
<p>{event_name}</p>
|
|
95
|
+
</div>
|
|
96
|
+
<div>
|
|
97
|
+
<h4>Ticket Holder</h4>
|
|
98
|
+
<p>{holder_name}</p>
|
|
99
|
+
</div>
|
|
100
|
+
<div>
|
|
101
|
+
<h4>Ticket ID</h4>
|
|
102
|
+
<p>{hash}</p>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
<div>
|
|
106
|
+
<h3>Sell to Whom</h3>
|
|
107
|
+
<Formik
|
|
108
|
+
initialValues={initialValues}
|
|
109
|
+
validationSchema={schema}
|
|
110
|
+
onSubmit={onSubmit}
|
|
111
|
+
>
|
|
112
|
+
{({ values, isValid, dirty }) => (
|
|
113
|
+
<Form>
|
|
114
|
+
<div>
|
|
115
|
+
<Field
|
|
116
|
+
name='to'
|
|
117
|
+
label='I want to sell the ticket to someone I know'
|
|
118
|
+
type='radio'
|
|
119
|
+
value='friend'
|
|
120
|
+
component={RadioField}
|
|
121
|
+
/>
|
|
122
|
+
{values.to === 'friend' && (
|
|
123
|
+
<div className='sell-to-friend'>
|
|
124
|
+
<div className='user-info-box'>
|
|
125
|
+
<div className='field-box'>
|
|
126
|
+
<div className='icon'>
|
|
127
|
+
<SVG
|
|
128
|
+
src={getImage('user.svg')}
|
|
129
|
+
width='24'
|
|
130
|
+
height='24'
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
<Field
|
|
134
|
+
name='first_name'
|
|
135
|
+
label='First Name'
|
|
136
|
+
type='text'
|
|
137
|
+
component={CustomField}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
<div className='field-box'>
|
|
141
|
+
<div className='empty-box' />
|
|
142
|
+
<Field
|
|
143
|
+
name='last_name'
|
|
144
|
+
label='Last Name'
|
|
145
|
+
type='text'
|
|
146
|
+
component={CustomField}
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
<div className='email-info-box'>
|
|
151
|
+
<div className='field-box'>
|
|
152
|
+
<div className='icon'>
|
|
153
|
+
<SVG
|
|
154
|
+
src={getImage('email.svg')}
|
|
155
|
+
width='24'
|
|
156
|
+
height='24'
|
|
157
|
+
/>
|
|
158
|
+
</div>
|
|
159
|
+
<Field
|
|
160
|
+
name='email'
|
|
161
|
+
label='Email address'
|
|
162
|
+
type='text'
|
|
163
|
+
component={CustomField}
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
<div className='field-box'>
|
|
167
|
+
<div className='empty-box' />
|
|
168
|
+
<Field
|
|
169
|
+
name='confirm_email'
|
|
170
|
+
label='Confirm Email address'
|
|
171
|
+
type='text'
|
|
172
|
+
component={CustomField}
|
|
173
|
+
/>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
)}
|
|
178
|
+
</div>
|
|
179
|
+
<div>
|
|
180
|
+
<Field
|
|
181
|
+
name='to'
|
|
182
|
+
label='I will sell my ticket to anyone who wants to buy it'
|
|
183
|
+
type='radio'
|
|
184
|
+
value='anyone'
|
|
185
|
+
component={RadioField}
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
<div>
|
|
189
|
+
<h4>Terms of Resale</h4>
|
|
190
|
+
<p>I confirm that I want to sell this ticket and that, if someone chooses to buy it, I will no longer own it or have the right to ask for it back.</p>
|
|
191
|
+
<p>I also understand that, if no one chooses to buy it, it remains my property, is valid for entry to <strong>{event_name}</strong> and I will not receive any refund.</p>
|
|
192
|
+
<p>If my ticket is sold, the original card I used to buy my ticket will be refunded with the original amount paid, minus a small handling fee of <strong>{currency + resale_fee_amount}</strong>, and that any existing refunds due to me for referring sales for this event are no longer valid.</p>
|
|
193
|
+
<Field
|
|
194
|
+
name='confirm'
|
|
195
|
+
label='I agree'
|
|
196
|
+
type='checkbox'
|
|
197
|
+
component={CheckboxField}
|
|
198
|
+
/>
|
|
199
|
+
</div>
|
|
200
|
+
<div className="resale-action-button">
|
|
201
|
+
<Button type="submit" disabled={!(isValid && dirty)}>Sell Ticket</Button>
|
|
202
|
+
</div>
|
|
203
|
+
</Form>
|
|
204
|
+
)}
|
|
205
|
+
</Formik>
|
|
206
|
+
</div>
|
|
207
|
+
</Box>
|
|
208
|
+
</Modal>
|
|
209
|
+
)
|
|
210
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.resale-modal .field-box {
|
|
2
|
+
margin-bottom: 10px;
|
|
3
|
+
display: flex;
|
|
4
|
+
}
|
|
5
|
+
.resale-modal .field-box .icon {
|
|
6
|
+
height: 56px;
|
|
7
|
+
min-width: 44px;
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
12
|
+
.resale-modal .field-box .empty-box {
|
|
13
|
+
min-width: 44px;
|
|
14
|
+
}
|
|
15
|
+
.resale-modal .resale-action-button button {
|
|
16
|
+
width: 100%;
|
|
17
|
+
color: white;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
background-color: #212529;
|
|
20
|
+
}
|
|
21
|
+
.resale-modal .resale-action-button button[disabled] {
|
|
22
|
+
opacity: .7;
|
|
23
|
+
}
|
|
24
|
+
.resale-modal .resale-action-button button:hover {
|
|
25
|
+
width: 100%;
|
|
26
|
+
background-color: #505050;
|
|
27
|
+
border-color: #505050;
|
|
28
|
+
}
|
|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import Button from 'react-bootstrap/Button'
|
|
3
3
|
import SVG from 'react-inlinesvg'
|
|
4
4
|
import { getImage } from '../../utils/getImage'
|
|
5
|
+
import { Loader } from '../common/index'
|
|
5
6
|
|
|
6
7
|
export interface IPromoCodeSectionProps {
|
|
7
8
|
promoCode: string;
|
|
@@ -10,6 +11,7 @@ export interface IPromoCodeSectionProps {
|
|
|
10
11
|
isPromotionsEnabled: boolean;
|
|
11
12
|
isAllTicketsSoldOut: boolean;
|
|
12
13
|
isAccessCodeEnabled?: boolean;
|
|
14
|
+
isPromoLoading?: boolean;
|
|
13
15
|
setPromoCode: (value: string) => void;
|
|
14
16
|
setPromoCodeUpdated: (value: string) => void;
|
|
15
17
|
setShowPromoInput: (value: boolean) => void;
|
|
@@ -24,6 +26,7 @@ export const PromoCodeSection = ({
|
|
|
24
26
|
setPromoCodeUpdated,
|
|
25
27
|
setShowPromoInput,
|
|
26
28
|
isAccessCodeEnabled,
|
|
29
|
+
isPromoLoading,
|
|
27
30
|
}: IPromoCodeSectionProps) => {
|
|
28
31
|
const isPromoCodeHasValue = !!promoCode.trim()
|
|
29
32
|
|
|
@@ -64,7 +67,7 @@ export const PromoCodeSection = ({
|
|
|
64
67
|
)
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
return (
|
|
70
|
+
return isPromoLoading ? <Loader /> : (
|
|
68
71
|
<div >
|
|
69
72
|
{promoCodeIsApplied ? (
|
|
70
73
|
<div className="alert-info">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import axios, { AxiosError } from 'axios'
|
|
3
|
+
import { Loader } from '../common/index'
|
|
3
4
|
import './style.css'
|
|
4
5
|
|
|
5
6
|
import {
|
|
@@ -14,7 +15,6 @@ import _some from 'lodash/some'
|
|
|
14
15
|
import _every from 'lodash/every'
|
|
15
16
|
import _find from 'lodash/find'
|
|
16
17
|
import _isEmpty from 'lodash/isEmpty'
|
|
17
|
-
import CircularProgress from '@mui/material/CircularProgress'
|
|
18
18
|
import Button from 'react-bootstrap/Button'
|
|
19
19
|
import jwt_decode from 'jwt-decode'
|
|
20
20
|
import { TicketsSection } from './TicketsSection'
|
|
@@ -28,14 +28,6 @@ import { createTheme, ThemeOptions } from '@mui/material'
|
|
|
28
28
|
import { CSSProperties } from '@mui/styles'
|
|
29
29
|
import { ReferralLogic } from './ReferralLogic'
|
|
30
30
|
|
|
31
|
-
function Loader() {
|
|
32
|
-
return (
|
|
33
|
-
<div className="loader-container">
|
|
34
|
-
<CircularProgress />
|
|
35
|
-
</div>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
31
|
interface CartSuccess {
|
|
40
32
|
skip_billing_page: boolean;
|
|
41
33
|
names_required: boolean;
|
|
@@ -101,6 +93,7 @@ export const TicketsContainer = ({
|
|
|
101
93
|
const [event, setEvent] = useState<any>(null)
|
|
102
94
|
const [showWaitingList, setShowWaitingList] = useState(false)
|
|
103
95
|
const [isLoading, setIsLoading] = useState(false)
|
|
96
|
+
const [isPromoLoading, setIsPromoLoading] = useState(false)
|
|
104
97
|
const [handleBookIsLoading, setHandleBookIsLoading] = useState(false)
|
|
105
98
|
const [promoCode, setPromoCode] = useState('')
|
|
106
99
|
const [promoCodeUpdated, setPromoCodeUpdated] = useState(getQueryVariable('r') || queryPromoCode)
|
|
@@ -121,7 +114,7 @@ export const TicketsContainer = ({
|
|
|
121
114
|
}, [])
|
|
122
115
|
|
|
123
116
|
useEffect(() => {
|
|
124
|
-
!!eventId && getTicketsApi()
|
|
117
|
+
!!eventId && getTicketsApi(!!promoCodeUpdated)
|
|
125
118
|
}, [eventId, promoCodeUpdated])
|
|
126
119
|
|
|
127
120
|
const handleLogout = () => {
|
|
@@ -148,9 +141,10 @@ export const TicketsContainer = ({
|
|
|
148
141
|
}
|
|
149
142
|
}
|
|
150
143
|
|
|
151
|
-
async function getTicketsApi() {
|
|
144
|
+
async function getTicketsApi(isUpdateingPromoCode?: boolean) {
|
|
152
145
|
try {
|
|
153
|
-
setIsLoading(true)
|
|
146
|
+
!isUpdateingPromoCode && setIsLoading(true)
|
|
147
|
+
setIsPromoLoading(true)
|
|
154
148
|
const response = await getTickets(eventId, promoCodeUpdated)
|
|
155
149
|
const eventResponse = await getEvent(eventId)
|
|
156
150
|
if (response.data.success) {
|
|
@@ -172,6 +166,7 @@ export const TicketsContainer = ({
|
|
|
172
166
|
}
|
|
173
167
|
} finally {
|
|
174
168
|
setIsLoading(false)
|
|
169
|
+
setIsPromoLoading(false)
|
|
175
170
|
}
|
|
176
171
|
}
|
|
177
172
|
|
|
@@ -352,6 +347,7 @@ export const TicketsContainer = ({
|
|
|
352
347
|
isPromotionsEnabled={isPromotionsEnabled}
|
|
353
348
|
isAccessCodeEnabled={isAccessCodeEnabled}
|
|
354
349
|
isAllTicketsSoldOut={isAllTicketsSoldOut}
|
|
350
|
+
isPromoLoading={isPromoLoading}
|
|
355
351
|
/>
|
|
356
352
|
{(isTicketOnSale || !event?.salesEnded) && (
|
|
357
353
|
<Button
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react'
|
|
|
2
2
|
import Button from '@mui/material/Button'
|
|
3
3
|
import CircularProgress from '@mui/material/CircularProgress'
|
|
4
4
|
import { Field, Form, Formik } from 'formik'
|
|
5
|
-
import { CustomField } from '../common/
|
|
5
|
+
import { CustomField } from '../common/index'
|
|
6
6
|
import { addToWaitingList } from '../../api'
|
|
7
7
|
import {
|
|
8
8
|
combineValidators,
|
package/src/index.ts
CHANGED
|
@@ -10,3 +10,4 @@ export { LoginModal } from './components/loginModal'
|
|
|
10
10
|
export { MyTicketsContainer } from './components/myTicketsContainer'
|
|
11
11
|
export { OrderDetailsContainer } from './components/orderDetailsContainer'
|
|
12
12
|
export { setConfigs } from './utils/setConfigs'
|
|
13
|
+
export { TicketResaleContainer } from './components'
|