tf-checkout-react 1.0.43 → 1.0.47

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 (43) hide show
  1. package/dist/api/index.d.ts +2 -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 +7 -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 +827 -269
  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 +832 -272
  21. package/dist/tf-checkout-react.esm.js.map +1 -1
  22. package/dist/types/billing-info-data.d.ts +2 -2
  23. package/dist/validators/index.d.ts +2 -1
  24. package/package.json +4 -1
  25. package/src/api/index.ts +7 -3
  26. package/src/components/billing-info-container/index.tsx +278 -70
  27. package/src/components/billing-info-container/style.css +15 -0
  28. package/src/components/billing-info-container/utils.ts +41 -13
  29. package/src/components/common/CheckboxField.tsx +3 -2
  30. package/src/components/common/CustomField.tsx +16 -1
  31. package/src/components/confirmationContainer/index.tsx +8 -3
  32. package/src/components/loginModal/index.tsx +46 -13
  33. package/src/components/paymentContainer/index.tsx +10 -0
  34. package/src/components/registerModal/index.tsx +20 -3
  35. package/src/components/ticketsContainer/TicketRow.tsx +86 -0
  36. package/src/components/ticketsContainer/TicketsSection.tsx +82 -0
  37. package/src/components/ticketsContainer/index.tsx +98 -210
  38. package/src/components/ticketsContainer/utils.ts +11 -0
  39. package/src/components/waitingList/index.tsx +162 -0
  40. package/src/components/waitingList/style.css +18 -0
  41. package/src/index.ts +2 -1
  42. package/src/types/billing-info-data.ts +2 -2
  43. package/src/validators/index.ts +9 -3
@@ -1,38 +1,39 @@
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
+ import { nanoid } from 'nanoid';
18
20
  import Container from '@mui/material/Container';
19
21
  import Alert from '@mui/material/Alert';
20
22
  import { useStripe, useElements, CardNumberElement, CardExpiryElement, CardCvcElement, Elements } from '@stripe/react-stripe-js';
21
23
  import { loadStripe } from '@stripe/stripe-js';
22
- import CircularProgress from '@mui/material/CircularProgress';
24
+ import CircularProgress$1 from '@mui/material/CircularProgress';
23
25
  import SVG from 'react-inlinesvg';
24
- import _sortBy from 'lodash-es/sortBy';
25
- import _has from 'lodash-es/has';
26
26
  import _some from 'lodash-es/some';
27
27
  import _find from 'lodash-es/find';
28
28
  import _isEmpty from 'lodash-es/isEmpty';
29
- import _filter from 'lodash-es/filter';
30
- import _isObject from 'lodash-es/isObject';
29
+ import Button$1 from 'react-bootstrap/Button';
30
+ import jwt_decode from 'jwt-decode';
31
+ import _sortBy from 'lodash-es/sortBy';
32
+ import _has from 'lodash-es/has';
31
33
  import FormControl from '@mui/material/FormControl';
32
34
  import MenuItem from '@mui/material/MenuItem';
33
35
  import Select from '@mui/material/Select';
34
- import Button$1 from 'react-bootstrap/Button';
35
- import jwt_decode from 'jwt-decode';
36
+ import Button from '@mui/material/Button';
36
37
 
37
38
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
38
39
  try {
@@ -890,9 +891,10 @@ function styleInject(css, ref) {
890
891
  }
891
892
  }
892
893
 
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}";
894
+ 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
895
  styleInject(css_248z);
895
896
 
