tf-checkout-react 1.0.106 → 1.2.1

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 (77) hide show
  1. package/README.md +278 -1
  2. package/dist/api/index.d.ts +40 -28
  3. package/dist/components/account-settings/index.d.ts +3 -0
  4. package/dist/components/billing-info-container/index.d.ts +11 -8
  5. package/dist/components/common/PhoneNumberField.d.ts +9 -0
  6. package/dist/components/common/index.d.ts +1 -0
  7. package/dist/components/confirmationContainer/index.d.ts +2 -1
  8. package/dist/components/countdown/index.d.ts +2 -1
  9. package/dist/components/forgotPasswordModal/index.d.ts +11 -0
  10. package/dist/components/index.d.ts +1 -0
  11. package/dist/components/loginModal/index.d.ts +35 -2
  12. package/dist/components/myTicketsContainer/index.d.ts +2 -1
  13. package/dist/components/myTicketsContainer/tableConfig.d.ts +1 -1
  14. package/dist/components/orderDetailsContainer/index.d.ts +6 -1
  15. package/dist/components/orderDetailsContainer/ticketsTable.d.ts +2 -1
  16. package/dist/components/paymentContainer/index.d.ts +2 -1
  17. package/dist/components/resetPasswordContainer/index.d.ts +10 -0
  18. package/dist/components/signupModal/index.d.ts +14 -0
  19. package/dist/components/ticketsContainer/PromoCodeSection.d.ts +3 -2
  20. package/dist/components/ticketsContainer/TicketsSection.d.ts +1 -2
  21. package/dist/components/ticketsContainer/index.d.ts +7 -3
  22. package/dist/index.d.ts +2 -0
  23. package/dist/tf-checkout-react.cjs.development.js +2177 -1482
  24. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  25. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  26. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  27. package/dist/tf-checkout-react.esm.js +2166 -1473
  28. package/dist/tf-checkout-react.esm.js.map +1 -1
  29. package/dist/tf-checkout-styles.css +1 -1
  30. package/dist/utils/cookies.d.ts +3 -0
  31. package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +6 -1
  32. package/dist/utils/downloadPDF.d.ts +1 -1
  33. package/dist/utils/getDomain.d.ts +1 -0
  34. package/dist/utils/index.d.ts +2 -0
  35. package/package.json +12 -1
  36. package/src/api/index.ts +100 -29
  37. package/src/components/account-settings/index.tsx +161 -0
  38. package/src/components/account-settings/style.css +200 -0
  39. package/src/components/billing-info-container/index.tsx +145 -99
  40. package/src/components/billing-info-container/style.css +1 -1
  41. package/src/components/billing-info-container/utils.ts +11 -3
  42. package/src/components/common/PhoneNumberField.tsx +68 -0
  43. package/src/components/common/SnackbarAlert.tsx +1 -1
  44. package/src/components/common/dist/PhoneNumberField.js +96 -0
  45. package/src/components/common/index.tsx +1 -0
  46. package/src/components/confirmationContainer/index.tsx +19 -9
  47. package/src/components/countdown/index.tsx +3 -1
  48. package/src/components/forgotPasswordModal/index.tsx +107 -0
  49. package/src/components/forgotPasswordModal/style.css +47 -0
  50. package/src/components/index.ts +1 -0
  51. package/src/components/loginModal/index.tsx +72 -71
  52. package/src/components/myTicketsContainer/index.tsx +99 -95
  53. package/src/components/myTicketsContainer/style.css +2 -2
  54. package/src/components/myTicketsContainer/tableConfig.tsx +3 -6
  55. package/src/components/orderDetailsContainer/index.tsx +80 -21
  56. package/src/components/orderDetailsContainer/style.css +7 -3
  57. package/src/components/orderDetailsContainer/ticketsTable.tsx +130 -83
  58. package/src/components/paymentContainer/index.tsx +114 -49
  59. package/src/components/registerModal/index.tsx +3 -10
  60. package/src/components/resetPasswordContainer/index.tsx +96 -0
  61. package/src/components/resetPasswordContainer/style.css +36 -0
  62. package/src/components/signupModal/index.tsx +195 -0
  63. package/src/components/signupModal/style.css +58 -0
  64. package/src/components/stripePayment/index.tsx +14 -12
  65. package/src/components/stripePayment/style.css +3 -3
  66. package/src/components/ticketResaleModal/index.tsx +12 -14
  67. package/src/components/ticketsContainer/PromoCodeSection.tsx +8 -7
  68. package/src/components/ticketsContainer/TicketRow.tsx +12 -6
  69. package/src/components/ticketsContainer/TicketsSection.tsx +0 -3
  70. package/src/components/ticketsContainer/index.tsx +155 -86
  71. package/src/env.ts +3 -3
  72. package/src/index.ts +3 -1
  73. package/src/utils/cookies.ts +42 -0
  74. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +16 -4
  75. package/src/utils/downloadPDF.tsx +28 -6
  76. package/src/utils/getDomain.ts +15 -0
  77. package/src/utils/index.ts +2 -0
