tf-checkout-react 1.0.42 → 1.0.46

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 (45) hide show
  1. package/dist/api/index.d.ts +1 -0
  2. package/dist/components/billing-info-container/index.d.ts +22 -3
  3. package/dist/components/billing-info-container/utils.d.ts +2 -2
  4. package/dist/components/common/CheckboxField.d.ts +2 -2
  5. package/dist/components/confirmationContainer/index.d.ts +4 -1
  6. package/dist/components/loginModal/index.d.ts +8 -4
  7. package/dist/components/paymentContainer/index.d.ts +5 -1
  8. package/dist/components/registerModal/index.d.ts +3 -0
  9. package/dist/components/ticketsContainer/TicketRow.d.ts +10 -0
  10. package/dist/components/ticketsContainer/TicketsSection.d.ts +10 -0
  11. package/dist/components/ticketsContainer/index.d.ts +6 -1
  12. package/dist/components/ticketsContainer/utils.d.ts +4 -0
  13. package/dist/components/waitingList/index.d.ts +7 -0
  14. package/dist/index.d.ts +1 -0
  15. package/dist/tf-checkout-react.cjs.development.css +3 -2
  16. package/dist/tf-checkout-react.cjs.development.js +688 -203
  17. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  18. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  19. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  20. package/dist/tf-checkout-react.esm.js +693 -206
  21. package/dist/tf-checkout-react.esm.js.map +1 -1
  22. package/dist/types/billing-info-data.d.ts +2 -1
  23. package/dist/validators/index.d.ts +2 -1
  24. package/package.json +3 -1
  25. package/src/.DS_Store +0 -0
  26. package/src/api/index.ts +5 -3
  27. package/src/components/.DS_Store +0 -0
  28. package/src/components/billing-info-container/index.tsx +239 -63
  29. package/src/components/billing-info-container/style.css +15 -0
  30. package/src/components/billing-info-container/utils.ts +41 -13
  31. package/src/components/common/CheckboxField.tsx +3 -2
  32. package/src/components/common/CustomField.tsx +16 -1
  33. package/src/components/confirmationContainer/index.tsx +8 -3
  34. package/src/components/loginModal/index.tsx +46 -13
  35. package/src/components/paymentContainer/index.tsx +10 -0
  36. package/src/components/registerModal/index.tsx +20 -3
  37. package/src/components/ticketsContainer/TicketRow.tsx +86 -0
  38. package/src/components/ticketsContainer/TicketsSection.tsx +82 -0
  39. package/src/components/ticketsContainer/index.tsx +96 -210
  40. package/src/components/ticketsContainer/utils.ts +11 -0
  41. package/src/components/waitingList/index.tsx +162 -0
  42. package/src/components/waitingList/style.css +18 -0
  43. package/src/index.ts +2 -1
  44. package/src/types/billing-info-data.ts +2 -1
  45. package/src/validators/index.ts +9 -3
@@ -1,17 +1,18 @@
1
1
  import React, { useState, useEffect, useRef } from 'react';
2
2
  import { Formik, Form, Field } from 'formik';
3
- import Button from '@mui/material/Button';
3
+ import LoadingButton from '@mui/lab/LoadingButton';
4
4
  import _identity from 'lodash-es/identity';
5
5
  import _map from 'lodash-es/map';
6
6
  import _get from 'lodash-es/get';
7
7
  import _includes from 'lodash-es/includes';
8
8
  import axios from 'axios';
9
- import { TextField } from '@mui/material';
9
+ import { TextField, CircularProgress } from '@mui/material';
10
10
  import Modal from '@mui/material/Modal';
11
11
  import Box from '@mui/material/Box';
12
12
  import _forEach from 'lodash-es/forEach';
13
13
  import _flatMapDeep from 'lodash-es/flatMapDeep';
14
14
  import TextField$1 from '@mui/material/TextField';
15
+ import { makeStyles } from '@mui/styles';
15
16
  import FormGroup from '@mui/material/FormGroup';
16
17
  import FormControlLabel from '@mui/material/FormControlLabel';
17
18
  import Checkbox from '@mui/material/Checkbox';
@@ -19,20 +20,19 @@ import Container from '@mui/material/Container';
19
20
  import Alert from '@mui/material/Alert';
20
21
  import { useStripe, useElements, CardNumberElement, CardExpiryElement, CardCvcElement, Elements } from '@stripe/react-stripe-js';
21
22
  import { loadStripe } from '@stripe/stripe-js';
22
- import CircularProgress from '@mui/material/CircularProgress';
23
+ import CircularProgress$1 from '@mui/material/CircularProgress';
23
24
  import SVG from 'react-inlinesvg';
24
- import _sortBy from 'lodash-es/sortBy';
25
- import _has from 'lodash-es/has';
26
25
  import _some from 'lodash-es/some';
27
26
  import _find from 'lodash-es/find';
28
27
  import _isEmpty from 'lodash-es/isEmpty';
29
- import _filter from 'lodash-es/filter';
30
- import _isObject from 'lodash-es/isObject';
28
+ import Button$1 from 'react-bootstrap/Button';
29
+ import jwt_decode from 'jwt-decode';
30
+ import _sortBy from 'lodash-es/sortBy';
31
+ import _has from 'lodash-es/has';
31
32
  import FormControl from '@mui/material/FormControl';
32
33
  import MenuItem from '@mui/material/MenuItem';
33
34
  import Select from '@mui/material/Select';
34
- import Button$1 from 'react-bootstrap/Button';
35
- import jwt_decode from 'jwt-decode';
35
+ import Button from '@mui/material/Button';
36
36
 
37
37
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
38
38
  try {
@@ -890,9 +890,10 @@ function styleInject(css, ref) {
890
890
  }
891
891
  }
892
892
 
893
- var css_248z = ".style_billing-info-container__3ZE3J{margin:0 auto;max-width:800px}.style_billing-info-container__3ZE3J .style_is-half__1W_rP{width:49%}.style_billing-info-container__3ZE3J p{color:#000}.style_billing-info-container__3ZE3J .style_main-header__2OFWa{font-size:2rem;font-weight:600}.style_billing-info-container__twoFields__2tDqt{display:flex;justify-content:space-between;margin-top:15px}.style_billing-info-container__singleField__2bcsf{margin-top:15px}button{margin-top:10px}.style_account-actions-block__16OH-{color:#182026;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,Icons16,sans-serif;margin-top:10px}.style_login-register-button__fGgZf,.style_MuiButtonBase-root__1UBk9.style_MuiButton-root__3NzEO,.style_MuiButtonBase-root__1UBk9.style_MuiButton-root__3NzEO:hover{background-color:#212529;border:#f28051;border-radius:5px;color:#fff;cursor:pointer;display:block;font-family:Inter-Bold;font-size:26px;font-weight:700;line-height:1.15;margin-top:10px;min-height:46px;outline:none;overflow:hidden;padding:14px 12px 12px;position:relative;text-align:center;text-overflow:ellipsis;text-transform:uppercase;width:49%}.style_logo-image-container__2A2uH{margin-top:5px;text-align:center;width:49%}.style_logo-image-container__2A2uH img{height:30px}.style_login-block__22kcN{align-items:center;display:flex;flex-direction:column}.style_login-register-button__fGgZf:hover{background-color:#505050!important;border-color:#505050!important}.style_login-register-block__36tu5{display:flex;justify-content:space-between}";
893
+ var css_248z = ".style_button-container__2bhts{display:flex;justify-content:center;padding:20px}.style_billing-info-container__3ZE3J{margin:0 auto;max-width:800px}.style_billing-info-container__3ZE3J .style_is-half__1W_rP{width:49%}.style_billing-info-container__3ZE3J p{color:#000}.style_billing-info-container__3ZE3J .style_main-header__2OFWa{font-size:2rem;font-weight:600}.style_billing-info-container__twoFields__2tDqt{display:flex;justify-content:space-between;margin-top:15px}.style_billing-info-container__singleField__2bcsf{margin-top:15px}button{margin-top:10px}.style_account-actions-block__16OH-{color:#182026;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,Icons16,sans-serif;margin-top:10px}.style_login-register-button__fGgZf,.style_MuiButtonBase-root__1UBk9.style_MuiButton-root__3NzEO,.style_MuiButtonBase-root__1UBk9.style_MuiButton-root__3NzEO:hover{background-color:#212529;border:#f28051;border-radius:5px;color:#fff;cursor:pointer;display:block;font-family:Inter-Bold;font-size:26px;font-weight:700;line-height:1.15;margin-top:10px;min-height:46px;outline:none;overflow:hidden;padding:14px 12px 12px;position:relative;text-align:center;text-overflow:ellipsis;text-transform:uppercase;width:49%}.style_logo-image-container__2A2uH{margin-top:5px;text-align:center;width:49%}.style_logo-image-container__2A2uH img{height:30px}.style_login-block__22kcN{align-items:center;display:flex;flex-direction:column}.style_login-register-button__fGgZf:hover{background-color:#505050!important;border-color:#505050!important}.style_login-register-block__36tu5{display:flex;justify-content:space-between}@media only screen and (max-width:820px){.style_billing-info-container__3ZE3J{width:90%}.style_billing-info-container__3ZE3J .style_main-header__2OFWa{font-size:1.5rem}}";
894
894
  styleInject(css_248z);
895
895
 