897
+ 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
898
  var combineValidators = function combineValidators() {
897
899
  for (var _len = arguments.length, validators = new Array(_len), _key = 0; _key < _len; _key++) {
898
900
  validators[_key] = arguments[_key];
@@ -901,19 +903,22 @@ var combineValidators = function combineValidators() {
901
903
  return function () {
902
904
  for (var i = 0; i < validators.length; ++i) {
903
905
  var error_message = validators[i].apply(validators, arguments);
904
- if (error_message !== undefined) return error_message;
906
+ if (error_message) return error_message;
905
907
  }
906
908
  };
907
909
  };
908
- var requiredValidator = function requiredValidator(value) {
910
+ var requiredValidator = function requiredValidator(value, message) {
909
911
  var errorMessage = '';
910
912
 
911
913
  if (!value) {
912
- errorMessage = 'Required';
914
+ errorMessage = message || 'Required';
913
915
  }
914
916
 
915
917
  return errorMessage;
916
918
  };
919
+ var emailValidator = function emailValidator(email) {
920
+ return !emailRegex.test(email) ? 'Please enter a valid email address' : '';
921
+ };
917
922
 
918
923
  // preview1
919
924
 
@@ -935,6 +940,10 @@ if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
935
940
  ttfHeaders['Authorization-Guest'] = /*#__PURE__*/localStorage.getItem('auth_guest_token');
936
941
  }
937
942
 
943
+ if (isWindowDefined && window.location.origin !== 'https://www.houseofx.nyc' && window.location.origin !== 'https://tickets-staging.houseofx.nyc') {
944
+ ttfHeaders['X-Source-Origin'] = 'houseofx.nyc';
945
+ }
946
+
938
947
  var publicRequest = /*#__PURE__*/axios.create({
939
948
  baseURL: ENV.BASE_URL ,
940
949
  headers: ttfHeaders
@@ -978,7 +987,9 @@ publicRequest.interceptors.request.use(function (config) {
978
987
  }
979
988
 
980
989
  if (isWindowDefined && window.location.origin !== 'https://www.houseofx.nyc' && window.location.origin !== 'https://tickets-staging.houseofx.nyc') {
981
- var _updatedHeaders2 = _extends({}, config.headers);
990
+ var _updatedHeaders2 = _extends({}, config.headers, {
991
+ 'X-Source-Origin': 'houseofx.nyc'
992
+ });
982
993
 
983
994
  config.headers = _updatedHeaders2;
984
995
  }
@@ -1084,6 +1095,12 @@ var getConfirmationData = function getConfirmationData(orderHash) {
1084
1095
  var getStates = function getStates(countryId) {
1085
1096
  return publicRequest.get("/countries/" + countryId + "/states/");
1086
1097
  };
1098
+ var addToWaitingList = function addToWaitingList(id, data) {
1099
+ return publicRequest.post("/v1/event/" + id + "/add_to_waiting_list", data);
1100
+ };
1101
+ var getConditions = function getConditions(eventId) {
1102
+ return publicRequest.get("v1/event/" + eventId + "/conditions");
1103
+ };
1087
1104
 
1088
1105
  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
1106
  styleInject(css_248z$1);
@@ -1101,9 +1118,18 @@ var style = {
1101
1118
  var LoginModal = function LoginModal(_ref) {
1102
1119
  var onClose = _ref.onClose,
1103
1120
  onLogin = _ref.onLogin,
1104
- alreadyHasUser = _ref.alreadyHasUser,
1105
- userExpired = _ref.userExpired,
1106
- setUserExpired = _ref.setUserExpired;
1121
+ _ref$alreadyHasUser = _ref.alreadyHasUser,
1122
+ alreadyHasUser = _ref$alreadyHasUser === void 0 ? false : _ref$alreadyHasUser,
1123
+ _ref$userExpired = _ref.userExpired,
1124
+ userExpired = _ref$userExpired === void 0 ? false : _ref$userExpired,
1125
+ _ref$onAuthorizeSucce = _ref.onAuthorizeSuccess,
1126
+ onAuthorizeSuccess = _ref$onAuthorizeSucce === void 0 ? function () {} : _ref$onAuthorizeSucce,
1127
+ _ref$onAuthorizeError = _ref.onAuthorizeError,
1128
+ onAuthorizeError = _ref$onAuthorizeError === void 0 ? function () {} : _ref$onAuthorizeError,
1129
+ _ref$onGetProfileData = _ref.onGetProfileDataSuccess,
1130
+ onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? function () {} : _ref$onGetProfileData,
1131
+ _ref$onGetProfileData2 = _ref.onGetProfileDataError,
1132
+ onGetProfileDataError = _ref$onGetProfileData2 === void 0 ? function () {} : _ref$onGetProfileData2;
1107
1133
 
1108
1134
  var _useState = useState(''),
1109
1135
  error = _useState[0],
@@ -1123,7 +1149,7 @@ var LoginModal = function LoginModal(_ref) {
1123
1149
  },
1124
1150
  onSubmit: function () {
1125
1151
  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;
1152
+ var email, password, bodyFormData, resAutorize, bodyFormDataToken, resAccessToken, accessToken, profileResponse, profileSpecifiedData, profileDataObj, _e$response, _e$response$data, _error;
1127
1153
 
1128
1154
  return runtime_1.wrap(function _callee$(_context) {
1129
1155
  while (1) {
@@ -1145,19 +1171,53 @@ var LoginModal = function LoginModal(_ref) {
1145
1171
  bodyFormDataToken.append('grant_type', 'authorization_code');
1146
1172
  bodyFormDataToken.append('client_id', ENV.CLIENT_ID );
1147
1173
  bodyFormDataToken.append('client_secret', ENV.CLIENT_SECRET );
1148
- _context.next = 16;
1174
+ resAccessToken = null;
1175
+ _context.prev = 15;
1176
+ _context.next = 18;
1149
1177
  return getAccessToken(bodyFormDataToken);
1150
1178
 
1151
- case 16:
1179
+ case 18:
1152
1180
  resAccessToken = _context.sent;
1181
+ onAuthorizeSuccess(resAccessToken.data);
1182
+ _context.next = 26;
1183
+ break;
1184
+
1185
+ case 22:
1186
+ _context.prev = 22;
1187
+ _context.t0 = _context["catch"](15);
1188
+
1189
+ if (axios.isAxiosError(_context.t0)) {
1190
+ onAuthorizeError(_context.t0);
1191
+ }
1192
+
1193
+ return _context.abrupt("return");
1194
+
1195
+ case 26:
1153
1196
  accessToken = _get(resAccessToken, 'data.access_token');
1154
1197
  handleSetAccessToken(accessToken);
1155
- _context.next = 21;
1198
+ profileResponse = null;
1199
+ _context.prev = 29;
1200
+ _context.next = 32;
1156
1201
  return getProfileData(accessToken);
1157
1202
 
1158
- case 21:
1159
- profileData = _context.sent;
1160
- profileSpecifiedData = _get(profileData, 'data.data');
1203
+ case 32:
1204
+ profileResponse = _context.sent;
1205
+ onGetProfileDataSuccess(profileResponse.data);
1206
+ _context.next = 40;
1207
+ break;
1208
+
1209
+ case 36:
1210
+ _context.prev = 36;
1211
+ _context.t1 = _context["catch"](29);
1212
+
1213
+ if (axios.isAxiosError(_context.t1)) {
1214
+ onGetProfileDataError(_context.t1);
1215
+ }
1216
+
1217
+ return _context.abrupt("return");
1218
+
1219
+ case 40:
1220
+ profileSpecifiedData = _get(profileResponse, 'data.data');
1161
1221
  profileDataObj = {
1162
1222
  id: profileSpecifiedData.id,
1163
1223
  first_name: profileSpecifiedData.firstName,
@@ -1170,28 +1230,27 @@ var LoginModal = function LoginModal(_ref) {
1170
1230
  window.localStorage.setItem('access_token', accessToken);
1171
1231
  }
1172
1232
 
1173
- setUserExpired(false);
1174
1233
  onLogin();
1175
- _context.next = 32;
1234
+ _context.next = 49;
1176
1235
  break;
1177
1236
 
1178
- case 29:
1179
- _context.prev = 29;
1180
- _context.t0 = _context["catch"](1);
1237
+ case 46:
1238
+ _context.prev = 46;
1239
+ _context.t2 = _context["catch"](1);
1181
1240
 
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';
1241
+ if (axios.isAxiosError(_context.t2)) {
1242
+ _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
1243
  setError(_error);
1185
- } else if (_context.t0 instanceof Error) {
1186
- setError((_context.t0 == null ? void 0 : _context.t0.message) || 'Error');
1244
+ } else if (_context.t2 instanceof Error) {
1245
+ setError((_context.t2 == null ? void 0 : _context.t2.message) || 'Error');
1187
1246
  }
1188
1247
 
1189
- case 32:
1248
+ case 49:
1190
1249
  case "end":
1191
1250
  return _context.stop();
1192
1251
  }
1193
1252
  }
1194
- }, _callee, null, [[1, 29]]);
1253
+ }, _callee, null, [[1, 46], [15, 22], [29, 36]]);
1195
1254
  }));
1196
1255
 
1197
1256
  function onSubmit(_x) {
@@ -1255,7 +1314,11 @@ var css_248z$2 = ".style_register-container___s5V8{margin:0 auto;max-width:800px
1255
1314
  styleInject(css_248z$2);
1256
1315
 
1257
1316
  var RegisterModal = function RegisterModal(_ref) {
1258
- var onClose = _ref.onClose;
1317
+ var onClose = _ref.onClose,
1318
+ _ref$onGetProfileData = _ref.onGetProfileDataSuccess,
1319
+ onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? function () {} : _ref$onGetProfileData,
1320
+ _ref$onGetProfileData2 = _ref.onGetProfileDataError,
1321
+ onGetProfileDataError = _ref$onGetProfileData2 === void 0 ? function () {} : _ref$onGetProfileData2;
1259
1322
  return React.createElement("div", {
1260
1323
  style: {
1261
1324
  display: 'flex',
@@ -1279,7 +1342,7 @@ var RegisterModal = function RegisterModal(_ref) {
1279
1342
  },
1280
1343
  onSubmit: function () {
1281
1344
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
1282
- var firstName, lastName, email, password, confirmPassword, bodyFormData, resRegister, access_token, profileData, profileSpecifiedData, profileDataObj;
1345
+ var firstName, lastName, email, password, confirmPassword, bodyFormData, resRegister, access_token, profileResponse, profileSpecifiedData, profileDataObj;
1283
1346
  return runtime_1.wrap(function _callee$(_context) {
1284
1347
  while (1) {
1285
1348
  switch (_context.prev = _context.next) {
@@ -1300,12 +1363,25 @@ var RegisterModal = function RegisterModal(_ref) {
1300
1363
  resRegister = _context.sent;
1301
1364
  access_token = _get(resRegister, 'data.data.attributes.access_token');
1302
1365
  handleSetAccessToken(access_token);
1303
- _context.next = 16;
1366
+ profileResponse = null;
1367
+ _context.prev = 15;
1368
+ _context.next = 18;
1304
1369
  return getProfileData(access_token);
1305
1370
 
1306
- case 16:
1307
- profileData = _context.sent;
1308
- profileSpecifiedData = _get(profileData, 'data.data');
1371
+ case 18:
1372
+ profileResponse = _context.sent;
1373
+ onGetProfileDataSuccess(profileResponse.data);
1374
+ _context.next = 26;
1375
+ break;
1376
+
1377
+ case 22:
1378
+ _context.prev = 22;
1379
+ _context.t0 = _context["catch"](15);
1380
+ onGetProfileDataError(_context.t0.response);
1381
+ return _context.abrupt("return");
1382
+
1383
+ case 26:
1384
+ profileSpecifiedData = _get(profileResponse, 'data.data');
1309
1385
  profileDataObj = {
1310
1386
  id: profileSpecifiedData.id,
1311
1387
  first_name: profileSpecifiedData.firstName,
@@ -1320,12 +1396,12 @@ var RegisterModal = function RegisterModal(_ref) {
1320
1396
 
1321
1397
  onClose();
1322
1398
 
1323
- case 21:
1399
+ case 30:
1324
1400
  case "end":
1325
1401
  return _context.stop();
1326
1402
  }
1327
1403
  }
1328
- }, _callee);
1404
+ }, _callee, null, [[15, 22]]);
1329
1405
  }));
1330
1406
 
1331
1407
  function onSubmit(_x) {
@@ -1429,8 +1505,8 @@ var RegisterModal = function RegisterModal(_ref) {
1429
1505
  }));
1430
1506
  };
1431
1507
 
1432
- var _excluded = ["holderAge", "firstName", "lastName", "confirmEmail", "confirmPassword", "holderFirstName", "holderLastName"];
1433
- var getInitialValues = function getInitialValues(data, propsInitialValues) {
1508
+ var _excluded = ["firstName", "lastName", "holderAge", "confirmEmail", "confirmPassword"];
1509
+ var getInitialValues = function getInitialValues(data, propsInitialValues, userValues) {
1434
1510
  if (data === void 0) {
1435
1511
  data = [];
1436
1512
  }
@@ -1439,6 +1515,10 @@ var getInitialValues = function getInitialValues(data, propsInitialValues) {
1439
1515
  propsInitialValues = {};
1440
1516
  }
1441
1517
 
1518
+ if (userValues === void 0) {
1519
+ userValues = {};
1520
+ }
1521
+
1442
1522
  var results = _flatMapDeep(data, function (_ref) {
1443
1523
  var fields = _ref.fields;
1444
1524
  return _map(fields, function (_ref2) {
@@ -1453,7 +1533,7 @@ var getInitialValues = function getInitialValues(data, propsInitialValues) {
1453
1533
  var initialValues = {};
1454
1534
 
1455
1535
  _forEach(results, function (item) {
1456
- initialValues[item] = propsInitialValues[item] || '';
1536
+ initialValues[item] = propsInitialValues[item] || userValues[item] || '';
1457
1537
  });
1458
1538
 
1459
1539
  return initialValues;
@@ -1487,7 +1567,7 @@ var setLoggedUserData = function setLoggedUserData(data) {
1487
1567
  zip: (data == null ? void 0 : data.zip) || (data == null ? void 0 : data.zipCode) || ''
1488
1568
  };
1489
1569
  };
1490
- var createCheckoutDataBody = function createCheckoutDataBody(values, logedInValues, includeDob) {
1570
+ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, values, logedInValues, includeDob) {
1491
1571
  if (values === void 0) {
1492
1572
  values = {};
1493
1573
  }
@@ -1501,23 +1581,52 @@ var createCheckoutDataBody = function createCheckoutDataBody(values, logedInValu
1501
1581
  }
1502
1582
 
1503
1583
  var _values = values,
1504
- holderAge = _values.holderAge,
1505
1584
  firstName = _values.firstName,
1506
1585
  lastName = _values.lastName,
1507
- holderFirstName = _values.holderFirstName,
1508
- holderLastName = _values.holderLastName,
1586
+ holderAge = _values.holderAge,
1509
1587
  restValues = _objectWithoutPropertiesLoose(_values, _excluded);
1510
1588
 
1589
+ var holders = [];
1590
+ var ticket_holders = [];
1591
+
1592
+ var _loop = function _loop(i) {
1593
+ var individualHolder = Object.fromEntries(Object.entries(values).filter(function (_ref4) {
1594
+ var key = _ref4[0];
1595
+ return key.includes(String(i));
1596
+ }));
1597
+ holders.push(individualHolder);
1598
+ };
1599
+
1600
+ for (var i = 0; i <= ticketsQuantity; i++) {
1601
+ _loop(i);
1602
+ }
1603
+
1604
+ var filteredHolders = holders.filter(function (holder) {
1605
+ return Object.entries(holder).length > 0;
1606
+ });
1607
+ ticket_holders = filteredHolders.map(function (item, index) {
1608
+ return {
1609
+ first_name: item["holderFirstName-" + index] || '',
1610
+ last_name: item["holderLastName-" + index] || '',
1611
+ phone: item["holderPhone-" + index] || '',
1612
+ email: item["holderEmail-" + index] || ''
1613
+ };
1614
+ });
1615
+ var filteredRestValue = {};
1616
+
1617
+ _forEach(restValues, function (value, key) {
1618
+ if (!key.includes('holder')) {
1619
+ filteredRestValue[key] = value;
1620
+ }
1621
+ });
1622
+
1511
1623
  var body = {
1512
- attributes: _extends({}, restValues, {
1624
+ attributes: _extends({}, filteredRestValue, {
1513
1625
  email: restValues.email || logedInValues.emailLogged,
1514
1626
  confirm_email: restValues.email || logedInValues.emailLogged,
1515
1627
  first_name: firstName || logedInValues.firstNameLogged,
1516
1628
  last_name: lastName || logedInValues.lastNameLogged,
1517
- ticket_holders: [{
1518
- first_name: holderFirstName,
1519
- last_name: holderLastName
1520
- }]
1629
+ ticket_holders: ticket_holders
1521
1630
  })
1522
1631
  };
1523
1632
 
@@ -1531,6 +1640,13 @@ var createCheckoutDataBody = function createCheckoutDataBody(values, logedInValu
1531
1640
  return body;
1532
1641
  };
1533
1642
 
1643
+ var useStyles = /*#__PURE__*/makeStyles({
1644
+ input: {
1645
+ "&::placeholder": {
1646
+ color: "gray"
1647
+ }
1648
+ }
1649
+ });
1534
1650
  var CustomField = function CustomField(_ref) {
1535
1651
  var label = _ref.label,
1536
1652
  _ref$type = _ref.type,
@@ -1547,6 +1663,7 @@ var CustomField = function CustomField(_ref) {
1547
1663
 
1548
1664
  var error = _get(errors, field.name);
1549
1665
 
1666
+ var classes = useStyles();
1550
1667
  return React.createElement(TextField$1, Object.assign({
1551
1668
  id: field.name,
1552
1669
  label: label,
@@ -1558,22 +1675,31 @@ var CustomField = function CustomField(_ref) {
1558
1675
  InputLabelProps: {
1559
1676
  shrink: isShrink
1560
1677
  },
1678
+ InputProps: {
1679
+ classes: {
1680
+ input: classes.input
1681
+ }
1682
+ },
1561
1683
  SelectProps: {
1562
1684
  "native": true
1563
1685
  }
1564
1686
  }, field), isSelectField ? _map(selectOptions, function (option) {
1565
1687
  return React.createElement("option", {
1566
1688
  key: option.value,
1567
- value: option.value
1689
+ value: option.value,
1690
+ disabled: option.disabled
1568
1691
  }, option.label);
1569
1692
  }) : null);
1570
1693
  };
1571
1694
 
1695
+ var _excluded$1 = ["label", "field"];
1572
1696
  var CheckboxField = function CheckboxField(_ref) {
1573
1697
  var label = _ref.label,
1574
- field = _ref.field;
1698
+ field = _ref.field,
1699
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
1700
+
1575
1701
  return React.createElement(FormGroup, null, React.createElement(FormControlLabel, {
1576
- control: React.createElement(Checkbox, Object.assign({}, field)),
1702
+ control: React.createElement(Checkbox, Object.assign({}, field, rest)),
1577
1703
  label: label
1578
1704
  }));
1579
1705
  };
@@ -1600,7 +1726,9 @@ var LogicRunner = function LogicRunner(_ref) {
1600
1726
  setStates = _ref.setStates,
1601
1727
  setFieldValue = _ref.setFieldValue,
1602
1728
  setValues = _ref.setValues,
1603
- setUserValues = _ref.setUserValues;
1729
+ setUserValues = _ref.setUserValues,
1730
+ onGetStatesSuccess = _ref.onGetStatesSuccess,
1731
+ onGetStatesError = _ref.onGetStatesError;
1604
1732
  useEffect(function () {
1605
1733
  var fetchStates = /*#__PURE__*/function () {
1606
1734
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -1624,19 +1752,24 @@ var LogicRunner = function LogicRunner(_ref) {
1624
1752
  });
1625
1753
  setStates(mappedStates);
1626
1754
  setFieldValue('state', (_mappedStates$0$label = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.label) != null ? _mappedStates$0$label : '');
1627
- _context.next = 11;
1755
+ onGetStatesSuccess(res.data);
1756
+ _context.next = 13;
1628
1757
  break;
1629
1758
 
1630
- case 9:
1631
- _context.prev = 9;
1759
+ case 10:
1760
+ _context.prev = 10;
1632
1761
  _context.t0 = _context["catch"](0);
1633
1762
 
1634
- case 11:
1763
+ if (axios.isAxiosError(_context.t0)) {
1764
+ onGetStatesError(_context.t0);
1765
+ }
1766
+
1767
+ case 13:
1635
1768
  case "end":
1636
1769
  return _context.stop();
1637
1770
  }
1638
1771
  }
1639
- }, _callee, null, [[0, 9]]);
1772
+ }, _callee, null, [[0, 10]]);
1640
1773
  }));
1641
1774
 
1642
1775
  return function fetchStates() {
@@ -1660,9 +1793,6 @@ var LogicRunner = function LogicRunner(_ref) {
1660
1793
  email: (parsedData == null ? void 0 : parsedData.email) || '',
1661
1794
  phone: (parsedData == null ? void 0 : parsedData.phone) || '',
1662
1795
  confirmEmail: '',
1663
- holderFirstName: '',
1664
- holderLastName: '',
1665
- holderAge: '',
1666
1796
  state: (parsedData == null ? void 0 : parsedData.state) || '',
1667
1797
  street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
1668
1798
  country: (parsedData == null ? void 0 : parsedData.country) || 1,
@@ -1674,9 +1804,7 @@ var LogicRunner = function LogicRunner(_ref) {
1674
1804
  };
1675
1805
  setValues(mappedValues);
1676
1806
  setUserValues(mappedValues);
1677
- } catch (e) {
1678
- console.log(e);
1679
- }
1807
+ } catch (e) {}
1680
1808
  }
1681
1809
  }
1682
1810
  };
@@ -1694,6 +1822,11 @@ var SectionContainer = function SectionContainer(_ref3) {
1694
1822
  var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1695
1823
  var _ref4$data = _ref4.data,
1696
1824
  data = _ref4$data === void 0 ? [] : _ref4$data,
1825
+ _ref4$ticketHoldersFi = _ref4.ticketHoldersFields,
1826
+ ticketHoldersFields = _ref4$ticketHoldersFi === void 0 ? {
1827
+ id: 1,
1828
+ fields: []
1829
+ } : _ref4$ticketHoldersFi,
1697
1830
  _ref4$initialValues = _ref4.initialValues,
1698
1831
  initialValues = _ref4$initialValues === void 0 ? {} : _ref4$initialValues,
1699
1832
  _ref4$buttonName = _ref4.buttonName,
@@ -1701,7 +1834,35 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1701
1834
  _ref4$handleSubmit = _ref4.handleSubmit,
1702
1835
  handleSubmit = _ref4$handleSubmit === void 0 ? _identity : _ref4$handleSubmit,
1703
1836
  _ref4$theme = _ref4.theme,
1704
- theme = _ref4$theme === void 0 ? 'light' : _ref4$theme;
1837
+ theme = _ref4$theme === void 0 ? 'light' : _ref4$theme,
1838
+ _ref4$onRegisterSucce = _ref4.onRegisterSuccess,
1839
+ onRegisterSuccess = _ref4$onRegisterSucce === void 0 ? function () {} : _ref4$onRegisterSucce,
1840
+ _ref4$onRegisterError = _ref4.onRegisterError,
1841
+ onRegisterError = _ref4$onRegisterError === void 0 ? function () {} : _ref4$onRegisterError,
1842
+ _ref4$onSubmitError = _ref4.onSubmitError,
1843
+ onSubmitError = _ref4$onSubmitError === void 0 ? function () {} : _ref4$onSubmitError,
1844
+ _ref4$onGetCartSucces = _ref4.onGetCartSuccess,
1845
+ onGetCartSuccess = _ref4$onGetCartSucces === void 0 ? function () {} : _ref4$onGetCartSucces,
1846
+ _ref4$onGetCartError = _ref4.onGetCartError,
1847
+ onGetCartError = _ref4$onGetCartError === void 0 ? function () {} : _ref4$onGetCartError,
1848
+ _ref4$onGetCountriesS = _ref4.onGetCountriesSuccess,
1849
+ onGetCountriesSuccess = _ref4$onGetCountriesS === void 0 ? function () {} : _ref4$onGetCountriesS,
1850
+ _ref4$onGetCountriesE = _ref4.onGetCountriesError,
1851
+ onGetCountriesError = _ref4$onGetCountriesE === void 0 ? function () {} : _ref4$onGetCountriesE,
1852
+ _ref4$onGetStatesSucc = _ref4.onGetStatesSuccess,
1853
+ onGetStatesSuccess = _ref4$onGetStatesSucc === void 0 ? function () {} : _ref4$onGetStatesSucc,
1854
+ _ref4$onGetStatesErro = _ref4.onGetStatesError,
1855
+ onGetStatesError = _ref4$onGetStatesErro === void 0 ? function () {} : _ref4$onGetStatesErro,
1856
+ _ref4$onGetProfileDat = _ref4.onGetProfileDataSuccess,
1857
+ onGetProfileDataSuccess = _ref4$onGetProfileDat === void 0 ? function () {} : _ref4$onGetProfileDat,
1858
+ _ref4$onGetProfileDat2 = _ref4.onGetProfileDataError,
1859
+ onGetProfileDataError = _ref4$onGetProfileDat2 === void 0 ? function () {} : _ref4$onGetProfileDat2,
1860
+ _ref4$onAuthorizeSucc = _ref4.onAuthorizeSuccess,
1861
+ onAuthorizeSuccess = _ref4$onAuthorizeSucc === void 0 ? function () {} : _ref4$onAuthorizeSucc,
1862
+ _ref4$onAuthorizeErro = _ref4.onAuthorizeError,
1863
+ onAuthorizeError = _ref4$onAuthorizeErro === void 0 ? function () {} : _ref4$onAuthorizeErro,
1864
+ _ref4$onLogin = _ref4.onLogin,
1865
+ onLogin = _ref4$onLogin === void 0 ? function () {} : _ref4$onLogin;
1705
1866
  var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
1706
1867
  var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
1707
1868
 
@@ -1733,7 +1894,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1733
1894
  showModalRegister = _useState7[0],
1734
1895
  setShowModalRegister = _useState7[1];
1735
1896
 
1736
- var _useState8 = useState({
1897
+ var _useState8 = useState([]),
1898
+ ticketsQuantity = _useState8[0],
1899
+ setTicketsQuantity = _useState8[1];
1900
+
1901
+ var _useState9 = useState([]),
1902
+ conditions = _useState9[0],
1903
+ setConditions = _useState9[1];
1904
+
1905
+ var _useState10 = useState({
1737
1906
  firstName: '',
1738
1907
  lastName: '',
1739
1908
  email: '',
@@ -1748,8 +1917,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1748
1917
  state: '',
1749
1918
  zip: ''
1750
1919
  }),
1751
- userValues = _useState8[0],
1752
- setUserValues = _useState8[1];
1920
+ userValues = _useState10[0],
1921
+ setUserValues = _useState10[1];
1753
1922
 
1754
1923
  var isLoggedIn = !!access_token;
1755
1924
 
@@ -1761,132 +1930,216 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1761
1930
 
1762
1931
  var showDOB = getQueryVariable('age_required') === 'true';
1763
1932
  var showTicketHolderName = getQueryVariable('names_required') === 'true';
1933
+ var eventId = getQueryVariable('event_id');
1764
1934
 
1765
- var optedInFieldValue = _get(cartInfoData, 'optedIn', false); // fetch cart data
1935
+ var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
1766
1936
 
1937
+ var hideOptIn = _get(cartInfoData, 'hide_ttf_opt_in', false);
1938
+
1939
+ var getQuantity = function getQuantity(cart) {
1940
+ if (cart === void 0) {
1941
+ cart = [];
1942
+ }
1943
+
1944
+ var qty = 0;
1945
+ cart.forEach(function (item) {
1946
+ qty += +item.quantity;
1947
+ });
1948
+ return qty;
1949
+ }; //just once
1950
+
1951
+
1952
+ useEffect(function () {
1953
+ // fetch conditions data
1954
+ var fetchConditions = /*#__PURE__*/function () {
1955
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1956
+ var res, conditionsInfo;
1957
+ return runtime_1.wrap(function _callee2$(_context2) {
1958
+ while (1) {
1959
+ switch (_context2.prev = _context2.next) {
1960
+ case 0:
1961
+ if (!eventId) {
1962
+ _context2.next = 6;
1963
+ break;
1964
+ }
1965
+
1966
+ _context2.next = 3;
1967
+ return getConditions(eventId);
1968
+
1969
+ case 3:
1970
+ res = _context2.sent;
1971
+ conditionsInfo = _get(res, 'data.data.attributes');
1972
+ setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
1973
+ return {
1974
+ id: nanoid(),
1975
+ text: item
1976
+ };
1977
+ }) : []);
1978
+
1979
+ case 6:
1980
+ case "end":
1981
+ return _context2.stop();
1982
+ }
1983
+ }
1984
+ }, _callee2);
1985
+ }));
1986
+
1987
+ return function fetchConditions() {
1988
+ return _ref5.apply(this, arguments);
1989
+ };
1990
+ }();
1991
+
1992
+ fetchConditions(); // fetch countries data
1993
+
1994
+ var fetchCountries = /*#__PURE__*/function () {
1995
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
1996
+ var res;
1997
+ return runtime_1.wrap(function _callee3$(_context3) {
1998
+ while (1) {
1999
+ switch (_context3.prev = _context3.next) {
2000
+ case 0:
2001
+ _context3.prev = 0;
2002
+ _context3.next = 3;
2003
+ return getCountries();
2004
+
2005
+ case 3:
2006
+ res = _context3.sent;
2007
+ setCustomHeader(res);
2008
+ setCountries(_map(_get(res, 'data.data'), function (item, key) {
2009
+ return {
2010
+ label: item,
2011
+ value: Number(key)
2012
+ };
2013
+ }));
2014
+ onGetCountriesSuccess(res.data);
2015
+ _context3.next = 12;
2016
+ break;
2017
+
2018
+ case 9:
2019
+ _context3.prev = 9;
2020
+ _context3.t0 = _context3["catch"](0);
2021
+
2022
+ if (axios.isAxiosError(_context3.t0)) {
2023
+ onGetCountriesError(_context3.t0);
2024
+ }
2025
+
2026
+ case 12:
2027
+ case "end":
2028
+ return _context3.stop();
2029
+ }
2030
+ }
2031
+ }, _callee3, null, [[0, 9]]);
2032
+ }));
2033
+
2034
+ return function fetchCountries() {
2035
+ return _ref6.apply(this, arguments);
2036
+ };
2037
+ }();
2038
+
2039
+ fetchCountries();
2040
+ fetchCart();
2041
+ }, []); // fetch cart data
1767
2042
 
1768
2043
  var fetchCart = /*#__PURE__*/function () {
1769
- var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1770
- var res;
1771
- return runtime_1.wrap(function _callee2$(_context2) {
2044
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
2045
+ var res, cartInfo, _cartInfo$cart, cart;
2046
+
2047
+ return runtime_1.wrap(function _callee4$(_context4) {
1772
2048
  while (1) {
1773
- switch (_context2.prev = _context2.next) {
2049
+ switch (_context4.prev = _context4.next) {
1774
2050
  case 0:
1775
- _context2.prev = 0;
1776
- _context2.next = 3;
2051
+ _context4.prev = 0;
2052
+ _context4.next = 3;
1777
2053
  return getCart();
1778
2054
 
1779
2055
  case 3:
1780
- res = _context2.sent;
2056
+ res = _context4.sent;
1781
2057
  setCustomHeader(res);
1782
- setCartInfo(_get(res, 'data.data.attributes'));
1783
- _context2.next = 10;
2058
+ cartInfo = _get(res, 'data.data.attributes');
2059
+ setCartInfo(cartInfo);
2060
+ _cartInfo$cart = cartInfo.cart, cart = _cartInfo$cart === void 0 ? [] : _cartInfo$cart;
2061
+ setTicketsQuantity(new Array(getQuantity(cart)).fill(null).map(function () {
2062
+ return nanoid();
2063
+ }));
2064
+ onGetCartSuccess(res.data);
2065
+ _context4.next = 15;
1784
2066
  break;
1785
2067
 
1786
- case 8:
1787
- _context2.prev = 8;
1788
- _context2.t0 = _context2["catch"](0);
2068
+ case 12:
2069
+ _context4.prev = 12;
2070
+ _context4.t0 = _context4["catch"](0);
1789
2071
 
1790
- case 10:
2072
+ if (axios.isAxiosError(_context4.t0)) {
2073
+ onGetCartError(_context4.t0);
2074
+ }
2075
+
2076
+ case 15:
1791
2077
  case "end":
1792
- return _context2.stop();
2078
+ return _context4.stop();
1793
2079
  }
1794
2080
  }
1795
- }, _callee2, null, [[0, 8]]);
2081
+ }, _callee4, null, [[0, 12]]);
1796
2082
  }));
1797
2083
 
1798
2084
  return function fetchCart() {
1799
- return _ref5.apply(this, arguments);
2085
+ return _ref7.apply(this, arguments);
1800
2086
  };
1801
2087
  }(); // fetch user data
1802
2088
 
1803
2089
 
1804
2090
  var fetchUserData = /*#__PURE__*/function () {
1805
- var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(token) {
2091
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(token) {
1806
2092
  var userDataResponse, profileSpecifiedData, profileDataObj;
1807
- return runtime_1.wrap(function _callee3$(_context3) {
2093
+ return runtime_1.wrap(function _callee5$(_context5) {
1808
2094
  while (1) {
1809
- switch (_context3.prev = _context3.next) {
2095
+ switch (_context5.prev = _context5.next) {
1810
2096
  case 0:
1811
- _context3.prev = 0;
2097
+ _context5.prev = 0;
1812
2098
 
1813
2099
  if (!(typeof window !== 'undefined' && token)) {
1814
- _context3.next = 9;
2100
+ _context5.next = 10;
1815
2101
  break;
1816
2102
  }
1817
2103
 
1818
- _context3.next = 4;
2104
+ _context5.next = 4;
1819
2105
  return getProfileData(token);
1820
2106
 
1821
2107
  case 4:
1822
- userDataResponse = _context3.sent;
2108
+ userDataResponse = _context5.sent;
1823
2109
  profileSpecifiedData = _get(userDataResponse, 'data.data');
1824
2110
  profileDataObj = setLoggedUserData(profileSpecifiedData);
1825
2111
  setUserValues(profileDataObj);
1826
2112
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
2113
+ onGetProfileDataSuccess(userDataResponse.data);
1827
2114
 
1828
- case 9:
1829
- _context3.next = 13;
2115
+ case 10:
2116
+ _context5.next = 15;
1830
2117
  break;
1831
2118
 
1832
- case 11:
1833
- _context3.prev = 11;
1834
- _context3.t0 = _context3["catch"](0);
2119
+ case 12:
2120
+ _context5.prev = 12;
2121
+ _context5.t0 = _context5["catch"](0);
1835
2122
 
1836
- case 13:
2123
+ if (axios.isAxiosError(_context5.t0)) {
2124
+ onGetProfileDataError(_context5.t0);
2125
+ }
2126
+
2127
+ case 15:
1837
2128
  case "end":
1838
- return _context3.stop();
2129
+ return _context5.stop();
1839
2130
  }
1840
2131
  }
1841
- }, _callee3, null, [[0, 11]]);
2132
+ }, _callee5, null, [[0, 12]]);
1842
2133
  }));
1843
2134
 
1844
2135
  return function fetchUserData(_x) {
1845
- return _ref6.apply(this, arguments);
2136
+ return _ref8.apply(this, arguments);
1846
2137
  };
1847
2138
  }();
1848
2139
 
1849
2140
  useEffect(function () {
1850
- fetchCart();
1851
- fetchUserData(access_token); // fetch countries data
1852
-
1853
- var fetchCountries = /*#__PURE__*/function () {
1854
- var _ref7 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
1855
- var res;
1856
- return runtime_1.wrap(function _callee4$(_context4) {
1857
- while (1) {
1858
- switch (_context4.prev = _context4.next) {
1859
- case 0:
1860
- _context4.next = 2;
1861
- return getCountries();
1862
-
1863
- case 2:
1864
- res = _context4.sent;
1865
- setCustomHeader(res);
1866
- setCountries(_map(_get(res, 'data.data'), function (item, key) {
1867
- return {
1868
- label: item,
1869
- value: Number(key)
1870
- };
1871
- }));
1872
-
1873
- case 5:
1874
- case "end":
1875
- return _context4.stop();
1876
- }
1877
- }
1878
- }, _callee4);
1879
- }));
1880
-
1881
- return function fetchCountries() {
1882
- return _ref7.apply(this, arguments);
1883
- };
1884
- }();
1885
-
1886
- if (!(countries && countries.length)) {
1887
- fetchCountries();
1888
- }
1889
- }, [access_token, countries]);
2141
+ fetchUserData(access_token);
2142
+ }, [access_token]);
1890
2143
  return React.createElement(React.Fragment, null, React.createElement(Formik, {
1891
2144
  initialValues: getInitialValues(data, _extends({}, initialValues, {
1892
2145
  email: emailLogged,
@@ -1894,33 +2147,33 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1894
2147
  lastName: lastNameLogged,
1895
2148
  country: 1,
1896
2149
  brand_opt_in: optedInFieldValue
1897
- })),
2150
+ }), userValues),
1898
2151
  enableReinitialize: true,
