tf-checkout-react 1.0.67 → 1.0.71
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 +5 -11
- package/dist/components/confirmationContainer/social-buttons.d.ts +11 -0
- package/dist/components/loginModal/index.d.ts +1 -0
- package/dist/components/waitingList/index.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +348 -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 +350 -170
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/dist/types/referral-promotion.d.ts +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/setConfigs.d.ts +10 -0
- package/package.json +8 -4
- package/src/api/index.ts +59 -35
- package/src/components/billing-info-container/index.tsx +3 -10
- package/src/components/billing-info-container/utils.ts +3 -3
- package/src/components/confirmationContainer/config.ts +72 -0
- package/src/components/confirmationContainer/index.tsx +107 -138
- package/src/components/confirmationContainer/social-buttons.tsx +91 -0
- package/src/components/confirmationContainer/style.css +87 -100
- package/src/components/loginModal/index.tsx +11 -4
- 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/types/referral-promotion.ts +1 -1
- package/src/utils/index.ts +3 -0
- package/src/utils/setConfigs.ts +21 -0
|
@@ -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 {
|
|
@@ -25,6 +25,7 @@ interface Props {
|
|
|
25
25
|
onAuthorizeError?: (e: AxiosError) => void;
|
|
26
26
|
onGetProfileDataSuccess?: (res: any) => void;
|
|
27
27
|
onGetProfileDataError?: (e: AxiosError) => void;
|
|
28
|
+
modalClassname?: string;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
const style: React.CSSProperties = {
|
|
@@ -47,6 +48,7 @@ export const LoginModal: FC<Props> = ({
|
|
|
47
48
|
onAuthorizeError = () => {},
|
|
48
49
|
onGetProfileDataSuccess = () => {},
|
|
49
50
|
onGetProfileDataError = () => {},
|
|
51
|
+
modalClassname = '',
|
|
50
52
|
}) => {
|
|
51
53
|
const [error, setError] = useState('')
|
|
52
54
|
return (
|
|
@@ -55,6 +57,7 @@ export const LoginModal: FC<Props> = ({
|
|
|
55
57
|
onClose={onClose}
|
|
56
58
|
aria-labelledby="modal-modal-title"
|
|
57
59
|
aria-describedby="modal-modal-description"
|
|
60
|
+
className={`login-modal ${modalClassname}`}
|
|
58
61
|
>
|
|
59
62
|
<Box style={style}>
|
|
60
63
|
<div>
|
|
@@ -73,11 +76,11 @@ export const LoginModal: FC<Props> = ({
|
|
|
73
76
|
bodyFormDataToken.append('grant_type', 'authorization_code')
|
|
74
77
|
bodyFormDataToken.append(
|
|
75
78
|
'client_id',
|
|
76
|
-
|
|
79
|
+
CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'
|
|
77
80
|
)
|
|
78
81
|
bodyFormDataToken.append(
|
|
79
82
|
'client_secret',
|
|
80
|
-
|
|
83
|
+
CONFIGS.CLIENT_SECRET ||
|
|
81
84
|
'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
|
|
82
85
|
)
|
|
83
86
|
|
|
@@ -136,7 +139,11 @@ export const LoginModal: FC<Props> = ({
|
|
|
136
139
|
{props => (
|
|
137
140
|
<Form onSubmit={props.handleSubmit}>
|
|
138
141
|
<div className="modal-title">Login</div>
|
|
139
|
-
<img
|
|
142
|
+
<img
|
|
143
|
+
className="login-logo-tff"
|
|
144
|
+
src="https://www.ticketfairy.com/resources/images/logo-ttf-black.svg"
|
|
145
|
+
alt=""
|
|
146
|
+
/>
|
|
140
147
|
<div className="server_auth__error">{error}</div>
|
|
141
148
|
{alreadyHasUser && (
|
|
142
149
|
<p className="info-text-for-login">
|
|
@@ -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,7 +1,7 @@
|
|
|
1
|
-
//
|
|
1
|
+
// preview
|
|
2
2
|
export const ENV_TEST = {
|
|
3
|
-
EVENT_ID:
|
|
4
|
-
BASE_URL: 'https://
|
|
3
|
+
EVENT_ID: 162,
|
|
4
|
+
BASE_URL: 'https://preview.ttf.fluxtech.me/api',
|
|
5
5
|
CLIENT_ID: '4792a61f2fcb49197ab4c2d2f44df570',
|
|
6
6
|
CLIENT_SECRET: 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9',
|
|
7
7
|
STRIPE_PUBLISHABLE_KEY:
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _forEach from 'lodash/forEach'
|
|
2
|
+
import { publicRequest } from '../api'
|
|
3
|
+
|
|
4
|
+
interface IConfigs {
|
|
5
|
+
BASE_URL: string;
|
|
6
|
+
CLIENT_ID: string;
|
|
7
|
+
CLIENT_SECRET: string;
|
|
8
|
+
STRIPE_PUBLISHABLE_KEY: string;
|
|
9
|
+
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const CONFIGS: IConfigs = {} as IConfigs
|
|
14
|
+
|
|
15
|
+
export const setConfigs = (configs: IConfigs) => {
|
|
16
|
+
_forEach(configs, (value, key) => {
|
|
17
|
+
CONFIGS[key] = value
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
publicRequest.setBaseUrl(CONFIGS.BASE_URL)
|
|
21
|
+
}
|