896
+ var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
896
897
  var combineValidators = function combineValidators() {
897
898
  for (var _len = arguments.length, validators = new Array(_len), _key = 0; _key < _len; _key++) {
898
899
  validators[_key] = arguments[_key];
@@ -901,19 +902,22 @@ var combineValidators = function combineValidators() {
901
902
  return function () {
902
903
  for (var i = 0; i < validators.length; ++i) {
903
904
  var error_message = validators[i].apply(validators, arguments);
904
- if (error_message !== undefined) return error_message;
905
+ if (error_message) return error_message;
905
906
  }
906
907
  };
907
908
  };
908
- var requiredValidator = function requiredValidator(value) {
909
+ var requiredValidator = function requiredValidator(value, message) {
909
910
  var errorMessage = '';
910
911
 
911
912
  if (!value) {
912
- errorMessage = 'Required';
913
+ errorMessage = message || 'Required';
913
914
  }
914
915
 
915
916
  return errorMessage;
916
917
  };
918
+ var emailValidator = function emailValidator(email) {
919
+ return !emailRegex.test(email) ? 'Please enter a valid email address' : '';
920
+ };
917
921
 
918
922
  // preview1
919
923
 
@@ -935,6 +939,10 @@ if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
935
939
  ttfHeaders['Authorization-Guest'] = /*#__PURE__*/localStorage.getItem('auth_guest_token');
936
940
  }
937
941
 
942
+ if (isWindowDefined && window.location.origin !== 'https://www.houseofx.nyc' && window.location.origin !== 'https://tickets-staging.houseofx.nyc') {
943
+ ttfHeaders['X-Source-Origin'] = 'houseofx.nyc';
944
+ }
945
+
938
946
  var publicRequest = /*#__PURE__*/axios.create({
939
947
  baseURL: ENV.BASE_URL ,
940
948
  headers: ttfHeaders
@@ -978,7 +986,9 @@ publicRequest.interceptors.request.use(function (config) {
978
986
  }
979
987
 
980
988
  if (isWindowDefined && window.location.origin !== 'https://www.houseofx.nyc' && window.location.origin !== 'https://tickets-staging.houseofx.nyc') {
981
- var _updatedHeaders2 = _extends({}, config.headers);
989
+ var _updatedHeaders2 = _extends({}, config.headers, {
990
+ 'X-Source-Origin': 'houseofx.nyc'
991
+ });
982
992
 
983
993
  config.headers = _updatedHeaders2;
984
994
  }
@@ -1084,6 +1094,9 @@ var getConfirmationData = function getConfirmationData(orderHash) {
1084
1094
  var getStates = function getStates(countryId) {
1085
1095
  return publicRequest.get("/countries/" + countryId + "/states/");
1086
1096
  };
1097
+ var addToWaitingList = function addToWaitingList(id, data) {
1098
+ return publicRequest.post("/v1/event/" + id + "/add_to_waiting_list", data);
1099
+ };
1087
1100
 
1088
1101
  var css_248z$1 = ".style_modal-title__2sUq_{align-items:center;background-color:#fff;display:flex;font-family:Inter;font-size:18px;font-weight:700;height:49px;line-height:22px;padding-left:25px;position:relative}.style_login-modal-body__2sFg5{padding:15px 25px}.style_login-modal-body__2sFg5 input{background:#fff!important}.style_login-modal-body__email__2nnEH,.style_login-modal-body__password__qS3g7{margin-bottom:20px}.style_login-action-button__1g9qt button{background-color:#212529;border:none;border-radius:0;color:#fff;cursor:pointer;font-size:26px;font-weight:600;height:45px;line-height:18px;margin:10px 0;outline:none;padding:10px;width:100%}.style_login-action-button__1g9qt button:hover{background-color:#505050;border-color:#505050}.style_server_auth__error__1340S{color:red;font-family:Inter;font-size:12px;font-style:normal;padding-left:25px;padding-top:15px}.style_info-text-for-login__28JQf{font-size:14px;margin-bottom:4px;padding-left:10px}";
1089
1102
  styleInject(css_248z$1);
@@ -1101,9 +1114,18 @@ var style = {
1101
1114
  var LoginModal = function LoginModal(_ref) {
1102
1115
  var onClose = _ref.onClose,
1103
1116
  onLogin = _ref.onLogin,
1104
- alreadyHasUser = _ref.alreadyHasUser,
1105
- userExpired = _ref.userExpired,
1106
- setUserExpired = _ref.setUserExpired;
1117
+ _ref$alreadyHasUser = _ref.alreadyHasUser,
1118
+ alreadyHasUser = _ref$alreadyHasUser === void 0 ? false : _ref$alreadyHasUser,
1119
+ _ref$userExpired = _ref.userExpired,
1120
+ userExpired = _ref$userExpired === void 0 ? false : _ref$userExpired,
1121
+ _ref$onAuthorizeSucce = _ref.onAuthorizeSuccess,
1122
+ onAuthorizeSuccess = _ref$onAuthorizeSucce === void 0 ? function () {} : _ref$onAuthorizeSucce,
1123
+ _ref$onAuthorizeError = _ref.onAuthorizeError,
1124
+ onAuthorizeError = _ref$onAuthorizeError === void 0 ? function () {} : _ref$onAuthorizeError,
1125
+ _ref$onGetProfileData = _ref.onGetProfileDataSuccess,
1126
+ onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? function () {} : _ref$onGetProfileData,
1127
+ _ref$onGetProfileData2 = _ref.onGetProfileDataError,
1128
+ onGetProfileDataError = _ref$onGetProfileData2 === void 0 ? function () {} : _ref$onGetProfileData2;
1107
1129
 
1108
1130
  var _useState = useState(''),
1109
1131
  error = _useState[0],
@@ -1123,7 +1145,7 @@ var LoginModal = function LoginModal(_ref) {
1123
1145
  },
1124
1146
  onSubmit: function () {
1125
1147
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
1126
- var email, password, bodyFormData, resAutorize, bodyFormDataToken, resAccessToken, accessToken, profileData, profileSpecifiedData, profileDataObj, _e$response, _e$response$data, _error;
1148
+ var email, password, bodyFormData, resAutorize, bodyFormDataToken, resAccessToken, accessToken, profileResponse, profileSpecifiedData, profileDataObj, _e$response, _e$response$data, _error;
1127
1149
 
1128
1150
  return runtime_1.wrap(function _callee$(_context) {
1129
1151
  while (1) {
@@ -1145,19 +1167,53 @@ var LoginModal = function LoginModal(_ref) {
1145
1167
  bodyFormDataToken.append('grant_type', 'authorization_code');
1146
1168
  bodyFormDataToken.append('client_id', ENV.CLIENT_ID );
1147
1169
  bodyFormDataToken.append('client_secret', ENV.CLIENT_SECRET );
1148
- _context.next = 16;
1170
+ resAccessToken = null;
1171
+ _context.prev = 15;
1172
+ _context.next = 18;
1149
1173
  return getAccessToken(bodyFormDataToken);
1150
1174
 
1151
- case 16:
1175
+ case 18:
1152
1176
  resAccessToken = _context.sent;
1177
+ onAuthorizeSuccess(resAccessToken.data);
1178
+ _context.next = 26;
1179
+ break;
1180
+
1181
+ case 22:
1182
+ _context.prev = 22;
1183
+ _context.t0 = _context["catch"](15);
1184
+
1185
+ if (axios.isAxiosError(_context.t0)) {
1186
+ onAuthorizeError(_context.t0);
1187
+ }
1188
+
1189
+ return _context.abrupt("return");
1190
+
1191
+ case 26:
1153
1192
  accessToken = _get(resAccessToken, 'data.access_token');
1154
1193
  handleSetAccessToken(accessToken);
1155
- _context.next = 21;
1194
+ profileResponse = null;
1195
+ _context.prev = 29;
1196
+ _context.next = 32;
1156
1197
  return getProfileData(accessToken);
1157
1198
 
1158
- case 21:
1159
- profileData = _context.sent;
1160
- profileSpecifiedData = _get(profileData, 'data.data');
1199
+ case 32:
1200
+ profileResponse = _context.sent;
1201
+ onGetProfileDataSuccess(profileResponse.data);
1202
+ _context.next = 40;
1203
+ break;
1204
+
1205
+ case 36:
1206
+ _context.prev = 36;
1207
+ _context.t1 = _context["catch"](29);
1208
+
1209
+ if (axios.isAxiosError(_context.t1)) {
1210
+ onGetProfileDataError(_context.t1);
1211
+ }
1212
+
1213
+ return _context.abrupt("return");
1214
+
1215
+ case 40:
1216
+ profileSpecifiedData = _get(profileResponse, 'data.data');
1161
1217
  profileDataObj = {
1162
1218
  id: profileSpecifiedData.id,
1163
1219
  first_name: profileSpecifiedData.firstName,
@@ -1170,28 +1226,27 @@ var LoginModal = function LoginModal(_ref) {
1170
1226
  window.localStorage.setItem('access_token', accessToken);
1171
1227
  }
1172
1228
 
1173
- setUserExpired(false);
1174
1229
  onLogin();
1175
- _context.next = 32;
1230
+ _context.next = 49;
1176
1231
  break;
1177
1232
 
1178
- case 29:
1179
- _context.prev = 29;
1180
- _context.t0 = _context["catch"](1);
1233
+ case 46:
1234
+ _context.prev = 46;
1235
+ _context.t2 = _context["catch"](1);
1181
1236
 
1182
- if (axios.isAxiosError(_context.t0)) {
1183
- _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';
1237
+ if (axios.isAxiosError(_context.t2)) {
1238
+ _error = (_context.t2 == null ? void 0 : (_e$response = _context.t2.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message) || 'Error';
1184
1239
  setError(_error);
1185
- } else if (_context.t0 instanceof Error) {
1186
- setError((_context.t0 == null ? void 0 : _context.t0.message) || 'Error');
1240
+ } else if (_context.t2 instanceof Error) {
1241
+ setError((_context.t2 == null ? void 0 : _context.t2.message) || 'Error');
1187
1242
  }
1188
1243
 
1189
- case 32:
1244
+ case 49:
1190
1245
  case "end":
1191
1246
  return _context.stop();
1192
1247
  }
1193
1248
  }
1194
- }, _callee, null, [[1, 29]]);
1249
+ }, _callee, null, [[1, 46], [15, 22], [29, 36]]);
1195
1250
  }));
1196
1251
 
1197
1252
  function onSubmit(_x) {
@@ -1255,7 +1310,11 @@ var css_248z$2 = ".style_register-container___s5V8{margin:0 auto;max-width:800px
1255
1310
  styleInject(css_248z$2);
1256
1311
 
1257
1312
  var RegisterModal = function RegisterModal(_ref) {
1258
- var onClose = _ref.onClose;
1313
+ var onClose = _ref.onClose,
1314
+ _ref$onGetProfileData = _ref.onGetProfileDataSuccess,
1315
+ onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? function () {} : _ref$onGetProfileData,
1316
+ _ref$onGetProfileData2 = _ref.onGetProfileDataError,
1317
+ onGetProfileDataError = _ref$onGetProfileData2 === void 0 ? function () {} : _ref$onGetProfileData2;
1259
1318
  return React.createElement("div", {
1260
1319
  style: {
1261
1320
  display: 'flex',
@@ -1279,7 +1338,7 @@ var RegisterModal = function RegisterModal(_ref) {
1279
1338
  },
1280
1339
  onSubmit: function () {
1281
1340
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
1282
- var firstName, lastName, email, password, confirmPassword, bodyFormData, resRegister, access_token, profileData, profileSpecifiedData, profileDataObj;
1341
+ var firstName, lastName, email, password, confirmPassword, bodyFormData, resRegister, access_token, profileResponse, profileSpecifiedData, profileDataObj;
1283
1342
  return runtime_1.wrap(function _callee$(_context) {
1284
1343
  while (1) {
1285
1344
  switch (_context.prev = _context.next) {
@@ -1300,12 +1359,25 @@ var RegisterModal = function RegisterModal(_ref) {
1300
1359
  resRegister = _context.sent;
1301
1360
  access_token = _get(resRegister, 'data.data.attributes.access_token');
1302
1361
  handleSetAccessToken(access_token);
1303
- _context.next = 16;
1362
+ profileResponse = null;
1363
+ _context.prev = 15;
1364
+ _context.next = 18;
1304
1365
  return getProfileData(access_token);
1305
1366
 
1306
- case 16:
1307
- profileData = _context.sent;
1308
- profileSpecifiedData = _get(profileData, 'data.data');
1367
+ case 18:
1368
+ profileResponse = _context.sent;
1369
+ onGetProfileDataSuccess(profileResponse.data);
1370
+ _context.next = 26;
1371
+ break;
1372
+
1373
+ case 22:
1374
+ _context.prev = 22;
1375
+ _context.t0 = _context["catch"](15);
1376
+ onGetProfileDataError(_context.t0.response);
1377
+ return _context.abrupt("return");
1378
+
1379
+ case 26:
1380
+ profileSpecifiedData = _get(profileResponse, 'data.data');
1309
1381
  profileDataObj = {
1310
1382
  id: profileSpecifiedData.id,
1311
1383
  first_name: profileSpecifiedData.firstName,
@@ -1320,12 +1392,12 @@ var RegisterModal = function RegisterModal(_ref) {
1320
1392
 
1321
1393
  onClose();
1322
1394
 
1323
- case 21:
1395
+ case 30:
1324
1396
  case "end":
1325
1397
  return _context.stop();
1326
1398
  }
1327
1399
  }
1328
- }, _callee);
1400
+ }, _callee, null, [[15, 22]]);
1329
1401
  }));
1330
1402
 
1331
1403
  function onSubmit(_x) {
@@ -1429,8 +1501,8 @@ var RegisterModal = function RegisterModal(_ref) {
1429
1501
  }));
1430
1502
  };
1431
1503
 
1432
- var _excluded = ["holderAge", "firstName", "lastName", "confirmEmail", "confirmPassword", "holderFirstName", "holderLastName"];
1433
- var getInitialValues = function getInitialValues(data, propsInitialValues) {
1504
+ var _excluded = ["firstName", "lastName", "holderAge", "confirmEmail", "confirmPassword"];
1505
+ var getInitialValues = function getInitialValues(data, propsInitialValues, userValues) {
1434
1506
  if (data === void 0) {
1435
1507
  data = [];
1436
1508
  }
@@ -1439,6 +1511,10 @@ var getInitialValues = function getInitialValues(data, propsInitialValues) {
1439
1511
  propsInitialValues = {};
1440
1512
  }
1441
1513
 
1514
+ if (userValues === void 0) {
1515
+ userValues = {};
1516
+ }
1517
+
1442
1518
  var results = _flatMapDeep(data, function (_ref) {
1443
1519
  var fields = _ref.fields;
1444
1520
  return _map(fields, function (_ref2) {
@@ -1453,7 +1529,7 @@ var getInitialValues = function getInitialValues(data, propsInitialValues) {
1453
1529
  var initialValues = {};
1454
1530
 
1455
1531
  _forEach(results, function (item) {
1456
- initialValues[item] = propsInitialValues[item] || '';
1532
+ initialValues[item] = propsInitialValues[item] || userValues[item] || '';
1457
1533
  });
1458
1534
 
1459
1535
  return initialValues;
@@ -1487,7 +1563,7 @@ var setLoggedUserData = function setLoggedUserData(data) {
1487
1563
  zip: (data == null ? void 0 : data.zip) || (data == null ? void 0 : data.zipCode) || ''
1488
1564
  };
1489
1565
  };
1490
- var createCheckoutDataBody = function createCheckoutDataBody(values, logedInValues, includeDob) {
1566
+ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, values, logedInValues, includeDob) {
1491
1567
  if (values === void 0) {
1492
1568
  values = {};
1493
1569
  }
@@ -1501,23 +1577,52 @@ var createCheckoutDataBody = function createCheckoutDataBody(values, logedInValu
1501
1577
  }
1502
1578
 
1503
1579
  var _values = values,
1504
- holderAge = _values.holderAge,
1505
1580
  firstName = _values.firstName,
1506
1581
  lastName = _values.lastName,
1507
- holderFirstName = _values.holderFirstName,
1508
- holderLastName = _values.holderLastName,
1582
+ holderAge = _values.holderAge,
1509
1583
  restValues = _objectWithoutPropertiesLoose(_values, _excluded);
1510
1584
 
1585
+ var holders = [];
1586
+ var ticket_holders = [];
1587
+
1588
+ var _loop = function _loop(i) {
1589
+ var individualHolder = Object.fromEntries(Object.entries(values).filter(function (_ref4) {
1590
+ var key = _ref4[0];
1591
+ return key.includes(String(i));
1592
+ }));
1593
+ holders.push(individualHolder);
1594
+ };
1595
+
1596
+ for (var i = 0; i <= ticketsQuantity; i++) {
1597
+ _loop(i);
1598
+ }
1599
+
1600
+ var filteredHolders = holders.filter(function (holder) {
1601
+ return Object.entries(holder).length > 0;
1602
+ });
1603
+ ticket_holders = filteredHolders.map(function (item, index) {
1604
+ return {
1605
+ first_name: item["holderFirstName-" + index] || '',
1606
+ last_name: item["holderLastName-" + index] || '',
1607
+ phone: item["holderPhone-" + index] || '',
1608
+ email: item["holderEmail-" + index] || ''
1609
+ };
1610
+ });
1611
+ var filteredRestValue = {};
1612
+
1613
+ _forEach(restValues, function (value, key) {
1614
+ if (!key.includes('holder')) {
1615
+ filteredRestValue[key] = value;
1616
+ }
1617
+ });
1618
+
1511
1619
  var body = {
1512
- attributes: _extends({}, restValues, {
1620
+ attributes: _extends({}, filteredRestValue, {
1513
1621
  email: restValues.email || logedInValues.emailLogged,
1514
1622
  confirm_email: restValues.email || logedInValues.emailLogged,
1515
1623
  first_name: firstName || logedInValues.firstNameLogged,
1516
1624
  last_name: lastName || logedInValues.lastNameLogged,
1517
- ticket_holders: [{
1518
- first_name: holderFirstName,
1519
- last_name: holderLastName
1520
- }]
1625
+ ticket_holders: ticket_holders
1521
1626
  })
1522
1627
  };
1523
1628
 
@@ -1531,6 +1636,13 @@ var createCheckoutDataBody = function createCheckoutDataBody(values, logedInValu
1531
1636
  return body;
1532
1637
  };
1533
1638
 
1639
+ var useStyles = /*#__PURE__*/makeStyles({
1640
+ input: {
1641
+ "&::placeholder": {
1642
+ color: "gray"
1643
+ }
1644
+ }
1645
+ });
1534
1646
  var CustomField = function CustomField(_ref) {
1535
1647
  var label = _ref.label,
1536
1648
  _ref$type = _ref.type,
@@ -1547,6 +1659,7 @@ var CustomField = function CustomField(_ref) {
1547
1659
 
1548
1660
  var error = _get(errors, field.name);
1549
1661
 
1662
+ var classes = useStyles();
1550
1663
  return React.createElement(TextField$1, Object.assign({
1551
1664
  id: field.name,
1552
1665
  label: label,
@@ -1558,22 +1671,31 @@ var CustomField = function CustomField(_ref) {
1558
1671
  InputLabelProps: {
1559
1672
  shrink: isShrink
1560
1673
  },
1674
+ InputProps: {
1675
+ classes: {
1676
+ input: classes.input
1677
+ }
1678
+ },
1561
1679
  SelectProps: {
1562
1680
  "native": true
1563
1681
  }
1564
1682
  }, field), isSelectField ? _map(selectOptions, function (option) {
1565
1683
  return React.createElement("option", {
1566
1684
  key: option.value,
1567
- value: option.value
1685
+ value: option.value,
1686
+ disabled: option.disabled
1568
1687
  }, option.label);
1569
1688
  }) : null);
1570
1689
  };
1571
1690
 
1691
+ var _excluded$1 = ["label", "field"];
1572
1692
  var CheckboxField = function CheckboxField(_ref) {
1573
1693
  var label = _ref.label,
1574
- field = _ref.field;
1694
+ field = _ref.field,
1695
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
1696
+
1575
1697
  return React.createElement(FormGroup, null, React.createElement(FormControlLabel, {
1576
- control: React.createElement(Checkbox, Object.assign({}, field)),
1698
+ control: React.createElement(Checkbox, Object.assign({}, field, rest)),
1577
1699
  label: label
1578
1700
  }));
1579
1701
  };
@@ -1600,7 +1722,9 @@ var LogicRunner = function LogicRunner(_ref) {
1600
1722
  setStates = _ref.setStates,
1601
1723
  setFieldValue = _ref.setFieldValue,
1602
1724
  setValues = _ref.setValues,
1603
- setUserValues = _ref.setUserValues;
1725
+ setUserValues = _ref.setUserValues,
1726
+ onGetStatesSuccess = _ref.onGetStatesSuccess,
1727
+ onGetStatesError = _ref.onGetStatesError;
1604
1728
  useEffect(function () {
1605
1729
  var fetchStates = /*#__PURE__*/function () {
1606
1730
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -1624,19 +1748,24 @@ var LogicRunner = function LogicRunner(_ref) {
1624
1748
  });
1625
1749
  setStates(mappedStates);
1626
1750
  setFieldValue('state', (_mappedStates$0$label = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.label) != null ? _mappedStates$0$label : '');
1627
- _context.next = 11;
1751
+ onGetStatesSuccess(res.data);
1752
+ _context.next = 13;
1628
1753
  break;
1629
1754
 
1630
- case 9:
1631
- _context.prev = 9;
1755
+ case 10:
1756
+ _context.prev = 10;
1632
1757
  _context.t0 = _context["catch"](0);
1633
1758
 
1634
- case 11:
1759
+ if (axios.isAxiosError(_context.t0)) {
1760
+ onGetStatesError(_context.t0);
1761
+ }
1762
+
1763
+ case 13:
1635
1764
  case "end":
1636
1765
  return _context.stop();
1637
1766
  }
1638
1767
  }
1639
- }, _callee, null, [[0, 9]]);
1768
+ }, _callee, null, [[0, 10]]);
1640
1769
  }));
1641
1770
 
1642
1771
  return function fetchStates() {
@@ -1660,9 +1789,6 @@ var LogicRunner = function LogicRunner(_ref) {
1660
1789
  email: (parsedData == null ? void 0 : parsedData.email) || '',
1661
1790
  phone: (parsedData == null ? void 0 : parsedData.phone) || '',
1662
1791
  confirmEmail: '',
1663
- holderFirstName: '',
1664
- holderLastName: '',
1665
- holderAge: '',
1666
1792
  state: (parsedData == null ? void 0 : parsedData.state) || '',
1667
1793
  street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
1668
1794
  country: (parsedData == null ? void 0 : parsedData.country) || 1,
@@ -1674,9 +1800,7 @@ var LogicRunner = function LogicRunner(_ref) {
1674
1800
  };
1675
1801
  setValues(mappedValues);
1676
1802
  setUserValues(mappedValues);
1677
- } catch (e) {
1678
- console.log(e);
1679
- }
1803
+ } catch (e) {}
1680
1804
  }
1681
1805
  }
1682
1806
  };
@@ -1694,6 +1818,11 @@ var SectionContainer = function SectionContainer(_ref3) {
1694
1818
  var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1695
1819
  var _ref4$data = _ref4.data,
1696
1820
  data = _ref4$data === void 0 ? [] : _ref4$data,
1821
+ _ref4$ticketHoldersFi = _ref4.ticketHoldersFields,
1822
+ ticketHoldersFields = _ref4$ticketHoldersFi === void 0 ? {
1823
+ id: 1,
1824
+ fields: []
1825
+ } : _ref4$ticketHoldersFi,
1697
1826
  _ref4$initialValues = _ref4.initialValues,
1698
1827
  initialValues = _ref4$initialValues === void 0 ? {} : _ref4$initialValues,
1699
1828
  _ref4$buttonName = _ref4.buttonName,
@@ -1701,7 +1830,35 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1701
1830
  _ref4$handleSubmit = _ref4.handleSubmit,
1702
1831
  handleSubmit = _ref4$handleSubmit === void 0 ? _identity : _ref4$handleSubmit,
1703
1832
  _ref4$theme = _ref4.theme,
1704
- theme = _ref4$theme === void 0 ? 'light' : _ref4$theme;
1833
+ theme = _ref4$theme === void 0 ? 'light' : _ref4$theme,
1834
+ _ref4$onRegisterSucce = _ref4.onRegisterSuccess,
1835
+ onRegisterSuccess = _ref4$onRegisterSucce === void 0 ? function () {} : _ref4$onRegisterSucce,
1836
+ _ref4$onRegisterError = _ref4.onRegisterError,
1837
+ onRegisterError = _ref4$onRegisterError === void 0 ? function () {} : _ref4$onRegisterError,
1838
+ _ref4$onSubmitError = _ref4.onSubmitError,
1839
+ onSubmitError = _ref4$onSubmitError === void 0 ? function () {} : _ref4$onSubmitError,
1840
+ _ref4$onGetCartSucces = _ref4.onGetCartSuccess,
1841
+ onGetCartSuccess = _ref4$onGetCartSucces === void 0 ? function () {} : _ref4$onGetCartSucces,
1842
+ _ref4$onGetCartError = _ref4.onGetCartError,
1843
+ onGetCartError = _ref4$onGetCartError === void 0 ? function () {} : _ref4$onGetCartError,
1844
+ _ref4$onGetCountriesS = _ref4.onGetCountriesSuccess,
1845
+ onGetCountriesSuccess = _ref4$onGetCountriesS === void 0 ? function () {} : _ref4$onGetCountriesS,
1846
+ _ref4$onGetCountriesE = _ref4.onGetCountriesError,
1847
+ onGetCountriesError = _ref4$onGetCountriesE === void 0 ? function () {} : _ref4$onGetCountriesE,
1848
+ _ref4$onGetStatesSucc = _ref4.onGetStatesSuccess,
1849
+ onGetStatesSuccess = _ref4$onGetStatesSucc === void 0 ? function () {} : _ref4$onGetStatesSucc,
1850
+ _ref4$onGetStatesErro = _ref4.onGetStatesError,
1851
+ onGetStatesError = _ref4$onGetStatesErro === void 0 ? function () {} : _ref4$onGetStatesErro,
1852
+ _ref4$onGetProfileDat = _ref4.onGetProfileDataSuccess,
1853
+ onGetProfileDataSuccess = _ref4$onGetProfileDat === void 0 ? function () {} : _ref4$onGetProfileDat,
1854
+ _ref4$onGetProfileDat2 = _ref4.onGetProfileDataError,
1855
+ onGetProfileDataError = _ref4$onGetProfileDat2 === void 0 ? function () {} : _ref4$onGetProfileDat2,
1856
+ _ref4$onAuthorizeSucc = _ref4.onAuthorizeSuccess,
1857
+ onAuthorizeSuccess = _ref4$onAuthorizeSucc === void 0 ? function () {} : _ref4$onAuthorizeSucc,
1858
+ _ref4$onAuthorizeErro = _ref4.onAuthorizeError,
1859
+ onAuthorizeError = _ref4$onAuthorizeErro === void 0 ? function () {} : _ref4$onAuthorizeErro,
1860
+ _ref4$onLogin = _ref4.onLogin,
1861
+ onLogin = _ref4$onLogin === void 0 ? function () {} : _ref4$onLogin;
1705
1862
  var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
1706
1863
  var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
1707
1864
 
@@ -1733,7 +1890,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1733
1890
  showModalRegister = _useState7[0],
1734
1891
  setShowModalRegister = _useState7[1];
1735
1892
 
1736
- var _useState8 = useState({
1893
+ var _useState8 = useState(1),
1894
+ ticketsQuantity = _useState8[0],
1895
+ setTicketsQuantity = _useState8[1];
1896
+
1897
+ var _useState9 = useState({
1737
1898
  firstName: '',
1738
1899
  lastName: '',
1739
1900
  email: '',
@@ -1748,8 +1909,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1748
1909
  state: '',
1749
1910
  zip: ''
1750
1911
  }),
1751
- userValues = _useState8[0],
1752
- setUserValues = _useState8[1];
1912
+ userValues = _useState9[0],
1913
+ setUserValues = _useState9[1];
1753
1914
 
1754
1915
  var isLoggedIn = !!access_token;
1755
1916
 
@@ -1762,12 +1923,25 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1762
1923
  var showDOB = getQueryVariable('age_required') === 'true';
1763
1924
  var showTicketHolderName = getQueryVariable('names_required') === 'true';
1764
1925
 
1765
- var optedInFieldValue = _get(cartInfoData, 'optedIn', false); // fetch cart data
1926
+ var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
1927
+
1928
+ var getQuantity = function getQuantity(cart) {
1929
+ if (cart === void 0) {
1930
+ cart = [];
1931
+ }
1932
+
1933
+ var qty = 0;
1934
+ cart.forEach(function (item) {
1935
+ qty += +item.quantity;
1936
+ });
1937
+ return qty;
1938
+ }; // fetch cart data
1766
1939
 
1767
1940
 
1768
1941
  var fetchCart = /*#__PURE__*/function () {
1769
1942
  var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1770
- var res;
1943
+ var res, cartInfo, _cartInfo$cart, cart;
1944
+
1771
1945
  return runtime_1.wrap(function _callee2$(_context2) {
1772
1946
  while (1) {
1773
1947
  switch (_context2.prev = _context2.next) {
@@ -1779,20 +1953,28 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1779
1953
  case 3:
1780
1954
  res = _context2.sent;
1781
1955
  setCustomHeader(res);
1782
- setCartInfo(_get(res, 'data.data.attributes'));
1783
- _context2.next = 10;
1956
+ cartInfo = _get(res, 'data.data.attributes');
1957
+ setCartInfo(cartInfo);
1958
+ _cartInfo$cart = cartInfo.cart, cart = _cartInfo$cart === void 0 ? [] : _cartInfo$cart;
1959
+ setTicketsQuantity(getQuantity(cart));
1960
+ onGetCartSuccess(res.data);
1961
+ _context2.next = 15;
1784
1962
  break;
1785
1963
 
1786
- case 8:
1787
- _context2.prev = 8;
1964
+ case 12:
1965
+ _context2.prev = 12;
1788
1966
  _context2.t0 = _context2["catch"](0);
1789
1967
 
1790
- case 10:
1968
+ if (axios.isAxiosError(_context2.t0)) {
1969
+ onGetCartError(_context2.t0);
1970
+ }
1971
+
1972
+ case 15:
1791
1973
  case "end":
1792
1974
  return _context2.stop();
1793
1975
  }
1794
1976
  }
1795
- }, _callee2, null, [[0, 8]]);
1977
+ }, _callee2, null, [[0, 12]]);
1796
1978
  }));
1797
1979
 
1798
1980
  return function fetchCart() {
@@ -1811,7 +1993,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1811
1993
  _context3.prev = 0;
1812
1994
 
1813
1995
  if (!(typeof window !== 'undefined' && token)) {
1814
- _context3.next = 9;
1996
+ _context3.next = 10;
1815
1997
  break;
1816
1998
  }
1817
1999
 
@@ -1824,21 +2006,26 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1824
2006
  profileDataObj = setLoggedUserData(profileSpecifiedData);
1825
2007
  setUserValues(profileDataObj);
1826
2008
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
2009
+ onGetProfileDataSuccess(userDataResponse.data);
1827
2010
 
1828
- case 9:
1829
- _context3.next = 13;
2011
+ case 10:
2012
+ _context3.next = 15;
1830
2013
  break;
1831
2014
 
1832
- case 11:
1833
- _context3.prev = 11;
2015
+ case 12:
2016
+ _context3.prev = 12;
1834
2017
  _context3.t0 = _context3["catch"](0);
1835
2018
 
1836
- case 13:
2019
+ if (axios.isAxiosError(_context3.t0)) {
2020
+ onGetProfileDataError(_context3.t0);
2021
+ }
2022
+
2023
+ case 15:
1837
2024
  case "end":
1838
2025
  return _context3.stop();
1839
2026
  }
1840
2027
  }
1841
- }, _callee3, null, [[0, 11]]);
2028
+ }, _callee3, null, [[0, 12]]);
1842
2029
  }));
1843
2030
 
1844
2031
  return function fetchUserData(_x) {
@@ -1857,10 +2044,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1857
2044
  while (1) {
1858
2045
  switch (_context4.prev = _context4.next) {
1859
2046
  case 0:
1860
- _context4.next = 2;
2047
+ _context4.prev = 0;
2048
+ _context4.next = 3;
1861
2049
  return getCountries();
1862
2050
 
1863
- case 2:
2051
+ case 3:
1864
2052
  res = _context4.sent;
1865
2053
  setCustomHeader(res);
1866
2054
  setCountries(_map(_get(res, 'data.data'), function (item, key) {
@@ -1869,13 +2057,24 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1869
2057
  value: Number(key)
1870
2058
  };
1871
2059
  }));
2060
+ onGetCountriesSuccess(res.data);
2061
+ _context4.next = 12;
2062
+ break;
1872
2063
 
1873
- case 5:
2064
+ case 9:
2065
+ _context4.prev = 9;
2066
+ _context4.t0 = _context4["catch"](0);
2067
+
2068
+ if (axios.isAxiosError(_context4.t0)) {
2069
+ onGetCountriesError(_context4.t0);
2070
+ }
2071
+
2072
+ case 12:
1874
2073
  case "end":
1875
2074
  return _context4.stop();
1876
2075
  }
1877
2076
  }
1878
- }, _callee4);
2077
+ }, _callee4, null, [[0, 9]]);
1879
2078
  }));
