tf-checkout-react 1.0.40 → 1.0.44

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 (28) hide show
  1. package/dist/components/billing-info-container/index.d.ts +20 -1
  2. package/dist/components/billing-info-container/utils.d.ts +1 -1
  3. package/dist/components/confirmationContainer/index.d.ts +4 -1
  4. package/dist/components/loginModal/index.d.ts +5 -0
  5. package/dist/components/paymentContainer/index.d.ts +5 -1
  6. package/dist/components/registerModal/index.d.ts +3 -0
  7. package/dist/components/ticketsContainer/index.d.ts +5 -1
  8. package/dist/env.d.ts +2 -2
  9. package/dist/tf-checkout-react.cjs.development.css +1 -1
  10. package/dist/tf-checkout-react.cjs.development.js +387 -144
  11. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  12. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  13. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  14. package/dist/tf-checkout-react.esm.js +392 -149
  15. package/dist/tf-checkout-react.esm.js.map +1 -1
  16. package/dist/types/billing-info-data.d.ts +2 -1
  17. package/package.json +3 -1
  18. package/src/components/billing-info-container/index.tsx +213 -52
  19. package/src/components/billing-info-container/style.css +15 -0
  20. package/src/components/billing-info-container/utils.ts +38 -11
  21. package/src/components/common/CustomField.tsx +15 -0
  22. package/src/components/confirmationContainer/index.tsx +8 -3
  23. package/src/components/loginModal/index.tsx +38 -6
  24. package/src/components/paymentContainer/index.tsx +10 -0
  25. package/src/components/registerModal/index.tsx +20 -3
  26. package/src/components/ticketsContainer/index.tsx +10 -2
  27. package/src/env.ts +2 -2
  28. package/src/types/billing-info-data.ts +2 -1
@@ -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,7 +20,7 @@ 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
25
  import _sortBy from 'lodash-es/sortBy';
25
26
  import _has from 'lodash-es/has';
@@ -31,7 +32,7 @@ import _isObject from 'lodash-es/isObject';
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 Button from 'react-bootstrap/Button';
35
36
  import jwt_decode from 'jwt-decode';
36
37
 
37
38
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -890,7 +891,7 @@ 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
 
896
897
  var combineValidators = function combineValidators() {
@@ -916,13 +917,14 @@ var requiredValidator = function requiredValidator(value) {
916
917
  };
917
918
 
918
919
  // preview1
920
+
919
921
  var ENV = {
920
- EVENT_ID: 3483,
921
- BASE_URL: 'https://preview1.ttf.fluxtech.me/api',
922
- CLIENT_ID: '4792a61f2fcb49197ab4c2d2f44df570',
922
+ EVENT_ID: 9766,
923
+ BASE_URL: 'https://www.ticketfairy.com/api',
924
+ CLIENT_ID: 'e9d8f8922797b4621e562255afe90dbf',
923
925
  CLIENT_SECRET: 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9',
924
- STRIPE_PUBLISHABLE_KEY: 'pk_test_51H4BkOGqveRD6EShliLrT9vd7mPOBPvQSuqmvc3wIinDqxWsCLeS2N7HonPPn6MhjU35ayYy5v4I6MLlD4jNWrd000NSgAF6UL'
925
- }; // prod
926
+ STRIPE_PUBLISHABLE_KEY: 'pk_live_51JucaXAnOd2Grid07FqHOkqcoh90bbCYL5bG7OuyM5RtzUoolrFcHroCWici0G9w0YpqO7qsGz6WP7K6HHYw1yhz00cm7fj5n5'
927
+ };
926
928
 
927
929
  var isWindowDefined = typeof window !== 'undefined';
