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/dist/api/index.d.ts +2 -2
- package/dist/components/billing-info-container/index.d.ts +2 -1
- package/dist/tf-checkout-react.cjs.development.css +1 -1
- package/dist/tf-checkout-react.cjs.development.js +56 -50
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +56 -50
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +6 -20
- package/src/components/billing-info-container/index.tsx +28 -4
- package/src/components/billing-info-container/style.css +2 -0
- package/src/components/loginModal/index.tsx +5 -3
- package/src/components/registerModal/index.tsx +5 -3
package/package.json
CHANGED
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
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
|
-
|
|
138
|
-
|
|
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=
|
|
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
|
-
<
|
|
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
|
)}
|
|
@@ -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
|
-
'
|
|
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
|
-
|
|
77
|
-
|
|
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', '
|
|
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
|
-
|
|
67
|
-
|
|
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
|
>
|