tf-checkout-react 1.4.14 → 1.4.15
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/orderDetailsContainer/index.d.ts +1 -1
- package/dist/tf-checkout-react.cjs.development.js +32 -37
- 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 +32 -37
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/orderDetailsContainer/index.tsx +140 -172
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import './style.css'
|
|
2
2
|
|
|
3
|
-
import CircularProgress from '@mui/material/CircularProgress'
|
|
4
3
|
import Paper from '@mui/material/Paper'
|
|
5
4
|
import Table from '@mui/material/Table'
|
|
6
5
|
import TableBody from '@mui/material/TableBody'
|
|
@@ -14,7 +13,7 @@ import _has from 'lodash/has'
|
|
|
14
13
|
import _identity from 'lodash/identity'
|
|
15
14
|
import _map from 'lodash/map'
|
|
16
15
|
import moment from 'moment-timezone'
|
|
17
|
-
import React, {
|
|
16
|
+
import React, { useEffect, useState } from 'react'
|
|
18
17
|
|
|
19
18
|
import { getOrderDetails, removeFromResale, resaleTicket } from '../../api'
|
|
20
19
|
import { isBrowser } from '../../utils'
|
|
@@ -84,10 +83,9 @@ export const OrderDetailsContainer = ({
|
|
|
84
83
|
orderId: pOrderId,
|
|
85
84
|
referralTitle = '',
|
|
86
85
|
itemsTitle = '',
|
|
87
|
-
ticketsTitle = 'Your Tickets'
|
|
86
|
+
ticketsTitle = 'Your Tickets',
|
|
88
87
|
}: OrderDetailsTypes) => {
|
|
89
88
|
const [data, setData] = useState<any>({})
|
|
90
|
-
const [loading, setLoading] = useState(true)
|
|
91
89
|
const [removeFromResaleLoading, setRemoveFromResaleLoading] = useState(false)
|
|
92
90
|
const [resaleTicketLoading, setResaleTicketLoading] = useState(false)
|
|
93
91
|
const [showResaleModal, setShowResaleModal] = useState(false)
|
|
@@ -102,17 +100,18 @@ export const OrderDetailsContainer = ({
|
|
|
102
100
|
useEffect(() => {
|
|
103
101
|
(async () => {
|
|
104
102
|
try {
|
|
105
|
-
|
|
103
|
+
let orderId = pOrderId || ''
|
|
104
|
+
if (isBrowser && !pOrderId) {
|
|
105
|
+
const params: URLSearchParams = new URL(`${window.location}`).searchParams
|
|
106
|
+
orderId = params.get('o') || ''
|
|
107
|
+
}
|
|
106
108
|
const response = await getOrderDetails(String(orderId))
|
|
107
109
|
onGetOrdersSuccess(response)
|
|
108
110
|
|
|
109
111
|
const data = _get(response, 'data.data.attributes')
|
|
110
|
-
|
|
111
112
|
setData(data)
|
|
112
113
|
} catch (error) {
|
|
113
114
|
onGetOrdersError(error)
|
|
114
|
-
} finally {
|
|
115
|
-
setLoading(false)
|
|
116
115
|
}
|
|
117
116
|
})()
|
|
118
117
|
}, [])
|
|
@@ -142,14 +141,7 @@ export const OrderDetailsContainer = ({
|
|
|
142
141
|
|
|
143
142
|
try {
|
|
144
143
|
setResaleTicketLoading(true)
|
|
145
|
-
const {
|
|
146
|
-
to,
|
|
147
|
-
first_name,
|
|
148
|
-
last_name,
|
|
149
|
-
email,
|
|
150
|
-
confirm_email,
|
|
151
|
-
confirm,
|
|
152
|
-
} = values
|
|
144
|
+
const { to, first_name, last_name, email, confirm_email, confirm } = values
|
|
153
145
|
const formData = new FormData()
|
|
154
146
|
formData.append('to', to)
|
|
155
147
|
formData.append('first_name', first_name)
|
|
@@ -223,9 +215,7 @@ export const OrderDetailsContainer = ({
|
|
|
223
215
|
|
|
224
216
|
let orderSummery = `ID ${data.id}, placed`
|
|
225
217
|
if (data.date && data.timezone) {
|
|
226
|
-
const date = moment
|
|
227
|
-
.tz(data.date, data.timezone)
|
|
228
|
-
.format('dddd, DD MMMM YYYY')
|
|
218
|
+
const date = moment.tz(data.date, data.timezone).format('dddd, DD MMMM YYYY')
|
|
229
219
|
orderSummery += ` ${date}`
|
|
230
220
|
}
|
|
231
221
|
const isTable = _get(data, 'tickets[0].is_table', false)
|
|
@@ -241,166 +231,144 @@ export const OrderDetailsContainer = ({
|
|
|
241
231
|
|
|
242
232
|
return (
|
|
243
233
|
<div className="order-details">
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
234
|
+
<h1 className="layout-title">Order Details</h1>
|
|
235
|
+
<div className="order-summary-box">
|
|
236
|
+
<div className="summary-block">
|
|
237
|
+
<div className="summary-item">
|
|
238
|
+
<h6 className="sub-title">Order Summary</h6>
|
|
239
|
+
<p className="order-summary-date">{orderSummery}</p>
|
|
240
|
+
</div>
|
|
241
|
+
<div className="summary-item">
|
|
242
|
+
<div className="return-button-container">
|
|
243
|
+
<button
|
|
244
|
+
type="button"
|
|
245
|
+
className="return-button"
|
|
246
|
+
onClick={() => {
|
|
247
|
+
if (typeof window !== 'undefined') {
|
|
248
|
+
window.location.assign(ordersPath ?? '/orders')
|
|
249
|
+
}
|
|
250
|
+
}}
|
|
251
|
+
>
|
|
252
|
+
Back to Orders
|
|
253
|
+
</button>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
247
256
|
</div>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
<
|
|
257
|
+
{!data?.disable_referral && (
|
|
258
|
+
<>
|
|
259
|
+
{referralTitle && (
|
|
260
|
+
<h4 className="referral-title sub-title">{referralTitle}</h4>
|
|
261
|
+
)}
|
|
262
|
+
<div className="personal-link">
|
|
263
|
+
<div className="link-item">
|
|
264
|
+
<span>Personal Share Link: </span>
|
|
265
|
+
<a href={data?.personal_share_link} target="_blank" rel="noreferrer">
|
|
266
|
+
{Boolean(personalLinkIcon) && <img src={personalLinkIcon} alt="Icon" />}
|
|
267
|
+
{data?.personal_share_link}
|
|
268
|
+
</a>
|
|
256
269
|
</div>
|
|
257
|
-
|
|
258
|
-
<div className="
|
|
259
|
-
<
|
|
260
|
-
type="button"
|
|
261
|
-
className="return-button"
|
|
262
|
-
onClick={() => {
|
|
263
|
-
if (typeof window !== 'undefined') {
|
|
264
|
-
window.location.assign(ordersPath ?? '/orders')
|
|
265
|
-
}
|
|
266
|
-
}}
|
|
267
|
-
>
|
|
268
|
-
Back to Orders
|
|
269
|
-
</button>
|
|
270
|
+
{data?.sales_referred ? (
|
|
271
|
+
<div className="link-item">
|
|
272
|
+
<p className="total-referrer">{`So far, you’ve referred ${data.sales_referred} tickets`}</p>
|
|
270
273
|
</div>
|
|
271
|
-
|
|
274
|
+
) : null}
|
|
272
275
|
</div>
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
<div className="link-item">
|
|
296
|
-
<p className="total-referrer">{`So far, you’ve referred ${data.sales_referred} tickets`}</p>
|
|
297
|
-
</div>
|
|
298
|
-
) : null}
|
|
299
|
-
</div>
|
|
300
|
-
</>
|
|
301
|
-
)}
|
|
302
|
-
{itemsTitle && <h4 className="items-title sub-title">{itemsTitle}</h4>}
|
|
303
|
-
<TableContainer component={Paper}>
|
|
304
|
-
<Table className="tt-type" aria-label="collapsible table">
|
|
305
|
-
<TableHead>
|
|
306
|
-
<TableRow>
|
|
307
|
-
{_map(columnsProps, item => (
|
|
308
|
-
<TableCell>{item.label || ''}</TableCell>
|
|
309
|
-
))}
|
|
276
|
+
</>
|
|
277
|
+
)}
|
|
278
|
+
{itemsTitle && <h4 className="items-title sub-title">{itemsTitle}</h4>}
|
|
279
|
+
<TableContainer component={Paper}>
|
|
280
|
+
<Table className="tt-type" aria-label="collapsible table">
|
|
281
|
+
<TableHead>
|
|
282
|
+
<TableRow>
|
|
283
|
+
{_map(columnsProps, item => (
|
|
284
|
+
<TableCell>{item.label || ''}</TableCell>
|
|
285
|
+
))}
|
|
286
|
+
</TableRow>
|
|
287
|
+
</TableHead>
|
|
288
|
+
<TableBody>
|
|
289
|
+
{data?.items?.ticket_types?.map((ticket: TicketTypes, index: number) =>
|
|
290
|
+
data?.tickets && !data?.tickets[0].is_table ? (
|
|
291
|
+
<TableRow key={index}>
|
|
292
|
+
<TableCell>
|
|
293
|
+
<b>Ticket Type:</b> {ticket.name}
|
|
294
|
+
</TableCell>
|
|
295
|
+
<TableCell>{ticket.currency + ticket.price}</TableCell>
|
|
296
|
+
<TableCell>{ticket.quantity}</TableCell>
|
|
297
|
+
<TableCell>{ticket.currency + ticket.total}</TableCell>
|
|
310
298
|
</TableRow>
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
<TableCell>
|
|
321
|
-
{ticket.currency + ticket.price}
|
|
322
|
-
</TableCell>
|
|
323
|
-
<TableCell>{ticket.quantity}</TableCell>
|
|
324
|
-
<TableCell>
|
|
325
|
-
{ticket.currency + ticket.total}
|
|
326
|
-
</TableCell>
|
|
327
|
-
</TableRow>
|
|
328
|
-
) : (
|
|
329
|
-
<TableRow key={index}>
|
|
330
|
-
<TableCell>
|
|
331
|
-
<b>Ticket Type:</b> {ticket.name}
|
|
332
|
-
</TableCell>
|
|
333
|
-
<TableCell>
|
|
334
|
-
{ticket.currency + ticket.price}
|
|
335
|
-
</TableCell>
|
|
336
|
-
<TableCell>{ticket.guests_count}</TableCell>
|
|
337
|
-
<TableCell>{ticket.deposit_paid}</TableCell>
|
|
338
|
-
<TableCell>{ticket.remaining}</TableCell>
|
|
339
|
-
</TableRow>
|
|
340
|
-
)
|
|
341
|
-
)}
|
|
342
|
-
{data?.items?.add_ons?.map(
|
|
343
|
-
(ticket: TicketTypes, index: number) => (
|
|
344
|
-
<TableRow key={index}>
|
|
345
|
-
<TableCell>
|
|
346
|
-
<div>
|
|
347
|
-
<b>Add-On: </b>
|
|
348
|
-
<div>{ticket.groupName && `${ticket.groupName}: `} {ticket.name}</div>
|
|
349
|
-
</div>
|
|
350
|
-
</TableCell>
|
|
351
|
-
<TableCell>{ticket.currency + ticket.price}</TableCell>
|
|
352
|
-
<TableCell>{ticket.quantity}</TableCell>
|
|
353
|
-
<TableCell>{ticket.currency + ticket.total}</TableCell>
|
|
354
|
-
</TableRow>
|
|
355
|
-
)
|
|
356
|
-
)}
|
|
357
|
-
<TableRow className="total-row">
|
|
358
|
-
<TableCell />
|
|
359
|
-
<TableCell />
|
|
360
|
-
<TableCell>Total</TableCell>
|
|
361
|
-
<TableCell>{getTotal(data)}</TableCell>
|
|
299
|
+
) : (
|
|
300
|
+
<TableRow key={index}>
|
|
301
|
+
<TableCell>
|
|
302
|
+
<b>Ticket Type:</b> {ticket.name}
|
|
303
|
+
</TableCell>
|
|
304
|
+
<TableCell>{ticket.currency + ticket.price}</TableCell>
|
|
305
|
+
<TableCell>{ticket.guests_count}</TableCell>
|
|
306
|
+
<TableCell>{ticket.deposit_paid}</TableCell>
|
|
307
|
+
<TableCell>{ticket.remaining}</TableCell>
|
|
362
308
|
</TableRow>
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
309
|
+
)
|
|
310
|
+
)}
|
|
311
|
+
{data?.items?.add_ons?.map((ticket: TicketTypes, index: number) => (
|
|
312
|
+
<TableRow key={index}>
|
|
313
|
+
<TableCell>
|
|
314
|
+
<div>
|
|
315
|
+
<b>Add-On</b>
|
|
316
|
+
<div>
|
|
317
|
+
{ticket.groupName && `${ticket.groupName}: `} {ticket.name}
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
</TableCell>
|
|
321
|
+
<TableCell>{ticket.currency + ticket.price}</TableCell>
|
|
322
|
+
<TableCell>{ticket.quantity}</TableCell>
|
|
323
|
+
<TableCell>{ticket.currency + ticket.total}</TableCell>
|
|
324
|
+
</TableRow>
|
|
325
|
+
))}
|
|
326
|
+
<TableRow className="total-row">
|
|
327
|
+
<TableCell />
|
|
328
|
+
<TableCell />
|
|
329
|
+
<TableCell>Total</TableCell>
|
|
330
|
+
<TableCell>{getTotal(data)}</TableCell>
|
|
331
|
+
</TableRow>
|
|
332
|
+
</TableBody>
|
|
333
|
+
</Table>
|
|
334
|
+
</TableContainer>
|
|
335
|
+
</div>
|
|
336
|
+
<TicketsTable
|
|
337
|
+
ticketsTitle={ticketsTitle}
|
|
338
|
+
tickets={data.tickets}
|
|
339
|
+
columns={
|
|
340
|
+
ticketsTableColumns?.length
|
|
341
|
+
? ticketsTableColumns
|
|
342
|
+
: [
|
|
343
|
+
{ key: 'hash' as never, label: 'Ticket ID' },
|
|
344
|
+
{ key: 'ticket_type' as never, label: 'Ticket Type' },
|
|
345
|
+
{ key: 'holder_name' as never, label: 'Ticket Holder' },
|
|
346
|
+
{ key: 'status' as never, label: 'Status' },
|
|
347
|
+
{ key: 'download' as never, label: '' },
|
|
348
|
+
{ key: 'sell_ticket' as never, label: '' },
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
handleSellTicket={handleSellTicket}
|
|
352
|
+
handleRemoveFromResale={handleRemoveFromResale}
|
|
353
|
+
displayColumnNameInRow={displayColumnNameInRow}
|
|
354
|
+
canSellTicket={canSellTicket}
|
|
355
|
+
/>
|
|
356
|
+
<div className="return-button-container">
|
|
357
|
+
<button
|
|
358
|
+
type="button"
|
|
359
|
+
className="return-button"
|
|
360
|
+
onClick={() => {
|
|
361
|
+
if (onReturnButtonClick) {
|
|
362
|
+
onReturnButtonClick(data)
|
|
363
|
+
} else if (typeof window !== 'undefined') {
|
|
364
|
+
window.location.assign(ordersPath ?? '/orders')
|
|
381
365
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
<button
|
|
389
|
-
type="button"
|
|
390
|
-
className="return-button"
|
|
391
|
-
onClick={() => {
|
|
392
|
-
if (onReturnButtonClick) {
|
|
393
|
-
onReturnButtonClick(data)
|
|
394
|
-
} else if (typeof window !== 'undefined') {
|
|
395
|
-
window.location.assign(ordersPath ?? '/orders')
|
|
396
|
-
}
|
|
397
|
-
}}
|
|
398
|
-
>
|
|
399
|
-
Return to Order History
|
|
400
|
-
</button>
|
|
401
|
-
</div>
|
|
402
|
-
</>
|
|
403
|
-
)}
|
|
366
|
+
}}
|
|
367
|
+
>
|
|
368
|
+
Return to Order History
|
|
369
|
+
</button>
|
|
370
|
+
</div>
|
|
371
|
+
|
|
404
372
|
{showResaleModal && (
|
|
405
373
|
<TicketResaleModal
|
|
406
374
|
ticket={activeTicket}
|