tf-checkout-react 1.4.26 → 1.5.1

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 (79) hide show
  1. package/dist/api/index.d.ts +1 -0
  2. package/dist/api/preRegistrationComplete.d.ts +3 -0
  3. package/dist/components/billing-info-container/index.d.ts +1 -3
  4. package/dist/components/common/CopyField.d.ts +12 -0
  5. package/dist/components/common/CopyMessageModal.d.ts +7 -0
  6. package/dist/components/common/index.d.ts +1 -0
  7. package/dist/components/common/socials.d.ts +10 -0
  8. package/dist/components/confirmationContainer/index.d.ts +7 -7
  9. package/dist/components/confirmationContainer/social-buttons.d.ts +5 -2
  10. package/dist/components/forgotPasswordModal/index.d.ts +2 -3
  11. package/dist/components/loginForm/index.d.ts +1 -0
  12. package/dist/components/loginModal/index.d.ts +2 -3
  13. package/dist/components/preRegistration/FieldsSection.d.ts +13 -0
  14. package/dist/components/preRegistration/Influancers.d.ts +2 -0
  15. package/dist/components/preRegistration/PreRegistrationComplete.d.ts +5 -0
  16. package/dist/components/preRegistration/PreRegistrationInformations.d.ts +2 -0
  17. package/dist/components/preRegistration/Prewards.d.ts +2 -0
  18. package/dist/components/preRegistration/ShareOptions.d.ts +2 -0
  19. package/dist/components/preRegistration/constants.d.ts +2 -0
  20. package/dist/components/preRegistration/index.d.ts +17 -0
  21. package/dist/components/preRegistration/utils.d.ts +12 -0
  22. package/dist/components/ticketsContainer/TicketRow.d.ts +3 -2
  23. package/dist/components/ticketsContainer/utils.d.ts +9 -0
  24. package/dist/hooks/index.d.ts +1 -0
  25. package/dist/hooks/useEventListener.d.ts +1 -0
  26. package/dist/hooks/useLocalStorageListener.d.ts +1 -0
  27. package/dist/images/instagram.svg +5 -0
  28. package/dist/images/spotify.svg +6 -0
  29. package/dist/index.d.ts +4 -1
  30. package/dist/tf-checkout-react.cjs.development.js +1525 -173
  31. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  32. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  33. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  34. package/dist/tf-checkout-react.esm.js +1526 -173
  35. package/dist/tf-checkout-react.esm.js.map +1 -1
  36. package/dist/utils/isValidNumber.d.ts +1 -0
  37. package/package.json +1 -1
  38. package/src/api/index.ts +28 -0
  39. package/src/api/orders.ts +3 -3
  40. package/src/api/preRegistrationComplete.ts +37 -0
  41. package/src/assets/images/instagram.svg +5 -0
  42. package/src/assets/images/spotify.svg +6 -0
  43. package/src/components/billing-info-container/index.tsx +1 -7
  44. package/src/components/common/CopyField.tsx +53 -0
  45. package/src/components/common/CopyMessageModal.tsx +34 -0
  46. package/src/components/common/NativeSelectFeild/index.tsx +1 -1
  47. package/src/components/common/index.tsx +1 -0
  48. package/src/components/common/socials.tsx +33 -0
  49. package/src/components/confirmationContainer/config.ts +62 -55
  50. package/src/components/confirmationContainer/index.tsx +11 -31
  51. package/src/components/confirmationContainer/social-buttons.tsx +43 -20
  52. package/src/components/forgotPasswordModal/index.tsx +4 -4
  53. package/src/components/loginForm/index.tsx +4 -0
  54. package/src/components/loginModal/index.tsx +5 -4
  55. package/src/components/myTicketsContainer/index.tsx +2 -2
  56. package/src/components/preRegistration/FieldsSection.tsx +142 -0
  57. package/src/components/preRegistration/Influancers.tsx +34 -0
  58. package/src/components/preRegistration/PreRegistrationComplete.tsx +164 -0
  59. package/src/components/preRegistration/PreRegistrationInformations.tsx +54 -0
  60. package/src/components/preRegistration/Prewards.tsx +41 -0
  61. package/src/components/preRegistration/ShareOptions.tsx +77 -0
  62. package/src/components/preRegistration/constants.tsx +161 -0
  63. package/src/components/preRegistration/index.tsx +274 -0
  64. package/src/components/preRegistration/utils.ts +155 -0
  65. package/src/components/ticketsContainer/ReferralLogic.tsx +1 -1
  66. package/src/components/ticketsContainer/TicketRow.tsx +17 -14
  67. package/src/components/ticketsContainer/TicketsSection.tsx +2 -0
  68. package/src/components/ticketsContainer/index.tsx +77 -8
  69. package/src/components/ticketsContainer/utils.ts +30 -6
  70. package/src/hooks/index.ts +1 -0
  71. package/src/hooks/useEventListener.ts +32 -0
  72. package/src/hooks/useLocalStorageListener.ts +27 -0
  73. package/src/index.ts +6 -2
  74. package/src/types/api/preRegistration.d.ts +11 -0
  75. package/src/types/api/preRegistrationComplete.d.ts +95 -0
  76. package/src/types/pre-registration-complete.d.ts +42 -0
  77. package/src/utils/cookies.ts +7 -7
  78. package/src/utils/isValidNumber.ts +8 -0
  79. package/src/components/common/dist/PhoneNumberField.js +0 -96
@@ -53,8 +53,8 @@ import { ThemeProvider as ThemeProvider$1 } from '@mui/private-theming';
53
53
  import jwt_decode from 'jwt-decode';
54
54
  import _filter from 'lodash-es/filter';
55
55
  import _some from 'lodash-es/some';
56
- import Button$1 from 'react-bootstrap/Button';
57
56
  import moment from 'moment-timezone';
57
+ import Button$1 from 'react-bootstrap/Button';
58
58
  import _sortBy from 'lodash-es/sortBy';
59
59
  import Autocomplete from '@mui/material/Autocomplete';
60
60
  import Paper from '@mui/material/Paper';
@@ -77,6 +77,8 @@ import SeatMapView from 'tf-seat-map-view';
77
77
  import InputLabel$1 from '@mui/material/InputLabel';
78
78
  import Tooltip from '@mui/material/Tooltip';
79
79
  import { Button as Button$3 } from 'react-bootstrap';
80
+ import _split from 'lodash-es/split';
81
+ import _slice from 'lodash-es/slice';
80
82
 