928
930
  var ttfHeaders = {
@@ -1108,7 +1110,15 @@ var LoginModal = function LoginModal(_ref) {
1108
1110
  onLogin = _ref.onLogin,
1109
1111
  alreadyHasUser = _ref.alreadyHasUser,
1110
1112
  userExpired = _ref.userExpired,
1111
- setUserExpired = _ref.setUserExpired;
1113
+ setUserExpired = _ref.setUserExpired,
1114
+ _ref$onAuthorizeSucce = _ref.onAuthorizeSuccess,
1115
+ onAuthorizeSuccess = _ref$onAuthorizeSucce === void 0 ? function () {} : _ref$onAuthorizeSucce,
1116
+ _ref$onAuthorizeError = _ref.onAuthorizeError,
1117
+ onAuthorizeError = _ref$onAuthorizeError === void 0 ? function () {} : _ref$onAuthorizeError,
1118
+ _ref$onGetProfileData = _ref.onGetProfileDataSuccess,
1119
+ onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? function () {} : _ref$onGetProfileData,
1120
+ _ref$onGetProfileData2 = _ref.onGetProfileDataError,
1121
+ onGetProfileDataError = _ref$onGetProfileData2 === void 0 ? function () {} : _ref$onGetProfileData2;
1112
1122
 
1113
1123
  var _useState = useState(''),
1114
1124
  error = _useState[0],
@@ -1128,7 +1138,7 @@ var LoginModal = function LoginModal(_ref) {
1128
1138
  },
1129
1139
  onSubmit: function () {
1130
1140
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
1131
- var email, password, bodyFormData, resAutorize, bodyFormDataToken, resAccessToken, accessToken, profileData, profileSpecifiedData, profileDataObj, _e$response, _e$response$data, _error;
1141
+ var email, password, bodyFormData, resAutorize, bodyFormDataToken, resAccessToken, accessToken, profileResponse, profileSpecifiedData, profileDataObj, _e$response, _e$response$data, _error;
1132
1142
 
1133
1143
  return runtime_1.wrap(function _callee$(_context) {
1134
1144
  while (1) {
@@ -1150,19 +1160,45 @@ var LoginModal = function LoginModal(_ref) {
1150
1160
  bodyFormDataToken.append('grant_type', 'authorization_code');
1151
1161
  bodyFormDataToken.append('client_id', ENV.CLIENT_ID );
1152
1162
  bodyFormDataToken.append('client_secret', ENV.CLIENT_SECRET );
1153
- _context.next = 16;
1163
+ resAccessToken = null;
1164
+ _context.prev = 15;
1165
+ _context.next = 18;
1154
1166
  return getAccessToken(bodyFormDataToken);
1155
1167
 
1156
- case 16:
1168
+ case 18:
1157
1169
  resAccessToken = _context.sent;
1170
+ onAuthorizeSuccess(resAccessToken.data);
1171
+ _context.next = 26;
1172
+ break;
1173
+
1174
+ case 22:
1175
+ _context.prev = 22;
1176
+ _context.t0 = _context["catch"](15);
1177
+ onAuthorizeError(_context.t0.response);
1178
+ return _context.abrupt("return");
1179
+
1180
+ case 26:
1158
1181
  accessToken = _get(resAccessToken, 'data.access_token');
1159
1182
  handleSetAccessToken(accessToken);
1160
- _context.next = 21;
1183
+ profileResponse = null;
1184
+ _context.prev = 29;
1185
+ _context.next = 32;
1161
1186
  return getProfileData(accessToken);
1162
1187
 
1163
- case 21:
1164
- profileData = _context.sent;
1165
- profileSpecifiedData = _get(profileData, 'data.data');
1188
+ case 32:
1189
+ profileResponse = _context.sent;
1190
+ onGetProfileDataSuccess(profileResponse.data);
1191
+ _context.next = 40;
1192
+ break;
1193
+
1194
+ case 36:
1195
+ _context.prev = 36;
1196
+ _context.t1 = _context["catch"](29);
1197
+ onGetProfileDataError(_context.t1.response);
1198
+ return _context.abrupt("return");
1199
+
1200
+ case 40:
1201
+ profileSpecifiedData = _get(profileResponse, 'data.data');
1166
1202
  profileDataObj = {
1167
1203
  id: profileSpecifiedData.id,
1168
1204
  first_name: profileSpecifiedData.firstName,
@@ -1177,26 +1213,26 @@ var LoginModal = function LoginModal(_ref) {
1177
1213
 
1178
1214
  setUserExpired(false);
1179
1215
  onLogin();
1180
- _context.next = 32;
1216
+ _context.next = 50;
1181
1217
  break;
1182
1218
 
1183
- case 29:
1184
- _context.prev = 29;
1185
- _context.t0 = _context["catch"](1);
1219
+ case 47:
1220
+ _context.prev = 47;
1221
+ _context.t2 = _context["catch"](1);
1186
1222
 
1187
- if (axios.isAxiosError(_context.t0)) {
1188
- _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';
1223
+ if (axios.isAxiosError(_context.t2)) {
1224
+ _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';
1189
1225
  setError(_error);
1190
- } else if (_context.t0 instanceof Error) {
1191
- setError((_context.t0 == null ? void 0 : _context.t0.message) || 'Error');
1226
+ } else if (_context.t2 instanceof Error) {
1227
+ setError((_context.t2 == null ? void 0 : _context.t2.message) || 'Error');
1192
1228
  }
1193
1229
 
1194
- case 32:
1230
+ case 50:
1195
1231
  case "end":
1196
1232
  return _context.stop();
1197
1233
  }
1198
1234
  }
1199
- }, _callee, null, [[1, 29]]);
1235
+ }, _callee, null, [[1, 47], [15, 22], [29, 36]]);
1200
1236
  }));
1201
1237
 
1202
1238
  function onSubmit(_x) {
@@ -1260,7 +1296,11 @@ var css_248z$2 = ".style_register-container___s5V8{margin:0 auto;max-width:800px
1260
1296
  styleInject(css_248z$2);
1261
1297
 
1262
1298
  var RegisterModal = function RegisterModal(_ref) {
1263
- var onClose = _ref.onClose;
1299
+ var onClose = _ref.onClose,
1300
+ _ref$onGetProfileData = _ref.onGetProfileDataSuccess,
1301
+ onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? function () {} : _ref$onGetProfileData,
1302
+ _ref$onGetProfileData2 = _ref.onGetProfileDataError,
1303
+ onGetProfileDataError = _ref$onGetProfileData2 === void 0 ? function () {} : _ref$onGetProfileData2;
1264
1304
  return React.createElement("div", {
1265
1305
  style: {
1266
1306
  display: 'flex',
@@ -1284,7 +1324,7 @@ var RegisterModal = function RegisterModal(_ref) {
1284
1324
  },
1285
1325
  onSubmit: function () {
1286
1326
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
1287
- var firstName, lastName, email, password, confirmPassword, bodyFormData, resRegister, access_token, profileData, profileSpecifiedData, profileDataObj;
1327
+ var firstName, lastName, email, password, confirmPassword, bodyFormData, resRegister, access_token, profileResponse, profileSpecifiedData, profileDataObj;
1288
1328
  return runtime_1.wrap(function _callee$(_context) {
1289
1329
  while (1) {
1290
1330
  switch (_context.prev = _context.next) {
@@ -1305,12 +1345,25 @@ var RegisterModal = function RegisterModal(_ref) {
1305
1345
  resRegister = _context.sent;
1306
1346
  access_token = _get(resRegister, 'data.data.attributes.access_token');
1307
1347
  handleSetAccessToken(access_token);
1308
- _context.next = 16;
1348
+ profileResponse = null;
1349
+ _context.prev = 15;
1350
+ _context.next = 18;
1309
1351
  return getProfileData(access_token);
1310
1352
 
1311
- case 16:
1312
- profileData = _context.sent;
1313
- profileSpecifiedData = _get(profileData, 'data.data');
1353
+ case 18:
1354
+ profileResponse = _context.sent;
1355
+ onGetProfileDataSuccess(profileResponse.data);
1356
+ _context.next = 26;
1357
+ break;
1358
+
1359
+ case 22:
1360
+ _context.prev = 22;
1361
+ _context.t0 = _context["catch"](15);
1362
+ onGetProfileDataError(_context.t0.response);
1363
+ return _context.abrupt("return");
1364
+
1365
+ case 26:
1366
+ profileSpecifiedData = _get(profileResponse, 'data.data');
1314
1367
  profileDataObj = {
1315
1368
  id: profileSpecifiedData.id,
1316
1369
  first_name: profileSpecifiedData.firstName,
@@ -1325,12 +1378,12 @@ var RegisterModal = function RegisterModal(_ref) {
1325
1378
 
1326
1379
  onClose();
1327
1380
 
1328
- case 21:
1381
+ case 30:
1329
1382
  case "end":
1330
1383
  return _context.stop();
1331
1384
  }
1332
1385
  }
1333
- }, _callee);
1386
+ }, _callee, null, [[15, 22]]);
1334
1387
  }));
1335
1388
 
1336
1389
  function onSubmit(_x) {
@@ -1434,7 +1487,7 @@ var RegisterModal = function RegisterModal(_ref) {
1434
1487
  }));
1435
1488
  };
1436
1489
 
1437
- var _excluded = ["holderAge", "firstName", "lastName", "confirmEmail", "confirmPassword", "holderFirstName", "holderLastName"];
1490
+ var _excluded = ["firstName", "lastName", "holderAge", "confirmEmail", "confirmPassword"];
1438
1491
  var getInitialValues = function getInitialValues(data, propsInitialValues) {
1439
1492
  if (data === void 0) {
1440
1493
  data = [];
@@ -1492,7 +1545,7 @@ var setLoggedUserData = function setLoggedUserData(data) {
1492
1545
  zip: (data == null ? void 0 : data.zip) || (data == null ? void 0 : data.zipCode) || ''
1493
1546
  };
1494
1547
  };
1495
- var createCheckoutDataBody = function createCheckoutDataBody(values, logedInValues, includeDob) {
1548
+ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, values, logedInValues, includeDob) {
1496
1549
  if (values === void 0) {
1497
1550
  values = {};
1498
1551
  }
@@ -1506,23 +1559,52 @@ var createCheckoutDataBody = function createCheckoutDataBody(values, logedInValu
1506
1559
  }
1507
1560
 
1508
1561
  var _values = values,
1509
- holderAge = _values.holderAge,
1510
1562
  firstName = _values.firstName,
1511
1563
  lastName = _values.lastName,
1512
- holderFirstName = _values.holderFirstName,
1513
- holderLastName = _values.holderLastName,
1564
+ holderAge = _values.holderAge,
1514
1565
  restValues = _objectWithoutPropertiesLoose(_values, _excluded);
1515
1566
 
1567
+ var holders = [];
1568
+ var ticket_holders = [];
1569
+
1570
+ var _loop = function _loop(i) {
1571
+ var individualHolder = Object.fromEntries(Object.entries(values).filter(function (_ref4) {
1572
+ var key = _ref4[0];
1573
+ return key.includes(String(i));
1574
+ }));
1575
+ holders.push(individualHolder);
1576
+ };
1577
+
1578
+ for (var i = 0; i <= ticketsQuantity; i++) {
1579
+ _loop(i);
1580
+ }
1581
+
1582
+ var filteredHolders = holders.filter(function (holder) {
1583
+ return Object.entries(holder).length > 0;
1584
+ });
1585
+ ticket_holders = filteredHolders.map(function (item, index) {
1586
+ return {
1587
+ first_name: item["holderFirstName-" + index] || '',
1588
+ last_name: item["holderLastName-" + index] || '',
1589
+ phone: item["holderPhone-" + index] || '',
1590
+ email: item["holderEmail-" + index] || ''
1591
+ };
1592
+ });
1593
+ var filteredRestValue = {};
1594
+
1595
+ _forEach(restValues, function (value, key) {
1596
+ if (!key.includes('holder')) {
1597
+ filteredRestValue[key] = value;
1598
+ }
1599
+ });
1600
+
1516
1601
  var body = {
1517
- attributes: _extends({}, restValues, {
1602
+ attributes: _extends({}, filteredRestValue, {
1518
1603
  email: restValues.email || logedInValues.emailLogged,
1519
1604
  confirm_email: restValues.email || logedInValues.emailLogged,
1520
1605
  first_name: firstName || logedInValues.firstNameLogged,
1521
1606
  last_name: lastName || logedInValues.lastNameLogged,
1522
- ticket_holders: [{
1523
- first_name: holderFirstName,
1524
- last_name: holderLastName
1525
- }]
1607
+ ticket_holders: ticket_holders
1526
1608
  })
1527
1609
  };
1528
1610
 
@@ -1536,6 +1618,13 @@ var createCheckoutDataBody = function createCheckoutDataBody(values, logedInValu
1536
1618
  return body;
1537
1619
  };
1538
1620
 
1621
+ var useStyles = /*#__PURE__*/makeStyles({
1622
+ input: {
1623
+ "&::placeholder": {
1624
+ color: "gray"
1625
+ }
1626
+ }
1627
+ });
1539
1628
  var CustomField = function CustomField(_ref) {
1540
1629
  var label = _ref.label,
1541
1630
  _ref$type = _ref.type,
@@ -1552,6 +1641,7 @@ var CustomField = function CustomField(_ref) {
1552
1641
 
1553
1642
  var error = _get(errors, field.name);
1554
1643
 
1644
+ var classes = useStyles();
1555
1645
  return React.createElement(TextField$1, Object.assign({
1556
1646
  id: field.name,
1557
1647
  label: label,
@@ -1563,6 +1653,11 @@ var CustomField = function CustomField(_ref) {
1563
1653
  InputLabelProps: {
1564
1654
  shrink: isShrink
1565
1655
  },
1656
+ InputProps: {
1657
+ classes: {
1658
+ input: classes.input
1659
+ }
1660
+ },
1566
1661
  SelectProps: {
1567
1662
  "native": true
1568
1663
  }
@@ -1605,7 +1700,9 @@ var LogicRunner = function LogicRunner(_ref) {
1605
1700
  setStates = _ref.setStates,
1606
1701
  setFieldValue = _ref.setFieldValue,
1607
1702
  setValues = _ref.setValues,
1608
- setUserValues = _ref.setUserValues;
1703
+ setUserValues = _ref.setUserValues,
1704
+ onGetStatesSuccess = _ref.onGetStatesSuccess,
1705
+ onGetStatesError = _ref.onGetStatesError;
1609
1706
  useEffect(function () {
1610
1707
  var fetchStates = /*#__PURE__*/function () {
1611
1708
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -1629,19 +1726,21 @@ var LogicRunner = function LogicRunner(_ref) {
1629
1726
  });
1630
1727
  setStates(mappedStates);
1631
1728
  setFieldValue('state', (_mappedStates$0$label = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.label) != null ? _mappedStates$0$label : '');
1632
- _context.next = 11;
1729
+ onGetStatesSuccess(res.data);
1730
+ _context.next = 13;
1633
1731
  break;
1634
1732
 
1635
- case 9:
1636
- _context.prev = 9;
1733
+ case 10:
1734
+ _context.prev = 10;
1637
1735
  _context.t0 = _context["catch"](0);
1736
+ onGetStatesError(_context.t0.response);
1638
1737
 
1639
- case 11:
1738
+ case 13:
1640
1739
  case "end":
1641
1740
  return _context.stop();
1642
1741
  }
1643
1742
  }
1644
- }, _callee, null, [[0, 9]]);
1743
+ }, _callee, null, [[0, 10]]);
1645
1744
  }));
1646
1745
 
1647
1746
  return function fetchStates() {
@@ -1665,9 +1764,6 @@ var LogicRunner = function LogicRunner(_ref) {
1665
1764
  email: (parsedData == null ? void 0 : parsedData.email) || '',
1666
1765
  phone: (parsedData == null ? void 0 : parsedData.phone) || '',
1667
1766
  confirmEmail: '',
1668
- holderFirstName: '',
1669
- holderLastName: '',
1670
- holderAge: '',
1671
1767
  state: (parsedData == null ? void 0 : parsedData.state) || '',
1672
1768
  street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
1673
1769
  country: (parsedData == null ? void 0 : parsedData.country) || 1,
@@ -1679,9 +1775,7 @@ var LogicRunner = function LogicRunner(_ref) {
1679
1775
  };
1680
1776
  setValues(mappedValues);
1681
1777
  setUserValues(mappedValues);
1682
- } catch (e) {
1683
- console.log(e);
1684
- }
1778
+ } catch (e) {}
1685
1779
  }
1686
1780
  }
1687
1781
  };
@@ -1699,6 +1793,11 @@ var SectionContainer = function SectionContainer(_ref3) {
1699
1793
  var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1700
1794
  var _ref4$data = _ref4.data,
1701
1795
  data = _ref4$data === void 0 ? [] : _ref4$data,
1796
+ _ref4$ticketHoldersFi = _ref4.ticketHoldersFields,
1797
+ ticketHoldersFields = _ref4$ticketHoldersFi === void 0 ? {
1798
+ id: 1,
1799
+ fields: []
1800
+ } : _ref4$ticketHoldersFi,
1702
1801
  _ref4$initialValues = _ref4.initialValues,
1703
1802
  initialValues = _ref4$initialValues === void 0 ? {} : _ref4$initialValues,
1704
1803
  _ref4$buttonName = _ref4.buttonName,
@@ -1706,7 +1805,35 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1706
1805
  _ref4$handleSubmit = _ref4.handleSubmit,
1707
1806
  handleSubmit = _ref4$handleSubmit === void 0 ? _identity : _ref4$handleSubmit,
1708
1807
  _ref4$theme = _ref4.theme,
1709
- theme = _ref4$theme === void 0 ? 'light' : _ref4$theme;
1808
+ theme = _ref4$theme === void 0 ? 'light' : _ref4$theme,
1809
+ _ref4$onRegisterSucce = _ref4.onRegisterSuccess,
1810
+ onRegisterSuccess = _ref4$onRegisterSucce === void 0 ? function () {} : _ref4$onRegisterSucce,
1811
+ _ref4$onRegisterError = _ref4.onRegisterError,
1812
+ onRegisterError = _ref4$onRegisterError === void 0 ? function () {} : _ref4$onRegisterError,
1813
+ _ref4$onSubmitError = _ref4.onSubmitError,
1814
+ onSubmitError = _ref4$onSubmitError === void 0 ? function () {} : _ref4$onSubmitError,
1815
+ _ref4$onGetCartSucces = _ref4.onGetCartSuccess,
1816
+ onGetCartSuccess = _ref4$onGetCartSucces === void 0 ? function () {} : _ref4$onGetCartSucces,
1817
+ _ref4$onGetCartError = _ref4.onGetCartError,
1818
+ onGetCartError = _ref4$onGetCartError === void 0 ? function () {} : _ref4$onGetCartError,
1819
+ _ref4$onGetCountriesS = _ref4.onGetCountriesSuccess,
1820
+ onGetCountriesSuccess = _ref4$onGetCountriesS === void 0 ? function () {} : _ref4$onGetCountriesS,
1821
+ _ref4$onGetCountriesE = _ref4.onGetCountriesError,
1822
+ onGetCountriesError = _ref4$onGetCountriesE === void 0 ? function () {} : _ref4$onGetCountriesE,
1823
+ _ref4$onGetStatesSucc = _ref4.onGetStatesSuccess,
1824
+ onGetStatesSuccess = _ref4$onGetStatesSucc === void 0 ? function () {} : _ref4$onGetStatesSucc,
1825
+ _ref4$onGetStatesErro = _ref4.onGetStatesError,
1826
+ onGetStatesError = _ref4$onGetStatesErro === void 0 ? function () {} : _ref4$onGetStatesErro,
1827
+ _ref4$onGetProfileDat = _ref4.onGetProfileDataSuccess,
1828
+ onGetProfileDataSuccess = _ref4$onGetProfileDat === void 0 ? function () {} : _ref4$onGetProfileDat,
1829
+ _ref4$onGetProfileDat2 = _ref4.onGetProfileDataError,
1830
+ onGetProfileDataError = _ref4$onGetProfileDat2 === void 0 ? function () {} : _ref4$onGetProfileDat2,
1831
+ _ref4$onAuthorizeSucc = _ref4.onAuthorizeSuccess,
1832
+ onAuthorizeSuccess = _ref4$onAuthorizeSucc === void 0 ? function () {} : _ref4$onAuthorizeSucc,
1833
+ _ref4$onAuthorizeErro = _ref4.onAuthorizeError,
1834
+ onAuthorizeError = _ref4$onAuthorizeErro === void 0 ? function () {} : _ref4$onAuthorizeErro,
1835
+ _ref4$onLogin = _ref4.onLogin,
1836
+ onLogin = _ref4$onLogin === void 0 ? function () {} : _ref4$onLogin;
1710
1837
  var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
1711
1838
  var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
1712
1839
 
@@ -1738,7 +1865,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1738
1865
  showModalRegister = _useState7[0],
1739
1866
  setShowModalRegister = _useState7[1];
1740
1867
 
1741
- var _useState8 = useState({
1868
+ var _useState8 = useState(1),
1869
+ ticketsQuantity = _useState8[0],
1870
+ setTicketsQuantity = _useState8[1];
1871
+
1872
+ var _useState9 = useState({
1742
1873
  firstName: '',
1743
1874
  lastName: '',
1744
1875
  email: '',
@@ -1753,8 +1884,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1753
1884
  state: '',
1754
1885
  zip: ''
1755
1886
  }),
1756
- userValues = _useState8[0],
1757
- setUserValues = _useState8[1];
1887
+ userValues = _useState9[0],
1888
+ setUserValues = _useState9[1];
1758
1889
 
1759
1890
  var isLoggedIn = !!access_token;
1760
1891
 
@@ -1767,12 +1898,25 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1767
1898
  var showDOB = getQueryVariable('age_required') === 'true';
1768
1899
  var showTicketHolderName = getQueryVariable('names_required') === 'true';
1769
1900
 
1770
- var optedInFieldValue = _get(cartInfoData, 'optedIn', false); // fetch cart data
1901
+ var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
1902
+
1903
+ var getQuantity = function getQuantity(cart) {
1904
+ if (cart === void 0) {
1905
+ cart = [];
1906
+ }
1907
+
1908
+ var qty = 0;
1909
+ cart.forEach(function (item) {
1910
+ qty += +item.quantity;
1911
+ });
1912
+ return qty;
1913
+ }; // fetch cart data
1771
1914
 
1772
1915
 
1773
1916
  var fetchCart = /*#__PURE__*/function () {
1774
1917
  var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1775
- var res;
1918
+ var res, cartInfo, _cartInfo$cart, cart;
1919
+
1776
1920
  return runtime_1.wrap(function _callee2$(_context2) {
1777
1921
  while (1) {
1778
1922
  switch (_context2.prev = _context2.next) {
@@ -1784,20 +1928,25 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1784
1928
  case 3:
1785
1929
  res = _context2.sent;
1786
1930
  setCustomHeader(res);
1787
- setCartInfo(_get(res, 'data.data.attributes'));
1788
- _context2.next = 10;
1931
+ cartInfo = _get(res, 'data.data.attributes');
1932
+ setCartInfo(cartInfo);
1933
+ _cartInfo$cart = cartInfo.cart, cart = _cartInfo$cart === void 0 ? [] : _cartInfo$cart;
1934
+ setTicketsQuantity(getQuantity(cart));
1935
+ onGetCartSuccess(res.data);
1936
+ _context2.next = 15;
1789
1937
  break;
1790
1938
 
1791
- case 8:
1792
- _context2.prev = 8;
1939
+ case 12:
1940
+ _context2.prev = 12;
1793
1941
  _context2.t0 = _context2["catch"](0);
1942
+ onGetCartError(_context2.t0.response);
1794
1943
 
1795
- case 10:
1944
+ case 15:
1796
1945
  case "end":
1797
1946
  return _context2.stop();
1798
1947
  }
1799
1948
  }
1800
- }, _callee2, null, [[0, 8]]);
1949
+ }, _callee2, null, [[0, 12]]);
1801
1950
  }));
1802
1951
 
1803
1952
  return function fetchCart() {
@@ -1816,7 +1965,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1816
1965
  _context3.prev = 0;
1817
1966
 
1818
1967
  if (!(typeof window !== 'undefined' && token)) {
1819
- _context3.next = 9;
1968
+ _context3.next = 10;
1820
1969
  break;
1821
1970
  }
1822
1971
 
@@ -1829,21 +1978,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1829
1978
  profileDataObj = setLoggedUserData(profileSpecifiedData);
1830
1979
  setUserValues(profileDataObj);
1831
1980
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1981
+ onGetProfileDataSuccess(userDataResponse.data);
1832
1982
 
1833
- case 9:
1834
- _context3.next = 13;
1983
+ case 10:
1984
+ _context3.next = 15;
1835
1985
  break;
1836
1986
 
1837
- case 11:
1838
- _context3.prev = 11;
1987
+ case 12:
1988
+ _context3.prev = 12;
1839
1989
  _context3.t0 = _context3["catch"](0);
1990
+ onGetProfileDataError(_context3.t0.response);
1840
1991
 
1841
- case 13:
1992
+ case 15:
1842
1993
  case "end":
1843
1994
  return _context3.stop();
1844
1995
  }
1845
1996
  }
1846
- }, _callee3, null, [[0, 11]]);
1997
+ }, _callee3, null, [[0, 12]]);
1847
1998
  }));
