tf-checkout-react 1.0.100 → 1.0.104

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 (84) hide show
  1. package/dist/components/billing-info-container/index.d.ts +3 -1
  2. package/dist/components/common/RedirectModal.d.ts +7 -0
  3. package/dist/components/common/SnackbarAlert.d.ts +13 -0
  4. package/dist/components/confirmationContainer/index.d.ts +2 -1
  5. package/dist/components/ticketsContainer/index.d.ts +2 -1
  6. package/dist/env.d.ts +1 -0
  7. package/dist/images/done.svg +3 -3
  8. package/dist/index.d.ts +1 -0
  9. package/dist/tf-checkout-react.cjs.development.js +317 -136
  10. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  11. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  12. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  13. package/dist/tf-checkout-react.esm.js +318 -138
  14. package/dist/tf-checkout-react.esm.js.map +1 -1
  15. package/dist/tf-checkout-styles.css +1 -1
  16. package/package.json +89 -89
  17. package/src/.DS_Store +0 -0
  18. package/src/.d.ts +2 -2
  19. package/src/api/index.ts +293 -278
  20. package/src/assets/images/done.svg +3 -3
  21. package/src/components/.DS_Store +0 -0
  22. package/src/components/billing-info-container/index.tsx +796 -777
  23. package/src/components/billing-info-container/style.css +105 -105
  24. package/src/components/billing-info-container/utils.ts +224 -224
  25. package/src/components/common/CheckboxField.tsx +41 -41
  26. package/src/components/common/CustomField.tsx +84 -84
  27. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  28. package/src/components/common/Loader.tsx +9 -9
  29. package/src/components/common/RadioField.tsx +35 -35
  30. package/src/components/common/RedirectModal.tsx +43 -0
  31. package/src/components/common/SelectField.tsx +80 -80
  32. package/src/components/common/SnackbarAlert.tsx +54 -0
  33. package/src/components/common/index.tsx +4 -4
  34. package/src/components/confirmModal/index.tsx +51 -51
  35. package/src/components/confirmModal/style.css +21 -21
  36. package/src/components/confirmationContainer/config.ts +72 -72
  37. package/src/components/confirmationContainer/index.tsx +197 -194
  38. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  39. package/src/components/confirmationContainer/style.css +202 -202
  40. package/src/components/countdown/index.tsx +89 -89
  41. package/src/components/countdown/style.css +9 -9
  42. package/src/components/index.ts +7 -7
  43. package/src/components/loginModal/index.tsx +209 -209
  44. package/src/components/loginModal/style.css +71 -71
  45. package/src/components/myTicketsContainer/index.tsx +196 -137
  46. package/src/components/myTicketsContainer/row.tsx +41 -41
  47. package/src/components/myTicketsContainer/style.css +39 -39
  48. package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
  49. package/src/components/orderDetailsContainer/index.tsx +249 -249
  50. package/src/components/orderDetailsContainer/style.css +72 -72
  51. package/src/components/orderDetailsContainer/ticketsTable.tsx +124 -124
  52. package/src/components/paymentContainer/index.tsx +284 -284
  53. package/src/components/registerModal/index.tsx +190 -190
  54. package/src/components/stripePayment/index.tsx +253 -253
  55. package/src/components/stripePayment/style.css +59 -59
  56. package/src/components/ticketResale/index.tsx +56 -56
  57. package/src/components/ticketResaleModal/index.tsx +210 -210
  58. package/src/components/ticketResaleModal/style.css +28 -28
  59. package/src/components/ticketsContainer/PromoCodeSection.tsx +99 -99
  60. package/src/components/ticketsContainer/ReferralLogic.tsx +33 -33
  61. package/src/components/ticketsContainer/TicketRow.tsx +83 -83
  62. package/src/components/ticketsContainer/TicketsSection.tsx +81 -81
  63. package/src/components/ticketsContainer/index.tsx +427 -409
  64. package/src/components/ticketsContainer/style.css +181 -181
  65. package/src/components/ticketsContainer/utils.ts +11 -11
  66. package/src/components/timerWidget/index.tsx +70 -70
  67. package/src/components/timerWidget/style.css +26 -26
  68. package/src/components/waitingList/index.tsx +178 -178
  69. package/src/components/waitingList/style.css +26 -26
  70. package/src/env.ts +20 -19
  71. package/src/index.ts +14 -13
  72. package/src/normalizers/index.ts +45 -45
  73. package/src/types/billing-info-data.ts +37 -37
  74. package/src/types/payment-field.ts +7 -7
  75. package/src/types/referral-promotion.ts +7 -7
  76. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
  77. package/src/utils/downloadPDF.tsx +30 -30
  78. package/src/utils/formikErrorFocus.ts +24 -24
  79. package/src/utils/getImage.ts +14 -14
  80. package/src/utils/getQueryVariable.ts +13 -13
  81. package/src/utils/index.ts +5 -5
  82. package/src/utils/setConfigs.ts +26 -26
  83. package/src/utils/showZero.tsx +10 -10
  84. package/src/validators/index.ts +20 -20
