tf-checkout-react 1.0.101 → 1.0.102

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.
Files changed (81) hide show
  1. package/dist/components/billing-info-container/index.d.ts +3 -1
  2. package/dist/components/common/SnackbarAlert.d.ts +13 -0
  3. package/dist/components/confirmationContainer/index.d.ts +2 -1
  4. package/dist/components/ticketsContainer/index.d.ts +2 -1
  5. package/dist/env.d.ts +1 -0
  6. package/dist/images/done.svg +3 -3
  7. package/dist/tf-checkout-react.cjs.development.js +242 -117
  8. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  9. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  10. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  11. package/dist/tf-checkout-react.esm.js +243 -118
  12. package/dist/tf-checkout-react.esm.js.map +1 -1
  13. package/dist/tf-checkout-styles.css +1 -1
  14. package/package.json +89 -89
  15. package/src/.DS_Store +0 -0
  16. package/src/.d.ts +2 -2
  17. package/src/api/index.ts +278 -278
  18. package/src/assets/images/done.svg +3 -3
  19. package/src/components/.DS_Store +0 -0
  20. package/src/components/billing-info-container/index.tsx +796 -777
  21. package/src/components/billing-info-container/style.css +105 -105
  22. package/src/components/billing-info-container/utils.ts +224 -224
  23. package/src/components/common/CheckboxField.tsx +41 -41
  24. package/src/components/common/CustomField.tsx +84 -84
  25. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  26. package/src/components/common/Loader.tsx +9 -9
  27. package/src/components/common/RadioField.tsx +35 -35
  28. package/src/components/common/SelectField.tsx +80 -80
  29. package/src/components/common/SnackbarAlert.tsx +54 -0
  30. package/src/components/common/index.tsx +4 -4
  31. package/src/components/confirmModal/index.tsx +51 -51
  32. package/src/components/confirmModal/style.css +21 -21
  33. package/src/components/confirmationContainer/config.ts +72 -72
  34. package/src/components/confirmationContainer/index.tsx +197 -194
  35. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  36. package/src/components/confirmationContainer/style.css +202 -202
  37. package/src/components/countdown/index.tsx +89 -89
  38. package/src/components/countdown/style.css +9 -9
  39. package/src/components/index.ts +7 -7
  40. package/src/components/loginModal/index.tsx +209 -209
  41. package/src/components/loginModal/style.css +71 -71
  42. package/src/components/myTicketsContainer/index.tsx +196 -137
  43. package/src/components/myTicketsContainer/row.tsx +41 -41
  44. package/src/components/myTicketsContainer/style.css +39 -39
  45. package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
  46. package/src/components/orderDetailsContainer/index.tsx +249 -249
  47. package/src/components/orderDetailsContainer/style.css +72 -72
  48. package/src/components/orderDetailsContainer/ticketsTable.tsx +124 -124
  49. package/src/components/paymentContainer/index.tsx +284 -284
  50. package/src/components/registerModal/index.tsx +190 -190
  51. package/src/components/stripePayment/index.tsx +253 -253
  52. package/src/components/stripePayment/style.css +59 -59
  53. package/src/components/ticketResale/index.tsx +56 -56
  54. package/src/components/ticketResaleModal/index.tsx +210 -210
  55. package/src/components/ticketResaleModal/style.css +28 -28
  56. package/src/components/ticketsContainer/PromoCodeSection.tsx +99 -99
  57. package/src/components/ticketsContainer/ReferralLogic.tsx +33 -33
  58. package/src/components/ticketsContainer/TicketRow.tsx +83 -83
  59. package/src/components/ticketsContainer/TicketsSection.tsx +81 -81
  60. package/src/components/ticketsContainer/index.tsx +430 -422
  61. package/src/components/ticketsContainer/style.css +181 -181
  62. package/src/components/ticketsContainer/utils.ts +11 -11
  63. package/src/components/timerWidget/index.tsx +70 -70
  64. package/src/components/timerWidget/style.css +26 -26
  65. package/src/components/waitingList/index.tsx +178 -178
  66. package/src/components/waitingList/style.css +26 -26
  67. package/src/env.ts +20 -19
  68. package/src/index.ts +13 -13
  69. package/src/normalizers/index.ts +45 -45
  70. package/src/types/billing-info-data.ts +37 -37
  71. package/src/types/payment-field.ts +7 -7
  72. package/src/types/referral-promotion.ts +7 -7
  73. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
  74. package/src/utils/downloadPDF.tsx +30 -30
  75. package/src/utils/formikErrorFocus.ts +24 -24
  76. package/src/utils/getImage.ts +14 -14
  77. package/src/utils/getQueryVariable.ts +13 -13
  78. package/src/utils/index.ts +5 -5
  79. package/src/utils/setConfigs.ts +26 -26
  80. package/src/utils/showZero.tsx +10 -10
  81. package/src/validators/index.ts +20 -20
