tf-checkout-react 1.7.7-beta.9 → 1.7.8
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/payment.d.ts +1 -3
- package/dist/components/confirmationContainer/index.d.ts +0 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/paymentContainer/index.d.ts +6 -20
- package/dist/constants/index.d.ts +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/tf-checkout-react.cjs.development.js +380 -693
- 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 +382 -694
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -8
- package/src/api/payment.ts +1 -17
- package/src/components/billing-info-container/index.tsx +67 -166
- package/src/components/confirmationContainer/index.tsx +0 -1
- package/src/components/index.ts +0 -1
- package/src/components/paymentContainer/OrderDetails.tsx +20 -0
- package/src/components/paymentContainer/index.tsx +81 -146
- package/src/components/ticketsContainer/TicketsSection.tsx +52 -10
- package/src/components/ticketsContainer/TimeSlotTicketRow.tsx +24 -5
- package/src/constants/index.ts +1 -1
- package/src/index.ts +0 -1
- package/src/types/api/checkout.d.ts +16 -27
- package/src/types/api/common.d.ts +3 -0
- package/src/types/api/payment.d.ts +1 -32
- package/dist/components/process-redirect-container/index.d.ts +0 -18
- package/src/components/process-redirect-container/index.tsx +0 -180
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.7.
|
|
2
|
+
"version": "1.7.8",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"@types/react-dom": "^17.0.11",
|
|
62
62
|
"@typescript-eslint/eslint-plugin": "^5.48.1",
|
|
63
63
|
"@typescript-eslint/parser": "^5.52.0",
|
|
64
|
-
"buffer": "^5.7.1",
|
|
65
64
|
"eslint": "^8.34.0",
|
|
66
65
|
"eslint-config-react-app": "^7.0.1",
|
|
67
66
|
"eslint-plugin-flowtype": "^8.0.3",
|
|
@@ -89,7 +88,6 @@
|
|
|
89
88
|
"@emotion/react": "^11.7.0",
|
|
90
89
|
"@emotion/styled": "^11.6.0",
|
|
91
90
|
"@fortawesome/fontawesome-svg-core": "^6.1.1",
|
|
92
|
-
"@mercadopago/sdk-react": "^1.0.7",
|
|
93
91
|
"@mui/icons-material": "^5.18.0",
|
|
94
92
|
"@mui/material": "^5.2.2",
|
|
95
93
|
"@mui/private-theming": "^5.11.1",
|
|
@@ -100,14 +98,12 @@
|
|
|
100
98
|
"axios": "^1.9.0",
|
|
101
99
|
"clsx": "^1.1.1",
|
|
102
100
|
"formik": "^2.2.9",
|
|
103
|
-
"install": "^0.13.0",
|
|
104
101
|
"jwt-decode": "^3.1.2",
|
|
105
102
|
"lodash": "^4.17.21",
|
|
106
103
|
"lodash-es": "^4.17.21",
|
|
107
104
|
"material-ui-phone-number": "^3.0.0",
|
|
108
105
|
"moment-timezone": "^0.5.34",
|
|
109
106
|
"nanoid": "^3.1.30",
|
|
110
|
-
"npm": "^11.9.0",
|
|
111
107
|
"prop-types": "^15.7.2",
|
|
112
108
|
"react-app-polyfill": "^1.0.0",
|
|
113
109
|
"react-bootstrap": "^2.0.2",
|
|
@@ -119,8 +115,5 @@
|
|
|
119
115
|
"rollup-plugin-svg": "^2.0.0",
|
|
120
116
|
"tf-seat-map-view": "9.4.7-beta.33",
|
|
121
117
|
"yup": "^0.32.11"
|
|
122
|
-
},
|
|
123
|
-
"optionalDependencies": {
|
|
124
|
-
"lightningcss-darwin-x64": "^1.18.0"
|
|
125
118
|
}
|
|
126
119
|
}
|
package/src/api/payment.ts
CHANGED
|
@@ -4,16 +4,8 @@ import { nanoid } from 'nanoid'
|
|
|
4
4
|
|
|
5
5
|
import { isBrowser } from '../utils'
|
|
6
6
|
import { publicRequest } from './publicRequest'
|
|
7
|
-
import {
|
|
8
|
-
ICheckoutCompleteDataResponse,
|
|
9
|
-
ICheckoutProcessPaymentData,
|
|
10
|
-
ICheckoutProcessPaymentResponse, IConditionsAdaptedData, IConditionsAdaptedDataResponse, IConditionsDataResponse,
|
|
11
|
-
IFreeRegistrationDataResponse,
|
|
12
|
-
IPaymentDataResponse,
|
|
13
|
-
IPaymentSuccessDataResponse,
|
|
14
|
-
} from '../types/api/payment'
|
|
15
7
|
|
|
16
|
-
export const getPaymentData = async (hash: string): Promise<IPaymentDataResponse
|
|
8
|
+
export const getPaymentData = async (hash: string): Promise<IPaymentDataResponse> => {
|
|
17
9
|
const response: AxiosResponse<IPaymentDataResponse, AxiosRequestConfig> =
|
|
18
10
|
await publicRequest.get(`v1/order/${hash}/review`, {
|
|
19
11
|
headers: { 'Referer-Url': isBrowser ? document.referrer : '' },
|
|
@@ -83,11 +75,3 @@ export const getConditions = async (
|
|
|
83
75
|
|
|
84
76
|
return returnData.data
|
|
85
77
|
}
|
|
86
|
-
|
|
87
|
-
export const processPayment = async (orderHash: string, params: any): Promise<ICheckoutProcessPaymentData> => {
|
|
88
|
-
const queryParams = new URLSearchParams(params)
|
|
89
|
-
const response: AxiosResponse<ICheckoutProcessPaymentResponse, AxiosRequestConfig> =
|
|
90
|
-
await publicRequest.post(`v1/order/${orderHash}/process_payment?${queryParams.toString()}`)
|
|
91
|
-
|
|
92
|
-
return response.data.data.attributes;
|
|
93
|
-
}
|
|
@@ -6,9 +6,9 @@ import Backdrop from '@mui/material/Backdrop'
|
|
|
6
6
|
import Button from '@mui/material/Button'
|
|
7
7
|
import { createTheme, ThemeProvider } from '@mui/material/styles'
|
|
8
8
|
import { CSSProperties } from '@mui/styles'
|
|
9
|
-
import { Stripe } from '@stripe/stripe-js'
|
|
9
|
+
import { Stripe, StripeElementsOptions } from '@stripe/stripe-js'
|
|
10
10
|
import axios, { AxiosError } from 'axios'
|
|
11
|
-
import {
|
|
11
|
+
import { Field, Form, Formik, FormikHelpers, FormikProps, FormikValues } from 'formik'
|
|
12
12
|
import _find from 'lodash/find'
|
|
13
13
|
import _forEach from 'lodash/forEach'
|
|
14
14
|
import _get from 'lodash/get'
|
|
@@ -35,11 +35,7 @@ import { updateCheckout } from '../../api/checkout'
|
|
|
35
35
|
import { withCustomFields } from '../../hoc'
|
|
36
36
|
import { usePixel } from '../../hooks/usePixel'
|
|
37
37
|
import { IBillingInfoData } from '../../types'
|
|
38
|
-
import {
|
|
39
|
-
ICheckoutMercadoPagoAdditionalData,
|
|
40
|
-
ICheckoutResponseData,
|
|
41
|
-
ICheckoutStripeAdditionalData,
|
|
42
|
-
} from '../../types/api/checkout'
|
|
38
|
+
import { ICheckoutResponseData } from '../../types/api/checkout'
|
|
43
39
|
import {
|
|
44
40
|
createCheckoutDataBodyWithDefaultHolder,
|
|
45
41
|
deleteCookieByName,
|
|
@@ -55,14 +51,7 @@ import SnackbarAlert from '../common/SnackbarAlert'
|
|
|
55
51
|
import { ForgotPasswordModal } from '../forgotPasswordModal'
|
|
56
52
|
import { VerificationPendingModal } from '../idVerificationContainer/VerificationPendingModal'
|
|
57
53
|
import { LoginModal } from '../loginModal'
|
|
58
|
-
import {
|
|
59
|
-
IMercadoPagoProTypeConfig,
|
|
60
|
-
IPaymentPage,
|
|
61
|
-
IPaymentTypeConfig,
|
|
62
|
-
IStripeIntendTypeConfig,
|
|
63
|
-
PaymentContainer,
|
|
64
|
-
PaymentType,
|
|
65
|
-
} from '../paymentContainer'
|
|
54
|
+
import { IPaymentPage, PaymentContainer } from '../paymentContainer'
|
|
66
55
|
import { SignupModal } from '../signupModal'
|
|
67
56
|
import TimerWidget from '../timerWidget'
|
|
68
57
|
import { usePaymentRedirect, useStripePayment } from './hooks'
|
|
@@ -77,13 +66,6 @@ import {
|
|
|
77
66
|
ICheckoutBody,
|
|
78
67
|
renderComponentWithProps,
|
|
79
68
|
} from './utils'
|
|
80
|
-
import { initMercadoPago, Wallet } from '@mercadopago/sdk-react'
|
|
81
|
-
import { IMercadoPagoProPaymentMethodData, IStripePaymentMethodData } from '../../types/api/payment'
|
|
82
|
-
|
|
83
|
-
// Memoized Wallet component to prevent unnecessary re-renders
|
|
84
|
-
const MemoizedWallet = React.memo<{
|
|
85
|
-
onSubmit: () => Promise<unknown>;
|
|
86
|
-
}>(({ onSubmit }) => <Wallet onSubmit={onSubmit} />)
|
|
87
69
|
|
|
88
70
|
export interface IBillingInfoPage {
|
|
89
71
|
data?: IBillingInfoData[];
|
|
@@ -473,27 +455,6 @@ const BillingInfoContainer = React.memo(
|
|
|
473
455
|
zip: '',
|
|
474
456
|
})
|
|
475
457
|
const [loading, setLoading] = useState(true)
|
|
476
|
-
|
|
477
|
-
// Ref to store Formik helpers for stable Wallet callback
|
|
478
|
-
const formikHelpersRef = useRef<{
|
|
479
|
-
setSubmitting: (isSubmitting: boolean) => void;
|
|
480
|
-
submitForm: () => Promise<any>;
|
|
481
|
-
} | null>(null)
|
|
482
|
-
|
|
483
|
-
// Stable callback for Wallet onSubmit to prevent re-renders
|
|
484
|
-
const handleWalletSubmit = useCallback(async () => {
|
|
485
|
-
if (formikHelpersRef.current) {
|
|
486
|
-
formikHelpersRef.current.setSubmitting(true)
|
|
487
|
-
const referenceId = await formikHelpersRef.current.submitForm()
|
|
488
|
-
|
|
489
|
-
if (referenceId) {
|
|
490
|
-
return referenceId
|
|
491
|
-
} else {
|
|
492
|
-
throw 'Invalid Form'
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}, [])
|
|
496
|
-
|
|
497
458
|
const [cardLoading, setCardLoading] = useState(false)
|
|
498
459
|
const [isCountriesLoading, setIsCountriesLoading] = useState(true)
|
|
499
460
|
const [error, setError] = useState<string | null>(null)
|
|
@@ -537,8 +498,6 @@ const BillingInfoContainer = React.memo(
|
|
|
537
498
|
const hideBusinessCategoryField =
|
|
538
499
|
!collectMandatoryBusinessCategory && !collectOptionalBusinessCategory
|
|
539
500
|
|
|
540
|
-
const [paymentTypeConfig, setPaymentTypeConfig] = useState<IPaymentTypeConfig | IMercadoPagoProTypeConfig | IStripeIntendTypeConfig>({type: PaymentType.STRIPE_INTENTS})
|
|
541
|
-
const [paymentType, setPaymentType] = useState<string | null>(null)
|
|
542
501
|
const [pendingVerificationMessage, setPendingVerificationMessage] = useState<string>()
|
|
543
502
|
const [reviewData, setReviewData] = useState<any>({})
|
|
544
503
|
const [checkoutData, setCheckoutData] = useState<any>({})
|
|
@@ -894,60 +853,6 @@ const BillingInfoContainer = React.memo(
|
|
|
894
853
|
onCheckoutUpdateSuccess({ expires_at: expirationTime, ...checkoutData })
|
|
895
854
|
}, [checkoutData, cartInfoData])
|
|
896
855
|
|
|
897
|
-
useEffect(() => {
|
|
898
|
-
const total = checkoutUpdateData?.cart_price_breakdown?.total ?? 0;
|
|
899
|
-
|
|
900
|
-
if (total <= 0) {
|
|
901
|
-
setPaymentType(PaymentType.STRIPE_INTENTS)
|
|
902
|
-
setPaymentTypeConfig({
|
|
903
|
-
type: PaymentType.STRIPE_INTENTS,
|
|
904
|
-
elementsOptions: undefined,
|
|
905
|
-
})
|
|
906
|
-
return
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
setPaymentType(
|
|
910
|
-
checkoutUpdateData?.additional_payment_information?.type ??
|
|
911
|
-
PaymentType.STRIPE_INTENTS
|
|
912
|
-
)
|
|
913
|
-
|
|
914
|
-
if (
|
|
915
|
-
checkoutUpdateData?.additional_payment_information?.type ===
|
|
916
|
-
PaymentType.MERCADO_PAGO_PRO
|
|
917
|
-
) {
|
|
918
|
-
const mercadoPagoAdditionalData =
|
|
919
|
-
checkoutUpdateData?.additional_payment_information as ICheckoutMercadoPagoAdditionalData
|
|
920
|
-
setPaymentTypeConfig({
|
|
921
|
-
type: PaymentType.MERCADO_PAGO_PRO,
|
|
922
|
-
publicKey: mercadoPagoAdditionalData?.public_key,
|
|
923
|
-
} as IMercadoPagoProTypeConfig)
|
|
924
|
-
} else {
|
|
925
|
-
const stripeAdditionalData = checkoutUpdateData?.additional_payment_information as ICheckoutStripeAdditionalData
|
|
926
|
-
setPaymentTypeConfig({
|
|
927
|
-
type: PaymentType.STRIPE_INTENTS,
|
|
928
|
-
publishableKey: stripeAdditionalData?.basic_config?.apiKey,
|
|
929
|
-
accountId: stripeAdditionalData?.basic_config?.accountId ?? null,
|
|
930
|
-
onReady: (stripe, elements) => {
|
|
931
|
-
stripeRef.current = stripe
|
|
932
|
-
elementsRef.current = elements
|
|
933
|
-
},
|
|
934
|
-
elementsOptions: stripeAdditionalData?.elements_config,
|
|
935
|
-
paymentElementOptions: {
|
|
936
|
-
wallets: {
|
|
937
|
-
applePay: stripeAdditionalData?.stripe_wallets?.applePay || 'never',
|
|
938
|
-
googlePay: stripeAdditionalData?.stripe_wallets?.googlePay || 'never',
|
|
939
|
-
},
|
|
940
|
-
},
|
|
941
|
-
} as IStripeIntendTypeConfig)
|
|
942
|
-
}
|
|
943
|
-
}, [checkoutUpdateData])
|
|
944
|
-
|
|
945
|
-
useEffect(() => {
|
|
946
|
-
if (paymentTypeConfig?.type === PaymentType.MERCADO_PAGO_PRO) {
|
|
947
|
-
initMercadoPago((paymentTypeConfig as IMercadoPagoProTypeConfig)?.publicKey)
|
|
948
|
-
}
|
|
949
|
-
}, [paymentTypeConfig?.type, (paymentTypeConfig as IMercadoPagoProTypeConfig)?.publicKey])
|
|
950
|
-
|
|
951
856
|
// Initialize payment hooks
|
|
952
857
|
usePaymentRedirect({
|
|
953
858
|
stripeRef,
|
|
@@ -999,7 +904,6 @@ const BillingInfoContainer = React.memo(
|
|
|
999
904
|
'data.attributes.cart_price_breakdown',
|
|
1000
905
|
{}
|
|
1001
906
|
)
|
|
1002
|
-
setCheckoutUpdateData(checkoutResponse.data.attributes)
|
|
1003
907
|
setCheckoutData(checkoutDataObj)
|
|
1004
908
|
setSingleCheckoutAddOns(mergedAddOns)
|
|
1005
909
|
}
|
|
@@ -1069,7 +973,7 @@ const BillingInfoContainer = React.memo(
|
|
|
1069
973
|
|
|
1070
974
|
const selectedCountry =
|
|
1071
975
|
_find(countries, item => item.code.toLowerCase() === defaultCountry) || {}
|
|
1072
|
-
const initialCountry = selectedCountry.id || _get(userData, 'countryId', '') ||
|
|
976
|
+
const initialCountry = selectedCountry.id || _get(userData, 'countryId', '') || '1'
|
|
1073
977
|
|
|
1074
978
|
const pageUrl = isBrowser ? window.location.href.split('?')[0] : ''
|
|
1075
979
|
usePixel(eventId || cartInfoData?.eventId, { page: 'billing', pageUrl })
|
|
@@ -1077,9 +981,19 @@ const BillingInfoContainer = React.memo(
|
|
|
1077
981
|
dataWithUniqueIds[0].label = 'Get Your Tables'
|
|
1078
982
|
}
|
|
1079
983
|
|
|
984
|
+
const stripePublishableKey =
|
|
985
|
+
reviewData?.payment_method?.stripe_publishable_key ||
|
|
986
|
+
checkoutUpdateData?.additional_payment_information?.basic_config?.apiKey
|
|
987
|
+
const stripeAccountId =
|
|
988
|
+
reviewData?.payment_method?.stripe_connected_account ||
|
|
989
|
+
checkoutUpdateData?.additional_payment_information?.basic_config?.accountId
|
|
1080
990
|
const addOnsIncludedOnInvitation =
|
|
1081
991
|
additionalConfigs.resale && additionalConfigs.resaleWithAddons
|
|
1082
992
|
|
|
993
|
+
const elementsOptions: StripeElementsOptions = {
|
|
994
|
+
...checkoutUpdateData?.additional_payment_information?.elements_config,
|
|
995
|
+
}
|
|
996
|
+
|
|
1083
997
|
if (loading || cardLoading || isCountriesLoading || isConfigLoading || !eventId) {
|
|
1084
998
|
return (
|
|
1085
999
|
<Backdrop
|
|
@@ -1091,9 +1005,6 @@ const BillingInfoContainer = React.memo(
|
|
|
1091
1005
|
)
|
|
1092
1006
|
}
|
|
1093
1007
|
|
|
1094
|
-
const isMercadoPagoPayment =
|
|
1095
|
-
paymentType === PaymentType.MERCADO_PAGO_PRO && isSinglePageCheckout && !orderIsFree
|
|
1096
|
-
|
|
1097
1008
|
return (
|
|
1098
1009
|
<ThemeProvider theme={themeMui}>
|
|
1099
1010
|
{!!expirationTime && enableTimer && (
|
|
@@ -1110,9 +1021,7 @@ const BillingInfoContainer = React.memo(
|
|
|
1110
1021
|
{
|
|
1111
1022
|
country: initialCountry,
|
|
1112
1023
|
state:
|
|
1113
|
-
_get(userData, 'stateId', '') ||
|
|
1114
|
-
_get(userData, 'state', '') ||
|
|
1115
|
-
states?.[0]?.id,
|
|
1024
|
+
_get(userData, 'stateId', '') || _get(userData, 'state', '') || '1',
|
|
1116
1025
|
brand_opt_in: Boolean(optedInFieldValue),
|
|
1117
1026
|
ttf_opt_in: ttfOptIn,
|
|
1118
1027
|
data_capture: {
|
|
@@ -1128,7 +1037,7 @@ const BillingInfoContainer = React.memo(
|
|
|
1128
1037
|
ticketsQuantity
|
|
1129
1038
|
)}
|
|
1130
1039
|
enableReinitialize={false}
|
|
1131
|
-
onSubmit={async (values, formikHelpers)
|
|
1040
|
+
onSubmit={async (values, formikHelpers) => {
|
|
1132
1041
|
try {
|
|
1133
1042
|
// Validation: if phone is required for ticket holders, mark errors and stop submit
|
|
1134
1043
|
const flagRequirePhoneLocal = Boolean(configs?.phone_required)
|
|
@@ -1150,7 +1059,7 @@ const BillingInfoContainer = React.memo(
|
|
|
1150
1059
|
}
|
|
1151
1060
|
}
|
|
1152
1061
|
|
|
1153
|
-
if ((!elementsRef.current || !stripeRef.current) && !orderIsFree
|
|
1062
|
+
if ((!elementsRef.current || !stripeRef.current) && !orderIsFree) {
|
|
1154
1063
|
setError('Fill in the payment details')
|
|
1155
1064
|
return
|
|
1156
1065
|
}
|
|
@@ -1284,13 +1193,8 @@ const BillingInfoContainer = React.memo(
|
|
|
1284
1193
|
(!Number(total) && !Number(updatedOrderData.total)) ||
|
|
1285
1194
|
!Number(updatedOrderData?.pay_now || 0)
|
|
1286
1195
|
const paymentMethod = attributes.payment_method || {}
|
|
1287
|
-
const paymentPlanAvailable =
|
|
1196
|
+
const paymentPlanAvailable = paymentMethod.stripe_payment_plan_enabled
|
|
1288
1197
|
console.log({ paymentPlanAvailable })
|
|
1289
|
-
|
|
1290
|
-
if (isMercadoPagoPayment) {
|
|
1291
|
-
return (paymentMethod as IMercadoPagoProPaymentMethodData)?.preference_id ?? null
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
1198
|
// Process payment using the hook
|
|
1295
1199
|
paymentResponse = await processPayment(
|
|
1296
1200
|
paymentDataResponse,
|
|
@@ -1331,7 +1235,7 @@ const BillingInfoContainer = React.memo(
|
|
|
1331
1235
|
'response.data.data.hasUnverifiedOrder'
|
|
1332
1236
|
)
|
|
1333
1237
|
const message = _get(e, 'response.data.message', {}) as
|
|
1334
|
-
| { password?: string | null
|
|
1238
|
+
| { password?: string | null, email?: string | null }
|
|
1335
1239
|
| string
|
|
1336
1240
|
|
|
1337
1241
|
if (hasUnverifiedOrder && typeof message === 'string') {
|
|
@@ -1366,14 +1270,7 @@ const BillingInfoContainer = React.memo(
|
|
|
1366
1270
|
}
|
|
1367
1271
|
}}
|
|
1368
1272
|
>
|
|
1369
|
-
{(props: FormikProps<any>) =>
|
|
1370
|
-
// Update ref with latest Formik helpers for stable Wallet callback
|
|
1371
|
-
formikHelpersRef.current = {
|
|
1372
|
-
setSubmitting: props.setSubmitting,
|
|
1373
|
-
submitForm: props.submitForm,
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
return (
|
|
1273
|
+
{(props: FormikProps<any>) => (
|
|
1377
1274
|
<Form onSubmit={props.handleSubmit}>
|
|
1378
1275
|
<ErrorFocus />
|
|
1379
1276
|
<LogicRunner
|
|
@@ -1464,12 +1361,12 @@ const BillingInfoContainer = React.memo(
|
|
|
1464
1361
|
/>
|
|
1465
1362
|
) : null}
|
|
1466
1363
|
{!cardLoading &&
|
|
1467
|
-
_map(dataWithUniqueIds,
|
|
1364
|
+
_map(dataWithUniqueIds, item => {
|
|
1468
1365
|
const { label, labelClassName, fields } = item
|
|
1469
1366
|
return (
|
|
1470
1367
|
<div key={item.uniqueId} className="billing-info-fields">
|
|
1471
1368
|
<p className={labelClassName}>{label}</p>
|
|
1472
|
-
{_map(fields,
|
|
1369
|
+
{_map(fields, group => {
|
|
1473
1370
|
const { groupClassname, groupItems } = group
|
|
1474
1371
|
const filteredGroupItems = filterBillingInfoFields(
|
|
1475
1372
|
groupItems,
|
|
@@ -1504,14 +1401,12 @@ const BillingInfoContainer = React.memo(
|
|
|
1504
1401
|
return (
|
|
1505
1402
|
<React.Fragment key={group.uniqueId}>
|
|
1506
1403
|
<div className={groupClassname}>
|
|
1507
|
-
{_map(filteredGroupItems,
|
|
1404
|
+
{_map(filteredGroupItems, element => {
|
|
1508
1405
|
// Hide password fields in single-page checkout or when user is logged in
|
|
1509
1406
|
const shouldHidePasswordFields =
|
|
1510
|
-
[
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
'password-info',
|
|
1514
|
-
].includes(element.name) &&
|
|
1407
|
+
['password', 'confirmPassword', 'password-info'].includes(
|
|
1408
|
+
element.name
|
|
1409
|
+
) &&
|
|
1515
1410
|
(isLoggedIn || isSinglePageCheckout)
|
|
1516
1411
|
|
|
1517
1412
|
return shouldHidePasswordFields ? null : (
|
|
@@ -1533,7 +1428,7 @@ const BillingInfoContainer = React.memo(
|
|
|
1533
1428
|
element.component
|
|
1534
1429
|
)
|
|
1535
1430
|
) : (
|
|
1536
|
-
<
|
|
1431
|
+
<Field
|
|
1537
1432
|
{...element}
|
|
1538
1433
|
type={
|
|
1539
1434
|
element.type === 'radio' ||
|
|
@@ -1546,11 +1441,7 @@ const BillingInfoContainer = React.memo(
|
|
|
1546
1441
|
? setPhoneValidationIsLoading
|
|
1547
1442
|
: undefined
|
|
1548
1443
|
}
|
|
1549
|
-
fill={
|
|
1550
|
-
element.type === 'phone'
|
|
1551
|
-
? true
|
|
1552
|
-
: undefined
|
|
1553
|
-
}
|
|
1444
|
+
fill={element.type === 'phone' ? true : undefined}
|
|
1554
1445
|
label={getFieldLabel(element, configs)}
|
|
1555
1446
|
validate={getValidateFunctions(
|
|
1556
1447
|
element,
|
|
@@ -1563,7 +1454,7 @@ const BillingInfoContainer = React.memo(
|
|
|
1563
1454
|
component={getFieldComponent(element)}
|
|
1564
1455
|
selectOptions={
|
|
1565
1456
|
element.name === 'country'
|
|
1566
|
-
? _map(countries,
|
|
1457
|
+
? _map(countries, item => ({
|
|
1567
1458
|
value: item.id,
|
|
1568
1459
|
label: item.name,
|
|
1569
1460
|
}))
|
|
@@ -1594,9 +1485,7 @@ const BillingInfoContainer = React.memo(
|
|
|
1594
1485
|
})}
|
|
1595
1486
|
</div>
|
|
1596
1487
|
{/* Show login suggestion if email is registered */}
|
|
1597
|
-
{group.groupItems.some(
|
|
1598
|
-
(el) => el.name === 'confirmEmail'
|
|
1599
|
-
) &&
|
|
1488
|
+
{group.groupItems.some(el => el.name === 'confirmEmail') &&
|
|
1600
1489
|
emailExists &&
|
|
1601
1490
|
!isLoggedIn && (
|
|
1602
1491
|
<div className="email-registered-message">
|
|
@@ -1632,14 +1521,14 @@ const BillingInfoContainer = React.memo(
|
|
|
1632
1521
|
{_map(ticketsQuantity, (_item, index) => (
|
|
1633
1522
|
<div key={_item}>
|
|
1634
1523
|
<h5>Ticket {index + 1}</h5>
|
|
1635
|
-
{_map(ticketHoldersFields.fields,
|
|
1524
|
+
{_map(ticketHoldersFields.fields, group => {
|
|
1636
1525
|
const { id, groupClassname, groupItems } = group
|
|
1637
1526
|
return (
|
|
1638
1527
|
<div key={id}>
|
|
1639
1528
|
<div className={groupClassname}>
|
|
1640
|
-
{_map(groupItems,
|
|
1529
|
+
{_map(groupItems, element => (
|
|
1641
1530
|
<div className={element.className} key={element.name}>
|
|
1642
|
-
<
|
|
1531
|
+
<Field
|
|
1643
1532
|
{...element}
|
|
1644
1533
|
type={
|
|
1645
1534
|
element.type === 'radio' ||
|
|
@@ -1676,13 +1565,29 @@ const BillingInfoContainer = React.memo(
|
|
|
1676
1565
|
</div>
|
|
1677
1566
|
)}
|
|
1678
1567
|
<div className="payment-section">
|
|
1679
|
-
{isSinglePageCheckout && !orderIsFree &&
|
|
1568
|
+
{isSinglePageCheckout && !orderIsFree && stripePublishableKey && (
|
|
1680
1569
|
<PaymentContainer
|
|
1681
|
-
|
|
1570
|
+
stripePublishableKey={stripePublishableKey}
|
|
1571
|
+
stripeAccountId={stripeAccountId}
|
|
1682
1572
|
formTitle="Payment Information"
|
|
1683
1573
|
orderInfoLabel=""
|
|
1684
1574
|
enableTimer={false}
|
|
1685
1575
|
checkoutData={checkoutData}
|
|
1576
|
+
elementsOptions={elementsOptions}
|
|
1577
|
+
paymentElementOptions={{
|
|
1578
|
+
wallets: {
|
|
1579
|
+
applePay:
|
|
1580
|
+
checkoutUpdateData?.additional_payment_information
|
|
1581
|
+
?.stripe_wallets?.applePay || 'never',
|
|
1582
|
+
googlePay:
|
|
1583
|
+
checkoutUpdateData?.additional_payment_information
|
|
1584
|
+
?.stripe_wallets?.googlePay || 'never',
|
|
1585
|
+
},
|
|
1586
|
+
}}
|
|
1587
|
+
onStripeReady={(stripe, elements) => {
|
|
1588
|
+
stripeRef.current = stripe
|
|
1589
|
+
elementsRef.current = elements
|
|
1590
|
+
}}
|
|
1686
1591
|
paymentFields={paymentProps.paymentFields || []}
|
|
1687
1592
|
onPaymentError={paymentProps.onPaymentError || _identity}
|
|
1688
1593
|
handlePayment={paymentProps.handlePayment || _identity}
|
|
@@ -1703,28 +1608,24 @@ const BillingInfoContainer = React.memo(
|
|
|
1703
1608
|
{paymentSectionAddon}
|
|
1704
1609
|
</div>
|
|
1705
1610
|
<div className="button-container">
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
)}
|
|
1721
|
-
</Button>
|
|
1722
|
-
)}
|
|
1611
|
+
<Button
|
|
1612
|
+
type="submit"
|
|
1613
|
+
variant="contained"
|
|
1614
|
+
className="login-register-button"
|
|
1615
|
+
disabled={props.isSubmitting || phoneValidationIsLoading}
|
|
1616
|
+
>
|
|
1617
|
+
{props.isSubmitting ? (
|
|
1618
|
+
<CircularProgress size={26} />
|
|
1619
|
+
) : orderIsFree ? (
|
|
1620
|
+
freeOrderButtonName
|
|
1621
|
+
) : (
|
|
1622
|
+
buttonName
|
|
1623
|
+
)}
|
|
1624
|
+
</Button>
|
|
1723
1625
|
</div>
|
|
1724
1626
|
</div>
|
|
1725
1627
|
</Form>
|
|
1726
|
-
|
|
1727
|
-
}}
|
|
1628
|
+
)}
|
|
1728
1629
|
</Formik>
|
|
1729
1630
|
)}
|
|
1730
1631
|
{showModalLogin && (
|
|
@@ -14,7 +14,6 @@ import { IReferralPromotion } from '../../types'
|
|
|
14
14
|
import { createMarkup, getCookieByName, isBrowser } from '../../utils'
|
|
15
15
|
import { CopyMessageModal } from '../common'
|
|
16
16
|
import SocialButtons from './social-buttons'
|
|
17
|
-
import { ICheckoutCompleteData } from '../../types/api/payment'
|
|
18
17
|
|
|
19
18
|
export interface IShareButton {
|
|
20
19
|
mainLabel: string;
|
package/src/components/index.ts
CHANGED
|
@@ -10,4 +10,3 @@ export { AddonsContainter } from './addonsContainer'
|
|
|
10
10
|
export { DelegationsContainer } from './delegationsContainer'
|
|
11
11
|
export { SeatMapContainer } from './seatMapContainer'
|
|
12
12
|
export { IDVerification } from './idVerificationContainer'
|
|
13
|
-
export { ProcessRedirectContainer } from './process-redirect-container'
|
|
@@ -98,6 +98,11 @@ export const OrderDetails = ({
|
|
|
98
98
|
currencyNormalizerCreator(
|
|
99
99
|
createFixedFloatNormalizer(2)(parseFloat(item.cost)),
|
|
100
100
|
currency,
|
|
101
|
+
)}
|
|
102
|
+
{CONFIGS.FEES_STYLE === FEES_STYLES.FINAL_WITH_BREAKDOWN &&
|
|
103
|
+
currencyNormalizerCreator(
|
|
104
|
+
createFixedFloatNormalizer(2)(parseFloat(item.price)),
|
|
105
|
+
currency,
|
|
101
106
|
)}
|
|
102
107
|
</span>
|
|
103
108
|
<span className="add-on-each">{' each'}</span>
|
|
@@ -112,6 +117,11 @@ export const OrderDetails = ({
|
|
|
112
117
|
)} with fees)`}
|
|
113
118
|
</p>
|
|
114
119
|
)}
|
|
120
|
+
{CONFIGS.FEES_STYLE === FEES_STYLES.FINAL_WITH_BREAKDOWN && parseFloat(item.price) - parseFloat(item.cost) > 0 && (
|
|
121
|
+
<p className="fees">
|
|
122
|
+
{`(${currencyNormalizerCreator(createFixedFloatNormalizer(2)(parseFloat(item.cost)), currency)} + ${currencyNormalizerCreator(createFixedFloatNormalizer(2)(parseFloat(item.price) - parseFloat(item.cost)), currency)} fee)`}
|
|
123
|
+
</p>
|
|
124
|
+
)}
|
|
115
125
|
</div>)
|
|
116
126
|
}
|
|
117
127
|
|
|
@@ -136,6 +146,11 @@ export const OrderDetails = ({
|
|
|
136
146
|
createFixedFloatNormalizer(2)(parseFloat(item.cost)),
|
|
137
147
|
currency,
|
|
138
148
|
)}
|
|
149
|
+
{CONFIGS.FEES_STYLE === FEES_STYLES.FINAL_WITH_BREAKDOWN &&
|
|
150
|
+
currencyNormalizerCreator(
|
|
151
|
+
createFixedFloatNormalizer(2)(parseFloat(item.price)),
|
|
152
|
+
currency,
|
|
153
|
+
)}
|
|
139
154
|
</span>
|
|
140
155
|
<br/>
|
|
141
156
|
{CONFIGS.FEES_STYLE === FEES_STYLES.DISPLAY_BOTH && (
|
|
@@ -148,6 +163,11 @@ export const OrderDetails = ({
|
|
|
148
163
|
)} with fees)`}
|
|
149
164
|
</p>
|
|
150
165
|
)}
|
|
166
|
+
{CONFIGS.FEES_STYLE === FEES_STYLES.FINAL_WITH_BREAKDOWN && parseFloat(item.price) - parseFloat(item.cost) > 0 && (
|
|
167
|
+
<p className="fees">
|
|
168
|
+
{`(${currencyNormalizerCreator(createFixedFloatNormalizer(2)(parseFloat(item.cost)), currency)} + ${currencyNormalizerCreator(createFixedFloatNormalizer(2)(parseFloat(item.price) - parseFloat(item.cost)), currency)} fee)`}
|
|
169
|
+
</p>
|
|
170
|
+
)}
|
|
151
171
|
</div>
|
|
152
172
|
</div>)
|
|
153
173
|
}
|