1848
1999
 
1849
2000
  return function fetchUserData(_x) {
@@ -1862,10 +2013,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1862
2013
  while (1) {
1863
2014
  switch (_context4.prev = _context4.next) {
1864
2015
  case 0:
1865
- _context4.next = 2;
2016
+ _context4.prev = 0;
2017
+ _context4.next = 3;
1866
2018
  return getCountries();
1867
2019
 
1868
- case 2:
2020
+ case 3:
1869
2021
  res = _context4.sent;
1870
2022
  setCustomHeader(res);
1871
2023
  setCountries(_map(_get(res, 'data.data'), function (item, key) {
@@ -1874,13 +2026,21 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1874
2026
  value: Number(key)
1875
2027
  };
1876
2028
  }));
2029
+ onGetCountriesSuccess(res.data);
2030
+ _context4.next = 12;
2031
+ break;
1877
2032
 
1878
- case 5:
2033
+ case 9:
2034
+ _context4.prev = 9;
2035
+ _context4.t0 = _context4["catch"](0);
2036
+ onGetCountriesError(_context4.t0.response);
2037
+
2038
+ case 12:
1879
2039
  case "end":
1880
2040
  return _context4.stop();
1881
2041
  }
1882
2042
  }
1883
- }, _callee4);
2043
+ }, _callee4, null, [[0, 9]]);
1884
2044
  }));
