tf-checkout-react 1.0.101 → 1.0.102
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/components/billing-info-container/index.d.ts +3 -1
- package/dist/components/common/SnackbarAlert.d.ts +13 -0
- package/dist/components/confirmationContainer/index.d.ts +2 -1
- package/dist/components/ticketsContainer/index.d.ts +2 -1
- package/dist/env.d.ts +1 -0
- package/dist/images/done.svg +3 -3
- package/dist/tf-checkout-react.cjs.development.js +242 -117
- 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 +243 -118
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/package.json +89 -89
- package/src/.DS_Store +0 -0
- package/src/.d.ts +2 -2
- package/src/api/index.ts +278 -278
- package/src/assets/images/done.svg +3 -3
- package/src/components/.DS_Store +0 -0
- package/src/components/billing-info-container/index.tsx +796 -777
- package/src/components/billing-info-container/style.css +105 -105
- package/src/components/billing-info-container/utils.ts +224 -224
- package/src/components/common/CheckboxField.tsx +41 -41
- package/src/components/common/CustomField.tsx +84 -84
- package/src/components/common/FormikPhoneNumberField.tsx +51 -51
- package/src/components/common/Loader.tsx +9 -9
- package/src/components/common/RadioField.tsx +35 -35
- package/src/components/common/SelectField.tsx +80 -80
- package/src/components/common/SnackbarAlert.tsx +54 -0
- package/src/components/common/index.tsx +4 -4
- package/src/components/confirmModal/index.tsx +51 -51
- package/src/components/confirmModal/style.css +21 -21
- package/src/components/confirmationContainer/config.ts +72 -72
- package/src/components/confirmationContainer/index.tsx +197 -194
- package/src/components/confirmationContainer/social-buttons.tsx +94 -94
- package/src/components/confirmationContainer/style.css +202 -202
- package/src/components/countdown/index.tsx +89 -89
- package/src/components/countdown/style.css +9 -9
- package/src/components/index.ts +7 -7
- package/src/components/loginModal/index.tsx +209 -209
- package/src/components/loginModal/style.css +71 -71
- package/src/components/myTicketsContainer/index.tsx +196 -137
- package/src/components/myTicketsContainer/row.tsx +41 -41
- package/src/components/myTicketsContainer/style.css +39 -39
- package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
- package/src/components/orderDetailsContainer/index.tsx +249 -249
- package/src/components/orderDetailsContainer/style.css +72 -72
- package/src/components/orderDetailsContainer/ticketsTable.tsx +124 -124
- package/src/components/paymentContainer/index.tsx +284 -284
- package/src/components/registerModal/index.tsx +190 -190
- package/src/components/stripePayment/index.tsx +253 -253
- package/src/components/stripePayment/style.css +59 -59
- package/src/components/ticketResale/index.tsx +56 -56
- package/src/components/ticketResaleModal/index.tsx +210 -210
- package/src/components/ticketResaleModal/style.css +28 -28
- package/src/components/ticketsContainer/PromoCodeSection.tsx +99 -99
- package/src/components/ticketsContainer/ReferralLogic.tsx +33 -33
- package/src/components/ticketsContainer/TicketRow.tsx +83 -83
- package/src/components/ticketsContainer/TicketsSection.tsx +81 -81
- package/src/components/ticketsContainer/index.tsx +430 -422
- package/src/components/ticketsContainer/style.css +181 -181
- package/src/components/ticketsContainer/utils.ts +11 -11
- package/src/components/timerWidget/index.tsx +70 -70
- package/src/components/timerWidget/style.css +26 -26
- package/src/components/waitingList/index.tsx +178 -178
- package/src/components/waitingList/style.css +26 -26
- package/src/env.ts +20 -19
- package/src/index.ts +13 -13
- package/src/normalizers/index.ts +45 -45
- package/src/types/billing-info-data.ts +37 -37
- package/src/types/payment-field.ts +7 -7
- package/src/types/referral-promotion.ts +7 -7
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
- package/src/utils/downloadPDF.tsx +30 -30
- package/src/utils/formikErrorFocus.ts +24 -24
- package/src/utils/getImage.ts +14 -14
- package/src/utils/getQueryVariable.ts +13 -13
- package/src/utils/index.ts +5 -5
- package/src/utils/setConfigs.ts +26 -26
- package/src/utils/showZero.tsx +10 -10
- package/src/validators/index.ts +20 -20
package/src/api/index.ts
CHANGED
|
@@ -1,278 +1,278 @@
|
|
|
1
|
-
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'
|
|
2
|
-
import _get from 'lodash/get'
|
|
3
|
-
|
|
4
|
-
import { CONFIGS } from '../utils'
|
|
5
|
-
|
|
6
|
-
const isWindowDefined = typeof window !== 'undefined'
|
|
7
|
-
|
|
8
|
-
const ttfHeaders: { [key: string]: any } = {
|
|
9
|
-
Accept: 'application/vnd.api+json',
|
|
10
|
-
'Content-Type': 'application/vnd.api+json',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
|
|
14
|
-
ttfHeaders['Authorization-Guest'] = localStorage.getItem('auth_guest_token')
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface IPublicRequest extends AxiosInstance {
|
|
18
|
-
setGuestToken: (token: string) => void;
|
|
19
|
-
setAccessToken: (token: string) => void;
|
|
20
|
-
setBaseUrl: (baseUrl: string) => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const publicRequest: IPublicRequest = axios.create({
|
|
24
|
-
baseURL: CONFIGS.BASE_URL || `https://www.ticketfairy.com/api`,
|
|
25
|
-
headers: ttfHeaders,
|
|
26
|
-
}) as IPublicRequest
|
|
27
|
-
|
|
28
|
-
publicRequest.interceptors.response.use(
|
|
29
|
-
response => response,
|
|
30
|
-
error => {
|
|
31
|
-
if (error?.response?.status === 401) {
|
|
32
|
-
if (isWindowDefined) {
|
|
33
|
-
window.localStorage.removeItem('auth_guest_token')
|
|
34
|
-
window.localStorage.removeItem('user_data')
|
|
35
|
-
window.localStorage.removeItem('access_token')
|
|
36
|
-
const errorType = error?.response?.data?.error
|
|
37
|
-
if (errorType === 'invalid_token') {
|
|
38
|
-
window.location.href = '/'
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return Promise.reject(error)
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
publicRequest.interceptors.request.use((config: AxiosRequestConfig) => {
|
|
47
|
-
const guestToken = isWindowDefined
|
|
48
|
-
? window.localStorage.getItem('auth_guest_token')
|
|
49
|
-
: null
|
|
50
|
-
const userData = isWindowDefined
|
|
51
|
-
? window.localStorage.getItem('user_data')
|
|
52
|
-
: null
|
|
53
|
-
const accessToken = isWindowDefined
|
|
54
|
-
? window.localStorage.getItem('access_token')
|
|
55
|
-
: null
|
|
56
|
-
|
|
57
|
-
if (userData && accessToken) {
|
|
58
|
-
const updatedHeaders = {
|
|
59
|
-
...config.headers,
|
|
60
|
-
Authorization: `Bearer ${accessToken}`,
|
|
61
|
-
}
|
|
62
|
-
config.headers = updatedHeaders
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (guestToken) {
|
|
66
|
-
publicRequest.setGuestToken(guestToken)
|
|
67
|
-
const updatedHeaders = {
|
|
68
|
-
...config.headers,
|
|
69
|
-
'Authorization-Guest': guestToken,
|
|
70
|
-
}
|
|
71
|
-
config.headers = updatedHeaders
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (CONFIGS.X_SOURCE_ORIGIN) {
|
|
75
|
-
const updatedHeaders = {
|
|
76
|
-
...config.headers,
|
|
77
|
-
'X-Source-Origin': CONFIGS.X_SOURCE_ORIGIN,
|
|
78
|
-
}
|
|
79
|
-
config.headers = updatedHeaders
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (CONFIGS.BASE_URL) {
|
|
83
|
-
config.baseURL = CONFIGS.BASE_URL + '/api'
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return config
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
publicRequest.setGuestToken = token =>
|
|
90
|
-
(publicRequest.defaults.headers.common['Authorization-Guest'] = token)
|
|
91
|
-
|
|
92
|
-
publicRequest.setBaseUrl = (baseUrl: string) =>
|
|
93
|
-
(publicRequest.defaults.baseURL = baseUrl + '/api')
|
|
94
|
-
|
|
95
|
-
publicRequest.setAccessToken = token =>
|
|
96
|
-
(publicRequest.defaults.headers.common.Authorization = token)
|
|
97
|
-
|
|
98
|
-
export const setXSourceOrigin = (sourceOrigin: string) => {
|
|
99
|
-
ttfHeaders['X-Source-Origin'] = sourceOrigin
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export const setCustomHeader = (response: any) => {
|
|
103
|
-
const guestHeaderResponseValue = _get(response, 'headers.authorization-guest')
|
|
104
|
-
const guestHeaderExistingValue = _get(
|
|
105
|
-
response,
|
|
106
|
-
'config.headers[Authorization-Guest]'
|
|
107
|
-
)
|
|
108
|
-
const guestHeader = guestHeaderResponseValue || guestHeaderExistingValue
|
|
109
|
-
|
|
110
|
-
if (guestHeader) {
|
|
111
|
-
if (isWindowDefined) {
|
|
112
|
-
window.localStorage.setItem('auth_guest_token', guestHeader)
|
|
113
|
-
publicRequest.setGuestToken(guestHeader)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export const handleSetAccessToken = (token: any) => {
|
|
119
|
-
if (token) {
|
|
120
|
-
if (isWindowDefined) {
|
|
121
|
-
window.localStorage.setItem('access_token', token)
|
|
122
|
-
publicRequest.setAccessToken(token)
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export function getEvent(id: string | number) {
|
|
128
|
-
const response = publicRequest
|
|
129
|
-
.get(`v1/event/${id}`, { headers: ttfHeaders })
|
|
130
|
-
.catch(error => {
|
|
131
|
-
throw error
|
|
132
|
-
})
|
|
133
|
-
return response
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export function getTickets(id: string | number, promoCode: string) {
|
|
137
|
-
const response = publicRequest
|
|
138
|
-
.get(`v1/event/${id}/tickets/`, {
|
|
139
|
-
headers: promoCode
|
|
140
|
-
? {
|
|
141
|
-
...ttfHeaders,
|
|
142
|
-
'Promotion-Event': String(id),
|
|
143
|
-
'Promotion-Code': promoCode,
|
|
144
|
-
}
|
|
145
|
-
: { ...ttfHeaders },
|
|
146
|
-
})
|
|
147
|
-
.catch(error => {
|
|
148
|
-
throw error
|
|
149
|
-
})
|
|
150
|
-
return response
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export const addToCart = (id: string | number, data: any) => {
|
|
154
|
-
const res = publicRequest.post(`v1/event/${id}/add-to-cart/`, { data })
|
|
155
|
-
return res
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export const getCart = () => {
|
|
159
|
-
const res = publicRequest.get(`v1/cart/`)
|
|
160
|
-
return res
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export const postOnCheckout = (data: any, accessToken: string) => {
|
|
164
|
-
const res = publicRequest.post(
|
|
165
|
-
`v1/on-checkout/`,
|
|
166
|
-
{ data },
|
|
167
|
-
{
|
|
168
|
-
headers: {
|
|
169
|
-
...ttfHeaders,
|
|
170
|
-
Authorization: `Bearer ${accessToken}`,
|
|
171
|
-
},
|
|
172
|
-
}
|
|
173
|
-
)
|
|
174
|
-
return res
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export const authorize = (data: FormData) =>
|
|
178
|
-
publicRequest.post(
|
|
179
|
-
`v1/oauth/authorize-rn?client_id=${CONFIGS.CLIENT_ID ||
|
|
180
|
-
'e9d8f8922797b4621e562255afe90dbf'}`,
|
|
181
|
-
data
|
|
182
|
-
)
|
|
183
|
-
|
|
184
|
-
export const register = (data: FormData) =>
|
|
185
|
-
publicRequest.post('v1/oauth/register-rn', data)
|
|
186
|
-
|
|
187
|
-
export const getAccessToken = (data: FormData) =>
|
|
188
|
-
publicRequest.post('v1/oauth/access_token', data)
|
|
189
|
-
|
|
190
|
-
export const getPaymentData = (hash: string) => {
|
|
191
|
-
const response = publicRequest
|
|
192
|
-
.get(`v1/order/${hash}/review/`)
|
|
193
|
-
.catch(error => {
|
|
194
|
-
throw error
|
|
195
|
-
})
|
|
196
|
-
return response
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export const handlePaymentData = (orderHash: string, data: any) => {
|
|
200
|
-
const res = publicRequest
|
|
201
|
-
.post(`v1/order/${orderHash}/pay`, {
|
|
202
|
-
data: { attributes: { 'stripe-source': data } },
|
|
203
|
-
})
|
|
204
|
-
.catch(error => {
|
|
205
|
-
throw error
|
|
206
|
-
})
|
|
207
|
-
return res
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export const handlePaymentSuccess = (orderHash: string) => {
|
|
211
|
-
const res = publicRequest
|
|
212
|
-
.post(`v1/order/${orderHash}/success`)
|
|
213
|
-
.catch(error => {
|
|
214
|
-
throw error
|
|
215
|
-
})
|
|
216
|
-
return res
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export const handleFreeSuccess = (orderHash: string) => {
|
|
220
|
-
const res = publicRequest
|
|
221
|
-
.post(`v1/order/${orderHash}/complete_free_registration`)
|
|
222
|
-
.catch(error => {
|
|
223
|
-
throw error
|
|
224
|
-
})
|
|
225
|
-
return res
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export const getProfileData = (accessToken: any) =>
|
|
229
|
-
publicRequest
|
|
230
|
-
.get('/customer/profile/', {
|
|
231
|
-
headers: {
|
|
232
|
-
...ttfHeaders,
|
|
233
|
-
Authorization: `Bearer ${accessToken}`,
|
|
234
|
-
},
|
|
235
|
-
})
|
|
236
|
-
.catch((e: any) => {
|
|
237
|
-
return e
|
|
238
|
-
})
|
|
239
|
-
|
|
240
|
-
export const getCountries = () => publicRequest.get('/countries/')
|
|
241
|
-
|
|
242
|
-
export const getConfirmationData = (orderHash: string) =>
|
|
243
|
-
publicRequest.get(`v1/order/${orderHash}/payment/complete`)
|
|
244
|
-
|
|
245
|
-
export const getStates = (countryId: string) =>
|
|
246
|
-
publicRequest.get(`/countries/${countryId}/states/`)
|
|
247
|
-
|
|
248
|
-
export const getOrders = (page: number, limit: number, eventSlug: string) =>
|
|
249
|
-
publicRequest.get(
|
|
250
|
-
`v1/account/orders/?page=${page}&limit=${limit}&filter[event]=${eventSlug}&filter[brand]=${CONFIGS.BRAND_SLUG}`
|
|
251
|
-
)
|
|
252
|
-
|
|
253
|
-
export const getOrderDetails = (orderId: string) =>
|
|
254
|
-
publicRequest.get(`v1/account/order/${orderId}`)
|
|
255
|
-
|
|
256
|
-
export const addToWaitingList = (id: number, data: any) =>
|
|
257
|
-
publicRequest.post(`v1/event/${id}/add_to_waiting_list`, data)
|
|
258
|
-
|
|
259
|
-
export const getConditions = (eventId: string) =>
|
|
260
|
-
publicRequest.get(`v1/event/${eventId}/conditions`)
|
|
261
|
-
|
|
262
|
-
// resale
|
|
263
|
-
export const resaleTicket = (data: any, hash: string) => {
|
|
264
|
-
return publicRequest.post(`v1/ticket/${hash}/sell`, data)
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export const removeFromResale = (hash: string) => {
|
|
268
|
-
return publicRequest.delete(`v1/ticket/${hash}/sell`)
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export const postReferralVisits = (eventId: string, referralId: string) =>
|
|
272
|
-
publicRequest.post(`v1/event/${eventId}/referrer/`, {
|
|
273
|
-
referrer: `${referralId}`,
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
export const checkTicketStatus = (hash: string) => {
|
|
277
|
-
return publicRequest.post(`v1/ticket/${hash}/status/`)
|
|
278
|
-
}
|
|
1
|
+
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'
|
|
2
|
+
import _get from 'lodash/get'
|
|
3
|
+
|
|
4
|
+
import { CONFIGS } from '../utils'
|
|
5
|
+
|
|
6
|
+
const isWindowDefined = typeof window !== 'undefined'
|
|
7
|
+
|
|
8
|
+
const ttfHeaders: { [key: string]: any } = {
|
|
9
|
+
Accept: 'application/vnd.api+json',
|
|
10
|
+
'Content-Type': 'application/vnd.api+json',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
|
|
14
|
+
ttfHeaders['Authorization-Guest'] = localStorage.getItem('auth_guest_token')
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface IPublicRequest extends AxiosInstance {
|
|
18
|
+
setGuestToken: (token: string) => void;
|
|
19
|
+
setAccessToken: (token: string) => void;
|
|
20
|
+
setBaseUrl: (baseUrl: string) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const publicRequest: IPublicRequest = axios.create({
|
|
24
|
+
baseURL: CONFIGS.BASE_URL || `https://www.ticketfairy.com/api`,
|
|
25
|
+
headers: ttfHeaders,
|
|
26
|
+
}) as IPublicRequest
|
|
27
|
+
|
|
28
|
+
publicRequest.interceptors.response.use(
|
|
29
|
+
response => response,
|
|
30
|
+
error => {
|
|
31
|
+
if (error?.response?.status === 401) {
|
|
32
|
+
if (isWindowDefined) {
|
|
33
|
+
window.localStorage.removeItem('auth_guest_token')
|
|
34
|
+
window.localStorage.removeItem('user_data')
|
|
35
|
+
window.localStorage.removeItem('access_token')
|
|
36
|
+
const errorType = error?.response?.data?.error
|
|
37
|
+
if (errorType === 'invalid_token') {
|
|
38
|
+
window.location.href = '/'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return Promise.reject(error)
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
publicRequest.interceptors.request.use((config: AxiosRequestConfig) => {
|
|
47
|
+
const guestToken = isWindowDefined
|
|
48
|
+
? window.localStorage.getItem('auth_guest_token')
|
|
49
|
+
: null
|
|
50
|
+
const userData = isWindowDefined
|
|
51
|
+
? window.localStorage.getItem('user_data')
|
|
52
|
+
: null
|
|
53
|
+
const accessToken = isWindowDefined
|
|
54
|
+
? window.localStorage.getItem('access_token')
|
|
55
|
+
: null
|
|
56
|
+
|
|
57
|
+
if (userData && accessToken) {
|
|
58
|
+
const updatedHeaders = {
|
|
59
|
+
...config.headers,
|
|
60
|
+
Authorization: `Bearer ${accessToken}`,
|
|
61
|
+
}
|
|
62
|
+
config.headers = updatedHeaders
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (guestToken) {
|
|
66
|
+
publicRequest.setGuestToken(guestToken)
|
|
67
|
+
const updatedHeaders = {
|
|
68
|
+
...config.headers,
|
|
69
|
+
'Authorization-Guest': guestToken,
|
|
70
|
+
}
|
|
71
|
+
config.headers = updatedHeaders
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (CONFIGS.X_SOURCE_ORIGIN) {
|
|
75
|
+
const updatedHeaders = {
|
|
76
|
+
...config.headers,
|
|
77
|
+
'X-Source-Origin': CONFIGS.X_SOURCE_ORIGIN,
|
|
78
|
+
}
|
|
79
|
+
config.headers = updatedHeaders
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (CONFIGS.BASE_URL) {
|
|
83
|
+
config.baseURL = CONFIGS.BASE_URL + '/api'
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return config
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
publicRequest.setGuestToken = token =>
|
|
90
|
+
(publicRequest.defaults.headers.common['Authorization-Guest'] = token)
|
|
91
|
+
|
|
92
|
+
publicRequest.setBaseUrl = (baseUrl: string) =>
|
|
93
|
+
(publicRequest.defaults.baseURL = baseUrl + '/api')
|
|
94
|
+
|
|
95
|
+
publicRequest.setAccessToken = token =>
|
|
96
|
+
(publicRequest.defaults.headers.common.Authorization = token)
|
|
97
|
+
|
|
98
|
+
export const setXSourceOrigin = (sourceOrigin: string) => {
|
|
99
|
+
ttfHeaders['X-Source-Origin'] = sourceOrigin
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const setCustomHeader = (response: any) => {
|
|
103
|
+
const guestHeaderResponseValue = _get(response, 'headers.authorization-guest')
|
|
104
|
+
const guestHeaderExistingValue = _get(
|
|
105
|
+
response,
|
|
106
|
+
'config.headers[Authorization-Guest]'
|
|
107
|
+
)
|
|
108
|
+
const guestHeader = guestHeaderResponseValue || guestHeaderExistingValue
|
|
109
|
+
|
|
110
|
+
if (guestHeader) {
|
|
111
|
+
if (isWindowDefined) {
|
|
112
|
+
window.localStorage.setItem('auth_guest_token', guestHeader)
|
|
113
|
+
publicRequest.setGuestToken(guestHeader)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const handleSetAccessToken = (token: any) => {
|
|
119
|
+
if (token) {
|
|
120
|
+
if (isWindowDefined) {
|
|
121
|
+
window.localStorage.setItem('access_token', token)
|
|
122
|
+
publicRequest.setAccessToken(token)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function getEvent(id: string | number) {
|
|
128
|
+
const response = publicRequest
|
|
129
|
+
.get(`v1/event/${id}`, { headers: ttfHeaders })
|
|
130
|
+
.catch(error => {
|
|
131
|
+
throw error
|
|
132
|
+
})
|
|
133
|
+
return response
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function getTickets(id: string | number, promoCode: string) {
|
|
137
|
+
const response = publicRequest
|
|
138
|
+
.get(`v1/event/${id}/tickets/`, {
|
|
139
|
+
headers: promoCode
|
|
140
|
+
? {
|
|
141
|
+
...ttfHeaders,
|
|
142
|
+
'Promotion-Event': String(id),
|
|
143
|
+
'Promotion-Code': promoCode,
|
|
144
|
+
}
|
|
145
|
+
: { ...ttfHeaders },
|
|
146
|
+
})
|
|
147
|
+
.catch(error => {
|
|
148
|
+
throw error
|
|
149
|
+
})
|
|
150
|
+
return response
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export const addToCart = (id: string | number, data: any) => {
|
|
154
|
+
const res = publicRequest.post(`v1/event/${id}/add-to-cart/`, { data })
|
|
155
|
+
return res
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const getCart = () => {
|
|
159
|
+
const res = publicRequest.get(`v1/cart/`)
|
|
160
|
+
return res
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export const postOnCheckout = (data: any, accessToken: string) => {
|
|
164
|
+
const res = publicRequest.post(
|
|
165
|
+
`v1/on-checkout/`,
|
|
166
|
+
{ data },
|
|
167
|
+
{
|
|
168
|
+
headers: {
|
|
169
|
+
...ttfHeaders,
|
|
170
|
+
Authorization: `Bearer ${accessToken}`,
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
return res
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export const authorize = (data: FormData) =>
|
|
178
|
+
publicRequest.post(
|
|
179
|
+
`v1/oauth/authorize-rn?client_id=${CONFIGS.CLIENT_ID ||
|
|
180
|
+
'e9d8f8922797b4621e562255afe90dbf'}`,
|
|
181
|
+
data
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
export const register = (data: FormData) =>
|
|
185
|
+
publicRequest.post('v1/oauth/register-rn', data)
|
|
186
|
+
|
|
187
|
+
export const getAccessToken = (data: FormData) =>
|
|
188
|
+
publicRequest.post('v1/oauth/access_token', data)
|
|
189
|
+
|
|
190
|
+
export const getPaymentData = (hash: string) => {
|
|
191
|
+
const response = publicRequest
|
|
192
|
+
.get(`v1/order/${hash}/review/`)
|
|
193
|
+
.catch(error => {
|
|
194
|
+
throw error
|
|
195
|
+
})
|
|
196
|
+
return response
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export const handlePaymentData = (orderHash: string, data: any) => {
|
|
200
|
+
const res = publicRequest
|
|
201
|
+
.post(`v1/order/${orderHash}/pay`, {
|
|
202
|
+
data: { attributes: { 'stripe-source': data } },
|
|
203
|
+
})
|
|
204
|
+
.catch(error => {
|
|
205
|
+
throw error
|
|
206
|
+
})
|
|
207
|
+
return res
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export const handlePaymentSuccess = (orderHash: string) => {
|
|
211
|
+
const res = publicRequest
|
|
212
|
+
.post(`v1/order/${orderHash}/success`)
|
|
213
|
+
.catch(error => {
|
|
214
|
+
throw error
|
|
215
|
+
})
|
|
216
|
+
return res
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export const handleFreeSuccess = (orderHash: string) => {
|
|
220
|
+
const res = publicRequest
|
|
221
|
+
.post(`v1/order/${orderHash}/complete_free_registration`)
|
|
222
|
+
.catch(error => {
|
|
223
|
+
throw error
|
|
224
|
+
})
|
|
225
|
+
return res
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export const getProfileData = (accessToken: any) =>
|
|
229
|
+
publicRequest
|
|
230
|
+
.get('/customer/profile/', {
|
|
231
|
+
headers: {
|
|
232
|
+
...ttfHeaders,
|
|
233
|
+
Authorization: `Bearer ${accessToken}`,
|
|
234
|
+
},
|
|
235
|
+
})
|
|
236
|
+
.catch((e: any) => {
|
|
237
|
+
return e
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
export const getCountries = () => publicRequest.get('/countries/')
|
|
241
|
+
|
|
242
|
+
export const getConfirmationData = (orderHash: string) =>
|
|
243
|
+
publicRequest.get(`v1/order/${orderHash}/payment/complete`)
|
|
244
|
+
|
|
245
|
+
export const getStates = (countryId: string) =>
|
|
246
|
+
publicRequest.get(`/countries/${countryId}/states/`)
|
|
247
|
+
|
|
248
|
+
export const getOrders = (page: number, limit: number, eventSlug: string) =>
|
|
249
|
+
publicRequest.get(
|
|
250
|
+
`v1/account/orders/?page=${page}&limit=${limit}&filter[event]=${eventSlug}&filter[brand]=${CONFIGS.BRAND_SLUG}`
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
export const getOrderDetails = (orderId: string) =>
|
|
254
|
+
publicRequest.get(`v1/account/order/${orderId}`)
|
|
255
|
+
|
|
256
|
+
export const addToWaitingList = (id: number, data: any) =>
|
|
257
|
+
publicRequest.post(`v1/event/${id}/add_to_waiting_list`, data)
|
|
258
|
+
|
|
259
|
+
export const getConditions = (eventId: string) =>
|
|
260
|
+
publicRequest.get(`v1/event/${eventId}/conditions`)
|
|
261
|
+
|
|
262
|
+
// resale
|
|
263
|
+
export const resaleTicket = (data: any, hash: string) => {
|
|
264
|
+
return publicRequest.post(`v1/ticket/${hash}/sell`, data)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export const removeFromResale = (hash: string) => {
|
|
268
|
+
return publicRequest.delete(`v1/ticket/${hash}/sell`)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export const postReferralVisits = (eventId: string, referralId: string) =>
|
|
272
|
+
publicRequest.post(`v1/event/${eventId}/referrer/`, {
|
|
273
|
+
referrer: `${referralId}`,
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
export const checkTicketStatus = (hash: string) => {
|
|
277
|
+
return publicRequest.post(`v1/ticket/${hash}/status/`)
|
|
278
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 20C15.5228 20 20 15.5228 20 10C20 4.47717 15.5228 0 10 0C4.47717 0 0 4.47717 0 10C0 15.5228 4.47717 20 10 20ZM8.14661 15.8678L16.8782 6.39722C16.9561 6.31335 17 6.19922 17 6.08008C17 5.96094 16.9561 5.8468 16.8782 5.76282L16.3016 5.12854C16.1386 4.95715 15.8796 4.95715 15.7167 5.12854L7.85004 13.661L4.28326 9.79236C4.20593 9.70776 4.10071 9.66016 3.99084 9.66016C3.9353 9.66016 3.88086 9.67236 3.83069 9.69531C3.78168 9.71777 3.73663 9.75061 3.69843 9.79236L3.12183 10.4177C3.07635 10.4667 3.04248 10.5259 3.02216 10.5905C3.00763 10.6365 3 10.6853 3 10.735C3 10.8541 3.04388 10.9683 3.12183 11.0521L7.56177 15.8678C7.6391 15.9524 7.74438 16 7.85419 16C7.96399 16 8.06927 15.9524 8.14661 15.8678Z" fill="#569F44"/>
|
|
3
|
-
</svg>
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 20C15.5228 20 20 15.5228 20 10C20 4.47717 15.5228 0 10 0C4.47717 0 0 4.47717 0 10C0 15.5228 4.47717 20 10 20ZM8.14661 15.8678L16.8782 6.39722C16.9561 6.31335 17 6.19922 17 6.08008C17 5.96094 16.9561 5.8468 16.8782 5.76282L16.3016 5.12854C16.1386 4.95715 15.8796 4.95715 15.7167 5.12854L7.85004 13.661L4.28326 9.79236C4.20593 9.70776 4.10071 9.66016 3.99084 9.66016C3.9353 9.66016 3.88086 9.67236 3.83069 9.69531C3.78168 9.71777 3.73663 9.75061 3.69843 9.79236L3.12183 10.4177C3.07635 10.4667 3.04248 10.5259 3.02216 10.5905C3.00763 10.6365 3 10.6853 3 10.735C3 10.8541 3.04388 10.9683 3.12183 11.0521L7.56177 15.8678C7.6391 15.9524 7.74438 16 7.85419 16C7.96399 16 8.06927 15.9524 8.14661 15.8678Z" fill="#569F44"/>
|
|
3
|
+
</svg>
|
|
Binary file
|