tf-checkout-react 1.0.80 → 1.0.81
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/ticketsContainer/index.d.ts +2 -1
- package/dist/hooks/usePrevious.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +65 -19
- 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 +66 -20
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/billing-info-container/index.tsx +18 -5
- package/src/components/ticketsContainer/PromoCodeSection.tsx +8 -3
- package/src/components/ticketsContainer/index.tsx +4 -1
- package/src/hooks/usePrevious.tsx +9 -0
- package/src/utils/downloadPDF.tsx +11 -3
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ import _identity from 'lodash/identity'
|
|
|
13
13
|
import _map from 'lodash/map'
|
|
14
14
|
import _get from 'lodash/get'
|
|
15
15
|
import _includes from 'lodash/includes'
|
|
16
|
+
import _isEqual from 'lodash/isEqual'
|
|
16
17
|
|
|
17
18
|
import './style.css'
|
|
18
19
|
import { combineValidators, requiredValidator } from '../../validators'
|
|
@@ -48,6 +49,7 @@ import { ErrorFocus } from '../../utils/formikErrorFocus'
|
|
|
48
49
|
import { FormikPhoneNumberField } from '../common/FormikPhoneNumberField'
|
|
49
50
|
import { ThemeProvider, createTheme } from '@mui/material/styles'
|
|
50
51
|
import { CSSProperties } from '@mui/styles'
|
|
52
|
+
import { usePrevious } from '../../hooks/usePrevious'
|
|
51
53
|
|
|
52
54
|
export interface IBillingInfoPage {
|
|
53
55
|
data?: IBillingInfoData[];
|
|
@@ -260,9 +262,13 @@ export const BillingInfoContainer = ({
|
|
|
260
262
|
const showDOB = getQueryVariable('age_required') === 'true'
|
|
261
263
|
const eventId = getQueryVariable('event_id')
|
|
262
264
|
const optedInFieldValue: boolean = _get(cartInfoData, 'optedIn', false)
|
|
265
|
+
const ttfOptIn: boolean = _get(cartInfoData, 'ttfOptIn', false)
|
|
263
266
|
const hideTtfOptIn: boolean = _get(cartInfoData, 'hide_ttf_opt_in', true)
|
|
264
267
|
|
|
265
|
-
|
|
268
|
+
// Get prevProps
|
|
269
|
+
const prevData = usePrevious(data)
|
|
270
|
+
|
|
271
|
+
if (!_get(dataWithUniqueIds, '[0].uniqueId') || !_isEqual(prevData, data)) {
|
|
266
272
|
setDataWithUniqueIds(assingUniqueIds(data))
|
|
267
273
|
}
|
|
268
274
|
|
|
@@ -371,6 +377,7 @@ export const BillingInfoContainer = ({
|
|
|
371
377
|
country: _get(userData, 'country', '') || "1",
|
|
372
378
|
state: _get(userData, 'state', '') || "1",
|
|
373
379
|
brand_opt_in: optedInFieldValue,
|
|
380
|
+
ttf_opt_in: ttfOptIn,
|
|
374
381
|
},
|
|
375
382
|
userValues
|
|
376
383
|
)}
|
|
@@ -628,12 +635,12 @@ export const BillingInfoContainer = ({
|
|
|
628
635
|
{_map(ticketHoldersFields.fields, group => {
|
|
629
636
|
const { groupClassname, groupItems } = group
|
|
630
637
|
return (
|
|
631
|
-
<div key={group.
|
|
638
|
+
<div key={group.id}>
|
|
632
639
|
<div className={groupClassname}>
|
|
633
640
|
{_map(groupItems, element => (
|
|
634
641
|
<div
|
|
635
642
|
className={element.className}
|
|
636
|
-
key={element.
|
|
643
|
+
key={element.name}
|
|
637
644
|
>
|
|
638
645
|
<Field
|
|
639
646
|
name={`${element.name}-${index}`}
|
|
@@ -695,7 +702,10 @@ export const BillingInfoContainer = ({
|
|
|
695
702
|
userExpired={userExpired}
|
|
696
703
|
onAuthorizeSuccess={onAuthorizeSuccess}
|
|
697
704
|
onAuthorizeError={onAuthorizeError}
|
|
698
|
-
onGetProfileDataSuccess={
|
|
705
|
+
onGetProfileDataSuccess={(data: any) => {
|
|
706
|
+
fetchCart()
|
|
707
|
+
onGetProfileDataSuccess(data)
|
|
708
|
+
}}
|
|
699
709
|
onGetProfileDataError={onGetProfileDataError}
|
|
700
710
|
/>
|
|
701
711
|
)}
|
|
@@ -707,7 +717,10 @@ export const BillingInfoContainer = ({
|
|
|
707
717
|
onRegister={() => {
|
|
708
718
|
setShowModalRegister(false)
|
|
709
719
|
}}
|
|
710
|
-
onGetProfileDataSuccess={
|
|
720
|
+
onGetProfileDataSuccess={(data: any) => {
|
|
721
|
+
fetchCart()
|
|
722
|
+
onGetProfileDataSuccess(data)
|
|
723
|
+
}}
|
|
711
724
|
onGetProfileDataError={onGetProfileDataError}
|
|
712
725
|
/>
|
|
713
726
|
)}
|
|
@@ -25,6 +25,7 @@ export const PromoCodeSection = ({
|
|
|
25
25
|
setShowPromoInput,
|
|
26
26
|
isAccessCodeEnabled,
|
|
27
27
|
}: IPromoCodeSectionProps) => {
|
|
28
|
+
const isPromoCodeHasValue = !!promoCode.trim()
|
|
28
29
|
|
|
29
30
|
const renderInputField = () => {
|
|
30
31
|
return (
|
|
@@ -42,15 +43,19 @@ export const PromoCodeSection = ({
|
|
|
42
43
|
setPromoCode(e.target.value)
|
|
43
44
|
}}
|
|
44
45
|
onKeyPress={event => {
|
|
45
|
-
if (event.key === 'Enter') {
|
|
46
|
+
if (event.key === 'Enter' && isPromoCodeHasValue) {
|
|
46
47
|
setPromoCodeUpdated(promoCode)
|
|
48
|
+
setShowPromoInput(false)
|
|
47
49
|
}
|
|
48
50
|
}}
|
|
49
51
|
/>
|
|
50
52
|
<Button
|
|
51
53
|
className="promo-submit-button"
|
|
52
54
|
onClick={() => {
|
|
53
|
-
|
|
55
|
+
if (isPromoCodeHasValue) {
|
|
56
|
+
setPromoCodeUpdated(promoCode)
|
|
57
|
+
setShowPromoInput(false)
|
|
58
|
+
}
|
|
54
59
|
}}
|
|
55
60
|
>
|
|
56
61
|
{isAccessCodeEnabled ? 'ENTER' : 'APPLY'}
|
|
@@ -70,7 +75,7 @@ export const PromoCodeSection = ({
|
|
|
70
75
|
<p className="promo-code-success">PROMO CODE APPLIED SUCCESSFULLY</p>
|
|
71
76
|
</div>
|
|
72
77
|
) : null}
|
|
73
|
-
{showPromoInput &&
|
|
78
|
+
{showPromoInput && (
|
|
74
79
|
renderInputField()
|
|
75
80
|
)}
|
|
76
81
|
{isPromotionsEnabled && !showPromoInput && !isAccessCodeEnabled ? (
|
|
@@ -57,6 +57,7 @@ export interface IGetTickets {
|
|
|
57
57
|
isPromotionsEnabled?: boolean;
|
|
58
58
|
themeOptions?: ThemeOptions & { input?: CSSProperties; checkbox?: CSSProperties }
|
|
59
59
|
isAccessCodeEnabled?: boolean;
|
|
60
|
+
hideSessionButtons?: boolean;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
export interface ITicket {
|
|
@@ -82,6 +83,7 @@ export const TicketsContainer = ({
|
|
|
82
83
|
isPromotionsEnabled = true,
|
|
83
84
|
themeOptions,
|
|
84
85
|
isAccessCodeEnabled = false,
|
|
86
|
+
hideSessionButtons = false
|
|
85
87
|
}: IGetTickets) => {
|
|
86
88
|
const [selectedTickets, setSelectedTickets] = useState(
|
|
87
89
|
{} as ISelectedTickets
|
|
@@ -154,6 +156,7 @@ export const TicketsContainer = ({
|
|
|
154
156
|
setTickets(_get(attributes, 'tickets'))
|
|
155
157
|
setShowWaitingList(attributes.showWaitingList)
|
|
156
158
|
onGetTicketsSuccess(response.data)
|
|
159
|
+
setPromoCode('')
|
|
157
160
|
}
|
|
158
161
|
if (eventResponse.data.success) {
|
|
159
162
|
const event = _get(eventResponse, 'data.data.attributes')
|
|
@@ -363,7 +366,7 @@ export const TicketsContainer = ({
|
|
|
363
366
|
{getTicketsLabel || 'GET TICKETS'}
|
|
364
367
|
</Button>
|
|
365
368
|
)}
|
|
366
|
-
{isLogged ? (
|
|
369
|
+
{isLogged && !hideSessionButtons ? (
|
|
367
370
|
<div className="session-wrapper">
|
|
368
371
|
<span className="session-container">
|
|
369
372
|
<Button
|
|
@@ -12,11 +12,19 @@ export const downloadPDF = (pdfUrl: string) => {
|
|
|
12
12
|
})
|
|
13
13
|
.then(async response => {
|
|
14
14
|
const blobValue = await response.blob()
|
|
15
|
-
|
|
15
|
+
const fileNameHeader = response.headers.get("content-disposition") || ''
|
|
16
|
+
const fileName = fileNameHeader.split('"')[1]
|
|
17
|
+
return { blobValue, fileName }
|
|
16
18
|
})
|
|
17
|
-
.then(blobValue => {
|
|
19
|
+
.then(({ blobValue, fileName }) => {
|
|
20
|
+
if (!fileName) return
|
|
18
21
|
const file = new Blob([blobValue], { type: 'application/pdf' })
|
|
19
22
|
const fileURL = URL.createObjectURL(file)
|
|
20
|
-
|
|
23
|
+
const link = document.createElement('a')
|
|
24
|
+
link.href = fileURL
|
|
25
|
+
link.setAttribute('download', fileName)
|
|
26
|
+
document.body.appendChild(link)
|
|
27
|
+
link.click()
|
|
28
|
+
document.body.removeChild(link)
|
|
21
29
|
})
|
|
22
30
|
}
|