tf-checkout-react 1.0.79 → 1.0.83

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.
@@ -27,6 +27,7 @@ export interface IBillingInfoPage {
27
27
  onAuthorizeError?: (e: AxiosError) => void;
28
28
  onLogin?: () => void;
29
29
  onLoginSuccess?: () => void;
30
+ onErrorClose?: () => void;
30
31
  initialValues?: FormikValues;
31
32
  buttonName?: string;
32
33
  theme?: 'light' | 'dark';
@@ -38,4 +39,4 @@ export interface IBillingInfoPage {
38
39
  checkbox?: CSSProperties;
39
40
  };
40
41
  }
41
- 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 }: IBillingInfoPage) => JSX.Element;
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;
@@ -5,8 +5,9 @@ export interface IPromoCodeSectionProps {
5
5
  showPromoInput: boolean;
6
6
  isPromotionsEnabled: boolean;
7
7
  isAllTicketsSoldOut: boolean;
8
+ isAccessCodeEnabled?: boolean;
8
9
  setPromoCode: (value: string) => void;
9
10
  setPromoCodeUpdated: (value: string) => void;
10
11
  setShowPromoInput: (value: boolean) => void;
11
12
  }
12
- export declare const PromoCodeSection: ({ promoCode, promoCodeIsApplied, showPromoInput, isPromotionsEnabled, isAllTicketsSoldOut, setPromoCode, setPromoCodeUpdated, setShowPromoInput, }: IPromoCodeSectionProps) => JSX.Element;
13
+ export declare const PromoCodeSection: ({ promoCode, promoCodeIsApplied, showPromoInput, isPromotionsEnabled, setPromoCode, setPromoCodeUpdated, setShowPromoInput, isAccessCodeEnabled, }: IPromoCodeSectionProps) => JSX.Element;
@@ -26,6 +26,8 @@ export interface IGetTickets {
26
26
  input?: CSSProperties;
27
27
  checkbox?: CSSProperties;
28
28
  };
29
+ isAccessCodeEnabled?: boolean;
30
+ hideSessionButtons?: boolean;
29
31
  }
30
32
  export interface ITicket {
31
33
  id: string | number;
@@ -34,5 +36,5 @@ export interface ITicket {
34
36
  export interface ISelectedTickets {
35
37
  [key: string]: string | number;
36
38
  }
37
- export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, }: IGetTickets) => JSX.Element;
39
+ export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, hideSessionButtons }: IGetTickets) => JSX.Element;
38
40
  export {};
@@ -12,6 +12,7 @@ var _identity = _interopDefault(require('lodash/identity'));
12
12
  var _map = _interopDefault(require('lodash/map'));
13
13
  var _get = _interopDefault(require('lodash/get'));
14
14
  var _includes = _interopDefault(require('lodash/includes'));
15
+ var _isEqual = _interopDefault(require('lodash/isEqual'));
15
16
  var axios = _interopDefault(require('axios'));
16
17
  var _forEach = _interopDefault(require('lodash/forEach'));
17
18
  var material = require('@mui/material');
@@ -1006,7 +1007,7 @@ var downloadPDF = function downloadPDF(pdfUrl) {
1006
1007
  }