@@ -1,29 +1,31 @@
1
- import React, { useEffect, useState } from 'react'
2
1
  import './style.css'
3
2
 
3
+ import Autocomplete from '@mui/material/Autocomplete'
4
+ import CircularProgress from '@mui/material/CircularProgress'
5
+ import Paper from '@mui/material/Paper'
4
6
  import Table from '@mui/material/Table'
5
7
  import TableBody from '@mui/material/TableBody'
6
8
  import TableCell from '@mui/material/TableCell'
7
9
  import TableContainer from '@mui/material/TableContainer'
8
10
  import TableHead from '@mui/material/TableHead'
9
- import TableRow from '@mui/material/TableRow'
10
- import Paper from '@mui/material/Paper'
11
11
  import TablePagination from '@mui/material/TablePagination'
12
- import CircularProgress from '@mui/material/CircularProgress'
12
+ import TableRow from '@mui/material/TableRow'
13
13
  import TextField from '@mui/material/TextField'
14
- import Autocomplete from '@mui/material/Autocomplete'
14
+ import axios from 'axios'
15
15
  import _get from 'lodash/get'
16
- import MyTicketsRow, { RowItems } from './row'
17
- import tableConfig from './tableConfig'
16
+ import _identity from 'lodash/identity'
17
+ import React, { useEffect, useState } from 'react'
18
+
18
19
  import { getOrders } from '../../api'
19
20
  import { LoginModal } from '../loginModal'
20
- import axios from 'axios'
21
+ import MyTicketsRow, { RowItems } from './row'
22
+ import tableConfig from './tableConfig'
21
23
 
22
24
  interface MyTicketsTypes {
23
25
  handleDetailsInfo: (id: string) => void;
24
26
  onGetOrdersSuccess: (res: any) => void;
25
27
  onGetOrdersError: (err: any) => void;
26
-
28
+ logo?: string;
27
29
  theme?: 'light' | 'dark';
28
30
  }
29
31
 
@@ -33,10 +35,11 @@ interface EventFilter {
33
35
  }
34
36
 