@@ -1,190 +1,190 @@
1
- import React, { FC } from 'react'
2
- import { AxiosError } from 'axios'
3
- import './style.css'
4
- import { getProfileData, handleSetAccessToken, register } from '../../api'
5
- import { Field, Form, Formik } from 'formik'
6
- import { requiredValidator } from '../../validators'
7
- import { TextField } from '@mui/material'
8
- import _get from 'lodash/get'
9
- import { CONFIGS } from '../../utils'
10
-
11
- interface Props {
12
- onClose: () => void;
13
- onRegister: () => void;
14
- onGetProfileDataSuccess: (res: any) => void;
15
- onGetProfileDataError: (e: AxiosError) => void;
16
- }
17
-
18
- export const RegisterModal: FC<Props> = ({
19
- onClose,
20
- onGetProfileDataSuccess = () => {},
21
- onGetProfileDataError = () => {},
22
- }) => (
23
- <div
24
- style={{
25
- display: 'flex',
26
- position: 'absolute',
27
- top: 0,
28
- bottom: 0,
29
- right: 0,
30
- left: 0,
31
- backgroundColor: 'white',
32
- alignItems: 'center',
33
- justifyContent: 'center',
34
- zIndex: 10,
35
- }}
36
- >
37
- <Formik
38
- initialValues={{
39
- firstName: '',
40
- lastName: '',
41
- email: '',
42
- password: '',
43
- confirmPassword: '',
44
- }}
45
- onSubmit={async ({
46
- firstName,
47
- lastName,
48
- email,
49
- password,
50
- confirmPassword,
51
- }) => {
52
- const bodyFormData = new FormData()
53
- bodyFormData.append('first_name', firstName)
54
- bodyFormData.append('last_name', lastName)
55
- bodyFormData.append('email', email)
56
- bodyFormData.append('password', password)
57
- bodyFormData.append('password_confirmation', confirmPassword)
58
- bodyFormData.append(
59
- 'client_id',
60
- CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'
61
- )
62
- bodyFormData.append(
63
- 'client_secret',
64
- CONFIGS.CLIENT_SECRET ||
65
- 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
66
- )
67
- const resRegister = await register(bodyFormData)
68
- const access_token = _get(
69
- resRegister,
70
- 'data.data.attributes.access_token'
71
- )
72
- handleSetAccessToken(access_token)
73
-
74
- let profileResponse = null
75
-
76
- try {
77
- profileResponse = await getProfileData(access_token)
78
- onGetProfileDataSuccess(profileResponse.data)
79
- } catch (e) {
80
- onGetProfileDataError(e.response)
81
- return
82
- }
83
-
84
- const profileSpecifiedData = _get(profileResponse, 'data.data')
85
- const profileDataObj = {
86
- id: profileSpecifiedData.id,
87
- first_name: profileSpecifiedData.firstName,
88
- last_name: profileSpecifiedData.lastName,
89
- email: profileSpecifiedData.email,
90
- }
91
- if (typeof window !== 'undefined') {
92
- window.localStorage.setItem('access_token', access_token)
93
- window.localStorage.setItem(
94
- 'user_data',
95
- JSON.stringify(profileDataObj)
96
- )
97
- }
98
- onClose()
99
- }}
100
- >
101
- {props => (
102
- <Form onSubmit={props.handleSubmit}>
103
- <div className="register-container">
104
- <div>Create account</div>
105
- <button type="button" onClick={onClose}>
106
- Close
107
- </button>
108
- <div className="register-container__twoFields">
109
- <div className="is-half">
110
- <Field name={'firstName'} validate={requiredValidator()}>
111
- {({ field, meta }: { [key: string]: any }) => (
112
- <TextField
113
- label={'First Name'}
114
- type={'text'}
115
- fullWidth
116
- error={!!meta.error && meta.touched}
117
- helperText={meta.touched && meta.error}
118
- {...field}
119
- />
120
- )}
121
- </Field>
122
- </div>
123
- <div className="is-half">
124
- <Field name={'lastName'} validate={requiredValidator()}>
125
- {({ field, meta }: { [key: string]: any }) => (
126
- <TextField
127
- label={'Last Name'}
128
- type={'text'}
129
- fullWidth
130
- error={!!meta.error && meta.touched}
131
- helperText={meta.touched && meta.error}
132
- {...field}
133
- />
134
- )}
135
- </Field>
136
- </div>
137
- </div>
138
- <div className="register-container__singleField">
139
- <div className="">
140
- <Field name={'email'} validate={requiredValidator()}>
141
- {({ field, meta }: { [key: string]: any }) => (
142
- <TextField
143
- label={'Email'}
144
- type={'email'}
145
- fullWidth
146
- error={!!meta.error && meta.touched}
147
- helperText={meta.touched && meta.error}
148
- {...field}
149
- />
150
- )}
151
- </Field>
152
- </div>
153
- </div>
154
- <div className="register-container__twoFields">
155
- <div className="is-half">
156
- <Field name={'password'} validate={requiredValidator()}>
157
- {({ field, meta }: { [key: string]: any }) => (
158
- <TextField
159
- label={'Password'}
160
- type={'password'}
161
- fullWidth
162
- error={!!meta.error && meta.touched}
163
- helperText={meta.touched && meta.error}
164
- {...field}
165
- />
166
- )}
167
- </Field>
168
- </div>
169
- <div className="is-half">
170
- <Field name={'confirmPassword'} validate={requiredValidator()}>
171
- {({ field, meta }: { [key: string]: any }) => (
172
- <TextField
173
- label={'Confirm Passwod'}
174
- type={'password'}
175
- fullWidth
176
- error={!!meta.error && meta.touched}
177
- helperText={meta.touched && meta.error}
178
- {...field}
179
- />
180
- )}
181
- </Field>
182
- </div>
183
- </div>
184
- </div>
185
- <button type="submit">Submit</button>
186
- </Form>
187
- )}
188
- </Formik>
189
- </div>
190
- )
1
+ import React, { FC } from 'react'
2
+ import { AxiosError } from 'axios'
3
+ import './style.css'
4
+ import { getProfileData, handleSetAccessToken, register } from '../../api'
5
+ import { Field, Form, Formik } from 'formik'
6
+ import { requiredValidator } from '../../validators'
7
+ import { TextField } from '@mui/material'
8
+ import _get from 'lodash/get'
9
+ import { CONFIGS } from '../../utils'
10
+
11
+ interface Props {
12
+ onClose: () => void;
13
+ onRegister: () => void;
14
+ onGetProfileDataSuccess: (res: any) => void;
15
+ onGetProfileDataError: (e: AxiosError) => void;
16
+ }
17
+
18
+ export const RegisterModal: FC<Props> = ({
19
+ onClose,
20
+ onGetProfileDataSuccess = () => {},
21
+ onGetProfileDataError = () => {},
22
+ }) => (
23
+ <div
24
+ style={{
25
+ display: 'flex',
26
+ position: 'absolute',
27
+ top: 0,
28
+ bottom: 0,
29
+ right: 0,
30
+ left: 0,
31
+ backgroundColor: 'white',
32
+ alignItems: 'center',
33
+ justifyContent: 'center',
34
+ zIndex: 10,
35
+ }}
36
+ >
37
+ <Formik
38
+ initialValues={{
39
+ firstName: '',
40
+ lastName: '',
41
+ email: '',
42
+ password: '',
43
+ confirmPassword: '',
44
+ }}
45
+ onSubmit={async ({
46
+ firstName,
47
+ lastName,
48
+ email,
49
+ password,
50
+ confirmPassword,
51
+ }) => {
52
+ const bodyFormData = new FormData()
53
+ bodyFormData.append('first_name', firstName)
54
+ bodyFormData.append('last_name', lastName)
55
+ bodyFormData.append('email', email)
56
+ bodyFormData.append('password', password)
57
+ bodyFormData.append('password_confirmation', confirmPassword)
58
+ bodyFormData.append(
59
+ 'client_id',
60
+ CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'
61
+ )
62
+ bodyFormData.append(
63
+ 'client_secret',
64
+ CONFIGS.CLIENT_SECRET ||
65
+ 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
66
+ )
67
+ const resRegister = await register(bodyFormData)
68
+ const access_token = _get(
69
+ resRegister,
70
+ 'data.data.attributes.access_token'
71
+ )
72
+ handleSetAccessToken(access_token)
73
+
74
+ let profileResponse = null
75
+
76
+ try {
77
+ profileResponse = await getProfileData(access_token)
78
+ onGetProfileDataSuccess(profileResponse.data)
79
+ } catch (e) {
80
+ onGetProfileDataError(e.response)
81
+ return
82
+ }
83
+
84
+ const profileSpecifiedData = _get(profileResponse, 'data.data')
85
+ const profileDataObj = {
86
+ id: profileSpecifiedData.id,
87
+ first_name: profileSpecifiedData.firstName,
88
+ last_name: profileSpecifiedData.lastName,
89
+ email: profileSpecifiedData.email,
90
+ }
91
+ if (typeof window !== 'undefined') {
92
+ window.localStorage.setItem('access_token', access_token)
93
+ window.localStorage.setItem(
94
+ 'user_data',
95
+ JSON.stringify(profileDataObj)
96
+ )
97
+ }
98
+ onClose()
99
+ }}
100
+ >
101
+ {props => (
102
+ <Form onSubmit={props.handleSubmit}>
103
+ <div className="register-container">
104
+ <div>Create account</div>
105
+ <button type="button" onClick={onClose}>
106
+ Close
107
+ </button>
108
+ <div className="register-container__twoFields">
109
+ <div className="is-half">
110
+ <Field name={'firstName'} validate={requiredValidator()}>
111
+ {({ field, meta }: { [key: string]: any }) => (
112
+ <TextField
113
+ label={'First Name'}
114
+ type={'text'}
115
+ fullWidth
116
+ error={!!meta.error && meta.touched}
117
+ helperText={meta.touched && meta.error}
118
+ {...field}
119
+ />
120
+ )}
121
+ </Field>
122
+ </div>
123
+ <div className="is-half">
124
+ <Field name={'lastName'} validate={requiredValidator()}>
125
+ {({ field, meta }: { [key: string]: any }) => (
126
+ <TextField
127
+ label={'Last Name'}
128
+ type={'text'}
129
+ fullWidth
130
+ error={!!meta.error && meta.touched}
131
+ helperText={meta.touched && meta.error}
132
+ {...field}
133
+ />
134
+ )}
135
+ </Field>
136
+ </div>
137
+ </div>
138
+ <div className="register-container__singleField">
139
+ <div className="">
140
+ <Field name={'email'} validate={requiredValidator()}>
141
+ {({ field, meta }: { [key: string]: any }) => (
142
+ <TextField
143
+ label={'Email'}
144
+ type={'email'}
145
+ fullWidth
146
+ error={!!meta.error && meta.touched}
147
+ helperText={meta.touched && meta.error}
148
+ {...field}
149
+ />
150
+ )}
151
+ </Field>
152
+ </div>
153
+ </div>
154
+ <div className="register-container__twoFields">
155
+ <div className="is-half">
156
+ <Field name={'password'} validate={requiredValidator()}>
157
+ {({ field, meta }: { [key: string]: any }) => (
158
+ <TextField
159
+ label={'Password'}
160
+ type={'password'}
161
+ fullWidth
162
+ error={!!meta.error && meta.touched}
163
+ helperText={meta.touched && meta.error}
164
+ {...field}
165
+ />
166
+ )}
167
+ </Field>
168
+ </div>
169
+ <div className="is-half">
170
+ <Field name={'confirmPassword'} validate={requiredValidator()}>
171
+ {({ field, meta }: { [key: string]: any }) => (
172
+ <TextField
173
+ label={'Confirm Passwod'}
174
+ type={'password'}
175
+ fullWidth
176
+ error={!!meta.error && meta.touched}
177
+ helperText={meta.touched && meta.error}
178
+ {...field}
179
+ />
180
+ )}
181
+ </Field>
182
+ </div>
183
+ </div>
184
+ </div>
185
+ <button type="submit">Submit</button>
186
+ </Form>
187
+ )}
188
+ </Formik>
189
+ </div>
190
+ )