1007
1008
  }).then( /*#__PURE__*/function () {
1008
1009
  var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(response) {
1009
- var blobValue;
1010
+ var blobValue, fileNameHeader, fileName;
1010
1011
  return runtime_1.wrap(function _callee$(_context) {
1011
1012
  while (1) {
1012
1013
  switch (_context.prev = _context.next) {
@@ -1016,9 +1017,14 @@ var downloadPDF = function downloadPDF(pdfUrl) {
1016
1017
 
1017
1018
  case 2:
1018
1019
  blobValue = _context.sent;
1019
- return _context.abrupt("return", blobValue);
1020
+ fileNameHeader = response.headers.get("content-disposition") || '';
1021
+ fileName = fileNameHeader.split('"')[1];
1022
+ return _context.abrupt("return", {
1023
+ blobValue: blobValue,
1024
+ fileName: fileName
1025
+ });
1020
1026
 
1021
- case 4:
1027
+ case 6:
1022
1028
  case "end":
1023
1029
  return _context.stop();
1024
1030
  }
@@ -1029,12 +1035,20 @@ var downloadPDF = function downloadPDF(pdfUrl) {
1029
1035
  return function (_x) {
1030
1036
  return _ref.apply(this, arguments);
1031
1037
  };
1032
- }()).then(function (blobValue) {
1038
+ }()).then(function (_ref2) {
1039
+ var blobValue = _ref2.blobValue,
1040
+ fileName = _ref2.fileName;
1041
+ if (!fileName) return;
1033
1042
  var file = new Blob([blobValue], {
1034
1043
  type: 'application/pdf'
1035
1044
  });
1036
1045
  var fileURL = URL.createObjectURL(file);
1037
- window.open(fileURL);
1046
+ var link = document.createElement('a');
1047
+ link.href = fileURL;
1048
+ link.setAttribute('download', fileName);
1049
+ document.body.appendChild(link);
1050
+ link.click();
1051
+ document.body.removeChild(link);
1038
1052
  });
1039
1053
  };
1040
1054
 
@@ -2224,7 +2238,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2224
2238
  _ref3$onGetStatesErro = _ref3.onGetStatesError,
2225
2239
  onGetStatesError = _ref3$onGetStatesErro === void 0 ? function () {} : _ref3$onGetStatesErro,
2226
2240
  _ref3$onGetProfileDat = _ref3.onGetProfileDataSuccess,
2227
- onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? function () {} : _ref3$onGetProfileDat,
2241
+ _onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? function () {} : _ref3$onGetProfileDat,
2228
2242
  _ref3$onGetProfileDat2 = _ref3.onGetProfileDataError,
2229
2243
  onGetProfileDataError = _ref3$onGetProfileDat2 === void 0 ? function () {} : _ref3$onGetProfileDat2,
2230
2244
  _ref3$onAuthorizeSucc = _ref3.onAuthorizeSuccess,
@@ -2239,7 +2253,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2239
2253
  _ref3$accountInfoTitl = _ref3.accountInfoTitle,
2240
2254
  accountInfoTitle = _ref3$accountInfoTitl === void 0 ? '' : _ref3$accountInfoTitl,
2241
2255
  hideLogo = _ref3.hideLogo,
2242
- themeOptions = _ref3.themeOptions;
2256
+ themeOptions = _ref3.themeOptions,
2257
+ _ref3$onErrorClose = _ref3.onErrorClose,
2258
+ onErrorClose = _ref3$onErrorClose === void 0 ? function () {} : _ref3$onErrorClose;
2259
+
2243
2260
  var themeMui = styles$1.createTheme(themeOptions);
2244
2261
  var isWindowDefined = typeof window !== 'undefined';
2245
2262
  var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
@@ -2303,6 +2320,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2303
2320
  userValues = _useState11[0],
2304
2321
  setUserValues = _useState11[1];
2305
2322
 
2323
+ var _useState12 = React.useState(null),
2324
+ error = _useState12[0],
2325
+ setError = _useState12[1];
2326
+
2306
2327
  var emailLogged = _get(userData, 'email', '') || _get(userValues, 'email', '');
2307
2328
 
2308
2329
  var firstNameLogged = _get(userData, 'first_name', '') || _get(userValues, 'first_name', '');
@@ -2314,11 +2335,25 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2314
2335
 
2315
2336
  var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
2316
2337
 
2317
- var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true);
2338
+ var ttfOptIn = _get(cartInfoData, 'ttfOptIn', false);
2318
2339
 
2319
- if (!_get(dataWithUniqueIds, '[0].uniqueId')) {
2320
- setDataWithUniqueIds(assingUniqueIds(data));
2321
- }
2340
+ var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true); // Get prevProps
2341
+
2342
+
2343
+ var prevData = React.useRef(data);
2344
+ React.useEffect(function () {
2345
+ var hasUniqueId = _get(dataWithUniqueIds, '[0].uniqueId');
2346
+
2347
+ var isEqualData = _isEqual(prevData.current, data);
2348
+
2349
+ if (!hasUniqueId || !isEqualData) {
2350
+ setDataWithUniqueIds(assingUniqueIds(data));
2351
+
2352
+ if (!isEqualData) {
2353
+ prevData.current = data;
2354
+ }
2355
+ }
2356
+ }, [dataWithUniqueIds, data]);
2322
2357
 
2323
2358
  var getQuantity = function getQuantity(cart) {
2324
2359
  if (cart === void 0) {
@@ -2471,7 +2506,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2471
2506
  lastName: profileDataObj.last_name
2472
2507
  }));
2473
2508
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
2474
- onGetProfileDataSuccess(userDataResponse.data);
2509
+
2510
+ _onGetProfileDataSuccess(userDataResponse.data);
2475
2511
 
2476
2512
  case 10:
2477
2513
  _context4.next = 15;
@@ -2507,12 +2543,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2507
2543
  initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
2508
2544
  country: _get(userData, 'country', '') || "1",
2509
2545
  state: _get(userData, 'state', '') || "1",
2510
- brand_opt_in: optedInFieldValue
2546
+ brand_opt_in: optedInFieldValue,
2547
+ ttf_opt_in: ttfOptIn
2511
2548
  }), userValues),
