tf-checkout-react 1.0.13 → 1.0.14

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.
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useEffect, useRef } from 'react';
2
2
  import { Formik, Form, Field } from 'formik';
3
3
  import TextField$1 from '@mui/material/TextField';
4
+ import Button from '@mui/material/Button';
4
5
  import _identity from 'lodash-es/identity';
5
6
  import _map from 'lodash-es/map';
6
7
  import _get from 'lodash-es/get';
@@ -941,27 +942,13 @@ var postOnCheckout = function postOnCheckout(data, accessToken) {
941
942
  return res;
942
943
  };
943
944
  var authorize = function authorize(data) {
944
- return axios({
945
- method: 'post',
946
- url: 'https://www.ticketfairy.com/api/v1/oauth/authorize-rn?client_id=4792a61f2fcb49197ab4c2d2f44df570',
947
- data: data,
948
- headers: {
949
- 'Content-Type': 'multipart/form-data'
950
- }
951
- });
945
+ return publicRequest.post('/v1/oauth/authorize-rn?client_id=4792a61f2fcb49197ab4c2d2f44df570', data);
952
946
  };
953
947
  var register = function register(data) {
954
948
  return publicRequest.post('/v1/oauth/register-rn', data);
955
949
  };
956
950
  var getAccessToken = function getAccessToken(data) {
957
- return axios({
958
- method: 'post',
959
- url: 'https://www.ticketfairy.com/api/v1/oauth/access_token',
960
- data: data,
961
- headers: {
962
- 'Content-Type': 'multipart/form-data'
963
- }
964
- });
951
+ return publicRequest.post('/v1/oauth/access_token', data);
965
952
  };
966
953
  var getPaymentData = function getPaymentData(hash) {
967
954
  var response = publicRequest.get("v1/order/" + hash + "/review/")["catch"](function (error) {
@@ -1063,24 +1050,28 @@ var LoginModal = function LoginModal(_ref) {
1063
1050
  last_name: profileSpecifiedData.lastName,
1064
1051
  email: profileSpecifiedData.email
1065
1052
  };
1066
- localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1067
- localStorage.setItem('access_token', accessToken);
1053
+
1054
+ if (typeof window !== 'undefined') {
1055
+ window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1056
+ window.localStorage.setItem('access_token', accessToken);
1057
+ }
1058
+
1068
1059
  onLogin();
1069
- _context.next = 33;
1060
+ _context.next = 32;
1070
1061
  break;
1071
1062
 
1072
- case 29:
1073
- _context.prev = 29;
1063
+ case 28:
1064
+ _context.prev = 28;
1074
1065
  _context.t0 = _context["catch"](1);
1075
1066
  _error = _context.t0.response.data.message || 'Error';
1076
1067
  setError(_error);
1077
1068
 
1078
- case 33:
1069
+ case 32:
1079
1070
  case "end":
1080
1071
  return _context.stop();
1081
1072
  }
1082
1073
  }
1083
- }, _callee, null, [[1, 29]]);
1074
+ }, _callee, null, [[1, 28]]);
1084
1075
  }));
1085
1076
 
1086
1077
  function onSubmit(_x) {
@@ -1196,11 +1187,15 @@ var RegisterModal = function RegisterModal(_ref) {
1196
1187
  last_name: profileSpecifiedData.lastName,
1197
1188
  email: profileSpecifiedData.email
1198
1189
  };
1199
- localStorage.setItem('access_token', access_token);
1200
- localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1190
+
1191
+ if (typeof window !== 'undefined') {
1192
+ window.localStorage.setItem('access_token', access_token);
1193
+ window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1194
+ }
1195
+
1201
1196
  onClose();
1202
1197
 
1203
- case 22:
1198
+ case 21:
1204
1199
  case "end":
1205
1200
  return _context.stop();
1206
1201
  }
@@ -1317,7 +1312,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1317
1312
  _ref$buttonName = _ref.buttonName,
1318
1313
  buttonName = _ref$buttonName === void 0 ? 'Submit' : _ref$buttonName,
