tf-checkout-react 1.0.46 → 1.0.50

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 (31) hide show
  1. package/dist/api/index.d.ts +1 -0
  2. package/dist/components/billing-info-container/index.d.ts +1 -1
  3. package/dist/components/common/CheckboxField.d.ts +2 -2
  4. package/dist/components/common/CustomField.d.ts +2 -1
  5. package/dist/components/paymentContainer/index.d.ts +1 -1
  6. package/dist/components/stripePayment/index.d.ts +2 -1
  7. package/dist/components/ticketsContainer/index.d.ts +1 -0
  8. package/dist/tf-checkout-react.cjs.development.css +2 -2
  9. package/dist/tf-checkout-react.cjs.development.js +268 -181
  10. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  11. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  12. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  13. package/dist/tf-checkout-react.esm.js +270 -183
  14. package/dist/tf-checkout-react.esm.js.map +1 -1
  15. package/dist/types/billing-info-data.d.ts +2 -2
  16. package/dist/utils/getQueryVariable.d.ts +1 -0
  17. package/package.json +2 -1
  18. package/src/api/index.ts +2 -0
  19. package/src/components/billing-info-container/index.tsx +128 -131
  20. package/src/components/common/CheckboxField.tsx +7 -2
  21. package/src/components/common/CustomField.tsx +17 -7
  22. package/src/components/paymentContainer/index.tsx +31 -3
  23. package/src/components/paymentContainer/style.css +8 -0
  24. package/src/components/stripePayment/index.tsx +48 -19
  25. package/src/components/stripePayment/style.css +6 -0
  26. package/src/components/ticketsContainer/index.tsx +2 -0
  27. package/src/components/waitingList/index.tsx +34 -24
  28. package/src/types/billing-info-data.ts +2 -2
  29. package/src/utils/getQueryVariable.ts +13 -0
  30. package/src/.DS_Store +0 -0
  31. package/src/components/.DS_Store +0 -0
@@ -23,6 +23,7 @@ var styles = require('@mui/styles');
23
23
  var FormGroup = _interopDefault(require('@mui/material/FormGroup'));
24
24
  var FormControlLabel = _interopDefault(require('@mui/material/FormControlLabel'));
25
25
  var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
26
+ var nanoid = require('nanoid');
26
27
  var Container = _interopDefault(require('@mui/material/Container'));
27
28
  var Alert = _interopDefault(require('@mui/material/Alert'));
28
29
  var reactStripeJs = require('@stripe/react-stripe-js');