1885
2045
 
1886
2046
  return function fetchCountries() {
@@ -1903,7 +2063,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1903
2063
  enableReinitialize: true,
1904
2064
  onSubmit: function () {
1905
2065
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(values, formikHelpers) {
1906
- var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, bodyFormData, resRegister, access_token_register, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response, _e$response$data, _e$response2, error;
2066
+ 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;
1907
2067
 
1908
2068
  return runtime_1.wrap(function _callee5$(_context5) {
1909
2069
  while (1) {
@@ -1934,7 +2094,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1934
2094
  }
1935
2095
 
1936
2096
  case 9:
1937
- _checkoutBody = createCheckoutDataBody(values, {
2097
+ _checkoutBody = createCheckoutDataBody(ticketsQuantity, values, {
1938
2098
  emailLogged: emailLogged,
1939
2099
  firstNameLogged: firstNameLogged,
1940
2100
  lastNameLogged: lastNameLogged
@@ -1949,17 +2109,54 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1949
2109
 
1950
2110
  case 15:
1951
2111
  bodyFormData = createRegisterFormData(values);
1952
- _context5.next = 18;
2112
+ access_token_register = null;
2113
+ _context5.prev = 17;
2114
+ _context5.next = 20;
1953
2115
  return register(bodyFormData);
1954
2116
 
1955
- case 18:
2117
+ case 20:
1956
2118
  resRegister = _context5.sent;
1957
2119
  access_token_register = _get(resRegister, 'data.data.attributes.access_token');
2120
+ refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
1958
2121
  handleSetAccessToken(access_token_register);
1959
- _context5.next = 23;
2122
+ tokens = {
2123
+ accessToken: access_token_register,
2124
+ refreshToken: refreshToken
2125
+ };
2126
+ onRegisterSuccess(tokens);
2127
+ _context5.next = 33;
2128
+ break;
2129
+
2130
+ case 28:
2131
+ _context5.prev = 28;
2132
+ _context5.t0 = _context5["catch"](17);
2133
+
2134
+ if (axios.isAxiosError(_context5.t0)) {
2135
+ 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;
2136
+
2137
+ if (_includes(error, 'You must be aged')) {
2138
+ formikHelpers.setFieldError('holderAge', error);
2139
+ }
2140
+
2141
+ if (error != null && error.password) {
2142
+ formikHelpers.setFieldError('password', error.password);
2143
+ formikHelpers.setFieldError('confirmPassword', error.password);
2144
+ }
2145
+
2146
+ if (error != null && error.email) {
2147
+ setAlreadyHasUser(true);
2148
+ setShowModalLogin(true);
2149
+ }
2150
+ }
2151
+
2152
+ onRegisterError(_context5.t0.response);
2153
+ return _context5.abrupt("return");
2154
+
2155
+ case 33:
2156
+ _context5.next = 35;
1960
2157
  return getProfileData(access_token_register);
1961
2158
 
1962
- case 23:
2159
+ case 35:
1963
2160
  profileData = _context5.sent;
1964
2161
  profileSpecifiedData = _get(profileData, 'data.data');
1965
2162
  profileDataObj = setLoggedUserData(profileSpecifiedData);
@@ -1968,42 +2165,26 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1968
2165
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1969
2166
  }
1970
2167
 
1971
- checkoutBody = createCheckoutDataBody(values, {
2168
+ checkoutBody = createCheckoutDataBody(ticketsQuantity, values, {
1972
2169
  emailLogged: emailLogged,
1973
2170
  firstNameLogged: firstNameLogged,
1974
2171
  lastNameLogged: lastNameLogged
1975
2172
  }, showDOB);
1976
- _context5.next = 30;
2173
+ _context5.next = 42;
1977
2174
  return postOnCheckout(checkoutBody, access_token_register);
1978
2175
 
1979
- case 30:
2176
+ case 42:
1980
2177
  res = _context5.sent;
1981
2178
  handleSubmit(values, formikHelpers, res);
1982
- _context5.next = 37;
2179
+ _context5.next = 50;
1983
2180
  break;
1984
2181
 
1985
- case 34:
1986
- _context5.prev = 34;
1987
- _context5.t0 = _context5["catch"](0);
1988
-
1989
- if (axios.isAxiosError(_context5.t0)) {
1990
- 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;
1991
-
1992
- if (_includes(error, 'You must be aged')) {
1993
- formikHelpers.setFieldError('holderAge', error);
1994
- }
1995
-
1996
- if (error != null && error.password) {
1997
- formikHelpers.setFieldError('password', error.password);
1998
- formikHelpers.setFieldError('confirmPassword', error.password);
1999
- }
2000
-
2001
- if (error != null && error.email) {
2002
- setAlreadyHasUser(true);
2003
- setShowModalLogin(true);
2004
- }
2182
+ case 46:
2183
+ _context5.prev = 46;
2184
+ _context5.t1 = _context5["catch"](0);
2005
2185
 
2006
- if (((_e$response2 = _context5.t0.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
2186
+ if (axios.isAxiosError(_context5.t1)) {
2187
+ if (((_e$response2 = _context5.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
2007
2188
  if (typeof window !== 'undefined') {
2008
2189
  window.localStorage.removeItem('user_data');
2009
2190
  window.localStorage.removeItem('access_token');
@@ -2013,12 +2194,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2013
2194
  }
2014
2195
  }
2015
2196
 
2016
- case 37:
2197
+ onSubmitError(_context5.t1.response);
2198
+
2199
+ case 50:
2017
2200
  case "end":
2018
2201
  return _context5.stop();
2019
2202
  }
2020
2203
  }
2021
- }, _callee5, null, [[0, 34]]);
2204
+ }, _callee5, null, [[0, 46], [17, 28]]);
2022
2205
  }));
2023
2206
 
2024
2207
  function onSubmit(_x2, _x3) {
@@ -2035,7 +2218,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2035
2218
  setStates: setStates,
2036
2219
  setFieldValue: props.setFieldValue,
2037
2220
  setValues: props.setValues,
2038
- setUserValues: setUserValues
2221
+ setUserValues: setUserValues,
2222
+ onGetStatesSuccess: onGetStatesSuccess,
2223
+ onGetStatesError: onGetStatesError
2039
2224
  }), React.createElement("div", {
2040
2225
  className: "billing-info-container " + theme
2041
2226
  }, !isLoggedIn && React.createElement("div", {
@@ -2046,6 +2231,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2046
2231
  className: "login-register-button",
2047
2232
  type: "button",
2048
2233
  onClick: function onClick() {
2234
+ onLogin();
2049
2235
  setShowModalLogin(true);
2050
2236
  }
2051
2237
  }, "Login"))), _map(data, function (item) {
@@ -2062,13 +2248,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2062
2248
  key: id
2063
2249
  }, React.createElement("p", {
2064
2250
  className: labelClassName
2065
- }, label), _map(fields, function (group, index) {
2251
+ }, label), _map(fields, function (group) {
2066
2252
  var groupClassname = group.groupClassname,
2067
2253
  groupItems = group.groupItems,
2068
2254
  groupLabel = group.groupLabel,
2069
2255
  groupLabelClassName = group.groupLabelClassName;
2070
- return React.createElement("div", {
2071
- key: index
2256
+ return React.createElement(SectionContainer, {
2257
+ key: group.id
2072
2258
  }, !isLoggedIn && React.createElement("div", {
2073
2259
  className: groupLabelClassName
2074
2260
  }, groupLabel), React.createElement("div", {
@@ -2101,16 +2287,45 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2101
2287
  }));
2102
2288
  })));
2103
2289
  }));
2104
- }), React.createElement("div", {
2105
- style: {
2106
- display: 'flex',
2107
- padding: 20,
2108
- justifyContent: 'center'
2109
- }
2110
- }, React.createElement(Button, {
2290
+ }), showTicketHolderName && React.createElement(SectionContainer, {
2291
+ key: ticketHoldersFields.id
2292
+ }, React.createElement("p", null, ticketHoldersFields.label), _map(new Array(ticketsQuantity), function (_item, index) {
2293
+ return React.createElement("div", {
2294
+ key: index
2295
+ }, React.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group, i) {
2296
+ var groupClassname = group.groupClassname,
2297
+ groupItems = group.groupItems;
2298
+ return React.createElement("div", {
2299
+ key: i
2300
+ }, React.createElement("div", {
2301
+ className: groupClassname
2302
+ }, _map(groupItems, function (element) {
2303
+ return React.createElement("div", {
2304
+ className: element.className,
2305
+ key: element.name + "-" + index
2306
+ }, React.createElement(Field, {
2307
+ name: element.name + "-" + index,
2308
+ key: element.name + "-" + index,
2309
+ label: element.label,
2310
+ type: element.type,
2311
+ required: true,
2312
+ component: element.type === 'checkbox' ? CheckboxField : CustomField,
2313
+ validate: combineValidators(element.required ? requiredValidator : function () {}, element.onValidate ? element.onValidate : function () {})
2314
+ }));
2315
+ })));
2316
+ }));
2317
+ })), React.createElement("div", {
2318
+ className: "button-container"
2319
+ }, React.createElement(LoadingButton, {
2111
2320
  type: "submit",
2112
2321
  variant: "contained",
2113
- className: "login-register-button"
2322
+ className: "login-register-button",
2323
+ loadingIndicator: React.createElement(CircularProgress, {
2324
+ color: "inherit",
2325
+ size: 26
2326
+ }),
2327
+ loading: props.isSubmitting,
2328
+ disabled: props.isSubmitting
2114
2329
  }, buttonName))));