81
83
  function _regeneratorRuntime() {
82
84
  _regeneratorRuntime = function () {
@@ -546,7 +548,7 @@ function setCustomCookie(name, value, days) {
546
548
  }
547
549
  if (typeof window !== 'undefined') {
548
550
  var domain = getDomain(window.location.hostname);
549
- document.cookie = name + '=' + (value || '') + expires + '; path=/' + ("; domain=" + domain);
551
+ document.cookie = name + '=' + (value || '') + expires + ("; path=/; domain=" + domain);
550
552
  }
551
553
  }
552
554
  function getCookieByName(cname) {
@@ -555,10 +557,10 @@ function getCookieByName(cname) {
555
557
  var ca = document.cookie.split(';');
556
558
  for (var i = 0; i < ca.length; i++) {
557
559
  var c = ca[i];
558
- while (c.charAt(0) == ' ') {
560
+ while (c.charAt(0) === ' ') {
559
561
  c = c.substring(1);
560
562
  }
561
- if (c.indexOf(name) == 0) {
563
+ if (c.indexOf(name) === 0) {
562
564
  return c.substring(name.length, c.length);
563
565
  }
564
566
  }
@@ -920,16 +922,17 @@ var logout = /*#__PURE__*/function () {
920
922
 
921
923
  var getOrders = /*#__PURE__*/function () {
922
924
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(page, limit, eventSlug) {
923
- var response;
925
+ var slug, response;
924
926
  return _regeneratorRuntime().wrap(function _callee$(_context) {
925
927
  while (1) switch (_context.prev = _context.next) {
926
928
  case 0:
927
- _context.next = 2;
928
- return publicRequest.get("v1/account/orders/?page=" + page + "&limit=" + limit + "&filter[event]=" + (eventSlug || CONFIGS.EVENT_SLUG) + "&filter[brand]=" + (CONFIGS.BRAND_SLUG ? "filter[brand]=" + CONFIGS.BRAND_SLUG + "&filter[subbrands]=true" : ''));
929
- case 2:
929
+ slug = eventSlug || CONFIGS.EVENT_SLUG || '';
930
+ _context.next = 3;
931
+ return publicRequest.get("v1/account/orders/?page=" + page + "&limit=" + limit + "&filter[event]=" + slug + "&" + (CONFIGS.BRAND_SLUG ? "filter[brand]=" + CONFIGS.BRAND_SLUG + "&filter[subbrands]=true" : ''));
932
+ case 3:
930
933
  response = _context.sent;
931
934
  return _context.abrupt("return", response.data);
932
- case 4:
935
+ case 5:
933
936
  case "end":
934
937
  return _context.stop();
935
938
  }
@@ -1580,70 +1583,79 @@ var getCheckoutPageConfigs = /*#__PURE__*/function () {
1580
1583
  return _ref2.apply(this, arguments);
1581
1584
  };
1582
1585
  }();
1583
- var getSeatMapData = /*#__PURE__*/function () {
1584
- var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(eventId) {
1585
- var reservedSeatsHash, params, response;
1586
+ var confirmPreRegistration = /*#__PURE__*/function () {
1587
+ var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(eventId, data) {
1588
+ var response;
1586
1589
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1587
1590
  while (1) switch (_context3.prev = _context3.next) {
1588
1591
  case 0:
1589
- localStorage.setItem('tierId', '');
1590
- reservedSeatsHash = getQueryVariable('reserved_seats_hash');
1591
- params = {};
1592
- if (reservedSeatsHash) {
1593
- params.reserved_seats_hash = reservedSeatsHash;
1594
- }
1595
- _context3.next = 6;
1596
- return publicRequest.get("v1/event/" + eventId + "/seat-map-data", {
1597
- params: params
1592
+ _context3.next = 2;
1593
+ return publicRequest.post("v1/event/" + eventId + "/pre-registration/confirm", {
1594
+ data: {
1595
+ attributes: data
1596
+ }
1598
1597
  });
1599
- case 6:
1598
+ case 2:
1600
1599
  response = _context3.sent;
1601
1600
  return _context3.abrupt("return", response.data);
1602
- case 8:
1601
+ case 4:
1603
1602
  case "end":
1604
1603
  return _context3.stop();
1605
1604
  }
1606
1605
  }, _callee3);
1607
1606
  }));
1608
- return function getSeatMapData(_x2) {
1607
+ return function confirmPreRegistration(_x2, _x3) {
1609
1608
  return _ref3.apply(this, arguments);
1610
1609
  };
1611
1610
  }();
1612
- var getSeatMapStatuses = /*#__PURE__*/function () {
1611
+ // seat map <--start-->
1612
+ // const makeId = (length = 20) => {
1613
+ // let result = ''
1614
+ // const characters =
1615
+ // 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
1616
+ // const charactersLength = characters.length
1617
+ // for (let i = 0; i < length; i++) {
1618
+ // result += characters.charAt(Math.floor(Math.random() * charactersLength))
1619
+ // }
1620
+ // return result
1621
+ // }
1622
+ var getSeatMapData = /*#__PURE__*/function () {
1613
1623
  var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(eventId) {
1614
- var response;
1624
+ var reservedSeatsHash, params, response;
1615
1625
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1616
1626
  while (1) switch (_context4.prev = _context4.next) {
1617
1627
  case 0:
1618
- _context4.next = 2;
1619
- return publicRequest.get("v1/event/" + eventId + "/seats/status");
1620
- case 2:
1628
+ localStorage.setItem('tierId', '');
1629
+ reservedSeatsHash = getQueryVariable('reserved_seats_hash');
1630
+ params = {};
1631
+ if (reservedSeatsHash) {
1632
+ params.reserved_seats_hash = reservedSeatsHash;
1633
+ }
1634
+ _context4.next = 6;
1635
+ return publicRequest.get("v1/event/" + eventId + "/seat-map-data", {
1636
+ params: params
1637
+ });
1638
+ case 6:
1621
1639
  response = _context4.sent;
1622
1640
  return _context4.abrupt("return", response.data);
1623
- case 4:
1641
+ case 8:
1624
1642
  case "end":
1625
1643
  return _context4.stop();
1626
1644
  }
1627
1645
  }, _callee4);
1628
1646
  }));
1629
- return function getSeatMapStatuses(_x3) {
1647
+ return function getSeatMapData(_x4) {
1630
1648
  return _ref4.apply(this, arguments);
1631
1649
  };
1632
1650
  }();
1633
- var reserveSeat = /*#__PURE__*/function () {
1634
- var _ref5 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(eventId, tierId, seatId) {
1651
+ var getSeatMapStatuses = /*#__PURE__*/function () {
1652
+ var _ref5 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(eventId) {
1635
1653
  var response;
1636
1654
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1637
1655
  while (1) switch (_context5.prev = _context5.next) {
1638
1656
  case 0:
1639
1657
  _context5.next = 2;
1640
- return publicRequest.post("v1/event/" + eventId + "/seats/reserve", {
1641
- data: {
1642
- tierId: tierId,
1643
- seatId: seatId,
1644
- ttl: 10
1645
- }
1646
- });
1658
+ return publicRequest.get("v1/event/" + eventId + "/seats/status");
1647
1659
  case 2:
1648
1660
  response = _context5.sent;
1649
1661
  return _context5.abrupt("return", response.data);
@@ -1653,21 +1665,22 @@ var reserveSeat = /*#__PURE__*/function () {
1653
1665
  }
1654
1666
  }, _callee5);
1655
1667
  }));
1656
- return function reserveSeat(_x4, _x5, _x6) {
1668
+ return function getSeatMapStatuses(_x5) {
1657
1669
  return _ref5.apply(this, arguments);
1658
1670
  };
1659
1671
  }();
1660
- var removeSeatReserve = /*#__PURE__*/function () {
1661
- var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(eventId, tierId, seatIds) {
1672
+ var reserveSeat = /*#__PURE__*/function () {
1673
+ var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(eventId, tierId, seatId) {
1662
1674
  var response;
1663
1675
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1664
1676
  while (1) switch (_context6.prev = _context6.next) {
1665
1677
  case 0:
1666
1678
  _context6.next = 2;
1667
- return publicRequest["delete"]("v1/event/" + eventId + "/seats/delete-reserved", {
1679
+ return publicRequest.post("v1/event/" + eventId + "/seats/reserve", {
1668
1680
  data: {
1669
1681
  tierId: tierId,
1670
- seatIds: seatIds
1682
+ seatId: seatId,
1683
+ ttl: 10
1671
1684
  }
1672
1685
  });
1673
1686
  case 2:
@@ -1679,30 +1692,23 @@ var removeSeatReserve = /*#__PURE__*/function () {
1679
1692
  }
1680
1693
  }, _callee6);
1681
1694
  }));
1682
- return function removeSeatReserve(_x7, _x8, _x9) {
1695
+ return function reserveSeat(_x6, _x7, _x8) {
1683
1696
  return _ref6.apply(this, arguments);
1684
1697
  };
1685
1698
  }();
1686
- // seat map <--end-->
1687
- function getPixelScript(id, pageOptions) {
1688
- var response = publicRequest.get("v1/event/" + id + "/track", {
1689
- params: {
1690
- page_url: pageOptions.pageUrl,
1691
- page: pageOptions.page,
1692
- order_hash: pageOptions.orderHash
1693
- }
1694
- });
1695
- return response;
1696
- }
1697
- // ID Verification
1698
- var getNetverifyUrl = /*#__PURE__*/function () {
1699
- var _ref7 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
1699
+ var removeSeatReserve = /*#__PURE__*/function () {
1700
+ var _ref7 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(eventId, tierId, seatIds) {
1700
1701
  var response;
1701
1702
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1702
1703
  while (1) switch (_context7.prev = _context7.next) {
1703
1704
  case 0:
1704
1705
  _context7.next = 2;
1705
- return publicRequest.get('v1/authenticate/verify');
1706
+ return publicRequest["delete"]("v1/event/" + eventId + "/seats/delete-reserved", {
1707
+ data: {
1708
+ tierId: tierId,
1709
+ seatIds: seatIds
1710
+ }
1711
+ });
1706
1712
  case 2:
1707
1713
  response = _context7.sent;
1708
1714
  return _context7.abrupt("return", response.data);
@@ -1712,18 +1718,30 @@ var getNetverifyUrl = /*#__PURE__*/function () {
1712
1718
  }
1713
1719
  }, _callee7);
1714
1720
  }));
1715
- return function getNetverifyUrl() {
1721
+ return function removeSeatReserve(_x9, _x10, _x11) {
1716
1722
  return _ref7.apply(this, arguments);
1717
1723
  };
1718
1724
  }();
1719
- var checkVerificationStatus = /*#__PURE__*/function () {
1725
+ // seat map <--end-->
1726
+ function getPixelScript(id, pageOptions) {
1727
+ var response = publicRequest.get("v1/event/" + id + "/track", {
1728
+ params: {
1729
+ page_url: pageOptions.pageUrl,
1730
+ page: pageOptions.page,
1731
+ order_hash: pageOptions.orderHash
1732
+ }
1733
+ });
1734
+ return response;
1735
+ }
1736
+ // ID Verification
1737
+ var getNetverifyUrl = /*#__PURE__*/function () {
1720
1738
  var _ref8 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1721
1739
  var response;
1722
1740
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1723
1741
  while (1) switch (_context8.prev = _context8.next) {
1724
1742
  case 0:
1725
1743
  _context8.next = 2;
1726
- return publicRequest.get('v1/authenticate/get-verification-info');
1744
+ return publicRequest.get('v1/authenticate/verify');
1727
1745
  case 2:
1728
1746
  response = _context8.sent;
1729
1747
  return _context8.abrupt("return", response.data);
@@ -1733,26 +1751,18 @@ var checkVerificationStatus = /*#__PURE__*/function () {
1733
1751
  }
1734
1752
  }, _callee8);
1735
1753
  }));
1736
- return function checkVerificationStatus() {
1754
+ return function getNetverifyUrl() {
1737
1755
  return _ref8.apply(this, arguments);
1738
1756
  };
1739
1757
  }();
1740
- var updateVerificationStatus = /*#__PURE__*/function () {
1758
+ var checkVerificationStatus = /*#__PURE__*/function () {
1741
1759
  var _ref9 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
1742
1760
  var response;
1743
1761
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1744
1762
  while (1) switch (_context9.prev = _context9.next) {
1745
1763
  case 0:
1746
1764
  _context9.next = 2;
1747
- return publicRequest.patch('v1/authenticate/verify', {
1748
- data: {
1749
- attributes: {
1750
- verification: {
1751
- verificationStatus: 'PENDING'
1752
- }
1753
- }
1754
- }
1755
- });
1765
+ return publicRequest.get('v1/authenticate/get-verification-info');
1756
1766
  case 2:
1757
1767
  response = _context9.sent;
1758
1768
  return _context9.abrupt("return", response.data);
@@ -1762,18 +1772,26 @@ var updateVerificationStatus = /*#__PURE__*/function () {
1762
1772
  }
1763
1773
  }, _callee9);
1764
1774
  }));
1765
- return function updateVerificationStatus() {
1775
+ return function checkVerificationStatus() {
1766
1776
  return _ref9.apply(this, arguments);
1767
1777
  };
1768
1778
  }();
1769
- var checkCustomerOrder = /*#__PURE__*/function () {
1770
- var _ref10 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(orderHash) {
1779
+ var updateVerificationStatus = /*#__PURE__*/function () {
1780
+ var _ref10 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1771
1781
  var response;
1772
1782
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1773
1783
  while (1) switch (_context10.prev = _context10.next) {
1774
1784
  case 0:
1775
1785
  _context10.next = 2;
1776
- return publicRequest.get("v1/order/" + orderHash + "/verify-customer-order");
1786
+ return publicRequest.patch('v1/authenticate/verify', {
1787
+ data: {
1788
+ attributes: {
1789
+ verification: {
1790
+ verificationStatus: 'PENDING'
1791
+ }
1792
+ }
1793
+ }
1794
+ });
1777
1795
  case 2:
1778
1796
  response = _context10.sent;
1779
1797
  return _context10.abrupt("return", response.data);
@@ -1783,33 +1801,54 @@ var checkCustomerOrder = /*#__PURE__*/function () {
1783
1801
  }
1784
1802
  }, _callee10);
1785
1803
  }));
1786
- return function checkCustomerOrder(_x10) {
1804
+ return function updateVerificationStatus() {
1787
1805
  return _ref10.apply(this, arguments);
1788
1806
  };
1789
1807
  }();
1790
- var refreshSeatReservation = /*#__PURE__*/function () {
1791
- var _ref11 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(eventId, orderId) {
1808
+ var checkCustomerOrder = /*#__PURE__*/function () {
1809
+ var _ref11 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(orderHash) {
1792
1810
  var response;
1793
1811
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1794
1812
  while (1) switch (_context11.prev = _context11.next) {
1795
1813
  case 0:
1796
1814
  _context11.next = 2;
1797
- return publicRequest.patch("event/" + eventId + "/reservation/refresh/", {
1798
- order_id: orderId
1799
- });
1815
+ return publicRequest.get("v1/order/" + orderHash + "/verify-customer-order");
1800
1816
  case 2:
1801
1817
  response = _context11.sent;
1802
- return _context11.abrupt("return", response);
1818
+ return _context11.abrupt("return", response.data);
1803
1819
  case 4:
1804
1820
  case "end":
1805
1821
  return _context11.stop();
1806
1822
  }
1807
1823
  }, _callee11);
1808
1824
  }));
1809
- return function refreshSeatReservation(_x11, _x12) {
1825
+ return function checkCustomerOrder(_x12) {
1810
1826
  return _ref11.apply(this, arguments);
1811
1827
  };
1812
1828
  }();
1829
+ var refreshSeatReservation = /*#__PURE__*/function () {
1830
+ var _ref12 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(eventId, orderId) {
1831
+ var response;
1832
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1833
+ while (1) switch (_context12.prev = _context12.next) {
1834
+ case 0:
1835
+ _context12.next = 2;
1836
+ return publicRequest.patch("event/" + eventId + "/reservation/refresh/", {
1837
+ order_id: orderId
1838
+ });
1839
+ case 2:
1840
+ response = _context12.sent;
1841
+ return _context12.abrupt("return", response);
1842
+ case 4:
1843
+ case "end":
1844
+ return _context12.stop();
1845
+ }
1846
+ }, _callee12);
1847
+ }));
1848
+ return function refreshSeatReservation(_x13, _x14) {
1849
+ return _ref12.apply(this, arguments);
1850
+ };
1851
+ }();
1813
1852
 
1814
1853
  function appendScriptsToHeader(code) {
1815
1854
  if (isBrowser && code) {
@@ -2109,8 +2148,8 @@ var Schema = /*#__PURE__*/object().shape({
2109
2148
  var ForgotPasswordModal = function ForgotPasswordModal(_ref) {
2110
2149
  var _ref$onClose = _ref.onClose,
2111
2150
  onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
2112
- _ref$onLogin = _ref.onLogin,
2113
- onLogin = _ref$onLogin === void 0 ? function () {} : _ref$onLogin,
2151
+ _ref$onLoginButtonCli = _ref.onLoginButtonClick,
2152
+ onLoginButtonClick = _ref$onLoginButtonCli === void 0 ? function () {} : _ref$onLoginButtonCli,
2114
2153
  _ref$onForgotPassword = _ref.onForgotPasswordSuccess,
2115
2154
  onForgotPasswordSuccess = _ref$onForgotPassword === void 0 ? function () {} : _ref$onForgotPassword,
2116
2155
  _ref$onForgotPassword2 = _ref.onForgotPasswordError,
@@ -2199,7 +2238,7 @@ var ForgotPasswordModal = function ForgotPasswordModal(_ref) {
2199
2238
  }) : 'Submit')), React.createElement("div", {
2200
2239
  className: "login"
2201
2240
  }, React.createElement("span", {
2202
- onClick: onLogin
2241
+ onClick: onLoginButtonClick
2203
2242
  }, "Back to Log In")), showPoweredByImage ? React.createElement(PoweredBy, null) : null);
2204
2243
  }))));
2205
2244
  };
@@ -2329,7 +2368,7 @@ var LoginModal = function LoginModal(_ref) {
2329
2368
  },
2330
2369
  onSubmit: function () {
2331
2370
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
2332
- var email, password, body, profileResponse, profileSpecifiedData, profileDataObj, event, _e$response, _e$response$data, _error;
2371
+ var email, password, body, authRes, profileResponse, profileSpecifiedData, profileDataObj, event, _e$response, _e$response$data, _error;
2333
2372
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2334
2373
  while (1) switch (_context.prev = _context.next) {
2335
2374
  case 0:
@@ -2342,23 +2381,24 @@ var LoginModal = function LoginModal(_ref) {
2342
2381
  _context.next = 5;
2343
2382
  return authorize(body);
2344
2383
  case 5:
2384
+ authRes = _context.sent;
2345
2385
  profileResponse = null;
2346
- _context.prev = 6;
2347
- _context.next = 9;
2386
+ _context.prev = 7;
2387
+ _context.next = 10;
2348
2388
  return getProfileData();
2349
- case 9:
2389
+ case 10:
2350
2390
  profileResponse = _context.sent;
2351
2391
  onGetProfileDataSuccess(profileResponse.data);
2352
- _context.next = 17;
2392
+ _context.next = 18;
2353
2393
  break;
2354
- case 13:
2355
- _context.prev = 13;
2356
- _context.t0 = _context["catch"](6);
2394
+ case 14:
2395
+ _context.prev = 14;
2396
+ _context.t0 = _context["catch"](7);
2357
2397
  if (axios.isAxiosError(_context.t0)) {
2358
2398
  onGetProfileDataError(_context.t0);
2359
2399
  }
2360
2400
  return _context.abrupt("return");
2361
- case 17:
2401
+ case 18:
2362
2402
  profileSpecifiedData = profileResponse.data;
2363
2403
  profileDataObj = setLoggedUserData(profileSpecifiedData);
2364
2404
  if (isBrowser) {
@@ -2366,11 +2406,11 @@ var LoginModal = function LoginModal(_ref) {
2366
2406
  event = new window.CustomEvent('tf-login');
2367
2407
  window.document.dispatchEvent(event);
2368
2408
  }
2369
- onLogin();
2370
- _context.next = 26;
2409
+ onLogin(_get(authRes, 'data.data'));
2410
+ _context.next = 27;
2371
2411
  break;
2372
- case 23:
2373
- _context.prev = 23;
2412
+ case 24:
2413
+ _context.prev = 24;
2374
2414
  _context.t1 = _context["catch"](1);
2375
2415
  if (axios.isAxiosError(_context.t1)) {
2376
2416
  _error = (_context.t1 == null ? void 0 : (_e$response = _context.t1.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message) || 'Error';
@@ -2378,11 +2418,11 @@ var LoginModal = function LoginModal(_ref) {
2378
2418
  } else if (_context.t1 instanceof Error) {
2379
2419
  setError((_context.t1 == null ? void 0 : _context.t1.message) || 'Error');
2380
2420
  }
2381
- case 26:
2421
+ case 27:
2382
2422
  case "end":
2383
2423
  return _context.stop();
2384
2424
  }
2385
- }, _callee, null, [[1, 23], [6, 13]]);
2425
+ }, _callee, null, [[1, 24], [7, 14]]);
2386
2426
  }));
2387
2427
  function onSubmit(_x) {
2388
2428
  return _onSubmit.apply(this, arguments);
@@ -2886,6 +2926,29 @@ function SelectField(_ref) {
2886
2926
  }, error) : null));
2887
2927
  }
2888
2928
 
2929
+ var CopyMessageModal = function CopyMessageModal(props) {
2930
+ var _props$showCopyModal = props.showCopyModal,
2931
+ showCopyModal = _props$showCopyModal === void 0 ? false : _props$showCopyModal,
2932
+ onClose = props.onClose;
2933
+ return React.createElement(Modal$2, {
2934
+ open: showCopyModal,
2935
+ onClose: onClose,
2936
+ "aria-labelledby": "modal-modal-title",
2937
+ "aria-describedby": "modal-modal-description",
2938
+ className: "success-copy-modal"
2939
+ }, React.createElement("div", {
2940
+ className: "message-copy-success-box"
2941
+ }, React.createElement("div", {
2942
+ className: "message-copy-success"
2943
+ }, React.createElement("span", null, "Copied to your clipboard! Now paste your link in a Snapchat message,"), React.createElement("span", null, "your Instagram bio, Whatsapp, Facebook or a text :)")), React.createElement("div", {
2944
+ className: "footer"
2945
+ }, React.createElement("button", {
2946
+ className: "footer-button",
2947
+ type: "button",
2948
+ onClick: onClose
2949
+ }, "OK"))));
2950
+ };
2951
+
2889
2952
  var DATE_SIZE = 32;
