tf-checkout-react 1.0.82 → 1.0.86
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 +2 -1
- package/dist/tf-checkout-react.cjs.development.js +51 -44
- 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 +52 -45
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +4 -4
- package/src/components/billing-info-container/index.tsx +75 -103
- package/src/components/common/CustomField.tsx +15 -12
- package/src/components/ticketsContainer/index.tsx +11 -5
- package/src/components/ticketsContainer/style.css +5 -0
- package/src/components/waitingList/index.tsx +12 -6
- package/dist/hooks/usePrevious.d.ts +0 -1
- package/src/hooks/usePrevious.tsx +0 -9
|
@@ -38,5 +38,6 @@ export interface IBillingInfoPage {
|
|
|
38
38
|
input?: CSSProperties;
|
|
39
39
|
checkbox?: CSSProperties;
|
|
40
40
|
};
|
|
41
|
+
hideErrorsAlertSection?: boolean;
|
|
41
42
|
}
|
|
42
|
-
export declare const BillingInfoContainer: ({ data, ticketHoldersFields, initialValues, buttonName, handleSubmit, theme, onRegisterSuccess, onRegisterError, onSubmitError, onGetCartSuccess, onGetCartError, onGetCountriesSuccess, onGetCountriesError, onGetStatesSuccess, onGetStatesError, onGetProfileDataSuccess, onGetProfileDataError, onAuthorizeSuccess, onAuthorizeError, onLogin, onLoginSuccess, isLoggedIn: pIsLoggedIn, accountInfoTitle, hideLogo, themeOptions, onErrorClose }: IBillingInfoPage) => JSX.Element;
|
|
43
|
+
export declare const BillingInfoContainer: ({ data, ticketHoldersFields, initialValues, buttonName, handleSubmit, theme, onRegisterSuccess, onRegisterError, onSubmitError, onGetCartSuccess, onGetCartError, onGetCountriesSuccess, onGetCountriesError, onGetStatesSuccess, onGetStatesError, onGetProfileDataSuccess, onGetProfileDataError, onAuthorizeSuccess, onAuthorizeError, onLogin, onLoginSuccess, isLoggedIn: pIsLoggedIn, accountInfoTitle, hideLogo, themeOptions, onErrorClose, hideErrorsAlertSection }: IBillingInfoPage) => JSX.Element;
|
|
@@ -13,6 +13,7 @@ var _map = _interopDefault(require('lodash/map'));
|
|
|
13
13
|
var _get = _interopDefault(require('lodash/get'));
|
|
14
14
|
var _includes = _interopDefault(require('lodash/includes'));
|
|
15
15
|
var _isEqual = _interopDefault(require('lodash/isEqual'));
|
|
16
|
+
var _isEmpty = _interopDefault(require('lodash/isEmpty'));
|
|
16
17
|
var axios = _interopDefault(require('axios'));
|
|
17
18
|
var _forEach = _interopDefault(require('lodash/forEach'));
|
|
18
19
|
var material = require('@mui/material');
|
|
@@ -36,8 +37,8 @@ var reactStripeJs = require('@stripe/react-stripe-js');
|
|
|
36
37
|
var stripeJs = require('@stripe/stripe-js');
|
|
37
38
|
var reactShare = require('react-share');
|
|
38
39
|
var _some = _interopDefault(require('lodash/some'));
|
|
40
|
+
var _every = _interopDefault(require('lodash/every'));
|
|
39
41
|
var _find = _interopDefault(require('lodash/find'));
|
|
40
|
-
var _isEmpty = _interopDefault(require('lodash/isEmpty'));
|
|
41
42
|
var Button$1 = _interopDefault(require('react-bootstrap/Button'));
|
|
42
43
|
var jwt_decode = _interopDefault(require('jwt-decode'));
|
|
43
44
|
var _sortBy = _interopDefault(require('lodash/sortBy'));
|
|
@@ -1109,9 +1110,16 @@ publicRequest.interceptors.response.use(function (response) {
|
|
|
1109
1110
|
|
|
1110
1111
|
if ((error == null ? void 0 : (_error$response = error.response) == null ? void 0 : _error$response.status) === 401) {
|
|
1111
1112
|
if (isWindowDefined) {
|
|
1113
|
+
var _error$response2, _error$response2$data;
|
|
1114
|
+
|
|
1112
1115
|
window.localStorage.removeItem('auth_guest_token');
|
|
1113
1116
|
window.localStorage.removeItem('user_data');
|
|
1114
1117
|
window.localStorage.removeItem('access_token');
|
|
1118
|
+
var errorType = error == null ? void 0 : (_error$response2 = error.response) == null ? void 0 : (_error$response2$data = _error$response2.data) == null ? void 0 : _error$response2$data.error;
|
|
1119
|
+
|
|
1120
|
+
if (errorType === 'invalid_token') {
|
|
1121
|
+
window.location.href = '/';
|
|
1122
|
+
}
|
|
1115
1123
|
}
|
|
1116
1124
|
}
|
|
1117
1125
|
|
|
@@ -1258,11 +1266,6 @@ var getProfileData = function getProfileData(accessToken) {
|
|
|
1258
1266
|
Authorization: "Bearer " + accessToken
|
|
1259
1267
|
})
|
|
1260
1268
|
})["catch"](function (e) {
|
|
1261
|
-
if (isWindowDefined) {
|
|
1262
|
-
var event = new window.CustomEvent('auth_error', e);
|
|
1263
|
-
window.document.dispatchEvent(event);
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
1269
|
return e;
|
|
1267
1270
|
});
|
|
1268
1271
|
};
|
|
@@ -1905,7 +1908,8 @@ var CustomField = function CustomField(_ref) {
|
|
|
1905
1908
|
}
|
|
1906
1909
|
},
|
|
1907
1910
|
InputLabelProps: {
|
|
1908
|
-
sx: customTheme == null ? void 0 : customTheme.input
|
|
1911
|
+
sx: customTheme == null ? void 0 : customTheme.input,
|
|
1912
|
+
shrink: field.name === 'holderAge' ? true : undefined
|
|
1909
1913
|
},
|
|
1910
1914
|
inputProps: {
|
|
1911
1915
|
sx: customTheme == null ? void 0 : customTheme.input
|
|
@@ -2101,14 +2105,6 @@ var FormikPhoneNumberField = function FormikPhoneNumberField(_ref) {
|
|
|
2101
2105
|
}, rest));
|
|
2102
2106
|
};
|
|
2103
2107
|
|
|
2104
|
-
var usePrevious = function usePrevious(value) {
|
|
2105
|
-
var ref = React.useRef();
|
|
2106
|
-
React.useEffect(function () {
|
|
2107
|
-
ref.current = value;
|
|
2108
|
-
});
|
|
2109
|
-
return ref.current;
|
|
2110
|
-
};
|
|
2111
|
-
|
|
2112
2108
|
var LogicRunner = function LogicRunner(_ref) {
|
|
2113
2109
|
var values = _ref.values,
|
|
2114
2110
|
setStates = _ref.setStates,
|
|
@@ -2189,7 +2185,7 @@ var LogicRunner = function LogicRunner(_ref) {
|
|
|
2189
2185
|
confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
|
|
2190
2186
|
state: (parsedData == null ? void 0 : parsedData.state) || '',
|
|
2191
2187
|
street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
|
|
2192
|
-
country: (parsedData == null ? void 0 : parsedData.country) ||
|
|
2188
|
+
country: (parsedData == null ? void 0 : parsedData.country) || '1',
|
|
2193
2189
|
zip: (parsedData == null ? void 0 : parsedData.zip) || '',
|
|
2194
2190
|
brand_opt_in: (parsedData == null ? void 0 : parsedData.brand_opt_in) || '',
|
|
2195
2191
|
city: (parsedData == null ? void 0 : parsedData.city) || '',
|
|
@@ -2263,7 +2259,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2263
2259
|
hideLogo = _ref3.hideLogo,
|
|
2264
2260
|
themeOptions = _ref3.themeOptions,
|
|
2265
2261
|
_ref3$onErrorClose = _ref3.onErrorClose,
|
|
2266
|
-
onErrorClose = _ref3$onErrorClose === void 0 ? function () {} : _ref3$onErrorClose
|
|
2262
|
+
onErrorClose = _ref3$onErrorClose === void 0 ? function () {} : _ref3$onErrorClose,
|
|
2263
|
+
_ref3$hideErrorsAlert = _ref3.hideErrorsAlertSection,
|
|
2264
|
+
hideErrorsAlertSection = _ref3$hideErrorsAlert === void 0 ? false : _ref3$hideErrorsAlert;
|
|
2267
2265
|
|
|
2268
2266
|
var themeMui = styles$1.createTheme(themeOptions);
|
|
2269
2267
|
var isWindowDefined = typeof window !== 'undefined';
|
|
@@ -2343,16 +2341,25 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2343
2341
|
|
|
2344
2342
|
var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
|
|
2345
2343
|
|
|
2346
|
-
var ttfOptIn = _get(cartInfoData, 'ttfOptIn', false);
|
|
2344
|
+
var ttfOptIn = Boolean(_get(cartInfoData, 'ttfOptIn', false));
|
|
2347
2345
|
|
|
2348
2346
|
var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true); // Get prevProps
|
|
2349
2347
|
|
|
2350
2348
|
|
|
2351
|
-
var prevData =
|
|
2349
|
+
var prevData = React.useRef(data);
|
|
2350
|
+
React.useEffect(function () {
|
|
2351
|
+
var hasUniqueId = _get(dataWithUniqueIds, '[0].uniqueId');
|
|
2352
|
+
|
|
2353
|
+
var isEqualData = _isEqual(prevData.current, data);
|
|
2352
2354
|
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2355
|
+
if (!hasUniqueId || !isEqualData) {
|
|
2356
|
+
setDataWithUniqueIds(assingUniqueIds(data));
|
|
2357
|
+
|
|
2358
|
+
if (!isEqualData) {
|
|
2359
|
+
prevData.current = data;
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}, [dataWithUniqueIds, data]);
|
|
2356
2363
|
|
|
2357
2364
|
var getQuantity = function getQuantity(cart) {
|
|
2358
2365
|
if (cart === void 0) {
|
|
@@ -2366,15 +2373,6 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2366
2373
|
return qty;
|
|
2367
2374
|
};
|
|
2368
2375
|
|
|
2369
|
-
var handleAuthErrors = React.useCallback(function () {
|
|
2370
|
-
setIsLoggedIn(false);
|
|
2371
|
-
}, []);
|
|
2372
|
-
React.useEffect(function () {
|
|
2373
|
-
isWindowDefined && window.document.addEventListener('auth_error', handleAuthErrors);
|
|
2374
|
-
return function () {
|
|
2375
|
-
isWindowDefined && window.document.removeEventListener('auth_error', handleAuthErrors);
|
|
2376
|
-
};
|
|
2377
|
-
}, [handleAuthErrors]);
|
|
2378
2376
|
React.useEffect(function () {
|
|
2379
2377
|
if ((pIsLoggedIn || access_token) && !isLoggedIn) {
|
|
2380
2378
|
setIsLoggedIn(true);
|
|
@@ -2540,8 +2538,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2540
2538
|
theme: themeMui
|
|
2541
2539
|
}, React__default.createElement(formik.Formik, {
|
|
2542
2540
|
initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
|
|
2543
|
-
country: _get(userData, 'country', '') ||
|
|
2544
|
-
state: _get(userData, 'state', '') ||
|
|
2541
|
+
country: _get(userData, 'country', '') || '1',
|
|
2542
|
+
state: _get(userData, 'state', '') || '1',
|
|
2545
2543
|
brand_opt_in: optedInFieldValue,
|
|
2546
2544
|
ttf_opt_in: ttfOptIn
|
|
2547
2545
|
}), userValues),
|
|
@@ -2731,7 +2729,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2731
2729
|
onGetStatesError: onGetStatesError
|
|
2732
2730
|
}), React__default.createElement("div", {
|
|
2733
2731
|
className: "billing-info-container " + theme
|
|
2734
|
-
}, error && React__default.createElement(material.Alert, {
|
|
2732
|
+
}, error && !hideErrorsAlertSection && React__default.createElement(material.Alert, {
|
|
2735
2733
|
severity: "error",
|
|
2736
2734
|
onClose: onErrorClose,
|
|
2737
2735
|
variant: "filled"
|
|
@@ -2798,7 +2796,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2798
2796
|
})));
|
|
2799
2797
|
})));
|
|
2800
2798
|
}));
|
|
2801
|
-
}), React__default.createElement("div", {
|
|
2799
|
+
}), !_isEmpty(ticketHoldersFields.fields) && React__default.createElement("div", {
|
|
2802
2800
|
className: "ticket-holders-fields"
|
|
2803
2801
|
}, React__default.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
|
|
2804
2802
|
return React__default.createElement("div", {
|
|
@@ -3930,6 +3928,8 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3930
3928
|
var _ref$tickets = _ref.tickets,
|
|
3931
3929
|
tickets = _ref$tickets === void 0 ? {} : _ref$tickets,
|
|
3932
3930
|
eventId = _ref.eventId;
|
|
3931
|
+
var isWindowDefined = typeof window !== 'undefined';
|
|
3932
|
+
var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
3933
3933
|
|
|
3934
3934
|
var _useState = React.useState(false),
|
|
3935
3935
|
showSuccessMessage = _useState[0],
|
|
@@ -4008,16 +4008,16 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
4008
4008
|
initialValues: {
|
|
4009
4009
|
ticketTypeId: '',
|
|
4010
4010
|
quantity: '',
|
|
4011
|
-
firstName: '',
|
|
4012
|
-
lastName: '',
|
|
4013
|
-
email: ''
|
|
4011
|
+
firstName: userData.first_name || '',
|
|
4012
|
+
lastName: userData.last_name || '',
|
|
4013
|
+
email: userData.email || ''
|
|
4014
4014
|
},
|
|
4015
4015
|
onSubmit: handleSubmit
|
|
4016
4016
|
}, React__default.createElement(formik.Form, null, React__default.createElement(ErrorFocus, null), showTicketsField && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
4017
4017
|
className: "field-item"
|
|
4018
4018
|
}, React__default.createElement(formik.Field, {
|
|
4019
4019
|
name: "ticketTypeId",
|
|
4020
|
-
label: "Ticket
|
|
4020
|
+
label: "Type of Ticket",
|
|
4021
4021
|
type: "select",
|
|
4022
4022
|
component: CustomField,
|
|
4023
4023
|
selectOptions: [{
|
|
@@ -4029,7 +4029,7 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
4029
4029
|
className: "field-item"
|
|
4030
4030
|
}, React__default.createElement(formik.Field, {
|
|
4031
4031
|
name: "quantity",
|
|
4032
|
-
label: "Quantity",
|
|
4032
|
+
label: "Quantity Requested",
|
|
4033
4033
|
type: "select",
|
|
4034
4034
|
component: CustomField,
|
|
4035
4035
|
selectOptions: [{
|
|
@@ -4546,9 +4546,14 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4546
4546
|
getTicketsApi();
|
|
4547
4547
|
};
|
|
4548
4548
|
|
|
4549
|
-
var isAllTicketsSoldOut =
|
|
4550
|
-
return
|
|
4549
|
+
var isAllTicketsSoldOut = _every(tickets, function (item) {
|
|
4550
|
+
return item.sold_out || item.soldOut;
|
|
4551
|
+
});
|
|
4552
|
+
|
|
4553
|
+
var isTicketOnSale = _some(tickets, function (item) {
|
|
4554
|
+
return item.salesStarted && !item.salesEnded && !item.soldOut;
|
|
4551
4555
|
});
|
|
4556
|
+
|
|
4552
4557
|
var themeMui = material.createTheme(themeOptions);
|
|
4553
4558
|
React.useEffect(function () {
|
|
4554
4559
|
isWindowDefined && window.document.addEventListener('custom-logout', handleLogout);
|
|
@@ -4572,7 +4577,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4572
4577
|
selectedTickets: selectedTickets,
|
|
4573
4578
|
handleTicketSelect: handleTicketSelect,
|
|
4574
4579
|
promoCodeIsApplied: promoCodeIsApplied
|
|
4575
|
-
}), event != null && event.salesEnded ? React__default.createElement("p",
|
|
4580
|
+
}), event != null && event.salesEnded ? React__default.createElement("p", {
|
|
4581
|
+
className: 'event-closed-message'
|
|
4582
|
+
}, "Sales for this event are closed.") : !(event != null && event.salesStarted) && event != null && event.salesStart ? React__default.createElement(Countdown, {
|
|
4576
4583
|
startDate: event.salesStart,
|
|
4577
4584
|
timezone: event.timezone,
|
|
4578
4585
|
title: "Sales start in:",
|
|
@@ -4591,7 +4598,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4591
4598
|
isPromotionsEnabled: isPromotionsEnabled,
|
|
4592
4599
|
isAccessCodeEnabled: isAccessCodeEnabled,
|
|
4593
4600
|
isAllTicketsSoldOut: isAllTicketsSoldOut
|
|
4594
|
-
}), !
|
|
4601
|
+
}), (isTicketOnSale || !(event != null && event.salesEnded)) && React__default.createElement(Button$1, {
|
|
4595
4602
|
"aria-hidden": true,
|
|
4596
4603
|
className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
|
|
4597
4604
|
onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
|