1880
2079
 
1881
2080
  return function fetchCountries() {
@@ -1894,11 +2093,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1894
2093
  lastName: lastNameLogged,
1895
2094
  country: 1,
1896
2095
  brand_opt_in: optedInFieldValue
1897
- })),
2096
+ }), userValues),
1898
2097
  enableReinitialize: true,
1899
2098
  onSubmit: function () {
1900
2099
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(values, formikHelpers) {
1901
- var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, bodyFormData, resRegister, access_token_register, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response, _e$response$data, _e$response2, error;
2100
+ var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, bodyFormData, access_token_register, resRegister, refreshToken, tokens, _e$response, _e$response$data, error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2;
1902
2101
 
1903
2102
  return runtime_1.wrap(function _callee5$(_context5) {
1904
2103
  while (1) {
@@ -1929,7 +2128,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1929
2128
  }
1930
2129
 
1931
2130
  case 9:
1932
- _checkoutBody = createCheckoutDataBody(values, {
2131
+ _checkoutBody = createCheckoutDataBody(ticketsQuantity, values, {
1933
2132
  emailLogged: emailLogged,
1934
2133
  firstNameLogged: firstNameLogged,
1935
2134
  lastNameLogged: lastNameLogged
@@ -1944,17 +2143,55 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1944
2143
 
1945
2144
  case 15:
1946
2145
  bodyFormData = createRegisterFormData(values);
1947
- _context5.next = 18;
2146
+ access_token_register = null;
2147
+ _context5.prev = 17;
2148
+ _context5.next = 20;
1948
2149
  return register(bodyFormData);
1949
2150
 
1950
- case 18:
2151
+ case 20:
1951
2152
  resRegister = _context5.sent;
1952
2153
  access_token_register = _get(resRegister, 'data.data.attributes.access_token');
2154
+ refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
1953
2155
  handleSetAccessToken(access_token_register);
1954
- _context5.next = 23;
2156
+ tokens = {
2157
+ accessToken: access_token_register,
2158
+ refreshToken: refreshToken
2159
+ };
2160
+ onRegisterSuccess(tokens);
2161
+ _context5.next = 32;
2162
+ break;
2163
+
2164
+ case 28:
2165
+ _context5.prev = 28;
2166
+ _context5.t0 = _context5["catch"](17);
2167
+
2168
+ if (axios.isAxiosError(_context5.t0)) {
2169
+ error = _context5.t0 == null ? void 0 : (_e$response = _context5.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
2170
+
2171
+ if (_includes(error, 'You must be aged')) {
2172
+ formikHelpers.setFieldError('holderAge', error);
2173
+ }
2174
+
2175
+ if (error != null && error.password) {
2176
+ formikHelpers.setFieldError('password', error.password);
2177
+ formikHelpers.setFieldError('confirmPassword', error.password);
2178
+ }
2179
+
2180
+ if (error != null && error.email) {
2181
+ setAlreadyHasUser(true);
2182
+ setShowModalLogin(true);
2183
+ }
2184
+
2185
+ onRegisterError(_context5.t0);
2186
+ }
2187
+
2188
+ return _context5.abrupt("return");
2189
+
2190
+ case 32:
2191
+ _context5.next = 34;
1955
2192
  return getProfileData(access_token_register);
1956
2193
 
1957
- case 23:
2194
+ case 34:
1958
2195
  profileData = _context5.sent;
1959
2196
  profileSpecifiedData = _get(profileData, 'data.data');
1960
2197
  profileDataObj = setLoggedUserData(profileSpecifiedData);
@@ -1963,42 +2200,26 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1963
2200
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1964
2201
  }
1965
2202
 
1966
- checkoutBody = createCheckoutDataBody(values, {
2203
+ checkoutBody = createCheckoutDataBody(ticketsQuantity, values, {
1967
2204
  emailLogged: emailLogged,
1968
2205
  firstNameLogged: firstNameLogged,
1969
2206
  lastNameLogged: lastNameLogged
1970
2207
  }, showDOB);
1971
- _context5.next = 30;
2208
+ _context5.next = 41;
1972
2209
  return postOnCheckout(checkoutBody, access_token_register);
1973
2210
 
1974
- case 30:
2211
+ case 41:
1975
2212
  res = _context5.sent;
1976
2213
  handleSubmit(values, formikHelpers, res);
1977
- _context5.next = 37;
2214
+ _context5.next = 48;
1978
2215
  break;
1979
2216
 
1980
- case 34:
1981
- _context5.prev = 34;
1982
- _context5.t0 = _context5["catch"](0);
2217
+ case 45:
2218
+ _context5.prev = 45;
2219
+ _context5.t1 = _context5["catch"](0);
1983
2220
 
1984
- if (axios.isAxiosError(_context5.t0)) {
1985
- error = _context5.t0 == null ? void 0 : (_e$response = _context5.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
1986
-
1987
- if (_includes(error, 'You must be aged')) {
1988
- formikHelpers.setFieldError('holderAge', error);
1989
- }
1990
-
1991
- if (error != null && error.password) {
1992
- formikHelpers.setFieldError('password', error.password);
1993
- formikHelpers.setFieldError('confirmPassword', error.password);
1994
- }
1995
-
1996
- if (error != null && error.email) {
1997
- setAlreadyHasUser(true);
1998
- setShowModalLogin(true);
1999
- }
2000
-
2001
- if (((_e$response2 = _context5.t0.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
2221
+ if (axios.isAxiosError(_context5.t1)) {
2222
+ if (((_e$response2 = _context5.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
2002
2223
  if (typeof window !== 'undefined') {
2003
2224
  window.localStorage.removeItem('user_data');
2004
2225
  window.localStorage.removeItem('access_token');
@@ -2006,14 +2227,16 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2006
2227
  setShowModalLogin(true);
2007
2228
  }
2008
2229
  }
2230
+
2231
+ onSubmitError(_context5.t1);
2009
2232
  }
2010
2233
 
2011
- case 37:
2234
+ case 48:
2012
2235
  case "end":
2013
2236
  return _context5.stop();
2014
2237
  }
2015
2238
  }
2016
- }, _callee5, null, [[0, 34]]);
2239
+ }, _callee5, null, [[0, 45], [17, 28]]);
2017
2240
  }));
2018
2241
 
2019
2242
  function onSubmit(_x2, _x3) {
@@ -2030,7 +2253,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2030
2253
  setStates: setStates,
2031
2254
  setFieldValue: props.setFieldValue,
2032
2255
  setValues: props.setValues,
2033
- setUserValues: setUserValues
2256
+ setUserValues: setUserValues,
2257
+ onGetStatesSuccess: onGetStatesSuccess,
2258
+ onGetStatesError: onGetStatesError
2034
2259
  }), React.createElement("div", {
2035
2260
  className: "billing-info-container " + theme
2036
2261
  }, !isLoggedIn && React.createElement("div", {
@@ -2041,6 +2266,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2041
2266
  className: "login-register-button",
2042
2267
  type: "button",
2043
2268
  onClick: function onClick() {
2269
+ onLogin();
2044
2270
  setShowModalLogin(true);
2045
2271
  }
2046
2272
  }, "Login"))), _map(data, function (item) {
@@ -2057,13 +2283,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2057
2283
  key: id
2058
2284
  }, React.createElement("p", {
2059
2285
  className: labelClassName
2060
- }, label), _map(fields, function (group, index) {
2286
+ }, label), _map(fields, function (group) {
2061
2287
  var groupClassname = group.groupClassname,
2062
2288
  groupItems = group.groupItems,
2063
2289
  groupLabel = group.groupLabel,
2064
2290
  groupLabelClassName = group.groupLabelClassName;
2065
- return React.createElement("div", {
2066
- key: index
2291
+ return React.createElement(SectionContainer, {
2292
+ key: group.id
2067
2293
  }, !isLoggedIn && React.createElement("div", {
2068
2294
  className: groupLabelClassName
2069
2295
  }, groupLabel), React.createElement("div", {
@@ -2096,16 +2322,43 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2096
2322
  }));
2097
2323
  })));
2098
2324
  }));
2099
- }), React.createElement("div", {
2100
- style: {
2101
- display: 'flex',
2102
- padding: 20,
2103
- justifyContent: 'center'
2104
- }
2105
- }, React.createElement(Button, {
2325
+ }), showTicketHolderName && React.createElement("div", null, React.createElement("p", null, ticketHoldersFields.label), _map(new Array(ticketsQuantity), function (_item, index) {
2326
+ return React.createElement("div", {
2327
+ key: index
2328
+ }, React.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
2329
+ var groupClassname = group.groupClassname,
2330
+ groupItems = group.groupItems;
2331
+ return React.createElement("div", {
2332
+ key: group.id
2333
+ }, React.createElement("div", {
2334
+ className: groupClassname
2335
+ }, _map(groupItems, function (element) {
2336
+ return React.createElement("div", {
2337
+ className: element.className,
2338
+ key: element.name + "-" + index
2339
+ }, React.createElement(Field, {
2340
+ name: element.name + "-" + index,
2341
+ key: element.name + "-" + index,
2342
+ label: element.label,
2343
+ type: element.type,
2344
+ required: true,
2345
+ component: element.type === 'checkbox' ? CheckboxField : CustomField,
2346
+ validate: combineValidators(element.required ? requiredValidator : function () {}, element.onValidate ? element.onValidate : function () {})
2347
+ }));
2348
+ })));
2349
+ }));
2350
+ })), React.createElement("div", {
2351
+ className: "button-container"
2352
+ }, React.createElement(LoadingButton, {
2106
2353
  type: "submit",
2107
2354
  variant: "contained",
2108
- className: "login-register-button"
2355
+ className: "login-register-button",
2356
+ loadingIndicator: React.createElement(CircularProgress, {
2357
+ color: "inherit",
2358
+ size: 26
2359
+ }),
2360
+ loading: props.isSubmitting,
2361
+ disabled: props.isSubmitting
2109
2362
  }, buttonName))));
