tf-checkout-react 1.0.101 → 1.0.102

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.
Files changed (81) hide show
  1. package/dist/components/billing-info-container/index.d.ts +3 -1
  2. package/dist/components/common/SnackbarAlert.d.ts +13 -0
  3. package/dist/components/confirmationContainer/index.d.ts +2 -1
  4. package/dist/components/ticketsContainer/index.d.ts +2 -1
  5. package/dist/env.d.ts +1 -0
  6. package/dist/images/done.svg +3 -3
  7. package/dist/tf-checkout-react.cjs.development.js +242 -117
  8. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  9. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  10. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  11. package/dist/tf-checkout-react.esm.js +243 -118
  12. package/dist/tf-checkout-react.esm.js.map +1 -1
  13. package/dist/tf-checkout-styles.css +1 -1
  14. package/package.json +89 -89
  15. package/src/.DS_Store +0 -0
  16. package/src/.d.ts +2 -2
  17. package/src/api/index.ts +278 -278
  18. package/src/assets/images/done.svg +3 -3
  19. package/src/components/.DS_Store +0 -0
  20. package/src/components/billing-info-container/index.tsx +796 -777
  21. package/src/components/billing-info-container/style.css +105 -105
  22. package/src/components/billing-info-container/utils.ts +224 -224
  23. package/src/components/common/CheckboxField.tsx +41 -41
  24. package/src/components/common/CustomField.tsx +84 -84
  25. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  26. package/src/components/common/Loader.tsx +9 -9
  27. package/src/components/common/RadioField.tsx +35 -35
  28. package/src/components/common/SelectField.tsx +80 -80
  29. package/src/components/common/SnackbarAlert.tsx +54 -0
  30. package/src/components/common/index.tsx +4 -4
  31. package/src/components/confirmModal/index.tsx +51 -51
  32. package/src/components/confirmModal/style.css +21 -21
  33. package/src/components/confirmationContainer/config.ts +72 -72
  34. package/src/components/confirmationContainer/index.tsx +197 -194
  35. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  36. package/src/components/confirmationContainer/style.css +202 -202
  37. package/src/components/countdown/index.tsx +89 -89
  38. package/src/components/countdown/style.css +9 -9
  39. package/src/components/index.ts +7 -7
  40. package/src/components/loginModal/index.tsx +209 -209
  41. package/src/components/loginModal/style.css +71 -71
  42. package/src/components/myTicketsContainer/index.tsx +196 -137
  43. package/src/components/myTicketsContainer/row.tsx +41 -41
  44. package/src/components/myTicketsContainer/style.css +39 -39
  45. package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
  46. package/src/components/orderDetailsContainer/index.tsx +249 -249
  47. package/src/components/orderDetailsContainer/style.css +72 -72
  48. package/src/components/orderDetailsContainer/ticketsTable.tsx +124 -124
  49. package/src/components/paymentContainer/index.tsx +284 -284
  50. package/src/components/registerModal/index.tsx +190 -190
  51. package/src/components/stripePayment/index.tsx +253 -253
  52. package/src/components/stripePayment/style.css +59 -59
  53. package/src/components/ticketResale/index.tsx +56 -56
  54. package/src/components/ticketResaleModal/index.tsx +210 -210
  55. package/src/components/ticketResaleModal/style.css +28 -28
  56. package/src/components/ticketsContainer/PromoCodeSection.tsx +99 -99
  57. package/src/components/ticketsContainer/ReferralLogic.tsx +33 -33
  58. package/src/components/ticketsContainer/TicketRow.tsx +83 -83
  59. package/src/components/ticketsContainer/TicketsSection.tsx +81 -81
  60. package/src/components/ticketsContainer/index.tsx +430 -422
  61. package/src/components/ticketsContainer/style.css +181 -181
  62. package/src/components/ticketsContainer/utils.ts +11 -11
  63. package/src/components/timerWidget/index.tsx +70 -70
  64. package/src/components/timerWidget/style.css +26 -26
  65. package/src/components/waitingList/index.tsx +178 -178
  66. package/src/components/waitingList/style.css +26 -26
  67. package/src/env.ts +20 -19
  68. package/src/index.ts +13 -13
  69. package/src/normalizers/index.ts +45 -45
  70. package/src/types/billing-info-data.ts +37 -37
  71. package/src/types/payment-field.ts +7 -7
  72. package/src/types/referral-promotion.ts +7 -7
  73. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
  74. package/src/utils/downloadPDF.tsx +30 -30
  75. package/src/utils/formikErrorFocus.ts +24 -24
  76. package/src/utils/getImage.ts +14 -14
  77. package/src/utils/getQueryVariable.ts +13 -13
  78. package/src/utils/index.ts +5 -5
  79. package/src/utils/setConfigs.ts +26 -26
  80. package/src/utils/showZero.tsx +10 -10
  81. package/src/validators/index.ts +20 -20