35
37
  export const MyTicketsContainer = ({
36
- handleDetailsInfo = () => {},
37
- onGetOrdersSuccess = () => {},
38
- onGetOrdersError = () => {},
38
+ handleDetailsInfo = _identity,
39
+ onGetOrdersSuccess = _identity,
40
+ onGetOrdersError = _identity,
39
41
  theme = 'dark',
42
+ logo,
40
43
  }: MyTicketsTypes) => {
41
44
  const [data, setData] = useState<any>(null)
42
45
  const [loading, setLoading] = useState(true)
@@ -103,94 +106,95 @@ export const MyTicketsContainer = ({
103
106
 
104
107
  return (
105
108
  <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)
109
+ <>
110
+ {showModalLogin ||
111
+ (!isLogged && (
112
+ <LoginModal
113
+ onClose={() => {
114
+ setShowModalLogin(false)
119
115
  }}
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}
116
+ onLogin={() => {
117
+ setShowModalLogin(false)
118
+ setUserExpired(false)
119
+ setIsLogged(true)
120
+ }}
121
+ userExpired={userExpired}
122
+ logo={logo}
123
+ />
124
+ ))}
125
+ </>
136
126
  {data && (
137
127
  <>
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
- />
128
+ <h2>My Ticket Orders</h2>
129
+ <div className="order_event">
130
+ <Autocomplete
131
+ disablePortal
132
+ id="combo-box-demo"
133
+ getOptionLabel={(option: EventFilter) => option.event_name}
134
+ onChange={onChange}
135
+ options={data.purchased_events}
136
+ sx={{ width: 300 }}
137
+ renderInput={params => <TextField {...params} label="Events" />}
138
+ />
139
+ <button type="button" className="clear">CLEAR</button>
140
+ </div>
141
+ {loading ? (
142
+ <div className="loading">
143
+ <CircularProgress />
144
+ </div>
145
+ ) : (
146
+ <>
147
+ <TableContainer component={Paper} className="my-ticket-table">
148
+ <Table aria-label="collapsible table">
149
+ <TableHead>
150
+ <TableRow>
151
+ {tableConfig().header.map(
152
+ (column: string, index: number) => (
153
+ <TableCell key={index}>{column}</TableCell>
154
+ )
155
+ )}
156
+ <TableCell />
157
+ </TableRow>
158
+ </TableHead>
159
+ <TableBody>
160
+ {data.orders?.map((row: RowItems) => (
161
+ <MyTicketsRow
162
+ key={row.id}
163
+ row={row}
164
+ handleDetailsInfo={handleDetailsInfo}
165
+ />
166
+ ))}
167
+ </TableBody>
168
+ </Table>
169
+ </TableContainer>
170
+ <TablePagination
171
+ rowsPerPageOptions={[10, 25, 100]}
172
+ component="div"
173
+ count={data.total_count}
174
+ rowsPerPage={limit}
175
+ page={data.page}
176
+ onPageChange={handleChangePage}
177
+ onRowsPerPageChange={handleChangeRowsPerPage}
178
+ />
179
+ </>
180
+ )}
177
181
  </>
178
182
  )}
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
- </>
183
+ <>
184
+ {showModalLogin && (
185
+ <LoginModal
186
+ onClose={() => {
187
+ setShowModalLogin(false)
188
+ }}
189
+ onLogin={() => {
190
+ setShowModalLogin(false)
191
+ setUserExpired(false)
192
+ setIsLogged(true)
193
+ }}
194
+ userExpired={userExpired}
195
+ />
196
+ )}
197
+ </>
194
198
  </div>
195
199
  )
196
200
  }
@@ -13,7 +13,7 @@
13
13
  position: fixed;
14
14
  top: 0;
15
15
  left: 0;
16
- background-color: rgba(0, 0, 0, .4);
16
+ background-color: rgba(0, 0, 0, 0.4);
17
17
  }
18
18
  .my-ticket .event-info {
19
19
  display: flex;
@@ -37,4 +37,4 @@
37
37
  }
38
38
  .my-ticket .order-details-button:hover {
39
39
  background-color: #505050;
40
- }
40
+ }
@@ -5,23 +5,20 @@ interface EventInfoTypes {
5
5
  name: string;
6
6
  }
7
7
 
