tf-checkout-react 1.0.13 → 1.0.17

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.
@@ -10,9 +10,9 @@ export declare function getTickets(id: string | number): Promise<import("axios")
10
10
  export declare const addToCart: (id: string | number, data: any) => Promise<import("axios").AxiosResponse<any, any>>;
11
11
  export declare const getCart: () => Promise<import("axios").AxiosResponse<any, any>>;
12
12
  export declare const postOnCheckout: (data: any, accessToken: string) => Promise<import("axios").AxiosResponse<any, any>>;
13
- export declare const authorize: (data: FormData) => import("axios").AxiosPromise<any>;
13
+ export declare const authorize: (data: FormData) => Promise<import("axios").AxiosResponse<any, any>>;
14
14
  export declare const register: (data: FormData) => Promise<import("axios").AxiosResponse<any, any>>;
15
- export declare const getAccessToken: (data: FormData) => import("axios").AxiosPromise<any>;
15
+ export declare const getAccessToken: (data: FormData) => Promise<import("axios").AxiosResponse<any, any>>;
16
16
  export declare const getPaymentData: (hash: string) => Promise<import("axios").AxiosResponse<any, any>>;
17
17
  export declare const handlePaymentData: (orderHash: string, data: any) => Promise<import("axios").AxiosResponse<any, any>>;
18
18
  export declare const getProfileData: (accessToken: any) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -7,5 +7,6 @@ export interface IBillingInfoPage {
7
7
  handleSubmit: (values: FormikValues, formikHelpers: FormikHelpers<FormikValues>, res?: any) => void;
8
8
  initialValues?: FormikValues;
9
9
  buttonName?: string;
10
+ theme?: 'light' | 'dark';
10
11
  }