@@ -1074,6 +1075,9 @@ var getStates = function getStates(countryId) {
1074
1075
  var addToWaitingList = function addToWaitingList(id, data) {
1075
1076
  return publicRequest.post("/v1/event/" + id + "/add_to_waiting_list", data);
1076
1077
  };
1078
+ var getConditions = function getConditions(eventId) {
1079
+ return publicRequest.get("v1/event/" + eventId + "/conditions");
1080
+ };
1077
1081
 
1078
1082
  var style = {
1079
1083
  position: 'absolute',
@@ -1609,8 +1613,8 @@ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, va
1609
1613
 
1610
1614
  var useStyles = /*#__PURE__*/styles.makeStyles({
1611
1615
  input: {
1612
- "&::placeholder": {
1613
- color: "gray"
1616
+ '&::placeholder': {
1617
+ color: 'gray'
1614
1618
  }
1615
1619
  }
1616
1620
  });
@@ -1623,7 +1627,8 @@ var CustomField = function CustomField(_ref) {
1623
1627
  selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
1624
1628
  _ref$form = _ref.form,
1625
1629
  touched = _ref$form.touched,
1626
- errors = _ref$form.errors;
1630
+ errors = _ref$form.errors,
1631
+ theme = _ref.theme;
1627
1632
  var isSelectField = type === 'select';
1628
1633
  var isShrink = Boolean(field.value) || type === 'date' || type === 'select';
1629
1634
  var isTouched = Boolean(_get(touched, field.name));
@@ -1648,7 +1653,11 @@ var CustomField = function CustomField(_ref) {
1648
1653
  }
1649
1654
  },
1650
1655
  SelectProps: {
1651
- "native": true
1656
+ "native": true,
1657
+ className: theme,
1658
+ MenuProps: {
1659
+ className: theme
1660
+ }
1652
1661
  }
1653
1662
  }, field), isSelectField ? _map(selectOptions, function (option) {
1654
1663
  return React__default.createElement("option", {
@@ -1659,7 +1668,7 @@ var CustomField = function CustomField(_ref) {
1659
1668
  }) : null);
1660
1669
  };
1661
1670
 
1662
- var _excluded$1 = ["label", "field"];
1671
+ var _excluded$1 = ["label", "field", "selectOptions", "theme"];
1663
1672
  var CheckboxField = function CheckboxField(_ref) {
1664
1673
  var label = _ref.label,
1665
1674
  field = _ref.field,
@@ -1781,55 +1790,50 @@ var LogicRunner = function LogicRunner(_ref) {
1781
1790
  return null;
1782
1791
  };
1783
1792
 
1784
- var SectionContainer = function SectionContainer(_ref3) {
1785
- var children = _ref3.children;
1786
- return React__default.createElement(React__default.Fragment, null, children);
1787
- };
1788
-
1789
- var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1790
- var _ref4$data = _ref4.data,
1791
- data = _ref4$data === void 0 ? [] : _ref4$data,
1792
- _ref4$ticketHoldersFi = _ref4.ticketHoldersFields,
1793
- ticketHoldersFields = _ref4$ticketHoldersFi === void 0 ? {
1793
+ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
1794
+ var _ref3$data = _ref3.data,
1795
+ data = _ref3$data === void 0 ? [] : _ref3$data,
1796
+ _ref3$ticketHoldersFi = _ref3.ticketHoldersFields,
1797
+ ticketHoldersFields = _ref3$ticketHoldersFi === void 0 ? {
1794
1798
  id: 1,
1795
1799
  fields: []
1796
- } : _ref4$ticketHoldersFi,
1797
- _ref4$initialValues = _ref4.initialValues,
1798
- initialValues = _ref4$initialValues === void 0 ? {} : _ref4$initialValues,
1799
- _ref4$buttonName = _ref4.buttonName,
1800
- buttonName = _ref4$buttonName === void 0 ? 'Submit' : _ref4$buttonName,
1801
- _ref4$handleSubmit = _ref4.handleSubmit,
1802
- handleSubmit = _ref4$handleSubmit === void 0 ? _identity : _ref4$handleSubmit,
1803
- _ref4$theme = _ref4.theme,
1804
- theme = _ref4$theme === void 0 ? 'light' : _ref4$theme,
1805
- _ref4$onRegisterSucce = _ref4.onRegisterSuccess,
1806
- onRegisterSuccess = _ref4$onRegisterSucce === void 0 ? function () {} : _ref4$onRegisterSucce,
1807
- _ref4$onRegisterError = _ref4.onRegisterError,
1808
- onRegisterError = _ref4$onRegisterError === void 0 ? function () {} : _ref4$onRegisterError,
1809
- _ref4$onSubmitError = _ref4.onSubmitError,
1810
- onSubmitError = _ref4$onSubmitError === void 0 ? function () {} : _ref4$onSubmitError,
1811
- _ref4$onGetCartSucces = _ref4.onGetCartSuccess,
1812
- onGetCartSuccess = _ref4$onGetCartSucces === void 0 ? function () {} : _ref4$onGetCartSucces,
1813
- _ref4$onGetCartError = _ref4.onGetCartError,
1814
- onGetCartError = _ref4$onGetCartError === void 0 ? function () {} : _ref4$onGetCartError,
1815
- _ref4$onGetCountriesS = _ref4.onGetCountriesSuccess,
1816
- onGetCountriesSuccess = _ref4$onGetCountriesS === void 0 ? function () {} : _ref4$onGetCountriesS,
1817
- _ref4$onGetCountriesE = _ref4.onGetCountriesError,
1818
- onGetCountriesError = _ref4$onGetCountriesE === void 0 ? function () {} : _ref4$onGetCountriesE,
1819
- _ref4$onGetStatesSucc = _ref4.onGetStatesSuccess,
1820
- onGetStatesSuccess = _ref4$onGetStatesSucc === void 0 ? function () {} : _ref4$onGetStatesSucc,
1821
- _ref4$onGetStatesErro = _ref4.onGetStatesError,
1822
- onGetStatesError = _ref4$onGetStatesErro === void 0 ? function () {} : _ref4$onGetStatesErro,
1823
- _ref4$onGetProfileDat = _ref4.onGetProfileDataSuccess,
1824
- onGetProfileDataSuccess = _ref4$onGetProfileDat === void 0 ? function () {} : _ref4$onGetProfileDat,
1825
- _ref4$onGetProfileDat2 = _ref4.onGetProfileDataError,
1826
- onGetProfileDataError = _ref4$onGetProfileDat2 === void 0 ? function () {} : _ref4$onGetProfileDat2,
1827
- _ref4$onAuthorizeSucc = _ref4.onAuthorizeSuccess,
1828
- onAuthorizeSuccess = _ref4$onAuthorizeSucc === void 0 ? function () {} : _ref4$onAuthorizeSucc,
1829
- _ref4$onAuthorizeErro = _ref4.onAuthorizeError,
1830
- onAuthorizeError = _ref4$onAuthorizeErro === void 0 ? function () {} : _ref4$onAuthorizeErro,
1831
- _ref4$onLogin = _ref4.onLogin,
1832
- onLogin = _ref4$onLogin === void 0 ? function () {} : _ref4$onLogin;
1800
+ } : _ref3$ticketHoldersFi,
1801
+ _ref3$initialValues = _ref3.initialValues,
1802
+ initialValues = _ref3$initialValues === void 0 ? {} : _ref3$initialValues,
1803
+ _ref3$buttonName = _ref3.buttonName,
1804
+ buttonName = _ref3$buttonName === void 0 ? 'Submit' : _ref3$buttonName,
1805
+ _ref3$handleSubmit = _ref3.handleSubmit,
1806
+ handleSubmit = _ref3$handleSubmit === void 0 ? _identity : _ref3$handleSubmit,
1807
+ _ref3$theme = _ref3.theme,
1808
+ theme = _ref3$theme === void 0 ? 'light' : _ref3$theme,
1809
+ _ref3$onRegisterSucce = _ref3.onRegisterSuccess,
1810
+ onRegisterSuccess = _ref3$onRegisterSucce === void 0 ? function () {} : _ref3$onRegisterSucce,
1811
+ _ref3$onRegisterError = _ref3.onRegisterError,
1812
+ onRegisterError = _ref3$onRegisterError === void 0 ? function () {} : _ref3$onRegisterError,
1813
+ _ref3$onSubmitError = _ref3.onSubmitError,
1814
+ onSubmitError = _ref3$onSubmitError === void 0 ? function () {} : _ref3$onSubmitError,
1815
+ _ref3$onGetCartSucces = _ref3.onGetCartSuccess,
1816
+ onGetCartSuccess = _ref3$onGetCartSucces === void 0 ? function () {} : _ref3$onGetCartSucces,
1817
+ _ref3$onGetCartError = _ref3.onGetCartError,
1818
+ onGetCartError = _ref3$onGetCartError === void 0 ? function () {} : _ref3$onGetCartError,
1819
+ _ref3$onGetCountriesS = _ref3.onGetCountriesSuccess,
1820
+ onGetCountriesSuccess = _ref3$onGetCountriesS === void 0 ? function () {} : _ref3$onGetCountriesS,
1821
+ _ref3$onGetCountriesE = _ref3.onGetCountriesError,
1822
+ onGetCountriesError = _ref3$onGetCountriesE === void 0 ? function () {} : _ref3$onGetCountriesE,
1823
+ _ref3$onGetStatesSucc = _ref3.onGetStatesSuccess,
1824
+ onGetStatesSuccess = _ref3$onGetStatesSucc === void 0 ? function () {} : _ref3$onGetStatesSucc,
1825
+ _ref3$onGetStatesErro = _ref3.onGetStatesError,
1826
+ onGetStatesError = _ref3$onGetStatesErro === void 0 ? function () {} : _ref3$onGetStatesErro,
1827
+ _ref3$onGetProfileDat = _ref3.onGetProfileDataSuccess,
1828
+ onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? function () {} : _ref3$onGetProfileDat,
1829
+ _ref3$onGetProfileDat2 = _ref3.onGetProfileDataError,
1830
+ onGetProfileDataError = _ref3$onGetProfileDat2 === void 0 ? function () {} : _ref3$onGetProfileDat2,
1831
+ _ref3$onAuthorizeSucc = _ref3.onAuthorizeSuccess,
1832
+ onAuthorizeSuccess = _ref3$onAuthorizeSucc === void 0 ? function () {} : _ref3$onAuthorizeSucc,
1833
+ _ref3$onAuthorizeErro = _ref3.onAuthorizeError,
1834
+ onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? function () {} : _ref3$onAuthorizeErro,
1835
+ _ref3$onLogin = _ref3.onLogin,
1836
+ onLogin = _ref3$onLogin === void 0 ? function () {} : _ref3$onLogin;
1833
1837
  var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
1834
1838
  var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
1835
1839
 
@@ -1861,7 +1865,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1861
1865
  showModalRegister = _useState7[0],
1862
1866
  setShowModalRegister = _useState7[1];
1863
1867
 
1864
- var _useState8 = React.useState(1),
1868
+ var _useState8 = React.useState([]),
1865
1869
  ticketsQuantity = _useState8[0],
1866
1870
  setTicketsQuantity = _useState8[1];
1867
1871
 
@@ -1893,9 +1897,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1893
1897
 
1894
1898
  var showDOB = getQueryVariable('age_required') === 'true';
1895
1899
  var showTicketHolderName = getQueryVariable('names_required') === 'true';
1900
+ var eventId = getQueryVariable('event_id');
1896
1901
 
1897
1902
  var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
1898
1903
 
1904
+ var hideOptIn = _get(cartInfoData, 'hide_ttf_opt_in', false);
1905
+
1899
1906
  var getQuantity = function getQuantity(cart) {
1900
1907
  if (cart === void 0) {
1901
1908
  cart = [];
@@ -1906,46 +1913,99 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1906
1913
  qty += +item.quantity;
1907
1914
  });
1908
1915
  return qty;
1909
- }; // fetch cart data
1916
+ }; //just once
1917
+
1918
+
1919
+ React.useEffect(function () {
1920
+ // fetch countries data
1921
+ var fetchCountries = /*#__PURE__*/function () {
1922
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1923
+ var res;
1924
+ return runtime_1.wrap(function _callee2$(_context2) {
1925
+ while (1) {
1926
+ switch (_context2.prev = _context2.next) {
1927
+ case 0:
1928
+ _context2.prev = 0;
1929
+ _context2.next = 3;
1930
+ return getCountries();
1931
+
1932
+ case 3:
1933
+ res = _context2.sent;
1934
+ setCustomHeader(res);
1935
+ setCountries(_map(_get(res, 'data.data'), function (item, key) {
1936
+ return {
1937
+ label: item,
1938
+ value: Number(key)
1939
+ };
1940
+ }));
1941
+ onGetCountriesSuccess(res.data);
1942
+ _context2.next = 12;
1943
+ break;
1944
+
1945
+ case 9:
1946
+ _context2.prev = 9;
1947
+ _context2.t0 = _context2["catch"](0);
1948
+
1949
+ if (axios.isAxiosError(_context2.t0)) {
1950
+ onGetCountriesError(_context2.t0);
1951
+ }
1910
1952
 
1953
+ case 12:
1954
+ case "end":
1955
+ return _context2.stop();
1956
+ }
1957
+ }
1958
+ }, _callee2, null, [[0, 9]]);
1959
+ }));
1960
+
1961
+ return function fetchCountries() {
1962
+ return _ref4.apply(this, arguments);
1963
+ };
1964
+ }();
1965
+
1966
+ fetchCountries();
1967
+ fetchCart();
1968
+ }, []); // fetch cart data
1911
1969
 