2110
2363
  }), showModalLogin && React.createElement(LoginModal, {
2111
2364
  onClose: function onClose() {
@@ -2113,17 +2366,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2113
2366
  },
2114
2367
  onLogin: function onLogin() {
2115
2368
  setShowModalLogin(false);
2369
+ setUserExpired(false);
2116
2370
  },
2117
2371
  alreadyHasUser: alreadyHasUser,
2118
2372
  userExpired: userExpired,
2119
- setUserExpired: setUserExpired
2373
+ onAuthorizeSuccess: onAuthorizeSuccess,
2374
+ onAuthorizeError: onAuthorizeError,
2375
+ onGetProfileDataSuccess: onGetProfileDataSuccess,
2376
+ onGetProfileDataError: onGetProfileDataError
2120
2377
  }), showModalRegister && React.createElement(RegisterModal, {
2121
2378
  onClose: function onClose() {
2122
2379
  setShowModalRegister(false);
2123
2380
  },
2124
2381
  onRegister: function onRegister() {
2125
2382
  setShowModalRegister(false);
2126
- }
2383
+ },
2384
+ onGetProfileDataSuccess: onGetProfileDataSuccess,
2385
+ onGetProfileDataError: onGetProfileDataError
2127
2386
  }));
2128
2387
  };