1319
1314
  _ref$handleSubmit = _ref.handleSubmit,
1320
- handleSubmit = _ref$handleSubmit === void 0 ? _identity : _ref$handleSubmit;
1315
+ handleSubmit = _ref$handleSubmit === void 0 ? _identity : _ref$handleSubmit,
1316
+ _ref$theme = _ref.theme,
1317
+ theme = _ref$theme === void 0 ? 'light' : _ref$theme;
1321
1318
  var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
1322
1319
  var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
1323
1320
 
@@ -1458,10 +1455,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1458
1455
  last_name: profileSpecifiedData.lastName,
1459
1456
  email: profileSpecifiedData.email
1460
1457
  };
1461
- localStorage.setItem('access_token', access_token_register);
1462
- localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1458
+
1459
+ if (typeof window !== 'undefined') {
1460
+ window.localStorage.setItem('access_token', access_token_register);
1461
+ window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1462
+ }
1463
+
1463
1464
  holderAge = new Date(values.holderAge);
1464
- _context2.next = 30;
1465
+ _context2.next = 29;
1465
1466
  return postOnCheckout({
1466
1467
  attributes: {
1467
1468
  email: values.email,
@@ -1478,14 +1479,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1478
1479
  }
1479
1480
  }, access_token_register);
1480
1481
 
1481
- case 30:
1482
+ case 29:
1482
1483
  res = _context2.sent;
1483
1484
  handleSubmit(values, formikHelpers, res);
1484
- _context2.next = 38;
1485
+ _context2.next = 37;
1485
1486
  break;
1486
1487
 
1487
- case 34:
1488
- _context2.prev = 34;
1488
+ case 33:
1489
+ _context2.prev = 33;
1489
1490
  _context2.t0 = _context2["catch"](0);
1490
1491
  error = _context2.t0.response.data.message;
1491
1492
 
@@ -1494,12 +1495,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1494
1495
  setShowModalLogin(true);
1495
1496
  }
1496
1497
 
1497
- case 38:
1498
+ case 37:
1498
1499
  case "end":
1499
1500
  return _context2.stop();
1500
1501
  }
1501
1502
  }
1502
- }, _callee2, null, [[0, 34]]);
1503
+ }, _callee2, null, [[0, 33]]);
1503
1504
  }));
1504
1505
 
1505
1506
  function onSubmit(_x, _x2) {
@@ -1512,7 +1513,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1512
1513
  return React.createElement(Form, {
1513
1514
  onSubmit: props.handleSubmit
1514
1515
  }, React.createElement("div", {
1515
- className: "billing-info-container"
1516
+ className: "billing-info-container " + theme
1516
1517
  }, !isLoggedIn && React.createElement("div", {
1517
1518
  className: "account-actions-block"
1518
1519
  }, React.createElement("div", null, "Got a Restless Nites account?"), React.createElement("div", null, "Login & skip ahead:"), React.createElement("div", {
@@ -1556,14 +1557,25 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1556
1557
  type: element.type,
1557
1558
  fullWidth: true,
1558
1559
  error: !!meta.error && meta.touched,
1559
- helperText: meta.touched && meta.error
1560
+ helperText: meta.touched && meta.error,
1561
+ InputLabelProps: element.type === 'date' ? {
1562
+ shrink: true
1563
+ } : {}
1560
1564
  }, field));
1561
1565
  }));
1562
1566
  }));
1563
1567
  }));
1564
- }), React.createElement("button", {
1565
- type: "submit"
1566
- }, buttonName)));
1568
+ }), React.createElement("div", {
1569
+ style: {
1570
+ display: 'flex',
1571
+ padding: 20,
1572
+ justifyContent: 'center'
1573
+ }
1574
+ }, React.createElement(Button, {
1575
+ type: "submit",
1576
+ variant: "contained",
1577
+ className: "login-register-button"
1578
+ }, buttonName))));
1567
1579
  }), showModalLogin && React.createElement(LoginModal, {
1568
1580
  onClose: function onClose() {
1569
1581
  setShowModalLogin(false);