1912
1970
  var fetchCart = /*#__PURE__*/function () {
1913
- var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1971
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
1914
1972
  var res, cartInfo, _cartInfo$cart, cart;
1915
1973
 
1916
- return runtime_1.wrap(function _callee2$(_context2) {
1974
+ return runtime_1.wrap(function _callee3$(_context3) {
1917
1975
  while (1) {
1918
- switch (_context2.prev = _context2.next) {
1976
+ switch (_context3.prev = _context3.next) {
1919
1977
  case 0:
1920
- _context2.prev = 0;
1921
- _context2.next = 3;
1978
+ _context3.prev = 0;
1979
+ _context3.next = 3;
1922
1980
  return getCart();
1923
1981
 
1924
1982
  case 3:
1925
- res = _context2.sent;
1983
+ res = _context3.sent;
1926
1984
  setCustomHeader(res);
1927
1985
  cartInfo = _get(res, 'data.data.attributes');
1928
1986
  setCartInfo(cartInfo);
1929
1987
  _cartInfo$cart = cartInfo.cart, cart = _cartInfo$cart === void 0 ? [] : _cartInfo$cart;
1930
- setTicketsQuantity(getQuantity(cart));
1988
+ setTicketsQuantity(new Array(getQuantity(cart)).fill(null).map(function () {
1989
+ return nanoid.nanoid();
1990
+ }));
1931
1991
  onGetCartSuccess(res.data);
1932
- _context2.next = 15;
1992
+ _context3.next = 15;
1933
1993
  break;
1934
1994
 
1935
1995
  case 12:
1936
- _context2.prev = 12;
1937
- _context2.t0 = _context2["catch"](0);
1996
+ _context3.prev = 12;
1997
+ _context3.t0 = _context3["catch"](0);
1938
1998
 
1939
- if (axios.isAxiosError(_context2.t0)) {
1940
- onGetCartError(_context2.t0);
1999
+ if (axios.isAxiosError(_context3.t0)) {
2000
+ onGetCartError(_context3.t0);
1941
2001
  }
1942
2002
 
1943
2003
  case 15:
1944
2004
  case "end":
1945
- return _context2.stop();
2005
+ return _context3.stop();
1946
2006
  }
1947
2007
  }
1948
- }, _callee2, null, [[0, 12]]);
2008
+ }, _callee3, null, [[0, 12]]);
1949
2009
  }));