2129
2388
 
@@ -2404,7 +2663,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2404
2663
  }, React.createElement("button", {
2405
2664
  disabled: !stripe || !!error || isLoading,
2406
2665
  type: "submit"
2407
- }, isLoading ? React.createElement(CircularProgress, null) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
2666
+ }, isLoading ? React.createElement(CircularProgress$1, null) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
2408
2667
  };
2409
2668
 
2410
2669
  var testId = ENV.STRIPE_PUBLISHABLE_KEY ;
@@ -2436,7 +2695,13 @@ var PaymentContainer = function PaymentContainer(_ref) {
2436
2695
  errorText = _ref.errorText,
2437
2696
  checkoutData = _ref.checkoutData,
2438
2697
  _ref$onErrorClose = _ref.onErrorClose,
2439
- onErrorClose = _ref$onErrorClose === void 0 ? _identity : _ref$onErrorClose;
2698
+ onErrorClose = _ref$onErrorClose === void 0 ? _identity : _ref$onErrorClose,
2699
+ _ref$onGetPaymentData = _ref.onGetPaymentDataSuccess,
2700
+ onGetPaymentDataSuccess = _ref$onGetPaymentData === void 0 ? function () {} : _ref$onGetPaymentData,
2701
+ _ref$onGetPaymentData2 = _ref.onGetPaymentDataError,
2702
+ onGetPaymentDataError = _ref$onGetPaymentData2 === void 0 ? function () {} : _ref$onGetPaymentData2,
2703
+ _ref$onPaymentError = _ref.onPaymentError,
2704
+ onPaymentError = _ref$onPaymentError === void 0 ? function () {} : _ref$onPaymentError;
2440
2705
 
2441
2706
  var _useState = useState(initialReviewValues),
2442
2707
  reviewData = _useState[0],
@@ -2487,17 +2752,19 @@ var PaymentContainer = function PaymentContainer(_ref) {
2487
2752
  currency: order_details == null ? void 0 : order_details.currency
2488
2753
  };
2489
2754
  setOrderData(_orderData);
2755
+ onGetPaymentDataSuccess(response.data);
2490
2756
  }