1899
2152
  onSubmit: function () {
1900
- 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;
2153
+ var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
2154
+ 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
2155
 
1903
- return runtime_1.wrap(function _callee5$(_context5) {
2156
+ return runtime_1.wrap(function _callee6$(_context6) {
1904
2157
  while (1) {
1905
- switch (_context5.prev = _context5.next) {
2158
+ switch (_context6.prev = _context6.next) {
1906
2159
  case 0:
1907
- _context5.prev = 0;
2160
+ _context6.prev = 0;
1908
2161
 
1909
2162
  if (!isLoggedIn) {
1910
- _context5.next = 15;
2163
+ _context6.next = 15;
1911
2164
  break;
1912
2165
  }
1913
2166
 
1914
2167
  if (!access_token) {
1915
- _context5.next = 9;
2168
+ _context6.next = 9;
1916
2169
  break;
1917
2170
  }
1918
2171
 
1919
- _context5.next = 5;
2172
+ _context6.next = 5;
1920
2173
  return getProfileData(access_token);
1921
2174
 
1922
2175
  case 5:
1923
- updatedUserData = _context5.sent;
2176
+ updatedUserData = _context6.sent;
1924
2177
  _profileSpecifiedData = _get(updatedUserData, 'data.data');
1925
2178
  _profileDataObj = setLoggedUserData(_profileSpecifiedData);
1926
2179
 
@@ -1929,33 +2182,71 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1929
2182
  }
1930
2183
 
1931
2184
  case 9:
1932
- _checkoutBody = createCheckoutDataBody(values, {
2185
+ _checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
1933
2186
  emailLogged: emailLogged,
1934
2187
  firstNameLogged: firstNameLogged,
1935
2188
  lastNameLogged: lastNameLogged
1936
2189
  }, showDOB);
1937
- _context5.next = 12;
2190
+ _context6.next = 12;
1938
2191
  return postOnCheckout(_checkoutBody, access_token);
1939
2192
 
1940
2193
  case 12:
1941
- _res = _context5.sent;
2194
+ _res = _context6.sent;
1942
2195
  handleSubmit(values, formikHelpers, _res);
1943
- return _context5.abrupt("return");
2196
+ return _context6.abrupt("return");
1944
2197
 
1945
2198
  case 15:
1946
2199
  bodyFormData = createRegisterFormData(values);
1947
- _context5.next = 18;
2200
+ access_token_register = null;
2201
+ _context6.prev = 17;
2202
+ _context6.next = 20;
1948
2203
  return register(bodyFormData);
1949
2204
 
1950
- case 18:
1951
- resRegister = _context5.sent;
2205
+ case 20:
2206
+ resRegister = _context6.sent;
1952
2207
  access_token_register = _get(resRegister, 'data.data.attributes.access_token');
2208
+ refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
1953
2209
  handleSetAccessToken(access_token_register);
1954
- _context5.next = 23;
2210
+ tokens = {
2211
+ accessToken: access_token_register,
2212
+ refreshToken: refreshToken
2213
+ };
2214
+ onRegisterSuccess(tokens);
2215
+ _context6.next = 32;
2216
+ break;
2217
+
2218
+ case 28:
2219
+ _context6.prev = 28;
2220
+ _context6.t0 = _context6["catch"](17);
2221
+
2222
+ if (axios.isAxiosError(_context6.t0)) {
2223
+ error = _context6.t0 == null ? void 0 : (_e$response = _context6.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
2224
+
2225
+ if (_includes(error, 'You must be aged')) {
2226
+ formikHelpers.setFieldError('holderAge', error);
2227
+ }
2228
+
2229
+ if (error != null && error.password) {
2230
+ formikHelpers.setFieldError('password', error.password);
2231
+ formikHelpers.setFieldError('confirmPassword', error.password);
2232
+ }
2233
+
2234
+ if (error != null && error.email) {
2235
+ setAlreadyHasUser(true);
2236
+ setShowModalLogin(true);
2237
+ }
2238
+
2239
+ onRegisterError(_context6.t0);
2240
+ }
2241
+
2242
+ return _context6.abrupt("return");
2243
+
2244
+ case 32:
2245
+ _context6.next = 34;
1955
2246
  return getProfileData(access_token_register);
1956
2247
 
1957
- case 23:
1958
- profileData = _context5.sent;
2248
+ case 34:
2249
+ profileData = _context6.sent;
1959
2250
  profileSpecifiedData = _get(profileData, 'data.data');
1960
2251
  profileDataObj = setLoggedUserData(profileSpecifiedData);
1961
2252
 
@@ -1963,42 +2254,26 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1963
2254
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1964
2255
  }
1965
2256
 
1966
- checkoutBody = createCheckoutDataBody(values, {
2257
+ checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
1967
2258
  emailLogged: emailLogged,
1968
2259
  firstNameLogged: firstNameLogged,
1969
2260
  lastNameLogged: lastNameLogged
1970
2261
  }, showDOB);
1971
- _context5.next = 30;
2262
+ _context6.next = 41;
1972
2263
  return postOnCheckout(checkoutBody, access_token_register);
1973
2264
 
1974
- case 30:
1975
- res = _context5.sent;
2265
+ case 41:
2266
+ res = _context6.sent;
1976
2267
  handleSubmit(values, formikHelpers, res);
1977
- _context5.next = 37;
2268
+ _context6.next = 48;
1978
2269
  break;
1979
2270
 
1980
- case 34:
1981
- _context5.prev = 34;
1982
- _context5.t0 = _context5["catch"](0);
2271
+ case 45:
2272
+ _context6.prev = 45;
2273
+ _context6.t1 = _context6["catch"](0);
1983
2274
 
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') {
2275
+ if (axios.isAxiosError(_context6.t1)) {
2276
+ if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
2002
2277
  if (typeof window !== 'undefined') {
2003
2278
  window.localStorage.removeItem('user_data');
2004
2279
  window.localStorage.removeItem('access_token');
@@ -2006,14 +2281,16 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2006
2281
  setShowModalLogin(true);
2007
2282
  }
2008
2283
  }
2284
+
2285
+ onSubmitError(_context6.t1);
2009
2286
  }
2010
2287
 
2011
- case 37:
2288
+ case 48:
2012
2289
  case "end":
2013
- return _context5.stop();
2290
+ return _context6.stop();
2014
2291
  }
2015
2292
  }
2016
- }, _callee5, null, [[0, 34]]);
2293
+ }, _callee6, null, [[0, 45], [17, 28]]);
2017
2294
  }));