@@ -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';
@@ -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"
@@ -3272,63 +3378,6 @@ var CheckoutForm = function CheckoutForm(_ref) {
3272
3378
  }) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
3273
3379
  };
3274
3380
 
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
3381
  var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
3333
3382
 
3334
3383
  var getStripePromise = function getStripePromise(reviewData) {
@@ -3830,7 +3879,9 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3830
3879
  onGetConfirmationDataSuccess = _ref$onGetConfirmatio === void 0 ? function () {} : _ref$onGetConfirmatio,
3831
3880
  _ref$onGetConfirmatio2 = _ref.onGetConfirmationDataError,
3832
3881
  onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2,
3833
- orderHash = _ref.orderHash;
3882
+ orderHash = _ref.orderHash,
3883
+ _ref$onLinkCopied = _ref.onLinkCopied,
3884
+ onLinkCopied = _ref$onLinkCopied === void 0 ? function () {} : _ref$onLinkCopied;
3834
3885
  var inputRef = useRef(null);
3835
3886
 
3836
3887
  var _useState = useState(null),
@@ -3968,7 +4019,8 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3968
4019
  }), React.createElement("div", {
3969
4020
  className: "share-by-link-copy-icon",
3970
4021
  onClick: function onClick() {
3971
- return navigator.clipboard.writeText(_get(inputRef, 'current.value'));
4022
+ navigator.clipboard.writeText(_get(inputRef, 'current.value'));
4023
+ onLinkCopied();
3972
4024
  }
3973
4025
  }, React.createElement("img", {
3974
4026
  src: "https://img.icons8.com/office/50/000000/copy.png",
@@ -4519,7 +4571,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
4519
4571
  _ref$hideSessionButto = _ref.hideSessionButtons,
4520
4572
  hideSessionButtons = _ref$hideSessionButto === void 0 ? false : _ref$hideSessionButto,
4521
4573
  _ref$hideWaitingList = _ref.hideWaitingList,
4522
- hideWaitingList = _ref$hideWaitingList === void 0 ? false : _ref$hideWaitingList;
4574
+ hideWaitingList = _ref$hideWaitingList === void 0 ? false : _ref$hideWaitingList,
4575
+ _ref$isButtonScrollab = _ref.isButtonScrollable,
4576
+ isButtonScrollable = _ref$isButtonScrollab === void 0 ? false : _ref$isButtonScrollab;
4523
4577
 
4524
4578
  var _useState = useState({}),
4525
4579
  selectedTickets = _useState[0],
@@ -4531,50 +4585,51 @@ var TicketsContainer = function TicketsContainer(_ref) {
4531
4585
  isLogged = _useState2[0],
4532
4586
  setIsLogged = _useState2[1];
4533
4587
 
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];
4588
+ var _useState3 = useState(false),
4589
+ showLoginModal = _useState3[0],
4590
+ setShowLoginModal = _useState3[1];
4541
4591
 
4542
- var _useState4 = useState(null),
4543
- event = _useState4[0],
4544
- setEvent = _useState4[1];
4592
+ var _useState4 = useState([]),
4593
+ tickets = _useState4[0],
4594
+ setTickets = _useState4[1];
4545
4595
 
4546
- var _useState5 = useState(false),
4547
- showWaitingList = _useState5[0],
4548
- setShowWaitingList = _useState5[1];
4596
+ var _useState5 = useState(null),
4597
+ event = _useState5[0],
4598
+ setEvent = _useState5[1];
4549
4599
 
4550
4600
  var _useState6 = useState(false),
4551
- isLoading = _useState6[0],
4552
- setIsLoading = _useState6[1];
4601
+ showWaitingList = _useState6[0],
4602
+ setShowWaitingList = _useState6[1];
4553
4603
 
4554
4604
  var _useState7 = useState(false),
4555
- isPromoLoading = _useState7[0],
4556
- setIsPromoLoading = _useState7[1];
4605
+ isLoading = _useState7[0],
4606
+ setIsLoading = _useState7[1];
4557
4607
 
4558
4608
  var _useState8 = useState(false),
4559
- handleBookIsLoading = _useState8[0],
4560
- setHandleBookIsLoading = _useState8[1];
4609
+ isPromoLoading = _useState8[0],
4610
+ setIsPromoLoading = _useState8[1];
4561
4611
 
4562
- var _useState9 = useState(''),
4563
- promoCode = _useState9[0],
4564
- setPromoCode = _useState9[1];
4612
+ var _useState9 = useState(false),
4613
+ handleBookIsLoading = _useState9[0],
4614
+ setHandleBookIsLoading = _useState9[1];
4565
4615
 
4566
- var _useState10 = useState(getQueryVariable('r') || queryPromoCode),
4567
- promoCodeUpdated = _useState10[0],
4568
- setPromoCodeUpdated = _useState10[1];
4616
+ var _useState10 = useState(''),
4617
+ promoCode = _useState10[0],
4618
+ setPromoCode = _useState10[1];
4569
4619
 
4570
- var _useState11 = useState(false),
4571
- showPromoInput = _useState11[0],
4572
- setShowPromoInput = _useState11[1];
4620
+ var _useState11 = useState(getQueryVariable('r') || queryPromoCode),
4621
+ promoCodeUpdated = _useState11[0],
4622
+ setPromoCodeUpdated = _useState11[1];
4573
4623
 
4574
4624
  var _useState12 = useState(false),
4575
- promoCodeIsApplied = _useState12[0],
4576
- setPromoCodeIsApplied = _useState12[1];
4625
+ showPromoInput = _useState12[0],
4626
+ setShowPromoInput = _useState12[1];
4627
+
4628
+ var _useState13 = useState(false),
4629
+ promoCodeIsApplied = _useState13[0],
4630
+ setPromoCodeIsApplied = _useState13[1];
4577
4631
 
4632
+ var ticketsContainerRef = useRef(null);
4578
4633
  useEffect(function () {
4579
4634
  if (typeof window !== 'undefined') {
4580
4635
  var access_token = window.localStorage.getItem('access_token');
@@ -4612,6 +4667,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
4612
4667
 
4613
4668
  if (userData.country === '') {
4614
4669
  handleLogout();
4670
+ window.open("https://www.ticketfairy.com/account/change_information?need_country=true");
4615
4671
  }
4616
4672
  }
4617
4673
  } catch (e) {}
@@ -4850,6 +4906,22 @@ var TicketsContainer = function TicketsContainer(_ref) {
4850
4906
  isWindowDefined && window.document.removeEventListener('custom-login', handleExternalLogin);
4851
4907
  };
4852
4908
  }, []);
4909
+
4910
+ var handleGetTicketClick = function handleGetTicketClick() {
4911
+ if (!handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0) {
4912
+ handleBook();
4913
+ } else {
4914
+ if (isButtonScrollable && ticketsContainerRef && ticketsContainerRef.current) {
4915
+ ticketsContainerRef.current.scrollIntoView({
4916
+ behavior: 'smooth',
4917
+ block: 'center',
4918
+ inline: 'nearest'
4919
+ });
4920
+ }
4921
+ }
4922
+ };
4923
+
4924
+ var bookButtonIsDisabled = handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0;
4853
4925
  return React.createElement(ThemeProvider$1, {
4854
4926
  theme: themeMui
4855
4927
  }, React.createElement(ReferralLogic, {
@@ -4857,7 +4929,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
4857
4929
  }), React.createElement("div", {
4858
4930
  className: "get-tickets-page " + theme,
4859
4931
  style: contentStyle
4860
- }, isLoading ? React.createElement(Loader, null) : React.createElement("div", null, React.createElement(TicketsSection, {
4932
+ }, isLoading ? React.createElement(Loader, null) : React.createElement("div", {
4933
+ ref: ticketsContainerRef
4934
+ }, React.createElement(TicketsSection, {
4861
4935
  ticketsList: tickets,
4862
4936
  selectedTickets: selectedTickets,
4863
4937
  handleTicketSelect: handleTicketSelect,
@@ -4886,8 +4960,8 @@ var TicketsContainer = function TicketsContainer(_ref) {
4886
4960
  isPromoLoading: isPromoLoading
4887
4961
  }), (isTicketOnSale || !(event != null && event.salesEnded)) && React.createElement(Button$1, {
4888
4962
  "aria-hidden": true,
4889
- className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
4890
- onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
4963
+ className: "book-button \n " + (bookButtonIsDisabled ? 'disabled' : '') + " \n " + (isButtonScrollable ? 'is-scrollable' : '') + "\n ",
4964
+ onClick: handleGetTicketClick
4891
4965
  }, getTicketsLabel || 'GET TICKETS'), isLogged && !hideSessionButtons ? React.createElement("div", {
4892
4966
  className: "session-wrapper"
4893
4967
  }, React.createElement("span", {
@@ -4997,16 +5071,30 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
4997
5071
 
4998
5072
  var _useState4 = useState(''),
4999
5073
  filter = _useState4[0],
5000
- setFilter = _useState4[1]; //just once
5074
+ setFilter = _useState4[1];
5075
+
5076
+ var isWindowDefined = typeof window !== 'undefined';
5077
+
5078
+ var _useState5 = useState(isWindowDefined ? !!window.localStorage.getItem('access_token') : false),
5079
+ isLogged = _useState5[0],
5080
+ setIsLogged = _useState5[1];
5081
+
5082
+ var _useState6 = useState(false),
5083
+ showModalLogin = _useState6[0],
5084
+ setShowModalLogin = _useState6[1];
5085
+
5086
+ var _useState7 = useState(false),
5087
+ userExpired = _useState7[0],
5088
+ setUserExpired = _useState7[1]; //just once
5001
5089
 
5002
5090
 
5003
5091
  useEffect(function () {
5004
5092
  fetchData(1, limit, filter);
5005
- }, []);
5093
+ }, [isLogged]);
5006
5094
 
5007
5095
  var fetchData = /*#__PURE__*/function () {
5008
5096
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(page, limit, filter) {
5009
- var response, _data;
5097
+ var response, _data, _error$response;
5010
5098
 
5011
5099
  return runtime_1.wrap(function _callee$(_context) {
5012
5100
  while (1) {
@@ -5023,25 +5111,37 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
5023
5111
  _data = _get(response, 'data.data.attributes');
5024
5112
  _data.page -= 1;
5025
5113
  setData(_data);
5026
- _context.next = 14;
5114
+ _context.next = 15;
5027
5115
  break;
5028
5116
 
5029
5117
  case 11:
5030
5118
  _context.prev = 11;
5031
5119
  _context.t0 = _context["catch"](0);
5120
+
5121
+ if (axios.isAxiosError(_context.t0)) {
5122
+ if (((_error$response = _context.t0.response) == null ? void 0 : _error$response.data.error) === 'invalid_token') {
5123
+ if (isWindowDefined) {
5124
+ window.localStorage.removeItem('user_data');
5125
+ window.localStorage.removeItem('access_token');
5126
+ setUserExpired(true);
5127
+ setShowModalLogin(true);
5128
+ }
5129
+ }
5130
+ }
5131
+
5032
5132
  onGetOrdersError(_context.t0);
5033
5133
 
5034
- case 14:
5035
- _context.prev = 14;
5134
+ case 15:
5135
+ _context.prev = 15;
5036
5136
  setLoading(false);
5037
- return _context.finish(14);
5137
+ return _context.finish(15);
5038
5138
 
5039
- case 17:
5139
+ case 18:
5040
5140
  case "end":
5041
5141
  return _context.stop();
5042
5142
  }
5043
5143
  }
5044
- }, _callee, null, [[0, 11, 14, 17]]);
5144
+ }, _callee, null, [[0, 11, 15, 18]]);
5045
5145
  }));
5046
5146
 
5047
5147
  return function fetchData(_x, _x2, _x3) {
@@ -5067,7 +5167,22 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
5067
5167
  className: "my-ticket " + theme
5068
5168
  }, loading && React.createElement("div", {
5069
5169
  className: "loading"
5070
- }, React.createElement(CircularProgress, null)), data && React.createElement(React.Fragment, null, React.createElement(Autocomplete, {
5170
+ }, React.createElement(CircularProgress, null)), !isLogged ? React.createElement("div", {
5171
+ className: "account-actions-block"
5172
+ }, React.createElement("div", {
5173
+ className: "login-block"
5174
+ }, React.createElement("button", {
5175
+ className: "login-register-button",
5176
+ type: "button",
5177
+ onClick: function onClick() {
5178
+ setShowModalLogin(true);
5179
+ }
5180
+ }, "Login"), React.createElement("div", {
5181
+ className: "logo-image-container"
5182
+ }, React.createElement("img", {
5183
+ src: theme === 'dark' ? 'https://www.ticketfairy.com/resources/images/logo-ttf.svg' : 'https://www.ticketfairy.com/resources/images/logo-ttf-black.svg',
5184
+ alt: "nodata"
5185
+ })))) : null, data && React.createElement(React.Fragment, null, React.createElement(Autocomplete, {
5071
5186
  disablePortal: true,
5072
5187
  id: "combo-box-demo",
5073
5188
  getOptionLabel: function getOptionLabel(option) {
@@ -5106,6 +5221,16 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
5106
5221
  page: data.page,
5107
5222
  onPageChange: handleChangePage,
5108
5223
  onRowsPerPageChange: handleChangeRowsPerPage
5224
+ })), React.createElement(React.Fragment, null, showModalLogin && React.createElement(LoginModal, {
5225
+ onClose: function onClose() {
5226
+ setShowModalLogin(false);
5227
+ },
5228
+ onLogin: function onLogin() {
5229
+ setShowModalLogin(false);
5230
+ setUserExpired(false);
5231
+ setIsLogged(true);
5232
+ },
5233
+ userExpired: userExpired
5109
5234
  })));
5110
5235
  };
5111
5236