tf-checkout-react 1.0.103 → 1.0.106

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 (96) hide show
  1. package/dist/api/index.d.ts +3 -1
  2. package/dist/components/common/CustomField.d.ts +1 -1
  3. package/dist/components/common/DatePickerField.d.ts +14 -0
  4. package/dist/components/common/RedirectModal.d.ts +7 -0
  5. package/dist/components/countdown/index.d.ts +3 -1
  6. package/dist/components/orderDetailsContainer/ticketsTable.d.ts +2 -0
  7. package/dist/components/rsvpContainer/index.d.ts +7 -0
  8. package/dist/components/ticketResale/index.d.ts +5 -3
  9. package/dist/components/ticketsContainer/AccessCodeSection.d.ts +7 -0
  10. package/dist/components/ticketsContainer/PromoCodeSection.d.ts +5 -9
  11. package/dist/components/ticketsContainer/TicketsSection.d.ts +6 -3
  12. package/dist/components/ticketsContainer/index.d.ts +9 -2
  13. package/dist/components/timerWidget/index.d.ts +3 -3
  14. package/dist/images/cross.svg +44 -0
  15. package/dist/images/done.svg +3 -3
  16. package/dist/index.d.ts +2 -0
  17. package/dist/tf-checkout-react.cjs.development.js +639 -223
  18. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  19. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  20. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  21. package/dist/tf-checkout-react.esm.js +645 -231
  22. package/dist/tf-checkout-react.esm.js.map +1 -1
  23. package/dist/tf-checkout-styles.css +1 -1
  24. package/package.json +89 -89
  25. package/src/.DS_Store +0 -0
  26. package/src/.d.ts +2 -2
  27. package/src/api/index.ts +300 -278
  28. package/src/assets/images/cross.svg +44 -0
  29. package/src/assets/images/done.svg +3 -3
  30. package/src/components/.DS_Store +0 -0
  31. package/src/components/billing-info-container/index.tsx +811 -799
  32. package/src/components/billing-info-container/style.css +105 -105
  33. package/src/components/billing-info-container/utils.ts +225 -224
  34. package/src/components/common/CheckboxField.tsx +41 -41
  35. package/src/components/common/CustomField.tsx +87 -84
  36. package/src/components/common/DatePickerField.tsx +98 -0
  37. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  38. package/src/components/common/Loader.tsx +9 -9
  39. package/src/components/common/RadioField.tsx +35 -35
  40. package/src/components/common/RedirectModal.tsx +43 -0
  41. package/src/components/common/SelectField.tsx +80 -80
  42. package/src/components/common/SnackbarAlert.tsx +53 -53
  43. package/src/components/common/index.tsx +4 -4
  44. package/src/components/confirmModal/index.tsx +51 -51
  45. package/src/components/confirmModal/style.css +21 -21
  46. package/src/components/confirmationContainer/config.ts +72 -72
  47. package/src/components/confirmationContainer/index.tsx +197 -197
  48. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  49. package/src/components/confirmationContainer/style.css +202 -202
  50. package/src/components/countdown/index.tsx +98 -89
  51. package/src/components/countdown/style.css +9 -9
  52. package/src/components/index.ts +7 -7
  53. package/src/components/loginModal/index.tsx +209 -209
  54. package/src/components/loginModal/style.css +71 -71
  55. package/src/components/myTicketsContainer/index.tsx +196 -196
  56. package/src/components/myTicketsContainer/row.tsx +41 -41
  57. package/src/components/myTicketsContainer/style.css +39 -39
  58. package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
  59. package/src/components/orderDetailsContainer/index.tsx +252 -249
  60. package/src/components/orderDetailsContainer/style.css +72 -72
  61. package/src/components/orderDetailsContainer/ticketsTable.tsx +130 -124
  62. package/src/components/paymentContainer/index.tsx +285 -284
  63. package/src/components/registerModal/index.tsx +190 -190
  64. package/src/components/rsvpContainer/index.tsx +126 -0
  65. package/src/components/stripePayment/index.tsx +254 -253
  66. package/src/components/stripePayment/style.css +59 -59
  67. package/src/components/ticketResale/index.tsx +74 -56
  68. package/src/components/ticketResaleModal/index.tsx +215 -210
  69. package/src/components/ticketResaleModal/style.css +28 -28
  70. package/src/components/ticketsContainer/AccessCodeSection.tsx +50 -0
  71. package/src/components/ticketsContainer/PromoCodeSection.tsx +88 -99
  72. package/src/components/ticketsContainer/ReferralLogic.tsx +31 -33
  73. package/src/components/ticketsContainer/TicketRow.tsx +83 -83
  74. package/src/components/ticketsContainer/TicketsSection.tsx +90 -81
  75. package/src/components/ticketsContainer/index.tsx +464 -430
  76. package/src/components/ticketsContainer/style.css +181 -181
  77. package/src/components/ticketsContainer/utils.ts +11 -11
  78. package/src/components/timerWidget/index.tsx +87 -70
  79. package/src/components/timerWidget/style.css +34 -26
  80. package/src/components/waitingList/index.tsx +178 -178
  81. package/src/components/waitingList/style.css +26 -26
  82. package/src/env.ts +20 -20
  83. package/src/index.ts +15 -13
  84. package/src/normalizers/index.ts +45 -45
  85. package/src/types/billing-info-data.ts +37 -37
  86. package/src/types/payment-field.ts +7 -7
  87. package/src/types/referral-promotion.ts +7 -7
  88. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
  89. package/src/utils/downloadPDF.tsx +30 -30
  90. package/src/utils/formikErrorFocus.ts +24 -24
  91. package/src/utils/getImage.ts +14 -14
  92. package/src/utils/getQueryVariable.ts +13 -13
  93. package/src/utils/index.ts +5 -5
  94. package/src/utils/setConfigs.ts +26 -26
  95. package/src/utils/showZero.tsx +10 -10
  96. package/src/validators/index.ts +20 -20