2115
2330
  }), showModalLogin && React.createElement(LoginModal, {
2116
2331
  onClose: function onClose() {
@@ -2121,14 +2336,20 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2121
2336
  },
2122
2337
  alreadyHasUser: alreadyHasUser,
2123
2338
  userExpired: userExpired,
2124
- setUserExpired: setUserExpired
2339
+ setUserExpired: setUserExpired,
2340
+ onAuthorizeSuccess: onAuthorizeSuccess,
2341
+ onAuthorizeError: onAuthorizeError,
2342
+ onGetProfileDataSuccess: onGetProfileDataSuccess,
2343
+ onGetProfileDataError: onGetProfileDataError
2125
2344
  }), showModalRegister && React.createElement(RegisterModal, {
2126
2345
  onClose: function onClose() {
2127
2346
  setShowModalRegister(false);
2128
2347
  },
2129
2348
  onRegister: function onRegister() {
2130
2349
  setShowModalRegister(false);
2131
- }
2350
+ },
2351
+ onGetProfileDataSuccess: onGetProfileDataSuccess,
2352
+ onGetProfileDataError: onGetProfileDataError
2132
2353
  }));
2133
2354
  };
2134
2355
 
@@ -2409,7 +2630,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2409
2630
  }, React.createElement("button", {
2410
2631
  disabled: !stripe || !!error || isLoading,
2411
2632
  type: "submit"
2412
- }, isLoading ? React.createElement(CircularProgress, null) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
2633
+ }, isLoading ? React.createElement(CircularProgress$1, null) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
2413
2634
  };