2018
2295
 
2019
2296
  function onSubmit(_x2, _x3) {
@@ -2030,7 +2307,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2030
2307
  setStates: setStates,
2031
2308
  setFieldValue: props.setFieldValue,
2032
2309
  setValues: props.setValues,
2033
- setUserValues: setUserValues
2310
+ setUserValues: setUserValues,
2311
+ onGetStatesSuccess: onGetStatesSuccess,
2312
+ onGetStatesError: onGetStatesError
2034
2313
  }), React.createElement("div", {
2035
2314
  className: "billing-info-container " + theme
2036
2315
  }, !isLoggedIn && React.createElement("div", {
@@ -2041,6 +2320,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2041
2320
  className: "login-register-button",
2042
2321
  type: "button",
2043
2322
  onClick: function onClick() {
2323
+ onLogin();
2044
2324
  setShowModalLogin(true);
2045
2325
  }
2046
2326
  }, "Login"))), _map(data, function (item) {
@@ -2081,6 +2361,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2081
2361
  return false;
2082
2362
  }
2083
2363
 
2364
+ if (el.name === 'brand_opt_in' && hideOptIn) {
2365
+ return false;
2366
+ }
2367
+
2084
2368
  return true;
2085
2369
  }), function (element) {
2086
2370
  return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React.createElement("div", {
@@ -2096,16 +2380,57 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2096
2380
  }));