2890
2953
  var compactStyles = {
2891
2954
  '& > div': {
@@ -3009,7 +3072,7 @@ var NativeSelectField = function NativeSelectField(_ref) {
3009
3072
  id: field.name
3010
3073
  },
3011
3074
  "native": true,
3012
- className: theme,
3075
+ className: "Mui-Select " + theme,
3013
3076
  MenuProps: {
3014
3077
  className: theme
3015
3078
  }
@@ -3409,10 +3472,6 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3409
3472
  _onGetProfileDataSuccess = _ref4$onGetProfileDat === void 0 ? _identity : _ref4$onGetProfileDat,
3410
3473
  _ref4$onGetProfileDat2 = _ref4.onGetProfileDataError,
3411
3474
  onGetProfileDataError = _ref4$onGetProfileDat2 === void 0 ? _identity : _ref4$onGetProfileDat2,
3412
- _ref4$onAuthorizeSucc = _ref4.onAuthorizeSuccess,
3413
- onAuthorizeSuccess = _ref4$onAuthorizeSucc === void 0 ? _identity : _ref4$onAuthorizeSucc,
3414
- _ref4$onAuthorizeErro = _ref4.onAuthorizeError,
3415
- onAuthorizeError = _ref4$onAuthorizeErro === void 0 ? _identity : _ref4$onAuthorizeErro,
3416
3475
  onLogin = _ref4.onLogin,
3417
3476
  _ref4$onLoginSuccess = _ref4.onLoginSuccess,
3418
3477
  onLoginSuccess = _ref4$onLoginSuccess === void 0 ? _identity : _ref4$onLoginSuccess,
@@ -4232,8 +4291,6 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
4232
4291
  },
4233
4292
  alreadyHasUser: alreadyHasUser,
4234
4293
  userExpired: userExpired,
4235
- onAuthorizeSuccess: onAuthorizeSuccess,
4236
- onAuthorizeError: onAuthorizeError,
4237
4294
  onGetProfileDataSuccess: function onGetProfileDataSuccess(data) {
4238
4295
  fetchCart();
4239
4296
  _onGetProfileDataSuccess(data);
@@ -4265,7 +4322,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
4265
4322
  onClose: function onClose() {
4266
4323
  setShowModalForgotPassword(false);
4267
4324
  },
4268
- onLogin: function onLogin() {
4325
+ onLoginButtonClick: function onLoginButtonClick() {
4269
4326
  setShowModalForgotPassword(false);
4270
4327
  setShowModalLogin(true);
4271
4328
  },
@@ -5183,6 +5240,52 @@ var PaymentContainer = function PaymentContainer(_ref) {
5183
5240
  }) : isFreeTickets ? 'Complete Registration' : 'Confirm Payment Plan')))));
5184
5241
  };
5185
5242
 
5243
+ var isValidNumber = function isValidNumber(value) {
5244
+ if (isNaN(Number(value))) {
5245
+ return false;
5246
+ }
5247
+ return _isNumber(Number(value));
5248
+ };
5249
+
5250
+ var getImage = function getImage(name) {
5251
+ if (name === void 0) {
5252
+ name = '';
5253
+ }
5254
+ var image = '';
5255
+ if (!name.trim().length) {
5256
+ return image;
5257
+ }
5258
+ if (process.env.NODE_ENV === 'production') {
5259
+ image = require("./images/" + name);
5260
+ return image["default"];
5261
+ }
5262
+ return image;
5263
+ };
5264
+
5265
+ var SpotifyIcon = function SpotifyIcon() {
5266
+ return React.createElement(SVG, {
5267
+ src: getImage('spotify.svg')
5268
+ });
5269
+ };
5270
+ var InstagramIcon = function InstagramIcon() {
5271
+ return React.createElement(SVG, {
5272
+ src: getImage('instagram.svg')
5273
+ });
5274
+ };
5275
+ var SocialButton = function SocialButton(props) {
5276
+ var children = props.children,
5277
+ url = props.url,
5278
+ disabled = props.disabled;
5279
+ var handleClick = function handleClick() {
5280
+ window.open(url);
5281
+ };
5282
+ return React.createElement("button", {
5283
+ className: "react-share__ShareButton " + (disabled ? 'disabled-action' : ''),
5284
+ type: "button",
5285
+ onClick: !disabled ? handleClick : _identity
5286
+ }, children);
5287
+ };
5288
+
5186
5289
  var config = {
5187
5290
  facebook: {
5188
5291
  component: FacebookShareButton,
@@ -5267,6 +5370,14 @@ var config = {
5267
5370
  hatena: {
5268
5371
  component: HatenaShareButton,
5269
5372
  icon: HatenaIcon
5373
+ },
5374
+ instagram: {
5375
+ component: SocialButton,
5376
+ icon: InstagramIcon
5377
+ },
5378
+ spotify: {
5379
+ component: SocialButton,
5380
+ icon: SpotifyIcon
5270
5381
  }
5271
5382
  };
5272
5383
  function config$1 (key) {
@@ -5278,11 +5389,20 @@ var SocialComponent = function SocialComponent(_ref) {
5278
5389
  var mainLabel = _ref.mainLabel,
5279
5390
  subLabel = _ref.subLabel,
5280
5391
  platform = _ref.platform,
5281
- shareData = _ref.shareData;
5392
+ shareData = _ref.shareData,
5393
+ points = _ref.points,
5394
+ onAfterShare = _ref.onAfterShare,
5395
+ alreadyApplied = _ref.alreadyApplied,
5396
+ oneTimeAction = _ref.oneTimeAction;
5282
5397
  var Component = (_config = config$1(platform)) == null ? void 0 : _config.component;
5283
5398
  var Icon = (_config2 = config$1(platform)) == null ? void 0 : _config2.icon;
5284
- return React.createElement(React.Fragment, null, Component && React.createElement(Component, Object.assign({}, shareData), React.createElement("div", {
5285
- className: "social-media-sharing"
5399
+ var isActionDisabled = alreadyApplied && oneTimeAction;
5400
+ return React.createElement(React.Fragment, null, Component && React.createElement(Component, Object.assign({}, shareData, {
5401
+ disabled: isActionDisabled
5402
+ }), React.createElement("div", {
5403
+ onKeyDown: _identity,
5404
+ onClick: !isActionDisabled ? onAfterShare : _identity,
5405
+ className: "social-media-sharing " + platform
5286
5406
  }, React.createElement("div", {
5287
5407
  className: "share-icon"
5288
5408
  }, React.createElement(Icon, {
@@ -5290,7 +5410,17 @@ var SocialComponent = function SocialComponent(_ref) {
5290
5410
  round: true
5291
5411
  })), React.createElement("span", {
5292
5412
  className: "share-text"
5293
- }, mainLabel, React.createElement("br", null), " ", subLabel))));
5413
+ }, React.createElement("span", {
5414
+ className: "main-label"
5415
+ }, mainLabel, " "), React.createElement("span", {
5416
+ className: "sub-label"
5417
+ }, subLabel)), isValidNumber(points) && React.createElement("div", {
5418
+ className: "share-points"
5419
+ }, React.createElement("span", {
5420
+ className: "points-count"
5421
+ }, points), React.createElement("span", {
5422
+ className: "points-text"
5423
+ }, "Points")))));
5294
5424
  };
5295
5425
  var SocialButtons = function SocialButtons(_ref2) {
5296
5426
  var showDefaultShareButtons = _ref2.showDefaultShareButtons,
@@ -5298,11 +5428,18 @@ var SocialButtons = function SocialButtons(_ref2) {
5298
5428
  name = _ref2.name,
5299
5429
  appId = _ref2.appId,
5300
5430
  shareButtons = _ref2.shareButtons,
5431
+ _ref2$titleText = _ref2.titleText,
5432
+ titleText = _ref2$titleText === void 0 ? 'or use one of these convenient buttons:' : _ref2$titleText,
5433
+ _ref2$footerText = _ref2.footerText,
5434
+ footerText = _ref2$footerText === void 0 ? React.createElement("p", null, "We ", React.createElement("strong", null, "never"), " post on Facebook without your permission!") : _ref2$footerText,
5301
5435
  clientLabel = _ref2.clientLabel,
5302
- showReferralsInfoText = _ref2.showReferralsInfoText;
5303
- return React.createElement(React.Fragment, null, React.createElement("div", {
5436
+ _ref2$onAfterShare = _ref2.onAfterShare,
5437
+ _onAfterShare = _ref2$onAfterShare === void 0 ? _identity : _ref2$onAfterShare,
5438
+ _ref2$showReferralsIn = _ref2.showReferralsInfoText,
5439
+ showReferralsInfoText = _ref2$showReferralsIn === void 0 ? false : _ref2$showReferralsIn;
5440
+ return React.createElement(React.Fragment, null, titleText && React.createElement("div", {
5304
5441
  className: "convenient_buttons"
5305
- }, "or use one of these convenient buttons:"), React.createElement("div", {
5442
+ }, titleText), React.createElement("div", {
5306
5443
  className: "social-media-btns"
5307
5444
  }, showDefaultShareButtons && React.createElement(React.Fragment, null, React.createElement(SocialComponent, {
5308
5445
  mainLabel: "Share on",
@@ -5338,9 +5475,12 @@ var SocialButtons = function SocialButtons(_ref2) {
5338
5475
  }
5339
5476
  })), shareButtons.map(function (shareButton, index) {
5340
5477
  return React.createElement(SocialComponent, Object.assign({
5478
+ onAfterShare: function onAfterShare() {
5479
+ return _onAfterShare(shareButton.eventActionId);
5480
+ },
5341
5481
  key: index
5342
5482
  }, shareButton));
5343
- })), (showDefaultShareButtons || shareButtons.length) && React.createElement("p", null, "We ", React.createElement("strong", null, "never"), " post on Facebook without your permission!"), (showReferralsInfoText || Boolean(clientLabel)) && React.createElement("p", {
5483
+ })), showDefaultShareButtons || shareButtons.length ? footerText : null, (showReferralsInfoText || Boolean(clientLabel)) && React.createElement("p", {
5344
5484
  className: "note-message"
5345
5485
  }, React.createElement("span", null, "*Please note, only purchases made from a different", ' ', clientLabel || 'Ticket Fairy', " account can count towards your referrals"), React.createElement("span", null, ' ', "so please make sure you ask your friends to buy their own tickets using their own ", clientLabel || 'Ticket Fairy', " account!")));
5346
5486
  };
@@ -5420,7 +5560,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
5420
5560
  case 12:
5421
5561
  _context.prev = 12;
5422
5562
  _context.t0 = _context["catch"](1);
5423
- onGetConfirmationDataError(_context.t0.response);
5563
+ if (axios.isAxiosError(_context.t0)) onGetConfirmationDataError(_context.t0);
5424
5564
  case 15:
5425
5565
  case "end":
5426
5566
  return _context.stop();
@@ -5460,23 +5600,10 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
5460
5600
  });
5461
5601
  return React.createElement("div", {
5462
5602
  className: "confirmation-page"
5463
- }, showCopyInfoModal && React.createElement(Modal$2, {
5464
- open: showCopyModal,
5603
+ }, showCopyInfoModal && React.createElement(CopyMessageModal, {
5465
5604
  onClose: onClose,
5466
- "aria-labelledby": "modal-modal-title",
5467
- "aria-describedby": "modal-modal-description",
5468
- className: "success-copy-modal"
5469
- }, React.createElement("div", {
5470
- className: "message-copy-success-box"
5471
- }, React.createElement("div", {
5472
- className: "message-copy-success"
5473
- }, React.createElement("span", null, "Copied to your clipboard! Now paste your link in a Snapchat message,"), React.createElement("span", null, "your Instagram bio, Whatsapp, Facebook or a text :)")), React.createElement("div", {
5474
- className: "footer"
5475
- }, React.createElement("button", {
5476
- className: "footer-button",
5477
- type: "button",
5478
- onClick: onClose
5479
- }, "OK")))), data && React.createElement(React.Fragment, null, React.createElement("div", {
5605
+ showCopyModal: showCopyModal
5606
+ }), data && React.createElement(React.Fragment, null, React.createElement("div", {
5480
5607
  className: "header-container"
5481
5608
  }, React.createElement("div", {
5482
5609
  className: "header-product-image"
@@ -5586,24 +5713,97 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
5586
5713
  }, "^ This is based on the most expensive ticket in your order."))))));
5587
5714
  };
5588
5715
 
5589
- var X_TF_ECOMMERCE = 'X-TF-ECOMMERCE';
5590
-
5591
- var useCookieListener = function useCookieListener(key, handler) {
5592
- var getCookie = function getCookie() {
5593
- return getCookieByName(key);
5594
- };
5595
- var _useState = useState(),
5596
- intervalValue = _useState[0],
5597
- setIntervalValue = _useState[1];
5598
- var cookieRef = useRef(getCookie());
5599
- var handleCookieChange = function handleCookieChange() {
5600
- var currentCookie = getCookie();
5601
- var prevCookie = cookieRef.current;
5602
- if (currentCookie !== prevCookie) {
5603
- cookieRef.current = getCookie();
5604
- handler(cookieRef.current);
5605
- }
5606
- };
5716
+ var getPreRegistrationInfluancers = /*#__PURE__*/function () {
5717
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
5718
+ var response;
5719
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
5720
+ while (1) switch (_context.prev = _context.next) {
5721
+ case 0:
5722
+ _context.next = 2;
5723
+ return publicRequest.get("v1/event/" + data.eventId + "/pre-registration/influencers");
5724
+ case 2:
5725
+ response = _context.sent;
5726
+ return _context.abrupt("return", response.data);
5727
+ case 4:
5728
+ case "end":
5729
+ return _context.stop();
5730
+ }
5731
+ }, _callee);
5732
+ }));
5733
+ return function getPreRegistrationInfluancers(_x) {
5734
+ return _ref.apply(this, arguments);
5735
+ };
5736
+ }();
5737
+ var getPreRegistrationShareOptions = /*#__PURE__*/function () {
5738
+ var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {
5739
+ var response;
5740
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
5741
+ while (1) switch (_context2.prev = _context2.next) {
5742
+ case 0:
5743
+ _context2.next = 2;
5744
+ return publicRequest.get("/v1/pre-registration/" + data.hash + "/confirmation-page");
5745
+ case 2:
5746
+ response = _context2.sent;
5747
+ return _context2.abrupt("return", response.data);
5748
+ case 4:
5749
+ case "end":
5750
+ return _context2.stop();
5751
+ }
5752
+ }, _callee2);
5753
+ }));
5754
+ return function getPreRegistrationShareOptions(_x2) {
5755
+ return _ref2.apply(this, arguments);
5756
+ };
5757
+ }();
5758
+ var submitShareAction = /*#__PURE__*/function () {
5759
+ var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {
5760
+ var eventActionId, accessToken, hash, response;
5761
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
5762
+ while (1) switch (_context3.prev = _context3.next) {
5763
+ case 0:
5764
+ eventActionId = data.eventActionId, accessToken = data.accessToken, hash = data.hash;
5765
+ _context3.next = 3;
5766
+ return publicRequest.post("/v1/pre-registration/" + hash + "/submit-action", {
5767
+ data: {
5768
+ attributes: {
5769
+ phase: 'pre-registration',
5770
+ eventActionId: Number(eventActionId),
5771
+ accessToken: accessToken
5772
+ }
5773
+ }
5774
+ });
5775
+ case 3:
5776
+ response = _context3.sent;
5777
+ return _context3.abrupt("return", response.data);
5778
+ case 5:
5779
+ case "end":
5780
+ return _context3.stop();
5781
+ }
5782
+ }, _callee3);
5783
+ }));
5784
+ return function submitShareAction(_x3) {
5785
+ return _ref3.apply(this, arguments);
5786
+ };
5787
+ }();
5788
+
5789
+ var X_TF_ECOMMERCE = 'X-TF-ECOMMERCE';
5790
+
5791
+ var useCookieListener = function useCookieListener(key, handler) {
5792
+ var getCookie = function getCookie() {
5793
+ return getCookieByName(key);
5794
+ };
5795
+ var _useState = useState(),
5796
+ intervalValue = _useState[0],
5797
+ setIntervalValue = _useState[1];
5798
+ var cookieRef = useRef(getCookie());
5799
+ var handleCookieChange = function handleCookieChange() {
5800
+ var currentCookie = getCookie();
5801
+ var prevCookie = cookieRef.current;
5802
+ if (currentCookie !== prevCookie) {
5803
+ cookieRef.current = getCookie();
5804
+ handler(cookieRef.current);
5805
+ }
5806
+ };
5607
5807
  useEffect(function () {
5608
5808
  var interval = setInterval(handleCookieChange, 500);
5609
5809
  setIntervalValue(interval);
@@ -5614,6 +5814,26 @@ var useCookieListener = function useCookieListener(key, handler) {
5614
5814
  }, []);
5615
5815
  };
5616
5816
 
5817
+ function useLocalStorageListener(key, callback) {
5818
+ var isWindowDefined = typeof window !== 'undefined';
5819
+ var _useState = useState(isWindowDefined ? localStorage.getItem(key) : ''),
5820
+ value = _useState[0],
5821
+ setValue = _useState[1];
5822
+ useEffect(function () {
5823
+ var intervalId = setInterval(function () {
5824
+ var newValue = localStorage.getItem(key);
5825
+ if (newValue !== value) {
5826
+ setValue(newValue);
5827
+ callback(JSON.parse(newValue || ''));
5828
+ }
5829
+ }, 100);
5830
+ return function () {
5831
+ clearInterval(intervalId);
5832
+ };
5833
+ }, [key, value, callback]);
5834
+ return value;
5835
+ }
5836
+
5617
5837
  var style$4 = {
5618
5838
  position: 'absolute',
5619
5839
  top: '50%',
@@ -5987,7 +6207,7 @@ var ReferralLogic = function ReferralLogic(props) {
5987
6207
  var isWindowDefined = typeof window !== 'undefined';
5988
6208
  if (isWindowDefined) {
5989
6209
  var params = new URL("" + window.location).searchParams;
5990
- var referralId = params.get('ttf_r') || '';
6210
+ var referralId = params.get('ttf_r') || params.get('referrer_id') || '';
5991
6211
  var referralValue = [eventId, '.', referralId].join('');
5992
6212
  var isAlreadyCounted = localStorage.getItem('referral_key') === referralValue;
5993
6213
  if (referralId && eventId && !isAlreadyCounted) {
@@ -6031,7 +6251,7 @@ var getTicketSelectOptions = function getTicketSelectOptions(maxCount, minCount,
6031
6251
  label: 0,
6032
6252
  value: 0
6033
6253
  }];
6034
- for (var i = minCount; i <= Math.min(50, maxCount); i += multiplier) {
6254
+ for (var i = minCount || 1; i <= Math.min(50, maxCount); i += multiplier) {
6035
6255
  options.push({
6036
6256
  label: i,
6037
6257
  value: i
@@ -6039,16 +6259,42 @@ var getTicketSelectOptions = function getTicketSelectOptions(maxCount, minCount,
6039
6259
  }
6040
6260
  return options;
6041
6261
  };
6262
+ var defineIsSalesClosed = function defineIsSalesClosed(eventDatesInfo) {
6263
+ var salesStarted = eventDatesInfo.salesStarted,
6264
+ salesEnded = eventDatesInfo.salesEnded,
6265
+ presalesStarted = eventDatesInfo.presalesStarted,
6266
+ presalesEnded = eventDatesInfo.presalesEnded,
6267
+ presalesEnabled = eventDatesInfo.presalesEnabled;
6268
+ var isSalesClosed = false;
6269
+ if (!salesStarted || salesStarted && salesEnded) {
6270
+ isSalesClosed = true;
6271
+ }
6272
+ if (presalesEnabled) {
6273
+ if (!presalesStarted && !presalesEnded || presalesStarted && presalesEnded && !salesStarted) {
6274
+ isSalesClosed = true;
6275
+ } else {
6276
+ isSalesClosed = false;
6277
+ }
6278
+ }
6279
+ return isSalesClosed;
6280
+ };
6042
6281
 
6043
6282
  var TicketRow = function TicketRow(_ref) {
6044
6283
  var ticketTier = _ref.ticketTier,
6045
6284
  prevTicketTier = _ref.prevTicketTier,
6046
6285
  selectedTickets = _ref.selectedTickets,
6047
6286
  handleTicketSelect = _ref.handleTicketSelect,
6287
+ event = _ref.event,
6048
6288
  isSeatMapAllowed = _ref.isSeatMapAllowed,
6049
6289
  tableType = _ref.tableType;
6050
6290
  var soldOutMessage = ticketTier.soldOutMessage ? ("" + ticketTier.soldOutMessage).toUpperCase() : 'SOLD OUT';
6051
- var isSalesClosed = !ticketTier.salesStarted || ticketTier.salesEnded;
6291
+ var isSalesClosed = defineIsSalesClosed({
6292
+ salesStarted: ticketTier.salesStarted,
6293
+ salesEnded: ticketTier.salesEnded,
6294
+ presalesStarted: event == null ? void 0 : event.presalesStarted,
6295
+ presalesEnded: event == null ? void 0 : event.presalesEnded,
6296
+ presalesEnabled: event == null ? void 0 : event.presales_enabled
6297
+ });
6052
6298
  var maxCount = tableType ? ticketTier.maxGuests : ticketTier.maxQuantity;
6053
6299
  var minCount = tableType ? ticketTier.minGuests : ticketTier.minQuantity;
6054
6300
  var multiplier = ticketTier.multiplier;
@@ -6096,7 +6342,7 @@ var TicketRow = function TicketRow(_ref) {
6096
6342
  } else if (canPurchaseTicket && isSeatMapAllowed && !isDirectPurchaseAllowed) {
6097
6343
  // Seat Map Tickets renderer logic
6098
6344
  returnValue = null;
6099
- } else if (canPurchaseTicket) {
6345
+ } else if (canPurchaseTicket || canPurchaseTicket && event != null && event.presalesStarted && !(event != null && event.presalesEnded)) {
6100
6346
  returnValue = onSaleContent;
6101
6347
  } else if (_get(prevTicketTier, 'in_stock')) {
6102
6348
  returnValue = 'SOON';
@@ -6170,7 +6416,8 @@ var TicketsSection = function TicketsSection(_ref) {
6170
6416
  ticketTier: ticket,
6171
6417
  prevTicketTier: arr[i - 1],
6172
6418
  selectedTickets: selectedTickets,
6173
- handleTicketSelect: ticketSelect
6419
+ handleTicketSelect: ticketSelect,
6420
+ event: event
6174
6421
  })))));
6175
6422
  }), !hideTableTicketsHeader && tableTicketsHeaderComponent, tableTickets.map(function (ticket, i, arr) {
6176
6423
  var _arr2;
@@ -6219,7 +6466,8 @@ var TicketsSection = function TicketsSection(_ref) {
6219
6466
  prevTicketTier: arr[i - 1],
6220
6467
  selectedTickets: selectedTickets,
6221
6468
  handleTicketSelect: ticketSelect,
6222
- isSeatMapAllowed: isSeatMapAllowed
6469
+ isSeatMapAllowed: isSeatMapAllowed,
6470
+ event: event
6223
6471
  }))))));