11
- export declare const BillingInfoContainer: ({ data, initialValues, buttonName, handleSubmit, }: IBillingInfoPage) => JSX.Element;
12
+ export declare const BillingInfoContainer: ({ data, initialValues, buttonName, handleSubmit, theme }: IBillingInfoPage) => JSX.Element;
@@ -1,4 +1,4 @@
1
- .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__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{background-color:#f28051;border:#f28051;border-radius:5px;color:#fff;cursor:pointer;display:block;font-family:Inter-Bold;font-size:1rem;font-weight:700;line-height:1.15;margin:10px 0;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_login-register-block__36tu5{display:flex;justify-content:space-between}
1
+ .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__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:#f28051;border:#f28051;border-radius:5px;color:#fff;cursor:pointer;display:block;font-family:Inter-Bold;font-size:1rem;font-weight:700;line-height:1.15;margin:10px 0;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_login-register-block__36tu5{display:flex;justify-content:space-between}
2
2
  .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:#f28051;border:none;border-radius:0;color:#fff;cursor:pointer;font-size:18px;font-weight:600;height:45px;line-height:18px;margin:10px 0;outline:none;padding:10px;width:100%}.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}
3
3
  .style_register-container___s5V8{margin:0 auto;max-width:800px}.style_register-container___s5V8 .style_is-half__2XhZU{width:49%}.style_register-container__twoFields__3dAvM{display:flex;justify-content:space-between;margin-top:15px}.style_register-container__singleField__36dGU{margin-top:15px}button{margin-top:10px}
4
4
  .style_payment_page__1PUd8{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,Icons16,sans-serif}.style_payment_page__1PUd8 .style_order_info_section__J1olw{padding:15px 0}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4{padding-bottom:15px;padding-top:15px}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4 .style_field-underline__2M8Bd{border-bottom:1px solid #000;padding-bottom:15px}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4 .style_order_info_title__1MBgS{font-size:14px;font-weight:700;padding-bottom:3px}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4 .style_order_info_text__3gSEK{font-size:16px;line-height:1.15;outline:none}.style_payment_page__1PUd8 .style_MuiBox-root__2LeaA{margin-left:auto;margin-right:auto;padding:20px;text-align:center}.style_payment_page__1PUd8 .style_payment_info_label__3Zmjp{padding:20px 0;text-align:center}.style_payment_page__1PUd8 .style_payment_form__2arf4{color:#fff;padding:20px}.style_payment_page__1PUd8 .style_payment_form__2arf4 input,.style_payment_page__1PUd8 .style_payment_form__2arf4 label{color:#fff}.style_payment_page__1PUd8 .style_payment_button__3WzAn{padding-top:20px;text-align:center}
@@ -8,6 +8,7 @@ var React = require('react');
8
8
  var React__default = _interopDefault(React);
9
9
  var formik = require('formik');
10
10
  var TextField = _interopDefault(require('@mui/material/TextField'));
11
+ var Button = _interopDefault(require('@mui/material/Button'));
11
12
  var _identity = _interopDefault(require('lodash/identity'));
12
13
  var _map = _interopDefault(require('lodash/map'));
13
14
  var _get = _interopDefault(require('lodash/get'));
@@ -948,27 +949,13 @@ var postOnCheckout = function postOnCheckout(data, accessToken) {
948
949
  return res;
949
950
  };
950
951
  var authorize = function authorize(data) {
951
- return axios({
952
- method: 'post',
953
- url: 'https://www.ticketfairy.com/api/v1/oauth/authorize-rn?client_id=4792a61f2fcb49197ab4c2d2f44df570',
954
- data: data,
955
- headers: {
956
- 'Content-Type': 'multipart/form-data'
957
- }
958
- });
952
+ return publicRequest.post('/v1/oauth/authorize-rn?client_id=4792a61f2fcb49197ab4c2d2f44df570', data);
959
953
  };
960
954
  var register = function register(data) {
961
955
  return publicRequest.post('/v1/oauth/register-rn', data);
962
956
  };
963
957
  var getAccessToken = function getAccessToken(data) {
964
- return axios({
965
- method: 'post',
966
- url: 'https://www.ticketfairy.com/api/v1/oauth/access_token',
967
- data: data,
968
- headers: {
969
- 'Content-Type': 'multipart/form-data'
970
- }
971
- });
958
+ return publicRequest.post('/v1/oauth/access_token', data);
972
959
  };
973
960
  var getPaymentData = function getPaymentData(hash) {
974
961
  var response = publicRequest.get("v1/order/" + hash + "/review/")["catch"](function (error) {
@@ -1070,24 +1057,28 @@ var LoginModal = function LoginModal(_ref) {
1070
1057
  last_name: profileSpecifiedData.lastName,
1071
1058
  email: profileSpecifiedData.email
1072
1059
  };
1073
- localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1074
- localStorage.setItem('access_token', accessToken);
1060
+
1061
+ if (typeof window !== 'undefined') {
1062
+ window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1063
+ window.localStorage.setItem('access_token', accessToken);
1064
+ }
1065
+
1075
1066
  onLogin();
1076
- _context.next = 33;
1067
+ _context.next = 32;
1077
1068
  break;
1078
1069
 
1079
- case 29:
1080
- _context.prev = 29;
1070
+ case 28:
1071
+ _context.prev = 28;
1081
1072
  _context.t0 = _context["catch"](1);
1082
1073
  _error = _context.t0.response.data.message || 'Error';
1083
1074
  setError(_error);
1084
1075
 
1085
- case 33:
1076
+ case 32:
1086
1077
  case "end":
1087
1078
  return _context.stop();
1088
1079
  }
1089
1080
  }
1090
- }, _callee, null, [[1, 29]]);
1081
+ }, _callee, null, [[1, 28]]);
1091
1082
  }));
1092
1083
 
1093
1084
  function onSubmit(_x) {
@@ -1203,11 +1194,15 @@ var RegisterModal = function RegisterModal(_ref) {
1203
1194
  last_name: profileSpecifiedData.lastName,
1204
1195
  email: profileSpecifiedData.email
1205
1196
  };
1206
- localStorage.setItem('access_token', access_token);
1207
- localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1197
+
1198
+ if (typeof window !== 'undefined') {
1199
+ window.localStorage.setItem('access_token', access_token);
1200
+ window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1201
+ }
1202
+
1208
1203
  onClose();
1209
1204
 
1210
- case 22:
1205
+ case 21:
1211
1206
  case "end":
1212
1207
  return _context.stop();
1213
1208
  }
