tf-checkout-react 1.0.62 → 1.0.66
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 +1 -1
- package/dist/components/billing-info-container/index.d.ts +2 -1
- package/dist/components/myTicketsContainer/index.d.ts +2 -1
- package/dist/components/orderDetailsContainer/index.d.ts +1 -1
- package/dist/components/paymentContainer/index.d.ts +2 -1
- package/dist/index.d.ts +3 -1
- package/dist/tf-checkout-react.cjs.development.js +408 -32
- 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 +408 -34
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/package.json +2 -3
- package/src/api/index.ts +6 -0
- package/src/components/billing-info-container/index.tsx +24 -4
- package/src/components/common/CustomField.tsx +10 -25
- package/src/components/common/SelectField.tsx +0 -13
- package/src/components/myTicketsContainer/index.tsx +22 -10
- package/src/components/orderDetailsContainer/index.tsx +63 -29
- package/src/components/orderDetailsContainer/style.css +27 -8
- package/src/components/paymentContainer/index.tsx +58 -45
- package/src/components/ticketsContainer/TicketRow.tsx +3 -0
- package/src/index.ts +7 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, Component, useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useState, Component, useCallback, useEffect, useRef, Fragment } from 'react';
|
|
2
2
|
import { Formik, Form, Field, connect } from 'formik';
|
|
3
3
|
import LoadingButton from '@mui/lab/LoadingButton';
|
|
4
4
|
import _identity from 'lodash-es/identity';
|
|
@@ -14,11 +14,11 @@ import _flatMapDeep from 'lodash-es/flatMapDeep';
|
|
|
14
14
|
import _isArray from 'lodash-es/isArray';
|
|
15
15
|
import { nanoid } from 'nanoid';
|
|
16
16
|
import TextField$1 from '@mui/material/TextField';
|
|
17
|
-
import { makeStyles } from '@mui/styles';
|
|
18
17
|
import FormGroup from '@mui/material/FormGroup';
|
|
19
18
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
20
19
|
import Checkbox from '@mui/material/Checkbox';
|
|
21
20
|
import Select from '@mui/material/Select';
|
|
21
|
+
import { createTheme, ThemeProvider } from '@mui/material/styles';
|
|
22
22
|
import Container from '@mui/material/Container';
|
|
23
23
|
import Alert from '@mui/material/Alert';
|
|
24
24
|
import { useStripe, useElements, CardNumberElement, CardExpiryElement, CardCvcElement, Elements } from '@stripe/react-stripe-js';
|
|
@@ -35,6 +35,15 @@ import _has from 'lodash-es/has';
|
|
|
35
35
|
import FormControl$1 from '@mui/material/FormControl';
|
|
36
36
|
import MenuItem from '@mui/material/MenuItem';
|
|
37
37
|
import Button from '@mui/material/Button';
|
|
38
|
+
import Table from '@mui/material/Table';
|
|
39
|
+
import TableBody from '@mui/material/TableBody';
|
|
40
|
+
import TableCell from '@mui/material/TableCell';
|
|
41
|
+
import TableContainer from '@mui/material/TableContainer';
|
|
42
|
+
import TableHead from '@mui/material/TableHead';
|
|
43
|
+
import TableRow from '@mui/material/TableRow';
|
|
44
|
+
import Paper from '@mui/material/Paper';
|
|
45
|
+
import TablePagination from '@mui/material/TablePagination';
|
|
46
|
+
import Autocomplete from '@mui/material/Autocomplete';
|
|
38
47
|
|
|
39
48
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
40
49
|
try {
|
|
@@ -1071,6 +1080,13 @@ var getProfileData = function getProfileData(accessToken) {
|
|
|
1071
1080
|
headers: _extends({}, ttfHeaders, {
|
|
1072
1081
|
Authorization: "Bearer " + accessToken
|
|
1073
1082
|
})
|
|
1083
|
+
})["catch"](function (e) {
|
|
1084
|
+
if (isWindowDefined) {
|
|
1085
|
+
var event = new window.CustomEvent('auth_error', e);
|
|
1086
|
+
window.document.dispatchEvent(event);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
return e;
|
|
1074
1090
|
});
|
|
1075
1091
|
};
|
|
1076
1092
|
var getCountries = function getCountries() {
|
|
@@ -1082,6 +1098,12 @@ var getConfirmationData = function getConfirmationData(orderHash) {
|
|
|
1082
1098
|
var getStates = function getStates(countryId) {
|
|
1083
1099
|
return publicRequest.get("/countries/" + countryId + "/states/");
|
|
1084
1100
|
};
|
|
1101
|
+
var getOrders = function getOrders(page, limit, eventSlug) {
|
|
1102
|
+
return publicRequest.get("/v1/account/orders/?page=" + page + "&limit=" + limit + "&filter[event]=" + eventSlug);
|
|
1103
|
+
};
|
|
1104
|
+
var getOrderDetails = function getOrderDetails(orderId) {
|
|
1105
|
+
return publicRequest.get("/v1/account/order/" + orderId);
|
|
1106
|
+
};
|
|
1085
1107
|
var addToWaitingList = function addToWaitingList(id, data) {
|
|
1086
1108
|
return publicRequest.post("/v1/event/" + id + "/add_to_waiting_list", data);
|
|
1087
1109
|
};
|
|
@@ -1667,13 +1689,6 @@ var assingUniqueIds = function assingUniqueIds(data) {
|
|
|
1667
1689
|
});
|
|
1668
1690
|
};
|
|
1669
1691
|
|
|
1670
|
-
var useStyles = /*#__PURE__*/makeStyles({
|
|
1671
|
-
input: {
|
|
1672
|
-
'&::placeholder': {
|
|
1673
|
-
color: 'gray'
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
});
|
|
1677
1692
|
var CustomField = function CustomField(_ref) {
|
|
1678
1693
|
var label = _ref.label,
|
|
1679
1694
|
_ref$type = _ref.type,
|
|
@@ -1691,7 +1706,6 @@ var CustomField = function CustomField(_ref) {
|
|
|
1691
1706
|
var error = _get(errors, field.name);
|
|
1692
1707
|
|
|
1693
1708
|
var isTouched = Boolean(_get(touched, field.name)) || _includes(field.name, 'holder') && !!error && !!submitCount;
|
|
1694
|
-
var classes = useStyles();
|
|
1695
1709
|
return React.createElement(TextField$1, Object.assign({
|
|
1696
1710
|
id: field.name,
|
|
1697
1711
|
label: label,
|
|
@@ -1700,11 +1714,6 @@ var CustomField = function CustomField(_ref) {
|
|
|
1700
1714
|
fullWidth: true,
|
|
1701
1715
|
error: !!error && isTouched,
|
|
1702
1716
|
helperText: isTouched && error,
|
|
1703
|
-
InputProps: {
|
|
1704
|
-
classes: {
|
|
1705
|
-
input: classes.input
|
|
1706
|
-
}
|
|
1707
|
-
},
|
|
1708
1717
|
SelectProps: {
|
|
1709
1718
|
"native": true,
|
|
1710
1719
|
className: theme,
|
|
@@ -1750,13 +1759,6 @@ var getQueryVariable = function getQueryVariable(variable) {
|
|
|
1750
1759
|
return false;
|
|
1751
1760
|
};
|
|
1752
1761
|
|
|
1753
|
-
var useStyles$1 = /*#__PURE__*/makeStyles({
|
|
1754
|
-
input: {
|
|
1755
|
-
'&::placeholder': {
|
|
1756
|
-
color: 'gray'
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
});
|
|
1760
1762
|
var SelectField = function SelectField(_ref) {
|
|
1761
1763
|
var label = _ref.label,
|
|
1762
1764
|
_ref$type = _ref.type,
|
|
@@ -1772,7 +1774,6 @@ var SelectField = function SelectField(_ref) {
|
|
|
1772
1774
|
|
|
1773
1775
|
var error = _get(errors, field.name);
|
|
1774
1776
|
|
|
1775
|
-
var classes = useStyles$1();
|
|
1776
1777
|
return React.createElement(FormControl, {
|
|
1777
1778
|
fullWidth: true
|
|
1778
1779
|
}, React.createElement(InputLabel, {
|
|
@@ -1786,10 +1787,7 @@ var SelectField = function SelectField(_ref) {
|
|
|
1786
1787
|
fullWidth: true,
|
|
1787
1788
|
error: !!error && isTouched,
|
|
1788
1789
|
inputProps: {
|
|
1789
|
-
id: field.name
|
|
1790
|
-
classes: {
|
|
1791
|
-
input: classes.input
|
|
1792
|
-
}
|
|
1790
|
+
id: field.name
|
|
1793
1791
|
},
|
|
1794
1792
|
"native": true,
|
|
1795
1793
|
className: theme,
|
|
@@ -2010,7 +2008,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2010
2008
|
_ref3$onLoginSuccess = _ref3.onLoginSuccess,
|
|
2011
2009
|
onLoginSuccess = _ref3$onLoginSuccess === void 0 ? function () {} : _ref3$onLoginSuccess,
|
|
2012
2010
|
_ref3$isLoggedIn = _ref3.isLoggedIn,
|
|
2013
|
-
pIsLoggedIn = _ref3$isLoggedIn === void 0 ? false : _ref3$isLoggedIn
|
|
2011
|
+
pIsLoggedIn = _ref3$isLoggedIn === void 0 ? false : _ref3$isLoggedIn,
|
|
2012
|
+
fontFamily = _ref3.fontFamily;
|
|
2013
|
+
var themeMui = createTheme({
|
|
2014
|
+
typography: {
|
|
2015
|
+
allVariants: {
|
|
2016
|
+
fontFamily: fontFamily
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
});
|
|
2014
2020
|
var isWindowDefined = typeof window !== 'undefined';
|
|
2015
2021
|
var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
2016
2022
|
var access_token = isWindowDefined && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
|
|
@@ -2102,6 +2108,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2102
2108
|
return qty;
|
|
2103
2109
|
};
|
|
2104
2110
|
|
|
2111
|
+
var handleAuthErrors = useCallback(function () {
|
|
2112
|
+
setIsLoggedIn(false);
|
|
2113
|
+
}, []);
|
|
2114
|
+
useEffect(function () {
|
|
2115
|
+
isWindowDefined && window.document.addEventListener("auth_error", handleAuthErrors);
|
|
2116
|
+
return function () {
|
|
2117
|
+
isWindowDefined && window.document.removeEventListener("auth_error", handleAuthErrors);
|
|
2118
|
+
};
|
|
2119
|
+
}, [handleAuthErrors]);
|
|
2105
2120
|
useEffect(function () {
|
|
2106
2121
|
if ((pIsLoggedIn || access_token) && !isLoggedIn) {
|
|
2107
2122
|
setIsLoggedIn(true);
|
|
@@ -2259,9 +2274,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2259
2274
|
useEffect(function () {
|
|
2260
2275
|
fetchUserData(access_token);
|
|
2261
2276
|
}, [access_token]);
|
|
2262
|
-
return React.createElement(
|
|
2277
|
+
return React.createElement(ThemeProvider, {
|
|
2278
|
+
theme: themeMui
|
|
2279
|
+
}, React.createElement(Formik, {
|
|
2263
2280
|
initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
|
|
2264
|
-
email: emailLogged,
|
|
2265
2281
|
firstName: firstNameLogged,
|
|
2266
2282
|
lastName: lastNameLogged,
|
|
2267
2283
|
country: 1,
|
|
@@ -2924,7 +2940,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
2924
2940
|
_ref$onPaymentError = _ref.onPaymentError,
|
|
2925
2941
|
onPaymentError = _ref$onPaymentError === void 0 ? function () {} : _ref$onPaymentError,
|
|
2926
2942
|
_ref$stripeCardOption = _ref.stripeCardOptions,
|
|
2927
|
-
stripeCardOptions = _ref$stripeCardOption === void 0 ? {} : _ref$stripeCardOption
|
|
2943
|
+
stripeCardOptions = _ref$stripeCardOption === void 0 ? {} : _ref$stripeCardOption,
|
|
2944
|
+
fontFamily = _ref.fontFamily;
|
|
2928
2945
|
|
|
2929
2946
|
var _useState = useState(initialReviewValues),
|
|
2930
2947
|
reviewData = _useState[0],
|
|
@@ -3099,7 +3116,16 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3099
3116
|
};
|
|
3100
3117
|
}();
|
|
3101
3118
|
|
|
3102
|
-
|
|
3119
|
+
var themeMui = createTheme({
|
|
3120
|
+
typography: {
|
|
3121
|
+
allVariants: {
|
|
3122
|
+
fontFamily: fontFamily
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
});
|
|
3126
|
+
return React.createElement(ThemeProvider, {
|
|
3127
|
+
theme: themeMui
|
|
3128
|
+
}, React.createElement("div", {
|
|
3103
3129
|
className: "payment_page"
|
|
3104
3130
|
}, error && React.createElement(Alert, {
|
|
3105
3131
|
severity: "error",
|
|
@@ -3147,7 +3173,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3147
3173
|
},
|
|
3148
3174
|
conditions: conditions,
|
|
3149
3175
|
stripeCardOptions: stripeCardOptions
|
|
3150
|
-
}))))));
|
|
3176
|
+
})))))));
|
|
3151
3177
|
};
|
|
3152
3178
|
|
|
3153
3179
|
var defaultSvg = 'https://img.icons8.com/ios-filled/50/000000/facebook-new.svg';
|
|
@@ -3358,6 +3384,9 @@ var TicketRow = function TicketRow(_ref) {
|
|
|
3358
3384
|
}, React.createElement(FormControl$1, {
|
|
3359
3385
|
fullWidth: true
|
|
3360
3386
|
}, React.createElement(Select, {
|
|
3387
|
+
sx: {
|
|
3388
|
+
borderRadius: 0
|
|
3389
|
+
},
|
|
3361
3390
|
value: selectedTickets[ticketTier.id] ? selectedTickets[ticketTier.id] : 0,
|
|
3362
3391
|
onChange: handleTicketSelect,
|
|
3363
3392
|
displayEmpty: true,
|
|
@@ -3881,5 +3910,350 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
3881
3910
|
}, getTicketsLabel || 'GET TICKETS'))));
|
|
3882
3911
|
};
|
|
3883
3912
|
|
|
3884
|
-
|
|
3913
|
+
var EventInfoItem = function EventInfoItem(_ref) {
|
|
3914
|
+
var image = _ref.image,
|
|
3915
|
+
name = _ref.name;
|
|
3916
|
+
return React.createElement("div", {
|
|
3917
|
+
className: 'event-info'
|
|
3918
|
+
}, React.createElement("img", {
|
|
3919
|
+
src: image,
|
|
3920
|
+
alt: "event"
|
|
3921
|
+
}), name);
|
|
3922
|
+
};
|
|
3923
|
+
|
|
3924
|
+
var tableConfig = function tableConfig(key) {
|
|
3925
|
+
var config;
|
|
3926
|
+
|
|
3927
|
+
switch (key) {
|
|
3928
|
+
default:
|
|
3929
|
+
config = {
|
|
3930
|
+
header: ['Order No.', 'Date', 'Event', 'Total'],
|
|
3931
|
+
body: [function (row) {
|
|
3932
|
+
return row.id;
|
|
3933
|
+
}, function (row) {
|
|
3934
|
+
return row.date;
|
|
3935
|
+
}, function (row) {
|
|
3936
|
+
return React.createElement(EventInfoItem, {
|
|
3937
|
+
image: row.image,
|
|
3938
|
+
name: row.eventName
|
|
3939
|
+
});
|
|
3940
|
+
}, function (row) {
|
|
3941
|
+
return row.currency + row.amount;
|
|
3942
|
+
}]
|
|
3943
|
+
};
|
|
3944
|
+
}
|
|
3945
|
+
|
|
3946
|
+
return config;
|
|
3947
|
+
};
|
|
3948
|
+
|
|
3949
|
+
var Row = function Row(_ref) {
|
|
3950
|
+
var row = _ref.row,
|
|
3951
|
+
handleDetailsInfo = _ref.handleDetailsInfo;
|
|
3952
|
+
return React.createElement(TableRow, {
|
|
3953
|
+
sx: {
|
|
3954
|
+
'& > *': {
|
|
3955
|
+
borderBottom: 'unset'
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
}, tableConfig().body.map(function (column, index) {
|
|
3959
|
+
return React.createElement(TableCell, {
|
|
3960
|
+
component: "th",
|
|
3961
|
+
scope: "row",
|
|
3962
|
+
key: index
|
|
3963
|
+
}, column(row));
|
|
3964
|
+
}), React.createElement(TableCell, {
|
|
3965
|
+
component: "th",
|
|
3966
|
+
scope: "row"
|
|
3967
|
+
}, React.createElement("button", {
|
|
3968
|
+
type: 'button',
|
|
3969
|
+
className: "order-details-button",
|
|
3970
|
+
onClick: function onClick() {
|
|
3971
|
+
return handleDetailsInfo(row.id);
|
|
3972
|
+
}
|
|
3973
|
+
}, "Details")));
|
|
3974
|
+
};
|
|
3975
|
+
|
|
3976
|
+
var MyTicketsContainer = function MyTicketsContainer(_ref) {
|
|
3977
|
+
var _data$orders;
|
|
3978
|
+
|
|
3979
|
+
var _ref$handleDetailsInf = _ref.handleDetailsInfo,
|
|
3980
|
+
handleDetailsInfo = _ref$handleDetailsInf === void 0 ? function () {} : _ref$handleDetailsInf,
|
|
3981
|
+
_ref$onGetOrdersSucce = _ref.onGetOrdersSuccess,
|
|
3982
|
+
onGetOrdersSuccess = _ref$onGetOrdersSucce === void 0 ? function () {} : _ref$onGetOrdersSucce,
|
|
3983
|
+
_ref$onGetOrdersError = _ref.onGetOrdersError,
|
|
3984
|
+
onGetOrdersError = _ref$onGetOrdersError === void 0 ? function () {} : _ref$onGetOrdersError,
|
|
3985
|
+
_ref$theme = _ref.theme,
|
|
3986
|
+
theme = _ref$theme === void 0 ? 'dark' : _ref$theme;
|
|
3987
|
+
|
|
3988
|
+
var _useState = useState(null),
|
|
3989
|
+
data = _useState[0],
|
|
3990
|
+
setData = _useState[1];
|
|
3991
|
+
|
|
3992
|
+
var _useState2 = useState(true),
|
|
3993
|
+
loading = _useState2[0],
|
|
3994
|
+
setLoading = _useState2[1];
|
|
3995
|
+
|
|
3996
|
+
var _useState3 = useState(10),
|
|
3997
|
+
limit = _useState3[0],
|
|
3998
|
+
setLimit = _useState3[1];
|
|
3999
|
+
|
|
4000
|
+
var _useState4 = useState(''),
|
|
4001
|
+
filter = _useState4[0],
|
|
4002
|
+
setFilter = _useState4[1]; //just once
|
|
4003
|
+
|
|
4004
|
+
|
|
4005
|
+
useEffect(function () {
|
|
4006
|
+
fetchData(1, limit, filter);
|
|
4007
|
+
}, []);
|
|
4008
|
+
|
|
4009
|
+
var fetchData = /*#__PURE__*/function () {
|
|
4010
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(page, limit, filter) {
|
|
4011
|
+
var response, _data;
|
|
4012
|
+
|
|
4013
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
4014
|
+
while (1) {
|
|
4015
|
+
switch (_context.prev = _context.next) {
|
|
4016
|
+
case 0:
|
|
4017
|
+
_context.prev = 0;
|
|
4018
|
+
setLoading(true);
|
|
4019
|
+
_context.next = 4;
|
|
4020
|
+
return getOrders(page, limit, filter);
|
|
4021
|
+
|
|
4022
|
+
case 4:
|
|
4023
|
+
response = _context.sent;
|
|
4024
|
+
onGetOrdersSuccess(response);
|
|
4025
|
+
_data = _get(response, 'data.data.attributes');
|
|
4026
|
+
_data.page -= 1;
|
|
4027
|
+
setData(_data);
|
|
4028
|
+
_context.next = 14;
|
|
4029
|
+
break;
|
|
4030
|
+
|
|
4031
|
+
case 11:
|
|
4032
|
+
_context.prev = 11;
|
|
4033
|
+
_context.t0 = _context["catch"](0);
|
|
4034
|
+
onGetOrdersError(_context.t0);
|
|
4035
|
+
|
|
4036
|
+
case 14:
|
|
4037
|
+
_context.prev = 14;
|
|
4038
|
+
setLoading(false);
|
|
4039
|
+
return _context.finish(14);
|
|
4040
|
+
|
|
4041
|
+
case 17:
|
|
4042
|
+
case "end":
|
|
4043
|
+
return _context.stop();
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
}, _callee, null, [[0, 11, 14, 17]]);
|
|
4047
|
+
}));
|
|
4048
|
+
|
|
4049
|
+
return function fetchData(_x, _x2, _x3) {
|
|
4050
|
+
return _ref2.apply(this, arguments);
|
|
4051
|
+
};
|
|
4052
|
+
}();
|
|
4053
|
+
|
|
4054
|
+
var handleChangePage = function handleChangePage(_event, newPage) {
|
|
4055
|
+
fetchData(newPage + 1, limit, filter);
|
|
4056
|
+
};
|
|
4057
|
+
|
|
4058
|
+
var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
|
|
4059
|
+
fetchData(1, +event.target.value, filter);
|
|
4060
|
+
setLimit(+event.target.value);
|
|
4061
|
+
};
|
|
4062
|
+
|
|
4063
|
+
var onChange = function onChange(_event, eventFilter) {
|
|
4064
|
+
fetchData(1, limit, (eventFilter == null ? void 0 : eventFilter.url_name) || '');
|
|
4065
|
+
setFilter((eventFilter == null ? void 0 : eventFilter.url_name) || '');
|
|
4066
|
+
};
|
|
4067
|
+
|
|
4068
|
+
return React.createElement("div", {
|
|
4069
|
+
className: "my-ticket " + theme
|
|
4070
|
+
}, loading && React.createElement("div", {
|
|
4071
|
+
className: "loading"
|
|
4072
|
+
}, React.createElement(CircularProgress$1, null)), data && React.createElement(React.Fragment, null, React.createElement(Autocomplete, {
|
|
4073
|
+
disablePortal: true,
|
|
4074
|
+
id: "combo-box-demo",
|
|
4075
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
4076
|
+
return option.event_name;
|
|
4077
|
+
},
|
|
4078
|
+
onChange: onChange,
|
|
4079
|
+
options: data.purchased_events,
|
|
4080
|
+
sx: {
|
|
4081
|
+
width: 300
|
|
4082
|
+
},
|
|
4083
|
+
renderInput: function renderInput(params) {
|
|
4084
|
+
return React.createElement(TextField$1, Object.assign({}, params, {
|
|
4085
|
+
label: "Events"
|
|
4086
|
+
}));
|
|
4087
|
+
}
|
|
4088
|
+
}), React.createElement(TableContainer, {
|
|
4089
|
+
component: Paper,
|
|
4090
|
+
className: "my-ticket-table"
|
|
4091
|
+
}, React.createElement(Table, {
|
|
4092
|
+
"aria-label": "collapsible table"
|
|
4093
|
+
}, React.createElement(TableHead, null, React.createElement(TableRow, null, tableConfig().header.map(function (column, index) {
|
|
4094
|
+
return React.createElement(TableCell, {
|
|
4095
|
+
key: index
|
|
4096
|
+
}, column);
|
|
4097
|
+
}), React.createElement(TableCell, null))), React.createElement(TableBody, null, (_data$orders = data.orders) == null ? void 0 : _data$orders.map(function (row) {
|
|
4098
|
+
return React.createElement(Row, {
|
|
4099
|
+
key: row.id,
|
|
4100
|
+
row: row,
|
|
4101
|
+
handleDetailsInfo: handleDetailsInfo
|
|
4102
|
+
});
|
|
4103
|
+
})))), React.createElement(TablePagination, {
|
|
4104
|
+
rowsPerPageOptions: [10, 25, 100],
|
|
4105
|
+
component: "div",
|
|
4106
|
+
count: data.total_count,
|
|
4107
|
+
rowsPerPage: limit,
|
|
4108
|
+
page: data.page,
|
|
4109
|
+
onPageChange: handleChangePage,
|
|
4110
|
+
onRowsPerPageChange: handleChangeRowsPerPage
|
|
4111
|
+
})));
|
|
4112
|
+
};
|
|
4113
|
+
|
|
4114
|
+
var TicketsTable = function TicketsTable(_ref) {
|
|
4115
|
+
var _ref$tickets = _ref.tickets,
|
|
4116
|
+
tickets = _ref$tickets === void 0 ? [] : _ref$tickets;
|
|
4117
|
+
return React.createElement("div", {
|
|
4118
|
+
className: 'tickets-box'
|
|
4119
|
+
}, React.createElement("h4", {
|
|
4120
|
+
className: 'sub-title'
|
|
4121
|
+
}, "Your Tickets"), React.createElement(TableContainer, {
|
|
4122
|
+
component: Paper
|
|
4123
|
+
}, React.createElement(Table, {
|
|
4124
|
+
"aria-label": "collapsible table"
|
|
4125
|
+
}, React.createElement(TableHead, null, React.createElement(TableRow, null, React.createElement(TableCell, null, "Ticket ID"), React.createElement(TableCell, null, "Ticket Type"), React.createElement(TableCell, null, "Ticket Holder Name"), React.createElement(TableCell, null, "Status"), React.createElement(TableCell, null, "Download"))), React.createElement(TableBody, null, tickets.map(function (ticket, index) {
|
|
4126
|
+
var _ticket$add_ons;
|
|
4127
|
+
|
|
4128
|
+
return React.createElement(Fragment, {
|
|
4129
|
+
key: index
|
|
4130
|
+
}, React.createElement(TableRow, null, React.createElement(TableCell, null, ticket.hash), React.createElement(TableCell, null, ticket.ticket_type), React.createElement(TableCell, null, ticket.holder_name), React.createElement(TableCell, null, ticket.status), React.createElement(TableCell, null, React.createElement("a", {
|
|
4131
|
+
className: 'download-button',
|
|
4132
|
+
href: ticket.pdf_link,
|
|
4133
|
+
download: true
|
|
4134
|
+
}, "Download"))), !!((_ticket$add_ons = ticket.add_ons) != null && _ticket$add_ons.length) && React.createElement(TableRow, null, React.createElement(TableCell, {
|
|
4135
|
+
colSpan: 5
|
|
4136
|
+
}, React.createElement(Table, {
|
|
4137
|
+
className: 'ticket-add-on-table'
|
|
4138
|
+
}, React.createElement(TableHead, null, React.createElement(TableRow, null, React.createElement(TableCell, null, "Add-On"), React.createElement(TableCell, null, "Status"))), React.createElement(TableBody, null, ticket.add_ons.map(function (add_on, index) {
|
|
4139
|
+
return React.createElement(TableRow, {
|
|
4140
|
+
key: index
|
|
4141
|
+
}, React.createElement(TableCell, null, add_on.name), React.createElement(TableCell, null, add_on.status));
|
|
4142
|
+
}))))));
|
|
4143
|
+
})))));
|
|
4144
|
+
};
|
|
4145
|
+
|
|
4146
|
+
var getTotal = function getTotal(data) {
|
|
4147
|
+
if (!(data != null && data.total) || !_has(data, 'items.ticket_types.length')) return '';
|
|
4148
|
+
return data.items.ticket_types[0].currency + data.total;
|
|
4149
|
+
};
|
|
4150
|
+
|
|
4151
|
+
var OrderDetailsContainer = function OrderDetailsContainer(_ref) {
|
|
4152
|
+
var _data$items$ticket_ty, _data$items$add_ons;
|
|
4153
|
+
|
|
4154
|
+
var _ref$onGetOrdersSucce = _ref.onGetOrdersSuccess,
|
|
4155
|
+
onGetOrdersSuccess = _ref$onGetOrdersSucce === void 0 ? function () {} : _ref$onGetOrdersSucce,
|
|
4156
|
+
_ref$onGetOrdersError = _ref.onGetOrdersError,
|
|
4157
|
+
onGetOrdersError = _ref$onGetOrdersError === void 0 ? function () {} : _ref$onGetOrdersError;
|
|
4158
|
+
|
|
4159
|
+
var _useState = useState({}),
|
|
4160
|
+
data = _useState[0],
|
|
4161
|
+
setData = _useState[1];
|
|
4162
|
+
|
|
4163
|
+
var _useState2 = useState(true),
|
|
4164
|
+
loading = _useState2[0],
|
|
4165
|
+
setLoading = _useState2[1];
|
|
4166
|
+
|
|
4167
|
+
useEffect(function () {
|
|
4168
|
+
_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
4169
|
+
var orderId, params, response, _data;
|
|
4170
|
+
|
|
4171
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
4172
|
+
while (1) {
|
|
4173
|
+
switch (_context.prev = _context.next) {
|
|
4174
|
+
case 0:
|
|
4175
|
+
_context.prev = 0;
|
|
4176
|
+
setLoading(true);
|
|
4177
|
+
orderId = '';
|
|
4178
|
+
|
|
4179
|
+
if (typeof window !== 'undefined') {
|
|
4180
|
+
params = new URL("" + window.location).searchParams;
|
|
4181
|
+
orderId = params.get('o') || '';
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4184
|
+
_context.next = 6;
|
|
4185
|
+
return getOrderDetails(orderId);
|
|
4186
|
+
|
|
4187
|
+
case 6:
|
|
4188
|
+
response = _context.sent;
|
|
4189
|
+
onGetOrdersSuccess(response);
|
|
4190
|
+
_data = _get(response, 'data.data.attributes');
|
|
4191
|
+
setData(_data);
|
|
4192
|
+
_context.next = 15;
|
|
4193
|
+
break;
|
|
4194
|
+
|
|
4195
|
+
case 12:
|
|
4196
|
+
_context.prev = 12;
|
|
4197
|
+
_context.t0 = _context["catch"](0);
|
|
4198
|
+
onGetOrdersError(_context.t0);
|
|
4199
|
+
|
|
4200
|
+
case 15:
|
|
4201
|
+
_context.prev = 15;
|
|
4202
|
+
setLoading(false);
|
|
4203
|
+
return _context.finish(15);
|
|
4204
|
+
|
|
4205
|
+
case 18:
|
|
4206
|
+
case "end":
|
|
4207
|
+
return _context.stop();
|
|
4208
|
+
}
|
|
4209
|
+
}
|
|
4210
|
+
}, _callee, null, [[0, 12, 15, 18]]);
|
|
4211
|
+
}))();
|
|
4212
|
+
}, []);
|
|
4213
|
+
return React.createElement("div", {
|
|
4214
|
+
className: "order-details"
|
|
4215
|
+
}, loading ? React.createElement("div", {
|
|
4216
|
+
className: "loading"
|
|
4217
|
+
}, React.createElement(CircularProgress$1, null)) : React.createElement(React.Fragment, null, React.createElement("h1", {
|
|
4218
|
+
className: "layout-title"
|
|
4219
|
+
}, "Order Details"), React.createElement("div", {
|
|
4220
|
+
className: "order-summary-box"
|
|
4221
|
+
}, React.createElement("h4", {
|
|
4222
|
+
className: "sub-title"
|
|
4223
|
+
}, "Order Summary"), React.createElement("div", {
|
|
4224
|
+
className: "personal-link"
|
|
4225
|
+
}, React.createElement("b", null, "Your personal share link for this event is: "), React.createElement("a", {
|
|
4226
|
+
href: data == null ? void 0 : data.personal_share_link,
|
|
4227
|
+
target: "_blank",
|
|
4228
|
+
rel: "noreferrer"
|
|
4229
|
+
}, data == null ? void 0 : data.personal_share_link)), React.createElement(TableContainer, {
|
|
4230
|
+
component: Paper
|
|
4231
|
+
}, React.createElement(Table, {
|
|
4232
|
+
"aria-label": "collapsible table"
|
|
4233
|
+
}, React.createElement(TableHead, null, React.createElement(TableRow, null, React.createElement(TableCell, null, "Items"), React.createElement(TableCell, null, "Price"), React.createElement(TableCell, null, "Quantity"), React.createElement(TableCell, null, "Total"))), React.createElement(TableBody, null, data == null ? void 0 : (_data$items$ticket_ty = data.items.ticket_types) == null ? void 0 : _data$items$ticket_ty.map(function (ticket, index) {
|
|
4234
|
+
return React.createElement(TableRow, {
|
|
4235
|
+
key: index
|
|
4236
|
+
}, React.createElement(TableCell, null, React.createElement("b", null, "Ticket Type: "), ticket.name), React.createElement(TableCell, null, ticket.currency + ticket.price), React.createElement(TableCell, null, ticket.quantity), React.createElement(TableCell, null, ticket.currency + ticket.total));
|
|
4237
|
+
}), data == null ? void 0 : (_data$items$add_ons = data.items.add_ons) == null ? void 0 : _data$items$add_ons.map(function (ticket, index) {
|
|
4238
|
+
return React.createElement(TableRow, {
|
|
4239
|
+
key: index
|
|
4240
|
+
}, React.createElement(TableCell, null, React.createElement("b", null, "Add-On: "), ticket.name), React.createElement(TableCell, null, ticket.currency + ticket.price), React.createElement(TableCell, null, ticket.quantity), React.createElement(TableCell, null, ticket.currency + ticket.total));
|
|
4241
|
+
}), React.createElement(TableRow, {
|
|
4242
|
+
className: "total-row"
|
|
4243
|
+
}, React.createElement(TableCell, null), React.createElement(TableCell, null), React.createElement(TableCell, null, "Total"), React.createElement(TableCell, null, getTotal(data))))))), React.createElement(TicketsTable, {
|
|
4244
|
+
tickets: data.tickets
|
|
4245
|
+
}), React.createElement("div", {
|
|
4246
|
+
className: "return-button-container"
|
|
4247
|
+
}, React.createElement("button", {
|
|
4248
|
+
type: "button",
|
|
4249
|
+
className: "return-button",
|
|
4250
|
+
onClick: function onClick() {
|
|
4251
|
+
if (typeof window !== 'undefined') {
|
|
4252
|
+
window.location.assign('/orders');
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
}, "Return to Order History"))));
|
|
4256
|
+
};
|
|
4257
|
+
|
|
4258
|
+
export { BillingInfoContainer, ConfirmationContainer, LoginModal, MyTicketsContainer, OrderDetailsContainer, PaymentContainer, TicketsContainer, createFixedFloatNormalizer, currencyNormalizerCreator };
|
|
3885
4259
|
//# sourceMappingURL=tf-checkout-react.esm.js.map
|