6224
6472
  }));
6225
6473
  };
@@ -6300,6 +6548,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
6300
6548
  var _useState = useState({}),
6301
6549
  selectedTickets = _useState[0],
6302
6550
  setSelectedTickets = _useState[1];
6551
+ var isWindowDefined = typeof window !== 'undefined';
6303
6552
  var _useState2 = useState(Boolean(getCookieByName(X_TF_ECOMMERCE))),
6304
6553
  isLogged = _useState2[0],
6305
6554
  setIsLogged = _useState2[1];
@@ -6354,16 +6603,31 @@ var TicketsContainer = function TicketsContainer(_ref) {
6354
6603
  var _useState19 = useState(),
6355
6604
  pendingVerificationMessage = _useState19[0],
6356
6605
  setPendingVerificationMessage = _useState19[1];
6606
+ var _useState20 = useState([]),
6607
+ preregistereds = _useState20[0],
6608
+ setPreregistereds = _useState20[1];
6609
+ var _useState21 = useState(false),
6610
+ ticketsNotAvailableModalOpen = _useState21[0],
6611
+ setTicketsNotAvailableModalOpen = _useState21[1];
6612
+ var _useState22 = useState(checkUserPreregistration()),
6613
+ isPreregistred = _useState22[0],
6614
+ setIsPreregisred = _useState22[1];
6357
6615
  var ticketsContainerRef = useRef(null);
6358
6616
  var pageUrl = isBrowser ? window.location.href.split('?')[0] : '';
6359
6617
  useCookieListener(X_TF_ECOMMERCE, function (value) {
6360
6618
  return setIsLogged(Boolean(value));
6361
6619
  });
6620
+ useLocalStorageListener('user_data', function (user) {
6621
+ var isPreregistredUser = _some(preregistereds, function (item) {
6622
+ return item.email === (user == null ? void 0 : user.email);
6623
+ });
6624
+ setIsPreregisred(isPreregistredUser);
6625
+ });
6362
6626
  usePixel(eventId, {
6363
6627
  pageUrl: pageUrl
6364
6628
  });
6365
6629
  useEffect(function () {
6366
- if (typeof window !== 'undefined') {
6630
+ if (isWindowDefined) {
6367
6631
  var access_token = window.localStorage.getItem('access_token');
6368
6632
  if (access_token) {
6369
6633
  var decoded = jwt_decode(access_token);
@@ -6376,8 +6640,14 @@ var TicketsContainer = function TicketsContainer(_ref) {
6376
6640
  }
6377
6641
  }, []);
6378
6642
  useEffect(function () {
6379
- !!eventId && getTicketsApi();
6643
+ if (eventId) {
6644
+ getTicketsApi();
6645
+ fetchPreregisteredsData();
6646
+ }
6380
6647
  }, [eventId]);
6648
+ useEffect(function () {
6649
+ setIsPreregisred(checkUserPreregistration());
6650
+ }, [preregistereds]);
6381
6651
  useEffect(function () {
6382
6652
  if (isLogged) {
6383
6653
  fetchUserData().then(function (res) {
@@ -6498,6 +6768,39 @@ var TicketsContainer = function TicketsContainer(_ref) {
6498
6768
  }));
6499
6769
  return _getTicketsApi.apply(this, arguments);
6500
6770
  }
6771
+ function fetchPreregisteredsData() {
6772
+ return _fetchPreregisteredsData.apply(this, arguments);
6773
+ }
6774
+ function _fetchPreregisteredsData() {
6775
+ _fetchPreregisteredsData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
6776
+ var preregistrationData;
6777
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
6778
+ while (1) switch (_context5.prev = _context5.next) {
6779
+ case 0:
6780
+ _context5.prev = 0;
6781
+ _context5.next = 3;
6782
+ return getPreRegistrationInfluancers({
6783
+ eventId: eventId
6784
+ });
6785
+ case 3:
6786
+ preregistrationData = _context5.sent;
6787
+ setPreregistereds(preregistrationData.data.attributes.influencers);
6788
+ _context5.next = 10;
6789
+ break;
6790
+ case 7:
6791
+ _context5.prev = 7;
6792
+ _context5.t0 = _context5["catch"](0);
6793
+ if (axios.isAxiosError(_context5.t0)) {
6794
+ setError(_get(_context5.t0, 'response.data.message'));
6795
+ }
6796
+ case 10:
6797
+ case "end":
6798
+ return _context5.stop();
6799
+ }
6800
+ }, _callee5, null, [[0, 7]]);
6801
+ }));
6802
+ return _fetchPreregisteredsData.apply(this, arguments);
6803
+ }
6501
6804
  var handleTicketSelect = function handleTicketSelect(key, value, isTable) {
6502
6805
  if (isTable === void 0) {
6503
6806
  isTable = false;
@@ -6510,6 +6813,17 @@ var TicketsContainer = function TicketsContainer(_ref) {
6510
6813
  return _ref3 = {}, _ref3[key] = value, _ref3.isTable = isTable, _ref3;
6511
6814
  });
6512
6815
  };
6816
+ function checkUserPreregistration() {
6817
+ var userDataString = isWindowDefined ? window.localStorage.getItem('user_data') : '';
6818
+ var isPreregistredUser = false;
6819
+ if (userDataString) {
6820
+ var user = JSON.parse(userDataString);
6821
+ isPreregistredUser = _some(preregistereds, function (item) {
6822
+ return item.email === (user == null ? void 0 : user.email);
6823
+ });
6824
+ }
6825
+ return isPreregistredUser;
6826
+ }
6513
6827
  var handleOrdersClick = function handleOrdersClick() {
6514
6828
  if (isBrowser) {
6515
6829
  window.location.href = ordersPath != null ? ordersPath : '/orders';
@@ -6693,7 +7007,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
6693
7007
  };
6694
7008
  }();
6695
7009
  var isTicketOnSale = _some(tickets, function (item) {
6696
- return item.salesStarted && !item.salesEnded && !item.soldOut;
7010
+ return (item.salesStarted || (event == null ? void 0 : event.presalesStarted)) && !item.salesEnded && !item.soldOut;
6697
7011
  });
6698
7012
  var eventHasTickets = !_isEmpty(tickets);
6699
7013
  var isSalesClosed = event == null ? void 0 : event.salesEnded;
@@ -6719,9 +7033,14 @@ var TicketsContainer = function TicketsContainer(_ref) {
6719
7033
  }
6720
7034
  }
