tf-checkout-react 1.0.98-beta.0 → 1.0.99-beta.3
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/billing-info-container/index.d.ts +1 -1
- package/dist/components/common/SnackbarAlert.d.ts +13 -0
- package/dist/components/ticketsContainer/index.d.ts +2 -1
- package/dist/tf-checkout-react.cjs.development.js +258 -103
- 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 +259 -104
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +6 -1
- package/dist/utils/downloadPDF.d.ts +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/billing-info-container/index.tsx +27 -7
- package/src/components/billing-info-container/utils.ts +3 -3
- package/src/components/common/SnackbarAlert.tsx +54 -0
- package/src/components/orderDetailsContainer/ticketsTable.tsx +83 -60
- package/src/components/ticketsContainer/TicketRow.tsx +11 -6
- package/src/components/ticketsContainer/TicketsSection.tsx +1 -1
- package/src/components/ticketsContainer/index.tsx +10 -6
- package/src/utils/cookies.ts +7 -2
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +16 -4
- package/src/utils/downloadPDF.tsx +28 -6
|
@@ -9,7 +9,7 @@ export interface IBillingInfoPage {
|
|
|
9
9
|
data?: IBillingInfoData[];
|
|
10
10
|
ticketHoldersFields?: IBillingInfoData;
|
|
11
11
|
handleSubmit?: (values: FormikValues, formikHelpers: FormikHelpers<FormikValues>, eventId: any, res: any) => void;
|
|
12
|
-
onRegisterSuccess?: () => void;
|
|
12
|
+
onRegisterSuccess?: (value: any) => void;
|
|
13
13
|
onRegisterError?: (e: AxiosError, email: string) => void;
|
|
14
14
|
onSubmitError?: (e: AxiosError) => void;
|
|
15
15
|
onGetCartSuccess?: (res: any) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AlertColor, SnackbarOrigin } from '@mui/material';
|
|
3
|
+
interface ISnackbarAlertProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
message: string;
|
|
6
|
+
type: AlertColor;
|
|
7
|
+
position?: SnackbarOrigin;
|
|
8
|
+
autoHideDuration?: number;
|
|
9
|
+
variant?: 'filled' | 'standard' | 'outlined';
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const SnackbarAlert: ({ isOpen, message, type, position, autoHideDuration, variant, onClose, }: ISnackbarAlertProps) => JSX.Element;
|
|
13
|
+
export default SnackbarAlert;
|
|
@@ -29,6 +29,7 @@ export interface IGetTickets {
|
|
|
29
29
|
isAccessCodeEnabled?: boolean;
|
|
30
30
|
hideSessionButtons?: boolean;
|
|
31
31
|
hideWaitingList?: boolean;
|
|
32
|
+
enableBillingInfoAutoCreate?: boolean;
|
|
32
33
|
}
|
|
33
34
|
export interface ITicket {
|
|
34
35
|
id: string | number;
|
|
@@ -37,5 +38,5 @@ export interface ITicket {
|
|
|
37
38
|
export interface ISelectedTickets {
|
|
38
39
|
[key: string]: string | number;
|
|
39
40
|
}
|
|
40
|
-
export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, hideSessionButtons, hideWaitingList, }: IGetTickets) => JSX.Element;
|
|
41
|
+
export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, hideSessionButtons, hideWaitingList, enableBillingInfoAutoCreate, }: IGetTickets) => JSX.Element;
|
|
41
42
|
export {};
|
|
@@ -1001,14 +1001,66 @@ var ErrorFocusInternal = /*#__PURE__*/function (_Component) {
|
|
|
1001
1001
|
|
|
1002
1002
|
var ErrorFocus = /*#__PURE__*/formik.connect(ErrorFocusInternal);
|
|
1003
1003
|
|
|
1004
|
+
function setCustomCookie(name, value, days) {
|
|
1005
|
+
var expires = '';
|
|
1006
|
+
|
|
1007
|
+
if (days) {
|
|
1008
|
+
var date = new Date();
|
|
1009
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
1010
|
+
expires = '; expires=' + date.toUTCString();
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
if (typeof window !== 'undefined') {
|
|
1014
|
+
document.cookie = name + '=' + (value || '') + expires + '; path=/';
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
function getCookieByName(cname) {
|
|
1018
|
+
if (typeof window === 'undefined') return '';
|
|
1019
|
+
var name = cname + '=';
|
|
1020
|
+
var ca = document.cookie.split(';');
|
|
1021
|
+
|
|
1022
|
+
for (var i = 0; i < ca.length; i++) {
|
|
1023
|
+
var c = ca[i];
|
|
1024
|
+
|
|
1025
|
+
while (c.charAt(0) == ' ') {
|
|
1026
|
+
c = c.substring(1);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
if (c.indexOf(name) == 0) {
|
|
1030
|
+
return c.substring(name.length, c.length);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
return '';
|
|
1035
|
+
}
|
|
1036
|
+
function deleteCookieByName(name) {
|
|
1037
|
+
if (typeof window !== 'undefined') {
|
|
1038
|
+
document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1004
1042
|
var downloadPDF = function downloadPDF(pdfUrl) {
|
|
1005
1043
|
if (typeof window === 'undefined') return;
|
|
1044
|
+
var xtfCookie = getCookieByName('X-TF-ECOMMERCE');
|
|
1006
1045
|
var accessToken = localStorage.getItem('access_token');
|
|
1007
|
-
if (!accessToken) return;
|
|
1008
|
-
|
|
1009
|
-
|
|
1046
|
+
if (!accessToken && !xtfCookie) return;
|
|
1047
|
+
var headers = {};
|
|
1048
|
+
|
|
1049
|
+
if (accessToken) {
|
|
1050
|
+
headers = {
|
|
1010
1051
|
Authorization: "Bearer " + accessToken
|
|
1011
|
-
}
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
if (xtfCookie) {
|
|
1056
|
+
headers = {
|
|
1057
|
+
'X-TF-ECOMMERCE': xtfCookie
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
return fetch(pdfUrl, {
|
|
1062
|
+
headers: headers,
|
|
1063
|
+
credentials: 'include'
|
|
1012
1064
|
}).then( /*#__PURE__*/function () {
|
|
1013
1065
|
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(response) {
|
|
1014
1066
|
var blobValue, fileNameHeader, fileName;
|
|
@@ -1021,7 +1073,7 @@ var downloadPDF = function downloadPDF(pdfUrl) {
|
|
|
1021
1073
|
|
|
1022
1074
|
case 2:
|
|
1023
1075
|
blobValue = _context.sent;
|
|
1024
|
-
fileNameHeader = response.headers.get(
|
|
1076
|
+
fileNameHeader = response.headers.get('content-disposition') || '';
|
|
1025
1077
|
fileName = fileNameHeader.split('"')[1];
|
|
1026
1078
|
return _context.abrupt("return", {
|
|
1027
1079
|
blobValue: blobValue,
|
|
@@ -1042,7 +1094,11 @@ var downloadPDF = function downloadPDF(pdfUrl) {
|
|
|
1042
1094
|
}()).then(function (_ref2) {
|
|
1043
1095
|
var blobValue = _ref2.blobValue,
|
|
1044
1096
|
fileName = _ref2.fileName;
|
|
1045
|
-
|
|
1097
|
+
|
|
1098
|
+
if (!fileName) {
|
|
1099
|
+
throw Error('Something went wrong.');
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1046
1102
|
var file = new Blob([blobValue], {
|
|
1047
1103
|
type: 'application/pdf'
|
|
1048
1104
|
});
|
|
@@ -1053,21 +1109,27 @@ var downloadPDF = function downloadPDF(pdfUrl) {
|
|
|
1053
1109
|
document.body.appendChild(link);
|
|
1054
1110
|
link.click();
|
|
1055
1111
|
document.body.removeChild(link);
|
|
1112
|
+
})["catch"](function (error) {
|
|
1113
|
+
return error;
|
|
1056
1114
|
});
|
|
1057
1115
|
};
|
|
1058
1116
|
|
|
1059
|
-
var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWithDefaultHolder(ticketsQuantity, logedInValues, includeDob) {
|
|
1117
|
+
var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWithDefaultHolder(ticketsQuantity, logedInValues, includeDob, userCredentials) {
|
|
1060
1118
|
if (includeDob === void 0) {
|
|
1061
1119
|
includeDob = false;
|
|
1062
1120
|
}
|
|
1063
1121
|
|
|
1122
|
+
if (userCredentials === void 0) {
|
|
1123
|
+
userCredentials = {};
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1064
1126
|
var ticket_holders = [];
|
|
1065
|
-
var first_name = _get(logedInValues, 'firstName') || _get(logedInValues, 'first_name') || '';
|
|
1066
|
-
var last_name = _get(logedInValues, 'lastName', '') || _get(
|
|
1127
|
+
var first_name = _get(logedInValues, 'firstName') || _get(logedInValues, 'first_name') || _get(userCredentials, 'firstNameLogged') || '';
|
|
1128
|
+
var last_name = _get(logedInValues, 'lastName') || _get(logedInValues, 'last_name') || _get(userCredentials, 'lastNameLogged') || '';
|
|
1067
1129
|
|
|
1068
1130
|
var phone = _get(logedInValues, 'phone', '');
|
|
1069
1131
|
|
|
1070
|
-
var email = _get(logedInValues, 'email', '');
|
|
1132
|
+
var email = _get(logedInValues, 'email') || _get(userCredentials, 'emailLogged') || '';
|
|
1071
1133
|
|
|
1072
1134
|
for (var i = 0; i <= ticketsQuantity - 1; i++) {
|
|
1073
1135
|
var individualHolder = i ? {
|
|
@@ -1104,39 +1166,6 @@ var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWit
|
|
|
1104
1166
|
return body;
|
|
1105
1167
|
};
|
|
1106
1168
|
|
|
1107
|
-
function setCustomCookie(name, value, days) {
|
|
1108
|
-
var expires = '';
|
|
1109
|
-
|
|
1110
|
-
if (days) {
|
|
1111
|
-
var date = new Date();
|
|
1112
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
1113
|
-
expires = '; expires=' + date.toUTCString();
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
document.cookie = name + '=' + (value || '') + expires + '; path=/';
|
|
1117
|
-
}
|
|
1118
|
-
function getCookieByName(cname) {
|
|
1119
|
-
var name = cname + '=';
|
|
1120
|
-
var ca = document.cookie.split(';');
|
|
1121
|
-
|
|
1122
|
-
for (var i = 0; i < ca.length; i++) {
|
|
1123
|
-
var c = ca[i];
|
|
1124
|
-
|
|
1125
|
-
while (c.charAt(0) == ' ') {
|
|
1126
|
-
c = c.substring(1);
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
if (c.indexOf(name) == 0) {
|
|
1130
|
-
return c.substring(name.length, c.length);
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
return '';
|
|
1135
|
-
}
|
|
1136
|
-
function deleteCookieByName(name) {
|
|
1137
|
-
document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
1169
|
var isWindowDefined = typeof window !== 'undefined';
|
|
1141
1170
|
var ttfHeaders = {
|
|
1142
1171
|
Accept: 'application/vnd.api+json',
|
|
@@ -1844,10 +1873,10 @@ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, va
|
|
|
1844
1873
|
});
|
|
1845
1874
|
ticket_holders = filteredHolders.map(function (item, index) {
|
|
1846
1875
|
return {
|
|
1847
|
-
first_name: item["holderFirstName-" + index] || '',
|
|
1848
|
-
last_name: item["holderLastName-" + index] || '',
|
|
1876
|
+
first_name: !index ? item["holderFirstName-" + index] || logedInValues.firstNameLogged || '' : item["holderFirstName-" + index] || '',
|
|
1877
|
+
last_name: !index ? item["holderLastName-" + index] || logedInValues.lastNameLogged || '' : item["holderLastName-" + index] || '',
|
|
1849
1878
|
phone: item["holderPhone-" + index] || '',
|
|
1850
|
-
email: item["holderEmail-" + index] || ''
|
|
1879
|
+
email: !index ? item["holderEmail-" + index] || logedInValues.emailLogged || '' : item["holderEmail-" + index] || ''
|
|
1851
1880
|
};
|
|
1852
1881
|
});
|
|
1853
1882
|
var filteredRestValue = {};
|
|
@@ -2650,16 +2679,20 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2650
2679
|
collectPaymentData();
|
|
2651
2680
|
}, [skipPage, ticketsQuantity]);
|
|
2652
2681
|
|
|
2653
|
-
var collectCheckoutBody = function collectCheckoutBody(values) {
|
|
2682
|
+
var collectCheckoutBody = function collectCheckoutBody(values, profileData) {
|
|
2654
2683
|
var checkoutBody = {}; // Auto collect ticket holders name when it was skipped optionally
|
|
2655
2684
|
|
|
2656
2685
|
if (showDOB && !showTicketHolders && canSkipHolderNames) {
|
|
2657
|
-
checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity.length, values, true
|
|
2658
|
-
} else {
|
|
2659
|
-
checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
2686
|
+
checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity.length, values, true, {
|
|
2660
2687
|
emailLogged: emailLogged,
|
|
2661
2688
|
firstNameLogged: firstNameLogged,
|
|
2662
2689
|
lastNameLogged: lastNameLogged
|
|
2690
|
+
});
|
|
2691
|
+
} else {
|
|
2692
|
+
checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
2693
|
+
emailLogged: emailLogged || profileData.email,
|
|
2694
|
+
firstNameLogged: firstNameLogged || profileData.first_name,
|
|
2695
|
+
lastNameLogged: lastNameLogged || profileData.last_name
|
|
2663
2696
|
}, showDOB);
|
|
2664
2697
|
}
|
|
2665
2698
|
|
|
@@ -2690,7 +2723,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2690
2723
|
enableReinitialize: true,
|
|
2691
2724
|
onSubmit: function () {
|
|
2692
2725
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
|
|
2693
|
-
var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, checkoutBodyForRegistration, bodyFormData, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3;
|
|
2726
|
+
var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, checkoutBodyForRegistration, bodyFormData, resRegister, _xtfCookie, accessToken, refreshToken, userProfile, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3;
|
|
2694
2727
|
|
|
2695
2728
|
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2696
2729
|
while (1) {
|
|
@@ -2738,17 +2771,29 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2738
2771
|
}, showDOB);
|
|
2739
2772
|
bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
|
|
2740
2773
|
_context6.prev = 17;
|
|
2741
|
-
|
|
2774
|
+
setLoading(true);
|
|
2775
|
+
_context6.next = 21;
|
|
2742
2776
|
return register(bodyFormData);
|
|
2743
2777
|
|
|
2744
|
-
case
|
|
2745
|
-
|
|
2746
|
-
|
|
2778
|
+
case 21:
|
|
2779
|
+
resRegister = _context6.sent;
|
|
2780
|
+
_xtfCookie = _get(resRegister, 'headers.x-tf-ecommerce');
|
|
2781
|
+
accessToken = _get(resRegister, 'data.data.attributes.access_token');
|
|
2782
|
+
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
2783
|
+
userProfile = _get(resRegister, 'data.data.attributes.user_profile');
|
|
2784
|
+
onRegisterSuccess({
|
|
2785
|
+
xtfCookie: _xtfCookie,
|
|
2786
|
+
accessToken: accessToken,
|
|
2787
|
+
refreshToken: refreshToken,
|
|
2788
|
+
userProfile: userProfile
|
|
2789
|
+
});
|
|
2790
|
+
_context6.next = 34;
|
|
2747
2791
|
break;
|
|
2748
2792
|
|
|
2749
|
-
case
|
|
2750
|
-
_context6.prev =
|
|
2793
|
+
case 29:
|
|
2794
|
+
_context6.prev = 29;
|
|
2751
2795
|
_context6.t0 = _context6["catch"](17);
|
|
2796
|
+
setLoading(false);
|
|
2752
2797
|
|
|
2753
2798
|
if (axios.isAxiosError(_context6.t0)) {
|
|
2754
2799
|
_error = _context6.t0 == null ? void 0 : (_e$response = _context6.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
|
|
@@ -2773,11 +2818,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2773
2818
|
|
|
2774
2819
|
return _context6.abrupt("return");
|
|
2775
2820
|
|
|
2776
|
-
case
|
|
2777
|
-
_context6.next =
|
|
2821
|
+
case 34:
|
|
2822
|
+
_context6.next = 36;
|
|
2778
2823
|
return getProfileData();
|
|
2779
2824
|
|
|
2780
|
-
case
|
|
2825
|
+
case 36:
|
|
2781
2826
|
profileData = _context6.sent;
|
|
2782
2827
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2783
2828
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
@@ -2786,19 +2831,20 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2786
2831
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
2787
2832
|
}
|
|
2788
2833
|
|
|
2789
|
-
checkoutBody = collectCheckoutBody(values);
|
|
2790
|
-
_context6.next =
|
|
2834
|
+
checkoutBody = collectCheckoutBody(values, profileDataObj);
|
|
2835
|
+
_context6.next = 43;
|
|
2791
2836
|
return postOnCheckout(checkoutBody);
|
|
2792
2837
|
|
|
2793
|
-
case
|
|
2838
|
+
case 43:
|
|
2794
2839
|
res = _context6.sent;
|
|
2795
2840
|
handleSubmit(values, formikHelpers, eventId, res);
|
|
2796
|
-
_context6.next =
|
|
2841
|
+
_context6.next = 51;
|
|
2797
2842
|
break;
|
|
2798
2843
|
|
|
2799
|
-
case
|
|
2800
|
-
_context6.prev =
|
|
2844
|
+
case 47:
|
|
2845
|
+
_context6.prev = 47;
|
|
2801
2846
|
_context6.t1 = _context6["catch"](0);
|
|
2847
|
+
setLoading(false);
|
|
2802
2848
|
|
|
2803
2849
|
if (axios.isAxiosError(_context6.t1)) {
|
|
2804
2850
|
if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
|
|
@@ -2821,12 +2867,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2821
2867
|
onSubmitError(_context6.t1);
|
|
2822
2868
|
}
|
|
2823
2869
|
|
|
2824
|
-
case
|
|
2870
|
+
case 51:
|
|
2871
|
+
_context6.prev = 51;
|
|
2872
|
+
setLoading(false);
|
|
2873
|
+
return _context6.finish(51);
|
|
2874
|
+
|
|
2875
|
+
case 54:
|
|
2825
2876
|
case "end":
|
|
2826
2877
|
return _context6.stop();
|
|
2827
2878
|
}
|
|
2828
2879
|
}
|
|
2829
|
-
}, _callee6, null, [[0,
|
|
2880
|
+
}, _callee6, null, [[0, 47, 51, 54], [17, 29]]);
|
|
2830
2881
|
}));
|
|
2831
2882
|
|
|
2832
2883
|
function onSubmit(_x2, _x3) {
|
|
@@ -4027,7 +4078,7 @@ var TicketRow = function TicketRow(_ref) {
|
|
|
4027
4078
|
var isSalesClosed = !ticketTier.salesStarted || ticketTier.salesEnded;
|
|
4028
4079
|
var options = getTicketSelectOptions(ticketTier.maxQuantity, ticketTier.minQuantity, ticketTier.multiplier);
|
|
4029
4080
|
var ticketsClosedMessage = !ticketTier.salesStarted ? 'Sales not started' : 'Sales Ended';
|
|
4030
|
-
var onSaleContent =
|
|
4081
|
+
var onSaleContent = React__default.createElement("div", {
|
|
4031
4082
|
className: "get-tickets"
|
|
4032
4083
|
}, React__default.createElement(Box, {
|
|
4033
4084
|
className: "get-tickets__selectbox"
|
|
@@ -4057,18 +4108,17 @@ var TicketRow = function TicketRow(_ref) {
|
|
|
4057
4108
|
value: option.value
|
|
4058
4109
|
}, option.value);
|
|
4059
4110
|
})))));
|
|
4060
|
-
var returnValue = '';
|
|
4061
|
-
|
|
4111
|
+
var returnValue = ''; // ticketTier.soldOut === false --> means that ticket is in the stock
|
|
4112
|
+
|
|
4113
|
+
var isSoldOut = ticketTier.sold_out || !ticketTier.displayTicket || ticketTier.soldOut || ticketTier.soldOut === false;
|
|
4062
4114
|
|
|
4063
4115
|
if (isSoldOut) {
|
|
4064
4116
|
returnValue = soldOutMessage;
|
|
4065
|
-
}
|
|
4066
|
-
|
|
4067
|
-
if (ticketTier.displayTicket &&
|
|
4117
|
+
} else if (isSalesClosed) {
|
|
4118
|
+
returnValue = ticketsClosedMessage;
|
|
4119
|
+
} else if (ticketTier.displayTicket && ticketTier.maxQuantity) {
|
|
4068
4120
|
returnValue = onSaleContent;
|
|
4069
|
-
}
|
|
4070
|
-
|
|
4071
|
-
if (_get(prevTicketTier, 'in_stock')) {
|
|
4121
|
+
} else if (_get(prevTicketTier, 'in_stock')) {
|
|
4072
4122
|
returnValue = 'SOON';
|
|
4073
4123
|
}
|
|
4074
4124
|
|
|
@@ -4098,7 +4148,7 @@ var TicketsSection = function TicketsSection(_ref) {
|
|
|
4098
4148
|
}
|
|
4099
4149
|
|
|
4100
4150
|
var ticketIsFree = (+ticket.cost || +ticket.price) === 0;
|
|
4101
|
-
var ticketPrice = isSoldOut ? '' : ticketIsFree ? 'FREE' : "$ " + (+ticket.cost || +ticket.price).toFixed(2);
|
|
4151
|
+
var ticketPrice = isSoldOut ? 'SOLD OUT' : ticketIsFree ? 'FREE' : "$ " + (+ticket.cost || +ticket.price).toFixed(2);
|
|
4102
4152
|
return React__default.createElement("div", {
|
|
4103
4153
|
key: ticket.id || ticket.name,
|
|
4104
4154
|
className: "event-detail__tier " + (isSoldOut ? 'disabled' : '')
|
|
@@ -4515,15 +4565,18 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4515
4565
|
_ref$hideSessionButto = _ref.hideSessionButtons,
|
|
4516
4566
|
hideSessionButtons = _ref$hideSessionButto === void 0 ? false : _ref$hideSessionButto,
|
|
4517
4567
|
_ref$hideWaitingList = _ref.hideWaitingList,
|
|
4518
|
-
hideWaitingList = _ref$hideWaitingList === void 0 ? false : _ref$hideWaitingList
|
|
4568
|
+
hideWaitingList = _ref$hideWaitingList === void 0 ? false : _ref$hideWaitingList,
|
|
4569
|
+
_ref$enableBillingInf = _ref.enableBillingInfoAutoCreate,
|
|
4570
|
+
enableBillingInfoAutoCreate = _ref$enableBillingInf === void 0 ? true : _ref$enableBillingInf;
|
|
4519
4571
|
|
|
4520
4572
|
var _useState = React.useState({}),
|
|
4521
4573
|
selectedTickets = _useState[0],
|
|
4522
4574
|
setSelectedTickets = _useState[1];
|
|
4523
4575
|
|
|
4524
4576
|
var isWindowDefined = typeof window !== 'undefined';
|
|
4577
|
+
var xtfCookie = getCookieByName('X-TF-ECOMMERCE');
|
|
4525
4578
|
|
|
4526
|
-
var _useState2 = React.useState(isWindowDefined ? !!window.localStorage.getItem('access_token') : false),
|
|
4579
|
+
var _useState2 = React.useState((isWindowDefined ? !!window.localStorage.getItem('access_token') : false) || !!xtfCookie),
|
|
4527
4580
|
isLogged = _useState2[0],
|
|
4528
4581
|
setIsLogged = _useState2[1];
|
|
4529
4582
|
|
|
@@ -4736,7 +4789,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4736
4789
|
result = _context.sent;
|
|
4737
4790
|
|
|
4738
4791
|
if (!(result.status === 200)) {
|
|
4739
|
-
_context.next =
|
|
4792
|
+
_context.next = 31;
|
|
4740
4793
|
break;
|
|
4741
4794
|
}
|
|
4742
4795
|
|
|
@@ -4747,7 +4800,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4747
4800
|
hash = '';
|
|
4748
4801
|
|
|
4749
4802
|
if (!skipBillingPage) {
|
|
4750
|
-
_context.next =
|
|
4803
|
+
_context.next = 30;
|
|
4751
4804
|
break;
|
|
4752
4805
|
}
|
|
4753
4806
|
|
|
@@ -4756,14 +4809,28 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4756
4809
|
userData = _isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
4757
4810
|
access_token = _isWindowDefined && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
|
|
4758
4811
|
checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketQuantity, userData);
|
|
4759
|
-
|
|
4812
|
+
|
|
4813
|
+
if (!enableBillingInfoAutoCreate) {
|
|
4814
|
+
_context.next = 27;
|
|
4815
|
+
break;
|
|
4816
|
+
}
|
|
4817
|
+
|
|
4818
|
+
_context.next = 24;
|
|
4760
4819
|
return postOnCheckout(checkoutBody, access_token);
|
|
4761
4820
|
|
|
4762
|
-
case
|
|
4763
|
-
|
|
4821
|
+
case 24:
|
|
4822
|
+
_context.t0 = _context.sent;
|
|
4823
|
+
_context.next = 28;
|
|
4824
|
+
break;
|
|
4825
|
+
|
|
4826
|
+
case 27:
|
|
4827
|
+
_context.t0 = null;
|
|
4828
|
+
|
|
4829
|
+
case 28:
|
|
4830
|
+
checkoutResult = _context.t0;
|
|
4764
4831
|
hash = _get(checkoutResult, 'data.data.attributes.hash');
|
|
4765
4832
|
|
|
4766
|
-
case
|
|
4833
|
+
case 30:
|
|
4767
4834
|
onAddToCartSuccess({
|
|
4768
4835
|
skip_billing_page: skipBillingPage,
|
|
4769
4836
|
names_required: nameIsRequired,
|
|
@@ -4772,29 +4839,29 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4772
4839
|
hash: hash
|
|
4773
4840
|
});
|
|
4774
4841
|
|
|
4775
|
-
case
|
|
4776
|
-
_context.next =
|
|
4842
|
+
case 31:
|
|
4843
|
+
_context.next = 36;
|
|
4777
4844
|
break;
|
|
4778
4845
|
|
|
4779
|
-
case
|
|
4780
|
-
_context.prev =
|
|
4781
|
-
_context.
|
|
4846
|
+
case 33:
|
|
4847
|
+
_context.prev = 33;
|
|
4848
|
+
_context.t1 = _context["catch"](6);
|
|
4782
4849
|
|
|
4783
|
-
if (axios.isAxiosError(_context.
|
|
4784
|
-
onAddToCartError(_context.
|
|
4850
|
+
if (axios.isAxiosError(_context.t1)) {
|
|
4851
|
+
onAddToCartError(_context.t1);
|
|
4785
4852
|
}
|
|
4786
4853
|
|
|
4787
|
-
case
|
|
4788
|
-
_context.prev =
|
|
4854
|
+
case 36:
|
|
4855
|
+
_context.prev = 36;
|
|
4789
4856
|
setHandleBookIsLoading(false);
|
|
4790
|
-
return _context.finish(
|
|
4857
|
+
return _context.finish(36);
|
|
4791
4858
|
|
|
4792
|
-
case
|
|
4859
|
+
case 39:
|
|
4793
4860
|
case "end":
|
|
4794
4861
|
return _context.stop();
|
|
4795
4862
|
}
|
|
4796
4863
|
}
|
|
4797
|
-
}, _callee, null, [[6,
|
|
4864
|
+
}, _callee, null, [[6, 33, 36, 39]]);
|
|
4798
4865
|
}));
|
|
4799
4866
|
|
|
4800
4867
|
return function handleBook() {
|
|
@@ -4865,7 +4932,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4865
4932
|
isPromotionsEnabled: isPromotionsEnabled,
|
|
4866
4933
|
isAccessCodeEnabled: isAccessCodeEnabled,
|
|
4867
4934
|
isAllTicketsSoldOut: isAllTicketsSoldOut
|
|
4868
|
-
}),
|
|
4935
|
+
}), isTicketOnSale && !isSalesClosed && (event == null ? void 0 : event.salesStarted) && React__default.createElement(Button$1, {
|
|
4869
4936
|
"aria-hidden": true,
|
|
4870
4937
|
className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
|
|
4871
4938
|
onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
|
|
@@ -5090,12 +5157,60 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
|
|
|
5090
5157
|
})));
|
|
5091
5158
|
};
|
|
5092
5159
|
|
|
5160
|
+
var SnackbarAlert = function SnackbarAlert(_ref) {
|
|
5161
|
+
var isOpen = _ref.isOpen,
|
|
5162
|
+
message = _ref.message,
|
|
5163
|
+
type = _ref.type,
|
|
5164
|
+
position = _ref.position,
|
|
5165
|
+
_ref$autoHideDuration = _ref.autoHideDuration,
|
|
5166
|
+
autoHideDuration = _ref$autoHideDuration === void 0 ? 3000 : _ref$autoHideDuration,
|
|
5167
|
+
variant = _ref.variant,
|
|
5168
|
+
onClose = _ref.onClose;
|
|
5169
|
+
return React__default.createElement("div", {
|
|
5170
|
+
className: "snackbar-alert-container"
|
|
5171
|
+
}, React__default.createElement(material.Snackbar, {
|
|
5172
|
+
autoHideDuration: autoHideDuration,
|
|
5173
|
+
open: isOpen,
|
|
5174
|
+
anchorOrigin: position || {
|
|
5175
|
+
vertical: 'top',
|
|
5176
|
+
horizontal: 'center'
|
|
5177
|
+
},
|
|
5178
|
+
onClose: onClose,
|
|
5179
|
+
classes: {
|
|
5180
|
+
root: 'snackbar-alert-snackbar-root'
|
|
5181
|
+
}
|
|
5182
|
+
}, React__default.createElement(material.Alert, {
|
|
5183
|
+
severity: type,
|
|
5184
|
+
onClose: onClose,
|
|
5185
|
+
variant: variant || 'filled',
|
|
5186
|
+
classes: {
|
|
5187
|
+
icon: 'snackbar-alert-icon',
|
|
5188
|
+
root: 'snackbar-alert-alert-root',
|
|
5189
|
+
action: 'snackbar-alert-action',
|
|
5190
|
+
message: 'snackbar-alert-message',
|
|
5191
|
+
filled: 'snackbar-alert-filled'
|
|
5192
|
+
}
|
|
5193
|
+
}, message)));
|
|
5194
|
+
};
|
|
5195
|
+
|
|
5093
5196
|
var TicketsTable = function TicketsTable(_ref) {
|
|
5094
5197
|
var _ref$tickets = _ref.tickets,
|
|
5095
5198
|
tickets = _ref$tickets === void 0 ? [] : _ref$tickets;
|
|
5199
|
+
|
|
5200
|
+
var _useState = React.useState(null),
|
|
5201
|
+
pdfError = _useState[0],
|
|
5202
|
+
setPdfError = _useState[1];
|
|
5203
|
+
|
|
5096
5204
|
return React__default.createElement("div", {
|
|
5097
5205
|
className: "tickets-box"
|
|
5098
|
-
}, React__default.createElement(
|
|
5206
|
+
}, React__default.createElement(SnackbarAlert, {
|
|
5207
|
+
type: "error",
|
|
5208
|
+
isOpen: !!pdfError,
|
|
5209
|
+
message: pdfError || '',
|
|
5210
|
+
onClose: function onClose() {
|
|
5211
|
+
return setPdfError(null);
|
|
5212
|
+
}
|
|
5213
|
+
}), React__default.createElement("h4", {
|
|
5099
5214
|
className: "sub-title"
|
|
5100
5215
|
}, "Your Tickets"), React__default.createElement(TableContainer, {
|
|
5101
5216
|
component: Paper
|
|
@@ -5109,9 +5224,49 @@ var TicketsTable = function TicketsTable(_ref) {
|
|
|
5109
5224
|
}, React__default.createElement(TableRow, null, React__default.createElement(TableCell, null, ticket.hash), React__default.createElement(TableCell, null, ticket.ticket_type), React__default.createElement(TableCell, null, ticket.holder_name), React__default.createElement(TableCell, null, ticket.status), React__default.createElement(TableCell, null, React__default.createElement("span", {
|
|
5110
5225
|
"aria-hidden": true,
|
|
5111
5226
|
className: "download-button",
|
|
5112
|
-
onClick: function
|
|
5113
|
-
|
|
5114
|
-
|
|
5227
|
+
onClick: function () {
|
|
5228
|
+
var _onClick = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
5229
|
+
var pdfDownloadError;
|
|
5230
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
5231
|
+
while (1) {
|
|
5232
|
+
switch (_context.prev = _context.next) {
|
|
5233
|
+
case 0:
|
|
5234
|
+
_context.prev = 0;
|
|
5235
|
+
_context.next = 3;
|
|
5236
|
+
return downloadPDF(ticket.pdf_link);
|
|
5237
|
+
|
|
5238
|
+
case 3:
|
|
5239
|
+
pdfDownloadError = _context.sent;
|
|
5240
|
+
|
|
5241
|
+
if (pdfDownloadError) {
|
|
5242
|
+
setPdfError(pdfDownloadError == null ? void 0 : pdfDownloadError.message);
|
|
5243
|
+
}
|
|
5244
|
+
|
|
5245
|
+
_context.next = 10;
|
|
5246
|
+
break;
|
|
5247
|
+
|
|
5248
|
+
case 7:
|
|
5249
|
+
_context.prev = 7;
|
|
5250
|
+
_context.t0 = _context["catch"](0);
|
|
5251
|
+
|
|
5252
|
+
if (_context.t0 && typeof _context.t0 === 'string') {
|
|
5253
|
+
setPdfError(_context.t0);
|
|
5254
|
+
}
|
|
5255
|
+
|
|
5256
|
+
case 10:
|
|
5257
|
+
case "end":
|
|
5258
|
+
return _context.stop();
|
|
5259
|
+
}
|
|
5260
|
+
}
|
|
5261
|
+
}, _callee, null, [[0, 7]]);
|
|
5262
|
+
}));
|
|
5263
|
+
|
|
5264
|
+
function onClick() {
|
|
5265
|
+
return _onClick.apply(this, arguments);
|
|
5266
|
+
}
|
|
5267
|
+
|
|
5268
|
+
return onClick;
|
|
5269
|
+
}()
|
|
5115
5270
|
}, "Download"))), !!((_ticket$add_ons = ticket.add_ons) != null && _ticket$add_ons.length) && React__default.createElement(TableRow, null, React__default.createElement(TableCell, {
|
|
5116
5271
|
colSpan: 5
|
|
5117
5272
|
}, React__default.createElement(Table, {
|