tf-checkout-react 1.3.17 → 1.3.19
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 -1
- package/dist/tf-checkout-react.cjs.development.js +46 -24
- 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 +46 -24
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/types/checkoutPageConfigs.d.ts +3 -0
- package/package.json +1 -1
- package/src/api/index.ts +8 -1
- package/src/components/addonsContainer/index.tsx +6 -0
- package/src/components/billing-info-container/index.tsx +7 -4
- package/src/components/ticketsContainer/index.tsx +1 -1
- package/src/types/checkoutPageConfigs.ts +3 -0
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -216,7 +216,14 @@ export const getCart = () => {
|
|
|
216
216
|
return res
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
export const postOnCheckout = (data: any, accessToken?: string) => {
|
|
219
|
+
export const postOnCheckout = (data: any, accessToken?: string, freeTicket = false) => {
|
|
220
|
+
if (freeTicket) {
|
|
221
|
+
delete data.attributes.city
|
|
222
|
+
delete data.attributes.country
|
|
223
|
+
delete data.attributes.state
|
|
224
|
+
delete data.attributes.zip
|
|
225
|
+
delete data.attributes.street_address
|
|
226
|
+
}
|
|
220
227
|
const res = publicRequest.post(
|
|
221
228
|
`v1/on-checkout/`,
|
|
222
229
|
{ data },
|
|
@@ -208,6 +208,9 @@ export const AddonsContainter = ({
|
|
|
208
208
|
const ageIsRequired = pageConfigsData.age_required ?? false
|
|
209
209
|
const phoneIsRequired = pageConfigsData.phone_required ?? false
|
|
210
210
|
const hasAddOn = pageConfigsData.has_add_on ?? false
|
|
211
|
+
const freeTicket = pageConfigsData.free_ticket ?? false
|
|
212
|
+
const collectOptionalWalletAddress = pageConfigsData.collect_optional_wallet_address ?? false
|
|
213
|
+
const collectMandatoryWalletAddress = pageConfigsData.collect_mandatory_wallet_address ?? false
|
|
211
214
|
|
|
212
215
|
if (skipBillingPage && enableBillingInfoAutoCreate) {
|
|
213
216
|
const ticketsQuantity = window.localStorage.getItem('quantity')
|
|
@@ -244,6 +247,9 @@ export const AddonsContainter = ({
|
|
|
244
247
|
hash,
|
|
245
248
|
total,
|
|
246
249
|
hasAddOn,
|
|
250
|
+
free_ticket: freeTicket,
|
|
251
|
+
collect_optional_wallet_address: collectOptionalWalletAddress,
|
|
252
|
+
collect_mandatory_wallet_address: collectMandatoryWalletAddress,
|
|
247
253
|
})
|
|
248
254
|
} catch (error) {
|
|
249
255
|
onPostCheckoutError(error)
|
|
@@ -317,7 +317,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
317
317
|
getQueryVariable('collect_optional_wallet_address') === 'true'
|
|
318
318
|
const flagFreeTicket = getQueryVariable('free_ticket') === 'true'
|
|
319
319
|
const hidePhoneField = getQueryVariable('hide_phone_field') === 'true'
|
|
320
|
-
const hideWalletAddressField = !collectOptionalWalletAddress && !collectMandatoryWalletAddress
|
|
320
|
+
const hideWalletAddressField = !collectOptionalWalletAddress && !collectMandatoryWalletAddress
|
|
321
321
|
|
|
322
322
|
// Get prevProps
|
|
323
323
|
const prevData = useRef(data)
|
|
@@ -441,7 +441,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
441
441
|
addAddOnsInAttributes(checkoutBody)
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
-
const res = await postOnCheckout(checkoutBody, access_token)
|
|
444
|
+
const res = await postOnCheckout(checkoutBody, access_token, flagFreeTicket)
|
|
445
445
|
removeReferralKey()
|
|
446
446
|
onSkipBillingPage(_get(res, 'data.data.attributes'))
|
|
447
447
|
setLoading(false)
|
|
@@ -541,7 +541,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
541
541
|
addAddOnsInAttributes(checkoutBody)
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
const res = await postOnCheckout(checkoutBody, access_token)
|
|
544
|
+
const res = await postOnCheckout(checkoutBody, access_token, flagFreeTicket)
|
|
545
545
|
removeReferralKey()
|
|
546
546
|
// After checkout is successful recover updated profile and store it on local storage if needed
|
|
547
547
|
if (isWindowDefined) {
|
|
@@ -647,7 +647,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
647
647
|
addAddOnsInAttributes(checkoutBody)
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
const res = await postOnCheckout(checkoutBody)
|
|
650
|
+
const res = await postOnCheckout(checkoutBody, undefined, flagFreeTicket)
|
|
651
651
|
removeReferralKey()
|
|
652
652
|
handleSubmit(
|
|
653
653
|
values,
|
|
@@ -794,6 +794,9 @@ export const BillingInfoContainer = React.memo(
|
|
|
794
794
|
return false
|
|
795
795
|
}
|
|
796
796
|
}
|
|
797
|
+
if (hideWalletAddressField && el.name === 'wallet-address-info') {
|
|
798
|
+
return false
|
|
799
|
+
}
|
|
797
800
|
return true
|
|
798
801
|
}),
|
|
799
802
|
element =>
|
|
@@ -335,7 +335,7 @@ export const TicketsContainer = ({
|
|
|
335
335
|
)
|
|
336
336
|
|
|
337
337
|
const checkoutResult = enableBillingInfoAutoCreate
|
|
338
|
-
? await postOnCheckout(checkoutBody, access_token)
|
|
338
|
+
? await postOnCheckout(checkoutBody, access_token, freeTicket)
|
|
339
339
|
: null
|
|
340
340
|
|
|
341
341
|
hash = _get(checkoutResult, 'data.data.attributes.hash')
|