tf-checkout-react 1.0.10 → 1.0.14

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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.10",
2
+ "version": "1.0.14",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
package/src/api/index.ts CHANGED
@@ -4,11 +4,6 @@ import get from 'lodash/get'
4
4
  const ttfHeaders: { [key: string]: any } = {
5
5
  Accept: 'application/vnd.api+json',
6
6
  'Content-Type': 'application/vnd.api+json',
7
- 'X-Source-Origin': 'https://restlessnit.es',
8
- }
9
-
10
- if (process.env.NODE_ENV === 'development') {
11
- ttfHeaders['X-Source-Origin'] = 'https://restlessnit.es'
12
7
  }
13
8
 
14
9
  interface IPublicRequest extends AxiosInstance {
@@ -100,24 +95,16 @@ export const postOnCheckout = (data: any, accessToken: string) => {
100
95
  }
101
96
 
102
97
  export const authorize = (data: FormData) =>
103
- axios({
104
- method: 'post',
105
- url:
106
- 'https://www.ticketfairy.com/api/v1/oauth/authorize-rn?client_id=4792a61f2fcb49197ab4c2d2f44df570',
107
- data,
108
- headers: { 'Content-Type': 'multipart/form-data' },
109
- })
98
+ publicRequest.post(
99
+ '/v1/oauth/authorize-rn?client_id=4792a61f2fcb49197ab4c2d2f44df570',
100
+ data
101
+ )
110
102
 
111
103
  export const register = (data: FormData) =>
112
104
  publicRequest.post('/v1/oauth/register-rn', data)
113
105
 
114
106
  export const getAccessToken = (data: FormData) =>
115
- axios({
116
- method: 'post',
117
- url: 'https://www.ticketfairy.com/api/v1/oauth/access_token',
118
- data,
119
- headers: { 'Content-Type': 'multipart/form-data' },
120
- })
107
+ publicRequest.post('/v1/oauth/access_token', data)
121
108
 
122
109
  export const getPaymentData = (hash: string) => {
123
110
  const response = publicRequest
@@ -139,10 +126,9 @@ export const handlePaymentData = (orderHash: string, data: any) => {
139
126
  return res
140
127
  }
141
128
 
142
- export const getProfileData = (accessToken: any) =>
129
+ export const getProfileData = (accessToken: any) =>
143
130
  publicRequest.get('/customer/profile/', {
144
131
  headers: {
145
132
  Authorization: `Bearer ${accessToken}`,
146
133
  },
147
134
  })
148
-
@@ -8,6 +8,7 @@ import {
8
8
  FormikValues,
9
9
  } from 'formik'
10
10
  import TextField from '@mui/material/TextField'
11
+ import Button from '@mui/material/Button'
11
12
  import _identity from 'lodash/identity'
12
13
  import _map from 'lodash/map'
13
14
  import _get from 'lodash/get'
@@ -29,6 +30,7 @@ export interface IBillingInfoPage {
29
30
 
30
31
  initialValues?: FormikValues;
31
32
  buttonName?: string;
33
+ theme?: 'light' | 'dark'
32
34
  }
33
35
 
34
36
  export const BillingInfoContainer = ({
@@ -36,6 +38,7 @@ export const BillingInfoContainer = ({
36
38
  initialValues = {},
37
39
  buttonName = 'Submit',
38
40
  handleSubmit = _identity,
41
+ theme = 'light'
39
42
  }: IBillingInfoPage) => {
40
43
  const userData =
41
44
  typeof window !== 'undefined' && window.localStorage.getItem('user_data')
@@ -134,8 +137,10 @@ export const BillingInfoContainer = ({
134
137
  last_name: profileSpecifiedData.lastName,
135
138
  email: profileSpecifiedData.email
136
139
  }
137
- localStorage.setItem('access_token', access_token_register)
138
- localStorage.setItem('user_data', JSON.stringify(profileDataObj))
140
+ if (typeof window !== 'undefined') {
141
+ window.localStorage.setItem('access_token', access_token_register)
142
+ window.localStorage.setItem('user_data', JSON.stringify(profileDataObj))
143
+ }
139
144
 
140
145
  const holderAge = new Date(values.holderAge)
141
146
  const res = await postOnCheckout(
@@ -171,7 +176,7 @@ export const BillingInfoContainer = ({
171
176
  >
172
177
  {(props: FormikProps<any>) => (
173
178
  <Form onSubmit={props.handleSubmit}>
174
- <div className="billing-info-container">
179
+ <div className={`billing-info-container ${theme}`}>
175
180
  {!isLoggedIn && (
176
181
  <div className="account-actions-block">
177
182
  <div>Got a Restless Nites account?</div>
@@ -248,6 +253,11 @@ export const BillingInfoContainer = ({
248
253
  fullWidth
249
254
  error={!!meta.error && meta.touched}
250
255
  helperText={meta.touched && meta.error}
256
+ InputLabelProps={
257
+ element.type === 'date'
258
+ ? { shrink: true }
259
+ : {}
260
+ }
251
261
  {...field}
252
262
  />
253
263
  )}
@@ -262,7 +272,21 @@ export const BillingInfoContainer = ({
262
272
  </div>
263
273
  )
264
274
  })}
265
- <button type="submit">{buttonName}</button>
275
+ <div
276
+ style={{
277
+ display: 'flex',
278
+ padding: 20,
279
+ justifyContent: 'center',
280
+ }}
281
+ >
282
+ <Button
283
+ type="submit"
284
+ variant="contained"
285
+ className="login-register-button"
286
+ >
287
+ {buttonName}
288
+ </Button>
289
+ </div>
266
290
  </div>
267
291
  </Form>
268
292
  )}
@@ -24,6 +24,8 @@ button {
24
24
  Ubuntu, Cantarell, Open Sans, Helvetica Neue, Icons16, sans-serif;
25
25
  }
26
26
 
27
+ .MuiButtonBase-root.MuiButton-root,
28
+ .MuiButtonBase-root.MuiButton-root:hover,
27
29
  .login-register-button {
28
30
  width: 49%;
29
31
  margin: 10px 0;
@@ -56,7 +56,7 @@ export const LoginModal: FC<Props> = ({ onClose, onLogin, alreadyHasUser }) => {
56
56
  bodyFormDataToken.append('grant_type', 'authorization_code')
57
57
  bodyFormDataToken.append(
58
58
  'client_id',
59
- '4792a61f2fcb49197ab4c2d2f44df570'
59
+ 'e9d8f8922797b4621e562255afe90dbf'
60
60
  )
61
61
  bodyFormDataToken.append(
62
62
  'client_secret',
@@ -73,8 +73,10 @@ export const LoginModal: FC<Props> = ({ onClose, onLogin, alreadyHasUser }) => {
73
73
  last_name: profileSpecifiedData.lastName,
74
74
  email: profileSpecifiedData.email
75
75
  }
76
- localStorage.setItem('user_data', JSON.stringify(profileDataObj))
77
- localStorage.setItem('access_token', accessToken)
76
+ if (typeof window !== 'undefined') {
77
+ window.localStorage.setItem('user_data', JSON.stringify(profileDataObj))
78
+ window.localStorage.setItem('access_token', accessToken)
79
+ }
78
80
  onLogin()
79
81
  } catch (e) {
80
82
  const error = e.response.data.message || 'Error'
@@ -47,7 +47,7 @@ export const RegisterModal: FC<Props> = ({ onClose }) => (
47
47
  bodyFormData.append('email', email)
48
48
  bodyFormData.append('password', password)
49
49
  bodyFormData.append('password_confirmation', confirmPassword)
50
- bodyFormData.append('client_id', '4792a61f2fcb49197ab4c2d2f44df570')
50
+ bodyFormData.append('client_id', 'e9d8f8922797b4621e562255afe90dbf')
51
51
  bodyFormData.append(
52
52
  'client_secret',
53
53
  'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
@@ -63,8 +63,10 @@ export const RegisterModal: FC<Props> = ({ onClose }) => (
63
63
  last_name: profileSpecifiedData.lastName,
64
64
  email: profileSpecifiedData.email
65
65
  }
66
- localStorage.setItem('access_token', access_token)
67
- localStorage.setItem('user_data', JSON.stringify(profileDataObj))
66
+ if (typeof window !== 'undefined') {
67
+ window.localStorage.setItem('access_token', access_token)
68
+ window.localStorage.setItem('user_data', JSON.stringify(profileDataObj))
69
+ }
68
70
  onClose()
69
71
  }}
70
72
  >