tf-checkout-react 1.0.99 → 1.0.103

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.
@@ -9,7 +9,7 @@ import _isEqual from 'lodash-es/isEqual';
9
9
  import _isEmpty from 'lodash-es/isEmpty';
10
10
  import axios from 'axios';
11
11
  import _forEach from 'lodash-es/forEach';
12
- import { TextField, FormControl, FormHelperText, InputLabel, CircularProgress as CircularProgress$1, Alert, createTheme as createTheme$1 } from '@mui/material';
12
+ import { TextField, FormControl, FormHelperText, InputLabel, Snackbar, Alert, CircularProgress as CircularProgress$1, createTheme as createTheme$1 } from '@mui/material';
13
13
  import Modal from '@mui/material/Modal';
14
14
  import Box from '@mui/material/Box';
15
15
  import _flatMapDeep from 'lodash-es/flatMapDeep';
@@ -25,12 +25,12 @@ import CircularProgress from '@mui/material/CircularProgress';
25
25
  import Select from '@mui/material/Select';
26
26
  import { createTheme, ThemeProvider } from '@mui/material/styles';
27
27
  import Backdrop from '@mui/material/Backdrop';
28
+ import Countdown$1 from 'react-countdown';
29
+ import _isNumber from 'lodash-es/isNumber';
28
30
  import Container from '@mui/material/Container';
29
31
  import Alert$1 from '@mui/material/Alert';
30
32
  import { useStripe, useElements, CardNumberElement, CardExpiryElement, CardCvcElement, Elements } from '@stripe/react-stripe-js';
31
33
  import { loadStripe } from '@stripe/stripe-js';
32
- import Countdown$1 from 'react-countdown';
33
- import _isNumber from 'lodash-es/isNumber';
34
34
  import { FacebookShareButton, FacebookIcon, FacebookMessengerShareButton, FacebookMessengerIcon, TwitterShareButton, TwitterIcon, LinkedinShareButton, LinkedinIcon, PinterestShareButton, PinterestIcon, VKShareButton, VKIcon, OKShareButton, OKIcon, TelegramShareButton, TelegramIcon, WhatsappShareButton, WhatsappIcon, RedditShareButton, RedditIcon, TumblrShareButton, TumblrIcon, MailruShareButton, MailruIcon, EmailShareButton, EmailIcon, LivejournalShareButton, LivejournalIcon, ViberShareButton, ViberIcon, WorkplaceShareButton, WorkplaceIcon, LineShareButton, LineIcon, PocketShareButton, PocketIcon, InstapaperShareButton, InstapaperIcon, WeiboShareButton, WeiboIcon, HatenaShareButton, HatenaIcon } from 'react-share';
35
35
  import _some from 'lodash-es/some';
36
36
  import _every from 'lodash-es/every';
@@ -1803,7 +1803,7 @@ var setLoggedUserData = function setLoggedUserData(data) {
1803
1803
  email: data.email,
1804
1804
  confirmEmail: data.email,
1805
1805
  city: (data == null ? void 0 : data.city) || '',
1806
- country: (data == null ? void 0 : data.country) || '',
1806
+ country: (data == null ? void 0 : data.countryId) || (data == null ? void 0 : data.country) || '',
1807
1807
  phone: (data == null ? void 0 : data.phone) || '',
1808
1808
  street_address: (data == null ? void 0 : data.streetAddress) || '',
1809
1809
  state: (data == null ? void 0 : data.stateId) || '',
@@ -2160,6 +2160,99 @@ var SelectField = function SelectField(_ref) {
2160
2160
  }, error) : null);
2161
2161
  };
2162
2162
 
