tf-checkout-react 1.0.68 → 1.0.69
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 +1 -0
- package/dist/components/confirmationContainer/config.d.ts +1 -0
- package/dist/components/confirmationContainer/index.d.ts +2 -2
- package/dist/components/waitingList/index.d.ts +2 -1
- package/dist/env.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +254 -167
- 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 +257 -171
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/setConfigs.d.ts +10 -0
- package/package.json +1 -1
- package/src/api/index.ts +56 -31
- package/src/components/billing-info-container/index.tsx +0 -7
- package/src/components/billing-info-container/utils.ts +3 -3
- package/src/components/confirmationContainer/config.ts +72 -0
- package/src/components/confirmationContainer/index.tsx +2 -2
- package/src/components/confirmationContainer/social-buttons.tsx +62 -87
- package/src/components/loginModal/index.tsx +3 -3
- package/src/components/paymentContainer/index.tsx +3 -4
- package/src/components/registerModal/index.tsx +3 -3
- package/src/components/stripePayment/index.tsx +4 -4
- package/src/components/ticketsContainer/index.tsx +1 -3
- package/src/components/waitingList/index.tsx +6 -5
- package/src/env.ts +3 -3
- package/src/index.ts +1 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/setConfigs.ts +21 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface IConfigs {
|
|
2
|
+
BASE_URL: string;
|
|
3
|
+
CLIENT_ID: string;
|
|
4
|
+
CLIENT_SECRET: string;
|
|
5
|
+
STRIPE_PUBLISHABLE_KEY: string;
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const CONFIGS: IConfigs;
|
|
9
|
+
export declare const setConfigs: (configs: IConfigs) => void;
|
|
10
|
+
export {};
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'
|
|
2
2
|
import _get from 'lodash/get'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { CONFIGS } from '../utils'
|
|
5
5
|
|
|
6
6
|
const isWindowDefined = typeof window !== 'undefined'
|
|
7
7
|
const allowedOrigins = [
|
|
8
|
-
'http://localhost',
|
|
8
|
+
'http://localhost',
|
|
9
|
+
'gtsb.io',
|
|
10
|
+
'gatsbyjs.io',
|
|
11
|
+
'https://www.houseofx.nyc',
|
|
12
|
+
'https://tickets-staging.houseofx.nyc',
|
|
9
13
|
]
|
|
10
14
|
const origin = isWindowDefined && window.location.origin
|
|
11
15
|
|
|
@@ -27,23 +31,27 @@ if (
|
|
|
27
31
|
interface IPublicRequest extends AxiosInstance {
|
|
28
32
|
setGuestToken: (token: string) => void;
|
|
29
33
|
setAccessToken: (token: string) => void;
|
|
34
|
+
setBaseUrl: (baseUrl: string) => void;
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
export const publicRequest: IPublicRequest = axios.create({
|
|
33
|
-
baseURL:
|
|
38
|
+
baseURL: CONFIGS.BASE_URL || `https://www.ticketfairy.com/api`,
|
|
34
39
|
headers: ttfHeaders,
|
|
35
40
|
}) as IPublicRequest
|
|
36
41
|
|
|
37
|
-
publicRequest.interceptors.response.use(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
publicRequest.interceptors.response.use(
|
|
43
|
+
response => response,
|
|
44
|
+
error => {
|
|
45
|
+
if (error?.response?.status === 401) {
|
|
46
|
+
if (isWindowDefined) {
|
|
47
|
+
window.localStorage.removeItem('auth_guest_token')
|
|
48
|
+
window.localStorage.removeItem('user_data')
|
|
49
|
+
window.localStorage.removeItem('access_token')
|
|
50
|
+
}
|
|
43
51
|
}
|
|
52
|
+
return Promise.reject(error)
|
|
44
53
|
}
|
|
45
|
-
|
|
46
|
-
})
|
|
54
|
+
)
|
|
47
55
|
|
|
48
56
|
publicRequest.interceptors.request.use((config: AxiosRequestConfig) => {
|
|
49
57
|
const guestToken = isWindowDefined
|
|
@@ -75,7 +83,8 @@ publicRequest.interceptors.request.use((config: AxiosRequestConfig) => {
|
|
|
75
83
|
|
|
76
84
|
if (
|
|
77
85
|
isWindowDefined &&
|
|
78
|
-
!allowedOrigins.some(el => origin && origin.includes(el))
|
|
86
|
+
!allowedOrigins.some(el => origin && origin.includes(el))
|
|
87
|
+
) {
|
|
79
88
|
const updatedHeaders = {
|
|
80
89
|
...config.headers,
|
|
81
90
|
'X-Source-Origin': 'houseofx.nyc',
|
|
@@ -83,12 +92,19 @@ publicRequest.interceptors.request.use((config: AxiosRequestConfig) => {
|
|
|
83
92
|
config.headers = updatedHeaders
|
|
84
93
|
}
|
|
85
94
|
|
|
95
|
+
if (CONFIGS.BASE_URL) {
|
|
96
|
+
config.baseURL = CONFIGS.BASE_URL + '/api'
|
|
97
|
+
}
|
|
98
|
+
|
|
86
99
|
return config
|
|
87
100
|
})
|
|
88
101
|
|
|
89
102
|
publicRequest.setGuestToken = token =>
|
|
90
103
|
(publicRequest.defaults.headers.common['Authorization-Guest'] = token)
|
|
91
104
|
|
|
105
|
+
publicRequest.setBaseUrl = (baseUrl: string) =>
|
|
106
|
+
(publicRequest.defaults.baseURL = baseUrl + '/api')
|
|
107
|
+
|
|
92
108
|
publicRequest.setAccessToken = token =>
|
|
93
109
|
(publicRequest.defaults.headers.common.Authorization = token)
|
|
94
110
|
|
|
@@ -163,7 +179,7 @@ export const postOnCheckout = (data: any, accessToken: string) => {
|
|
|
163
179
|
|
|
164
180
|
export const authorize = (data: FormData) =>
|
|
165
181
|
publicRequest.post(
|
|
166
|
-
`/v1/oauth/authorize-rn?client_id=${
|
|
182
|
+
`/v1/oauth/authorize-rn?client_id=${CONFIGS.CLIENT_ID ||
|
|
167
183
|
'e9d8f8922797b4621e562255afe90dbf'}`,
|
|
168
184
|
data
|
|
169
185
|
)
|
|
@@ -204,30 +220,39 @@ export const handlePaymentSuccess = (orderHash: string) => {
|
|
|
204
220
|
}
|
|
205
221
|
|
|
206
222
|
export const getProfileData = (accessToken: any) =>
|
|
207
|
-
publicRequest
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
223
|
+
publicRequest
|
|
224
|
+
.get('/customer/profile/', {
|
|
225
|
+
headers: {
|
|
226
|
+
...ttfHeaders,
|
|
227
|
+
Authorization: `Bearer ${accessToken}`,
|
|
228
|
+
},
|
|
229
|
+
})
|
|
230
|
+
.catch((e: any) => {
|
|
231
|
+
if (isWindowDefined) {
|
|
232
|
+
const event = new window.CustomEvent('auth_error', e)
|
|
233
|
+
window.document.dispatchEvent(event)
|
|
234
|
+
}
|
|
235
|
+
return e
|
|
236
|
+
})
|
|
219
237
|
|
|
220
238
|
export const getCountries = () => publicRequest.get('/countries/')
|
|
221
239
|
|
|
222
|
-
export const getConfirmationData = (orderHash: string) =>
|
|
240
|
+
export const getConfirmationData = (orderHash: string) =>
|
|
241
|
+
publicRequest.get(`/v1/order/${orderHash}/payment/complete`)
|
|
223
242
|
|
|
224
|
-
export const getStates = (countryId: string) =>
|
|
243
|
+
export const getStates = (countryId: string) =>
|
|
244
|
+
publicRequest.get(`/countries/${countryId}/states/`)
|
|
225
245
|
|
|
226
246
|
export const getOrders = (page: number, limit: number, eventSlug: string) =>
|
|
227
|
-
publicRequest.get(
|
|
247
|
+
publicRequest.get(
|
|
248
|
+
`/v1/account/orders/?page=${page}&limit=${limit}&filter[event]=${eventSlug}`
|
|
249
|
+
)
|
|
228
250
|
|
|
229
|
-
export const getOrderDetails = (orderId: string) =>
|
|
251
|
+
export const getOrderDetails = (orderId: string) =>
|
|
252
|
+
publicRequest.get(`/v1/account/order/${orderId}`)
|
|
230
253
|
|
|
231
|
-
export const addToWaitingList = (id: number, data: any) =>
|
|
254
|
+
export const addToWaitingList = (id: number, data: any) =>
|
|
255
|
+
publicRequest.post(`/v1/event/${id}/add_to_waiting_list`, data)
|
|
232
256
|
|
|
233
|
-
export const getConditions = (eventId: string) =>
|
|
257
|
+
export const getConditions = (eventId: string) =>
|
|
258
|
+
publicRequest.get(`v1/event/${eventId}/conditions`)
|
|
@@ -563,13 +563,6 @@ export const BillingInfoContainer = ({
|
|
|
563
563
|
].includes(element.name) &&
|
|
564
564
|
isLoggedIn ? null : (
|
|
565
565
|
<React.Fragment key={element.uniqueId}>
|
|
566
|
-
{element.name === 'email' ? (
|
|
567
|
-
<div className="email-checking">
|
|
568
|
-
{`IMPORTANT: Please double check that your
|
|
569
|
-
email address is correct. It's where we
|
|
570
|
-
send your confirmation and e-tickets to!`}
|
|
571
|
-
</div>
|
|
572
|
-
) : null}
|
|
573
566
|
<div className={element.className}>
|
|
574
567
|
{element.component ? (
|
|
575
568
|
element.component
|
|
@@ -4,7 +4,7 @@ import _forEach from 'lodash/forEach'
|
|
|
4
4
|
import _flatMapDeep from 'lodash/flatMapDeep'
|
|
5
5
|
import _isArray from 'lodash/isArray'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { CONFIGS } from '../../utils'
|
|
8
8
|
import { IGroupItem } from '../../types'
|
|
9
9
|
import { combineValidators, requiredValidator } from '../../validators'
|
|
10
10
|
import { nanoid } from 'nanoid'
|
|
@@ -56,11 +56,11 @@ export const createRegisterFormData = (
|
|
|
56
56
|
bodyFormData.append('password_confirmation', values.confirmPassword)
|
|
57
57
|
bodyFormData.append(
|
|
58
58
|
'client_id',
|
|
59
|
-
|
|
59
|
+
CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'
|
|
60
60
|
)
|
|
61
61
|
bodyFormData.append(
|
|
62
62
|
'client_secret',
|
|
63
|
-
|
|
63
|
+
CONFIGS.CLIENT_SECRET || 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
|
|
64
64
|
)
|
|
65
65
|
|
|
66
66
|
_forEach(checkoutBody.attributes, (item: any, key: string) => {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FacebookShareButton,
|
|
3
|
+
FacebookMessengerShareButton,
|
|
4
|
+
TwitterShareButton,
|
|
5
|
+
LinkedinShareButton,
|
|
6
|
+
PinterestShareButton,
|
|
7
|
+
VKShareButton,
|
|
8
|
+
OKShareButton,
|
|
9
|
+
TelegramShareButton,
|
|
10
|
+
WhatsappShareButton,
|
|
11
|
+
RedditShareButton,
|
|
12
|
+
TumblrShareButton,
|
|
13
|
+
MailruShareButton,
|
|
14
|
+
EmailShareButton,
|
|
15
|
+
LivejournalShareButton,
|
|
16
|
+
ViberShareButton,
|
|
17
|
+
WorkplaceShareButton,
|
|
18
|
+
LineShareButton,
|
|
19
|
+
PocketShareButton,
|
|
20
|
+
InstapaperShareButton,
|
|
21
|
+
WeiboShareButton,
|
|
22
|
+
HatenaShareButton,
|
|
23
|
+
FacebookIcon,
|
|
24
|
+
FacebookMessengerIcon,
|
|
25
|
+
TwitterIcon,
|
|
26
|
+
LinkedinIcon,
|
|
27
|
+
PinterestIcon,
|
|
28
|
+
VKIcon,
|
|
29
|
+
OKIcon,
|
|
30
|
+
TelegramIcon,
|
|
31
|
+
WhatsappIcon,
|
|
32
|
+
RedditIcon,
|
|
33
|
+
TumblrIcon,
|
|
34
|
+
MailruIcon,
|
|
35
|
+
EmailIcon,
|
|
36
|
+
LivejournalIcon,
|
|
37
|
+
ViberIcon,
|
|
38
|
+
WorkplaceIcon,
|
|
39
|
+
LineIcon,
|
|
40
|
+
PocketIcon,
|
|
41
|
+
InstapaperIcon,
|
|
42
|
+
WeiboIcon,
|
|
43
|
+
HatenaIcon,
|
|
44
|
+
} from 'react-share'
|
|
45
|
+
|
|
46
|
+
const config: any = {
|
|
47
|
+
facebook: { component: FacebookShareButton, icon: FacebookIcon },
|
|
48
|
+
messenger: { component: FacebookMessengerShareButton, icon: FacebookMessengerIcon },
|
|
49
|
+
twitter: { component: TwitterShareButton, icon: TwitterIcon },
|
|
50
|
+
linkedin: { component: LinkedinShareButton, icon: LinkedinIcon },
|
|
51
|
+
pinterest: { component: PinterestShareButton, icon: PinterestIcon },
|
|
52
|
+
vk: { component: VKShareButton, icon: VKIcon },
|
|
53
|
+
ok: { component: OKShareButton, icon: OKIcon },
|
|
54
|
+
telegram: { component: TelegramShareButton, icon: TelegramIcon },
|
|
55
|
+
whatsapp: { component: WhatsappShareButton, icon: WhatsappIcon },
|
|
56
|
+
reddit: { component: RedditShareButton, icon: RedditIcon },
|
|
57
|
+
tumblr: { component: TumblrShareButton, icon: TumblrIcon },
|
|
58
|
+
mailru: { component: MailruShareButton, icon: MailruIcon },
|
|
59
|
+
email: { component: EmailShareButton, icon: EmailIcon },
|
|
60
|
+
livejournal: { component: LivejournalShareButton, icon: LivejournalIcon },
|
|
61
|
+
viber: { component: ViberShareButton, icon: ViberIcon },
|
|
62
|
+
workplace: { component: WorkplaceShareButton, icon: WorkplaceIcon },
|
|
63
|
+
line: { component: LineShareButton, icon: LineIcon },
|
|
64
|
+
pocket: { component: PocketShareButton, icon: PocketIcon },
|
|
65
|
+
instapaper: { component: InstapaperShareButton, icon: InstapaperIcon },
|
|
66
|
+
weibo: { component: WeiboShareButton, icon: WeiboIcon },
|
|
67
|
+
hatena: { component: HatenaShareButton, icon: HatenaIcon },
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default function (key: string) {
|
|
71
|
+
return config[key]
|
|
72
|
+
}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import SVG from 'react-inlinesvg'
|
|
3
|
-
import { getImage } from '../../utils/getImage'
|
|
4
2
|
import { IShareButton } from'./index'
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
3
|
+
import config from './config'
|
|
4
|
+
|
|
5
|
+
const SocialComponent = ({ mainLabel, subLabel, platform, shareData }: IShareButton) => {
|
|
6
|
+
const Component = config(platform)?.component
|
|
7
|
+
const Icon = config(platform)?.icon
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
{Component && (
|
|
12
|
+
<Component {...shareData}>
|
|
13
|
+
<div className='social-media-sharing'>
|
|
14
|
+
<div className='share-icon'>
|
|
15
|
+
<Icon size={32} round />
|
|
16
|
+
</div>
|
|
17
|
+
<span className="share-text">
|
|
18
|
+
{mainLabel}
|
|
19
|
+
<br /> {subLabel}
|
|
20
|
+
</span>
|
|
21
|
+
</div>
|
|
22
|
+
</Component>
|
|
23
|
+
)}
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
15
27
|
|
|
16
28
|
interface SocialButtonsTypes {
|
|
17
29
|
shareLink: string;
|
|
@@ -30,83 +42,46 @@ const SocialButtons = ({ showDefaultShareButtons, shareLink, name, appId, shareB
|
|
|
30
42
|
<div className="social-media-btns">
|
|
31
43
|
{showDefaultShareButtons && (
|
|
32
44
|
<>
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<span className="share-text">
|
|
70
|
-
Message friends on
|
|
71
|
-
<br /> Facebook
|
|
72
|
-
</span>
|
|
73
|
-
</div>
|
|
74
|
-
</FacebookMessengerShareButton>
|
|
75
|
-
<WhatsappShareButton
|
|
76
|
-
url={shareLink}
|
|
77
|
-
title={name}
|
|
78
|
-
>
|
|
79
|
-
<div className='social-media-sharing'>
|
|
80
|
-
<div className='share-icon'>
|
|
81
|
-
<WhatsappIcon size={32} round />
|
|
82
|
-
</div>
|
|
83
|
-
<span className="share-text">
|
|
84
|
-
Message friends on
|
|
85
|
-
<br /> Whatsapp
|
|
86
|
-
</span>
|
|
87
|
-
</div>
|
|
88
|
-
</WhatsappShareButton>
|
|
45
|
+
<SocialComponent
|
|
46
|
+
mainLabel='Share on'
|
|
47
|
+
subLabel='Facebook'
|
|
48
|
+
platform='facebook'
|
|
49
|
+
shareData={{
|
|
50
|
+
quote: name,
|
|
51
|
+
url: shareLink
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
<SocialComponent
|
|
55
|
+
mainLabel='Tweet to your'
|
|
56
|
+
subLabel='Followers'
|
|
57
|
+
platform='twitter'
|
|
58
|
+
shareData={{
|
|
59
|
+
title: name,
|
|
60
|
+
url: shareLink
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
<SocialComponent
|
|
64
|
+
mainLabel='Message friends on'
|
|
65
|
+
subLabel='Facebook'
|
|
66
|
+
platform='messenger'
|
|
67
|
+
shareData={{
|
|
68
|
+
appId: appId,
|
|
69
|
+
url: shareLink
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
<SocialComponent
|
|
73
|
+
mainLabel='Message friends on'
|
|
74
|
+
subLabel='Whatsapp'
|
|
75
|
+
platform='whatsapp'
|
|
76
|
+
shareData={{
|
|
77
|
+
title: name,
|
|
78
|
+
url: shareLink
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
89
81
|
</>
|
|
90
82
|
)}
|
|
91
|
-
{shareButtons.map((shareButton, index) => (
|
|
92
|
-
<
|
|
93
|
-
<a href={shareButton.link} target="_blank" rel="noopener noreferrer">
|
|
94
|
-
<div className='social-media-sharing'>
|
|
95
|
-
<div className='share-icon'>
|
|
96
|
-
<SVG
|
|
97
|
-
width='32px'
|
|
98
|
-
height='32px'
|
|
99
|
-
fill='#FFF'
|
|
100
|
-
src={getImage(shareButton.icon)}
|
|
101
|
-
/>
|
|
102
|
-
</div>
|
|
103
|
-
<span className="share-text">
|
|
104
|
-
{shareButton.mainLabel}
|
|
105
|
-
<br /> {shareButton.subLabel}
|
|
106
|
-
</span>
|
|
107
|
-
</div>
|
|
108
|
-
</a>
|
|
109
|
-
</div>
|
|
83
|
+
{shareButtons.map((shareButton: IShareButton, index: number) => (
|
|
84
|
+
<SocialComponent key={index} {...shareButton} />
|
|
110
85
|
))}
|
|
111
86
|
</div>
|
|
112
87
|
</>
|
|
@@ -13,7 +13,7 @@ import { TextField } from '@mui/material'
|
|
|
13
13
|
import Modal from '@mui/material/Modal'
|
|
14
14
|
import Box from '@mui/material/Box'
|
|
15
15
|
import './style.css'
|
|
16
|
-
import {
|
|
16
|
+
import { CONFIGS } from '../../utils'
|
|
17
17
|
import axios from 'axios'
|
|
18
18
|
|
|
19
19
|
interface Props {
|
|
@@ -76,11 +76,11 @@ export const LoginModal: FC<Props> = ({
|
|
|
76
76
|
bodyFormDataToken.append('grant_type', 'authorization_code')
|
|
77
77
|
bodyFormDataToken.append(
|
|
78
78
|
'client_id',
|
|
79
|
-
|
|
79
|
+
CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'
|
|
80
80
|
)
|
|
81
81
|
bodyFormDataToken.append(
|
|
82
82
|
'client_secret',
|
|
83
|
-
|
|
83
|
+
CONFIGS.CLIENT_SECRET ||
|
|
84
84
|
'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
|
|
85
85
|
)
|
|
86
86
|
|
|
@@ -7,7 +7,7 @@ import { loadStripe } from '@stripe/stripe-js'
|
|
|
7
7
|
import _map from 'lodash/map'
|
|
8
8
|
import _get from 'lodash/get'
|
|
9
9
|
import _identity from 'lodash/identity'
|
|
10
|
-
import {
|
|
10
|
+
import { CONFIGS } from '../../utils'
|
|
11
11
|
import { nanoid } from 'nanoid'
|
|
12
12
|
import { getQueryVariable } from '../../utils/getQueryVariable'
|
|
13
13
|
|
|
@@ -19,10 +19,9 @@ import { getPaymentData, handlePaymentSuccess, getConditions } from '../../api'
|
|
|
19
19
|
import { StripeCardNumberElementOptions } from '@stripe/stripe-js'
|
|
20
20
|
import { ThemeProvider, createTheme } from '@mui/material/styles'
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || 'pk_test_3Ov1P1oP33A1cxaSjxWE0VjT'
|
|
23
23
|
const stripePromise = loadStripe(
|
|
24
|
-
|
|
25
|
-
// 'pk_live_51JucaXAnOd2Grid07FqHOkqcoh90bbCYL5bG7OuyM5RtzUoolrFcHroCWici0G9w0YpqO7qsGz6WP7K6HHYw1yhz00cm7fj5n5'
|
|
24
|
+
publishableKey
|
|
26
25
|
)
|
|
27
26
|
export interface IPaymentPage {
|
|
28
27
|
paymentFields: IPaymentField[];
|
|
@@ -6,7 +6,7 @@ import { Field, Form, Formik } from 'formik'
|
|
|
6
6
|
import { requiredValidator } from '../../validators'
|
|
7
7
|
import { TextField } from '@mui/material'
|
|
8
8
|
import _get from 'lodash/get'
|
|
9
|
-
import {
|
|
9
|
+
import { CONFIGS } from '../../utils'
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
12
|
onClose: () => void;
|
|
@@ -57,11 +57,11 @@ export const RegisterModal: FC<Props> = ({
|
|
|
57
57
|
bodyFormData.append('password_confirmation', confirmPassword)
|
|
58
58
|
bodyFormData.append(
|
|
59
59
|
'client_id',
|
|
60
|
-
|
|
60
|
+
CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'
|
|
61
61
|
)
|
|
62
62
|
bodyFormData.append(
|
|
63
63
|
'client_secret',
|
|
64
|
-
|
|
64
|
+
CONFIGS.CLIENT_SECRET ||
|
|
65
65
|
'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
|
|
66
66
|
)
|
|
67
67
|
const resRegister = await register(bodyFormData)
|
|
@@ -168,10 +168,12 @@ const CheckoutForm = ({
|
|
|
168
168
|
(item: any) => item?.checked === true
|
|
169
169
|
)
|
|
170
170
|
setAllowSubmit(allChecked)
|
|
171
|
+
} else {
|
|
172
|
+
setAllowSubmit(true)
|
|
171
173
|
}
|
|
172
174
|
}, [checkboxes])
|
|
173
175
|
|
|
174
|
-
const buttonIsDiabled = !stripe || !!error || isLoading
|
|
176
|
+
const buttonIsDiabled = !stripe || !!error || isLoading || !allowSubmit
|
|
175
177
|
|
|
176
178
|
return (
|
|
177
179
|
<div className="stripe_payment_container">
|
|
@@ -225,9 +227,7 @@ const CheckoutForm = ({
|
|
|
225
227
|
</div>
|
|
226
228
|
))}
|
|
227
229
|
<div
|
|
228
|
-
className={`payment_button ${
|
|
229
|
-
buttonIsDiabled || !allowSubmit ? 'disabled-payment-button' : ''
|
|
230
|
-
}`}
|
|
230
|
+
className={`payment_button ${buttonIsDiabled ? 'disabled-payment-button' : ''}`}
|
|
231
231
|
>
|
|
232
232
|
<button disabled={buttonIsDiabled} type="submit">
|
|
233
233
|
{isLoading ? (
|
|
@@ -7,8 +7,6 @@ import _get from 'lodash/get'
|
|
|
7
7
|
import _some from 'lodash/some'
|
|
8
8
|
import _find from 'lodash/find'
|
|
9
9
|
import _isEmpty from 'lodash/isEmpty'
|
|
10
|
-
import _filter from 'lodash/filter'
|
|
11
|
-
import _isObject from 'lodash/isObject'
|
|
12
10
|
import CircularProgress from '@mui/material/CircularProgress'
|
|
13
11
|
import Button from 'react-bootstrap/Button'
|
|
14
12
|
import jwt_decode from 'jwt-decode'
|
|
@@ -185,7 +183,7 @@ export const TicketsContainer = ({
|
|
|
185
183
|
) : (
|
|
186
184
|
<>
|
|
187
185
|
{showWaitingList ? (
|
|
188
|
-
<WaitingList tickets={tickets} />
|
|
186
|
+
<WaitingList tickets={tickets} eventId={eventId} />
|
|
189
187
|
) : (
|
|
190
188
|
<div>
|
|
191
189
|
<TicketsSection
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
requiredValidator,
|
|
10
10
|
emailValidator,
|
|
11
11
|
} from '../../validators'
|
|
12
|
-
import { ENV } from '../../env'
|
|
13
12
|
import { ErrorFocus } from '../../utils/formikErrorFocus'
|
|
14
13
|
|
|
15
14
|
import './style.css'
|
|
16
15
|
|
|
17
16
|
interface WaitingListProps {
|
|
18
17
|
tickets: any;
|
|
18
|
+
eventId: number;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
interface WaitingListFields {
|
|
@@ -34,7 +34,7 @@ const generateQuantity = (n: number) => {
|
|
|
34
34
|
return quantityList
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const WaitingList = ({ tickets = {} }: WaitingListProps) => {
|
|
37
|
+
const WaitingList = ({ tickets = {}, eventId }: WaitingListProps) => {
|
|
38
38
|
const [showSuccessMessage, setShowSuccessMessage] = useState(false)
|
|
39
39
|
const [loading, setLoading] = useState(false)
|
|
40
40
|
const ticketTypesList = Object.values(tickets).map((d: any) => ({
|
|
@@ -47,13 +47,12 @@ const WaitingList = ({ tickets = {} }: WaitingListProps) => {
|
|
|
47
47
|
const handleSubmit = async (values: WaitingListFields) => {
|
|
48
48
|
try {
|
|
49
49
|
setLoading(true)
|
|
50
|
-
const id = ENV.EVENT_ID
|
|
51
50
|
const requestData = {
|
|
52
51
|
data: {
|
|
53
52
|
attributes: values,
|
|
54
53
|
},
|
|
55
54
|
}
|
|
56
|
-
const { data } = await addToWaitingList(
|
|
55
|
+
const { data } = await addToWaitingList(eventId, requestData)
|
|
57
56
|
|
|
58
57
|
if (data.success) {
|
|
59
58
|
setShowSuccessMessage(true)
|
|
@@ -73,7 +72,9 @@ const WaitingList = ({ tickets = {} }: WaitingListProps) => {
|
|
|
73
72
|
</div>
|
|
74
73
|
) : (
|
|
75
74
|
<>
|
|
76
|
-
<p className="no-tickets-text">
|
|
75
|
+
<p className="no-tickets-text">
|
|
76
|
+
No tickets are currently available for this event.
|
|
77
|
+
</p>
|
|
77
78
|
<h2>WAITING LIST</h2>
|
|
78
79
|
<Formik
|
|
79
80
|
initialValues={{
|
package/src/env.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// preview
|
|
2
|
-
export const
|
|
3
|
-
EVENT_ID:
|
|
2
|
+
export const ENV_TEST = {
|
|
3
|
+
EVENT_ID: 162,
|
|
4
4
|
BASE_URL: 'https://preview.ttf.fluxtech.me/api',
|
|
5
5
|
CLIENT_ID: '4792a61f2fcb49197ab4c2d2f44df570',
|
|
6
6
|
CLIENT_SECRET: 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9',
|
|
@@ -9,7 +9,7 @@ export const ENV = {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// prod
|
|
12
|
-
export const
|
|
12
|
+
export const ENV = {
|
|
13
13
|
EVENT_ID: 9766,
|
|
14
14
|
BASE_URL: 'https://www.ticketfairy.com/api',
|
|
15
15
|
CLIENT_ID: 'e9d8f8922797b4621e562255afe90dbf',
|
package/src/index.ts
CHANGED