2512
2549
  enableReinitialize: true,
2513
2550
  onSubmit: function () {
2514
2551
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(values, formikHelpers) {
2515
- 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;
2552
+ 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;
2516
2553
 
2517
2554
  return runtime_1.wrap(function _callee5$(_context5) {
2518
2555
  while (1) {
@@ -2521,7 +2558,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2521
2558
  _context5.prev = 0;
2522
2559
 
2523
2560
  if (!isLoggedIn) {
2524
- _context5.next = 15;
2561
+ _context5.next = 17;
2525
2562
  break;
2526
2563
  }
2527
2564
 
@@ -2553,10 +2590,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2553
2590
 
2554
2591
  case 12:
2555
2592
  _res = _context5.sent;
2593
+ _context5.next = 15;
2594
+ return getPaymentData(_res.data.data.attributes.hash);
2595
+
2596
+ case 15:
2556
2597
  handleSubmit(values, formikHelpers, eventId, _res);
2557
2598
  return _context5.abrupt("return");
2558
2599
 
2559
- case 15:
2600
+ case 17:
2560
2601
  checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
2561
2602
  emailLogged: emailLogged,
2562
2603
  firstNameLogged: firstNameLogged,
@@ -2564,11 +2605,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2564
2605
  }, showDOB);
2565
2606
  bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
2566
2607
  access_token_register = null;
2567
- _context5.prev = 18;
2568
- _context5.next = 21;
2608
+ _context5.prev = 20;
2609
+ _context5.next = 23;
2569
2610
  return register(bodyFormData);
2570
2611
 
2571
- case 21:
2612
+ case 23:
2572
2613
  resRegister = _context5.sent;
2573
2614
  access_token_register = _get(resRegister, 'data.data.attributes.access_token');
2574
2615
  refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
@@ -2578,26 +2619,26 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2578
2619
  refreshToken: refreshToken
2579
2620
  };
2580
2621
  onRegisterSuccess(tokens);
2581
- _context5.next = 33;
2622
+ _context5.next = 35;
2582
2623
  break;
2583
2624
 
2584
- case 29:
2585
- _context5.prev = 29;
2586
- _context5.t0 = _context5["catch"](18);
2625
+ case 31:
2626
+ _context5.prev = 31;
2627
+ _context5.t0 = _context5["catch"](20);
2587
2628
 
2588
2629
  if (axios.isAxiosError(_context5.t0)) {
2589
- error = _context5.t0 == null ? void 0 : (_e$response = _context5.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
2630
+ _error = _context5.t0 == null ? void 0 : (_e$response = _context5.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
2590
2631
 
2591
- if (_includes(error, 'You must be aged')) {
2592
- formikHelpers.setFieldError('holderAge', error);
2632
+ if (_includes(_error, 'You must be aged')) {
2633
+ formikHelpers.setFieldError('holderAge', _error);
2593
2634
  }
2594
2635
 
2595
- if (error != null && error.password) {
2596
- formikHelpers.setFieldError('password', error.password);
2597
- formikHelpers.setFieldError('confirmPassword', error.password);
2636
+ if (_error != null && _error.password) {
2637
+ formikHelpers.setFieldError('password', _error.password);
2638
+ formikHelpers.setFieldError('confirmPassword', _error.password);
2598
2639
  }
2599
2640
 
2600
- if (error != null && error.email && !onLogin) {
2641
+ if (_error != null && _error.email && !onLogin) {
2601
2642
  // False will stand for outside controll
2602
2643
  setAlreadyHasUser(true);
2603
2644
  setShowModalLogin(true);
@@ -2608,11 +2649,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2608
2649
 
2609
2650
  return _context5.abrupt("return");
2610
2651
 
2611
- case 33:
2612
- _context5.next = 35;
2652
+ case 35:
2653
+ _context5.next = 37;
2613
2654
  return getProfileData(access_token_register);
2614
2655
 
2615
- case 35:
2656
+ case 37:
2616
2657
  profileData = _context5.sent;
2617
2658
  profileSpecifiedData = _get(profileData, 'data.data');
2618
2659
  profileDataObj = setLoggedUserData(profileSpecifiedData);
@@ -2626,17 +2667,21 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2626
2667
  firstNameLogged: firstNameLogged,
2627
2668
  lastNameLogged: lastNameLogged
2628
2669
  }, showDOB);
2629
- _context5.next = 42;
2670
+ _context5.next = 44;
2630
2671
  return postOnCheckout(checkoutBody, access_token_register);
2631
2672
 
2632
- case 42:
2673
+ case 44:
2633
2674
  res = _context5.sent;
2675
+ _context5.next = 47;
2676
+ return getPaymentData(res.data.data.attributes.hash);
2677
+
2678
+ case 47:
2634
2679
  handleSubmit(values, formikHelpers, eventId, res);
2635
- _context5.next = 49;
2680
+ _context5.next = 53;
2636
2681
  break;
2637
2682
 
2638
- case 46:
2639
- _context5.prev = 46;
2683
+ case 50:
2684
+ _context5.prev = 50;
2640
2685
  _context5.t1 = _context5["catch"](0);
2641
2686
 
2642
2687
  if (axios.isAxiosError(_context5.t1)) {
@@ -2649,15 +2694,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2649
2694
  }
2650
2695
  }
2651
2696
 
2697
+ if ((_e$response3 = _context5.t1.response) != null && _e$response3.data.message) {
2698
+ if (typeof document !== undefined) {
2699
+ document.body.scrollTop = document.documentElement.scrollTop = 0;
2700
+ }
2701
+
2702
+ setError(_get(_context5.t1, 'response.data.message'));
2703
+ }
2704
+
2652
2705
  onSubmitError(_context5.t1);
2653
2706
  }
2654
2707
 
2655
- case 49:
2708
+ case 53:
2656
2709
  case "end":
2657
2710
  return _context5.stop();
2658
2711
  }
2659
2712
  }
2660
- }, _callee5, null, [[0, 46], [18, 29]]);
2713
+ }, _callee5, null, [[0, 50], [20, 31]]);
2661
2714
  }));