2163
+ var showZero = function showZero(value) {
2164
+ if (value === void 0) {
2165
+ value = 0;
2166
+ }
2167
+
2168
+ var intNumber = Number(value);
2169
+ return _isNumber(intNumber) ? intNumber >= 0 && intNumber < 10 ? '0' + intNumber : intNumber : null;
2170
+ };
2171
+
2172
+ var TimerWidget = function TimerWidget(_ref) {
2173
+ var expires_at = _ref.expires_at,
2174
+ buyLoading = _ref.buyLoading,
2175
+ _ref$onCountdownFinis = _ref.onCountdownFinish,
2176
+ onCountdownFinish = _ref$onCountdownFinis === void 0 ? function () {} : _ref$onCountdownFinis;
2177
+
2178
+ var _useState = useState(true),
2179
+ showTimer = _useState[0],
2180
+ setShowTimer = _useState[1];
2181
+
2182
+ var handleCountdownFinish = function handleCountdownFinish() {
2183
+ setShowTimer(false);
2184
+
2185
+ if (!buyLoading) {
2186
+ onCountdownFinish();
2187
+ }
2188
+ };
2189
+
2190
+ var _renderer = function renderer(_ref2) {
2191
+ var minutes = _ref2.minutes,
2192
+ seconds = _ref2.seconds,
2193
+ completed = _ref2.completed,
2194
+ handleCountdownFinish = _ref2.handleCountdownFinish;
2195
+
2196
+ if (completed) {
2197
+ handleCountdownFinish();
2198
+ return null;
2199
+ }
2200
+
2201
+ return React.createElement("span", null, showZero(minutes), ":", showZero(seconds));
2202
+ };
2203
+
2204
+ return showTimer && !!expires_at ? React.createElement("div", {
2205
+ className: "timer"
2206
+ }, React.createElement("div", {
2207
+ className: "toast-message"
2208
+ }, React.createElement("p", null, "Please complete your purchase before the timer reaches zero."), React.createElement("p", {
2209
+ className: "countdown"
2210
+ }, React.createElement(Countdown$1, {
2211
+ date: Date.now() + expires_at * 1000,
2212
+ renderer: function renderer(props) {
2213
+ return _renderer(_extends({}, props, {
2214
+ handleCountdownFinish: handleCountdownFinish
2215
+ }));
2216
+ }
2217
+ })))) : null;
2218
+ };
2219
+
2220
+ var SnackbarAlert = function SnackbarAlert(_ref) {
2221
+ var isOpen = _ref.isOpen,
2222
+ message = _ref.message,
2223
+ type = _ref.type,
2224
+ position = _ref.position,
2225
+ _ref$autoHideDuration = _ref.autoHideDuration,
2226
+ autoHideDuration = _ref$autoHideDuration === void 0 ? 3000 : _ref$autoHideDuration,
2227
+ variant = _ref.variant,
2228
+ onClose = _ref.onClose;
2229
+ return React.createElement("div", {
2230
+ className: "snackbar-alert-container"
2231
+ }, React.createElement(Snackbar, {
2232
+ autoHideDuration: autoHideDuration,
2233
+ open: isOpen,
2234
+ anchorOrigin: position || {
2235
+ vertical: 'top',
2236
+ horizontal: 'center'
2237
+ },
2238
+ onClose: onClose,
2239
+ classes: {
2240
+ root: 'snackbar-alert-snackbar-root'
2241
+ }
2242
+ }, React.createElement(Alert, {
2243
+ severity: type,
2244
+ onClose: onClose,
2245
+ variant: variant || 'filled',
2246
+ classes: {
2247
+ icon: 'snackbar-alert-icon',
2248
+ root: 'snackbar-alert-alert-root',
2249
+ action: 'snackbar-alert-action',
2250
+ message: 'snackbar-alert-message',
2251
+ filled: 'snackbar-alert-filled'
2252
+ }
2253
+ }, message)));
2254
+ };
2255
+
2163
2256
  var LogicRunner = function LogicRunner(_ref) {
2164
2257
  var values = _ref.values,
2165
2258
  setStates = _ref.setStates,
@@ -2322,7 +2415,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2322
2415
  _ref3$skipPage = _ref3.skipPage,
2323
2416
  skipPage = _ref3$skipPage === void 0 ? false : _ref3$skipPage,
2324
2417
  _ref3$canSkipHolderNa = _ref3.canSkipHolderNames,
2325
- canSkipHolderNames = _ref3$canSkipHolderNa === void 0 ? false : _ref3$canSkipHolderNa;
2418
+ canSkipHolderNames = _ref3$canSkipHolderNa === void 0 ? false : _ref3$canSkipHolderNa,
2419
+ _ref3$onCountdownFini = _ref3.onCountdownFinish,
2420
+ onCountdownFinish = _ref3$onCountdownFini === void 0 ? function () {} : _ref3$onCountdownFini,
2421
+ _ref3$enableTimer = _ref3.enableTimer,
2422
+ enableTimer = _ref3$enableTimer === void 0 ? false : _ref3$enableTimer;
2326
2423
 
2327
2424
  var themeMui = createTheme(themeOptions);
2328
2425
  var isWindowDefined = typeof window !== 'undefined';
@@ -2411,6 +2508,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2411
2508
 
2412
2509
  var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true);