6721
7035
  };
7036
+ var handleNotAvailableTicketsClick = function handleNotAvailableTicketsClick() {
7037
+ if (!_isEmpty(selectedTickets)) {
7038
+ setTicketsNotAvailableModalOpen(true);
7039
+ }
7040
+ };
6722
7041
  var bookButtonIsDisabled = (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0) && !(event != null && event.flagSeatMapAllowed);
6723
7042
  var isTicketAvailable = _some(tickets, function (ticket) {
6724
- return ticket.displayTicket && !ticket.soldOut && ticket.salesStarted;
7043
+ return ticket.displayTicket && !ticket.soldOut && (ticket.salesStarted || (event == null ? void 0 : event.presalesStarted) && !(event != null && event.presalesEnded));
6725
7044
  });
6726
7045
  var wrappedActionsSectionComponent = React.isValidElement(ActionsSectionComponent) ? React.cloneElement(ActionsSectionComponent, {
6727
7046
  handleGetTicketClick: handleGetTicketClick,
@@ -6749,6 +7068,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
6749
7068
  var hideTopInfluencers = event == null ? void 0 : event.hideTopInfluencers;
6750
7069
  var isSeatMapAllowed = _get(event, 'seatMapAllowed', false);
6751
7070
  var isTableMapEnabled = _get(event, 'tableMapEnabled', false);
7071
+ var notAvailableTicketsMessage = "Tickets for this event are not available until " + moment(event == null ? void 0 : event.salesStart).format('dddd, DD MMMM YYYY') + ". \n If you pre-registered, log into your account first to buy your pre-sale ticket.";
6752
7072
  var tableTickets = _filter(tickets, function (ticket) {
6753
7073
  return ticket.isTable;
6754
7074
  });
@@ -6790,7 +7110,16 @@ var TicketsContainer = function TicketsContainer(_ref) {
6790
7110
  style: {
6791
7111
  width: '350px'
6792
7112
  }
6793
- }, error), isLoading ? React.createElement(Loader, null) : React.createElement("div", {
7113
+ }, error), ticketsNotAvailableModalOpen && React.createElement(ConfirmModal, {
7114
+ message: notAvailableTicketsMessage,
7115
+ hideCancelBtn: true,
7116
+ onClose: function onClose() {
7117
+ return _onClose('invalidLink');
7118
+ },
7119
+ onConfirm: function onConfirm() {
7120
+ return setTicketsNotAvailableModalOpen(false);
7121
+ }
7122
+ }), isLoading ? React.createElement(Loader, null) : React.createElement("div", {
6794
7123
  ref: ticketsContainerRef
6795
7124
  }, !isSalesClosed && React.createElement(TicketsSection, {
6796
7125
  event: event,
@@ -6840,7 +7169,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
6840
7169
  }) : null, wrappedActionsSectionComponent, canShowGetTicketBtn() && React.createElement(Button$1, {
6841
7170
  "aria-hidden": true,
6842
7171
  className: "book-button \n " + (bookButtonIsDisabled ? 'disabled' : '') + " \n " + (isButtonScrollable ? 'is-scrollable' : '') + "\n " + (!isLoggedIn ? 'on-bottom' : '') + "\n ",
6843
- onClick: handleGetTicketClick
7172
+ onClick: event != null && event.salesStart && event != null && event.presalesStarted && !(event != null && event.presalesEnded) && (!isPreregistred || !isLogged) ? handleNotAvailableTicketsClick : handleGetTicketClick
6844
7173
  }, selectedTickets.isTable ? 'RESERVE TABLES' : getTicketsLabel || 'GET TICKETS'), isSeatMapAllowed && !(event != null && event.salesEnded) && isTicketAvailable && React.createElement(Button$1, {
6845
7174
  className: "reserve-button",
6846
7175
  "aria-hidden": true,
@@ -7051,7 +7380,7 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
7051
7380
  fetchData(1, limit, filter);
7052
7381
  }, [isLogged]);
7053
7382
  var fetchData = /*#__PURE__*/function () {
7054
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(page, limit, filter) {
7383
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(page, limit, eventSlug) {
7055
7384
  var response, _data, _error$response;
7056
7385
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7057
7386
  while (1) switch (_context.prev = _context.next) {
@@ -7059,7 +7388,7 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
7059
7388
  _context.prev = 0;
7060
7389
  setLoading(true);
7061
7390
  _context.next = 4;
7062
- return getOrders(page, limit, filter);
7391
+ return getOrders(page, limit, eventSlug);
7063
7392
  case 4:
7064
7393
  response = _context.sent;
7065
7394
  onGetOrdersSuccess(response);
@@ -8756,7 +9085,9 @@ var LoginForm = function LoginForm(_ref) {
8756
9085
  _ref$showForgotPasswo = _ref.showForgotPasswordButton,
8757
9086
  showForgotPasswordButton = _ref$showForgotPasswo === void 0 ? false : _ref$showForgotPasswo,
8758
9087
  _ref$showSignUpButton = _ref.showSignUpButton,
8759
- showSignUpButton = _ref$showSignUpButton === void 0 ? false : _ref$showSignUpButton;
9088
+ showSignUpButton = _ref$showSignUpButton === void 0 ? false : _ref$showSignUpButton,
9089
+ _ref$showPoweredByIma = _ref.showPoweredByImage,
9090
+ showPoweredByImage = _ref$showPoweredByIma === void 0 ? false : _ref$showPoweredByIma;
8760
9091
  var _useState = useState(''),
8761
9092
  error = _useState[0],
8762
9093
  setError = _useState[1];
@@ -8880,7 +9211,7 @@ var LoginForm = function LoginForm(_ref) {
8880
9211
  }, React.createElement("span", {
8881
9212
  "aria-hidden": "true",
8882
9213
  onClick: onSignupButtonClick
8883
- }, "Sign up"))));
9214
+ }, "Sign up")), showPoweredByImage ? React.createElement(PoweredBy, null) : null));
8884
9215
  }));
8885
9216
  };
8886
9217
 
@@ -11177,5 +11508,1027 @@ var RsvpContainer = function RsvpContainer(_ref) {
11177
11508
  }, "RSVP"))))))));
11178
11509
  };
11179
11510
 