8
- const EventInfoItem = ({ image, name }: EventInfoTypes) => {
9
- return (
8
+ const EventInfoItem = ({ image, name }: EventInfoTypes) => (
10
9
  <div className='event-info'>
11
10
  <img src={image} alt="event" />
12
11
  {name}
13
12
  </div>
14
13
  )
15
- }
16
14
 
17
15
  const tableConfig = (key?: string) => {
18
- let config;
16
+ let config
19
17
  switch (key) {
20
18
  default:
21
19
  config = {
22
- header: ['Order No.', 'Date', 'Event', 'Total'],
20
+ header: [],
23
21
  body: [
24
- (row: any) => row.id,
25
22
  (row: any) => row.date,
26
23
  (row: any) => <EventInfoItem image={row.image} name={row.eventName} />,
27
24
  (row: any) => row.currency + row.amount
@@ -12,6 +12,7 @@ import CircularProgress from '@mui/material/CircularProgress'
12
12
  import _get from 'lodash/get'
13
13
  import _has from 'lodash/has'
14
14
  import _find from 'lodash/find'
15
+ import _map from 'lodash/map'
15
16
  import { getOrderDetails } from '../../api'
16
17
  import TicketsTable, { ITicketTypes } from './ticketsTable'
17
18
  import { TicketResaleModal, InitialValuesTypes } from '../ticketResaleModal'
@@ -28,8 +29,11 @@ interface TicketTypes {
28
29
  }
29
30
 
30
31
  interface OrderDetailsTypes {
32
+ columns: Array<{ label: string }>;
31
33
  onGetOrdersSuccess: (res: any) => void;
32
34
  onGetOrdersError: (err: any) => void;
35
+ onReturnButtonClick: (data: any) => void;
36
+ personalLinkIcon?: string;
33
37
  }
34
38
 
35
39
  const getTotal = (data: any) => {
@@ -39,8 +43,11 @@ const getTotal = (data: any) => {
39
43
  }
40
44
 
41
45
  export const OrderDetailsContainer = ({
46
+ columns = [],
42
47
  onGetOrdersSuccess = () => {},
43
48
  onGetOrdersError = () => {},
49
+ onReturnButtonClick,
50
+ personalLinkIcon = '',
44
51
  }: OrderDetailsTypes) => {
45
52
  const [data, setData] = useState<any>({})
46
53
  const [loading, setLoading] = useState(true)
@@ -74,8 +81,14 @@ export const OrderDetailsContainer = ({
74
81
 
75
82
  const handleSellTicket = (ticket: ITicketTypes) => {
76
83
  const ticketTypesArr = data.items.ticket_types
77
- const sellTicketType = _find(ticketTypesArr, ticketType => ticketType.hash === ticket.ticket_type_hash)
78
- setActiveTicket({ ...ticket, ticket_type_is_active: sellTicketType?.active })
84
+ const sellTicketType = _find(
85
+ ticketTypesArr,
86
+ ticketType => ticketType.hash === ticket.ticket_type_hash
87
+ )
88
+ setActiveTicket({
89
+ ...ticket,
90
+ ticket_type_is_active: sellTicketType?.active,
91
+ })
79
92
  setShowResaleModal(true)
80
93
  }
81
94
 
@@ -87,8 +100,15 @@ export const OrderDetailsContainer = ({
87
100
  const handleOnSubmit = async (values: InitialValuesTypes) => {
88
101
  try {
89
102
  setLoading(true)
90
- const { to, first_name, last_name, email, confirm_email, confirm } = values
91
- const formData = new FormData();
103
+ const {
104
+ to,
105
+ first_name,
106
+ last_name,
107
+ email,
108
+ confirm_email,
109
+ confirm,
110
+ } = values
111
+ const formData = new FormData()
92
112
  formData.append('to', to)
93
113
  formData.append('first_name', first_name)
94
114
  formData.append('last_name', last_name)
@@ -99,7 +119,7 @@ export const OrderDetailsContainer = ({
99
119
  await resaleTicket(formData, activeTicket.hash)
100
120
  const updatedData = { ...data }
101
121
  updatedData?.tickets?.forEach((ticket: ITicketTypes) => {
102
- if(ticket.hash === activeTicket.hash) {
122
+ if (ticket.hash === activeTicket.hash) {
103
123
  ticket.is_sellable = false
104
124
  ticket.is_on_sale = true
105
125
  }
@@ -130,7 +150,7 @@ export const OrderDetailsContainer = ({
130
150
  await removeFromResale(activeTicket.hash)
131
151
  const updatedData = { ...data }
132
152
  updatedData?.tickets?.forEach((ticket: ITicketTypes) => {
133
- if(ticket.hash === activeTicket.hash) {
153
+ if (ticket.hash === activeTicket.hash) {
134
154
  ticket.is_sellable = true
135
155
  ticket.is_on_sale = false
136
156
  }
@@ -145,6 +165,11 @@ export const OrderDetailsContainer = ({
145
165
  }
146
166
  }
147
167
 
168
+ let orderSummery = `ID ${data.id}, placed`
169
+ if (data.date) {
170
+ orderSummery += ` ${data.date}`
171
+ }
172
+
148
173
  return (
149
174
  <div className="order-details">
150
175
  {loading ? (
@@ -155,25 +180,57 @@ export const OrderDetailsContainer = ({
155
180
  <>
156
181
  <h1 className="layout-title">Order Details</h1>
157
182
  <div className="order-summary-box">
158
- <h4 className="sub-title">Order Summary</h4>
183
+ <div className="summary-block">
184
+ <div className="summary-item">
185
+ <h6 className="sub-title">Order Summary</h6>
186
+ <p>{orderSummery}</p>
187
+ </div>
188
+ <div className="summary-item">
189
+ <div className="return-button-container">
190
+ <button
191
+ type="button"
192
+ className="return-button"
193
+ onClick={() => {
194
+ if (typeof window !== 'undefined') {
195
+ window.location.assign('/orders')
196
+ }
197
+ }}
198
+ >
199
+ Back to Orders
200
+ </button>
201
+ </div>
202
+ </div>
203
+ </div>
159
204
  <div className="personal-link">
160
- <b>Your personal share link for this event is: </b>
161
- <a
162
- href={data?.personal_share_link}
163
- target="_blank"
164
- rel="noreferrer"
165
- >
166
- {data?.personal_share_link}
167
- </a>
205
+ <div className="link-item">
206
+ <span>Personal Share Link: </span>
207
+ <a
208
+ href={data?.personal_share_link}
209
+ target="_blank"
210
+ rel="noreferrer"
211
+ >
212
+ {Boolean(personalLinkIcon) && (
213
+ <img src={personalLinkIcon} alt="Icon" />
214
+ )}
215
+ {data?.personal_share_link}
216
+ </a>
217
+ </div>
218
+ <div className="link-item">
219
+ <p>{`So far, you’ve referred ${data.sales_referred} tickets`}</p>
220
+ </div>
168
221
  </div>
222
+ {data?.sales_referred ? (
223
+ <div className="total-referrer">
224
+ <b>So far, you've referred {data.sales_referred} tickets.</b>
225
+ </div>
226
+ ) : null}
169
227
  <TableContainer component={Paper}>
170
- <Table aria-label="collapsible table">
228
+ <Table className="tt-type" aria-label="collapsible table">
171
229
  <TableHead>
172
230
  <TableRow>
173
- <TableCell>Items</TableCell>
174
- <TableCell>Price</TableCell>
175
- <TableCell>Quantity</TableCell>
176
- <TableCell>Total</TableCell>
231
+ {_map(columns, item => (
232
+ <TableCell>{item.label || ''}</TableCell>
233
+ ))}
177
234
  </TableRow>
178
235
  </TableHead>
179
236
  <TableBody>
@@ -223,7 +280,9 @@ export const OrderDetailsContainer = ({
223
280
  type="button"
224
281
  className="return-button"
225
282
  onClick={() => {
226
- if (typeof window !== 'undefined') {
283
+ if (onReturnButtonClick) {
284
+ onReturnButtonClick(data)
285
+ } else if (typeof window !== 'undefined') {
227
286
  window.location.assign('/orders')
228
287
  }
229
288
  }}
@@ -11,7 +11,7 @@
11
11
  position: fixed;
12
12
  top: 0;
13
13
  left: 0;
14
- background-color: rgba(0, 0, 0, .4);
14
+ background-color: rgba(0, 0, 0, 0.4);
15
15
  z-index: 1400;
16
16
  }
17
17
  .order-details .layout-title {
@@ -38,7 +38,7 @@
38
38
  margin-top: 30px;
39
39
  }
40
40
  .order-details .ticket-add-on-table {
41
- background-color: #fcf8e3;;
41
+ background-color: #fcf8e3;
42
42
  }
43
43
  .order-details .action-button {
44
44
  width: max-content;
@@ -70,4 +70,8 @@
70
70
 
71
71
  .order-details .personal-link {
72
72
  padding: 20px 0;
73
- }
73
+ }
74
+
75
+ .order-details .total-referrer {
76
+ padding: 0px 0px 20px 0px;
77
+ }