tf-checkout-react 1.0.10 → 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.
- package/dist/api/index.d.ts +2 -2
- package/dist/components/billing-info-container/index.d.ts +2 -1
- package/dist/tf-checkout-react.cjs.development.css +1 -1
- package/dist/tf-checkout-react.cjs.development.js +56 -50
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +56 -50
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +6 -20
- package/src/components/billing-info-container/index.tsx +28 -4
- package/src/components/billing-info-container/style.css +2 -0
- package/src/components/loginModal/index.tsx +5 -3
- package/src/components/registerModal/index.tsx +5 -3
|
@@ -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';
|
|
@@ -860,14 +861,8 @@ var requiredValidator = function requiredValidator(value) {
|
|
|
860
861
|
|
|
861
862
|
var ttfHeaders = {
|
|
862
863
|
Accept: 'application/vnd.api+json',
|
|
863
|
-
'Content-Type': 'application/vnd.api+json'
|
|
864
|
-
'X-Source-Origin': 'https://restlessnit.es'
|
|
864
|
+
'Content-Type': 'application/vnd.api+json'
|
|
865
865
|
};
|
|
866
|
-
|
|
867
|
-
if (process.env.NODE_ENV === 'development') {
|
|
868
|
-
ttfHeaders['X-Source-Origin'] = 'https://restlessnit.es';
|
|
869
|
-
}
|
|
870
|
-
|
|
871
866
|
var publicRequest = /*#__PURE__*/axios.create({
|
|
872
867
|
baseURL: "https://www.ticketfairy.com/api",
|
|
873
868
|
headers: ttfHeaders
|
|
@@ -947,27 +942,13 @@ var postOnCheckout = function postOnCheckout(data, accessToken) {
|
|
|
947
942
|
return res;
|
|
948
943
|
};
|
|
949
944
|
var authorize = function authorize(data) {
|
|
950
|
-
return
|
|
951
|
-
method: 'post',
|
|
952
|
-
url: 'https://www.ticketfairy.com/api/v1/oauth/authorize-rn?client_id=4792a61f2fcb49197ab4c2d2f44df570',
|
|
953
|
-
data: data,
|
|
954
|
-
headers: {
|
|
955
|
-
'Content-Type': 'multipart/form-data'
|
|
956
|
-
}
|
|
957
|
-
});
|
|
945
|
+
return publicRequest.post('/v1/oauth/authorize-rn?client_id=4792a61f2fcb49197ab4c2d2f44df570', data);
|
|
958
946
|
};
|
|
959
947
|
var register = function register(data) {
|
|
960
948
|
return publicRequest.post('/v1/oauth/register-rn', data);
|
|
961
949
|
};
|
|
962
950
|
var getAccessToken = function getAccessToken(data) {
|
|
963
|
-
return
|
|
964
|
-
method: 'post',
|
|
965
|
-
url: 'https://www.ticketfairy.com/api/v1/oauth/access_token',
|
|
966
|
-
data: data,
|
|
967
|
-
headers: {
|
|
968
|
-
'Content-Type': 'multipart/form-data'
|
|
969
|
-
}
|
|
970
|
-
});
|
|
951
|
+
return publicRequest.post('/v1/oauth/access_token', data);
|
|
971
952
|
};
|
|
972
953
|
var getPaymentData = function getPaymentData(hash) {
|
|
973
954
|
var response = publicRequest.get("v1/order/" + hash + "/review/")["catch"](function (error) {
|
|
@@ -1048,7 +1029,7 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1048
1029
|
bodyFormDataToken.append('code', resAutorize.data.data.code);
|
|
1049
1030
|
bodyFormDataToken.append('scope', 'profile');
|
|
1050
1031
|
bodyFormDataToken.append('grant_type', 'authorization_code');
|
|
1051
|
-
bodyFormDataToken.append('client_id', '
|
|
1032
|
+
bodyFormDataToken.append('client_id', 'e9d8f8922797b4621e562255afe90dbf');
|
|
1052
1033
|
bodyFormDataToken.append('client_secret', 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9');
|
|
1053
1034
|
_context.next = 16;
|
|
1054
1035
|
return getAccessToken(bodyFormDataToken);
|
|
@@ -1069,24 +1050,28 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1069
1050
|
last_name: profileSpecifiedData.lastName,
|
|
1070
1051
|
email: profileSpecifiedData.email
|
|
1071
1052
|
};
|
|
1072
|
-
|
|
1073
|
-
|
|
1053
|
+
|
|
1054
|
+
if (typeof window !== 'undefined') {
|
|
1055
|
+
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
1056
|
+
window.localStorage.setItem('access_token', accessToken);
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1074
1059
|
onLogin();
|
|
1075
|
-
_context.next =
|
|
1060
|
+
_context.next = 32;
|
|
1076
1061
|
break;
|
|
1077
1062
|
|
|
1078
|
-
case
|
|
1079
|
-
_context.prev =
|
|
1063
|
+
case 28:
|
|
1064
|
+
_context.prev = 28;
|
|
1080
1065
|
_context.t0 = _context["catch"](1);
|
|
1081
1066
|
_error = _context.t0.response.data.message || 'Error';
|
|
1082
1067
|
setError(_error);
|
|
1083
1068
|
|
|
1084
|
-
case
|
|
1069
|
+
case 32:
|
|
1085
1070
|
case "end":
|
|
1086
1071
|
return _context.stop();
|
|
1087
1072
|
}
|
|
1088
1073
|
}
|
|
1089
|
-
}, _callee, null, [[1,
|
|
1074
|
+
}, _callee, null, [[1, 28]]);
|
|
1090
1075
|
}));
|
|
1091
1076
|
|
|
1092
1077
|
function onSubmit(_x) {
|
|
@@ -1181,7 +1166,7 @@ var RegisterModal = function RegisterModal(_ref) {
|
|
|
1181
1166
|
bodyFormData.append('email', email);
|
|
1182
1167
|
bodyFormData.append('password', password);
|
|
1183
1168
|
bodyFormData.append('password_confirmation', confirmPassword);
|
|
1184
|
-
bodyFormData.append('client_id', '
|
|
1169
|
+
bodyFormData.append('client_id', 'e9d8f8922797b4621e562255afe90dbf');
|
|
1185
1170
|
bodyFormData.append('client_secret', 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9');
|
|
1186
1171
|
_context.next = 11;
|
|
1187
1172
|
return register(bodyFormData);
|
|
@@ -1202,11 +1187,15 @@ var RegisterModal = function RegisterModal(_ref) {
|
|
|
1202
1187
|
last_name: profileSpecifiedData.lastName,
|
|
1203
1188
|
email: profileSpecifiedData.email
|
|
1204
1189
|
};
|
|
1205
|
-
|
|
1206
|
-
|
|
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
|
+
|
|
1207
1196
|
onClose();
|
|
1208
1197
|
|
|
1209
|
-
case
|
|
1198
|
+
case 21:
|
|
1210
1199
|
case "end":
|
|
1211
1200
|
return _context.stop();
|
|
1212
1201
|
}
|
|
@@ -1323,7 +1312,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
|
|
|
1323
1312
|
_ref$buttonName = _ref.buttonName,
|
|
1324
1313
|
buttonName = _ref$buttonName === void 0 ? 'Submit' : _ref$buttonName,
|
|
1325
1314
|
_ref$handleSubmit = _ref.handleSubmit,
|
|
1326
|
-
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;
|
|
1327
1318
|
var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
1328
1319
|
var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
|
|
1329
1320
|
|
|
@@ -1464,10 +1455,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
|
|
|
1464
1455
|
last_name: profileSpecifiedData.lastName,
|
|
1465
1456
|
email: profileSpecifiedData.email
|
|
1466
1457
|
};
|
|
1467
|
-
|
|
1468
|
-
|
|
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
|
+
|
|
1469
1464
|
holderAge = new Date(values.holderAge);
|
|
1470
|
-
_context2.next =
|
|
1465
|
+
_context2.next = 29;
|
|
1471
1466
|
return postOnCheckout({
|
|
1472
1467
|
attributes: {
|
|
1473
1468
|
email: values.email,
|
|
@@ -1484,14 +1479,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
|
|
|
1484
1479
|
}
|
|
1485
1480
|
}, access_token_register);
|
|
1486
1481
|
|
|
1487
|
-
case
|
|
1482
|
+
case 29:
|
|
1488
1483
|
res = _context2.sent;
|
|
1489
1484
|
handleSubmit(values, formikHelpers, res);
|
|
1490
|
-
_context2.next =
|
|
1485
|
+
_context2.next = 37;
|
|
1491
1486
|
break;
|
|
1492
1487
|
|
|
1493
|
-
case
|
|
1494
|
-
_context2.prev =
|
|
1488
|
+
case 33:
|
|
1489
|
+
_context2.prev = 33;
|
|
1495
1490
|
_context2.t0 = _context2["catch"](0);
|
|
1496
1491
|
error = _context2.t0.response.data.message;
|
|
1497
1492
|
|
|
@@ -1500,12 +1495,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
|
|
|
1500
1495
|
setShowModalLogin(true);
|
|
1501
1496
|
}
|
|
1502
1497
|
|
|
1503
|
-
case
|
|
1498
|
+
case 37:
|
|
1504
1499
|
case "end":
|
|
1505
1500
|
return _context2.stop();
|
|
1506
1501
|
}
|
|
1507
1502
|
}
|
|
1508
|
-
}, _callee2, null, [[0,
|
|
1503
|
+
}, _callee2, null, [[0, 33]]);
|
|
1509
1504
|
}));
|
|
1510
1505
|
|
|
1511
1506
|
function onSubmit(_x, _x2) {
|
|
@@ -1518,7 +1513,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
|
|
|
1518
1513
|
return React.createElement(Form, {
|
|
1519
1514
|
onSubmit: props.handleSubmit
|
|
1520
1515
|
}, React.createElement("div", {
|
|
1521
|
-
className: "billing-info-container"
|
|
1516
|
+
className: "billing-info-container " + theme
|
|
1522
1517
|
}, !isLoggedIn && React.createElement("div", {
|
|
1523
1518
|
className: "account-actions-block"
|
|
1524
1519
|
}, React.createElement("div", null, "Got a Restless Nites account?"), React.createElement("div", null, "Login & skip ahead:"), React.createElement("div", {
|
|
@@ -1562,14 +1557,25 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
|
|
|
1562
1557
|
type: element.type,
|
|
1563
1558
|
fullWidth: true,
|
|
1564
1559
|
error: !!meta.error && meta.touched,
|
|
1565
|
-
helperText: meta.touched && meta.error
|
|
1560
|
+
helperText: meta.touched && meta.error,
|
|
1561
|
+
InputLabelProps: element.type === 'date' ? {
|
|
1562
|
+
shrink: true
|
|
1563
|
+
} : {}
|
|
1566
1564
|
}, field));
|
|
1567
1565
|
}));
|
|
1568
1566
|
}));
|
|
1569
1567
|
}));
|
|
1570
|
-
}), React.createElement("
|
|
1571
|
-
|
|
1572
|
-
|
|
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))));
|
|
1573
1579
|
}), showModalLogin && React.createElement(LoginModal, {
|
|
1574
1580
|
onClose: function onClose() {
|
|
1575
1581
|
setShowModalLogin(false);
|