@@ -1,209 +1,209 @@
1
- import React, { FC, useState } from 'react'
2
- import { AxiosError } from 'axios'
3
- import {
4
- authorize,
5
- getAccessToken,
6
- getProfileData,
7
- handleSetAccessToken,
8
- } from '../../api'
9
- import _get from 'lodash/get'
10
- import { Field, Form, Formik } from 'formik'
11
- import { requiredValidator } from '../../validators'
12
- import { TextField } from '@mui/material'
13
- import Modal from '@mui/material/Modal'
14
- import Box from '@mui/material/Box'
15
- import './style.css'
16
- import { CONFIGS } from '../../utils'
17
- import axios from 'axios'
18
-
19
- interface Props {
20
- onClose: () => void;
21
- onLogin: () => void;
22
- alreadyHasUser?: boolean;
23
- userExpired?: boolean;
24
- onAuthorizeSuccess?: (res: any) => void;
25
- onAuthorizeError?: (e: AxiosError) => void;
26
- onGetProfileDataSuccess?: (res: any) => void;
27
- onGetProfileDataError?: (e: AxiosError) => void;
28
- modalClassname?: string;
29
- }
30
-
31
- const style: React.CSSProperties = {
32
- position: 'absolute',
33
- top: '50%',
34
- left: '50%',
35
- transform: 'translate(-50%, -50%)',
36
- minWidth: 480,
37
- backgroundColor: '#e3e3e3',
38
- border: '1px solid white',
39
- outline: 'none',
40
- }
41
-
42
- export const LoginModal: FC<Props> = ({
43
- onClose,
44
- onLogin,
45
- alreadyHasUser = false,
46
- userExpired = false,
47
- onAuthorizeSuccess = () => {},
48
- onAuthorizeError = () => {},
49
- onGetProfileDataSuccess = () => {},
50
- onGetProfileDataError = () => {},
51
- modalClassname = '',
52
- }) => {
53
- const [error, setError] = useState('')
54
- const handleForgotPassword = () => {
55
- if (typeof window !== 'undefined') {
56
- window.open(`${CONFIGS.BASE_URL}/password-restore/`)
57
- }
58
- }
59
- return (
60
- <Modal
61
- open={true}
62
- onClose={onClose}
63
- aria-labelledby="modal-modal-title"
64
- aria-describedby="modal-modal-description"
65
- className={`login-modal ${modalClassname}`}
66
- >
67
- <Box style={style}>
68
- <div>
69
- <Formik
70
- initialValues={{ email: '', password: '' }}
71
- onSubmit={async ({ email, password }) => {
72
- try {
73
- const bodyFormData = new FormData()
74
- bodyFormData.append('email', email)
75
- bodyFormData.append('password', password)
76
-
77
- const resAutorize = await authorize(bodyFormData)
78
- const bodyFormDataToken = new FormData()
79
- bodyFormDataToken.append('code', resAutorize.data.data.code)
80
- bodyFormDataToken.append('scope', 'profile')
81
- bodyFormDataToken.append('grant_type', 'authorization_code')
82
- bodyFormDataToken.append(
83
- 'client_id',
84
- CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'
85
- )
86
- bodyFormDataToken.append(
87
- 'client_secret',
88
- CONFIGS.CLIENT_SECRET ||
89
- 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
90
- )
91
-
92
- let resAccessToken = null
93
-
94
- try {
95
- resAccessToken = await getAccessToken(bodyFormDataToken)
96
- onAuthorizeSuccess(resAccessToken.data)
97
- } catch (e) {
98
- if (axios.isAxiosError(e)) {
99
- onAuthorizeError(e)
100
- }
101
- return
102
- }
103
-
104
- const accessToken = _get(resAccessToken, 'data.access_token')
105
- handleSetAccessToken(accessToken)
106
-
107
- let profileResponse = null
108
-
109
- try {
110
- profileResponse = await getProfileData(accessToken)
111
- onGetProfileDataSuccess(profileResponse.data)
112
- } catch (e) {
113
- if (axios.isAxiosError(e)) {
114
- onGetProfileDataError(e)
115
- }
116
- return
117
- }
118
-
119
- const profileSpecifiedData = _get(profileResponse, 'data.data')
120
- const profileDataObj = {
121
- id: profileSpecifiedData.id,
122
- first_name: profileSpecifiedData.firstName,
123
- last_name: profileSpecifiedData.lastName,
124
- email: profileSpecifiedData.email,
125
- }
126
- if (typeof window !== 'undefined') {
127
- window.localStorage.setItem(
128
- 'user_data',
129
- JSON.stringify(profileDataObj)
130
- )
131
- window.localStorage.setItem('access_token', accessToken)
132
- const event = new window.CustomEvent('tf-login')
133
- window.document.dispatchEvent(event)
134
- }
135
- onLogin()
136
- } catch (e) {
137
- if (axios.isAxiosError(e)) {
138
- const error = e?.response?.data?.message || 'Error'
139
- setError(error)
140
- } else if (e instanceof Error) {
141
- setError(e?.message || 'Error')
142
- }
143
- }
144
- }}
145
- >
146
- {props => (
147
- <Form onSubmit={props.handleSubmit}>
148
- <div className="modal-title">Login</div>
149
- <img
150
- className="login-logo-tff"
151
- src="https://www.ticketfairy.com/resources/images/logo-ttf-black.svg"
152
- alt=""
153
- />
154
- <div className="server_auth__error">{error}</div>
155
- {alreadyHasUser && (
156
- <p className="info-text-for-login">
157
- It appears this email is already attached to an account.
158
- Please log in here to complete your registration.
159
- </p>
160
- )}
161
- {userExpired && (
162
- <p className="info-text-for-login">
163
- Your session has expired, please log in again.
164
- </p>
165
- )}
166
- <div className="login-modal-body">
167
- <div className="login-modal-body__email">
168
- <Field name={'email'} validate={requiredValidator}>
169
- {({ field, meta }: { [key: string]: any }) => (
170
- <TextField
171
- label={'Email'}
172
- type={'email'}
173
- fullWidth
174
- error={!!meta.error && meta.touched}
175
- helperText={meta.touched && meta.error}
176
- {...field}
177
- />
178
- )}
179
- </Field>
180
- </div>
181
- <div className="login-modal-body__password">
182
- <Field name={'password'} validate={requiredValidator}>
183
- {({ field, meta }: { [key: string]: any }) => (
184
- <TextField
185
- label="Password"
186
- type="password"
187
- fullWidth
188
- error={!!meta.error && meta.touched}
189
- helperText={meta.touched && meta.error}
190
- {...field}
191
- />
192
- )}
193
- </Field>
194
- </div>
195
- <div className="login-action-button">
196
- <button type="submit">Login</button>
197
- </div>
198
- <div className='forgot-password'>
199
- <span onClick={handleForgotPassword}>Forgot password?</span>
200
- </div>
201
- </div>
202
- </Form>
203
- )}
204
- </Formik>
205
- </div>
206
- </Box>
207
- </Modal>
208
- )
209
- }
1
+ import React, { FC, useState } from 'react'
2
+ import { AxiosError } from 'axios'
3
+ import {
4
+ authorize,
5
+ getAccessToken,
6
+ getProfileData,
7
+ handleSetAccessToken,
8
+ } from '../../api'
9
+ import _get from 'lodash/get'
10
+ import { Field, Form, Formik } from 'formik'
11
+ import { requiredValidator } from '../../validators'
12
+ import { TextField } from '@mui/material'
13
+ import Modal from '@mui/material/Modal'
14
+ import Box from '@mui/material/Box'
15
+ import './style.css'
16
+ import { CONFIGS } from '../../utils'
17
+ import axios from 'axios'
18
+
19
+ interface Props {
20
+ onClose: () => void;
21
+ onLogin: () => void;
22
+ alreadyHasUser?: boolean;
23
+ userExpired?: boolean;
24
+ onAuthorizeSuccess?: (res: any) => void;
25
+ onAuthorizeError?: (e: AxiosError) => void;
26
+ onGetProfileDataSuccess?: (res: any) => void;
27
+ onGetProfileDataError?: (e: AxiosError) => void;
28
+ modalClassname?: string;
29
+ }
30
+
31
+ const style: React.CSSProperties = {
32
+ position: 'absolute',
33
+ top: '50%',
34
+ left: '50%',
35
+ transform: 'translate(-50%, -50%)',
36
+ minWidth: 480,
37
+ backgroundColor: '#e3e3e3',
38
+ border: '1px solid white',
39
+ outline: 'none',
40
+ }
41
+
42
+ export const LoginModal: FC<Props> = ({
43
+ onClose,
44
+ onLogin,
45
+ alreadyHasUser = false,
46
+ userExpired = false,
47
+ onAuthorizeSuccess = () => {},
48
+ onAuthorizeError = () => {},
49
+ onGetProfileDataSuccess = () => {},
50
+ onGetProfileDataError = () => {},
51
+ modalClassname = '',
52
+ }) => {
53
+ const [error, setError] = useState('')
54
+ const handleForgotPassword = () => {
55
+ if (typeof window !== 'undefined') {
56
+ window.open(`${CONFIGS.BASE_URL}/password-restore/`)
57
+ }
58
+ }
59
+ return (
60
+ <Modal
61
+ open={true}
62
+ onClose={onClose}
63
+ aria-labelledby="modal-modal-title"
64
+ aria-describedby="modal-modal-description"
65
+ className={`login-modal ${modalClassname}`}
66
+ >
67
+ <Box style={style}>
68
+ <div>
69
+ <Formik
70
+ initialValues={{ email: '', password: '' }}
71
+ onSubmit={async ({ email, password }) => {
72
+ try {
73
+ const bodyFormData = new FormData()
74
+ bodyFormData.append('email', email)
75
+ bodyFormData.append('password', password)
76
+
77
+ const resAutorize = await authorize(bodyFormData)
78
+ const bodyFormDataToken = new FormData()
79
+ bodyFormDataToken.append('code', resAutorize.data.data.code)
80
+ bodyFormDataToken.append('scope', 'profile')
81
+ bodyFormDataToken.append('grant_type', 'authorization_code')
82
+ bodyFormDataToken.append(
83
+ 'client_id',
84
+ CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'
85
+ )
86
+ bodyFormDataToken.append(
87
+ 'client_secret',
88
+ CONFIGS.CLIENT_SECRET ||
89
+ 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
90
+ )
91
+
92
+ let resAccessToken = null
93
+
94
+ try {
95
+ resAccessToken = await getAccessToken(bodyFormDataToken)
96
+ onAuthorizeSuccess(resAccessToken.data)
97
+ } catch (e) {
98
+ if (axios.isAxiosError(e)) {
99
+ onAuthorizeError(e)
100
+ }
101
+ return
102
+ }
103
+
104
+ const accessToken = _get(resAccessToken, 'data.access_token')
105
+ handleSetAccessToken(accessToken)
106
+
107
+ let profileResponse = null
108
+
109
+ try {
110
+ profileResponse = await getProfileData(accessToken)
111
+ onGetProfileDataSuccess(profileResponse.data)
112
+ } catch (e) {
113
+ if (axios.isAxiosError(e)) {
114
+ onGetProfileDataError(e)
115
+ }
116
+ return
117
+ }
118
+
119
+ const profileSpecifiedData = _get(profileResponse, 'data.data')
120
+ const profileDataObj = {
121
+ id: profileSpecifiedData.id,
122
+ first_name: profileSpecifiedData.firstName,
123
+ last_name: profileSpecifiedData.lastName,
124
+ email: profileSpecifiedData.email,
125
+ }
126
+ if (typeof window !== 'undefined') {
127
+ window.localStorage.setItem(
128
+ 'user_data',
129
+ JSON.stringify(profileDataObj)
130
+ )
131
+ window.localStorage.setItem('access_token', accessToken)
132
+ const event = new window.CustomEvent('tf-login')
133
+ window.document.dispatchEvent(event)
134
+ }
135
+ onLogin()
136
+ } catch (e) {
137
+ if (axios.isAxiosError(e)) {
138
+ const error = e?.response?.data?.message || 'Error'
139
+ setError(error)
140
+ } else if (e instanceof Error) {
141
+ setError(e?.message || 'Error')
142
+ }
143
+ }
144
+ }}
145
+ >
146
+ {props => (
147
+ <Form onSubmit={props.handleSubmit}>
148
+ <div className="modal-title">Login</div>
149
+ <img
150
+ className="login-logo-tff"
151
+ src="https://www.ticketfairy.com/resources/images/logo-ttf-black.svg"
152
+ alt=""
153
+ />
154
+ <div className="server_auth__error">{error}</div>
155
+ {alreadyHasUser && (
156
+ <p className="info-text-for-login">
157
+ It appears this email is already attached to an account.
158
+ Please log in here to complete your registration.
159
+ </p>
160
+ )}
161
+ {userExpired && (
162
+ <p className="info-text-for-login">
163
+ Your session has expired, please log in again.
164
+ </p>
165
+ )}
166
+ <div className="login-modal-body">
167
+ <div className="login-modal-body__email">
168
+ <Field name={'email'} validate={requiredValidator}>
169
+ {({ field, meta }: { [key: string]: any }) => (
170
+ <TextField
171
+ label={'Email'}
172
+ type={'email'}
173
+ fullWidth
174
+ error={!!meta.error && meta.touched}
175
+ helperText={meta.touched && meta.error}
176
+ {...field}
177
+ />
178
+ )}
179
+ </Field>
180
+ </div>
181
+ <div className="login-modal-body__password">
182
+ <Field name={'password'} validate={requiredValidator}>
183
+ {({ field, meta }: { [key: string]: any }) => (
184
+ <TextField
185
+ label="Password"
186
+ type="password"
187
+ fullWidth
188
+ error={!!meta.error && meta.touched}
189
+ helperText={meta.touched && meta.error}
190
+ {...field}
191
+ />
192
+ )}
193
+ </Field>
194
+ </div>
195
+ <div className="login-action-button">
196
+ <button type="submit">Login</button>
197
+ </div>
198
+ <div className='forgot-password'>
199
+ <span onClick={handleForgotPassword}>Forgot password?</span>
200
+ </div>
201
+ </div>
202
+ </Form>
203
+ )}
204
+ </Formik>
205
+ </div>
206
+ </Box>
207
+ </Modal>
208
+ )
209
+ }
@@ -1,72 +1,72 @@
1
- .modal-title {
2
- padding-left: 25px;
3
- background-color: #fff;
4
- height: 49px;
5
- display: flex;
6
- align-items: center;
7
- font-family: Inter;
8
- font-weight: 700;
9
- font-size: 18px;
10
- line-height: 22px;
11
- position: relative;
12
- }
13
-
14
- .login-modal-body {
15
- padding: 15px 25px;
16
- }
17
-
18
- .login-modal-body input {
19
- background: white !important;
20
- }
21
-
22
- .login-modal-body__email {
23
- margin-bottom: 20px;
24
- }
25
-
26
- .login-modal-body__password {
27
- margin-bottom: 20px;
28
- }
29
-
30
- .login-action-button button {
31
- padding: 10px;
32
- width: 100%;
33
- margin: 10px 0;
34
- border: none;
35
- border-radius: 0;
36
- height: 45px;
37
- font-weight: 600;
38
- font-size: 26px;
39
- line-height: 18px;
40
- color: white;
41
- cursor: pointer;
42
- outline: none;
43
- background-color: #212529;
44
- }
45
- .login-action-button button:hover {
46
- background-color: #505050;
47
- border-color: #505050;
48
- }
49
-
50
- .server_auth__error {
51
- color: red;
52
- padding-left: 25px;
53
- padding-top: 15px;
54
- font-size: 12px;
55
- font-family: Inter;
56
- font-style: normal;
57
- }
58
-
59
- .info-text-for-login {
60
- font-size: 14px;
61
- padding-left: 10px;
62
- margin-bottom: 4px;
63
- }
64
- .forgot-password {
65
- text-align: center;
66
- }
67
- .forgot-password span {
68
- cursor: pointer;
69
- }
70
- .forgot-password span:hover {
71
- text-decoration: underline;
1
+ .modal-title {
2
+ padding-left: 25px;
3
+ background-color: #fff;
4
+ height: 49px;
5
+ display: flex;
6
+ align-items: center;
7
+ font-family: Inter;
8
+ font-weight: 700;
9
+ font-size: 18px;
10
+ line-height: 22px;
11
+ position: relative;
12
+ }
13
+
14
+ .login-modal-body {
15
+ padding: 15px 25px;
16
+ }
17
+
18
+ .login-modal-body input {
19
+ background: white !important;
20
+ }
21
+
22
+ .login-modal-body__email {
23
+ margin-bottom: 20px;
24
+ }
25
+
26
+ .login-modal-body__password {
27
+ margin-bottom: 20px;
28
+ }
29
+
30
+ .login-action-button button {
31
+ padding: 10px;
32
+ width: 100%;
33
+ margin: 10px 0;
34
+ border: none;
35
+ border-radius: 0;
36
+ height: 45px;
37
+ font-weight: 600;
38
+ font-size: 26px;
39
+ line-height: 18px;
40
+ color: white;
41
+ cursor: pointer;
42
+ outline: none;
43
+ background-color: #212529;
44
+ }
45
+ .login-action-button button:hover {
46
+ background-color: #505050;
47
+ border-color: #505050;
48
+ }
49
+
50
+ .server_auth__error {
51
+ color: red;
52
+ padding-left: 25px;
53
+ padding-top: 15px;
54
+ font-size: 12px;
55
+ font-family: Inter;
56
+ font-style: normal;
57
+ }
58
+
59
+ .info-text-for-login {
60
+ font-size: 14px;
61
+ padding-left: 10px;
62
+ margin-bottom: 4px;
63
+ }
64
+ .forgot-password {
65
+ text-align: center;
66
+ }
67
+ .forgot-password span {
68
+ cursor: pointer;
69
+ }
70
+ .forgot-password span:hover {
71
+ text-decoration: underline;
72
72
  }