2097
2381
  })));
2098
2382
  }));
2383
+ }), showTicketHolderName && React.createElement(React.Fragment, null, React.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
2384
+ return React.createElement("div", {
2385
+ key: _item
2386
+ }, React.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
2387
+ var groupClassname = group.groupClassname,
2388
+ groupItems = group.groupItems;
2389
+ return React.createElement("div", {
2390
+ key: group.id
2391
+ }, React.createElement("div", {
2392
+ className: groupClassname
2393
+ }, _map(groupItems, function (element) {
2394
+ return React.createElement("div", {
2395
+ className: element.className,
2396
+ key: element.name + "-" + index
2397
+ }, React.createElement(Field, {
2398
+ name: element.name + "-" + index,
2399
+ key: element.name + "-" + index,
2400
+ label: element.label,
2401
+ type: element.type,
2402
+ required: true,
2403
+ component: element.type === 'checkbox' ? CheckboxField : CustomField,
2404
+ validate: combineValidators(element.required ? requiredValidator : function () {}, element.onValidate ? element.onValidate : function () {})
2405
+ }));
2406
+ })));
2407
+ }));
2408
+ })), conditions == null ? void 0 : conditions.map(function (checkbox) {
2409
+ return React.createElement("div", {
2410
+ className: 'billing-info-container__singleField',
2411
+ key: checkbox.id
2412
+ }, React.createElement("div", {
2413
+ className: "width-fc"
2414
+ }, React.createElement(Field, {
2415
+ name: checkbox.id,
2416
+ label: checkbox.text,
2417
+ type: 'checkbox',
2418
+ required: true,
2419
+ component: CheckboxField,
2420
+ validate: combineValidators(requiredValidator)
2421
+ })));
2099
2422
  }), React.createElement("div", {
2100
- style: {
2101
- display: 'flex',
2102
- padding: 20,
2103
- justifyContent: 'center'
2104
- }
2105
- }, React.createElement(Button, {
2423
+ className: "button-container"
2424
+ }, React.createElement(LoadingButton, {
2106
2425
  type: "submit",
2107
2426
  variant: "contained",
2108
- className: "login-register-button"
2427
+ className: "login-register-button",
2428
+ loadingIndicator: React.createElement(CircularProgress, {
2429
+ color: "inherit",
2430
+ size: 26
2431
+ }),
2432
+ loading: props.isSubmitting,
2433
+ disabled: props.isSubmitting
2109
2434
  }, buttonName))));
