tf-checkout-react 1.0.102 → 1.0.105

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 (80) hide show
  1. package/dist/components/common/RedirectModal.d.ts +7 -0
  2. package/dist/components/ticketsContainer/TicketsSection.d.ts +2 -1
  3. package/dist/components/ticketsContainer/index.d.ts +2 -1
  4. package/dist/images/done.svg +3 -3
  5. package/dist/index.d.ts +1 -0
  6. package/dist/tf-checkout-react.cjs.development.js +71 -25
  7. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  8. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  9. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  10. package/dist/tf-checkout-react.esm.js +71 -26
  11. package/dist/tf-checkout-react.esm.js.map +1 -1
  12. package/package.json +89 -89
  13. package/src/.d.ts +2 -2
  14. package/src/api/index.ts +293 -278
  15. package/src/assets/images/done.svg +3 -3
  16. package/src/components/billing-info-container/index.tsx +796 -796
  17. package/src/components/billing-info-container/style.css +105 -105
  18. package/src/components/billing-info-container/utils.ts +224 -224
  19. package/src/components/common/CheckboxField.tsx +41 -41
  20. package/src/components/common/CustomField.tsx +84 -84
  21. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  22. package/src/components/common/Loader.tsx +9 -9
  23. package/src/components/common/RadioField.tsx +35 -35
  24. package/src/components/common/RedirectModal.tsx +43 -0
  25. package/src/components/common/SelectField.tsx +80 -80
  26. package/src/components/common/SnackbarAlert.tsx +53 -53
  27. package/src/components/common/index.tsx +4 -4
  28. package/src/components/confirmModal/index.tsx +51 -51
  29. package/src/components/confirmModal/style.css +21 -21
  30. package/src/components/confirmationContainer/config.ts +72 -72
  31. package/src/components/confirmationContainer/index.tsx +197 -197
  32. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  33. package/src/components/confirmationContainer/style.css +202 -202
  34. package/src/components/countdown/index.tsx +89 -89
  35. package/src/components/countdown/style.css +9 -9
  36. package/src/components/index.ts +7 -7
  37. package/src/components/loginModal/index.tsx +209 -209
  38. package/src/components/loginModal/style.css +71 -71
  39. package/src/components/myTicketsContainer/index.tsx +196 -196
  40. package/src/components/myTicketsContainer/row.tsx +41 -41
  41. package/src/components/myTicketsContainer/style.css +39 -39
  42. package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
  43. package/src/components/orderDetailsContainer/index.tsx +249 -249
  44. package/src/components/orderDetailsContainer/style.css +72 -72
  45. package/src/components/orderDetailsContainer/ticketsTable.tsx +124 -124
  46. package/src/components/paymentContainer/index.tsx +284 -284
  47. package/src/components/registerModal/index.tsx +190 -190
  48. package/src/components/stripePayment/index.tsx +253 -253
  49. package/src/components/stripePayment/style.css +59 -59
  50. package/src/components/ticketResale/index.tsx +56 -56
  51. package/src/components/ticketResaleModal/index.tsx +210 -210
  52. package/src/components/ticketResaleModal/style.css +28 -28
  53. package/src/components/ticketsContainer/PromoCodeSection.tsx +99 -99
  54. package/src/components/ticketsContainer/ReferralLogic.tsx +33 -33
  55. package/src/components/ticketsContainer/TicketRow.tsx +83 -83
  56. package/src/components/ticketsContainer/TicketsSection.tsx +85 -81
  57. package/src/components/ticketsContainer/index.tsx +430 -430
  58. package/src/components/ticketsContainer/style.css +181 -181
  59. package/src/components/ticketsContainer/utils.ts +11 -11
  60. package/src/components/timerWidget/index.tsx +70 -70
  61. package/src/components/timerWidget/style.css +26 -26
  62. package/src/components/waitingList/index.tsx +178 -178
  63. package/src/components/waitingList/style.css +26 -26
  64. package/src/env.ts +20 -20
  65. package/src/index.ts +14 -13
  66. package/src/normalizers/index.ts +45 -45
  67. package/src/types/billing-info-data.ts +37 -37
  68. package/src/types/payment-field.ts +7 -7
  69. package/src/types/referral-promotion.ts +7 -7
  70. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
  71. package/src/utils/downloadPDF.tsx +30 -30
  72. package/src/utils/formikErrorFocus.ts +24 -24
  73. package/src/utils/getImage.ts +14 -14
  74. package/src/utils/getQueryVariable.ts +13 -13
  75. package/src/utils/index.ts +5 -5
  76. package/src/utils/setConfigs.ts +26 -26
  77. package/src/utils/showZero.tsx +10 -10
  78. package/src/validators/index.ts +20 -20
  79. package/src/.DS_Store +0 -0
  80. package/src/components/.DS_Store +0 -0
@@ -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
  }