tf-checkout-react 1.0.75 → 1.0.79

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 (42) hide show
  1. package/dist/api/index.d.ts +1 -0
  2. package/dist/components/billing-info-container/index.d.ts +7 -2
  3. package/dist/components/billing-info-container/utils.d.ts +1 -0
  4. package/dist/components/common/FormikPhoneNumberField.d.ts +1 -1
  5. package/dist/components/countdown/index.d.ts +11 -0
  6. package/dist/components/orderDetailsContainer/ticketsTable.d.ts +13 -1
  7. package/dist/components/paymentContainer/index.d.ts +9 -2
  8. package/dist/components/ticketsContainer/index.d.ts +9 -1
  9. package/dist/components/waitingList/index.d.ts +1 -2
  10. package/dist/tf-checkout-react.cjs.development.js +505 -177
  11. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  12. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  13. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  14. package/dist/tf-checkout-react.esm.js +498 -170
  15. package/dist/tf-checkout-react.esm.js.map +1 -1
  16. package/dist/tf-checkout-styles.css +1 -1
  17. package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +7 -0
  18. package/dist/utils/downloadPDF.d.ts +1 -0
  19. package/dist/utils/index.d.ts +2 -0
  20. package/package.json +2 -1
  21. package/src/api/index.ts +9 -0
  22. package/src/components/billing-info-container/index.tsx +25 -27
  23. package/src/components/billing-info-container/utils.ts +2 -1
  24. package/src/components/common/CheckboxField.tsx +19 -8
  25. package/src/components/common/CustomField.tsx +7 -0
  26. package/src/components/common/FormikPhoneNumberField.tsx +11 -1
  27. package/src/components/common/SelectField.tsx +5 -1
  28. package/src/components/countdown/index.tsx +89 -0
  29. package/src/components/countdown/style.css +10 -0
  30. package/src/components/loginModal/index.tsx +2 -0
  31. package/src/components/orderDetailsContainer/ticketsTable.tsx +66 -60
  32. package/src/components/paymentContainer/index.tsx +9 -11
  33. package/src/components/stripePayment/index.tsx +4 -4
  34. package/src/components/ticketsContainer/PromoCodeSection.tsx +3 -2
  35. package/src/components/ticketsContainer/TicketsSection.tsx +10 -6
  36. package/src/components/ticketsContainer/index.tsx +236 -76
  37. package/src/components/ticketsContainer/style.css +7 -0
  38. package/src/components/waitingList/index.tsx +3 -9
  39. package/src/components/waitingList/style.css +4 -2
  40. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +51 -0
  41. package/src/utils/downloadPDF.tsx +22 -0
  42. package/src/utils/index.ts +2 -0
@@ -6,13 +6,14 @@ import TableContainer from '@mui/material/TableContainer'
6
6
  import TableHead from '@mui/material/TableHead'
7
7
  import TableRow from '@mui/material/TableRow'
8
8
  import Paper from '@mui/material/Paper'
9
+ import { downloadPDF } from '../../utils'
9
10
 