1950
2010
 
1951
2011
  return function fetchCart() {
@@ -1955,24 +2015,24 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1955
2015
 
1956
2016
 
1957
2017
  var fetchUserData = /*#__PURE__*/function () {
1958
- var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(token) {
2018
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(token) {
1959
2019
  var userDataResponse, profileSpecifiedData, profileDataObj;
1960
- return runtime_1.wrap(function _callee3$(_context3) {
2020
+ return runtime_1.wrap(function _callee4$(_context4) {
1961
2021
  while (1) {
1962
- switch (_context3.prev = _context3.next) {
2022
+ switch (_context4.prev = _context4.next) {
1963
2023
  case 0:
1964
- _context3.prev = 0;
2024
+ _context4.prev = 0;
1965
2025
 
1966
2026
  if (!(typeof window !== 'undefined' && token)) {
1967
- _context3.next = 10;
2027
+ _context4.next = 10;
1968
2028
  break;
1969
2029
  }
1970
2030
 
1971
- _context3.next = 4;
2031
+ _context4.next = 4;
1972
2032
  return getProfileData(token);
1973
2033
 
1974
2034
  case 4:
1975
- userDataResponse = _context3.sent;
2035
+ userDataResponse = _context4.sent;
1976
2036
  profileSpecifiedData = _get(userDataResponse, 'data.data');
1977
2037
  profileDataObj = setLoggedUserData(profileSpecifiedData);
1978
2038
  setUserValues(profileDataObj);
@@ -1980,23 +2040,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1980
2040
  onGetProfileDataSuccess(userDataResponse.data);
1981
2041
 
1982
2042
  case 10:
1983
- _context3.next = 15;
2043
+ _context4.next = 15;
1984
2044
  break;
1985
2045
 
1986
2046
  case 12:
1987
- _context3.prev = 12;
1988
- _context3.t0 = _context3["catch"](0);
2047
+ _context4.prev = 12;
2048
+ _context4.t0 = _context4["catch"](0);
1989
2049
 
1990
- if (axios.isAxiosError(_context3.t0)) {
1991
- onGetProfileDataError(_context3.t0);
2050
+ if (axios.isAxiosError(_context4.t0)) {
2051
+ onGetProfileDataError(_context4.t0);
1992
2052
  }
1993
2053
 
1994
2054
  case 15:
1995
2055
  case "end":
1996
- return _context3.stop();
2056
+ return _context4.stop();
1997
2057
  }
1998
2058
  }
1999
- }, _callee3, null, [[0, 12]]);
2059
+ }, _callee4, null, [[0, 12]]);
2000
2060
  }));
2001
2061
 
2002
2062
  return function fetchUserData(_x) {
@@ -2005,58 +2065,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2005
2065
  }();
2006
2066
 
2007
2067
  React.useEffect(function () {
2008
- fetchCart();
2009
- fetchUserData(access_token); // fetch countries data
2010
-
2011
- var fetchCountries = /*#__PURE__*/function () {
2012
- var _ref7 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
2013
- var res;
2014
- return runtime_1.wrap(function _callee4$(_context4) {
2015
- while (1) {
2016
- switch (_context4.prev = _context4.next) {
2017
- case 0:
2018
- _context4.prev = 0;
2019
- _context4.next = 3;
2020
- return getCountries();
2021
-
2022
- case 3:
2023
- res = _context4.sent;
2024
- setCustomHeader(res);
2025
- setCountries(_map(_get(res, 'data.data'), function (item, key) {
2026
- return {
2027
- label: item,
2028
- value: Number(key)
2029
- };
2030
- }));
2031
- onGetCountriesSuccess(res.data);
2032
- _context4.next = 12;
2033
- break;
2034
-
2035
- case 9:
2036
- _context4.prev = 9;
2037
- _context4.t0 = _context4["catch"](0);
2038
-
2039
- if (axios.isAxiosError(_context4.t0)) {
2040
- onGetCountriesError(_context4.t0);
2041
- }
2042
-
2043
- case 12:
2044
- case "end":
2045
- return _context4.stop();
2046
- }
2047
- }
2048
- }, _callee4, null, [[0, 9]]);
2049
- }));
2050
-
2051
- return function fetchCountries() {
2052
- return _ref7.apply(this, arguments);
2053
- };
2054
- }();
2055
-
2056
- if (!(countries && countries.length)) {
2057
- fetchCountries();
2058
- }
2059
- }, [access_token, countries]);
2068
+ fetchUserData(access_token);
2069
+ }, [access_token]);
2060
2070
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(formik.Formik, {
2061
2071
  initialValues: getInitialValues(data, _extends({}, initialValues, {
2062
2072
  email: emailLogged,
@@ -2099,7 +2109,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2099
2109
  }
2100
2110
 
2101
2111
  case 9:
2102
- _checkoutBody = createCheckoutDataBody(ticketsQuantity, values, {
2112
+ _checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
2103
2113
  emailLogged: emailLogged,
2104
2114
  firstNameLogged: firstNameLogged,
2105
2115
  lastNameLogged: lastNameLogged
@@ -2109,7 +2119,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2109
2119
 
2110
2120
  case 12:
2111
2121
  _res = _context5.sent;
2112
- handleSubmit(values, formikHelpers, _res);
2122
+ handleSubmit(values, formikHelpers, eventId, _res);
2113
2123
  return _context5.abrupt("return");
2114
2124
 
2115
2125
  case 15:
@@ -2171,7 +2181,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2171
2181
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
2172
2182
  }
2173
2183
 
2174
- checkoutBody = createCheckoutDataBody(ticketsQuantity, values, {
2184
+ checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
2175
2185
  emailLogged: emailLogged,
2176
2186
  firstNameLogged: firstNameLogged,
2177
2187
  lastNameLogged: lastNameLogged
@@ -2181,7 +2191,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2181
2191
 
2182
2192
  case 41:
2183
2193
  res = _context5.sent;
2184
- handleSubmit(values, formikHelpers, res);
2194
+ handleSubmit(values, formikHelpers, eventId, res);
2185
2195
  _context5.next = 48;
2186
2196
  break;
2187
2197
 
@@ -2241,8 +2251,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2241
2251
  setShowModalLogin(true);
2242
2252
  }
2243
2253
  }, "Login"))), _map(data, function (item) {
2244
- var id = item.id,
2245
- label = item.label,
2254
+ var label = item.label,
2246
2255
  labelClassName = item.labelClassName,
2247
2256
  fields = item.fields;
2248
2257
 
@@ -2250,8 +2259,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2250
2259
  return null;
2251
2260
  }
2252
2261
 
2253
- return React__default.createElement(SectionContainer, {
2254
- key: id
2262
+ return React__default.createElement(React__default.Fragment, {
2263
+ key: nanoid.nanoid()
2255
2264
  }, React__default.createElement("p", {
2256
2265
  className: labelClassName
2257
2266
  }, label), _map(fields, function (group) {
@@ -2259,8 +2268,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2259
2268
  groupItems = group.groupItems,
2260
2269
  groupLabel = group.groupLabel,
2261
2270
  groupLabelClassName = group.groupLabelClassName;
2262
- return React__default.createElement(SectionContainer, {
2263
- key: group.id
2271
+ return React__default.createElement(React__default.Fragment, {
2272
+ key: nanoid.nanoid()
2264
2273
  }, !isLoggedIn && React__default.createElement("div", {
2265
2274
  className: groupLabelClassName
2266
2275
  }, groupLabel), React__default.createElement("div", {
@@ -2278,38 +2287,49 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2278
2287
  return false;
2279
2288
  }
2280
2289
 
2290
+ if (el.name === 'brand_opt_in' && hideOptIn) {
2291
+ return false;
2292
+ }
2293
+
2281
2294
  return true;
2282
2295
  }), function (element) {
2283
- return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React__default.createElement("div", {
2284
- className: element.className,
2285
- key: element.name
2296
+ return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React__default.createElement(React__default.Fragment, {
2297
+ key: nanoid.nanoid()
2298
+ }, element.name === 'email' ? React__default.createElement("div", {
2299
+ className: "email-checking"
2300
+ }, "IMPORTANT: Please double check that your email address is correct. It's where we send your confirmation and e-tickets to!") : null, React__default.createElement("div", {
2301
+ className: element.className
2286
2302
  }, element.component ? element.component : React__default.createElement(formik.Field, {
2287
2303
  name: element.name,
2288
2304
  label: element.label,
2289
2305
  type: element.type,
2290
2306
  validate: combineValidators(element.required ? requiredValidator : function () {}, element.onValidate ? element.onValidate : function () {}),
2291
2307
  component: element.type === 'checkbox' ? CheckboxField : CustomField,
2292
- selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : []
2293
- }));
2308
+ selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : [],
2309
+ theme: theme
2310
+ })));
2294
2311
  })));
2295
2312
  }));
2296
- }), showTicketHolderName && React__default.createElement("div", null, React__default.createElement("p", null, ticketHoldersFields.label), _map(new Array(ticketsQuantity), function (_item, index) {
2313
+ }), showTicketHolderName && React__default.createElement(React__default.Fragment, {
2314
+ key: nanoid.nanoid()
2315
+ }, React__default.createElement("div", {
2316
+ className: "ticket-holders-fields"
2317
+ }, React__default.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
2297
2318
  return React__default.createElement("div", {
2298
- key: index
2319
+ key: nanoid.nanoid()
2299
2320
  }, React__default.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
2300
2321
  var groupClassname = group.groupClassname,
2301
2322
  groupItems = group.groupItems;
2302
2323
  return React__default.createElement("div", {
2303
- key: group.id
2324
+ key: nanoid.nanoid()
2304
2325
  }, React__default.createElement("div", {
2305
2326
  className: groupClassname
2306
2327
  }, _map(groupItems, function (element) {
2307
2328
  return React__default.createElement("div", {
2308
2329
  className: element.className,
2309
- key: element.name + "-" + index
2330
+ key: nanoid.nanoid()
2310
2331
  }, React__default.createElement(formik.Field, {
2311
2332
  name: element.name + "-" + index,
2312
- key: element.name + "-" + index,
2313
2333
  label: element.label,
2314
2334
  type: element.type,
2315
2335
  required: true,
@@ -2318,8 +2338,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2318
2338
  }));
2319
2339
  })));
2320
2340
  }));
2321
- })), React__default.createElement("div", {
2322
- className: "button-container"
2341
+ }))), React__default.createElement("div", {
2342
+ className: "button-container",
2343
+ key: nanoid.nanoid()
2323
2344
  }, React__default.createElement(LoadingButton, {
2324
2345
  type: "submit",
2325
2346
  variant: "contained",
@@ -2427,6 +2448,7 @@ var getCurrencySymbolByCurrency = function getCurrencySymbolByCurrency(currency)
2427
2448
  var options = {
2428
2449
  style: {
2429
2450
  base: {
2451
+ backgroundColor: '#232323',
2430
2452
  fontSize: '18px',
2431
2453
  color: '#ffffff',
2432
2454
  letterSpacing: '1px',
@@ -2454,7 +2476,9 @@ var CheckoutForm = function CheckoutForm(_ref) {
2454
2476
  _ref$isLoading = _ref.isLoading,
2455
2477
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
2456
2478
  _ref$handleSetLoading = _ref.handleSetLoading,
2457
- handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading;
2479
+ handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading,
2480
+ _ref$conditions = _ref.conditions,
2481
+ conditions = _ref$conditions === void 0 ? [] : _ref$conditions;
2458
2482
  var stripe = reactStripeJs.useStripe();
2459
2483
  var elements = reactStripeJs.useElements();
2460
2484
 
@@ -2483,7 +2507,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2483
2507
  break;
2484
2508
  }
2485
2509
 
2486
- setStripeError("Please enter your zip code.");
2510
+ setStripeError('Please enter your zip code.');
2487
2511
  handleSetLoading(false);
2488
2512
  return _context.abrupt("return");
2489
2513
 
@@ -2584,6 +2608,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2584
2608
  zipCode && setPostalCode(zipCode);
2585
2609
  }
2586
2610
  }, []);
2611
+ var buttonIsDiabled = !stripe || !!error || isLoading;
2587
2612
  return React__default.createElement("div", {
2588
2613
  className: "stripe_payment_container"
2589
2614
  }, !!stripeError && React__default.createElement("div", {
@@ -2623,10 +2648,21 @@ var CheckoutForm = function CheckoutForm(_ref) {
2623
2648
  value: postalCode,
2624
2649
  onChange: onChangePostalCode,
2625
2650
  placeholder: "ZIP"
2626
- }))), React__default.createElement("div", {
2627
- className: "payment_button"
2651
+ }))), conditions == null ? void 0 : conditions.map(function (checkbox) {
2652
+ return React__default.createElement("div", {
2653
+ className: 'billing-info-container__singleField',
2654
+ key: checkbox.id
2655
+ }, React__default.createElement("div", {
2656
+ className: "conditions-block"
2657
+ }, React__default.createElement(CheckboxField, {
2658
+ name: checkbox.id,
2659
+ label: checkbox.text,
2660
+ required: true
2661
+ })));
2662
+ }), React__default.createElement("div", {
2663
+ className: "payment_button " + (buttonIsDiabled ? 'disabled-payment-button' : '')
2628
2664
  }, React__default.createElement("button", {
2629
- disabled: !stripe || !!error || isLoading,
2665
+ disabled: buttonIsDiabled,
2630
2666
  type: "submit"
2631
2667
  }, isLoading ? React__default.createElement(CircularProgress, null) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
2632
2668
  };
@@ -2684,8 +2720,13 @@ var PaymentContainer = function PaymentContainer(_ref) {
2684
2720
  paymentIsLoading = _useState4[0],
2685
2721
  setPaymentIsLoading = _useState4[1];
2686
2722
 
2723
+ var _useState5 = React.useState([]),
2724
+ conditions = _useState5[0],
2725
+ setConditions = _useState5[1];
2726
+
2687
2727
  var showFormTitle = Boolean(formTitle);
2688
2728
  var showErrorText = Boolean(errorText);
2729
+ var eventId = getQueryVariable('event_id');
2689
2730
  React.useEffect(function () {
2690
2731
  var hash = checkoutData.hash;
2691
2732
 
@@ -2736,21 +2777,64 @@ var PaymentContainer = function PaymentContainer(_ref) {
2736
2777
  }
2737
2778
  }, _callee, null, [[0, 7]]);
2738
2779
  }))();