2491
2757
 
2492
- _context.next = 10;
2758
+ _context.next = 11;
2493
2759
  break;
2494
2760
 
2495
2761
  case 7:
2496
2762
  _context.prev = 7;
2497
2763
  _context.t0 = _context["catch"](0);
2498
2764
  setError(_get(_context.t0, 'response.data.message'));
2765
+ onGetPaymentDataError(_context.t0.response);
2499
2766
 
2500
- case 10:
2767
+ case 11:
2501
2768
  case "end":
2502
2769
  return _context.stop();
2503
2770
  }
@@ -2538,15 +2805,16 @@ var PaymentContainer = function PaymentContainer(_ref) {
2538
2805
  setPaymentIsLoading(false);
2539
2806
  }
2540
2807
 
2541
- _context2.next = 14;
2808
+ _context2.next = 15;
2542
2809
  break;
2543
2810
 
2544
2811
  case 11:
2545
2812
  _context2.prev = 11;
2546
2813
  _context2.t0 = _context2["catch"](0);
2547
2814
  setError(_get(_context2.t0, 'response.data.message'));
2815
+ onPaymentError(_context2.t0.response);
2548
2816
 
2549
- case 14:
2817
+ case 15:
2550
2818
  case "end":
2551
2819
  return _context2.stop();
2552
2820
  }
@@ -2618,7 +2886,11 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
2618
2886
  _ref$shareButtons = _ref.shareButtons,
2619
2887
  shareButtons = _ref$shareButtons === void 0 ? [] : _ref$shareButtons,
2620
2888
  _ref$shareLink = _ref.shareLink,
2621
- shareLink = _ref$shareLink === void 0 ? '' : _ref$shareLink;
2889
+ shareLink = _ref$shareLink === void 0 ? '' : _ref$shareLink,
2890
+ _ref$onGetConfirmatio = _ref.onGetConfirmationDataSuccess,
2891
+ onGetConfirmationDataSuccess = _ref$onGetConfirmatio === void 0 ? function () {} : _ref$onGetConfirmatio,
2892
+ _ref$onGetConfirmatio2 = _ref.onGetConfirmationDataError,
2893
+ onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2;
2622
2894
  var inputRef = useRef(null);
2623
2895
 
2624
2896
  var _useState = useState({}),
@@ -2639,7 +2911,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
2639
2911
  dataEncoded = typeof window !== 'undefined' && window.localStorage.getItem('checkoutData');
2640
2912
 
2641
2913
  if (!dataEncoded) {
2642
- _context.next = 14;
2914
+ _context.next = 16;
2643
2915
  break;
2644
2916
  }
2645
2917
 
@@ -2653,21 +2925,23 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
2653
2925
  response = _context.sent;
2654
2926
  _data = _get(response, 'data.data.attributes');
2655
2927
  setData(_data);
2656
- _context.next = 14;
2928
+ onGetConfirmationDataSuccess(response.data);
2929
+ _context.next = 16;
2657
2930
  break;
2658
2931
 
2659
- case 12:
2660
- _context.prev = 12;
2932
+ case 13:
2933
+ _context.prev = 13;
2661
2934
  _context.t0 = _context["catch"](4);
2935
+ onGetConfirmationDataError(_context.t0.response);
2662
2936
 
2663
- case 14:
2937
+ case 16:
2664
2938
  case "end":
2665
2939
  return _context.stop();
2666
2940
  }
2667
2941
  }
2668
- }, _callee, null, [[4, 12]]);
2942
+ }, _callee, null, [[4, 13]]);
2669
2943
  }))();