2110
2435
  }), showModalLogin && React.createElement(LoginModal, {
2111
2436
  onClose: function onClose() {
@@ -2113,17 +2438,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2113
2438
  },
2114
2439
  onLogin: function onLogin() {
2115
2440
  setShowModalLogin(false);
2441
+ setUserExpired(false);
2116
2442
  },
2117
2443
  alreadyHasUser: alreadyHasUser,
2118
2444
  userExpired: userExpired,
2119
- setUserExpired: setUserExpired
2445
+ onAuthorizeSuccess: onAuthorizeSuccess,
2446
+ onAuthorizeError: onAuthorizeError,
2447
+ onGetProfileDataSuccess: onGetProfileDataSuccess,
2448
+ onGetProfileDataError: onGetProfileDataError
2120
2449
  }), showModalRegister && React.createElement(RegisterModal, {
2121
2450
  onClose: function onClose() {
2122
2451
  setShowModalRegister(false);
2123
2452
  },
2124
2453
  onRegister: function onRegister() {
2125
2454
  setShowModalRegister(false);
2126
- }
2455
+ },
2456
+ onGetProfileDataSuccess: onGetProfileDataSuccess,
2457
+ onGetProfileDataError: onGetProfileDataError
2127
2458
  }));
2128
2459
  };
2129
2460
 
@@ -2404,7 +2735,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2404
2735
  }, React.createElement("button", {
2405
2736
  disabled: !stripe || !!error || isLoading,
2406
2737
  type: "submit"
2407
- }, isLoading ? React.createElement(CircularProgress, null) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
2738
+ }, isLoading ? React.createElement(CircularProgress$1, null) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
2408
2739
  };
2409
2740
 
2410
2741
  var testId = ENV.STRIPE_PUBLISHABLE_KEY ;
@@ -2436,7 +2767,13 @@ var PaymentContainer = function PaymentContainer(_ref) {
2436
2767
  errorText = _ref.errorText,
2437
2768
  checkoutData = _ref.checkoutData,
2438
2769
  _ref$onErrorClose = _ref.onErrorClose,
2439
- onErrorClose = _ref$onErrorClose === void 0 ? _identity : _ref$onErrorClose;
2770
+ onErrorClose = _ref$onErrorClose === void 0 ? _identity : _ref$onErrorClose,
2771
+ _ref$onGetPaymentData = _ref.onGetPaymentDataSuccess,
2772
+ onGetPaymentDataSuccess = _ref$onGetPaymentData === void 0 ? function () {} : _ref$onGetPaymentData,
2773
+ _ref$onGetPaymentData2 = _ref.onGetPaymentDataError,
2774
+ onGetPaymentDataError = _ref$onGetPaymentData2 === void 0 ? function () {} : _ref$onGetPaymentData2,
2775
+ _ref$onPaymentError = _ref.onPaymentError,
2776
+ onPaymentError = _ref$onPaymentError === void 0 ? function () {} : _ref$onPaymentError;
2440
2777
 
2441
2778
  var _useState = useState(initialReviewValues),
2442
2779
  reviewData = _useState[0],
@@ -2487,17 +2824,19 @@ var PaymentContainer = function PaymentContainer(_ref) {
2487
2824
  currency: order_details == null ? void 0 : order_details.currency
2488
2825
  };
2489
2826
  setOrderData(_orderData);
2827
+ onGetPaymentDataSuccess(response.data);
2490
2828
  }
2491
2829
 
2492
- _context.next = 10;
2830
+ _context.next = 11;
2493
2831
  break;
2494
2832
 
2495
2833
  case 7:
2496
2834
  _context.prev = 7;
2497
2835
  _context.t0 = _context["catch"](0);
2498
2836
  setError(_get(_context.t0, 'response.data.message'));
2837
+ onGetPaymentDataError(_context.t0.response);
2499
2838
 
2500
- case 10:
2839
+ case 11:
2501
2840
  case "end":
2502
2841
  return _context.stop();
2503
2842
  }
@@ -2538,15 +2877,16 @@ var PaymentContainer = function PaymentContainer(_ref) {
2538
2877
  setPaymentIsLoading(false);
2539
2878
  }
2540
2879
 
2541
- _context2.next = 14;
2880
+ _context2.next = 15;
2542
2881
  break;
2543
2882
 
2544
2883
  case 11:
2545
2884
  _context2.prev = 11;
2546
2885
  _context2.t0 = _context2["catch"](0);
2547
2886
  setError(_get(_context2.t0, 'response.data.message'));
2887
+ onPaymentError(_context2.t0.response);
2548
2888
 
2549
- case 14:
2889
+ case 15:
2550
2890
  case "end":
2551
2891
  return _context2.stop();
2552
2892
  }
@@ -2618,7 +2958,11 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
2618
2958
  _ref$shareButtons = _ref.shareButtons,
2619
2959
  shareButtons = _ref$shareButtons === void 0 ? [] : _ref$shareButtons,
2620
2960
  _ref$shareLink = _ref.shareLink,
2621
- shareLink = _ref$shareLink === void 0 ? '' : _ref$shareLink;
2961
+ shareLink = _ref$shareLink === void 0 ? '' : _ref$shareLink,
2962
+ _ref$onGetConfirmatio = _ref.onGetConfirmationDataSuccess,
2963
+ onGetConfirmationDataSuccess = _ref$onGetConfirmatio === void 0 ? function () {} : _ref$onGetConfirmatio,
2964
+ _ref$onGetConfirmatio2 = _ref.onGetConfirmationDataError,
2965
+ onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2;
2622
2966
  var inputRef = useRef(null);
2623
2967
 
2624
2968
  var _useState = useState({}),
@@ -2639,7 +2983,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
2639
2983
  dataEncoded = typeof window !== 'undefined' && window.localStorage.getItem('checkoutData');
2640
2984
 
2641
2985
  if (!dataEncoded) {
2642
- _context.next = 14;
2986
+ _context.next = 16;
2643
2987
  break;
2644
2988
  }
2645
2989
 
@@ -2653,21 +2997,23 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
2653
2997
  response = _context.sent;
2654
2998
  _data = _get(response, 'data.data.attributes');
2655
2999
  setData(_data);
2656
- _context.next = 14;
3000
+ onGetConfirmationDataSuccess(response.data);
3001
+ _context.next = 16;
2657
3002
  break;
2658
3003
 
2659
- case 12:
2660
- _context.prev = 12;
3004
+ case 13:
3005
+ _context.prev = 13;
2661
3006
  _context.t0 = _context["catch"](4);
3007
+ onGetConfirmationDataError(_context.t0.response);
2662
3008
 
2663
- case 14:
3009
+ case 16:
2664
3010
  case "end":
2665
3011
  return _context.stop();
2666
3012
  }
2667
3013
  }
2668
- }, _callee, null, [[4, 12]]);
3014
+ }, _callee, null, [[4, 13]]);
2669
3015
  }))();
