tf-checkout-react 1.0.87 → 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 +3 -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 +188 -45
- 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 +189 -46
- 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/components/billing-info-container/index.tsx +42 -2
- package/src/components/paymentContainer/index.tsx +30 -10
- package/src/components/ticketsContainer/index.tsx +4 -2
- package/src/components/timerWidget/index.tsx +70 -0
- package/src/components/timerWidget/style.css +26 -0
- package/src/utils/showZero.tsx +10 -0
|
@@ -39,5 +39,7 @@ export interface IBillingInfoPage {
|
|
|
39
39
|
checkbox?: CSSProperties;
|
|
40
40
|
};
|
|
41
41
|
hideErrorsAlertSection?: boolean;
|
|
42
|
+
onSkipBillingPage: (data: any) => void;
|
|
43
|
+
skipPage?: boolean;
|
|
42
44
|
}
|
|
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;
|
|
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;
|
|
@@ -30,11 +30,14 @@ var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
|
|
|
30
30
|
var Select = _interopDefault(require('@mui/material/Select'));
|
|
31
31
|
var MuiPhoneNumber = _interopDefault(require('material-ui-phone-number'));
|
|
32
32
|
var styles$1 = require('@mui/material/styles');
|
|
33
|
+
var Backdrop = _interopDefault(require('@mui/material/Backdrop'));
|
|
33
34
|
var Container = _interopDefault(require('@mui/material/Container'));
|
|
34
35
|
var CircularProgress = _interopDefault(require('@mui/material/CircularProgress'));
|
|
35
36
|
var Alert = _interopDefault(require('@mui/material/Alert'));
|
|
36
37
|
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
37
38
|
var stripeJs = require('@stripe/stripe-js');
|
|
39
|
+
var Countdown$1 = _interopDefault(require('react-countdown'));
|
|
40
|
+
var _isNumber = _interopDefault(require('lodash/isNumber'));
|
|
38
41
|
var reactShare = require('react-share');
|
|
39
42
|
var _some = _interopDefault(require('lodash/some'));
|
|
40
43
|
var _every = _interopDefault(require('lodash/every'));
|
|
@@ -2261,7 +2264,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2261
2264
|
_ref3$onErrorClose = _ref3.onErrorClose,
|
|
2262
2265
|
onErrorClose = _ref3$onErrorClose === void 0 ? function () {} : _ref3$onErrorClose,
|
|
2263
2266
|
_ref3$hideErrorsAlert = _ref3.hideErrorsAlertSection,
|
|
2264
|
-
hideErrorsAlertSection = _ref3$hideErrorsAlert === void 0 ? false : _ref3$hideErrorsAlert
|
|
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
|
|
|
@@ -2534,6 +2545,71 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2534
2545
|
React.useEffect(function () {
|
|
2535
2546
|
fetchUserData(access_token);
|
|
2536
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
|
+
|
|
2537
2613
|
return React__default.createElement(styles$1.ThemeProvider, {
|
|
2538
2614
|
theme: themeMui
|
|
2539
2615
|
}, React__default.createElement(formik.Formik, {
|
|
@@ -2545,30 +2621,30 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2545
2621
|
}), userValues),
|
|
2546
2622
|
enableReinitialize: true,
|
|
2547
2623
|
onSubmit: function () {
|
|
2548
|
-
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2624
|
+
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
|
|
2549
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;
|
|
2550
2626
|
|
|
2551
|
-
return runtime_1.wrap(function
|
|
2627
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2552
2628
|
while (1) {
|
|
2553
|
-
switch (
|
|
2629
|
+
switch (_context6.prev = _context6.next) {
|
|
2554
2630
|
case 0:
|
|
2555
|
-
|
|
2631
|
+
_context6.prev = 0;
|
|
2556
2632
|
|
|
2557
2633
|
if (!isLoggedIn) {
|
|
2558
|
-
|
|
2634
|
+
_context6.next = 17;
|
|
2559
2635
|
break;
|
|
2560
2636
|
}
|
|
2561
2637
|
|
|
2562
2638
|
if (!access_token) {
|
|
2563
|
-
|
|
2639
|
+
_context6.next = 9;
|
|
2564
2640
|
break;
|
|
2565
2641
|
}
|
|
2566
2642
|
|
|
2567
|
-
|
|
2643
|
+
_context6.next = 5;
|
|
2568
2644
|
return getProfileData(access_token);
|
|
2569
2645
|
|
|
2570
2646
|
case 5:
|
|
2571
|
-
updatedUserData =
|
|
2647
|
+
updatedUserData = _context6.sent;
|
|
2572
2648
|
_profileSpecifiedData = _get(updatedUserData, 'data.data');
|
|
2573
2649
|
_profileDataObj = setLoggedUserData(_profileSpecifiedData);
|
|
2574
2650
|
|
|
@@ -2582,17 +2658,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2582
2658
|
firstNameLogged: firstNameLogged,
|
|
2583
2659
|
lastNameLogged: lastNameLogged
|
|
2584
2660
|
}, showDOB);
|
|
2585
|
-
|
|
2661
|
+
_context6.next = 12;
|
|
2586
2662
|
return postOnCheckout(_checkoutBody, access_token);
|
|
2587
2663
|
|
|
2588
2664
|
case 12:
|
|
2589
|
-
_res =
|
|
2590
|
-
|
|
2665
|
+
_res = _context6.sent;
|
|
2666
|
+
_context6.next = 15;
|
|
2591
2667
|
return getPaymentData(_res.data.data.attributes.hash);
|
|
2592
2668
|
|
|
2593
2669
|
case 15:
|
|
2594
2670
|
handleSubmit(values, formikHelpers, eventId, _res);
|
|
2595
|
-
return
|
|
2671
|
+
return _context6.abrupt("return");
|
|
2596
2672
|
|
|
2597
2673
|
case 17:
|
|
2598
2674
|
checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
@@ -2602,12 +2678,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2602
2678
|
}, showDOB);
|
|
2603
2679
|
bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
|
|
2604
2680
|
access_token_register = null;
|
|
2605
|
-
|
|
2606
|
-
|
|
2681
|
+
_context6.prev = 20;
|
|
2682
|
+
_context6.next = 23;
|
|
2607
2683
|
return register(bodyFormData);
|
|
2608
2684
|
|
|
2609
2685
|
case 23:
|
|
2610
|
-
resRegister =
|
|
2686
|
+
resRegister = _context6.sent;
|
|
2611
2687
|
access_token_register = _get(resRegister, 'data.data.attributes.access_token');
|
|
2612
2688
|
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
2613
2689
|
handleSetAccessToken(access_token_register);
|
|
@@ -2616,15 +2692,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2616
2692
|
refreshToken: refreshToken
|
|
2617
2693
|
};
|
|
2618
2694
|
onRegisterSuccess(tokens);
|
|
2619
|
-
|
|
2695
|
+
_context6.next = 35;
|
|
2620
2696
|
break;
|
|
2621
2697
|
|
|
2622
2698
|
case 31:
|
|
2623
|
-
|
|
2624
|
-
|
|
2699
|
+
_context6.prev = 31;
|
|
2700
|
+
_context6.t0 = _context6["catch"](20);
|
|
2625
2701
|
|
|
2626
|
-
if (axios.isAxiosError(
|
|
2627
|
-
_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;
|
|
2628
2704
|
|
|
2629
2705
|
if (_includes(_error, 'You must be aged')) {
|
|
2630
2706
|
formikHelpers.setFieldError('holderAge', _error);
|
|
@@ -2641,17 +2717,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2641
2717
|
setShowModalLogin(true);
|
|
2642
2718
|
}
|
|
2643
2719
|
|
|
2644
|
-
onRegisterError(
|
|
2720
|
+
onRegisterError(_context6.t0, values.email);
|
|
2645
2721
|
}
|
|
2646
2722
|
|
|
2647
|
-
return
|
|
2723
|
+
return _context6.abrupt("return");
|
|
2648
2724
|
|
|
2649
2725
|
case 35:
|
|
2650
|
-
|
|
2726
|
+
_context6.next = 37;
|
|
2651
2727
|
return getProfileData(access_token_register);
|
|
2652
2728
|
|
|
2653
2729
|
case 37:
|
|
2654
|
-
profileData =
|
|
2730
|
+
profileData = _context6.sent;
|
|
2655
2731
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2656
2732
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
2657
2733
|
|
|
@@ -2664,25 +2740,25 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2664
2740
|
firstNameLogged: firstNameLogged,
|
|
2665
2741
|
lastNameLogged: lastNameLogged
|
|
2666
2742
|
}, showDOB);
|
|
2667
|
-
|
|
2743
|
+
_context6.next = 44;
|
|
2668
2744
|
return postOnCheckout(checkoutBody, access_token_register);
|
|
2669
2745
|
|
|
2670
2746
|
case 44:
|
|
2671
|
-
res =
|
|
2672
|
-
|
|
2747
|
+
res = _context6.sent;
|
|
2748
|
+
_context6.next = 47;
|
|
2673
2749
|
return getPaymentData(res.data.data.attributes.hash);
|
|
2674
2750
|
|
|
2675
2751
|
case 47:
|
|
2676
2752
|
handleSubmit(values, formikHelpers, eventId, res);
|
|
2677
|
-
|
|
2753
|
+
_context6.next = 53;
|
|
2678
2754
|
break;
|
|
2679
2755
|
|
|
2680
2756
|
case 50:
|
|
2681
|
-
|
|
2682
|
-
|
|
2757
|
+
_context6.prev = 50;
|
|
2758
|
+
_context6.t1 = _context6["catch"](0);
|
|
2683
2759
|
|
|
2684
|
-
if (axios.isAxiosError(
|
|
2685
|
-
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') {
|
|
2686
2762
|
if (isWindowDefined) {
|
|
2687
2763
|
window.localStorage.removeItem('user_data');
|
|
2688
2764
|
window.localStorage.removeItem('access_token');
|
|
@@ -2691,23 +2767,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2691
2767
|
}
|
|
2692
2768
|
}
|
|
2693
2769
|
|
|
2694
|
-
if ((_e$response3 =
|
|
2770
|
+
if ((_e$response3 = _context6.t1.response) != null && _e$response3.data.message) {
|
|
2695
2771
|
if (typeof document !== undefined) {
|
|
2696
2772
|
document.body.scrollTop = document.documentElement.scrollTop = 0;
|
|
2697
2773
|
}
|
|
2698
2774
|
|
|
2699
|
-
setError(_get(
|
|
2775
|
+
setError(_get(_context6.t1, 'response.data.message'));
|
|
2700
2776
|
}
|
|
2701
2777
|
|
|
2702
|
-
onSubmitError(
|
|
2778
|
+
onSubmitError(_context6.t1);
|
|
2703
2779
|
}
|
|
2704
2780
|
|
|
2705
2781
|
case 53:
|
|
2706
2782
|
case "end":
|
|
2707
|
-
return
|
|
2783
|
+
return _context6.stop();
|
|
2708
2784
|
}
|
|
2709
2785
|
}
|
|
2710
|
-
},
|
|
2786
|
+
}, _callee6, null, [[0, 50], [20, 31]]);
|
|
2711
2787
|
}));
|
|
2712
2788
|
|
|
2713
2789
|
function onSubmit(_x2, _x3) {
|
|
@@ -3135,6 +3211,63 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
3135
3211
|
}) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
|
|
3136
3212
|
};
|
|
3137
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
|
+
|
|
3138
3271
|
var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
|
|
3139
3272
|
|
|
3140
3273
|
var getStripePromise = function getStripePromise(reviewData) {
|
|
@@ -3195,7 +3328,11 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3195
3328
|
_ref$disableZipSectio = _ref.disableZipSection,
|
|
3196
3329
|
disableZipSection = _ref$disableZipSectio === void 0 ? false : _ref$disableZipSectio,
|
|
3197
3330
|
themeOptions = _ref.themeOptions,
|
|
3198
|
-
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;
|
|
3199
3336
|
|
|
3200
3337
|
var _useState = React.useState(initialReviewValues),
|
|
3201
3338
|
reviewData = _useState[0],
|
|
@@ -3384,7 +3521,11 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3384
3521
|
theme: themeMui
|
|
3385
3522
|
}, React__default.createElement("div", {
|
|
3386
3523
|
className: "payment_page"
|
|
3387
|
-
}, 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, {
|
|
3388
3529
|
severity: "error",
|
|
3389
3530
|
onClose: onErrorClose,
|
|
3390
3531
|
variant: "filled"
|
|
@@ -4255,7 +4396,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4255
4396
|
_ref$isAccessCodeEnab = _ref.isAccessCodeEnabled,
|
|
4256
4397
|
isAccessCodeEnabled = _ref$isAccessCodeEnab === void 0 ? false : _ref$isAccessCodeEnab,
|
|
4257
4398
|
_ref$hideSessionButto = _ref.hideSessionButtons,
|
|
4258
|
-
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;
|
|
4259
4402
|
|
|
4260
4403
|
var _useState = React.useState({}),
|
|
4261
4404
|
selectedTickets = _useState[0],
|
|
@@ -4585,7 +4728,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4585
4728
|
title: "Sales start in:",
|
|
4586
4729
|
message: "No tickets are currently available for this event.",
|
|
4587
4730
|
callback: updateTickets
|
|
4588
|
-
}) : null, showWaitingList && event.salesStarted && React__default.createElement(WaitingList, {
|
|
4731
|
+
}) : null, showWaitingList && event.salesStarted && !hideWaitingList && React__default.createElement(WaitingList, {
|
|
4589
4732
|
tickets: tickets,
|
|
4590
4733
|
eventId: eventId
|
|
4591
4734
|
}), React__default.createElement(PromoCodeSection, {
|