2670
- }, []);
2944
+ }, [onGetConfirmationDataSuccess, onGetConfirmationDataError]);
2671
2945
  return React.createElement("div", {
2672
2946
  className: "confirmation-page"
2673
2947
  }, React.createElement("p", {
@@ -2800,10 +3074,14 @@ var getTicketSelectOptions = function getTicketSelectOptions(maxCount, minCount,
2800
3074
  return options;
2801
3075
  };
2802
3076
 
2803
- var computeTierStateLabel = function computeTierStateLabel(tier, prevTier, selectedTickets, handleTicketSelect) {
2804
- var soldOutMessage = tier.soldOutMessage ? ("" + tier.soldOutMessage).toUpperCase() : 'SOLD OUT';
2805
- var isSalesClosed = !tier.salesStarted || tier.salesEnded || !_has(tier, 'maxQuantity') || tier.maxQuantity === 0;
2806
- var options = getTicketSelectOptions(tier.maxQuantity, tier.minQuantity, tier.multiplier);
3077
+ var TicketRow = function TicketRow(_ref) {
3078
+ var ticketTier = _ref.ticketTier,
3079
+ prevTicketTier = _ref.prevTicketTier,
3080
+ selectedTickets = _ref.selectedTickets,
3081
+ handleTicketSelect = _ref.handleTicketSelect;
3082
+ var soldOutMessage = ticketTier.soldOutMessage ? ("" + ticketTier.soldOutMessage).toUpperCase() : 'SOLD OUT';
3083
+ var isSalesClosed = !ticketTier.salesStarted || ticketTier.salesEnded || !_has(ticketTier, 'maxQuantity') || ticketTier.maxQuantity === 0;
3084
+ var options = getTicketSelectOptions(ticketTier.maxQuantity, ticketTier.minQuantity, ticketTier.multiplier);
2807
3085
  var onSaleContent = isSalesClosed ? null : React.createElement("div", {
2808
3086
  className: "get-tickets"
2809
3087
  }, React.createElement(Box, {
@@ -2811,7 +3089,7 @@ var computeTierStateLabel = function computeTierStateLabel(tier, prevTier, selec
2811
3089
  }, React.createElement(FormControl, {
2812
3090
  fullWidth: true
2813
3091
  }, React.createElement(Select, {
2814
- value: selectedTickets[tier.id] ? selectedTickets[tier.id] : 0,
3092
+ value: selectedTickets[ticketTier.id] ? selectedTickets[ticketTier.id] : 0,
2815
3093
  onChange: handleTicketSelect,
2816
3094
  displayEmpty: true,
2817
3095
  inputProps: {
@@ -2831,57 +3109,243 @@ var computeTierStateLabel = function computeTierStateLabel(tier, prevTier, selec
2831
3109
  value: option.value
2832
3110
  }, option.value);
2833
3111
  })))));
2834
- if (tier.sold_out || !tier.displayTicket || tier.soldOut) return soldOutMessage;
2835
- if (!+tier.cost && !+tier.price) return 'FREE';
2836
- if (tier.displayTicket) return onSaleContent;
2837
- if (prevTier.in_stock) return 'SOON';
2838
- return '';
3112
+ var returnValue = '';
3113
+
3114
+ if (ticketTier.sold_out || !ticketTier.displayTicket || ticketTier.soldOut) {
3115
+ returnValue = soldOutMessage;
3116
+ }
3117
+
3118
+ if (!+ticketTier.cost && !+ticketTier.price) {
3119
+ returnValue = 'FREE';
3120
+ }
3121
+
3122
+ if (ticketTier.displayTicket) {
3123
+ returnValue = onSaleContent;
3124
+ }
3125
+
3126
+ if (_get(prevTicketTier, 'in_stock')) {
3127
+ returnValue = 'SOON';
3128
+ }
3129
+
3130
+ return React.createElement(React.Fragment, null, returnValue, " ");
2839
3131
  };
2840
3132
 
2841
- var renderTiers = function renderTiers(boxOffice, selectedTickets, handleTicketSelect, promoCodeIsApplied) {
2842
- var sortedBoxOfiice = _sortBy(boxOffice, 'sortOrder');
3133
+ var TicketsSection = function TicketsSection(_ref) {
3134
+ var ticketsList = _ref.ticketsList,
3135
+ selectedTickets = _ref.selectedTickets,
3136
+ handleTicketSelect = _ref.handleTicketSelect,
3137
+ promoCodeIsApplied = _ref.promoCodeIsApplied;
3138
+
3139
+ var sortedTicketsList = _sortBy(ticketsList, 'sortOrder');
2843
3140
 
2844
- var primaryTiers = sortedBoxOfiice.map(function (tier, i, arr) {
2845
- var isSoldOut = tier.sold_out || !tier.displayTicket || tier.soldOut;
3141
+ return React.createElement(React.Fragment, null, sortedTicketsList.map(function (ticket, i, arr) {
3142
+ var isSoldOut = ticket.sold_out || !ticket.displayTicket || ticket.soldOut;
2846
3143
 
2847
3144
  var ticketSelect = function ticketSelect(event) {
2848
3145
  var value = event.target.value;
2849
- handleTicketSelect(tier.id, value);
3146
+ handleTicketSelect(ticket.id, value);
2850
3147
  };
2851
3148
 
2852
3149
  var ticketIsDiscounted = false;
2853
3150
 
2854
- if (tier.oldPrice && promoCodeIsApplied && !isSoldOut && tier.oldPrice !== tier.price) {
3151
+ if (ticket.oldPrice && promoCodeIsApplied && !isSoldOut && ticket.oldPrice !== ticket.price) {
2855
3152
  ticketIsDiscounted = true;
2856
3153
  }
2857
3154
 
2858
3155
  return React.createElement("div", {
2859
- key: tier.id || tier.name,
3156
+ key: ticket.id || ticket.name,
2860
3157
  className: "event-detail__tier " + (isSoldOut ? 'disabled' : '')
2861
3158
  }, React.createElement("div", {
2862
3159
  className: "event-detail__tier-name"
2863
- }, tier.displayName || tier.name), React.createElement("div", {
3160
+ }, ticket.displayName || ticket.name), React.createElement("div", {
2864
3161
  className: "event-tickets-container"
2865
3162
  }, React.createElement("div", {
2866
3163
  className: "event-detail__tier-price"
2867
3164
  }, ticketIsDiscounted && React.createElement("p", {
2868
3165
  className: "old-price"
2869
- }, "$ ", (+tier.oldPrice).toFixed(2)), React.createElement("p", null, isSoldOut ? 'SOLD OUT' : "$ " + (+tier.cost || +tier.price).toFixed(2)), !isSoldOut && React.createElement("p", {
2870
- className: 'fees'
2871
- }, tier.taxesIncluded ? '(incl. Fees)' : '(excl. Fees)')), React.createElement("div", {
3166
+ }, "$ ", (+ticket.oldPrice).toFixed(2)), React.createElement("p", null, isSoldOut ? 'SOLD OUT' : "$ " + (+ticket.cost || +ticket.price).toFixed(2)), !isSoldOut && React.createElement("p", {
3167
+ className: "fees"
3168
+ }, ticket.taxesIncluded ? '(incl. Fees)' : '(excl. Fees)')), React.createElement("div", {
2872
3169
  className: "event-detail__tier-state",
2873
3170
  style: {
2874
3171
  minWidth: 55
2875
3172
  }
2876
- }, computeTierStateLabel(tier, arr[i - 1], selectedTickets, ticketSelect))));
3173
+ }, React.createElement(TicketRow, {
3174
+ ticketTier: ticket,
3175
+ prevTicketTier: arr[i - 1],
3176
+ selectedTickets: selectedTickets,
3177
+ handleTicketSelect: ticketSelect
3178
+ }))));
3179
+ }));
3180
+ };
3181
+
3182
+ var css_248z$7 = ".style_waiting-list__2sJxM{padding:17px 35px 20px}.style_waiting-list__2sJxM .style_field-item__34MYc{margin-bottom:30px}.style_waiting-list__2sJxM .style_waiting-list-button__tO7D2{width:100%!important}.style_waiting-list__2sJxM .style_waiting-list-button__tO7D2:hover{background-color:#505050}.style_waiting-list__2sJxM .style_success-message__BvF3R h3{margin:10px 0}.style_waiting-list__2sJxM .style_success-message__BvF3R p{margin:0}";
3183
+ styleInject(css_248z$7);
3184
+
3185
+ var generateQuantity = function generateQuantity(n) {
3186
+ var quantityList = [];
3187
+
3188
+ for (var i = 1; i <= n; i++) {
3189
+ quantityList.push({
3190
+ label: i,
3191
+ value: i
3192
+ });
3193
+ }
3194
+
3195
+ return quantityList;
3196
+ };
3197
+
3198
+ var WaitingList = function WaitingList(_ref) {
3199
+ var _ref$tickets = _ref.tickets,
3200
+ tickets = _ref$tickets === void 0 ? {} : _ref$tickets;
3201
+
3202
+ var _useState = useState(false),
3203
+ showSuccessMessage = _useState[0],
3204
+ setShowSuccessMessage = _useState[1];
3205
+
3206
+ var _useState2 = useState(false),
3207
+ loading = _useState2[0],
3208
+ setLoading = _useState2[1];
3209
+
3210
+ var ticketTypesList = Object.values(tickets).map(function (d) {
3211
+ return {
3212
+ label: d.displayName,
3213
+ value: d.id
3214
+ };
2877
3215
  });
2878
- return primaryTiers;
3216
+
3217
+ var handleSubmit = /*#__PURE__*/function () {
3218
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(values) {
3219
+ var id, requestData, _yield$addToWaitingLi, data;
3220
+
3221
+ return runtime_1.wrap(function _callee$(_context) {
3222
+ while (1) {
3223
+ switch (_context.prev = _context.next) {
3224
+ case 0:
3225
+ _context.prev = 0;
3226
+ setLoading(true);
3227
+ id = ENV.EVENT_ID;
3228
+ requestData = {
3229
+ data: {
3230
+ attributes: values
3231
+ }
3232
+ };
3233
+ _context.next = 6;
3234
+ return addToWaitingList(id, requestData);
3235
+
3236
+ case 6:
3237
+ _yield$addToWaitingLi = _context.sent;
3238
+ data = _yield$addToWaitingLi.data;
3239
+
3240
+ if (data.success) {
3241
+ setShowSuccessMessage(true);
3242
+ }
3243
+
3244
+ _context.next = 14;
3245
+ break;
3246
+
3247
+ case 11:
3248
+ _context.prev = 11;
3249
+ _context.t0 = _context["catch"](0);
3250
+ console.log(_context.t0);
3251
+
3252
+ case 14:
3253
+ _context.prev = 14;
3254
+ setLoading(false);
3255
+ return _context.finish(14);
3256
+
3257
+ case 17:
3258
+ case "end":
3259
+ return _context.stop();
3260
+ }
3261
+ }
3262
+ }, _callee, null, [[0, 11, 14, 17]]);
3263
+ }));
3264
+
3265
+ return function handleSubmit(_x) {
3266
+ return _ref2.apply(this, arguments);
3267
+ };
3268
+ }();
3269
+
3270
+ return React.createElement("div", {
3271
+ className: "waiting-list"
3272
+ }, showSuccessMessage ? React.createElement("div", {
3273
+ className: "success-message"
3274
+ }, React.createElement("h3", null, "You've been added to the waiting list!"), React.createElement("p", null, "You'll be notified if tickets become available.")) : React.createElement(React.Fragment, null, React.createElement("h2", null, "WAITING LIST"), React.createElement(Formik, {
3275
+ initialValues: {
3276
+ ticketTypeId: '',
3277
+ quantity: '',
3278
+ firstName: '',
3279
+ lastName: '',
3280
+ email: ''
3281
+ },
3282
+ onSubmit: handleSubmit
3283
+ }, React.createElement(Form, null, React.createElement("div", {
3284
+ className: "field-item"
3285
+ }, React.createElement(Field, {
3286
+ name: "ticketTypeId",
3287
+ label: "Ticket types",
3288
+ type: "select",
3289
+ component: CustomField,
3290
+ selectOptions: [{
3291
+ label: 'Type of Ticket',
3292
+ value: '',
3293
+ disabled: true
3294
+ }].concat(ticketTypesList)
3295
+ })), React.createElement("div", {
3296
+ className: "field-item"
3297
+ }, React.createElement(Field, {
3298
+ name: "quantity",
3299
+ label: "Quantity",
3300
+ type: "select",
3301
+ component: CustomField,
3302
+ selectOptions: [{
3303
+ label: 'Quantity Requested',
3304
+ value: '',
3305
+ disabled: true
3306
+ }].concat(generateQuantity(10))
3307
+ })), React.createElement("div", {
3308
+ className: "field-item"
3309
+ }, React.createElement(Field, {
3310
+ name: "firstName",
3311
+ label: "First name",
3312
+ validate: function validate(value) {
3313
+ return requiredValidator(value, 'Please enter your First name');
3314
+ },
3315
+ component: CustomField
3316
+ })), React.createElement("div", {
3317
+ className: "field-item"
3318
+ }, React.createElement(Field, {
3319
+ name: "lastName",
3320
+ label: "Last name",
3321
+ validate: function validate(value) {
3322
+ return requiredValidator(value, 'Please enter your Last name');
3323
+ },
3324
+ component: CustomField
3325
+ })), React.createElement("div", {
3326
+ className: "field-item"
3327
+ }, React.createElement(Field, {
3328
+ name: "email",
3329
+ label: "Email",
3330
+ validate: combineValidators(function (value) {
3331
+ return requiredValidator(value, 'Please enter your Email');
3332
+ }, function (value) {
3333
+ return emailValidator(value);
3334
+ }),
3335
+ component: CustomField
3336
+ })), React.createElement(Button, {
3337
+ type: "submit",
3338
+ variant: "contained",
3339
+ className: "waiting-list-button"
3340
+ }, loading ? React.createElement(CircularProgress$1, {
3341
+ size: "22px"
3342
+ }) : 'ADD TO WAITING LIST')))));
2879
3343
  };
2880
3344
 
2881
3345
  function Loader() {
2882
3346
  return React.createElement("div", {
2883
3347
  className: "loader-container"
2884
- }, React.createElement(CircularProgress, null));
3348
+ }, React.createElement(CircularProgress$1, null));
2885
3349
  }