2739
- }, [checkoutData]); // 1. get payment data ---> v1/order/${hash}/review/ done
2780
+ }, [checkoutData]); //just once
2781
+
2782
+ React.useEffect(function () {
2783
+ // fetch conditions data
2784
+ var fetchConditions = /*#__PURE__*/function () {
2785
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
2786
+ var res, conditionsInfo;
2787
+ return runtime_1.wrap(function _callee2$(_context2) {
2788
+ while (1) {
2789
+ switch (_context2.prev = _context2.next) {
2790
+ case 0:
2791
+ if (!eventId) {
2792
+ _context2.next = 6;
2793
+ break;
2794
+ }
2795
+
2796
+ _context2.next = 3;
2797
+ return getConditions(eventId);
2798
+
2799
+ case 3:
2800
+ res = _context2.sent;
2801
+ conditionsInfo = _get(res, 'data.data.attributes');
2802
+ setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
2803
+ return {
2804
+ id: nanoid.nanoid(),
2805
+ text: item
2806
+ };
2807
+ }) : []);
2808
+
2809
+ case 6:
2810
+ case "end":
2811
+ return _context2.stop();
2812
+ }
2813
+ }
2814
+ }, _callee2);
2815
+ }));
2816
+
2817
+ return function fetchConditions() {
2818
+ return _ref3.apply(this, arguments);
2819
+ };
2820
+ }();
2821
+
2822
+ fetchConditions();
2823
+ }, []); // 1. get payment data ---> v1/order/${hash}/review/ done
2740
2824
  // 2. handle payment ---> v1/order/${orderHash}/pay/
