tf-checkout-react 1.3.50 → 1.4.0
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 +6 -1
- package/dist/components/common/Loader.d.ts +1 -1
- package/dist/components/idVerificationContainer/constants.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/seatMapContainer/SeatMapComponent.d.ts +8 -0
- package/dist/components/seatMapContainer/TicketsSection.d.ts +9 -0
- package/dist/components/seatMapContainer/addToCart.d.ts +21 -0
- package/dist/components/seatMapContainer/index.d.ts +2 -0
- package/dist/components/seatMapContainer/utils.d.ts +14 -0
- package/dist/components/stripePayment/index.d.ts +2 -2
- package/dist/components/ticketsContainer/TicketRow.d.ts +3 -1
- package/dist/components/ticketsContainer/TicketsSection.d.ts +5 -1
- package/dist/components/ticketsContainer/index.d.ts +6 -2
- package/dist/index.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +1441 -130
- 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 +1442 -132
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/dist/types/order-data.d.ts +3 -0
- package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +9 -2
- package/package.json +12 -4
- package/src/.d.ts +4 -3
- package/src/api/index.ts +89 -6
- package/src/components/billing-info-container/index.tsx +115 -103
- package/src/components/billing-info-container/utils.ts +1 -2
- package/src/components/common/Loader.tsx +6 -8
- package/src/components/confirmationContainer/index.tsx +11 -9
- package/src/components/idVerificationContainer/constants.ts +2 -0
- package/src/components/idVerificationContainer/index.tsx +54 -13
- package/src/components/index.ts +2 -1
- package/src/components/orderDetailsContainer/index.tsx +54 -23
- package/src/components/paymentContainer/index.tsx +167 -33
- package/src/components/seatMapContainer/SeatMapComponent.tsx +73 -0
- package/src/components/seatMapContainer/TicketsSection.tsx +254 -0
- package/src/components/seatMapContainer/addToCart.ts +82 -0
- package/src/components/seatMapContainer/index.tsx +408 -0
- package/src/components/seatMapContainer/utils.ts +138 -0
- package/src/components/stripePayment/index.tsx +23 -18
- package/src/components/ticketsContainer/TicketRow.tsx +28 -13
- package/src/components/ticketsContainer/TicketsSection.tsx +85 -2
- package/src/components/ticketsContainer/index.tsx +57 -12
- package/src/components/ticketsContainer/style.css +0 -3
- package/src/hooks/usePixel.ts +35 -1
- package/src/index.ts +2 -1
- package/src/types/order-data.ts +3 -0
- package/src/types/seatMap.d.ts +154 -0
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +6 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import './style.css'
|
|
3
|
-
|
|
4
|
-
import _get from 'lodash/get'
|
|
2
|
+
|
|
5
3
|
import Box from '@mui/material/Box'
|
|
6
4
|
import FormControl from '@mui/material/FormControl'
|
|
7
5
|
import MenuItem from '@mui/material/MenuItem'
|
|
8
6
|
import Select from '@mui/material/Select'
|
|
7
|
+
import _get from 'lodash/get'
|
|
8
|
+
import React from 'react'
|
|
9
9
|
|
|
10
10
|
import { getTicketSelectOptions } from './utils'
|
|
11
11
|
|
|
@@ -14,6 +14,8 @@ interface ITicketRowProps {
|
|
|
14
14
|
prevTicketTier: any;
|
|
15
15
|
selectedTickets: any;
|
|
16
16
|
handleTicketSelect: any;
|
|
17
|
+
isSeatMapAllowed?: any;
|
|
18
|
+
tableType?: boolean;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export const TicketRow = ({
|
|
@@ -21,26 +23,31 @@ export const TicketRow = ({
|
|
|
21
23
|
prevTicketTier,
|
|
22
24
|
selectedTickets,
|
|
23
25
|
handleTicketSelect,
|
|
26
|
+
isSeatMapAllowed,
|
|
27
|
+
tableType,
|
|
24
28
|
}: ITicketRowProps) => {
|
|
25
29
|
const soldOutMessage = ticketTier.soldOutMessage
|
|
26
30
|
? `${ticketTier.soldOutMessage}`.toUpperCase()
|
|
27
31
|
: 'SOLD OUT'
|
|
28
32
|
const isSalesClosed = !ticketTier.salesStarted || ticketTier.salesEnded
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const ticketsClosedMessage = !ticketTier.salesStarted
|
|
33
|
+
const maxCount = tableType ? ticketTier.maxGuests : ticketTier.maxQuantity
|
|
34
|
+
const minCount = tableType ? ticketTier.minGuests : ticketTier.minQuantity
|
|
35
|
+
const { multiplier } = ticketTier
|
|
36
|
+
const options = getTicketSelectOptions(maxCount, minCount, multiplier)
|
|
37
|
+
|
|
38
|
+
const ticketsClosedMessage = !ticketTier.salesStarted
|
|
39
|
+
? 'Sales not started'
|
|
40
|
+
: 'Sales Ended'
|
|
41
|
+
const canPurchaseTicket = ticketTier.displayTicket && ticketTier.maxQuantity
|
|
42
|
+
const isDirectPurchaseAllowed = _get(ticketTier, 'allowDirectPurchase', false)
|
|
35
43
|
|
|
36
44
|
const onSaleContent = (
|
|
37
45
|
<div className="get-tickets">
|
|
46
|
+
{ticketTier.isTable && <span>GUESTS</span>}
|
|
38
47
|
<Box className="get-tickets__selectbox">
|
|
39
48
|
<FormControl fullWidth>
|
|
40
49
|
<Select
|
|
41
|
-
sx={{
|
|
42
|
-
borderRadius: 0,
|
|
43
|
-
}}
|
|
50
|
+
sx={{ borderRadius: 0 }}
|
|
44
51
|
value={
|
|
45
52
|
selectedTickets[ticketTier.id]
|
|
46
53
|
? selectedTickets[ticketTier.id]
|
|
@@ -68,6 +75,7 @@ export const TicketRow = ({
|
|
|
68
75
|
)
|
|
69
76
|
|
|
70
77
|
let returnValue: any = ''
|
|
78
|
+
|
|
71
79
|
// ticketTier.soldOut === false --> means that ticket is in the stock
|
|
72
80
|
const isSoldOut =
|
|
73
81
|
ticketTier.sold_out ||
|
|
@@ -79,7 +87,14 @@ export const TicketRow = ({
|
|
|
79
87
|
returnValue = soldOutMessage
|
|
80
88
|
} else if (isSalesClosed) {
|
|
81
89
|
returnValue = ticketsClosedMessage
|
|
82
|
-
} else if (
|
|
90
|
+
} else if (
|
|
91
|
+
canPurchaseTicket &&
|
|
92
|
+
isSeatMapAllowed &&
|
|
93
|
+
!isDirectPurchaseAllowed
|
|
94
|
+
) {
|
|
95
|
+
// Seat Map Tickets renderer logic
|
|
96
|
+
returnValue = null
|
|
97
|
+
} else if (canPurchaseTicket) {
|
|
83
98
|
returnValue = onSaleContent
|
|
84
99
|
} else if (_get(prevTicketTier, 'in_stock')) {
|
|
85
100
|
returnValue = 'SOON'
|
|
@@ -12,10 +12,13 @@ interface ITicketsSectionProps {
|
|
|
12
12
|
handleTicketSelect: any;
|
|
13
13
|
sortBySoldOut: boolean;
|
|
14
14
|
hideTicketsHeader: boolean;
|
|
15
|
-
|
|
15
|
+
hideTableTicketsHeader: boolean;
|
|
16
|
+
tableTickets: any;
|
|
16
17
|
ticketsHeaderComponent?: ReactNode;
|
|
18
|
+
tableTicketsHeaderComponent?: ReactNode;
|
|
17
19
|
showGroupNameBlock?: boolean;
|
|
18
20
|
currencySybmol?: string;
|
|
21
|
+
isSeatMapAllowed?: boolean;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export const TicketsSection = ({
|
|
@@ -25,9 +28,13 @@ export const TicketsSection = ({
|
|
|
25
28
|
handleTicketSelect,
|
|
26
29
|
sortBySoldOut,
|
|
27
30
|
ticketsHeaderComponent,
|
|
31
|
+
tableTicketsHeaderComponent,
|
|
28
32
|
hideTicketsHeader,
|
|
33
|
+
hideTableTicketsHeader,
|
|
29
34
|
showGroupNameBlock,
|
|
30
35
|
currencySybmol,
|
|
36
|
+
isSeatMapAllowed,
|
|
37
|
+
tableTickets,
|
|
31
38
|
}: ITicketsSectionProps) => {
|
|
32
39
|
const {
|
|
33
40
|
currency: { symbol },
|
|
@@ -37,7 +44,6 @@ export const TicketsSection = ({
|
|
|
37
44
|
: _sortBy(ticketsList, 'sortOrder')
|
|
38
45
|
const showGroup = !!sortedTicketsList.find(ticket => ticket.groupName)
|
|
39
46
|
const priceSymbol = currencySybmol ? currencySybmol : symbol
|
|
40
|
-
|
|
41
47
|
return (
|
|
42
48
|
<>
|
|
43
49
|
{!hideTicketsHeader && ticketsHeaderComponent}
|
|
@@ -108,6 +114,83 @@ export const TicketsSection = ({
|
|
|
108
114
|
</React.Fragment>
|
|
109
115
|
)
|
|
110
116
|
})}
|
|
117
|
+
{!hideTableTicketsHeader && tableTicketsHeaderComponent}
|
|
118
|
+
{tableTickets.map((ticket: any, i: any, arr: any) => {
|
|
119
|
+
const ticketPrice = `${priceSymbol} ${(+ticket.price).toFixed(2)}`
|
|
120
|
+
const ticketOldPrice = `${priceSymbol} ${(+ticket.oldPrice).toFixed(2)}`
|
|
121
|
+
|
|
122
|
+
const isSoldOut =
|
|
123
|
+
ticket.sold_out || !ticket.displayTicket || ticket.soldOut
|
|
124
|
+
const ticketSelect = (event: any) => {
|
|
125
|
+
const { value } = event.target
|
|
126
|
+
handleTicketSelect(ticket.id, value, true)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
let ticketIsDiscounted = false
|
|
130
|
+
if (ticket.oldPrice && !isSoldOut && ticket.oldPrice !== ticket.price) {
|
|
131
|
+
ticketIsDiscounted = true
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const ticketIsFree = +ticket.price === 0
|
|
135
|
+
const ticketPriceElem = isSoldOut
|
|
136
|
+
? 'SOLD OUT'
|
|
137
|
+
: ticketIsFree
|
|
138
|
+
? 'FREE'
|
|
139
|
+
: ticketPrice
|
|
140
|
+
const isNewGroupTicket = ticket?.groupName !== arr[i - 1]?.groupName
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<>
|
|
144
|
+
<React.Fragment key={ticket.id || ticket.name}>
|
|
145
|
+
{showGroupNameBlock && showGroup && isNewGroupTicket ? (
|
|
146
|
+
<div className="event-detail__tier group-title">
|
|
147
|
+
{ticket.groupName || ''}
|
|
148
|
+
</div>
|
|
149
|
+
) : null}
|
|
150
|
+
<div
|
|
151
|
+
className={`event-detail__tier ${isSoldOut ? 'disabled' : ''}`}
|
|
152
|
+
>
|
|
153
|
+
<div className="event-detail__tier-name">
|
|
154
|
+
{ticket.displayName || ticket.name}
|
|
155
|
+
</div>
|
|
156
|
+
<div className="event-tickets-container">
|
|
157
|
+
<div className="event-detail__tier-price">
|
|
158
|
+
{ticketIsDiscounted && (
|
|
159
|
+
<p className="old-price">{ticketOldPrice}</p>
|
|
160
|
+
)}
|
|
161
|
+
<p className={isSoldOut ? 'sold-out' : ''}>
|
|
162
|
+
{ticketPriceElem}
|
|
163
|
+
</p>
|
|
164
|
+
{!isSoldOut && !ticketIsFree && (
|
|
165
|
+
<p className="fees">
|
|
166
|
+
{ticket.feeIncluded ? '(incl. Fees)' : '(excl. Fees)'}
|
|
167
|
+
</p>
|
|
168
|
+
)}
|
|
169
|
+
{ticket.depositPercent && (
|
|
170
|
+
<p className="deposits">
|
|
171
|
+
{ticket.depositPercent + '% DEPOSIT'}
|
|
172
|
+
</p>
|
|
173
|
+
)}
|
|
174
|
+
</div>
|
|
175
|
+
<div
|
|
176
|
+
className="event-detail__tier-state"
|
|
177
|
+
style={{ minWidth: 55 }}
|
|
178
|
+
>
|
|
179
|
+
<TicketRow
|
|
180
|
+
tableType={true}
|
|
181
|
+
ticketTier={ticket}
|
|
182
|
+
prevTicketTier={arr[i - 1]}
|
|
183
|
+
selectedTickets={selectedTickets}
|
|
184
|
+
handleTicketSelect={ticketSelect}
|
|
185
|
+
isSeatMapAllowed={isSeatMapAllowed}
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</React.Fragment>
|
|
191
|
+
</>
|
|
192
|
+
)
|
|
193
|
+
})}
|
|
111
194
|
</>
|
|
112
195
|
)
|
|
113
196
|
}
|
|
@@ -6,7 +6,9 @@ import { ThemeProvider } from '@mui/private-theming'
|
|
|
6
6
|
import { CSSProperties } from '@mui/styles'
|
|
7
7
|
import axios, { AxiosError } from 'axios'
|
|
8
8
|
import jwt_decode from 'jwt-decode'
|
|
9
|
+
import _filter from 'lodash/filter'
|
|
9
10
|
import _find from 'lodash/find'
|
|
11
|
+
import _forEach from 'lodash/forEach'
|
|
10
12
|
import _get from 'lodash/get'
|
|
11
13
|
import _identity from 'lodash/identity'
|
|
12
14
|
import _includes from 'lodash/includes'
|
|
@@ -95,6 +97,8 @@ export interface IGetTickets {
|
|
|
95
97
|
actionsSectionComponent?: any;
|
|
96
98
|
ticketsHeaderComponent?: ReactNode;
|
|
97
99
|
hideTicketsHeader?: boolean;
|
|
100
|
+
tableTicketsHeaderComponent?: ReactNode;
|
|
101
|
+
hideTableTicketsHeader?: boolean;
|
|
98
102
|
enableInfluencersSection?: boolean;
|
|
99
103
|
enableAddOns?: boolean;
|
|
100
104
|
ordersPath?: string;
|
|
@@ -102,6 +106,7 @@ export interface IGetTickets {
|
|
|
102
106
|
promoText?: string;
|
|
103
107
|
showGroupNameBlock?: boolean;
|
|
104
108
|
currencySybmol?: string;
|
|
109
|
+
onReserveButtonClick?: () => void;
|
|
105
110
|
onPendingVerification?: () => void;
|
|
106
111
|
}
|
|
107
112
|
|
|
@@ -114,7 +119,8 @@ interface IInfluencer {
|
|
|
114
119
|
[key: string]: string | undefined;
|
|
115
120
|
}
|
|
116
121
|
export interface ISelectedTickets {
|
|
117
|
-
|
|
122
|
+
isTable: boolean;
|
|
123
|
+
[key: string]: string | number | boolean;
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
export const TicketsContainer = ({
|
|
@@ -145,6 +151,8 @@ export const TicketsContainer = ({
|
|
|
145
151
|
actionsSectionComponent: ActionsSectionComponent,
|
|
146
152
|
ticketsHeaderComponent,
|
|
147
153
|
hideTicketsHeader = false,
|
|
154
|
+
tableTicketsHeaderComponent,
|
|
155
|
+
hideTableTicketsHeader = false,
|
|
148
156
|
enableInfluencersSection = true,
|
|
149
157
|
enableAddOns = true,
|
|
150
158
|
handleNotInvitedModalClose = _identity,
|
|
@@ -154,6 +162,7 @@ export const TicketsContainer = ({
|
|
|
154
162
|
promoText,
|
|
155
163
|
showGroupNameBlock = false,
|
|
156
164
|
currencySybmol = '',
|
|
165
|
+
onReserveButtonClick = _identity,
|
|
157
166
|
onPendingVerification = _identity,
|
|
158
167
|
}: IGetTickets) => {
|
|
159
168
|
const [selectedTickets, setSelectedTickets] = useState({} as ISelectedTickets)
|
|
@@ -290,13 +299,18 @@ export const TicketsContainer = ({
|
|
|
290
299
|
}
|
|
291
300
|
}
|
|
292
301
|
|
|
293
|
-
const handleTicketSelect = (
|
|
302
|
+
const handleTicketSelect = (
|
|
303
|
+
key: string,
|
|
304
|
+
value: number | string,
|
|
305
|
+
isTable = false
|
|
306
|
+
) => {
|
|
294
307
|
setSelectedTickets(prevState => {
|
|
295
308
|
if (Object.keys(prevState)[0] !== key && !value) {
|
|
296
309
|
return prevState
|
|
297
310
|
}
|
|
298
311
|
return {
|
|
299
312
|
[key]: value,
|
|
313
|
+
isTable,
|
|
300
314
|
}
|
|
301
315
|
})
|
|
302
316
|
}
|
|
@@ -317,12 +331,14 @@ export const TicketsContainer = ({
|
|
|
317
331
|
_find(tickets, item => selectedTickets[item.id] > 0) || ({} as ITicket)
|
|
318
332
|
const optionName = _get(ticket, 'optionName')
|
|
319
333
|
const ticketId = _get(ticket, 'id')
|
|
320
|
-
const
|
|
334
|
+
const isTableType = _get(ticket, 'isTable', false)
|
|
335
|
+
const productCartQuantity = +selectedTickets[ticket.id]
|
|
336
|
+
const ticketQuantity = isTableType ? 1 : +selectedTickets[ticket.id]
|
|
321
337
|
|
|
322
338
|
const data = {
|
|
323
339
|
attributes: {
|
|
324
340
|
alternative_view_id: null,
|
|
325
|
-
product_cart_quantity:
|
|
341
|
+
product_cart_quantity: productCartQuantity,
|
|
326
342
|
product_options: {
|
|
327
343
|
[optionName]: ticketId,
|
|
328
344
|
},
|
|
@@ -496,9 +512,10 @@ export const TicketsContainer = ({
|
|
|
496
512
|
}
|
|
497
513
|
|
|
498
514
|
const bookButtonIsDisabled =
|
|
499
|
-
handleBookIsLoading ||
|
|
500
|
-
|
|
501
|
-
|
|
515
|
+
(handleBookIsLoading ||
|
|
516
|
+
_isEmpty(selectedTickets) ||
|
|
517
|
+
Object.values(selectedTickets)[0] === 0) &&
|
|
518
|
+
!event?.flagSeatMapAllowed
|
|
502
519
|
|
|
503
520
|
const isTicketAvailable = _some(
|
|
504
521
|
tickets,
|
|
@@ -543,8 +560,17 @@ export const TicketsContainer = ({
|
|
|
543
560
|
setIsNotInvitedError('')
|
|
544
561
|
setIsInvalidLinkError('')
|
|
545
562
|
}
|
|
546
|
-
|
|
547
563
|
const hideTopInfluencers = event?.hideTopInfluencers
|
|
564
|
+
const isSeatMapAllowed = _get(event, 'seatMapAllowed', false)
|
|
565
|
+
const isTableMapEnabled = _get(event, 'tableMapEnabled', false)
|
|
566
|
+
|
|
567
|
+
const tableTickets = _filter(tickets, (ticket: any) => ticket.isTable)
|
|
568
|
+
const ordinarTickets = {} as ITicket
|
|
569
|
+
_forEach(tickets, (ticket: any, key: string) => {
|
|
570
|
+
if (!ticket.isTable) {
|
|
571
|
+
ordinarTickets[key] = ticket
|
|
572
|
+
}
|
|
573
|
+
})
|
|
548
574
|
|
|
549
575
|
return (
|
|
550
576
|
<ThemeProvider theme={themeMui}>
|
|
@@ -584,14 +610,22 @@ export const TicketsContainer = ({
|
|
|
584
610
|
{!isSalesClosed && (
|
|
585
611
|
<TicketsSection
|
|
586
612
|
event={event}
|
|
587
|
-
ticketsList={
|
|
613
|
+
ticketsList={ordinarTickets}
|
|
614
|
+
tableTickets={tableTickets}
|
|
588
615
|
selectedTickets={selectedTickets}
|
|
589
616
|
handleTicketSelect={handleTicketSelect}
|
|
590
617
|
sortBySoldOut={sortBySoldOut}
|
|
591
618
|
ticketsHeaderComponent={ticketsHeaderComponent}
|
|
592
|
-
|
|
619
|
+
tableTicketsHeaderComponent={tableTicketsHeaderComponent}
|
|
620
|
+
hideTableTicketsHeader={
|
|
621
|
+
hideTableTicketsHeader || _isEmpty(tableTickets)
|
|
622
|
+
}
|
|
623
|
+
hideTicketsHeader={
|
|
624
|
+
hideTicketsHeader || _isEmpty(ordinarTickets)
|
|
625
|
+
}
|
|
593
626
|
showGroupNameBlock={showGroupNameBlock}
|
|
594
627
|
currencySybmol={currencySybmol}
|
|
628
|
+
isSeatMapAllowed={isSeatMapAllowed}
|
|
595
629
|
/>
|
|
596
630
|
)}
|
|
597
631
|
{externalUrl ? null : isSalesClosed ? (
|
|
@@ -616,7 +650,7 @@ export const TicketsContainer = ({
|
|
|
616
650
|
) : null}
|
|
617
651
|
{showWaitingList && event.salesStarted && !hideWaitingList && (
|
|
618
652
|
<WaitingList
|
|
619
|
-
tickets={
|
|
653
|
+
tickets={ordinarTickets}
|
|
620
654
|
eventId={eventId}
|
|
621
655
|
defaultMaxQuantity={event.waitingListMaxQuantity}
|
|
622
656
|
/>
|
|
@@ -654,7 +688,18 @@ export const TicketsContainer = ({
|
|
|
654
688
|
`}
|
|
655
689
|
onClick={handleGetTicketClick}
|
|
656
690
|
>
|
|
657
|
-
{
|
|
691
|
+
{selectedTickets.isTable
|
|
692
|
+
? 'RESERVE TABLES'
|
|
693
|
+
: getTicketsLabel || 'GET TICKETS'}
|
|
694
|
+
</Button>
|
|
695
|
+
)}
|
|
696
|
+
{isSeatMapAllowed && !event?.salesEnded && isTicketAvailable && (
|
|
697
|
+
<Button
|
|
698
|
+
className="reserve-button"
|
|
699
|
+
aria-hidden={true}
|
|
700
|
+
onClick={onReserveButtonClick}
|
|
701
|
+
>
|
|
702
|
+
{isTableMapEnabled ? 'Select on map' : 'Select your seats'}
|
|
658
703
|
</Button>
|
|
659
704
|
)}
|
|
660
705
|
{isLogged && !hideSessionButtons ? (
|
package/src/hooks/usePixel.ts
CHANGED
|
@@ -32,6 +32,33 @@ function appendScriptsToHeader(code: string) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
const addGTagToHeader = (tagId?: string, links?: string[]) => {
|
|
36
|
+
if (document?.head && document?.body && tagId) {
|
|
37
|
+
const script = document.createElement('script')
|
|
38
|
+
script.innerHTML = `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
39
|
+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
|
40
|
+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|
41
|
+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
|
42
|
+
})(window,document,'script','dataLayer','${tagId}');`.trim()
|
|
43
|
+
document.head.append(script)
|
|
44
|
+
|
|
45
|
+
const scriptBody = document.createElement('noscript')
|
|
46
|
+
scriptBody.innerHTML = `<iframe src="https://www.googletagmanager.com/ns.html?id=${tagId}"
|
|
47
|
+
height="0" width="0" style="display:none;visibility:hidden"></iframe>`
|
|
48
|
+
document.body.append(scriptBody);
|
|
49
|
+
|
|
50
|
+
(window as any).dataLayer = (window as any).dataLayer || [];
|
|
51
|
+
(window as any).gtag = function gtag(...args: any){(window as any).dataLayer.push(args)}
|
|
52
|
+
if (links) {
|
|
53
|
+
(window as any)?.gtag('set', 'linker', {
|
|
54
|
+
'domains': links
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
(window as any).gtag('js', new Date());
|
|
58
|
+
(window as any).gtag('config', tagId)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
35
62
|
export const usePixel = async (
|
|
36
63
|
eventId: string | number,
|
|
37
64
|
options: pageOptions
|
|
@@ -43,6 +70,13 @@ export const usePixel = async (
|
|
|
43
70
|
const response = await getPixelScript(eventId, options)
|
|
44
71
|
const pixels = _get(response, 'data.data.attributes.pixels', '')
|
|
45
72
|
appendScriptsToHeader(pixels)
|
|
73
|
+
const brandGoogleTagKey = _get(response, 'data.data.attributes.brandGoogleTagKey', '')
|
|
74
|
+
const eventGoogleTagKey = _get(response, 'data.data.attributes.eventGoogleTagKey', '')
|
|
75
|
+
const eventGoogleTagManagerLinkerDomains = _get(response, 'data.data.attributes.eventGoogleTagManagerLinkerDomains', '')
|
|
76
|
+
addGTagToHeader(brandGoogleTagKey, eventGoogleTagManagerLinkerDomains)
|
|
77
|
+
if (eventGoogleTagKey) {
|
|
78
|
+
addGTagToHeader(eventGoogleTagKey, eventGoogleTagManagerLinkerDomains)
|
|
79
|
+
}
|
|
46
80
|
} catch (e) {
|
|
47
81
|
console.error(e)
|
|
48
82
|
}
|
|
@@ -51,4 +85,4 @@ export const usePixel = async (
|
|
|
51
85
|
useEffect(() => {
|
|
52
86
|
getScript()
|
|
53
87
|
}, [eventId])
|
|
54
|
-
}
|
|
88
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -17,5 +17,6 @@ export { ResetPasswordContainer } from './components/resetPasswordContainer'
|
|
|
17
17
|
export { ForgotPasswordModal } from './components/forgotPasswordModal'
|
|
18
18
|
export { AddonsContainter } from './components/addonsContainer'
|
|
19
19
|
export { PoweredBy } from './components/common/PoweredBy'
|
|
20
|
+
export { SeatMapContainer } from './components/seatMapContainer'
|
|
20
21
|
export { IDVerification } from './components/idVerificationContainer'
|
|
21
|
-
export { VERIFICATION_STATUSES } from './components/idVerificationContainer/constants'
|
|
22
|
+
export { VERIFICATION_STATUSES } from './components/idVerificationContainer/constants'
|
package/src/types/order-data.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { IAddOn } from './add_on'
|
|
2
2
|
|
|
3
3
|
export interface IOrderData {
|
|
4
|
+
id: string;
|
|
4
5
|
product_name: string;
|
|
5
6
|
ticketType: string;
|
|
6
7
|
quantity: string;
|
|
7
8
|
price: string;
|
|
8
9
|
total: string;
|
|
9
10
|
currency: string;
|
|
11
|
+
guest_count: string;
|
|
12
|
+
pay_now: string;
|
|
10
13
|
add_ons: IAddOn[];
|
|
11
14
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
interface SeatMapResponse {
|
|
2
|
+
data: any;
|
|
3
|
+
success: boolean;
|
|
4
|
+
error: boolean;
|
|
5
|
+
message: string;
|
|
6
|
+
status: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface IMapContainerProps {
|
|
10
|
+
event: any;
|
|
11
|
+
mapContainerId?: string;
|
|
12
|
+
timerMessage?: string | Node;
|
|
13
|
+
onAddToCartSuccess?: (data: any) => void;
|
|
14
|
+
onCountdownFinish?: any;
|
|
15
|
+
ticketDeleteButtonContent?: string | Node;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface ISeatMapContainerProps {
|
|
19
|
+
seatMapProps: {
|
|
20
|
+
seatData: any;
|
|
21
|
+
statuses: any;
|
|
22
|
+
seatMapEvents: any;
|
|
23
|
+
seatMapType: string | null;
|
|
24
|
+
ticketTypeTierRelations: any;
|
|
25
|
+
tierPrices: any;
|
|
26
|
+
isReserving: boolean;
|
|
27
|
+
predefinedSeats: any;
|
|
28
|
+
};
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
mapContainerId?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface SeatMapResponseData {
|
|
34
|
+
attributes: any;
|
|
35
|
+
relationships: any[];
|
|
36
|
+
type: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface TicketTypeTierRelationsData {
|
|
40
|
+
ticket_type_id: string;
|
|
41
|
+
ticket_type_deposit: string;
|
|
42
|
+
ticket_type_max_number_of_guests: string;
|
|
43
|
+
ticket_type_min_number_of_guests: string;
|
|
44
|
+
ticket_type_tier_id: number;
|
|
45
|
+
ticket_type_name: string;
|
|
46
|
+
ticket_type_option: string;
|
|
47
|
+
ticket_type_price: number;
|
|
48
|
+
ticket_quantity: number;
|
|
49
|
+
multiplier: number;
|
|
50
|
+
sort_order: string;
|
|
51
|
+
ticket_quantity_limit_type: string;
|
|
52
|
+
guest_price: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface TicketTypeTierRelations {
|
|
56
|
+
[key: string]: {
|
|
57
|
+
[key: string]: TicketTypeTierRelationsData;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface SeatMapDataAttributes {
|
|
62
|
+
seatMapType: string | null;
|
|
63
|
+
seatReservationTime: number;
|
|
64
|
+
ticketTypeTierRelations: TicketTypeTierRelations;
|
|
65
|
+
tierNames: {
|
|
66
|
+
[key: string]: string;
|
|
67
|
+
};
|
|
68
|
+
tierPrices: {
|
|
69
|
+
[key: string]: string;
|
|
70
|
+
};
|
|
71
|
+
seatData: string;
|
|
72
|
+
eventSeats: EventSeat[];
|
|
73
|
+
predefinedSeats: any;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface SeatMapData extends SeatMapResponseData {
|
|
77
|
+
attributes: SeatMapDataAttributes;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface SeatMapStatuses extends SeatMapResponseData {
|
|
81
|
+
attributes: any;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface SeatMapDataResponse extends SeatMapResponse {
|
|
85
|
+
data: SeatMapData;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface SeatMapStatusesResponse extends SeatMapResponse {
|
|
89
|
+
data: SeatMapStatuses;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface ISeatMapContainerProps {
|
|
93
|
+
seatMapProps: {
|
|
94
|
+
seatData: any;
|
|
95
|
+
statuses: any;
|
|
96
|
+
seatMapEvents: any;
|
|
97
|
+
seatMapType?: string;
|
|
98
|
+
ticketTypeTierRelations: any;
|
|
99
|
+
isReserving: boolean;
|
|
100
|
+
predefinedSeats: any;
|
|
101
|
+
};
|
|
102
|
+
mapContainerId?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface SeatReservationData {
|
|
106
|
+
seatId: string;
|
|
107
|
+
tierId: string;
|
|
108
|
+
type: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface EventSeat {
|
|
112
|
+
label: string;
|
|
113
|
+
ticket_type_id: Array<string>;
|
|
114
|
+
seats: any;
|
|
115
|
+
ticketing_engine_id: number | string;
|
|
116
|
+
tier_id: number | string;
|
|
117
|
+
seats: {
|
|
118
|
+
[key: string]: number;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface ITicketsSectionProps {
|
|
123
|
+
ticketTypeTierRelations: TicketTypeTierRelations;
|
|
124
|
+
reservedSeats: Array<SeatReservationData>;
|
|
125
|
+
handleCancelReservation: any;
|
|
126
|
+
isAddingToCart: boolean;
|
|
127
|
+
handleGetTicketClick: any;
|
|
128
|
+
currencySymbol: string;
|
|
129
|
+
handleTicketSelect: any;
|
|
130
|
+
selectedTickets: { [seatId: string]: string };
|
|
131
|
+
|
|
132
|
+
theme?: 'light' | 'dark';
|
|
133
|
+
getTicketsBtnLabel?: string;
|
|
134
|
+
contentStyle?: React.CSSProperties;
|
|
135
|
+
isButtonScrollable?: boolean;
|
|
136
|
+
ticketDeleteButtonContent?: string | Node;
|
|
137
|
+
tableMapEnabled?: boolean;
|
|
138
|
+
|
|
139
|
+
guestCounts?: any;
|
|
140
|
+
setGuestCounts?: any;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
interface ITicketDropdownOption {
|
|
144
|
+
ticket_type_tier_id: number | string;
|
|
145
|
+
ticket_type_name: string;
|
|
146
|
+
ticket_type_price: number | string;
|
|
147
|
+
ticket_type_id: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface ITicketsDropdownsData {
|
|
151
|
+
seatId: string;
|
|
152
|
+
tierId: string;
|
|
153
|
+
ticketsData: Array<ITicketDropdownOption | TicketTypeTierRelationsData>;
|
|
154
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import _get from 'lodash/get'
|
|
2
2
|
|
|
3
|
+
type Type1 = string | number | null | undefined
|
|
3
4
|
interface ICheckoutBody {
|
|
4
5
|
attributes: {
|
|
5
|
-
[key: string]:
|
|
6
|
+
[key: string]:
|
|
7
|
+
| Type1
|
|
8
|
+
| Record<string | number, Type1>
|
|
9
|
+
| Array<Type1 | IticketHolder>;
|
|
6
10
|
};
|
|
7
11
|
}
|
|
8
12
|
|
|
@@ -21,7 +25,7 @@ interface IUserCredentialsValues {
|
|
|
21
25
|
|
|
22
26
|
export const createCheckoutDataBodyWithDefaultHolder = (
|
|
23
27
|
ticketsQuantity: number,
|
|
24
|
-
logedInValues:
|
|
28
|
+
logedInValues: Record<string, string | undefined>,
|
|
25
29
|
includeDob = false,
|
|
26
30
|
userCredentials: IUserCredentialsValues = {}
|
|
27
31
|
): ICheckoutBody => {
|