2414
2635
 
2415
2636
  var testId = ENV.STRIPE_PUBLISHABLE_KEY ;
@@ -2441,7 +2662,13 @@ var PaymentContainer = function PaymentContainer(_ref) {
2441
2662
  errorText = _ref.errorText,
2442
2663
  checkoutData = _ref.checkoutData,
2443
2664
  _ref$onErrorClose = _ref.onErrorClose,
2444
- onErrorClose = _ref$onErrorClose === void 0 ? _identity : _ref$onErrorClose;
2665
+ onErrorClose = _ref$onErrorClose === void 0 ? _identity : _ref$onErrorClose,
2666
+ _ref$onGetPaymentData = _ref.onGetPaymentDataSuccess,
2667
+ onGetPaymentDataSuccess = _ref$onGetPaymentData === void 0 ? function () {} : _ref$onGetPaymentData,
2668
+ _ref$onGetPaymentData2 = _ref.onGetPaymentDataError,
2669
+ onGetPaymentDataError = _ref$onGetPaymentData2 === void 0 ? function () {} : _ref$onGetPaymentData2,
2670
+ _ref$onPaymentError = _ref.onPaymentError,
2671
+ onPaymentError = _ref$onPaymentError === void 0 ? function () {} : _ref$onPaymentError;
2445
2672
 
2446
2673
  var _useState = useState(initialReviewValues),
2447
2674
  reviewData = _useState[0],
@@ -2492,17 +2719,19 @@ var PaymentContainer = function PaymentContainer(_ref) {
2492
2719
  currency: order_details == null ? void 0 : order_details.currency
2493
2720
  };
2494
2721
  setOrderData(_orderData);
2722
+ onGetPaymentDataSuccess(response.data);
2495
2723
  }