2741
2825
  // 3. redirect to confirmation page
2742
2826
 
2743
2827
  var handlePaymentMiddleWare = /*#__PURE__*/function () {
2744
- var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(error) {
2828
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(error) {
2745
2829
  var order_hash, paymentSuccessResponse;
2746
- return runtime_1.wrap(function _callee2$(_context2) {
2830
+ return runtime_1.wrap(function _callee3$(_context3) {
2747
2831
  while (1) {
2748
- switch (_context2.prev = _context2.next) {
2832
+ switch (_context3.prev = _context3.next) {
2749
2833
  case 0:
2750
- _context2.prev = 0;
2834
+ _context3.prev = 0;
2751
2835
 
2752
2836
  if (!error) {
2753
- _context2.next = 4;
2837
+ _context3.next = 4;
2754
2838
  break;
2755
2839
  }
2756
2840
 
@@ -2759,36 +2843,36 @@ var PaymentContainer = function PaymentContainer(_ref) {
2759
2843
 
2760
2844
  case 4:
2761
2845
  order_hash = reviewData.order_details.order_hash;
2762
- _context2.next = 7;
2846
+ _context3.next = 7;
2763
2847
  return handlePaymentSuccess(order_hash);
2764
2848
 
2765
2849
  case 7:
2766
- paymentSuccessResponse = _context2.sent;
2850
+ paymentSuccessResponse = _context3.sent;
2767
2851
 
2768
2852
  if (paymentSuccessResponse.status === 200) {
2769
2853
  handlePayment(paymentSuccessResponse);
2770
2854
  setPaymentIsLoading(false);
2771
2855
  }
2772
2856
 
2773
- _context2.next = 15;
2857
+ _context3.next = 15;
2774
2858
  break;
2775
2859
 
2776
2860
  case 11:
2777
- _context2.prev = 11;
2778
- _context2.t0 = _context2["catch"](0);
2779
- setError(_get(_context2.t0, 'response.data.message'));
2780
- onPaymentError(_context2.t0.response);
2861
+ _context3.prev = 11;
2862
+ _context3.t0 = _context3["catch"](0);
2863
+ setError(_get(_context3.t0, 'response.data.message'));
2864
+ onPaymentError(_context3.t0.response);
2781
2865
 
2782
2866
  case 15:
2783
2867
  case "end":
2784
- return _context2.stop();
2868
+ return _context3.stop();
2785
2869
  }
2786
2870
  }
2787
- }, _callee2, null, [[0, 11]]);
2871
+ }, _callee3, null, [[0, 11]]);
2788
2872
  }));
2789
2873
 
2790
2874
  return function handlePaymentMiddleWare(_x) {
2791
- return _ref3.apply(this, arguments);
2875
+ return _ref4.apply(this, arguments);
2792
2876
  };
2793
2877
  }();
2794
2878
 
@@ -2837,7 +2921,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
2837
2921
  isLoading: paymentIsLoading,
2838
2922
  handleSetLoading: function handleSetLoading(value) {
2839
2923
  return setPaymentIsLoading(value);
2840
- }
2924
+ },
2925
+ conditions: conditions
2841
2926
  }))))));