2413
2510
 
2511
+ var expirationTime = _get(cartInfoData, 'expires_at');
2512
+
2414
2513
  var flagRequirePhone = getQueryVariable('phone_required') === 'true'; // Get prevProps
2415
2514
 
2416
2515
  var prevData = useRef(data);
@@ -2685,7 +2784,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2685
2784
 
2686
2785
  return React.createElement(ThemeProvider, {
2687
2786
  theme: themeMui
2688
- }, React.createElement(Formik, {
2787
+ }, expirationTime && enableTimer && React.createElement(TimerWidget, {
2788
+ expires_at: expirationTime,
2789
+ onCountdownFinish: onCountdownFinish
2790
+ }), React.createElement(Formik, {
2689
2791
  initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
2690
2792
  country: _get(userData, 'country', '') || '1',
2691
2793
  state: _get(userData, 'state', '') || '1',
@@ -2782,6 +2884,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2782
2884
  setShowModalLogin(true);
2783
2885
  }
2784
2886
 
2887
+ if (_includes(_error, 'The cart is expired') && !hideErrorsAlertSection) {
2888
+ setError(_error);
2889
+ }
2890
+
2785
2891
  onRegisterError(_context6.t0, values.email);
2786
2892
  }
2787
2893
 
@@ -2824,11 +2930,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2824
2930
  }
2825
2931
  }
2826
2932
 