2670
- }, []);
3016
+ }, [onGetConfirmationDataSuccess, onGetConfirmationDataError]);
2671
3017
  return React.createElement("div", {
2672
3018
  className: "confirmation-page"
2673
3019
  }, React.createElement("p", {
@@ -2800,10 +3146,14 @@ var getTicketSelectOptions = function getTicketSelectOptions(maxCount, minCount,
2800
3146
  return options;
2801
3147
  };
2802
3148
 
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);
3149
+ var TicketRow = function TicketRow(_ref) {
3150
+ var ticketTier = _ref.ticketTier,
3151
+ prevTicketTier = _ref.prevTicketTier,
3152
+ selectedTickets = _ref.selectedTickets,
3153
+ handleTicketSelect = _ref.handleTicketSelect;
3154
+ var soldOutMessage = ticketTier.soldOutMessage ? ("" + ticketTier.soldOutMessage).toUpperCase() : 'SOLD OUT';
3155
+ var isSalesClosed = !ticketTier.salesStarted || ticketTier.salesEnded || !_has(ticketTier, 'maxQuantity') || ticketTier.maxQuantity === 0;
3156
+ var options = getTicketSelectOptions(ticketTier.maxQuantity, ticketTier.minQuantity, ticketTier.multiplier);
2807
3157
  var onSaleContent = isSalesClosed ? null : React.createElement("div", {
2808
3158
  className: "get-tickets"
2809
3159
  }, React.createElement(Box, {
@@ -2811,7 +3161,7 @@ var computeTierStateLabel = function computeTierStateLabel(tier, prevTier, selec
2811
3161
  }, React.createElement(FormControl, {
2812
3162
  fullWidth: true
2813
3163
  }, React.createElement(Select, {
2814
- value: selectedTickets[tier.id] ? selectedTickets[tier.id] : 0,
3164
+ value: selectedTickets[ticketTier.id] ? selectedTickets[ticketTier.id] : 0,
2815
3165
  onChange: handleTicketSelect,
2816
3166
  displayEmpty: true,
2817
3167
  inputProps: {
@@ -2831,57 +3181,243 @@ var computeTierStateLabel = function computeTierStateLabel(tier, prevTier, selec
2831
3181
  value: option.value
2832
3182
  }, option.value);
2833
3183
  })))));
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 '';
3184
+ var returnValue = '';
3185
+
3186
+ if (ticketTier.sold_out || !ticketTier.displayTicket || ticketTier.soldOut) {
3187
+ returnValue = soldOutMessage;
3188
+ }
3189
+
3190
+ if (!+ticketTier.cost && !+ticketTier.price) {
3191
+ returnValue = 'FREE';
3192
+ }
3193
+
3194
+ if (ticketTier.displayTicket) {
3195
+ returnValue = onSaleContent;
3196
+ }
3197
+
3198
+ if (_get(prevTicketTier, 'in_stock')) {
3199
+ returnValue = 'SOON';
3200
+ }
3201
+
3202
+ return React.createElement(React.Fragment, null, returnValue, " ");
2839
3203
  };
2840
3204
 
2841
- var renderTiers = function renderTiers(boxOffice, selectedTickets, handleTicketSelect, promoCodeIsApplied) {
2842
- var sortedBoxOfiice = _sortBy(boxOffice, 'sortOrder');
3205
+ var TicketsSection = function TicketsSection(_ref) {
3206
+ var ticketsList = _ref.ticketsList,
3207
+ selectedTickets = _ref.selectedTickets,
3208
+ handleTicketSelect = _ref.handleTicketSelect,
3209
+ promoCodeIsApplied = _ref.promoCodeIsApplied;
3210
+
3211
+ var sortedTicketsList = _sortBy(ticketsList, 'sortOrder');
2843
3212
 
2844
- var primaryTiers = sortedBoxOfiice.map(function (tier, i, arr) {
2845
- var isSoldOut = tier.sold_out || !tier.displayTicket || tier.soldOut;
3213
+ return React.createElement(React.Fragment, null, sortedTicketsList.map(function (ticket, i, arr) {
3214
+ var isSoldOut = ticket.sold_out || !ticket.displayTicket || ticket.soldOut;
2846
3215
 
2847
3216
  var ticketSelect = function ticketSelect(event) {
2848
3217
  var value = event.target.value;
2849
- handleTicketSelect(tier.id, value);
3218
+ handleTicketSelect(ticket.id, value);
2850
3219
  };
2851
3220
 
2852
3221
  var ticketIsDiscounted = false;
2853
3222
 
2854
- if (tier.oldPrice && promoCodeIsApplied && !isSoldOut && tier.oldPrice !== tier.price) {
3223
+ if (ticket.oldPrice && promoCodeIsApplied && !isSoldOut && ticket.oldPrice !== ticket.price) {
2855
3224
  ticketIsDiscounted = true;
2856
3225
  }
2857
3226
 
2858
3227
  return React.createElement("div", {
2859
- key: tier.id || tier.name,
3228
+ key: ticket.id || ticket.name,
2860
3229
  className: "event-detail__tier " + (isSoldOut ? 'disabled' : '')
2861
3230
  }, React.createElement("div", {
2862
3231
  className: "event-detail__tier-name"
2863
- }, tier.displayName || tier.name), React.createElement("div", {
3232
+ }, ticket.displayName || ticket.name), React.createElement("div", {
2864
3233
  className: "event-tickets-container"
2865
3234
  }, React.createElement("div", {
2866
3235
  className: "event-detail__tier-price"
2867
3236
  }, ticketIsDiscounted && React.createElement("p", {
2868
3237
  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", {
3238
+ }, "$ ", (+ticket.oldPrice).toFixed(2)), React.createElement("p", null, isSoldOut ? 'SOLD OUT' : "$ " + (+ticket.cost || +ticket.price).toFixed(2)), !isSoldOut && React.createElement("p", {
3239
+ className: "fees"
3240
+ }, ticket.taxesIncluded ? '(incl. Fees)' : '(excl. Fees)')), React.createElement("div", {
2872
3241
  className: "event-detail__tier-state",
2873
3242
  style: {
2874
3243
  minWidth: 55
2875
3244
  }
2876
- }, computeTierStateLabel(tier, arr[i - 1], selectedTickets, ticketSelect))));
3245
+ }, React.createElement(TicketRow, {
3246
+ ticketTier: ticket,
3247
+ prevTicketTier: arr[i - 1],
3248
+ selectedTickets: selectedTickets,
3249
+ handleTicketSelect: ticketSelect
3250
+ }))));
3251
+ }));
3252
+ };
3253
+
3254
+ 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}";
3255
+ styleInject(css_248z$7);
3256
+
3257
+ var generateQuantity = function generateQuantity(n) {
3258
+ var quantityList = [];
3259
+
3260
+ for (var i = 1; i <= n; i++) {
3261
+ quantityList.push({
3262
+ label: i,
3263
+ value: i
3264
+ });
3265
+ }
3266
+
3267
+ return quantityList;
3268
+ };
3269
+
3270
+ var WaitingList = function WaitingList(_ref) {
3271
+ var _ref$tickets = _ref.tickets,
3272
+ tickets = _ref$tickets === void 0 ? {} : _ref$tickets;
3273
+
3274
+ var _useState = useState(false),
3275
+ showSuccessMessage = _useState[0],
3276
+ setShowSuccessMessage = _useState[1];
3277
+
3278
+ var _useState2 = useState(false),
3279
+ loading = _useState2[0],
3280
+ setLoading = _useState2[1];
3281
+
3282
+ var ticketTypesList = Object.values(tickets).map(function (d) {
3283
+ return {
3284
+ label: d.displayName,
3285
+ value: d.id
3286
+ };
2877
3287
  });
2878
- return primaryTiers;
3288
+
3289
+ var handleSubmit = /*#__PURE__*/function () {
3290
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(values) {
3291
+ var id, requestData, _yield$addToWaitingLi, data;
3292
+
3293
+ return runtime_1.wrap(function _callee$(_context) {
3294
+ while (1) {
3295
+ switch (_context.prev = _context.next) {
3296
+ case 0:
3297
+ _context.prev = 0;
3298
+ setLoading(true);
3299
+ id = ENV.EVENT_ID;
3300
+ requestData = {
3301
+ data: {
3302
+ attributes: values
3303
+ }
3304
+ };
3305
+ _context.next = 6;
3306
+ return addToWaitingList(id, requestData);
3307
+
3308
+ case 6:
3309
+ _yield$addToWaitingLi = _context.sent;
3310
+ data = _yield$addToWaitingLi.data;
3311
+
3312
+ if (data.success) {
3313
+ setShowSuccessMessage(true);
3314
+ }
3315
+
3316
+ _context.next = 14;
3317
+ break;
3318
+
3319
+ case 11:
3320
+ _context.prev = 11;
3321
+ _context.t0 = _context["catch"](0);
3322
+ console.log(_context.t0);
3323
+
3324
+ case 14:
3325
+ _context.prev = 14;
3326
+ setLoading(false);
3327
+ return _context.finish(14);
3328
+
3329
+ case 17:
3330
+ case "end":
3331
+ return _context.stop();
3332
+ }
3333
+ }
3334
+ }, _callee, null, [[0, 11, 14, 17]]);
3335
+ }));
3336
+
3337
+ return function handleSubmit(_x) {
3338
+ return _ref2.apply(this, arguments);
3339
+ };
3340
+ }();
3341
+
3342
+ return React.createElement("div", {
3343
+ className: "waiting-list"
3344
+ }, showSuccessMessage ? React.createElement("div", {
3345
+ className: "success-message"
3346
+ }, 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, {
3347
+ initialValues: {
3348
+ ticketTypeId: '',
3349
+ quantity: '',
3350
+ firstName: '',
3351
+ lastName: '',
3352
+ email: ''
3353
+ },
3354
+ onSubmit: handleSubmit
3355
+ }, React.createElement(Form, null, React.createElement("div", {
3356
+ className: "field-item"
3357
+ }, React.createElement(Field, {
3358
+ name: "ticketTypeId",
3359
+ label: "Ticket types",
3360
+ type: "select",
3361
+ component: CustomField,
3362
+ selectOptions: [{
3363
+ label: 'Type of Ticket',
3364
+ value: '',
3365
+ disabled: true
3366
+ }].concat(ticketTypesList)
3367
+ })), React.createElement("div", {
3368
+ className: "field-item"
3369
+ }, React.createElement(Field, {
3370
+ name: "quantity",
3371
+ label: "Quantity",
3372
+ type: "select",
3373
+ component: CustomField,
3374
+ selectOptions: [{
3375
+ label: 'Quantity Requested',
3376
+ value: '',
3377
+ disabled: true
3378
+ }].concat(generateQuantity(10))
3379
+ })), React.createElement("div", {
3380
+ className: "field-item"
3381
+ }, React.createElement(Field, {
3382
+ name: "firstName",
3383
+ label: "First name",
3384
+ validate: function validate(value) {
3385
+ return requiredValidator(value, 'Please enter your First name');
3386
+ },
3387
+ component: CustomField
3388
+ })), React.createElement("div", {
3389
+ className: "field-item"
3390
+ }, React.createElement(Field, {
3391
+ name: "lastName",
3392
+ label: "Last name",
3393
+ validate: function validate(value) {
3394
+ return requiredValidator(value, 'Please enter your Last name');
3395
+ },
3396
+ component: CustomField
3397
+ })), React.createElement("div", {
3398
+ className: "field-item"
3399
+ }, React.createElement(Field, {
3400
+ name: "email",
3401
+ label: "Email",
3402
+ validate: combineValidators(function (value) {
3403
+ return requiredValidator(value, 'Please enter your Email');
3404
+ }, function (value) {
3405
+ return emailValidator(value);
3406
+ }),
3407
+ component: CustomField
3408
+ })), React.createElement(Button, {
3409
+ type: "submit",
3410
+ variant: "contained",
3411
+ className: "waiting-list-button"
3412
+ }, loading ? React.createElement(CircularProgress$1, {
3413
+ size: "22px"
3414
+ }) : 'ADD TO WAITING LIST')))));
2879
3415
  };