2496
2724
 
2497
- _context.next = 10;
2725
+ _context.next = 11;
2498
2726
  break;
2499
2727
 
2500
2728
  case 7:
2501
2729
  _context.prev = 7;
2502
2730
  _context.t0 = _context["catch"](0);
2503
2731
  setError(_get(_context.t0, 'response.data.message'));
2732
+ onGetPaymentDataError(_context.t0.response);
2504
2733
 
2505
- case 10:
2734
+ case 11:
2506
2735
  case "end":
2507
2736
  return _context.stop();
2508
2737
  }
@@ -2543,15 +2772,16 @@ var PaymentContainer = function PaymentContainer(_ref) {
2543
2772
  setPaymentIsLoading(false);
2544
2773
  }
2545
2774
 
2546
- _context2.next = 14;
2775
+ _context2.next = 15;
2547
2776
  break;
2548
2777
 
2549
2778
  case 11:
2550
2779
  _context2.prev = 11;
2551
2780
  _context2.t0 = _context2["catch"](0);
2552
2781
  setError(_get(_context2.t0, 'response.data.message'));
2782
+ onPaymentError(_context2.t0.response);
2553
2783
 
2554
- case 14:
2784
+ case 15:
2555
2785
  case "end":
2556
2786
  return _context2.stop();
2557
2787
  }
@@ -2623,7 +2853,11 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
2623
2853
  _ref$shareButtons = _ref.shareButtons,