2827
- if ((_e$response3 = _context6.t1.response) != null && _e$response3.data.message) {
2828
- if (typeof document !== undefined) {
2829
- document.body.scrollTop = document.documentElement.scrollTop = 0;
2830
- }
2831
-
2933
+ if ((_e$response3 = _context6.t1.response) != null && _e$response3.data.message && !hideErrorsAlertSection) {
2832
2934
  setError(_get(_context6.t1, 'response.data.message'));
2833
2935
  }
2834
2936
 
@@ -2862,11 +2964,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2862
2964
  onGetStatesError: onGetStatesError
2863
2965
  }), React.createElement("div", {
2864
2966
  className: "billing-info-container " + theme
2865
- }, error && !hideErrorsAlertSection && React.createElement(Alert, {
2866
- severity: "error",
2867
- onClose: onErrorClose,
2868
- variant: "filled"
2869
- }, error), !isLoggedIn && React.createElement("div", {
2967
+ }, React.createElement(SnackbarAlert, {
2968
+ type: "error",
2969
+ isOpen: !!error,
2970
+ message: error || '',
2971
+ onClose: function onClose() {
2972
+ setError(null);
2973
+ onErrorClose();
2974
+ }
2975
+ }), !isLoggedIn && React.createElement("div", {
2870
2976
  className: "account-actions-block"
2871
2977
  }, React.createElement("div", null, accountInfoTitle), React.createElement("div", null, "Login & skip ahead:"), React.createElement("div", {
2872
2978
  className: "login-block"
@@ -2914,6 +3020,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2914
3020
  el.required = flagRequirePhone;
2915
3021
  }
2916
3022
 
3023
+ if (el.name === 'street_address') {
3024
+ el.required = true;
3025
+ }
3026
+
2917
3027
  return true;
2918
3028
  }), function (element) {
2919
3029
  return ['password', 'confirmPassword', 'password-info'].includes(element.name) && isLoggedIn ? null : React.createElement(React.Fragment, {
@@ -3272,63 +3382,6 @@ var CheckoutForm = function CheckoutForm(_ref) {
3272
3382
  }) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
3273
3383
  };
3274
3384
 
3275
- var showZero = function showZero(value) {
3276
- if (value === void 0) {
3277
- value = 0;
3278
- }
3279
-
3280
- var intNumber = Number(value);
3281
- return _isNumber(intNumber) ? intNumber >= 0 && intNumber < 10 ? '0' + intNumber : intNumber : null;
3282
- };
3283
-
3284
- var TimerWidget = function TimerWidget(_ref) {
3285
- var expires_at = _ref.expires_at,
3286
- buyLoading = _ref.buyLoading,
3287
- _ref$onCountdownFinis = _ref.onCountdownFinish,
3288
- onCountdownFinish = _ref$onCountdownFinis === void 0 ? function () {} : _ref$onCountdownFinis;
3289
-
3290
- var _useState = useState(true),
3291
- showTimer = _useState[0],
3292
- setShowTimer = _useState[1];
3293
-
3294
- var handleCountdownFinish = function handleCountdownFinish() {
3295
- setShowTimer(false);
3296
-
3297
- if (!buyLoading) {
3298
- onCountdownFinish();
3299
- }
3300
- };
3301
-
3302
- var _renderer = function renderer(_ref2) {
3303
- var minutes = _ref2.minutes,
3304
- seconds = _ref2.seconds,
3305
- completed = _ref2.completed,
3306
- handleCountdownFinish = _ref2.handleCountdownFinish;
3307
-
3308
- if (completed) {
3309
- handleCountdownFinish();
3310
- return null;
3311
- }
3312
-
3313
- return React.createElement("span", null, showZero(minutes), ":", showZero(seconds));
3314
- };
3315
-
3316
- return showTimer && !!expires_at ? React.createElement("div", {
3317
- className: "timer"
3318
- }, React.createElement("div", {
3319
- className: "toast-message"
3320
- }, React.createElement("p", null, "Please complete your purchase before the timer reaches zero."), React.createElement("p", {
3321
- className: "countdown"
3322
- }, React.createElement(Countdown$1, {
3323
- date: Date.now() + expires_at * 1000,
3324
- renderer: function renderer(props) {
3325
- return _renderer(_extends({}, props, {
3326
- handleCountdownFinish: handleCountdownFinish
3327
- }));
3328
- }
3329
- })))) : null;
3330
- };
3331
-
3332
3385
  var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
3333
3386
 
3334
3387
  var getStripePromise = function getStripePromise(reviewData) {
@@ -3830,7 +3883,9 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3830
3883
  onGetConfirmationDataSuccess = _ref$onGetConfirmatio === void 0 ? function () {} : _ref$onGetConfirmatio,
3831
3884
  _ref$onGetConfirmatio2 = _ref.onGetConfirmationDataError,
3832
3885
  onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2,
3833
- orderHash = _ref.orderHash;
3886
+ orderHash = _ref.orderHash,
3887
+ _ref$onLinkCopied = _ref.onLinkCopied,
3888
+ onLinkCopied = _ref$onLinkCopied === void 0 ? function () {} : _ref$onLinkCopied;
3834
3889
  var inputRef = useRef(null);
3835
3890
 
3836
3891
  var _useState = useState(null),
@@ -3968,7 +4023,8 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3968
4023
  }), React.createElement("div", {
3969
4024
  className: "share-by-link-copy-icon",
3970
4025
  onClick: function onClick() {
3971
- return navigator.clipboard.writeText(_get(inputRef, 'current.value'));
4026
+ navigator.clipboard.writeText(_get(inputRef, 'current.value'));
4027
+ onLinkCopied();
3972
4028
  }
3973
4029
  }, React.createElement("img", {
3974
4030
  src: "https://img.icons8.com/office/50/000000/copy.png",
@@ -4519,7 +4575,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
4519
4575
  _ref$hideSessionButto = _ref.hideSessionButtons,
4520
4576
  hideSessionButtons = _ref$hideSessionButto === void 0 ? false : _ref$hideSessionButto,
4521
4577
  _ref$hideWaitingList = _ref.hideWaitingList,
4522
- hideWaitingList = _ref$hideWaitingList === void 0 ? false : _ref$hideWaitingList;
4578
+ hideWaitingList = _ref$hideWaitingList === void 0 ? false : _ref$hideWaitingList,
4579
+ _ref$isButtonScrollab = _ref.isButtonScrollable,
4580
+ isButtonScrollable = _ref$isButtonScrollab === void 0 ? false : _ref$isButtonScrollab;
4523
4581
 
4524
4582
  var _useState = useState({}),
4525
4583
  selectedTickets = _useState[0],
@@ -4531,50 +4589,51 @@ var TicketsContainer = function TicketsContainer(_ref) {
4531
4589
  isLogged = _useState2[0],
4532
4590
  setIsLogged = _useState2[1];
4533
4591
 
4534
- var _React$useState = React.useState(false),
4535
- showLoginModal = _React$useState[0],
4536
- setShowLoginModal = _React$useState[1];
4537
-
4538
- var _useState3 = useState([]),
4539
- tickets = _useState3[0],
4540
- setTickets = _useState3[1];
4592
+ var _useState3 = useState(false),
4593
+ showLoginModal = _useState3[0],
4594
+ setShowLoginModal = _useState3[1];
4541
4595
 
4542
- var _useState4 = useState(null),
4543
- event = _useState4[0],
4544
- setEvent = _useState4[1];
4596
+ var _useState4 = useState([]),
4597
+ tickets = _useState4[0],
4598
+ setTickets = _useState4[1];
4545
4599
 
4546
- var _useState5 = useState(false),
4547
- showWaitingList = _useState5[0],
4548
- setShowWaitingList = _useState5[1];
4600
+ var _useState5 = useState(null),
4601
+ event = _useState5[0],
4602
+ setEvent = _useState5[1];
4549
4603
 
4550
4604
  var _useState6 = useState(false),
4551
- isLoading = _useState6[0],
4552
- setIsLoading = _useState6[1];
4605
+ showWaitingList = _useState6[0],
4606
+ setShowWaitingList = _useState6[1];
4553
4607
 
4554
4608
  var _useState7 = useState(false),
4555
- isPromoLoading = _useState7[0],
4556
- setIsPromoLoading = _useState7[1];
4609
+ isLoading = _useState7[0],
4610
+ setIsLoading = _useState7[1];
4557
4611
 
4558
4612
  var _useState8 = useState(false),
4559
- handleBookIsLoading = _useState8[0],
4560
- setHandleBookIsLoading = _useState8[1];
4613
+ isPromoLoading = _useState8[0],
4614
+ setIsPromoLoading = _useState8[1];
4561
4615
 
4562
- var _useState9 = useState(''),
4563
- promoCode = _useState9[0],
4564
- setPromoCode = _useState9[1];
4616
+ var _useState9 = useState(false),
4617
+ handleBookIsLoading = _useState9[0],
4618
+ setHandleBookIsLoading = _useState9[1];
4565
4619
 
4566
- var _useState10 = useState(getQueryVariable('r') || queryPromoCode),
4567
- promoCodeUpdated = _useState10[0],
4568
- setPromoCodeUpdated = _useState10[1];
4620
+ var _useState10 = useState(''),
4621
+ promoCode = _useState10[0],
4622
+ setPromoCode = _useState10[1];
4569
4623
 
4570
- var _useState11 = useState(false),
4571
- showPromoInput = _useState11[0],
4572
- setShowPromoInput = _useState11[1];
4624
+ var _useState11 = useState(getQueryVariable('r') || queryPromoCode),
4625
+ promoCodeUpdated = _useState11[0],
4626
+ setPromoCodeUpdated = _useState11[1];
4573
4627
 
4574
4628
  var _useState12 = useState(false),
4575
- promoCodeIsApplied = _useState12[0],
4576
- setPromoCodeIsApplied = _useState12[1];
4629
+ showPromoInput = _useState12[0],
4630
+ setShowPromoInput = _useState12[1];
4631
+
4632
+ var _useState13 = useState(false),
4633
+ promoCodeIsApplied = _useState13[0],
4634
+ setPromoCodeIsApplied = _useState13[1];
4577
4635
 
4636
+ var ticketsContainerRef = useRef(null);
4578
4637
  useEffect(function () {
4579
4638
  if (typeof window !== 'undefined') {
4580
4639
  var access_token = window.localStorage.getItem('access_token');
@@ -4605,6 +4664,19 @@ var TicketsContainer = function TicketsContainer(_ref) {
4605
4664
  }
4606
4665
  };
4607
4666
 
4667
+ useEffect(function () {
4668
+ try {
4669
+ if (typeof window !== 'undefined') {
4670
+ var userData = window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '{}') : {};
4671
+
4672
+ if (userData.country === '') {
4673
+ handleLogout();
4674
+ window.open("https://www.ticketfairy.com/account/change_information?need_country=true");
4675
+ }
4676
+ }
4677
+ } catch (e) {}
4678
+ }, []);
4679
+
4608
4680
  var handleExternalLogin = function handleExternalLogin() {
4609
4681
  setIsLogged(true);
4610
4682
  };
@@ -4838,6 +4910,22 @@ var TicketsContainer = function TicketsContainer(_ref) {
4838
4910
  isWindowDefined && window.document.removeEventListener('custom-login', handleExternalLogin);
4839
4911
  };
4840
4912
  }, []);
4913
+
4914
+ var handleGetTicketClick = function handleGetTicketClick() {
4915
+ if (!handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0) {
4916
+ handleBook();
4917
+ } else {
4918
+ if (isButtonScrollable && ticketsContainerRef && ticketsContainerRef.current) {
4919
+ ticketsContainerRef.current.scrollIntoView({
4920
+ behavior: 'smooth',
4921
+ block: 'center',
4922
+ inline: 'nearest'
4923
+ });
4924
+ }
4925
+ }
4926
+ };
4927
+
4928
+ var bookButtonIsDisabled = handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0;
4841
4929
  return React.createElement(ThemeProvider$1, {
4842
4930
  theme: themeMui
4843
4931
  }, React.createElement(ReferralLogic, {
@@ -4845,7 +4933,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
4845
4933
  }), React.createElement("div", {
4846
4934
  className: "get-tickets-page " + theme,
4847
4935
  style: contentStyle
4848
- }, isLoading ? React.createElement(Loader, null) : React.createElement("div", null, React.createElement(TicketsSection, {
4936
+ }, isLoading ? React.createElement(Loader, null) : React.createElement("div", {
4937
+ ref: ticketsContainerRef
4938
+ }, React.createElement(TicketsSection, {
4849
4939
  ticketsList: tickets,
4850
4940
  selectedTickets: selectedTickets,
4851
4941
  handleTicketSelect: handleTicketSelect,
@@ -4874,8 +4964,8 @@ var TicketsContainer = function TicketsContainer(_ref) {
4874
4964
  isPromoLoading: isPromoLoading
4875
4965
  }), (isTicketOnSale || !(event != null && event.salesEnded)) && React.createElement(Button$1, {
4876
4966
  "aria-hidden": true,
4877
- className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
4878
- onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
4967
+ className: "book-button \n " + (bookButtonIsDisabled ? 'disabled' : '') + " \n " + (isButtonScrollable ? 'is-scrollable' : '') + "\n ",
4968
+ onClick: handleGetTicketClick
4879
4969
  }, getTicketsLabel || 'GET TICKETS'), isLogged && !hideSessionButtons ? React.createElement("div", {
4880
4970
  className: "session-wrapper"
4881
4971
  }, React.createElement("span", {
@@ -4985,16 +5075,30 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
4985
5075
 
4986
5076
  var _useState4 = useState(''),
4987
5077
  filter = _useState4[0],
4988
- setFilter = _useState4[1]; //just once
5078
+ setFilter = _useState4[1];
5079
+
5080
+ var isWindowDefined = typeof window !== 'undefined';
5081
+
5082
+ var _useState5 = useState(isWindowDefined ? !!window.localStorage.getItem('access_token') : false),
5083
+ isLogged = _useState5[0],
5084
+ setIsLogged = _useState5[1];
5085
+
5086
+ var _useState6 = useState(false),
5087
+ showModalLogin = _useState6[0],
5088
+ setShowModalLogin = _useState6[1];
5089
+
5090
+ var _useState7 = useState(false),
5091
+ userExpired = _useState7[0],
5092
+ setUserExpired = _useState7[1]; //just once
4989
5093
 
4990
5094
 
4991
5095
  useEffect(function () {
4992
5096
  fetchData(1, limit, filter);
4993
- }, []);
5097
+ }, [isLogged]);
4994
5098
 
4995
5099
  var fetchData = /*#__PURE__*/function () {
4996
5100
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(page, limit, filter) {
4997
- var response, _data;
5101
+ var response, _data, _error$response;
4998
5102
 
4999
5103
  return runtime_1.wrap(function _callee$(_context) {
5000
5104
  while (1) {
@@ -5011,25 +5115,37 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
5011
5115
  _data = _get(response, 'data.data.attributes');
5012
5116
  _data.page -= 1;
5013
5117
  setData(_data);
5014
- _context.next = 14;
5118
+ _context.next = 15;
5015
5119
  break;
5016
5120
 
5017
5121
  case 11:
5018
5122
  _context.prev = 11;
5019
5123
  _context.t0 = _context["catch"](0);
5124
+
5125
+ if (axios.isAxiosError(_context.t0)) {
5126
+ if (((_error$response = _context.t0.response) == null ? void 0 : _error$response.data.error) === 'invalid_token') {
5127
+ if (isWindowDefined) {
5128
+ window.localStorage.removeItem('user_data');
5129
+ window.localStorage.removeItem('access_token');
5130
+ setUserExpired(true);
5131
+ setShowModalLogin(true);
5132
+ }
5133
+ }
5134
+ }
5135
+
5020
5136
  onGetOrdersError(_context.t0);
5021
5137
 
5022
- case 14:
5023
- _context.prev = 14;
5138
+ case 15:
5139
+ _context.prev = 15;
5024
5140
  setLoading(false);
5025
- return _context.finish(14);
5141
+ return _context.finish(15);
5026
5142
 
5027
- case 17:
5143
+ case 18:
5028
5144
  case "end":
5029
5145
  return _context.stop();
5030
5146
  }
5031
5147
  }
5032
- }, _callee, null, [[0, 11, 14, 17]]);
5148
+ }, _callee, null, [[0, 11, 15, 18]]);
5033
5149
  }));
5034
5150
 
5035
5151
  return function fetchData(_x, _x2, _x3) {
@@ -5055,7 +5171,22 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
5055
5171
  className: "my-ticket " + theme
5056
5172
  }, loading && React.createElement("div", {
5057
5173
  className: "loading"
5058
- }, React.createElement(CircularProgress, null)), data && React.createElement(React.Fragment, null, React.createElement(Autocomplete, {
5174
+ }, React.createElement(CircularProgress, null)), !isLogged ? React.createElement("div", {
5175
+ className: "account-actions-block"
5176
+ }, React.createElement("div", {
5177
+ className: "login-block"
5178
+ }, React.createElement("button", {
5179
+ className: "login-register-button",
5180
+ type: "button",
5181
+ onClick: function onClick() {
5182
+ setShowModalLogin(true);
5183
+ }
5184
+ }, "Login"), React.createElement("div", {
5185
+ className: "logo-image-container"
5186
+ }, React.createElement("img", {
5187
+ src: theme === 'dark' ? 'https://www.ticketfairy.com/resources/images/logo-ttf.svg' : 'https://www.ticketfairy.com/resources/images/logo-ttf-black.svg',
5188
+ alt: "nodata"
5189
+ })))) : null, data && React.createElement(React.Fragment, null, React.createElement(Autocomplete, {
5059
5190
  disablePortal: true,
5060
5191
  id: "combo-box-demo",
5061
5192
  getOptionLabel: function getOptionLabel(option) {
@@ -5094,6 +5225,16 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
5094
5225
  page: data.page,
5095
5226
  onPageChange: handleChangePage,
5096
5227
  onRowsPerPageChange: handleChangeRowsPerPage
5228
+ })), React.createElement(React.Fragment, null, showModalLogin && React.createElement(LoginModal, {
5229
+ onClose: function onClose() {
5230
+ setShowModalLogin(false);
5231
+ },
5232
+ onLogin: function onLogin() {
5233
+ setShowModalLogin(false);
5234
+ setUserExpired(false);
5235
+ setIsLogged(true);
5236
+ },
5237
+ userExpired: userExpired
5097
5238
  })));
5098
5239
  };
5099
5240