@@ -1324,7 +1319,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1324
1319
  _ref$buttonName = _ref.buttonName,
1325
1320
  buttonName = _ref$buttonName === void 0 ? 'Submit' : _ref$buttonName,
1326
1321
  _ref$handleSubmit = _ref.handleSubmit,
1327
- handleSubmit = _ref$handleSubmit === void 0 ? _identity : _ref$handleSubmit;
1322
+ handleSubmit = _ref$handleSubmit === void 0 ? _identity : _ref$handleSubmit,
1323
+ _ref$theme = _ref.theme,
1324
+ theme = _ref$theme === void 0 ? 'light' : _ref$theme;
1328
1325
  var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
1329
1326
  var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
1330
1327
 
@@ -1402,7 +1399,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1402
1399
  }),
1403
1400
  onSubmit: function () {
1404
1401
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(values, formikHelpers) {
1405
- var _holderAge, bodyFormData, resRegister, access_token_register, profileData, profileSpecifiedData, profileDataObj, holderAge, res, error;
1402
+ var _holderAge, _res, bodyFormData, resRegister, access_token_register, profileData, profileSpecifiedData, profileDataObj, holderAge, res, error;
1406
1403
 
1407
1404
  return runtime_1.wrap(function _callee2$(_context2) {
1408
1405
  while (1) {
@@ -1411,7 +1408,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1411
1408
  _context2.prev = 0;
1412
1409
 
1413
1410
  if (!isLoggedIn) {
1414
- _context2.next = 7;
1411
+ _context2.next = 9;
1415
1412
  break;
1416
1413
  }
1417
1414
 
@@ -1434,10 +1431,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1434
1431
  }, access_token);
1435
1432
 
1436
1433
  case 5:
1437
- window.location.replace('/checkout');
1434
+ _res = _context2.sent;
1435
+ handleSubmit(values, formikHelpers, _res);
1436
+ window.location.replace('/billing/checkout');
1438
1437
  return _context2.abrupt("return");
1439
1438
 
1440
- case 7:
1439
+ case 9:
1441
1440
  bodyFormData = new FormData();
1442
1441
  bodyFormData.append('first_name', values.firstName);
1443
1442
  bodyFormData.append('last_name', values.lastName);
@@ -1446,17 +1445,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1446
1445
  bodyFormData.append('password_confirmation', values.confirmPassword);
1447
1446
  bodyFormData.append('client_id', '4792a61f2fcb49197ab4c2d2f44df570');
1448
1447
  bodyFormData.append('client_secret', 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9');
1449
- _context2.next = 17;
1448
+ _context2.next = 19;
1450
1449
  return register(bodyFormData);
1451
1450
 
1452
- case 17:
1451
+ case 19:
1453
1452
  resRegister = _context2.sent;
1454
1453
  access_token_register = _get(resRegister, 'data.data.attributes.access_token');
1455
1454
  handleSetAccessToken(access_token_register);
1456
- _context2.next = 22;
1455
+ _context2.next = 24;
1457
1456
  return getProfileData(access_token_register);
1458
1457
 
1459
- case 22:
1458
+ case 24:
1460
1459
  profileData = _context2.sent;
1461
1460
  profileSpecifiedData = _get(profileData, 'data.data');
1462
1461
  profileDataObj = {
@@ -1465,10 +1464,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1465
1464
  last_name: profileSpecifiedData.lastName,
1466
1465
  email: profileSpecifiedData.email
1467
1466
  };
1468
- localStorage.setItem('access_token', access_token_register);
1469
- localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1467
+
1468
+ if (typeof window !== 'undefined') {
1469
+ window.localStorage.setItem('access_token', access_token_register);
1470
+ window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
1471
+ }
1472
+
1470
1473
  holderAge = new Date(values.holderAge);
1471
- _context2.next = 30;
1474
+ _context2.next = 31;
1472
1475
  return postOnCheckout({
1473
1476
  attributes: {
1474
1477
  email: values.email,
@@ -1485,14 +1488,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1485
1488
  }
1486
1489
  }, access_token_register);
1487
1490
 
1488
- case 30:
1491
+ case 31:
1489
1492
  res = _context2.sent;
1490
1493
  handleSubmit(values, formikHelpers, res);
1491
- _context2.next = 38;
1494
+ _context2.next = 39;
1492
1495
  break;
1493
1496
 
1494
- case 34:
1495
- _context2.prev = 34;
1497
+ case 35:
1498
+ _context2.prev = 35;
1496
1499
  _context2.t0 = _context2["catch"](0);
1497
1500
  error = _context2.t0.response.data.message;
1498
1501
 
@@ -1501,12 +1504,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1501
1504
  setShowModalLogin(true);
1502
1505
  }
1503
1506
 
1504
- case 38:
1507
+ case 39:
1505
1508
  case "end":
1506
1509
  return _context2.stop();
1507
1510
  }
1508
1511
  }
1509
- }, _callee2, null, [[0, 34]]);
1512
+ }, _callee2, null, [[0, 35]]);
1510
1513
  }));