2624
2854
  shareButtons = _ref$shareButtons === void 0 ? [] : _ref$shareButtons,
2625
2855
  _ref$shareLink = _ref.shareLink,
2626
- shareLink = _ref$shareLink === void 0 ? '' : _ref$shareLink;
2856
+ shareLink = _ref$shareLink === void 0 ? '' : _ref$shareLink,
2857
+ _ref$onGetConfirmatio = _ref.onGetConfirmationDataSuccess,
2858
+ onGetConfirmationDataSuccess = _ref$onGetConfirmatio === void 0 ? function () {} : _ref$onGetConfirmatio,
2859
+ _ref$onGetConfirmatio2 = _ref.onGetConfirmationDataError,
2860
+ onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2;
2627
2861
  var inputRef = useRef(null);
2628
2862
 
2629
2863
  var _useState = useState({}),
@@ -2644,7 +2878,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
2644
2878
  dataEncoded = typeof window !== 'undefined' && window.localStorage.getItem('checkoutData');
2645
2879
 
2646
2880
  if (!dataEncoded) {
2647
- _context.next = 14;
2881
+ _context.next = 16;
2648
2882
  break;
2649
2883
  }
2650
2884
 
@@ -2658,21 +2892,23 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
2658
2892
  response = _context.sent;
2659
2893
  _data = _get(response, 'data.data.attributes');
2660
2894
  setData(_data);
2661
- _context.next = 14;
2895
+ onGetConfirmationDataSuccess(response.data);
2896
+ _context.next = 16;
2662
2897
  break;
2663
2898
 
2664
- case 12:
2665
- _context.prev = 12;
2899
+ case 13:
2900
+ _context.prev = 13;
2666
2901
  _context.t0 = _context["catch"](4);
2902
+ onGetConfirmationDataError(_context.t0.response);
2667
2903
 
2668
- case 14:
2904
+ case 16:
2669
2905
  case "end":
2670
2906
  return _context.stop();
2671
2907
  }
2672
2908
  }
2673
- }, _callee, null, [[4, 12]]);
2909
+ }, _callee, null, [[4, 13]]);
2674
2910
  }))();
2675
- }, []);
2911
+ }, [onGetConfirmationDataSuccess, onGetConfirmationDataError]);
2676
2912
  return React.createElement("div", {
2677
2913
  className: "confirmation-page"
2678
2914
  }, React.createElement("p", {
@@ -2886,7 +3122,7 @@ var renderTiers = function renderTiers(boxOffice, selectedTickets, handleTicketS
2886
3122
  function Loader() {
2887
3123
  return React.createElement("div", {
2888
3124
  className: "loader-container"
2889
- }, React.createElement(CircularProgress, null));
3125
+ }, React.createElement(CircularProgress$1, null));
2890
3126
  }
2891
3127
 
2892
3128
  var TicketsContainer = function TicketsContainer(_ref) {
@@ -2894,7 +3130,13 @@ var TicketsContainer = function TicketsContainer(_ref) {
2894
3130
  eventId = _ref.eventId,
2895
3131
  onAddToCartSuccess = _ref.onAddToCartSuccess,
2896
3132
  _ref$contentStyle = _ref.contentStyle,
2897
- contentStyle = _ref$contentStyle === void 0 ? {} : _ref$contentStyle;
3133
+ contentStyle = _ref$contentStyle === void 0 ? {} : _ref$contentStyle,
3134
+ _ref$onAddToCartError = _ref.onAddToCartError,
3135
+ onAddToCartError = _ref$onAddToCartError === void 0 ? function () {} : _ref$onAddToCartError,
3136
+ _ref$onGetTicketsSucc = _ref.onGetTicketsSuccess,
3137
+ onGetTicketsSuccess = _ref$onGetTicketsSucc === void 0 ? function () {} : _ref$onGetTicketsSucc,
3138
+ _ref$onGetTicketsErro = _ref.onGetTicketsError,
3139
+ onGetTicketsError = _ref$onGetTicketsErro === void 0 ? function () {} : _ref$onGetTicketsErro;
2898
3140
 
2899
3141
  var _useState = useState({}),
2900
3142
  selectedTickets = _useState[0],
@@ -2971,6 +3213,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
2971
3213
  return _isObject(item);
2972
3214
  });
2973
3215
  setTickets(_tickets);
3216
+ onGetTicketsSuccess(response.data);
2974
3217
  }
2975
3218
 
2976
3219
  _context.next = 11;
@@ -2979,7 +3222,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
2979
3222
  case 8:
2980
3223
  _context.prev = 8;
2981
3224
  _context.t0 = _context["catch"](0);
2982
- console.log('e', _context.t0);
3225
+ onGetTicketsError(_context.t0.response);
2983
3226
 
2984
3227
  case 11:
2985
3228
  _context.prev = 11;
@@ -3062,7 +3305,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
3062
3305
  case 13:
3063
3306
  _context2.prev = 13;
3064
3307
  _context2.t0 = _context2["catch"](6);
3065
- console.log('e', _context2.t0);
3308
+ onAddToCartError(_context2.t0.response);
3066
3309
 
3067
3310
  case 16:
3068
3311
  _context2.prev = 16;
@@ -3102,13 +3345,13 @@ var TicketsContainer = function TicketsContainer(_ref) {
3102
3345
  setPromoCodeUpdated(promoCode);
3103
3346
  }
3104
3347
  }
3105
- }), React.createElement(Button$1, {
3348
+ }), React.createElement(Button, {
3106
3349
  className: "promo-apply-button",
3107
3350
  placeholder: "Promo Code",
3108
3351
  onClick: function onClick() {
3109
3352
  setPromoCodeUpdated(promoCode);
3110
3353
  }
3111
- }, "Apply")), !showPromoInput && !isAllTicketsSoldOut ? React.createElement(Button$1, {
3354
+ }, "Apply")), !showPromoInput && !isAllTicketsSoldOut ? React.createElement(Button, {
3112
3355
  className: "promo-code-button",
3113
3356
  placeholder: "Promo Codes",
3114
3357
  onClick: function onClick() {
@@ -3119,7 +3362,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
3119
3362
  style: {
3120
3363
  display: 'none'
3121
3364
  }
3122
- }), !isAllTicketsSoldOut && React.createElement(Button$1, {
3365
+ }), !isAllTicketsSoldOut && React.createElement(Button, {
3123
3366
  "aria-hidden": true,
3124
3367
  className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
3125
3368
  onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}