10
- interface TicketsTableTypes {
11
- tickets: any[];
11
+ interface IAddOnTypes {
12
+ name: string;
13
+ status: string;
12
14
  }
13
-
14
- interface TicketTypes {
15
- add_ons: any[];
15
+ interface ITicketTypes {
16
+ add_ons?: IAddOnTypes[];
16
17
  hash: string;
17
18
  ticket_type: string;
18
19
  holder_name: string;
@@ -20,67 +21,72 @@ interface TicketTypes {
20
21
  pdf_link: string;
21
22
  }
22
23
 
23
- interface AddOnTypes {
24
- name: string;
25
- status: string;
24
+ interface TicketsTableTypes {
25
+ tickets: ITicketTypes[];
26
26
  }
27
27
 
28
- const TicketsTable = ({ tickets = [] }: TicketsTableTypes) => {
29
- return (
30
- <div className='tickets-box'>
31
- <h4 className='sub-title'>Your Tickets</h4>
32
- <TableContainer component={Paper}>
33
- <Table aria-label="collapsible table">
34
- <TableHead>
35
- <TableRow>
36
- <TableCell>Ticket ID</TableCell>
37
- <TableCell>Ticket Type</TableCell>
38
- <TableCell>Ticket Holder Name</TableCell>
39
- <TableCell>Status</TableCell>
40
- <TableCell>Download</TableCell>
41
- </TableRow>
42
- </TableHead>
43
- <TableBody>
44
- {tickets.map((ticket: TicketTypes, index: number) => (
45
- <Fragment key={index}>
28
+ const TicketsTable = ({ tickets = [] }: TicketsTableTypes) => (
29
+ <div className="tickets-box">
30
+ <h4 className="sub-title">Your Tickets</h4>
31
+ <TableContainer component={Paper}>
32
+ <Table aria-label="collapsible table">
33
+ <TableHead>
34
+ <TableRow>
35
+ <TableCell>Ticket ID</TableCell>
36
+ <TableCell>Ticket Type</TableCell>
37
+ <TableCell>Ticket Holder Name</TableCell>
38
+ <TableCell>Status</TableCell>
39
+ <TableCell>Download</TableCell>
40
+ </TableRow>
41
+ </TableHead>
42
+ <TableBody>
43
+ {tickets.map((ticket: ITicketTypes, index: number) => (
44
+ <Fragment key={index}>
45
+ <TableRow>
46
+ <TableCell>{ticket.hash}</TableCell>
47
+ <TableCell>{ticket.ticket_type}</TableCell>
48
+ <TableCell>{ticket.holder_name}</TableCell>
49
+ <TableCell>{ticket.status}</TableCell>
50
+ <TableCell>
51
+ <span
52
+ aria-hidden={true}
53
+ className="download-button"
54
+ onClick={() => downloadPDF(ticket.pdf_link)}
55
+ >
56
+ Download
57
+ </span>
58
+ </TableCell>
59
+ </TableRow>
60
+ {!!ticket.add_ons?.length && (
46
61
  <TableRow>
47
- <TableCell>{ticket.hash}</TableCell>
48
- <TableCell>{ticket.ticket_type}</TableCell>
49
- <TableCell>{ticket.holder_name}</TableCell>
50
- <TableCell>{ticket.status}</TableCell>
51
- <TableCell>
52
- <a className='download-button' href={ticket.pdf_link} download>Download</a>
53
- </TableCell>
54
- </TableRow>
55
- {!!ticket.add_ons?.length && (
56
- <TableRow>
57
- <TableCell colSpan={5}>
58
- <Table className='ticket-add-on-table'>
59
- <TableHead>
60
- <TableRow>
61
- <TableCell>Add-On</TableCell>
62
- <TableCell>Status</TableCell>
63
- </TableRow>
64
- </TableHead>
65
- <TableBody>
66
- {ticket.add_ons.map((add_on: AddOnTypes, index: number) => (
62
+ <TableCell colSpan={5}>
63
+ <Table className="ticket-add-on-table">
64
+ <TableHead>
65
+ <TableRow>
66
+ <TableCell>Add-On</TableCell>
67
+ <TableCell>Status</TableCell>
68
+ </TableRow>
69
+ </TableHead>
70
+ <TableBody>
71
+ {ticket.add_ons.map(
72
+ (add_on: IAddOnTypes, index: number) => (
67
73
  <TableRow key={index}>
68
74
  <TableCell>{add_on.name}</TableCell>
69
75
  <TableCell>{add_on.status}</TableCell>
70
76
  </TableRow>
71
- ))}
72
- </TableBody>
73
- </Table>
74
- </TableCell>
75
- </TableRow>
76
- )}
77
- </Fragment>
78
- ))}
79
- </TableBody>
80
- </Table>
81
- </TableContainer>
82
- </div>
83
- )
84
- }
77
+ )
78
+ )}
79
+ </TableBody>
80
+ </Table>
81
+ </TableCell>
82
+ </TableRow>
83
+ )}
84
+ </Fragment>
85
+ ))}
86
+ </TableBody>
87
+ </Table>
88
+ </TableContainer>
89
+ </div>
90
+ )
85
91
 
86
92
  export default TicketsTable
@@ -4,7 +4,7 @@ import Container from '@mui/material/Container'
4
4
  import CircularProgress from '@mui/material/CircularProgress'
5
5
  import Alert from '@mui/material/Alert'
6
6
  import { Elements } from '@stripe/react-stripe-js'
7
- import { loadStripe, StripeConstructorOptions } from '@stripe/stripe-js'
7
+ import { loadStripe, StripeConstructorOptions, StripeElementsOptions } from '@stripe/stripe-js'
8
8
  import _map from 'lodash/map'
9
9
  import _get from 'lodash/get'
10
10
  import _identity from 'lodash/identity'
@@ -19,6 +19,8 @@ import { IOrderData, IPaymentField } from '../../types'
19
19
  import { getPaymentData, handlePaymentSuccess, getConditions } from '../../api'
20
20
  import { StripeCardNumberElementOptions } from '@stripe/stripe-js'
21
21
  import { ThemeProvider, createTheme } from '@mui/material/styles'
22
+ import { ThemeOptions } from '@mui/material'
23
+ import { CSSProperties } from "@mui/styles"
22
24
 
23
25
  const publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || ''
24
26
 
@@ -59,7 +61,8 @@ export interface IPaymentPage {
59
61
  onPaymentError: (value: AxiosError) => void;
60
62
  stripeCardOptions?: StripeCardNumberElementOptions;
61
63
  disableZipSection: boolean;
62
- fontFamily?: string;
64
+ themeOptions?: ThemeOptions & { input?: CSSProperties; checkbox?: CSSProperties };
65
+ elementsOptions?: StripeElementsOptions;
63
66
  }
64
67
 
65
68
  const initialOrderValues: IOrderData = {
@@ -92,7 +95,8 @@ export const PaymentContainer = ({
92
95
  onPaymentError = () => {},
93
96
  stripeCardOptions = {},
94
97
  disableZipSection = false,
95
- fontFamily,
98
+ themeOptions,
99
+ elementsOptions
96
100
  }: IPaymentPage) => {
97
101
  const [reviewData, setReviewData] = useState(initialReviewValues)
98
102
  const [orderData, setOrderData] = useState(initialOrderValues)
@@ -184,13 +188,7 @@ export const PaymentContainer = ({
184
188
  }
185
189
  }
186
190
 
187
- const themeMui = createTheme({
188
- typography: {
189
- allVariants: {
190
- fontFamily,
191
- },
192
- },
193
- })
191
+ const themeMui = createTheme(themeOptions)
194
192
 
195
193
  return (
196
194
  <ThemeProvider theme={themeMui}>
@@ -231,7 +229,7 @@ export const PaymentContainer = ({
231
229
  <p className="payment_info__error">{errorText}</p>
232
230
  )}
233
231
  <div>
234
- <Elements stripe={getStripePromise(reviewData)}>
232
+ <Elements stripe={getStripePromise(reviewData)} options={elementsOptions}>
235
233
  <StripePayment
236
234
  stripe_client_secret={_get(
237
235
  reviewData,
@@ -191,7 +191,7 @@ const CheckoutForm = ({
191
191
  <label className="card_number_element">
192
192
  <span className="card_label_text">Card number</span>
193
193
  <CardNumberElement
194
- options={{ ...options.style, ...stripeCardOptions }}
194
+ options={{ ...options, ...stripeCardOptions, }}
195
195
  onReady={_identity}
196
196
  onChange={_identity}
197
197
  onBlur={_identity}
@@ -200,11 +200,11 @@ const CheckoutForm = ({
200
200
  </label>
201
201
  <label className="expiration_element">
202
202
  <span className="card_label_text">Expiration date</span>
203
- <CardExpiryElement options={{ ...options.style, ...stripeCardOptions }} />
203
+ <CardExpiryElement options={{ ...options, ...stripeCardOptions }} />
204
204
  </label>
205
205
  <label className="cvc_element">
206
206
  <span className="card_label_text">CVC</span>
207
- <CardCvcElement options={{ ...options.style, ...stripeCardOptions }} />
207
+ <CardCvcElement options={{ ...options, ...stripeCardOptions }} />
208
208
  </label>
209
209
  {!disableZipSection && (
210
210
  <label className="zip_element">
@@ -239,7 +239,7 @@ const CheckoutForm = ({
239
239
  >
240
240
  <button disabled={buttonIsDiabled} type="submit">
241
241
  {isLoading ? (
242
- <CircularProgress />
242
+ <CircularProgress size={26} />
243
243
  ) : (
244
244
  `Pay ${getCurrencySymbolByCurrency(currency)}${total}`
245
245
  )}
@@ -34,13 +34,14 @@ export const PromoCodeSection = ({
34
34
  src={getImage('done.svg')}
35
35
  preProcessor={(code) => code.replace(/fill=".*?"/g, 'fill="currentColor"')}
36
36
  />
37
- <p>PROMO CODE APPLIED SUCCESSFULLY</p>
37
+ <p className="promo-code-success">PROMO CODE APPLIED SUCCESSFULLY</p>
38
38
  </div>
39
39
  ) : null}
40
40
  {showPromoInput && (
41
41
  <div className="promo-code-block">
42
+ <label>PROMO CODE</label>
42
43
  <input
43
- placeholder="Promo Code"
44
+ placeholder=""
44
45
  onChange={e => {
45
46
  setPromoCode(e.target.value)
46
47
  }}
@@ -66,12 +66,16 @@ export const TicketsSection = ({
66
66
  className="event-detail__tier-state"
67
67
  style={{ minWidth: 55 }}
68
68
  >
69
- <TicketRow
70
- ticketTier={ticket}
71
- prevTicketTier={arr[i - 1]}
72
- selectedTickets={selectedTickets}
73
- handleTicketSelect={ticketSelect}
74
- />
69
+ {ticket.salesStarted ? (
70
+ <TicketRow
71
+ ticketTier={ticket}
72
+ prevTicketTier={arr[i - 1]}
73
+ selectedTickets={selectedTickets}
74
+ handleTicketSelect={ticketSelect}
75
+ />
76
+ ) : (
77
+ <p className='ticket-not-started-message'>Sales not started</p>
78
+ )}
75
79
  </div>
76
80
  </div>
77
81
  </div>