11180
- export { AddonsContainter, BillingInfoContainer, ConfirmationContainer, DelegationsContainer, ForgotPasswordModal, IDVerification, LoginModal, MyTicketsContainer, OrderDetailsContainer, PaymentContainer, PoweredBy, RedirectModal, ResetPasswordContainer, RsvpContainer, SeatMapContainer, TicketResaleContainer, TicketsContainer, VERIFICATION_STATUSES, createFixedFloatNormalizer, currencyNormalizerCreator, setConfigs, useCookieListener };
11511
+ var formFieldsNotLoggedIn = [{
11512
+ name: 'basic-info',
11513
+ groupLabel: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "If you want to enter your details manually, please type them below to create an account, then click on"), /*#__PURE__*/React.createElement("b", null, " Confirm Registration:")),
11514
+ groupLabelClassName: '',
11515
+ groupClassName: '',
11516
+ fields: [{
11517
+ className: 'half-width',
11518
+ name: 'firstName',
11519
+ label: 'First Name',
11520
+ type: 'text',
11521
+ required: true,
11522
+ onValidate: null
11523
+ }, {
11524
+ className: 'half-width',
11525
+ name: 'lastName',
11526
+ label: 'Last Name',
11527
+ type: 'text',
11528
+ required: true,
11529
+ onValidate: null
11530
+ }, {
11531
+ name: 'email',
11532
+ label: 'Email',
11533
+ type: 'email',
11534
+ required: true,
11535
+ onValidate: null
11536
+ }, {
11537
+ name: 'confirmEmail',
11538
+ label: 'Confirm Email',
11539
+ type: 'email',
11540
+ required: true,
11541
+ onValidate: null
11542
+ }]
11543
+ }, {
11544
+ name: 'billing-info',
11545
+ groupLabel: '',
11546
+ groupLabelClassName: '',
11547
+ groupClassName: '',
11548
+ fields: [{
11549
+ className: 'half-width',
11550
+ name: 'zip',
11551
+ label: 'Post Code/Zip',
11552
+ type: 'text',
11553
+ required: true,
11554
+ onValidate: null
11555
+ }, {
11556
+ className: 'half-width',
11557
+ name: 'country',
11558
+ label: 'Country',
11559
+ type: 'select',
11560
+ required: true,
11561
+ onValidate: null
11562
+ }]
11563
+ }, {
11564
+ name: 'password-info',
11565
+ groupLabel: /*#__PURE__*/React.createElement("div", {
11566
+ className: "email-info-block"
11567
+ }, /*#__PURE__*/React.createElement("span", null, "Choose a password for your new"), /*#__PURE__*/React.createElement("b", null, " Mana Common "), /*#__PURE__*/React.createElement("span", null, "account")),
11568
+ groupLabelClassName: '',
11569
+ groupClassName: '',
11570
+ fields: [{
11571
+ className: 'half-width',
11572
+ name: 'password',
11573
+ label: 'Password',
11574
+ type: 'password',
11575
+ required: true,
11576
+ onValidate: null
11577
+ }, {
11578
+ className: 'half-width',
11579
+ name: 'confirmPassword',
11580
+ label: 'Confirm Password',
11581
+ type: 'password',
11582
+ required: true,
11583
+ onValidate: null
11584
+ }]
11585
+ }];
11586
+ var formFieldsLoggedIn = [{
11587
+ name: 'basic-info-logged-in',
11588
+ groupLabel: 'To confirm your pre-registration for {event_name} simply click on the confirmation button below.',
11589
+ groupLabelClassName: '',
11590
+ groupClassName: '',
11591
+ fields: [{
11592
+ name: 'email',
11593
+ label: 'Email',
11594
+ type: 'email',
11595
+ required: true,
11596
+ onValidate: null
11597
+ }, {
11598
+ name: 'confirmEmail',
11599
+ label: 'Confirm Email',
11600
+ type: 'email',
11601
+ required: true,
11602
+ onValidate: null
11603
+ }]
11604
+ }, {
11605
+ name: 'billing-info-logged-in',
11606
+ groupLabel: '',
11607
+ groupLabelClassName: '',
11608
+ groupClassName: '',
11609
+ fields: [{
11610
+ name: 'numTickets',
11611
+ label: 'How many tickets do you want to buy?',
11612
+ type: 'select',
11613
+ required: true,
11614
+ options: /*#__PURE__*/new Array(10).fill(null).map(function (_, index) {
11615
+ return {
11616
+ label: index + 1,
11617
+ value: index + 1
11618
+ };
11619
+ }),
11620
+ onValidate: null
11621
+ }, {
11622
+ name: 'holderAge',
11623
+ label: 'Ticket Holder Age',
11624
+ type: 'date',
11625
+ required: true,
11626
+ onValidate: null
11627
+ }, {
11628
+ name: 'brandOptIn',
11629
+ label: 'I would like to be updated on Mana Common news, events and offers.',
11630
+ type: 'checkbox'
11631
+ }]
11632
+ }];
11633
+
11634
+ var getValidateFunctions$2 = function getValidateFunctions(_ref) {
11635
+ var element = _ref.element,
11636
+ values = _ref.values;
11637
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11638
+ var validationFunctions = [];
11639
+ if (element.required) {
11640
+ validationFunctions.push(requiredValidator);
11641
+ }
11642
+ if (element.onValidate) {
11643
+ validationFunctions.push(element.onValidate);
11644
+ }
11645
+ if (element.name === 'confirmEmail') {
11646
+ var isSameEmail = function isSameEmail(confirmEmail) {
11647
+ return values.email !== confirmEmail ? 'Please confirm your email address correctly' : null;
11648
+ };
11649
+ validationFunctions.push(isSameEmail);
11650
+ }
11651
+ if (element.name === 'confirmPassword') {
11652
+ var isSame = function isSame(confirmPassword) {
11653
+ return values.password !== confirmPassword ? 'Password confirmation does not match' : null;
11654
+ };
11655
+ validationFunctions.push(isSame);
11656
+ }
11657
+ return combineValidators.apply(void 0, validationFunctions);
11658
+ };
11659
+ var getFormInitialValues$1 = function getFormInitialValues(fieldsSections) {
11660
+ var initialValues = {};
11661
+ var isWindowDefined = typeof window !== 'undefined';
11662
+ var userData = JSON.parse(isWindowDefined ? window.localStorage.getItem('user_data') || '{}' : '{}');
11663
+ _forEach(fieldsSections, function (item) {
11664
+ _forEach(item.fields, function (fieldItem) {
11665
+ switch (fieldItem.name) {
11666
+ case 'country':
11667
+ case 'numTickets':
11668
+ initialValues[fieldItem.name] = 1;
11669
+ break;
11670
+ case 'brandOptIn':
11671
+ initialValues[fieldItem.name] = true;
11672
+ break;
11673
+ case 'confirmEmail':
11674
+ initialValues[fieldItem.name] = _get(userData, fieldItem.name) || _get(userData, 'email') || '';
11675
+ break;
11676
+ default:
11677
+ initialValues[fieldItem.name] = _get(userData, fieldItem.name) || '';
11678
+ break;
11679
+ }
11680
+ });
11681
+ });
11682
+ return initialValues;
11683
+ };
11684
+ var updateFormFieldsAttributes$1 = function updateFormFieldsAttributes(formFields, attributes) {
11685
+ if (attributes && !_isEmpty(attributes)) {
11686
+ var updatedFormFields = _map(formFields, function (fieldSection) {
11687
+ var fieldSectionAttributes = attributes[fieldSection.name] || {};
11688
+ var updatedFields = _map(fieldSection.fields, function (fieldItem) {
11689
+ var fieldItemAttributes = attributes[fieldItem.name] || {};
11690
+ return _extends({}, fieldItem, fieldItemAttributes);
11691
+ });
11692
+ return _extends({}, fieldSection, fieldSectionAttributes, {
11693
+ fields: updatedFields
11694
+ });
11695
+ });
11696
+ return updatedFormFields;
11697
+ }
11698
+ return formFields;
11699
+ };
11700
+ var shareOptionsAdapter = function shareOptionsAdapter(data, shareUrl) {
11701
+ var adaptedData = [];
11702
+ _forEach(data, function (option) {
11703
+ if (option.action !== 'shared_url') {
11704
+ var _split2 = _split(option.action, '_'),
11705
+ platform = _split2[0],
11706
+ method = _split2[1];
11707
+ var mainLabel = method ? method[0].toUpperCase() + method.substring(1) : 'Share';
11708
+ adaptedData.push({
11709
+ mainLabel: option.action === 'twitter' ? 'Tweet' : mainLabel + ' on',
11710
+ subLabel: option.action === 'twitter' ? ' to your followers' : platform[0].toUpperCase() + platform.substring(1),
11711
+ platform: platform,
11712
+ shareData: {
11713
+ quote: 'as',
11714
+ url: option.socialUrl || shareUrl
11715
+ },
11716
+ points: option.point,
11717
+ eventActionId: option.id,
11718
+ oneTimeAction: option.oneTimeAction,
11719
+ alreadyApplied: option.alreadyApplied
11720
+ });
11721
+ }
11722
+ });
11723
+ return adaptedData;
11724
+ };
11725
+ var getShuffleMethodByName = function getShuffleMethodByName(tokenShuffleMethod) {
11726
+ var reverseString = function reverseString(value) {
11727
+ return value.split('').reverse().join('');
11728
+ };
11729
+ var symmetricShuffleString = function symmetricShuffleString(value) {
11730
+ var lengthOfStr = value.length;
11731
+ var part1 = value.substring(0, lengthOfStr / 2);
11732
+ return value.substring(lengthOfStr / 2) + part1;
11733
+ };
11734
+ var shuffleEveryTwoSymbolsInString = function shuffleEveryTwoSymbolsInString(value) {
11735
+ var words = value.split('');
11736
+ var shuffledStr = '';
11737
+ for (var i = 0; i < words.length; i += 2) {
11738
+ shuffledStr = shuffledStr.concat(words[i + 1], words[i]);
11739
+ }
11740
+ return shuffledStr;
11741
+ };
11742
+ if (tokenShuffleMethod === 'reverse_string') {
11743
+ return reverseString;
11744
+ } else if (tokenShuffleMethod === 'symmetric_shuffle_string') {
11745
+ return symmetricShuffleString;
11746
+ } else if (tokenShuffleMethod === 'shuffle_every_two_symbols_in_string') return shuffleEveryTwoSymbolsInString;
11747
+ return _identity;
11748
+ };
11749
+
11750
+ var isDocumentDefined = typeof document !== 'undefined';
11751
+ var SectionContainer$1 = function SectionContainer(_ref) {
11752
+ var children = _ref.children,
11753
+ className = _ref.className;
11754
+ return React.createElement("div", {
11755
+ className: className
11756
+ }, children);
11757
+ };
11758
+ var insertHTML$1 = function insertHTML(elementId, text) {
11759
+ if (text === void 0) {
11760
+ text = '';
11761
+ }
11762
+ if (isDocumentDefined) {
11763
+ var elem = document && document.getElementById(elementId);
11764
+ if (!(elem != null && elem.childNodes.length)) {
11765
+ elem == null ? void 0 : elem.insertAdjacentHTML('afterbegin', text);
11766
+ }
11767
+ }
11768
+ return null;
11769
+ };
11770
+ var getFieldClassNames$1 = function getFieldClassNames(id, existingClassNames) {
11771
+ if (isDocumentDefined) {
11772
+ var _elem$parentElement;
11773
+ var elem = document && document.getElementById(id);
11774
+ if (((elem == null ? void 0 : (_elem$parentElement = elem.parentElement) == null ? void 0 : _elem$parentElement.clientWidth) || 0) < 375) {
11775
+ return existingClassNames + ' full-width';
11776
+ }
11777
+ }
11778
+ return existingClassNames;
11779
+ };
11780
+ var FieldsSection$1 = function FieldsSection(_ref2) {
11781
+ var _ref2$formFields = _ref2.formFields,
11782
+ formFields = _ref2$formFields === void 0 ? [] : _ref2$formFields,
11783
+ _ref2$countries = _ref2.countries,
11784
+ countries = _ref2$countries === void 0 ? [] : _ref2$countries,
11785
+ values = _ref2.values,
11786
+ setFieldValue = _ref2.setFieldValue,
11787
+ theme = _ref2.theme,
11788
+ _ref2$containerClass = _ref2.containerClass,
11789
+ containerClass = _ref2$containerClass === void 0 ? '' : _ref2$containerClass;
11790
+ return React.createElement(React.Fragment, null, _map(formFields, function (item, index) {
11791
+ var name = item.name,
11792
+ groupLabel = item.groupLabel,
11793
+ _item$groupLabelVars = item.groupLabelVars,
11794
+ groupLabelVars = _item$groupLabelVars === void 0 ? [] : _item$groupLabelVars,
11795
+ groupLabelClassName = item.groupLabelClassName,
11796
+ _item$groupClassName = item.groupClassName,
11797
+ groupClassName = _item$groupClassName === void 0 ? '' : _item$groupClassName,
11798
+ fields = item.fields;
11799
+ return React.createElement(SectionContainer$1, {
11800
+ key: name,
11801
+ className: groupClassName
11802
+ }, React.createElement("span", {
11803
+ id: "group_label_" + index,
11804
+ className: groupLabelClassName
11805
+ }, typeof groupLabel === 'string' ? insertHTML$1("group_label_" + index, replaceVarInString(groupLabel, groupLabelVars)) : groupLabel), React.createElement("div", {
11806
+ className: "fields-container " + groupClassName
11807
+ }, _map(fields, function (fieldData, fieldIndex) {
11808
+ var name = fieldData.name,
11809
+ label = fieldData.label,
11810
+ _fieldData$className = fieldData.className,
11811
+ className = _fieldData$className === void 0 ? 'full-width' : _fieldData$className,
11812
+ type = fieldData.type,
11813
+ component = fieldData.component,
11814
+ _fieldData$options = fieldData.options,
11815
+ options = _fieldData$options === void 0 ? [] : _fieldData$options;
11816
+ var id = name + "-" + fieldIndex;
11817
+ var classNames = containerClass + "-container__field " + className;
11818
+ return component || React.createElement("div", {
11819
+ key: name,
11820
+ id: id,
11821
+ className: getFieldClassNames$1(id, classNames)
11822
+ }, React.createElement(Field, {
11823
+ name: name,
11824
+ label: label,
11825
+ type: type,
11826
+ validate: getValidateFunctions$2({
11827
+ element: fieldData,
11828
+ values: values
11829
+ }),
11830
+ setFieldValue: setFieldValue,
11831
+ component: type === 'checkbox' ? CheckboxField : type === 'select' ? NativeSelectField : type === 'phone' ? PhoneNumberField : type === 'date' ? DatePickerField : CustomField,
11832
+ selectOptions: name === 'country' ? countries : options,
11833
+ theme: theme
11834
+ }));
11835
+ })));
11836
+ }));
11837
+ };
11838
+
11839
+ var X_TF_ECOMMERCE$2 = 'X-TF-ECOMMERCE';
11840
+ var isWindowDefined$1 = typeof window !== 'undefined';
11841
+ var PreRegistration = function PreRegistration(_ref) {
11842
+ var eventId = _ref.eventId,
11843
+ pFormFields = _ref.formFields,
11844
+ additionalFieldAttribute = _ref.additionalFieldAttribute,
11845
+ isPreregistrationStarted = _ref.isPreregistrationStarted,
11846
+ logo = _ref.logo,
11847
+ showForgotPasswordButton = _ref.showForgotPasswordButton,
11848
+ _ref$onLoginSuccess = _ref.onLoginSuccess,
11849
+ onLoginSuccess = _ref$onLoginSuccess === void 0 ? _identity : _ref$onLoginSuccess,
11850
+ _ref$onForgotPassword = _ref.onForgotPasswordSuccess,
11851
+ onForgotPasswordSuccess = _ref$onForgotPassword === void 0 ? _identity : _ref$onForgotPassword,
11852
+ _ref$onForgotPassword2 = _ref.onForgotPasswordError,
11853
+ onForgotPasswordError = _ref$onForgotPassword2 === void 0 ? _identity : _ref$onForgotPassword2,
11854
+ _ref$onGetCountriesSu = _ref.onGetCountriesSuccess,
11855
+ onGetCountriesSuccess = _ref$onGetCountriesSu === void 0 ? _identity : _ref$onGetCountriesSu,
11856
+ _ref$onGetCountriesEr = _ref.onGetCountriesError,
11857
+ onGetCountriesError = _ref$onGetCountriesEr === void 0 ? _identity : _ref$onGetCountriesEr,
11858
+ _ref$onConfirmationSu = _ref.onConfirmationSuccess,
11859
+ onConfirmationSuccess = _ref$onConfirmationSu === void 0 ? _identity : _ref$onConfirmationSu,
11860
+ _ref$onConfirmationEr = _ref.onConfirmationError,
11861
+ onConfirmationError = _ref$onConfirmationEr === void 0 ? _identity : _ref$onConfirmationEr;
11862
+ var _useState = useState(''),
11863
+ error = _useState[0],
11864
+ setError = _useState[1];
11865
+ var _useState2 = useState(false),
11866
+ showModalLogin = _useState2[0],
11867
+ setShowModalLogin = _useState2[1];
11868
+ var _useState3 = useState(false),
11869
+ alreadyHasUser = _useState3[0],
11870
+ setAlreadyHasUser = _useState3[1];
11871
+ var _useState4 = useState(false),
11872
+ showModalForgotPassword = _useState4[0],
11873
+ setShowModalForgotPassword = _useState4[1];
11874
+ var _useState5 = useState([]),
11875
+ countries = _useState5[0],
11876
+ setCountries = _useState5[1];
11877
+ var _useState6 = useState(Boolean(getCookieByName(X_TF_ECOMMERCE$2))),
11878
+ isLoggedIn = _useState6[0],
11879
+ setIsLoggedIn = _useState6[1];
11880
+ var _useState7 = useState({
11881
+ show: false,
11882
+ message: ''
11883
+ }),
11884
+ confirmModalState = _useState7[0],
11885
+ setConfirmModalState = _useState7[1];
11886
+ useCookieListener(X_TF_ECOMMERCE$2, function (value) {
11887
+ return setIsLoggedIn(Boolean(value));
11888
+ });
11889
+ var formFields = updateFormFieldsAttributes$1(pFormFields || isLoggedIn ? formFieldsLoggedIn : formFieldsNotLoggedIn, additionalFieldAttribute);
11890
+ useEffect(function () {
11891
+ // fetch countries data
11892
+ var fetchCountries = /*#__PURE__*/function () {
11893
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11894
+ var res, _e$response, _e$response$data, _error;
11895
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11896
+ while (1) switch (_context.prev = _context.next) {
11897
+ case 0:
11898
+ _context.prev = 0;
11899
+ _context.next = 3;
11900
+ return getCountries();
11901
+ case 3:
11902
+ res = _context.sent;
11903
+ setCountries(_map(_get(res, 'data'), function (item) {
11904
+ return {
11905
+ label: item.name,
11906
+ value: Number(item.id)
11907
+ };
11908
+ }));
11909
+ onGetCountriesSuccess(res.data);
11910
+ _context.next = 11;
11911
+ break;
11912
+ case 8:
11913
+ _context.prev = 8;
11914
+ _context.t0 = _context["catch"](0);
11915
+ if (axios.isAxiosError(_context.t0)) {
11916
+ _error = (_context.t0 == null ? void 0 : (_e$response = _context.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message) || 'Error';
11917
+ setError(_error);
11918
+ onGetCountriesError(_context.t0);
11919
+ }
11920
+ case 11:
11921
+ case "end":
11922
+ return _context.stop();
11923
+ }
11924
+ }, _callee, null, [[0, 8]]);
11925
+ }));
11926
+ return function fetchCountries() {
11927
+ return _ref2.apply(this, arguments);
11928
+ };
11929
+ }();
11930
+ fetchCountries();
11931
+ }, []);
11932
+ var hash = getQueryVariable('hash') || '';
11933
+ var referrerId = getQueryVariable('referrer_id') || '';
11934
+ return React.createElement("div", {
11935
+ className: "pre-registration-container"
11936
+ }, React.createElement(SnackbarAlert, {
11937
+ type: "error",
11938
+ isOpen: !!error,
11939
+ message: error || '',
11940
+ onClose: function onClose() {
11941
+ setError('');
11942
+ }
11943
+ }), confirmModalState.show && React.createElement(ConfirmModal, {
11944
+ hideCancelBtn: true,
11945
+ onConfirm: function onConfirm() {
11946
+ return setConfirmModalState({
11947
+ show: false,
11948
+ message: ''
11949
+ });
11950
+ },
11951
+ message: confirmModalState.message
11952
+ }), !isLoggedIn && React.createElement("div", {
11953
+ className: "account-actions-block"
11954
+ }, React.createElement("div", {
11955
+ className: "action-item"
11956
+ }, React.createElement("div", null, React.createElement("span", null, "Create (or log in to) your account, then click on Confirm Registration."), React.createElement("span", null, " If you have a"), React.createElement("b", null, " Mana Common "), React.createElement("span", null, "account and password already"))), React.createElement("div", {
11957
+ className: "action-item login-block"
11958
+ }, React.createElement("button", {
11959
+ className: "login-register-button",
11960
+ type: "button",
11961
+ onClick: function onClick() {
11962
+ setShowModalLogin(true);
11963
+ }
11964
+ }, "Login"))), showModalLogin && React.createElement(LoginModal, {
11965
+ logo: logo,
11966
+ onClose: function onClose() {
11967
+ setShowModalLogin(false);
11968
+ },
11969
+ onLogin: function onLogin(res) {
11970
+ setShowModalLogin(false);
11971
+ onLoginSuccess(res);
11972
+ },
11973
+ showForgotPasswordButton: showForgotPasswordButton,
11974
+ onForgotPassword: function onForgotPassword() {
11975
+ setShowModalLogin(false);
11976
+ setShowModalForgotPassword(true);
11977
+ },
11978
+ alreadyHasUser: alreadyHasUser
11979
+ }), showModalForgotPassword && React.createElement(ForgotPasswordModal, {
11980
+ onClose: function onClose() {
11981
+ setShowModalForgotPassword(false);
11982
+ },
11983
+ onLoginButtonClick: function onLoginButtonClick() {
11984
+ setShowModalForgotPassword(false);
11985
+ setShowModalLogin(true);
11986
+ },
11987
+ onForgotPasswordSuccess: onForgotPasswordSuccess,
11988
+ onForgotPasswordError: onForgotPasswordError
11989
+ }), React.createElement("h2", null, "Pre-Registration"), React.createElement(Formik, {
11990
+ initialValues: getFormInitialValues$1(formFields),
11991
+ enableReinitialize: true,
11992
+ onSubmit: function () {
11993
+ var _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
11994
+ var updatedValues, holderAgeDate, confirmationData, bodyFormData, res, profileRes, _e$response2, _e$response2$data, _e$response2$data$mes, _e$response3, _e$response3$data, errorMessage, emailErrors, _e$response4, _e$response4$data;
11995
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11996
+ while (1) switch (_context2.prev = _context2.next) {
11997
+ case 0:
11998
+ _context2.prev = 0;
11999
+ if (!isLoggedIn) {
12000
+ _context2.next = 21;
12001
+ break;
12002
+ }
12003
+ if (!isPreregistrationStarted) {
12004
+ _context2.next = 18;
12005
+ break;
12006
+ }
12007
+ updatedValues = _extends({}, values);
12008
+ holderAgeDate = new Date(values.holderAge);
12009
+ updatedValues.dobDay = holderAgeDate.getDate();
12010
+ updatedValues.dobMonth = holderAgeDate.getMonth() + 1;
12011
+ updatedValues.dobYear = holderAgeDate.getFullYear();
12012
+ updatedValues.referrerId = referrerId;
12013
+ updatedValues.shareHash = hash;
12014
+ // remove date picker string value
12015
+ delete updatedValues.holderAge;
12016
+ _context2.next = 13;
12017
+ return confirmPreRegistration(eventId, updatedValues);
12018
+ case 13:
12019
+ confirmationData = _context2.sent;
12020
+ if (isWindowDefined$1) {
12021
+ window.localStorage.setItem('pre-registration-hash', _get(confirmationData, 'attributes.hash'));
12022
+ }
12023
+ onConfirmationSuccess(confirmationData);
12024
+ _context2.next = 19;
12025
+ break;
12026
+ case 18:
12027
+ setConfirmModalState({
12028
+ show: true,
12029
+ message: 'The preregistration has not started'
12030
+ });
12031
+ case 19:
12032
+ _context2.next = 41;
12033
+ break;
12034
+ case 21:
12035
+ bodyFormData = new FormData();
12036
+ bodyFormData.append('first_name', values.firstName);
12037
+ bodyFormData.append('last_name', values.lastName);
12038
+ bodyFormData.append('email', values.email);
12039
+ bodyFormData.append('confirm_email', values.confirmEmail);
12040
+ bodyFormData.append('zip', values.zip);
12041
+ bodyFormData.append('country', values.country);
12042
+ bodyFormData.append('password', values.password);
12043
+ bodyFormData.append('password_confirmation', values.confirmPassword);
12044
+ bodyFormData.append('client_id', CONFIGS.CLIENT_ID);
12045
+ bodyFormData.append('client_secret', CONFIGS.CLIENT_SECRET);
12046
+ bodyFormData.append('register_for', 'prereg');
12047
+ _context2.next = 35;
12048
+ return register(bodyFormData);
12049
+ case 35:
12050
+ res = _context2.sent;
12051
+ _context2.next = 38;
12052
+ return getProfileData();
12053
+ case 38:
12054
+ profileRes = _context2.sent;
12055
+ onLoginSuccess(res.data);
12056
+ if (isWindowDefined$1) {
12057
+ window.localStorage.setItem('user_data', JSON.stringify(_get(profileRes, 'data')));
12058
+ }
12059
+ case 41:
12060
+ _context2.next = 50;
12061
+ break;
12062
+ case 43:
12063
+ _context2.prev = 43;
12064
+ _context2.t0 = _context2["catch"](0);
12065
+ errorMessage = (_context2.t0 == null ? void 0 : _context2.t0.message) || 'Error';
12066
+ emailErrors = _context2.t0 == null ? void 0 : (_e$response2 = _context2.t0.response) == null ? void 0 : (_e$response2$data = _e$response2.data) == null ? void 0 : (_e$response2$data$mes = _e$response2$data.message) == null ? void 0 : _e$response2$data$mes.email;
12067
+ if (typeof (_context2.t0 == null ? void 0 : (_e$response3 = _context2.t0.response) == null ? void 0 : (_e$response3$data = _e$response3.data) == null ? void 0 : _e$response3$data.message) === 'string') {
12068
+ errorMessage = _context2.t0 == null ? void 0 : (_e$response4 = _context2.t0.response) == null ? void 0 : (_e$response4$data = _e$response4.data) == null ? void 0 : _e$response4$data.message;
12069
+ }
12070
+ if ((emailErrors == null ? void 0 : emailErrors.length) > 0) {
12071
+ if (emailErrors[0] === 'The email is already used') {
12072
+ setShowModalLogin(true);
12073
+ setAlreadyHasUser(true);
12074
+ }
12075
+ } else {
12076
+ setError(errorMessage);
12077
+ }
12078
+ onConfirmationError(_context2.t0);
12079
+ case 50:
12080
+ case "end":
12081
+ return _context2.stop();
12082
+ }
12083
+ }, _callee2, null, [[0, 43]]);
12084
+ }));
12085
+ function onSubmit(_x) {
12086
+ return _onSubmit.apply(this, arguments);
12087
+ }
12088
+ return onSubmit;
12089
+ }()
12090
+ }, function (props) {
12091
+ return React.createElement(Form, null, React.createElement("div", {
12092
+ className: "login-modal-body"
12093
+ }, React.createElement(FieldsSection$1, {
12094
+ formFields: formFields,
12095
+ values: props.values,
12096
+ setFieldValue: props.setFieldValue,
12097
+ containerClass: "pre-registration",
12098
+ countries: countries
12099
+ })), React.createElement("div", {
12100
+ className: "button-container"
12101
+ }, React.createElement(Button$2, {
12102
+ type: "submit",
12103
+ variant: "contained",
12104
+ className: "login-register-button",
12105
+ disabled: props.isSubmitting
12106
+ }, props.isSubmitting ? React.createElement(CircularProgress, {
12107
+ size: 26
12108
+ }) : isLoggedIn ? 'Confirm Pre-Registration' : 'Create Account')));
12109
+ }));
12110
+ };
12111
+
12112
+ var Prewards = function Prewards(props) {
12113
+ var data = props.data,
12114
+ _props$classNamePrefi = props.classNamePrefix,
12115
+ classNamePrefix = _props$classNamePrefi === void 0 ? '' : _props$classNamePrefi,
12116
+ _props$headerNode = props.headerNode,
12117
+ headerNode = _props$headerNode === void 0 ? React.createElement(React.Fragment, null, "PRE", React.createElement("span", null, "WARDS\u2122")) : _props$headerNode;
12118
+ return React.createElement("div", {
12119
+ className: classNamePrefix + "_prewards"
12120
+ }, !_isEmpty(data) && React.createElement("div", {
12121
+ className: classNamePrefix + "_prewards_heder"
12122
+ }, headerNode), React.createElement("div", {
12123
+ className: classNamePrefix + "_prizes"
12124
+ }, _map(data, function (prize) {
12125
+ var description = prize.description,
12126
+ name = prize.name,
12127
+ image = prize.image,
12128
+ id = prize.id;
12129
+ return React.createElement("div", {
12130
+ className: classNamePrefix + "_prize",
12131
+ key: id
12132
+ }, image && React.createElement("img", {
12133
+ className: classNamePrefix + "_image",
12134
+ alt: "",
12135
+ src: image
12136
+ }), React.createElement("div", {
12137
+ className: classNamePrefix + "_info"
12138
+ }, React.createElement("h4", {
12139
+ className: classNamePrefix + "_name"
12140
+ }, name), description && React.createElement("article", {
12141
+ className: classNamePrefix + "_description"
12142
+ }, description)));
12143
+ })));
12144
+ };
12145
+
12146
+ var CopyField = function CopyField(props) {
12147
+ var copyValue = props.copyValue,
12148
+ _props$copyIconSrc = props.copyIconSrc,
12149
+ copyIconSrc = _props$copyIconSrc === void 0 ? 'https://img.icons8.com/office/50/000000/copy.png' : _props$copyIconSrc,
12150
+ _props$copyTitle = props.copyTitle,
12151
+ copyTitle = _props$copyTitle === void 0 ? 'Copy' : _props$copyTitle,
12152
+ _props$hasCopyIcon = props.hasCopyIcon,
12153
+ hasCopyIcon = _props$hasCopyIcon === void 0 ? false : _props$hasCopyIcon,
12154
+ _props$onLinkCopied = props.onLinkCopied,
12155
+ onLinkCopied = _props$onLinkCopied === void 0 ? _identity : _props$onLinkCopied,
12156
+ _props$classNamePrefi = props.classNamePrefix,
12157
+ classNamePrefix = _props$classNamePrefi === void 0 ? '' : _props$classNamePrefi,
12158
+ _props$messageText = props.messageText,
12159
+ messageText = _props$messageText === void 0 ? '' : _props$messageText;
12160
+ var inputRef = useRef(null);
12161
+ return React.createElement(React.Fragment, null, messageText && React.createElement("span", {
12162
+ className: "message-text"
12163
+ }, messageText), React.createElement("input", {
12164
+ ref: inputRef,
12165
+ className: classNamePrefix + "_share-input",
12166
+ defaultValue: copyValue,
12167
+ readOnly: true
12168
+ }), React.createElement("div", {
12169
+ className: classNamePrefix + "_share-by-link-copy-icon",
12170
+ "aria-hidden": true,
12171
+ onClick: function onClick() {
12172
+ navigator.clipboard.writeText(_get(inputRef, 'current.value'));
12173
+ onLinkCopied();
12174
+ }
12175
+ }, hasCopyIcon ? React.createElement("img", {
12176
+ src: copyIconSrc,
12177
+ alt: "copy"
12178
+ }) : React.createElement("span", {
12179
+ className: classNamePrefix + "_copy-icon"
12180
+ }, copyTitle)));
12181
+ };
12182
+
12183
+ var ShareOptions = function ShareOptions(props) {
12184
+ var classNamePrefix = props.classNamePrefix,
12185
+ data = props.data,
12186
+ _props$hasCopyIcon = props.hasCopyIcon,
12187
+ hasCopyIcon = _props$hasCopyIcon === void 0 ? true : _props$hasCopyIcon,
12188
+ _props$onLinkCopied = props.onLinkCopied,
12189
+ onLinkCopied = _props$onLinkCopied === void 0 ? _identity : _props$onLinkCopied,
12190
+ _props$headerText = props.headerText,
12191
+ headerText = _props$headerText === void 0 ? 'Share with your friends here ...' : _props$headerText,
12192
+ hash = props.hash,
12193
+ updateShareActionData = props.updateShareActionData,
12194
+ shareActionData = props.shareActionData;
12195
+ var _data$attributes = data.attributes,
12196
+ actions = _data$attributes.actions,
12197
+ shareUrl = _data$attributes.shareUrl;
12198
+ var shareButtons = shareOptionsAdapter(actions, shareUrl);
12199
+ var isShareLinkEnabled = _some(actions, function (item) {
12200
+ return item.action === 'shared_url';
12201
+ });
12202
+ var _onAfterShare = /*#__PURE__*/function () {
12203
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(eventActionId) {
12204
+ var shareActionToken, tokenShuffleMethod, accessToken;
12205
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12206
+ while (1) switch (_context.prev = _context.next) {
12207
+ case 0:
12208
+ shareActionToken = shareActionData.shareActionToken, tokenShuffleMethod = shareActionData.tokenShuffleMethod;
12209
+ accessToken = getShuffleMethodByName(tokenShuffleMethod)(shareActionToken);
12210
+ if (!(typeof eventActionId === 'string')) {
12211
+ _context.next = 6;
12212
+ break;
12213
+ }
12214
+ _context.next = 5;
12215
+ return submitShareAction({
12216
+ eventActionId: eventActionId,
12217
+ accessToken: accessToken,
12218
+ hash: hash
12219
+ });
12220
+ case 5:
12221
+ updateShareActionData();
12222
+ case 6:
12223
+ case "end":
12224
+ return _context.stop();
12225
+ }
12226
+ }, _callee);
12227
+ }));
12228
+ return function onAfterShare(_x) {
12229
+ return _ref.apply(this, arguments);
12230
+ };
12231
+ }();
12232
+ return React.createElement("div", {
12233
+ className: classNamePrefix + "_share_options"
12234
+ }, !_isEmpty(actions) && React.createElement(React.Fragment, null, React.createElement("div", {
12235
+ className: classNamePrefix + "_share_header"
12236
+ }, headerText), React.createElement(SocialButtons, {
12237
+ shareLink: data.attributes.shareUrl,
12238
+ name: "",
12239
+ appId: "",
12240
+ showDefaultShareButtons: false,
12241
+ shareButtons: shareButtons,
12242
+ titleText: "",
12243
+ footerText: "",
12244
+ onAfterShare: function onAfterShare(eventActionId) {
12245
+ return _onAfterShare(eventActionId);
12246
+ }
12247
+ }), isShareLinkEnabled && React.createElement("div", {
12248
+ className: classNamePrefix + "_share_btn_inner"
12249
+ }, React.createElement(CopyField, {
12250
+ copyValue: shareUrl,
12251
+ onLinkCopied: onLinkCopied,
12252
+ hasCopyIcon: hasCopyIcon,
12253
+ classNamePrefix: classNamePrefix,
12254
+ messageText: "Share your link"
12255
+ }))));
12256
+ };
12257
+
12258
+ var isWindowDefined$2 = typeof window !== 'undefined';
12259
+ var PreRegistrationComplete = function PreRegistrationComplete(_ref) {
12260
+ var pEventId = _ref.eventId,
12261
+ _ref$classNamePrefix = _ref.classNamePrefix,
12262
+ classNamePrefix = _ref$classNamePrefix === void 0 ? '' : _ref$classNamePrefix,
12263
+ _ref$onLinkCopied = _ref.onLinkCopied,
12264
+ _onLinkCopied = _ref$onLinkCopied === void 0 ? _identity : _ref$onLinkCopied,
12265
+ _ref$hasCopyIcon = _ref.hasCopyIcon,
12266
+ hasCopyIcon = _ref$hasCopyIcon === void 0 ? false : _ref$hasCopyIcon,
12267
+ _ref$pageHeader = _ref.pageHeader,
12268
+ pageHeader = _ref$pageHeader === void 0 ? 'Pre-Registration Confirmation' : _ref$pageHeader,
12269
+ _ref$onGetConfirmatio = _ref.onGetConfirmationDataError,
12270
+ onGetConfirmationDataError = _ref$onGetConfirmatio === void 0 ? _identity : _ref$onGetConfirmatio,
12271
+ _ref$onGetConfirmatio2 = _ref.onGetConfirmationDataSuccess,
12272
+ onGetConfirmationDataSuccess = _ref$onGetConfirmatio2 === void 0 ? _identity : _ref$onGetConfirmatio2,
12273
+ _ref$pageMessage = _ref.pageMessage,
12274
+ pageMessage = _ref$pageMessage === void 0 ? 'Pre registration was successful!' : _ref$pageMessage,
12275
+ _ref$onLoginSuccess = _ref.onLoginSuccess,
12276
+ onLoginSuccess = _ref$onLoginSuccess === void 0 ? _identity : _ref$onLoginSuccess,
12277
+ logo = _ref.logo;
12278
+ var localStorageHash = isWindowDefined$2 ? localStorage.getItem('pre-registration-hash') : '';
12279
+ var queryHash = getQueryVariable('hash') || '';
12280
+ queryHash && isWindowDefined$2 && window.localStorage.setItem('pre-registration-hash', queryHash);
12281
+ var hash = queryHash || localStorageHash;
12282
+ var _useState = useState(Boolean(getCookieByName(X_TF_ECOMMERCE))),
12283
+ isLoggedIn = _useState[0],
12284
+ setIsLoggedIn = _useState[1];
12285
+ var _useState2 = useState(!isLoggedIn),
12286
+ showModalLogin = _useState2[0],
12287
+ setShowModalLogin = _useState2[1];
12288
+ var _useState3 = useState(false),
12289
+ showCopyModal = _useState3[0],
12290
+ setShowCopyModal = _useState3[1];
12291
+ var _useState4 = useState([]),
12292
+ prizes = _useState4[0],
12293
+ setPrizes = _useState4[1];
12294
+ var _useState5 = useState({}),
12295
+ shareOptions = _useState5[0],
12296
+ setShareOptions = _useState5[1];
12297
+ var _useState6 = useState({}),
12298
+ shareActionData = _useState6[0],
12299
+ setShareActionData = _useState6[1];
12300
+ var _useState7 = useState({}),
12301
+ error = _useState7[0],
12302
+ setError = _useState7[1];
12303
+ useCookieListener(X_TF_ECOMMERCE, function (value) {
12304
+ return setIsLoggedIn(Boolean(value));
12305
+ });
12306
+ useEffect(function () {
12307
+ var fetchConfirmationData = /*#__PURE__*/function () {
12308
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
12309
+ var shareOptionsData, attributes, eventId, influencersData, _error$response;
12310
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12311
+ while (1) switch (_context.prev = _context.next) {
12312
+ case 0:
12313
+ _context.prev = 0;
12314
+ if (!(hash && isLoggedIn)) {
12315
+ _context.next = 15;
12316
+ break;
12317
+ }
12318
+ _context.next = 4;
12319
+ return getPreRegistrationShareOptions({
12320
+ hash: hash
12321
+ });
12322
+ case 4:
12323
+ shareOptionsData = _context.sent;
12324
+ attributes = shareOptionsData.data.attributes;
12325
+ setShareOptions(shareOptionsData.data);
12326
+ setShareActionData({
12327
+ shareActionToken: attributes.shareActionToken,
12328
+ tokenShuffleMethod: attributes.tokenShuffleMethod
12329
+ });
12330
+ eventId = _get(shareOptionsData, 'data.attributes.eventId');
12331
+ if (!(eventId || pEventId)) {
12332
+ _context.next = 14;
12333
+ break;
12334
+ }
12335
+ _context.next = 12;
12336
+ return getPreRegistrationInfluancers({
12337
+ eventId: eventId || pEventId
12338
+ });
12339
+ case 12:
12340
+ influencersData = _context.sent;
12341
+ setPrizes(influencersData.data.attributes.prizes);
12342
+ case 14:
12343
+ onGetConfirmationDataSuccess();
12344
+ case 15:
12345
+ _context.next = 20;
12346
+ break;
12347
+ case 17:
12348
+ _context.prev = 17;
12349
+ _context.t0 = _context["catch"](0);
12350
+ if (axios.isAxiosError(_context.t0)) {
12351
+ setError((_error$response = _context.t0.response) == null ? void 0 : _error$response.data);
12352
+ }
12353
+ case 20:
12354
+ case "end":
12355
+ return _context.stop();
12356
+ }
12357
+ }, _callee, null, [[0, 17]]);
12358
+ }));
12359
+ return function fetchConfirmationData() {
12360
+ return _ref2.apply(this, arguments);
12361
+ };
12362
+ }();
12363
+ fetchConfirmationData();
12364
+ }, [pEventId, hash, onGetConfirmationDataError, onGetConfirmationDataSuccess, isLoggedIn]);
12365
+ var onClose = function onClose() {
12366
+ setShowCopyModal(false);
12367
+ };
12368
+ var updateShareActionData = /*#__PURE__*/function () {
12369
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
12370
+ var shareOptionsData;
12371
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
12372
+ while (1) switch (_context2.prev = _context2.next) {
12373
+ case 0:
12374
+ if (!hash) {
12375
+ _context2.next = 6;
12376
+ break;
12377
+ }
12378
+ _context2.next = 3;
12379
+ return getPreRegistrationShareOptions({
12380
+ hash: hash
12381
+ });
12382
+ case 3:
12383
+ shareOptionsData = _context2.sent;
12384
+ setShareOptions(shareOptionsData.data);
12385
+ setShareActionData({
12386
+ shareActionToken: shareOptionsData.data.attributes.shareActionToken,
12387
+ tokenShuffleMethod: shareOptionsData.data.attributes.tokenShuffleMethod
12388
+ });
12389
+ case 6:
12390
+ case "end":
12391
+ return _context2.stop();
12392
+ }
12393
+ }, _callee2);
12394
+ }));
12395
+ return function updateShareActionData() {
12396
+ return _ref3.apply(this, arguments);
12397
+ };
12398
+ }();
12399
+ return React.createElement(React.Fragment, null, isLoggedIn && _isEmpty(error) ? React.createElement("div", {
12400
+ className: classNamePrefix + "_pre_registration_complete_container"
12401
+ }, React.createElement(CopyMessageModal, {
12402
+ showCopyModal: showCopyModal,
12403
+ onClose: onClose
12404
+ }), React.createElement("p", {
12405
+ className: classNamePrefix + "_pre_registration_complete_header"
12406
+ }, pageHeader), React.createElement("div", {
12407
+ className: classNamePrefix + "_pre_registration_complete_message"
12408
+ }, pageMessage), React.createElement("div", {
12409
+ className: classNamePrefix + "_pre_registration_complete_body"
12410
+ }, !_isEmpty(prizes) && React.createElement(Prewards, {
12411
+ classNamePrefix: classNamePrefix,
12412
+ data: prizes
12413
+ }), !_isEmpty(shareOptions) && React.createElement(ShareOptions, {
12414
+ classNamePrefix: classNamePrefix,
12415
+ data: shareOptions,
12416
+ onLinkCopied: function onLinkCopied() {
12417
+ setShowCopyModal(true);
12418
+ _onLinkCopied();
12419
+ },
12420
+ shareActionData: shareActionData,
12421
+ updateShareActionData: updateShareActionData,
12422
+ hasCopyIcon: hasCopyIcon,
12423
+ hash: hash
12424
+ }))) : showModalLogin && React.createElement(LoginModal, {
12425
+ logo: logo,
12426
+ onClose: function onClose() {
12427
+ setShowModalLogin(false);
12428
+ },
12429
+ onLogin: function onLogin(res) {
12430
+ setShowModalLogin(false);
12431
+ onLoginSuccess(res);
12432
+ }
12433
+ }), !_isEmpty(error) && React.createElement(ConfirmModal, {
12434
+ hideCancelBtn: true,
12435
+ message: error.message,
12436
+ onConfirm: function onConfirm() {
12437
+ return onGetConfirmationDataError(error);
12438
+ }
12439
+ }));
12440
+ };
12441
+
12442
+ var Influancers = function Influancers(props) {
12443
+ var data = props.data,
12444
+ classNamePrefix = props.classNamePrefix,
12445
+ _props$headerNode = props.headerNode,
12446
+ headerNode = _props$headerNode === void 0 ? React.createElement(React.Fragment, null, "TOP", React.createElement("span", null, "\xA0INFLUANCERS")) : _props$headerNode;
12447
+ return React.createElement("div", {
12448
+ className: classNamePrefix + "_influencers_container"
12449
+ }, !_isEmpty(data) && React.createElement("div", {
12450
+ className: classNamePrefix + "_influencers_header"
12451
+ }, headerNode), React.createElement("div", {
12452
+ className: classNamePrefix + "_influencers"
12453
+ }, _map(data, function (influencer, index) {
12454
+ return React.createElement("div", {
12455
+ key: influencer.prereg_id,
12456
+ className: classNamePrefix + "_influencer"
12457
+ }, React.createElement("span", {
12458
+ className: classNamePrefix + "_influencer_index"
12459
+ }, index + 1), React.createElement("span", {
12460
+ className: classNamePrefix + "_influencer_title"
12461
+ }, "INFLUENCER"), React.createElement("span", {
12462
+ className: classNamePrefix + "_influencer_name"
12463
+ }, influencer.name));
12464
+ })));
12465
+ };
12466
+
12467
+ var PreRegistrationInformations = function PreRegistrationInformations(props) {
12468
+ var classNamePrefix = props.classNamePrefix,
12469
+ eventId = props.eventId,
12470
+ _props$onGetPreregist = props.onGetPreregistrationDataSuccess,
12471
+ onGetPreregistrationDataSuccess = _props$onGetPreregist === void 0 ? _identity : _props$onGetPreregist,
12472
+ _props$onGetPreregist2 = props.onGetPreregistrationDataError,
12473
+ onGetPreregistrationDataError = _props$onGetPreregist2 === void 0 ? _identity : _props$onGetPreregist2,
12474
+ influancersHeaderNode = props.influancersHeaderNode,
12475
+ prewardsHeaderNode = props.prewardsHeaderNode;
12476
+ var _useState = useState([]),
12477
+ prizes = _useState[0],
12478
+ setPrizes = _useState[1];
12479
+ var _useState2 = useState([]),
12480
+ influencers = _useState2[0],
12481
+ setInfluencers = _useState2[1];
12482
+ var topInfluancers = _slice(influencers, 0, 10);
12483
+ useEffect(function () {
12484
+ var fetchPreregistrationData = /*#__PURE__*/function () {
12485
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
12486
+ var preregistrationData;
12487
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12488
+ while (1) switch (_context.prev = _context.next) {
12489
+ case 0:
12490
+ _context.prev = 0;
12491
+ _context.next = 3;
12492
+ return getPreRegistrationInfluancers({
12493
+ eventId: eventId
12494
+ });
12495
+ case 3:
12496
+ preregistrationData = _context.sent;
12497
+ setPrizes(preregistrationData.data.attributes.prizes);
12498
+ setInfluencers(preregistrationData.data.attributes.influencers);
12499
+ onGetPreregistrationDataSuccess();
12500
+ _context.next = 12;
12501
+ break;
12502
+ case 9:
12503
+ _context.prev = 9;
12504
+ _context.t0 = _context["catch"](0);
12505
+ if (_context.t0) {
12506
+ onGetPreregistrationDataError();
12507
+ }
12508
+ case 12:
12509
+ case "end":
12510
+ return _context.stop();
12511
+ }
12512
+ }, _callee, null, [[0, 9]]);
12513
+ }));
12514
+ return function fetchPreregistrationData() {
12515
+ return _ref.apply(this, arguments);
12516
+ };
12517
+ }();
12518
+ fetchPreregistrationData();
12519
+ }, [eventId, onGetPreregistrationDataError, onGetPreregistrationDataSuccess]);
12520
+ return React.createElement("div", {
12521
+ className: classNamePrefix + "_pre_registration_info_container"
12522
+ }, React.createElement(Prewards, {
12523
+ headerNode: prewardsHeaderNode,
12524
+ data: prizes,
12525
+ classNamePrefix: classNamePrefix
12526
+ }), React.createElement(Influancers, {
12527
+ headerNode: influancersHeaderNode,
12528
+ data: topInfluancers,
12529
+ classNamePrefix: classNamePrefix
12530
+ }));
12531
+ };
12532
+
12533
+ export { AddonsContainter, BillingInfoContainer, ConfirmationContainer, DelegationsContainer, ForgotPasswordModal, IDVerification, LoginModal, MyTicketsContainer, OrderDetailsContainer, PaymentContainer, PoweredBy, PreRegistration, PreRegistrationComplete, PreRegistrationInformations, RedirectModal, ResetPasswordContainer, RsvpContainer, SeatMapContainer, TicketResaleContainer, TicketsContainer, VERIFICATION_STATUSES, createFixedFloatNormalizer, currencyNormalizerCreator, setConfigs, useCookieListener };
11181
12534
  //# sourceMappingURL=tf-checkout-react.esm.js.map