2842
2927
  };
2843
2928
 
@@ -3169,6 +3254,7 @@ var WaitingList = function WaitingList(_ref) {
3169
3254
  value: d.id
3170
3255
  };
3171
3256
  });
3257
+ var showTicketsField = Boolean(ticketTypesList.length);
3172
3258
 
3173
3259
  var handleSubmit = /*#__PURE__*/function () {
3174
3260
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(values) {
@@ -3236,7 +3322,7 @@ var WaitingList = function WaitingList(_ref) {
3236
3322
  email: ''
3237
3323
  },
3238
3324
  onSubmit: handleSubmit
3239
- }, React__default.createElement(formik.Form, null, React__default.createElement("div", {
3325
+ }, React__default.createElement(formik.Form, null, showTicketsField && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
3240
3326
  className: "field-item"
3241
3327
  }, React__default.createElement(formik.Field, {
3242
3328
  name: "ticketTypeId",
@@ -3260,7 +3346,7 @@ var WaitingList = function WaitingList(_ref) {
3260
3346
  value: '',
3261
3347
  disabled: true
3262
3348
  }].concat(generateQuantity(10))
3263
- })), React__default.createElement("div", {
3349
+ }))), React__default.createElement("div", {
3264
3350
  className: "field-item"
3265
3351
  }, React__default.createElement(formik.Field, {
3266
3352
  name: "firstName",
@@ -3480,7 +3566,8 @@ var TicketsContainer = function TicketsContainer(_ref) {
3480
3566
  onAddToCartSuccess({
3481
3567
  skip_billing_page: (_result$data$data$att = result == null ? void 0 : (_result$data = result.data) == null ? void 0 : (_result$data$data = _result$data.data) == null ? void 0 : (_result$data$data$att2 = _result$data$data.attributes) == null ? void 0 : _result$data$data$att2.skip_billing_page) != null ? _result$data$data$att : false,
3482
3568
  names_required: (_result$data$data$att3 = result == null ? void 0 : (_result$data2 = result.data) == null ? void 0 : (_result$data2$data = _result$data2.data) == null ? void 0 : (_result$data2$data$at = _result$data2$data.attributes) == null ? void 0 : _result$data2$data$at.names_required) != null ? _result$data$data$att3 : false,
3483
- age_required: (_result$data$data$att4 = result == null ? void 0 : (_result$data3 = result.data) == null ? void 0 : (_result$data3$data = _result$data3.data) == null ? void 0 : (_result$data3$data$at = _result$data3$data.attributes) == null ? void 0 : _result$data3$data$at.age_required) != null ? _result$data$data$att4 : false
3569
+ age_required: (_result$data$data$att4 = result == null ? void 0 : (_result$data3 = result.data) == null ? void 0 : (_result$data3$data = _result$data3.data) == null ? void 0 : (_result$data3$data$at = _result$data3$data.attributes) == null ? void 0 : _result$data3$data$at.age_required) != null ? _result$data$data$att4 : false,
3570
+ event_id: String(eventId)
3484
3571
  });
3485
3572
  }
3486
3573