1511
1514
 
1512
1515
  function onSubmit(_x, _x2) {
@@ -1519,7 +1522,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1519
1522
  return React__default.createElement(formik.Form, {
1520
1523
  onSubmit: props.handleSubmit
1521
1524
  }, React__default.createElement("div", {
1522
- className: "billing-info-container"
1525
+ className: "billing-info-container " + theme
1523
1526
  }, !isLoggedIn && React__default.createElement("div", {
1524
1527
  className: "account-actions-block"
1525
1528
  }, React__default.createElement("div", null, "Got a Restless Nites account?"), React__default.createElement("div", null, "Login & skip ahead:"), React__default.createElement("div", {
@@ -1563,14 +1566,25 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
1563
1566
  type: element.type,
1564
1567
  fullWidth: true,
1565
1568
  error: !!meta.error && meta.touched,
1566
- helperText: meta.touched && meta.error
1569
+ helperText: meta.touched && meta.error,
1570
+ InputLabelProps: element.type === 'date' ? {
1571
+ shrink: true
1572
+ } : {}
1567
1573
  }, field));
1568
1574
  }));
1569
1575
  }));
1570
1576
  }));
1571
- }), React__default.createElement("button", {
1572
- type: "submit"
1573
- }, buttonName)));
1577
+ }), React__default.createElement("div", {
1578
+ style: {
1579
+ display: 'flex',
1580
+ padding: 20,
1581
+ justifyContent: 'center'
1582
+ }
1583
+ }, React__default.createElement(Button, {
1584
+ type: "submit",
1585
+ variant: "contained",
1586
+ className: "login-register-button"
1587
+ }, buttonName))));
1574
1588
  }), showModalLogin && React__default.createElement(LoginModal, {
1575
1589
  onClose: function onClose() {
1576
1590
  setShowModalLogin(false);
@@ -1798,26 +1812,27 @@ var PaymentContainer = function PaymentContainer(_ref) {
1798
1812
 
1799
1813
  case 8:
1800
1814
  paymentResponse = _context2.sent;
1815
+ console.log(paymentResponse);
1801
1816
 
1802
1817
  if (paymentResponse.status === 200) {
1803
1818
  handlePayment(paymentResponse);
1804
1819
  }
1805
1820
 
1806
- _context2.next = 15;
1821
+ _context2.next = 16;
1807
1822
  break;
1808
1823
 
1809
- case 12:
1810
- _context2.prev = 12;
1824
+ case 13:
1825
+ _context2.prev = 13;
1811
1826
  _context2.t0 = _context2["catch"](1);
1812
1827
  //Handle payment errors
1813
1828
  console.log(_context2.t0);
1814
1829
 
1815
- case 15:
1830
+ case 16:
1816
1831
  case "end":
1817
1832
  return _context2.stop();
1818
1833
  }
1819
1834
  }
1820
- }, _callee2, null, [[1, 12]]);
1835
+ }, _callee2, null, [[1, 13]]);
1821
1836
  }));
1822
1837
 
1823
1838
  return function handlePaymentMiddleWare(_x) {