2880
3416
 
2881
3417
  function Loader() {
2882
3418
  return React.createElement("div", {
2883
3419
  className: "loader-container"
2884
- }, React.createElement(CircularProgress, null));
3420
+ }, React.createElement(CircularProgress$1, null));
2885
3421
  }
2886
3422
 
2887
3423
  var TicketsContainer = function TicketsContainer(_ref) {
@@ -2889,7 +3425,15 @@ var TicketsContainer = function TicketsContainer(_ref) {
2889
3425
  eventId = _ref.eventId,
2890
3426
  onAddToCartSuccess = _ref.onAddToCartSuccess,
2891
3427
  _ref$contentStyle = _ref.contentStyle,
2892
- contentStyle = _ref$contentStyle === void 0 ? {} : _ref$contentStyle;
3428
+ contentStyle = _ref$contentStyle === void 0 ? {} : _ref$contentStyle,
3429
+ _ref$onAddToCartError = _ref.onAddToCartError,
3430
+ onAddToCartError = _ref$onAddToCartError === void 0 ? function () {} : _ref$onAddToCartError,
3431
+ _ref$onGetTicketsSucc = _ref.onGetTicketsSuccess,
3432
+ onGetTicketsSuccess = _ref$onGetTicketsSucc === void 0 ? function () {} : _ref$onGetTicketsSucc,
3433
+ _ref$onGetTicketsErro = _ref.onGetTicketsError,
3434
+ onGetTicketsError = _ref$onGetTicketsErro === void 0 ? function () {} : _ref$onGetTicketsErro,
3435
+ _ref$theme = _ref.theme,
3436
+ theme = _ref$theme === void 0 ? 'light' : _ref$theme;
2893
3437
 
2894
3438
  var _useState = useState({}),
2895
3439
  selectedTickets = _useState[0],
@@ -2900,28 +3444,32 @@ var TicketsContainer = function TicketsContainer(_ref) {
2900
3444
  setTickets = _useState2[1];
2901
3445
 
2902
3446
  var _useState3 = useState(false),
2903
- isLoading = _useState3[0],
2904
- setIsLoading = _useState3[1];
3447
+ showWaitingList = _useState3[0],
3448
+ setShowWaitingList = _useState3[1];
2905
3449
 
2906
3450
  var _useState4 = useState(false),
2907
- handleBookIsLoading = _useState4[0],
2908
- setHandleBookIsLoading = _useState4[1];
3451
+ isLoading = _useState4[0],
3452
+ setIsLoading = _useState4[1];
2909
3453
 
2910
- var _useState5 = useState(''),
2911
- promoCode = _useState5[0],
2912
- setPromoCode = _useState5[1];
3454
+ var _useState5 = useState(false),
3455
+ handleBookIsLoading = _useState5[0],
3456
+ setHandleBookIsLoading = _useState5[1];
2913
3457
 
2914
3458
  var _useState6 = useState(''),
2915
- promoCodeUpdated = _useState6[0],
2916
- setPromoCodeUpdated = _useState6[1];
3459
+ promoCode = _useState6[0],
3460
+ setPromoCode = _useState6[1];
2917
3461
 
2918
- var _useState7 = useState(false),
2919
- showPromoInput = _useState7[0],
2920
- setShowPromoInput = _useState7[1];
3462
+ var _useState7 = useState(''),
3463
+ promoCodeUpdated = _useState7[0],
3464
+ setPromoCodeUpdated = _useState7[1];
2921
3465
 
2922
3466
  var _useState8 = useState(false),
2923
- promoCodeIsApplied = _useState8[0],
2924
- setPromoCodeIsApplied = _useState8[1];
3467
+ showPromoInput = _useState8[0],
3468
+ setShowPromoInput = _useState8[1];
3469
+
3470
+ var _useState9 = useState(false),
3471
+ promoCodeIsApplied = _useState9[0],
3472
+ setPromoCodeIsApplied = _useState9[1];
2925
3473
 
2926
3474
  useEffect(function () {
2927
3475
  if (typeof window !== 'undefined') {
@@ -2944,8 +3492,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
2944
3492
 
2945
3493
  function _getTicketsApi() {
2946
3494
  _getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2947
- var response, attributes, _tickets;
2948
-
3495
+ var response, attributes;
2949
3496
  return runtime_1.wrap(function _callee$(_context) {
2950
3497
  while (1) {
2951
3498
  switch (_context.prev = _context.next) {
@@ -2962,10 +3509,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
2962
3509
  setCustomHeader(response);
2963
3510
  attributes = _get(response, 'data.data.attributes');
2964
3511
  setPromoCodeIsApplied(attributes.ValidPromoCode);
2965
- _tickets = _filter(Object.values(attributes) || [], function (item) {
2966
- return _isObject(item);
2967
- });
2968
- setTickets(_tickets);
3512
+ setTickets(_get(attributes, 'tickets'));
3513
+ setShowWaitingList(attributes.showWaitingList);
3514
+ onGetTicketsSuccess(response.data);
2969
3515
  }
2970
3516
 
2971
3517
  _context.next = 11;
@@ -2974,7 +3520,10 @@ var TicketsContainer = function TicketsContainer(_ref) {
2974
3520
  case 8:
2975
3521
  _context.prev = 8;
2976
3522
  _context.t0 = _context["catch"](0);
2977
- console.log('e', _context.t0);
3523
+
3524
+ if (axios.isAxiosError(_context.t0)) {
3525
+ onGetTicketsError(_context.t0);
3526
+ }
2978
3527
 
2979
3528
  case 11:
2980
3529
  _context.prev = 11;
@@ -3047,7 +3596,8 @@ var TicketsContainer = function TicketsContainer(_ref) {
3047
3596
  onAddToCartSuccess({
3048
3597
  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,
3049
3598
  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,
3050
- 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
3599
+ 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,
3600
+ event_id: String(eventId)
3051
3601
  });
3052
3602
  }
3053
3603
 
@@ -3057,7 +3607,10 @@ var TicketsContainer = function TicketsContainer(_ref) {
3057
3607
  case 13:
3058
3608
  _context2.prev = 13;
3059
3609
  _context2.t0 = _context2["catch"](6);
3060
- console.log('e', _context2.t0);
3610
+
3611
+ if (axios.isAxiosError(_context2.t0)) {
3612
+ onAddToCartError(_context2.t0);
3613
+ }
3061
3614
 
3062
3615
  case 16:
3063
3616
  _context2.prev = 16;
@@ -3081,9 +3634,16 @@ var TicketsContainer = function TicketsContainer(_ref) {
3081
3634
  return !(item.sold_out || item.soldOut);
3082
3635
  });
3083
3636
  return React.createElement("div", {
3084
- className: "get-tickets-page",
3637
+ className: "get-tickets-page " + theme,
3085
3638
  style: contentStyle
3086
- }, isLoading ? React.createElement(Loader, null) : React.createElement("div", null, renderTiers(tickets, selectedTickets, handleTicketSelect, promoCodeIsApplied), promoCodeIsApplied ? React.createElement("div", {
3639
+ }, isLoading ? React.createElement(Loader, null) : React.createElement(React.Fragment, null, showWaitingList ? React.createElement(WaitingList, {
3640
+ tickets: tickets
3641
+ }) : React.createElement("div", null, React.createElement(TicketsSection, {
3642
+ ticketsList: tickets,
3643
+ selectedTickets: selectedTickets,
3644
+ handleTicketSelect: handleTicketSelect,
3645
+ promoCodeIsApplied: promoCodeIsApplied
3646
+ }), promoCodeIsApplied ? React.createElement("div", {
3087
3647
  className: "alert-info"
3088
3648
  }, "Your promo code was applied successfully.") : null, showPromoInput && React.createElement("div", {
3089
3649
  className: "promo-code-block"
@@ -3118,8 +3678,8 @@ var TicketsContainer = function TicketsContainer(_ref) {
3118
3678
  "aria-hidden": true,
3119
3679
  className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
3120
3680
  onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
3121
- }, getTicketsLabel || 'GET TICKETS')));
3681
+ }, getTicketsLabel || 'GET TICKETS'))));
3122
3682
  };
3123
3683
 
3124
- export { BillingInfoContainer, ConfirmationContainer, PaymentContainer, TicketsContainer, createFixedFloatNormalizer, currencyNormalizerCreator };
3684
+ export { BillingInfoContainer, ConfirmationContainer, LoginModal, PaymentContainer, TicketsContainer, createFixedFloatNormalizer, currencyNormalizerCreator };
3125
3685
  //# sourceMappingURL=tf-checkout-react.esm.js.map