2886
3350
 
2887
3351
  var TicketsContainer = function TicketsContainer(_ref) {
@@ -2889,7 +3353,15 @@ var TicketsContainer = function TicketsContainer(_ref) {
2889
3353
  eventId = _ref.eventId,
2890
3354
  onAddToCartSuccess = _ref.onAddToCartSuccess,
2891
3355
  _ref$contentStyle = _ref.contentStyle,
2892
- contentStyle = _ref$contentStyle === void 0 ? {} : _ref$contentStyle;
3356
+ contentStyle = _ref$contentStyle === void 0 ? {} : _ref$contentStyle,
3357
+ _ref$onAddToCartError = _ref.onAddToCartError,
3358
+ onAddToCartError = _ref$onAddToCartError === void 0 ? function () {} : _ref$onAddToCartError,
3359
+ _ref$onGetTicketsSucc = _ref.onGetTicketsSuccess,
3360
+ onGetTicketsSuccess = _ref$onGetTicketsSucc === void 0 ? function () {} : _ref$onGetTicketsSucc,
3361
+ _ref$onGetTicketsErro = _ref.onGetTicketsError,
3362
+ onGetTicketsError = _ref$onGetTicketsErro === void 0 ? function () {} : _ref$onGetTicketsErro,
3363
+ _ref$theme = _ref.theme,
3364
+ theme = _ref$theme === void 0 ? 'light' : _ref$theme;
2893
3365
 
2894
3366
  var _useState = useState({}),
2895
3367
  selectedTickets = _useState[0],
@@ -2900,28 +3372,32 @@ var TicketsContainer = function TicketsContainer(_ref) {
2900
3372
  setTickets = _useState2[1];
2901
3373
 
2902
3374
  var _useState3 = useState(false),
2903
- isLoading = _useState3[0],
2904
- setIsLoading = _useState3[1];
3375
+ showWaitingList = _useState3[0],
3376
+ setShowWaitingList = _useState3[1];
2905
3377
 
2906
3378
  var _useState4 = useState(false),
2907
- handleBookIsLoading = _useState4[0],
2908
- setHandleBookIsLoading = _useState4[1];
3379
+ isLoading = _useState4[0],
3380
+ setIsLoading = _useState4[1];
2909
3381
 
2910
- var _useState5 = useState(''),
2911
- promoCode = _useState5[0],
2912
- setPromoCode = _useState5[1];
3382
+ var _useState5 = useState(false),
3383
+ handleBookIsLoading = _useState5[0],
3384
+ setHandleBookIsLoading = _useState5[1];
2913
3385
 
2914
3386
  var _useState6 = useState(''),
2915
- promoCodeUpdated = _useState6[0],
2916
- setPromoCodeUpdated = _useState6[1];
3387
+ promoCode = _useState6[0],
3388
+ setPromoCode = _useState6[1];
2917
3389
 
2918
- var _useState7 = useState(false),
2919
- showPromoInput = _useState7[0],
2920
- setShowPromoInput = _useState7[1];
3390
+ var _useState7 = useState(''),
3391
+ promoCodeUpdated = _useState7[0],
3392
+ setPromoCodeUpdated = _useState7[1];
2921
3393
 
2922
3394
  var _useState8 = useState(false),
2923
- promoCodeIsApplied = _useState8[0],
2924
- setPromoCodeIsApplied = _useState8[1];
3395
+ showPromoInput = _useState8[0],
3396
+ setShowPromoInput = _useState8[1];
3397
+
3398
+ var _useState9 = useState(false),
3399
+ promoCodeIsApplied = _useState9[0],
3400
+ setPromoCodeIsApplied = _useState9[1];
2925
3401
 
2926
3402
  useEffect(function () {
2927
3403
  if (typeof window !== 'undefined') {
@@ -2944,8 +3420,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
2944
3420
 
2945
3421
  function _getTicketsApi() {
2946
3422
  _getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2947
- var response, attributes, _tickets;
2948
-
3423
+ var response, attributes;
2949
3424
  return runtime_1.wrap(function _callee$(_context) {
2950
3425
  while (1) {
2951
3426
  switch (_context.prev = _context.next) {
@@ -2962,10 +3437,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
2962
3437
  setCustomHeader(response);
2963
3438
  attributes = _get(response, 'data.data.attributes');
2964
3439
  setPromoCodeIsApplied(attributes.ValidPromoCode);
2965
- _tickets = _filter(Object.values(attributes) || [], function (item) {
2966
- return _isObject(item);
2967
- });
2968
- setTickets(_tickets);
3440
+ setTickets(_get(attributes, 'tickets'));
3441
+ setShowWaitingList(attributes.showWaitingList);
3442
+ onGetTicketsSuccess(response.data);
2969
3443
  }
2970
3444
 
2971
3445
  _context.next = 11;
@@ -2974,7 +3448,10 @@ var TicketsContainer = function TicketsContainer(_ref) {
2974
3448
  case 8:
2975
3449
  _context.prev = 8;
2976
3450
  _context.t0 = _context["catch"](0);
2977
- console.log('e', _context.t0);
3451
+
3452
+ if (axios.isAxiosError(_context.t0)) {
3453
+ onGetTicketsError(_context.t0);
3454
+ }
2978
3455
 
2979
3456
  case 11:
2980
3457
  _context.prev = 11;
@@ -3057,7 +3534,10 @@ var TicketsContainer = function TicketsContainer(_ref) {
3057
3534
  case 13:
3058
3535
  _context2.prev = 13;
3059
3536
  _context2.t0 = _context2["catch"](6);
3060
- console.log('e', _context2.t0);
3537
+
3538
+ if (axios.isAxiosError(_context2.t0)) {
3539
+ onAddToCartError(_context2.t0);
3540
+ }
3061
3541
 
3062
3542
  case 16:
3063
3543
  _context2.prev = 16;
@@ -3081,9 +3561,16 @@ var TicketsContainer = function TicketsContainer(_ref) {
3081
3561
  return !(item.sold_out || item.soldOut);
3082
3562
  });
3083
3563
  return React.createElement("div", {
3084
- className: "get-tickets-page",
3564
+ className: "get-tickets-page " + theme,
3085
3565
  style: contentStyle
3086
- }, isLoading ? React.createElement(Loader, null) : React.createElement("div", null, renderTiers(tickets, selectedTickets, handleTicketSelect, promoCodeIsApplied), promoCodeIsApplied ? React.createElement("div", {
3566
+ }, isLoading ? React.createElement(Loader, null) : React.createElement(React.Fragment, null, showWaitingList ? React.createElement(WaitingList, {
3567
+ tickets: tickets
3568
+ }) : React.createElement("div", null, React.createElement(TicketsSection, {
3569
+ ticketsList: tickets,
3570
+ selectedTickets: selectedTickets,
3571
+ handleTicketSelect: handleTicketSelect,
3572
+ promoCodeIsApplied: promoCodeIsApplied
3573
+ }), promoCodeIsApplied ? React.createElement("div", {
3087
3574
  className: "alert-info"
3088
3575
  }, "Your promo code was applied successfully.") : null, showPromoInput && React.createElement("div", {
3089
3576
  className: "promo-code-block"
@@ -3118,8 +3605,8 @@ var TicketsContainer = function TicketsContainer(_ref) {
3118
3605
  "aria-hidden": true,
3119
3606
  className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
3120
3607
  onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
3121
- }, getTicketsLabel || 'GET TICKETS')));
3608
+ }, getTicketsLabel || 'GET TICKETS'))));
3122
3609
  };
3123
3610
 
3124
- export { BillingInfoContainer, ConfirmationContainer, PaymentContainer, TicketsContainer, createFixedFloatNormalizer, currencyNormalizerCreator };
3611
+ export { BillingInfoContainer, ConfirmationContainer, LoginModal, PaymentContainer, TicketsContainer, createFixedFloatNormalizer, currencyNormalizerCreator };
3125
3612
  //# sourceMappingURL=tf-checkout-react.esm.js.map