2662
2715
 
2663
2716
  function onSubmit(_x2, _x3) {
@@ -2679,7 +2732,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2679
2732
  onGetStatesError: onGetStatesError
2680
2733
  }), React__default.createElement("div", {
2681
2734
  className: "billing-info-container " + theme
2682
- }, !isLoggedIn && React__default.createElement("div", {
2735
+ }, error && React__default.createElement(material.Alert, {
2736
+ severity: "error",
2737
+ onClose: onErrorClose,
2738
+ variant: "filled"
2739
+ }, error), !isLoggedIn && React__default.createElement("div", {
2683
2740
  className: "account-actions-block"
2684
2741
  }, React__default.createElement("div", null, accountInfoTitle), React__default.createElement("div", null, "Login & skip ahead:"), React__default.createElement("div", {
2685
2742
  className: "login-block"
@@ -2751,13 +2808,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2751
2808
  var groupClassname = group.groupClassname,
2752
2809
  groupItems = group.groupItems;
2753
2810
  return React__default.createElement("div", {
2754
- key: group.uniqueId
2811
+ key: group.id
2755
2812
  }, React__default.createElement("div", {
2756
2813
  className: groupClassname
2757
2814
  }, _map(groupItems, function (element) {
2758
2815
  return React__default.createElement("div", {
2759
2816
  className: element.className,
2760
- key: element.uniqueId
2817
+ key: element.name
2761
2818
  }, React__default.createElement(formik.Field, {
2762
2819
  name: element.name + "-" + index,
2763
2820
  label: element.label,
@@ -2791,7 +2848,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2791
2848
  userExpired: userExpired,
2792
2849
  onAuthorizeSuccess: onAuthorizeSuccess,
2793
2850
  onAuthorizeError: onAuthorizeError,
2794
- onGetProfileDataSuccess: onGetProfileDataSuccess,
2851
+ onGetProfileDataSuccess: function onGetProfileDataSuccess(data) {
2852
+ fetchCart();
2853
+
2854
+ _onGetProfileDataSuccess(data);
2855
+ },
2795
2856
  onGetProfileDataError: onGetProfileDataError
2796
2857
  }), showModalRegister && React__default.createElement(RegisterModal, {
2797
2858
  onClose: function onClose() {
@@ -2800,7 +2861,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2800
2861
  onRegister: function onRegister() {
2801
2862
  setShowModalRegister(false);
2802
2863
  },
2803
- onGetProfileDataSuccess: onGetProfileDataSuccess,
2864
+ onGetProfileDataSuccess: function onGetProfileDataSuccess(data) {
2865
+ fetchCart();
2866
+
2867
+ _onGetProfileDataSuccess(data);
2868
+ },
2804
2869
  onGetProfileDataError: onGetProfileDataError
2805
2870
  }));
2806
2871
  };
@@ -4030,10 +4095,42 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
4030
4095
  promoCodeIsApplied = _ref.promoCodeIsApplied,
4031
4096
  showPromoInput = _ref.showPromoInput,
4032
4097
  isPromotionsEnabled = _ref.isPromotionsEnabled,
4033
- isAllTicketsSoldOut = _ref.isAllTicketsSoldOut,
4034
4098
  setPromoCode = _ref.setPromoCode,
4035
4099
  setPromoCodeUpdated = _ref.setPromoCodeUpdated,
4036
- setShowPromoInput = _ref.setShowPromoInput;
4100
+ setShowPromoInput = _ref.setShowPromoInput,
4101
+ isAccessCodeEnabled = _ref.isAccessCodeEnabled;
4102
+ var isPromoCodeHasValue = !!promoCode.trim();
4103
+
4104
+ var renderInputField = function renderInputField() {
4105
+ return React__default.createElement("div", {
4106
+ className: "promo-code-block"
4107
+ }, React__default.createElement("div", {
4108
+ className: "promo-code-block"
4109
+ }, React__default.createElement("p", {
4110
+ className: "promo-code-text"
4111
+ }, isAccessCodeEnabled ? 'Access code required' : 'Promo code')), React__default.createElement("input", {
4112
+ className: "promo-code-input",
4113
+ placeholder: "",
4114
+ onChange: function onChange(e) {
4115
+ setPromoCode(e.target.value);
4116
+ },
4117
+ onKeyPress: function onKeyPress(event) {
4118
+ if (event.key === 'Enter' && isPromoCodeHasValue) {
4119
+ setPromoCodeUpdated(promoCode);
4120
+ setShowPromoInput(false);
4121
+ }
4122
+ }
4123
+ }), React__default.createElement(Button$1, {
4124
+ className: "promo-submit-button",
4125
+ onClick: function onClick() {
4126
+ if (isPromoCodeHasValue) {
4127
+ setPromoCodeUpdated(promoCode);
4128
+ setShowPromoInput(false);
4129
+ }
4130
+ }
4131
+ }, isAccessCodeEnabled ? 'ENTER' : 'APPLY'));
4132
+ };
4133
+
4037
4134
  return React__default.createElement("div", null, promoCodeIsApplied ? React__default.createElement("div", {
4038
4135
  className: "alert-info"
4039
4136
  }, React__default.createElement(SVG, {
@@ -4043,33 +4140,13 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
4043
4140
  }
4044
4141
  }), React__default.createElement("p", {
4045
4142
  className: "promo-code-success"
4046
- }, "PROMO CODE APPLIED SUCCESSFULLY")) : null, showPromoInput && React__default.createElement("div", {
4047
- className: "promo-code-block"
4048
- }, React__default.createElement("label", null, "PROMO CODE"), React__default.createElement("input", {
4049
- placeholder: "",
4050
- onChange: function onChange(e) {
4051
- setPromoCode(e.target.value);
4052
- },
4053
- onKeyPress: function onKeyPress(event) {
4054
- if (event.key === 'Enter') {
4055
- setPromoCodeUpdated(promoCode);
4056
- }
4057
- }
4058
- }), React__default.createElement(Button$1, {
4059
- className: "promo-apply-button",
4060
- placeholder: "Promo Code",
4061
- onClick: function onClick() {
4062
- setPromoCodeUpdated(promoCode);
4063
- }
4064
- }, "Apply")), isPromotionsEnabled && !showPromoInput && isAllTicketsSoldOut && React__default.createElement("p", {
4065
- className: "promo-code-text"
4066
- }, "Access code needed"), isPromotionsEnabled && !showPromoInput ? React__default.createElement(Button$1, {
4143
+ }, "PROMO CODE APPLIED SUCCESSFULLY")) : null, showPromoInput && renderInputField(), isPromotionsEnabled && !showPromoInput && !isAccessCodeEnabled ? React__default.createElement(Button$1, {
4067
4144
  className: "promo-code-button",
4068
4145
  placeholder: "Promo Codes",
4069
4146
  onClick: function onClick() {
4070
4147
  setShowPromoInput(true);
4071
4148
  }
4072
- }, "Got a promo code? Click here") : null);
4149
+ }, "Got a promo code? Click here") : !isPromotionsEnabled && !showPromoInput && isAccessCodeEnabled && !promoCodeIsApplied ? renderInputField() : null);
4073
4150
  };
4074
4151
 
4075
4152
  var isTimeExpired = function isTimeExpired(startDate, timezone) {
@@ -4175,7 +4252,11 @@ var TicketsContainer = function TicketsContainer(_ref) {
4175
4252
  queryPromoCode = _ref$queryPromoCode === void 0 ? '' : _ref$queryPromoCode,
4176
4253
  _ref$isPromotionsEnab = _ref.isPromotionsEnabled,
4177
4254
  isPromotionsEnabled = _ref$isPromotionsEnab === void 0 ? true : _ref$isPromotionsEnab,
4178
- themeOptions = _ref.themeOptions;
4255
+ themeOptions = _ref.themeOptions,
4256
+ _ref$isAccessCodeEnab = _ref.isAccessCodeEnabled,
4257
+ isAccessCodeEnabled = _ref$isAccessCodeEnab === void 0 ? false : _ref$isAccessCodeEnab,
4258
+ _ref$hideSessionButto = _ref.hideSessionButtons,
4259
+ hideSessionButtons = _ref$hideSessionButto === void 0 ? false : _ref$hideSessionButto;
4179
4260
 
4180
4261
  var _useState = React.useState({}),
4181
4262
  selectedTickets = _useState[0],
@@ -4306,6 +4387,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
4306
4387
  setTickets(_get(attributes, 'tickets'));
4307
4388
  setShowWaitingList(attributes.showWaitingList);
4308
4389
  onGetTicketsSuccess(response.data);
4390
+ setPromoCode('');
4309
4391
  }
4310
4392
 
4311
4393
  if (eventResponse.data.success) {
@@ -4508,12 +4590,13 @@ var TicketsContainer = function TicketsContainer(_ref) {
4508
4590
  setPromoCodeUpdated: setPromoCodeUpdated,
4509
4591
  setShowPromoInput: setShowPromoInput,
4510
4592
  isPromotionsEnabled: isPromotionsEnabled,
4593
+ isAccessCodeEnabled: isAccessCodeEnabled,
4511
4594
  isAllTicketsSoldOut: isAllTicketsSoldOut
4512
4595
  }), !isAllTicketsSoldOut && React__default.createElement(Button$1, {
4513
4596
  "aria-hidden": true,
4514
4597
  className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
4515
4598
  onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
4516
- }, getTicketsLabel || 'GET TICKETS'), isLogged ? React__default.createElement("div", {
4599
+ }, getTicketsLabel || 'GET TICKETS'), isLogged && !hideSessionButtons ? React__default.createElement("div", {
4517
4600
  className: "session-wrapper"
4518
4601
  }, React__default.createElement("span", {
4519
4602
  className: "session-container"