@@ -1,137 +1,196 @@
1
- import React, { useEffect, useState } from 'react'
2
- import './style.css'
3
-
4
- import Table from '@mui/material/Table'
5
- import TableBody from '@mui/material/TableBody'
6
- import TableCell from '@mui/material/TableCell'
7
- import TableContainer from '@mui/material/TableContainer'
8
- import TableHead from '@mui/material/TableHead'
9
- import TableRow from '@mui/material/TableRow'
10
- import Paper from '@mui/material/Paper'
11
- import TablePagination from '@mui/material/TablePagination'
12
- import CircularProgress from '@mui/material/CircularProgress'
13
- import TextField from '@mui/material/TextField'
14
- import Autocomplete from '@mui/material/Autocomplete'
15
- import _get from 'lodash/get'
16
- import MyTicketsRow, { RowItems } from './row'
17
- import tableConfig from './tableConfig'
18
- import { getOrders } from '../../api'
19
-
20
- interface MyTicketsTypes {
21
- handleDetailsInfo: (id: string) => void;
22
- onGetOrdersSuccess: (res: any) => void;
23
- onGetOrdersError: (err: any) => void;
24
-
25
- theme?: 'light' | 'dark';
26
- }
27
-
28
- interface EventFilter {
29
- event_name: string;
30
- url_name: string;
31
- }
32
-
33
- export const MyTicketsContainer = ({
34
- handleDetailsInfo = () => {},
35
- onGetOrdersSuccess = () => {},
36
- onGetOrdersError = () => {},
37
- theme = 'dark',
38
- }: MyTicketsTypes) => {
39
- const [data, setData] = useState<any>(null)
40
- const [loading, setLoading] = useState(true)
41
- const [limit, setLimit] = useState(10)
42
- const [filter, setFilter] = useState('')
43
-
44
- //just once
45
- useEffect(() => {
46
- fetchData(1, limit, filter)
47
- }, [])
48
-
49
- const fetchData = async (page: number, limit: number, filter: string) => {
50
- try {
51
- setLoading(true)
52
- const response = await getOrders(page, limit, filter)
53
- onGetOrdersSuccess(response)
54
-
55
- const data = _get(response, 'data.data.attributes')
56
- data.page -= 1
57
-
58
- setData(data)
59
- } catch (error) {
60
- onGetOrdersError(error)
61
- } finally {
62
- setLoading(false)
63
- }
64
- }
65
-
66
- const handleChangePage = (_event: any, newPage: number) => {
67
- fetchData(newPage + 1, limit, filter)
68
- }
69
-
70
- const handleChangeRowsPerPage = (
71
- event: React.ChangeEvent<HTMLInputElement>
72
- ) => {
73
- fetchData(1, +event.target.value, filter)
74
- setLimit(+event.target.value)
75
- }
76
-
77
- const onChange = (
78
- _event: React.SyntheticEvent<Element, Event>,
79
- eventFilter: EventFilter | null
80
- ) => {
81
- fetchData(1, limit, eventFilter?.url_name || '')
82
- setFilter(eventFilter?.url_name || '')
83
- }
84
-
85
- return (
86
- <div className={`my-ticket ${theme}`}>
87
- {loading && (
88
- <div className="loading">
89
- <CircularProgress />
90
- </div>
91
- )}
92
- {data && (
93
- <>
94
- <Autocomplete
95
- disablePortal
96
- id="combo-box-demo"
97
- getOptionLabel={(option: EventFilter) => option.event_name}
98
- onChange={onChange}
99
- options={data.purchased_events}
100
- sx={{ width: 300 }}
101
- renderInput={params => <TextField {...params} label="Events" />}
102
- />
103
- <TableContainer component={Paper} className="my-ticket-table">
104
- <Table aria-label="collapsible table">
105
- <TableHead>
106
- <TableRow>
107
- {tableConfig().header.map((column: string, index: number) => (
108
- <TableCell key={index}>{column}</TableCell>
109
- ))}
110
- <TableCell />
111
- </TableRow>
112
- </TableHead>
113
- <TableBody>
114
- {data.orders?.map((row: RowItems) => (
115
- <MyTicketsRow
116
- key={row.id}
117
- row={row}
118
- handleDetailsInfo={handleDetailsInfo}
119
- />
120
- ))}
121
- </TableBody>
122
- </Table>
123
- </TableContainer>
124
- <TablePagination
125
- rowsPerPageOptions={[10, 25, 100]}
126
- component="div"
127
- count={data.total_count}
128
- rowsPerPage={limit}
129
- page={data.page}
130
- onPageChange={handleChangePage}
131
- onRowsPerPageChange={handleChangeRowsPerPage}
132
- />
133
- </>
134
- )}
135
- </div>
136
- )
137
- }
1
+ import React, { useEffect, useState } from 'react'
2
+ import './style.css'
3
+
4
+ import Table from '@mui/material/Table'
5
+ import TableBody from '@mui/material/TableBody'
6
+ import TableCell from '@mui/material/TableCell'
7
+ import TableContainer from '@mui/material/TableContainer'
8
+ import TableHead from '@mui/material/TableHead'
9
+ import TableRow from '@mui/material/TableRow'
10
+ import Paper from '@mui/material/Paper'
11
+ import TablePagination from '@mui/material/TablePagination'
12
+ import CircularProgress from '@mui/material/CircularProgress'
13
+ import TextField from '@mui/material/TextField'
14
+ import Autocomplete from '@mui/material/Autocomplete'
15
+ import _get from 'lodash/get'
16
+ import MyTicketsRow, { RowItems } from './row'
17
+ import tableConfig from './tableConfig'
18
+ import { getOrders } from '../../api'
19
+ import { LoginModal } from '../loginModal'
20
+ import axios from 'axios'
21
+
22
+ interface MyTicketsTypes {
23
+ handleDetailsInfo: (id: string) => void;
24
+ onGetOrdersSuccess: (res: any) => void;
25
+ onGetOrdersError: (err: any) => void;
26
+
27
+ theme?: 'light' | 'dark';
28
+ }
29
+
30
+ interface EventFilter {
31
+ event_name: string;
32
+ url_name: string;
33
+ }
34
+
35
+ export const MyTicketsContainer = ({
36
+ handleDetailsInfo = () => {},
37
+ onGetOrdersSuccess = () => {},
38
+ onGetOrdersError = () => {},
39
+ theme = 'dark',
40
+ }: MyTicketsTypes) => {
41
+ const [data, setData] = useState<any>(null)
42
+ const [loading, setLoading] = useState(true)
43
+ const [limit, setLimit] = useState(10)
44
+ const [filter, setFilter] = useState('')
45
+
46
+ const isWindowDefined = typeof window !== 'undefined'
47
+ const [isLogged, setIsLogged] = useState(
48
+ isWindowDefined ? !!window.localStorage.getItem('access_token') : false
49
+ )
50
+ const [showModalLogin, setShowModalLogin] = useState(false)
51
+ const [userExpired, setUserExpired] = useState(false)
52
+
53
+ //just once
54
+ useEffect(() => {
55
+ fetchData(1, limit, filter)
56
+ }, [isLogged])
57
+
58
+ const fetchData = async (page: number, limit: number, filter: string) => {
59
+ try {
60
+ setLoading(true)
61
+ const response = await getOrders(page, limit, filter)
62
+ onGetOrdersSuccess(response)
63
+
64
+ const data = _get(response, 'data.data.attributes')
65
+ data.page -= 1
66
+
67
+ setData(data)
68
+ } catch (error) {
69
+ if (axios.isAxiosError(error)) {
70
+ if (error.response?.data.error === 'invalid_token') {
71
+ if (isWindowDefined) {
72
+ window.localStorage.removeItem('user_data')
73
+ window.localStorage.removeItem('access_token')
74
+ setUserExpired(true)
75
+ setShowModalLogin(true)
76
+ }
77
+ }
78
+ }
79
+ onGetOrdersError(error)
80
+ } finally {
81
+ setLoading(false)
82
+ }
83
+ }
84
+
85
+ const handleChangePage = (_event: any, newPage: number) => {
86
+ fetchData(newPage + 1, limit, filter)
87
+ }
88
+
89
+ const handleChangeRowsPerPage = (
90
+ event: React.ChangeEvent<HTMLInputElement>
91
+ ) => {
92
+ fetchData(1, +event.target.value, filter)
93
+ setLimit(+event.target.value)
94
+ }
95
+
96
+ const onChange = (
97
+ _event: React.SyntheticEvent<Element, Event>,
98
+ eventFilter: EventFilter | null
99
+ ) => {
100
+ fetchData(1, limit, eventFilter?.url_name || '')
101
+ setFilter(eventFilter?.url_name || '')
102
+ }
103
+
104
+ return (
105
+ <div className={`my-ticket ${theme}`}>
106
+ {loading && (
107
+ <div className="loading">
108
+ <CircularProgress />
109
+ </div>
110
+ )}
111
+ {!isLogged ? (
112
+ <div className="account-actions-block">
113
+ <div className="login-block">
114
+ <button
115
+ className="login-register-button"
116
+ type="button"
117
+ onClick={() => {
118
+ setShowModalLogin(true)
119
+ }}
120
+ >
121
+ Login
122
+ </button>
123
+ <div className="logo-image-container">
124
+ <img
125
+ src={
126
+ theme === 'dark'
127
+ ? 'https://www.ticketfairy.com/resources/images/logo-ttf.svg'
128
+ : 'https://www.ticketfairy.com/resources/images/logo-ttf-black.svg'
129
+ }
130
+ alt="nodata"
131
+ />
132
+ </div>
133
+ </div>
134
+ </div>
135
+ ) : null}
136
+ {data && (
137
+ <>
138
+ <Autocomplete
139
+ disablePortal
140
+ id="combo-box-demo"
141
+ getOptionLabel={(option: EventFilter) => option.event_name}
142
+ onChange={onChange}
143
+ options={data.purchased_events}
144
+ sx={{ width: 300 }}
145
+ renderInput={params => <TextField {...params} label="Events" />}
146
+ />
147
+ <TableContainer component={Paper} className="my-ticket-table">
148
+ <Table aria-label="collapsible table">
149
+ <TableHead>
150
+ <TableRow>
151
+ {tableConfig().header.map((column: string, index: number) => (
152
+ <TableCell key={index}>{column}</TableCell>
153
+ ))}
154
+ <TableCell />
155
+ </TableRow>
156
+ </TableHead>
157
+ <TableBody>
158
+ {data.orders?.map((row: RowItems) => (
159
+ <MyTicketsRow
160
+ key={row.id}
161
+ row={row}
162
+ handleDetailsInfo={handleDetailsInfo}
163
+ />
164
+ ))}
165
+ </TableBody>
166
+ </Table>
167
+ </TableContainer>
168
+ <TablePagination
169
+ rowsPerPageOptions={[10, 25, 100]}
170
+ component="div"
171
+ count={data.total_count}
172
+ rowsPerPage={limit}
173
+ page={data.page}
174
+ onPageChange={handleChangePage}
175
+ onRowsPerPageChange={handleChangeRowsPerPage}
176
+ />
177
+ </>
178
+ )}
179
+ <>
180
+ {showModalLogin && (
181
+ <LoginModal
182
+ onClose={() => {
183
+ setShowModalLogin(false)
184
+ }}
185
+ onLogin={() => {
186
+ setShowModalLogin(false)
187
+ setUserExpired(false)
188
+ setIsLogged(true)
189
+ }}
190
+ userExpired={userExpired}
191
+ />
192
+ )}
193
+ </>
194
+ </div>
195
+ )
196
+ }
@@ -1,41 +1,41 @@
1
- import React from 'react'
2
- import TableRow from '@mui/material/TableRow'
3
- import TableCell from '@mui/material/TableCell'
4
- import tableConfig from './tableConfig'
5
-
6
- export interface RowItems {
7
- id: string;
8
- date: string;
9
- image: string;
10
- eventName: string;
11
- amount: string;
12
- currency: string;
13
- }
14
-
15
- interface RowPropsTypes {
16
- row: RowItems;
17
- handleDetailsInfo: (id: string) => void;
18
- }
19
-
20
- const Row = ({ row, handleDetailsInfo }: RowPropsTypes) => {
21
- return (
22
- <TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
23
- {tableConfig().body.map((column: any, index: number) => (
24
- <TableCell component="th" scope="row" key={index}>
25
- {column(row)}
26
- </TableCell>
27
- ))}
28
- <TableCell component="th" scope="row">
29
- <button
30
- type='button'
31
- className="order-details-button"
32
- onClick={() => handleDetailsInfo(row.id)}
33
- >
34
- Details
35
- </button>
36
- </TableCell>
37
- </TableRow>
38
- );
39
- }
40
-
41
- export default Row
1
+ import React from 'react'
2
+ import TableRow from '@mui/material/TableRow'
3
+ import TableCell from '@mui/material/TableCell'
4
+ import tableConfig from './tableConfig'
5
+
6
+ export interface RowItems {
7
+ id: string;
8
+ date: string;
9
+ image: string;
10
+ eventName: string;
11
+ amount: string;
12
+ currency: string;
13
+ }
14
+
15
+ interface RowPropsTypes {
16
+ row: RowItems;
17
+ handleDetailsInfo: (id: string) => void;
18
+ }
19
+
20
+ const Row = ({ row, handleDetailsInfo }: RowPropsTypes) => {
21
+ return (
22
+ <TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
23
+ {tableConfig().body.map((column: any, index: number) => (
24
+ <TableCell component="th" scope="row" key={index}>
25
+ {column(row)}
26
+ </TableCell>
27
+ ))}
28
+ <TableCell component="th" scope="row">
29
+ <button
30
+ type='button'
31
+ className="order-details-button"
32
+ onClick={() => handleDetailsInfo(row.id)}
33
+ >
34
+ Details
35
+ </button>
36
+ </TableCell>
37
+ </TableRow>
38
+ );
39
+ }
40
+
41
+ export default Row
@@ -1,40 +1,40 @@
1
- .my-ticket {
2
- padding: 30px;
3
- }
4
- .my-ticket-table {
5
- margin-top: 30px;
6
- }
7
- .my-ticket .loading {
8
- width: 100%;
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- height: 100vh;
13
- position: fixed;
14
- top: 0;
15
- left: 0;
16
- background-color: rgba(0, 0, 0, .4);
17
- }
18
- .my-ticket .event-info {
19
- display: flex;
20
- align-items: center;
21
- }
22
- .my-ticket thead th {
23
- font-weight: 700;
24
- }
25
- .my-ticket .event-info img {
26
- width: 50px;
27
- margin-right: 10px;
28
- }
29
- .my-ticket .order-details-button {
30
- border: none;
31
- border-radius: 4px;
32
- color: #fff;
33
- background-color: #32325d;
34
- transition: all 150ms ease;
35
- cursor: pointer;
36
- padding: 10px 14px;
37
- }
38
- .my-ticket .order-details-button:hover {
39
- background-color: #505050;
1
+ .my-ticket {
2
+ padding: 30px;
3
+ }
4
+ .my-ticket-table {
5
+ margin-top: 30px;
6
+ }
7
+ .my-ticket .loading {
8
+ width: 100%;
9
+ display: flex;
10
+ justify-content: center;
11
+ align-items: center;
12
+ height: 100vh;
13
+ position: fixed;
14
+ top: 0;
15
+ left: 0;
16
+ background-color: rgba(0, 0, 0, .4);
17
+ }
18
+ .my-ticket .event-info {
19
+ display: flex;
20
+ align-items: center;
21
+ }
22
+ .my-ticket thead th {
23
+ font-weight: 700;
24
+ }
25
+ .my-ticket .event-info img {
26
+ width: 50px;
27
+ margin-right: 10px;
28
+ }
29
+ .my-ticket .order-details-button {
30
+ border: none;
31
+ border-radius: 4px;
32
+ color: #fff;
33
+ background-color: #32325d;
34
+ transition: all 150ms ease;
35
+ cursor: pointer;
36
+ padding: 10px 14px;
37
+ }
38
+ .my-ticket .order-details-button:hover {
39
+ background-color: #505050;
40
40
  }
@@ -1,34 +1,34 @@
1
- import React from 'react'
2
-
3
- interface EventInfoTypes {
4
- image: string;
5
- name: string;
6
- }
7
-
8
- const EventInfoItem = ({ image, name }: EventInfoTypes) => {
9
- return (
10
- <div className='event-info'>
11
- <img src={image} alt="event" />
12
- {name}
13
- </div>
14
- )
15
- }
16
-
17
- const tableConfig = (key?: string) => {
18
- let config;
19
- switch (key) {
20
- default:
21
- config = {
22
- header: ['Order No.', 'Date', 'Event', 'Total'],
23
- body: [
24
- (row: any) => row.id,
25
- (row: any) => row.date,
26
- (row: any) => <EventInfoItem image={row.image} name={row.eventName} />,
27
- (row: any) => row.currency + row.amount
28
- ],
29
- }
30
- }
31
- return config
32
- }
33
-
34
- export default tableConfig
1
+ import React from 'react'
2
+
3
+ interface EventInfoTypes {
4
+ image: string;
5
+ name: string;
6
+ }
7
+
8
+ const EventInfoItem = ({ image, name }: EventInfoTypes) => {
9
+ return (
10
+ <div className='event-info'>
11
+ <img src={image} alt="event" />
12
+ {name}
13
+ </div>
14
+ )
15
+ }
16
+
17
+ const tableConfig = (key?: string) => {
18
+ let config;
19
+ switch (key) {
20
+ default:
21
+ config = {
22
+ header: ['Order No.', 'Date', 'Event', 'Total'],
23
+ body: [
24
+ (row: any) => row.id,
25
+ (row: any) => row.date,
26
+ (row: any) => <EventInfoItem image={row.image} name={row.eventName} />,
27
+ (row: any) => row.currency + row.amount
28
+ ],
29
+ }
30
+ }
31
+ return config
32
+ }
33
+
34
+ export default tableConfig