tf-checkout-react 1.0.84 → 1.0.88
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 +4 -1
- package/dist/components/paymentContainer/index.d.ts +4 -2
- package/dist/components/ticketsContainer/index.d.ts +2 -1
- package/dist/components/timerWidget/index.d.ts +15 -0
- package/dist/tf-checkout-react.cjs.development.js +226 -87
- 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 +228 -89
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/dist/utils/showZero.d.ts +1 -0
- package/package.json +2 -1
- package/src/api/index.ts +4 -5
- package/src/components/billing-info-container/index.tsx +105 -102
- package/src/components/common/CustomField.tsx +15 -12
- package/src/components/paymentContainer/index.tsx +30 -10
- package/src/components/ticketsContainer/index.tsx +17 -9
- package/src/components/ticketsContainer/style.css +5 -0
- package/src/components/timerWidget/index.tsx +70 -0
- package/src/components/timerWidget/style.css +26 -0
- package/src/components/waitingList/index.tsx +12 -6
- package/src/utils/showZero.tsx +10 -0
|
@@ -38,5 +38,8 @@ export interface IBillingInfoPage {
|
|
|
38
38
|
input?: CSSProperties;
|
|
39
39
|
checkbox?: CSSProperties;
|
|
40
40
|
};
|
|
41
|
+
hideErrorsAlertSection?: boolean;
|
|
42
|
+
onSkipBillingPage: (data: any) => void;
|
|
43
|
+
skipPage?: boolean;
|
|
41
44
|
}
|
|
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;
|
|
45
|
+
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, onSkipBillingPage, skipPage, }: IBillingInfoPage) => JSX.Element;
|
|
@@ -5,7 +5,7 @@ import './style.css';
|
|
|
5
5
|
import { IPaymentField } from '../../types';
|
|
6
6
|
import { StripeCardNumberElementOptions } from '@stripe/stripe-js';
|
|
7
7
|
import { ThemeOptions } from '@mui/material';
|
|
8
|
-
import { CSSProperties } from
|
|
8
|
+
import { CSSProperties } from '@mui/styles';
|
|
9
9
|
export interface IPaymentPage {
|
|
10
10
|
paymentFields: IPaymentField[];
|
|
11
11
|
handlePayment: any;
|
|
@@ -23,5 +23,7 @@ export interface IPaymentPage {
|
|
|
23
23
|
checkbox?: CSSProperties;
|
|
24
24
|
};
|
|
25
25
|
elementsOptions?: StripeElementsOptions;
|
|
26
|
+
onCountdownFinish?: () => void;
|
|
27
|
+
enableTimer?: boolean;
|
|
26
28
|
}
|
|
27
|
-
export declare const PaymentContainer: ({ paymentFields, handlePayment, formTitle, errorText, checkoutData, onErrorClose, onGetPaymentDataSuccess, onGetPaymentDataError, onPaymentError, stripeCardOptions, disableZipSection, themeOptions, elementsOptions }: IPaymentPage) => JSX.Element;
|
|
29
|
+
export declare const PaymentContainer: ({ paymentFields, handlePayment, formTitle, errorText, checkoutData, onErrorClose, onGetPaymentDataSuccess, onGetPaymentDataError, onPaymentError, stripeCardOptions, disableZipSection, themeOptions, elementsOptions, onCountdownFinish, enableTimer, }: IPaymentPage) => JSX.Element;
|
|
@@ -28,6 +28,7 @@ export interface IGetTickets {
|
|
|
28
28
|
};
|
|
29
29
|
isAccessCodeEnabled?: boolean;
|
|
30
30
|
hideSessionButtons?: boolean;
|
|
31
|
+
hideWaitingList?: boolean;
|
|
31
32
|
}
|
|
32
33
|
export interface ITicket {
|
|
33
34
|
id: string | number;
|
|
@@ -36,5 +37,5 @@ export interface ITicket {
|
|
|
36
37
|
export interface ISelectedTickets {
|
|
37
38
|
[key: string]: string | number;
|
|
38
39
|
}
|
|
39
|
-
export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, hideSessionButtons }: IGetTickets) => JSX.Element;
|
|
40
|
+
export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, hideSessionButtons, hideWaitingList }: IGetTickets) => JSX.Element;
|
|
40
41
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './style.css';
|
|
3
|
+
export interface ITimerWidgetPage {
|
|
4
|
+
expires_at: number;
|
|
5
|
+
buyLoading?: boolean;
|
|
6
|
+
onCountdownFinish?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface IRenderer {
|
|
9
|
+
minutes: number;
|
|
10
|
+
seconds: number;
|
|
11
|
+
completed: number;
|
|
12
|
+
handleCountdownFinish: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const TimerWidget: ({ expires_at, buyLoading, onCountdownFinish, }: ITimerWidgetPage) => JSX.Element | null;
|
|
15
|
+
export default TimerWidget;
|
|
@@ -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');
|
|
@@ -29,15 +30,18 @@ var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
|
|
|
29
30
|
var Select = _interopDefault(require('@mui/material/Select'));
|
|
30
31
|
var MuiPhoneNumber = _interopDefault(require('material-ui-phone-number'));
|
|
31
32
|
var styles$1 = require('@mui/material/styles');
|
|
33
|
+
var Backdrop = _interopDefault(require('@mui/material/Backdrop'));
|
|
32
34
|
var Container = _interopDefault(require('@mui/material/Container'));
|
|
33
35
|
var CircularProgress = _interopDefault(require('@mui/material/CircularProgress'));
|
|
34
36
|
var Alert = _interopDefault(require('@mui/material/Alert'));
|
|
35
37
|
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
36
38
|
var stripeJs = require('@stripe/stripe-js');
|
|
39
|
+
var Countdown$1 = _interopDefault(require('react-countdown'));
|
|
40
|
+
var _isNumber = _interopDefault(require('lodash/isNumber'));
|
|
37
41
|
var reactShare = require('react-share');
|
|
38
42
|
var _some = _interopDefault(require('lodash/some'));
|
|
43
|
+
var _every = _interopDefault(require('lodash/every'));
|
|
39
44
|
var _find = _interopDefault(require('lodash/find'));
|
|
40
|
-
var _isEmpty = _interopDefault(require('lodash/isEmpty'));
|
|
41
45
|
var Button$1 = _interopDefault(require('react-bootstrap/Button'));
|
|
42
46
|
var jwt_decode = _interopDefault(require('jwt-decode'));
|
|
43
47
|
var _sortBy = _interopDefault(require('lodash/sortBy'));
|
|
@@ -1109,9 +1113,16 @@ publicRequest.interceptors.response.use(function (response) {
|
|
|
1109
1113
|
|
|
1110
1114
|
if ((error == null ? void 0 : (_error$response = error.response) == null ? void 0 : _error$response.status) === 401) {
|
|
1111
1115
|
if (isWindowDefined) {
|
|
1116
|
+
var _error$response2, _error$response2$data;
|
|
1117
|
+
|
|
1112
1118
|
window.localStorage.removeItem('auth_guest_token');
|
|
1113
1119
|
window.localStorage.removeItem('user_data');
|
|
1114
1120
|
window.localStorage.removeItem('access_token');
|
|
1121
|
+
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;
|
|
1122
|
+
|
|
1123
|
+
if (errorType === 'invalid_token') {
|
|
1124
|
+
window.location.href = '/';
|
|
1125
|
+
}
|
|
1115
1126
|
}
|
|
1116
1127
|
}
|
|
1117
1128
|
|
|
@@ -1258,17 +1269,6 @@ var getProfileData = function getProfileData(accessToken) {
|
|
|
1258
1269
|
Authorization: "Bearer " + accessToken
|
|
1259
1270
|
})
|
|
1260
1271
|
})["catch"](function (e) {
|
|
1261
|
-
var _e$response, _e$response$data;
|
|
1262
|
-
|
|
1263
|
-
var errorType = e == null ? void 0 : (_e$response = e.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.error;
|
|
1264
|
-
|
|
1265
|
-
if (isWindowDefined) {
|
|
1266
|
-
var event = new window.CustomEvent('auth_error', {
|
|
1267
|
-
detail: errorType
|
|
1268
|
-
});
|
|
1269
|
-
window.document.dispatchEvent(event);
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
1272
|
return e;
|
|
1273
1273
|
});
|
|
1274
1274
|
};
|
|
@@ -1911,7 +1911,8 @@ var CustomField = function CustomField(_ref) {
|
|
|
1911
1911
|
}
|
|
1912
1912
|
},
|
|
1913
1913
|
InputLabelProps: {
|
|
1914
|
-
sx: customTheme == null ? void 0 : customTheme.input
|
|
1914
|
+
sx: customTheme == null ? void 0 : customTheme.input,
|
|
1915
|
+
shrink: field.name === 'holderAge' ? true : undefined
|
|
1915
1916
|
},
|
|
1916
1917
|
inputProps: {
|
|
1917
1918
|
sx: customTheme == null ? void 0 : customTheme.input
|
|
@@ -2187,7 +2188,7 @@ var LogicRunner = function LogicRunner(_ref) {
|
|
|
2187
2188
|
confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
|
|
2188
2189
|
state: (parsedData == null ? void 0 : parsedData.state) || '',
|
|
2189
2190
|
street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
|
|
2190
|
-
country: (parsedData == null ? void 0 : parsedData.country) ||
|
|
2191
|
+
country: (parsedData == null ? void 0 : parsedData.country) || '1',
|
|
2191
2192
|
zip: (parsedData == null ? void 0 : parsedData.zip) || '',
|
|
2192
2193
|
brand_opt_in: (parsedData == null ? void 0 : parsedData.brand_opt_in) || '',
|
|
2193
2194
|
city: (parsedData == null ? void 0 : parsedData.city) || '',
|
|
@@ -2261,7 +2262,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2261
2262
|
hideLogo = _ref3.hideLogo,
|
|
2262
2263
|
themeOptions = _ref3.themeOptions,
|
|
2263
2264
|
_ref3$onErrorClose = _ref3.onErrorClose,
|
|
2264
|
-
onErrorClose = _ref3$onErrorClose === void 0 ? function () {} : _ref3$onErrorClose
|
|
2265
|
+
onErrorClose = _ref3$onErrorClose === void 0 ? function () {} : _ref3$onErrorClose,
|
|
2266
|
+
_ref3$hideErrorsAlert = _ref3.hideErrorsAlertSection,
|
|
2267
|
+
hideErrorsAlertSection = _ref3$hideErrorsAlert === void 0 ? false : _ref3$hideErrorsAlert,
|
|
2268
|
+
_ref3$onSkipBillingPa = _ref3.onSkipBillingPage,
|
|
2269
|
+
onSkipBillingPage = _ref3$onSkipBillingPa === void 0 ? function () {} : _ref3$onSkipBillingPa,
|
|
2270
|
+
_ref3$skipPage = _ref3.skipPage,
|
|
2271
|
+
skipPage = _ref3$skipPage === void 0 ? false : _ref3$skipPage;
|
|
2265
2272
|
|
|
2266
2273
|
var themeMui = styles$1.createTheme(themeOptions);
|
|
2267
2274
|
var isWindowDefined = typeof window !== 'undefined';
|
|
@@ -2326,9 +2333,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2326
2333
|
userValues = _useState11[0],
|
|
2327
2334
|
setUserValues = _useState11[1];
|
|
2328
2335
|
|
|
2329
|
-
var _useState12 = React.useState(
|
|
2330
|
-
|
|
2331
|
-
|
|
2336
|
+
var _useState12 = React.useState(true),
|
|
2337
|
+
loading = _useState12[0],
|
|
2338
|
+
setLoading = _useState12[1];
|
|
2339
|
+
|
|
2340
|
+
var _useState13 = React.useState(null),
|
|
2341
|
+
error = _useState13[0],
|
|
2342
|
+
setError = _useState13[1];
|
|
2332
2343
|
|
|
2333
2344
|
var emailLogged = _get(userData, 'email', '') || _get(userValues, 'email', '');
|
|
2334
2345
|
|
|
@@ -2341,7 +2352,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2341
2352
|
|
|
2342
2353
|
var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
|
|
2343
2354
|
|
|
2344
|
-
var ttfOptIn = _get(cartInfoData, 'ttfOptIn', false);
|
|
2355
|
+
var ttfOptIn = Boolean(_get(cartInfoData, 'ttfOptIn', false));
|
|
2345
2356
|
|
|
2346
2357
|
var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true); // Get prevProps
|
|
2347
2358
|
|
|
@@ -2373,19 +2384,6 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2373
2384
|
return qty;
|
|
2374
2385
|
};
|
|
2375
2386
|
|
|
2376
|
-
var handleAuthErrors = React.useCallback(function (e) {
|
|
2377
|
-
setIsLoggedIn(false);
|
|
2378
|
-
|
|
2379
|
-
if (isWindowDefined && (e == null ? void 0 : e.detail) === 'invalid_token') {
|
|
2380
|
-
window.location.href = '/';
|
|
2381
|
-
}
|
|
2382
|
-
}, []);
|
|
2383
|
-
React.useEffect(function () {
|
|
2384
|
-
isWindowDefined && window.document.addEventListener('auth_error', handleAuthErrors);
|
|
2385
|
-
return function () {
|
|
2386
|
-
isWindowDefined && window.document.removeEventListener('auth_error', handleAuthErrors);
|
|
2387
|
-
};
|
|
2388
|
-
}, [handleAuthErrors]);
|
|
2389
2387
|
React.useEffect(function () {
|
|
2390
2388
|
if ((pIsLoggedIn || access_token) && !isLoggedIn) {
|
|
2391
2389
|
setIsLoggedIn(true);
|
|
@@ -2547,41 +2545,106 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2547
2545
|
React.useEffect(function () {
|
|
2548
2546
|
fetchUserData(access_token);
|
|
2549
2547
|
}, [access_token]);
|
|
2548
|
+
React.useEffect(function () {
|
|
2549
|
+
var collectPaymentData = /*#__PURE__*/function () {
|
|
2550
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
|
|
2551
|
+
var checkoutBody, res;
|
|
2552
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2553
|
+
while (1) {
|
|
2554
|
+
switch (_context5.prev = _context5.next) {
|
|
2555
|
+
case 0:
|
|
2556
|
+
if (!(skipPage && !_isEmpty(ticketsQuantity))) {
|
|
2557
|
+
_context5.next = 16;
|
|
2558
|
+
break;
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
setLoading(true);
|
|
2562
|
+
checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity.length, userData);
|
|
2563
|
+
_context5.prev = 3;
|
|
2564
|
+
_context5.next = 6;
|
|
2565
|
+
return postOnCheckout(checkoutBody, access_token);
|
|
2566
|
+
|
|
2567
|
+
case 6:
|
|
2568
|
+
res = _context5.sent;
|
|
2569
|
+
onSkipBillingPage(_get(res, 'data.data.attributes'));
|
|
2570
|
+
setLoading(false);
|
|
2571
|
+
_context5.next = 14;
|
|
2572
|
+
break;
|
|
2573
|
+
|
|
2574
|
+
case 11:
|
|
2575
|
+
_context5.prev = 11;
|
|
2576
|
+
_context5.t0 = _context5["catch"](3);
|
|
2577
|
+
onSubmitError(_context5.t0);
|
|
2578
|
+
|
|
2579
|
+
case 14:
|
|
2580
|
+
_context5.next = 17;
|
|
2581
|
+
break;
|
|
2582
|
+
|
|
2583
|
+
case 16:
|
|
2584
|
+
setLoading(false);
|
|
2585
|
+
|
|
2586
|
+
case 17:
|
|
2587
|
+
case "end":
|
|
2588
|
+
return _context5.stop();
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
}, _callee5, null, [[3, 11]]);
|
|
2592
|
+
}));
|
|
2593
|
+
|
|
2594
|
+
return function collectPaymentData() {
|
|
2595
|
+
return _ref7.apply(this, arguments);
|
|
2596
|
+
};
|
|
2597
|
+
}();
|
|
2598
|
+
|
|
2599
|
+
collectPaymentData();
|
|
2600
|
+
}, [skipPage, ticketsQuantity]); // Displaying loader
|
|
2601
|
+
|
|
2602
|
+
if (loading) {
|
|
2603
|
+
return React__default.createElement(Backdrop, {
|
|
2604
|
+
sx: {
|
|
2605
|
+
color: '#fff'
|
|
2606
|
+
},
|
|
2607
|
+
open: true
|
|
2608
|
+
}, React__default.createElement(material.CircularProgress, {
|
|
2609
|
+
color: "inherit"
|
|
2610
|
+
}));
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2550
2613
|
return React__default.createElement(styles$1.ThemeProvider, {
|
|
2551
2614
|
theme: themeMui
|
|
2552
2615
|
}, React__default.createElement(formik.Formik, {
|
|
2553
2616
|
initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
|
|
2554
|
-
country: _get(userData, 'country', '') ||
|
|
2555
|
-
state: _get(userData, 'state', '') ||
|
|
2617
|
+
country: _get(userData, 'country', '') || '1',
|
|
2618
|
+
state: _get(userData, 'state', '') || '1',
|
|
2556
2619
|
brand_opt_in: optedInFieldValue,
|
|
2557
2620
|
ttf_opt_in: ttfOptIn
|
|
2558
2621
|
}), userValues),
|
|
2559
2622
|
enableReinitialize: true,
|
|
2560
2623
|
onSubmit: function () {
|
|
2561
|
-
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2624
|
+
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
|
|
2562
2625
|
var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, checkoutBodyForRegistration, bodyFormData, access_token_register, resRegister, refreshToken, tokens, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3;
|
|
2563
2626
|
|
|
2564
|
-
return runtime_1.wrap(function
|
|
2627
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2565
2628
|
while (1) {
|
|
2566
|
-
switch (
|
|
2629
|
+
switch (_context6.prev = _context6.next) {
|
|
2567
2630
|
case 0:
|
|
2568
|
-
|
|
2631
|
+
_context6.prev = 0;
|
|
2569
2632
|
|
|
2570
2633
|
if (!isLoggedIn) {
|
|
2571
|
-
|
|
2634
|
+
_context6.next = 17;
|
|
2572
2635
|
break;
|
|
2573
2636
|
}
|
|
2574
2637
|
|
|
2575
2638
|
if (!access_token) {
|
|
2576
|
-
|
|
2639
|
+
_context6.next = 9;
|
|
2577
2640
|
break;
|
|
2578
2641
|
}
|
|
2579
2642
|
|
|
2580
|
-
|
|
2643
|
+
_context6.next = 5;
|
|
2581
2644
|
return getProfileData(access_token);
|
|
2582
2645
|
|
|
2583
2646
|
case 5:
|
|
2584
|
-
updatedUserData =
|
|
2647
|
+
updatedUserData = _context6.sent;
|
|
2585
2648
|
_profileSpecifiedData = _get(updatedUserData, 'data.data');
|
|
2586
2649
|
_profileDataObj = setLoggedUserData(_profileSpecifiedData);
|
|
2587
2650
|
|
|
@@ -2595,17 +2658,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2595
2658
|
firstNameLogged: firstNameLogged,
|
|
2596
2659
|
lastNameLogged: lastNameLogged
|
|
2597
2660
|
}, showDOB);
|
|
2598
|
-
|
|
2661
|
+
_context6.next = 12;
|
|
2599
2662
|
return postOnCheckout(_checkoutBody, access_token);
|
|
2600
2663
|
|
|
2601
2664
|
case 12:
|
|
2602
|
-
_res =
|
|
2603
|
-
|
|
2665
|
+
_res = _context6.sent;
|
|
2666
|
+
_context6.next = 15;
|
|
2604
2667
|
return getPaymentData(_res.data.data.attributes.hash);
|
|
2605
2668
|
|
|
2606
2669
|
case 15:
|
|
2607
2670
|
handleSubmit(values, formikHelpers, eventId, _res);
|
|
2608
|
-
return
|
|
2671
|
+
return _context6.abrupt("return");
|
|
2609
2672
|
|
|
2610
2673
|
case 17:
|
|
2611
2674
|
checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
@@ -2615,12 +2678,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2615
2678
|
}, showDOB);
|
|
2616
2679
|
bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
|
|
2617
2680
|
access_token_register = null;
|
|
2618
|
-
|
|
2619
|
-
|
|
2681
|
+
_context6.prev = 20;
|
|
2682
|
+
_context6.next = 23;
|
|
2620
2683
|
return register(bodyFormData);
|
|
2621
2684
|
|
|
2622
2685
|
case 23:
|
|
2623
|
-
resRegister =
|
|
2686
|
+
resRegister = _context6.sent;
|
|
2624
2687
|
access_token_register = _get(resRegister, 'data.data.attributes.access_token');
|
|
2625
2688
|
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
2626
2689
|
handleSetAccessToken(access_token_register);
|
|
@@ -2629,15 +2692,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2629
2692
|
refreshToken: refreshToken
|
|
2630
2693
|
};
|
|
2631
2694
|
onRegisterSuccess(tokens);
|
|
2632
|
-
|
|
2695
|
+
_context6.next = 35;
|
|
2633
2696
|
break;
|
|
2634
2697
|
|
|
2635
2698
|
case 31:
|
|
2636
|
-
|
|
2637
|
-
|
|
2699
|
+
_context6.prev = 31;
|
|
2700
|
+
_context6.t0 = _context6["catch"](20);
|
|
2638
2701
|
|
|
2639
|
-
if (axios.isAxiosError(
|
|
2640
|
-
_error =
|
|
2702
|
+
if (axios.isAxiosError(_context6.t0)) {
|
|
2703
|
+
_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;
|
|
2641
2704
|
|
|
2642
2705
|
if (_includes(_error, 'You must be aged')) {
|
|
2643
2706
|
formikHelpers.setFieldError('holderAge', _error);
|
|
@@ -2654,17 +2717,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2654
2717
|
setShowModalLogin(true);
|
|
2655
2718
|
}
|
|
2656
2719
|
|
|
2657
|
-
onRegisterError(
|
|
2720
|
+
onRegisterError(_context6.t0, values.email);
|
|
2658
2721
|
}
|
|
2659
2722
|
|
|
2660
|
-
return
|
|
2723
|
+
return _context6.abrupt("return");
|
|
2661
2724
|
|
|
2662
2725
|
case 35:
|
|
2663
|
-
|
|
2726
|
+
_context6.next = 37;
|
|
2664
2727
|
return getProfileData(access_token_register);
|
|
2665
2728
|
|
|
2666
2729
|
case 37:
|
|
2667
|
-
profileData =
|
|
2730
|
+
profileData = _context6.sent;
|
|
2668
2731
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2669
2732
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
2670
2733
|
|
|
@@ -2677,25 +2740,25 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2677
2740
|
firstNameLogged: firstNameLogged,
|
|
2678
2741
|
lastNameLogged: lastNameLogged
|
|
2679
2742
|
}, showDOB);
|
|
2680
|
-
|
|
2743
|
+
_context6.next = 44;
|
|
2681
2744
|
return postOnCheckout(checkoutBody, access_token_register);
|
|
2682
2745
|
|
|
2683
2746
|
case 44:
|
|
2684
|
-
res =
|
|
2685
|
-
|
|
2747
|
+
res = _context6.sent;
|
|
2748
|
+
_context6.next = 47;
|
|
2686
2749
|
return getPaymentData(res.data.data.attributes.hash);
|
|
2687
2750
|
|
|
2688
2751
|
case 47:
|
|
2689
2752
|
handleSubmit(values, formikHelpers, eventId, res);
|
|
2690
|
-
|
|
2753
|
+
_context6.next = 53;
|
|
2691
2754
|
break;
|
|
2692
2755
|
|
|
2693
2756
|
case 50:
|
|
2694
|
-
|
|
2695
|
-
|
|
2757
|
+
_context6.prev = 50;
|
|
2758
|
+
_context6.t1 = _context6["catch"](0);
|
|
2696
2759
|
|
|
2697
|
-
if (axios.isAxiosError(
|
|
2698
|
-
if (((_e$response2 =
|
|
2760
|
+
if (axios.isAxiosError(_context6.t1)) {
|
|
2761
|
+
if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
|
|
2699
2762
|
if (isWindowDefined) {
|
|
2700
2763
|
window.localStorage.removeItem('user_data');
|
|
2701
2764
|
window.localStorage.removeItem('access_token');
|
|
@@ -2704,23 +2767,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2704
2767
|
}
|
|
2705
2768
|
}
|
|
2706
2769
|
|
|
2707
|
-
if ((_e$response3 =
|
|
2770
|
+
if ((_e$response3 = _context6.t1.response) != null && _e$response3.data.message) {
|
|
2708
2771
|
if (typeof document !== undefined) {
|
|
2709
2772
|
document.body.scrollTop = document.documentElement.scrollTop = 0;
|
|
2710
2773
|
}
|
|
2711
2774
|
|
|
2712
|
-
setError(_get(
|
|
2775
|
+
setError(_get(_context6.t1, 'response.data.message'));
|
|
2713
2776
|
}
|
|
2714
2777
|
|
|
2715
|
-
onSubmitError(
|
|
2778
|
+
onSubmitError(_context6.t1);
|
|
2716
2779
|
}
|
|
2717
2780
|
|
|
2718
2781
|
case 53:
|
|
2719
2782
|
case "end":
|
|
2720
|
-
return
|
|
2783
|
+
return _context6.stop();
|
|
2721
2784
|
}
|
|
2722
2785
|
}
|
|
2723
|
-
},
|
|
2786
|
+
}, _callee6, null, [[0, 50], [20, 31]]);
|
|
2724
2787
|
}));
|
|
2725
2788
|
|
|
2726
2789
|
function onSubmit(_x2, _x3) {
|
|
@@ -2742,7 +2805,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2742
2805
|
onGetStatesError: onGetStatesError
|
|
2743
2806
|
}), React__default.createElement("div", {
|
|
2744
2807
|
className: "billing-info-container " + theme
|
|
2745
|
-
}, error && React__default.createElement(material.Alert, {
|
|
2808
|
+
}, error && !hideErrorsAlertSection && React__default.createElement(material.Alert, {
|
|
2746
2809
|
severity: "error",
|
|
2747
2810
|
onClose: onErrorClose,
|
|
2748
2811
|
variant: "filled"
|
|
@@ -2809,7 +2872,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2809
2872
|
})));
|
|
2810
2873
|
})));
|
|
2811
2874
|
}));
|
|
2812
|
-
}), React__default.createElement("div", {
|
|
2875
|
+
}), !_isEmpty(ticketHoldersFields.fields) && React__default.createElement("div", {
|
|
2813
2876
|
className: "ticket-holders-fields"
|
|
2814
2877
|
}, React__default.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
|
|
2815
2878
|
return React__default.createElement("div", {
|
|
@@ -3148,6 +3211,63 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
3148
3211
|
}) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
|
|
3149
3212
|
};
|
|
3150
3213
|
|
|
3214
|
+
var showZero = function showZero(value) {
|
|
3215
|
+
if (value === void 0) {
|
|
3216
|
+
value = 0;
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3219
|
+
var intNumber = Number(value);
|
|
3220
|
+
return _isNumber(intNumber) ? intNumber >= 0 && intNumber < 10 ? '0' + intNumber : intNumber : null;
|
|
3221
|
+
};
|
|
3222
|
+
|
|
3223
|
+
var TimerWidget = function TimerWidget(_ref) {
|
|
3224
|
+
var expires_at = _ref.expires_at,
|
|
3225
|
+
buyLoading = _ref.buyLoading,
|
|
3226
|
+
_ref$onCountdownFinis = _ref.onCountdownFinish,
|
|
3227
|
+
onCountdownFinish = _ref$onCountdownFinis === void 0 ? function () {} : _ref$onCountdownFinis;
|
|
3228
|
+
|
|
3229
|
+
var _useState = React.useState(true),
|
|
3230
|
+
showTimer = _useState[0],
|
|
3231
|
+
setShowTimer = _useState[1];
|
|
3232
|
+
|
|
3233
|
+
var handleCountdownFinish = function handleCountdownFinish() {
|
|
3234
|
+
setShowTimer(false);
|
|
3235
|
+
|
|
3236
|
+
if (!buyLoading) {
|
|
3237
|
+
onCountdownFinish();
|
|
3238
|
+
}
|
|
3239
|
+
};
|
|
3240
|
+
|
|
3241
|
+
var _renderer = function renderer(_ref2) {
|
|
3242
|
+
var minutes = _ref2.minutes,
|
|
3243
|
+
seconds = _ref2.seconds,
|
|
3244
|
+
completed = _ref2.completed,
|
|
3245
|
+
handleCountdownFinish = _ref2.handleCountdownFinish;
|
|
3246
|
+
|
|
3247
|
+
if (completed) {
|
|
3248
|
+
handleCountdownFinish();
|
|
3249
|
+
return null;
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3252
|
+
return React__default.createElement("span", null, showZero(minutes), ":", showZero(seconds));
|
|
3253
|
+
};
|
|
3254
|
+
|
|
3255
|
+
return showTimer && !!expires_at ? React__default.createElement("div", {
|
|
3256
|
+
className: "timer"
|
|
3257
|
+
}, React__default.createElement("div", {
|
|
3258
|
+
className: "toast-message"
|
|
3259
|
+
}, React__default.createElement("p", null, "Please complete your purchase before the timer reaches zero."), React__default.createElement("p", {
|
|
3260
|
+
className: "countdown"
|
|
3261
|
+
}, React__default.createElement(Countdown$1, {
|
|
3262
|
+
date: Date.now() + expires_at * 1000,
|
|
3263
|
+
renderer: function renderer(props) {
|
|
3264
|
+
return _renderer(_extends({}, props, {
|
|
3265
|
+
handleCountdownFinish: handleCountdownFinish
|
|
3266
|
+
}));
|
|
3267
|
+
}
|
|
3268
|
+
})))) : null;
|
|
3269
|
+
};
|
|
3270
|
+
|
|
3151
3271
|
var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
|
|
3152
3272
|
|
|
3153
3273
|
var getStripePromise = function getStripePromise(reviewData) {
|
|
@@ -3208,7 +3328,11 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3208
3328
|
_ref$disableZipSectio = _ref.disableZipSection,
|
|
3209
3329
|
disableZipSection = _ref$disableZipSectio === void 0 ? false : _ref$disableZipSectio,
|
|
3210
3330
|
themeOptions = _ref.themeOptions,
|
|
3211
|
-
elementsOptions = _ref.elementsOptions
|
|
3331
|
+
elementsOptions = _ref.elementsOptions,
|
|
3332
|
+
_ref$onCountdownFinis = _ref.onCountdownFinish,
|
|
3333
|
+
onCountdownFinish = _ref$onCountdownFinis === void 0 ? function () {} : _ref$onCountdownFinis,
|
|
3334
|
+
_ref$enableTimer = _ref.enableTimer,
|
|
3335
|
+
enableTimer = _ref$enableTimer === void 0 ? false : _ref$enableTimer;
|
|
3212
3336
|
|
|
3213
3337
|
var _useState = React.useState(initialReviewValues),
|
|
3214
3338
|
reviewData = _useState[0],
|
|
@@ -3397,7 +3521,11 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3397
3521
|
theme: themeMui
|
|
3398
3522
|
}, React__default.createElement("div", {
|
|
3399
3523
|
className: "payment_page"
|
|
3400
|
-
}, error && React__default.createElement(
|
|
3524
|
+
}, !paymentIsLoading && !error && enableTimer && React__default.createElement(TimerWidget, {
|
|
3525
|
+
expires_at: _get(reviewData, 'expires_at', 0),
|
|
3526
|
+
buyLoading: paymentIsLoading,
|
|
3527
|
+
onCountdownFinish: onCountdownFinish
|
|
3528
|
+
}), error && React__default.createElement(Alert, {
|
|
3401
3529
|
severity: "error",
|
|
3402
3530
|
onClose: onErrorClose,
|
|
3403
3531
|
variant: "filled"
|
|
@@ -3941,6 +4069,8 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3941
4069
|
var _ref$tickets = _ref.tickets,
|
|
3942
4070
|
tickets = _ref$tickets === void 0 ? {} : _ref$tickets,
|
|
3943
4071
|
eventId = _ref.eventId;
|
|
4072
|
+
var isWindowDefined = typeof window !== 'undefined';
|
|
4073
|
+
var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
3944
4074
|
|
|
3945
4075
|
var _useState = React.useState(false),
|
|
3946
4076
|
showSuccessMessage = _useState[0],
|
|
@@ -4019,16 +4149,16 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
4019
4149
|
initialValues: {
|
|
4020
4150
|
ticketTypeId: '',
|
|
4021
4151
|
quantity: '',
|
|
4022
|
-
firstName: '',
|
|
4023
|
-
lastName: '',
|
|
4024
|
-
email: ''
|
|
4152
|
+
firstName: userData.first_name || '',
|
|
4153
|
+
lastName: userData.last_name || '',
|
|
4154
|
+
email: userData.email || ''
|
|
4025
4155
|
},
|
|
4026
4156
|
onSubmit: handleSubmit
|
|
4027
4157
|
}, React__default.createElement(formik.Form, null, React__default.createElement(ErrorFocus, null), showTicketsField && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
4028
4158
|
className: "field-item"
|
|
4029
4159
|
}, React__default.createElement(formik.Field, {
|
|
4030
4160
|
name: "ticketTypeId",
|
|
4031
|
-
label: "Ticket
|
|
4161
|
+
label: "Type of Ticket",
|
|
4032
4162
|
type: "select",
|
|
4033
4163
|
component: CustomField,
|
|
4034
4164
|
selectOptions: [{
|
|
@@ -4040,7 +4170,7 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
4040
4170
|
className: "field-item"
|
|
4041
4171
|
}, React__default.createElement(formik.Field, {
|
|
4042
4172
|
name: "quantity",
|
|
4043
|
-
label: "Quantity",
|
|
4173
|
+
label: "Quantity Requested",
|
|
4044
4174
|
type: "select",
|
|
4045
4175
|
component: CustomField,
|
|
4046
4176
|
selectOptions: [{
|
|
@@ -4266,7 +4396,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4266
4396
|
_ref$isAccessCodeEnab = _ref.isAccessCodeEnabled,
|
|
4267
4397
|
isAccessCodeEnabled = _ref$isAccessCodeEnab === void 0 ? false : _ref$isAccessCodeEnab,
|
|
4268
4398
|
_ref$hideSessionButto = _ref.hideSessionButtons,
|
|
4269
|
-
hideSessionButtons = _ref$hideSessionButto === void 0 ? false : _ref$hideSessionButto
|
|
4399
|
+
hideSessionButtons = _ref$hideSessionButto === void 0 ? false : _ref$hideSessionButto,
|
|
4400
|
+
_ref$hideWaitingList = _ref.hideWaitingList,
|
|
4401
|
+
hideWaitingList = _ref$hideWaitingList === void 0 ? false : _ref$hideWaitingList;
|
|
4270
4402
|
|
|
4271
4403
|
var _useState = React.useState({}),
|
|
4272
4404
|
selectedTickets = _useState[0],
|
|
@@ -4306,7 +4438,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4306
4438
|
promoCode = _useState8[0],
|
|
4307
4439
|
setPromoCode = _useState8[1];
|
|
4308
4440
|
|
|
4309
|
-
var _useState9 = React.useState(queryPromoCode),
|
|
4441
|
+
var _useState9 = React.useState(getQueryVariable('r') || queryPromoCode),
|
|
4310
4442
|
promoCodeUpdated = _useState9[0],
|
|
4311
4443
|
setPromoCodeUpdated = _useState9[1];
|
|
4312
4444
|
|
|
@@ -4557,9 +4689,14 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4557
4689
|
getTicketsApi();
|
|
4558
4690
|
};
|
|
4559
4691
|
|
|
4560
|
-
var isAllTicketsSoldOut =
|
|
4561
|
-
return
|
|
4692
|
+
var isAllTicketsSoldOut = _every(tickets, function (item) {
|
|
4693
|
+
return item.sold_out || item.soldOut;
|
|
4562
4694
|
});
|
|
4695
|
+
|
|
4696
|
+
var isTicketOnSale = _some(tickets, function (item) {
|
|
4697
|
+
return item.salesStarted && !item.salesEnded && !item.soldOut;
|
|
4698
|
+
});
|
|
4699
|
+
|
|
4563
4700
|
var themeMui = material.createTheme(themeOptions);
|
|
4564
4701
|
React.useEffect(function () {
|
|
4565
4702
|
isWindowDefined && window.document.addEventListener('custom-logout', handleLogout);
|
|
@@ -4583,13 +4720,15 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4583
4720
|
selectedTickets: selectedTickets,
|
|
4584
4721
|
handleTicketSelect: handleTicketSelect,
|
|
4585
4722
|
promoCodeIsApplied: promoCodeIsApplied
|
|
4586
|
-
}), event != null && event.salesEnded ? React__default.createElement("p",
|
|
4723
|
+
}), event != null && event.salesEnded ? React__default.createElement("p", {
|
|
4724
|
+
className: 'event-closed-message'
|
|
4725
|
+
}, "Sales for this event are closed.") : !(event != null && event.salesStarted) && event != null && event.salesStart ? React__default.createElement(Countdown, {
|
|
4587
4726
|
startDate: event.salesStart,
|
|
4588
4727
|
timezone: event.timezone,
|
|
4589
4728
|
title: "Sales start in:",
|
|
4590
4729
|
message: "No tickets are currently available for this event.",
|
|
4591
4730
|
callback: updateTickets
|
|
4592
|
-
}) : null, showWaitingList && event.salesStarted && React__default.createElement(WaitingList, {
|
|
4731
|
+
}) : null, showWaitingList && event.salesStarted && !hideWaitingList && React__default.createElement(WaitingList, {
|
|
4593
4732
|
tickets: tickets,
|
|
4594
4733
|
eventId: eventId
|
|
4595
4734
|
}), React__default.createElement(PromoCodeSection, {
|
|
@@ -4602,7 +4741,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4602
4741
|
isPromotionsEnabled: isPromotionsEnabled,
|
|
4603
4742
|
isAccessCodeEnabled: isAccessCodeEnabled,
|
|
4604
4743
|
isAllTicketsSoldOut: isAllTicketsSoldOut
|
|
4605
|
-
}), !
|
|
4744
|
+
}), (isTicketOnSale || !(event != null && event.salesEnded)) && React__default.createElement(Button$1, {
|
|
4606
4745
|
"aria-hidden": true,
|
|
4607
4746
|
className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
|
|
4608
4747
|
onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
|