tf-checkout-react 1.3.31 → 1.3.34
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/components/common/CheckboxField.d.ts +1 -1
- package/dist/components/common/RadioGroupField/index.d.ts +17 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/ticketsContainer/index.d.ts +3 -1
- package/dist/constants/index.d.ts +1 -0
- package/dist/hooks/useCookieListener.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +218 -68
- 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 +218 -68
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/utils/auth.d.ts +13 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/api/index.ts +2 -2
- package/src/components/.DS_Store +0 -0
- package/src/components/billing-info-container/index.tsx +469 -438
- package/src/components/common/CheckboxField.tsx +15 -8
- package/src/components/common/FormikPhoneNumberField.tsx +11 -11
- package/src/components/common/RadioGroupField/index.tsx +71 -0
- package/src/components/common/dist/PhoneNumberField.js +96 -0
- package/src/components/common/index.tsx +2 -1
- package/src/components/ticketsContainer/index.tsx +53 -6
- package/src/constants/index.ts +1 -0
- package/src/hooks/useCookieListener.ts +32 -0
- package/src/types/auth.d.ts +15 -0
- package/src/utils/auth.ts +13 -0
- package/src/utils/index.ts +1 -0
|
@@ -4,6 +4,7 @@ import Button from '@mui/material/Button';
|
|
|
4
4
|
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import { connect, Formik, Form, Field } from 'formik';
|
|
7
|
+
import _find from 'lodash-es/find';
|
|
7
8
|
import _get from 'lodash-es/get';
|
|
8
9
|
import _identity from 'lodash-es/identity';
|
|
9
10
|
import _includes from 'lodash-es/includes';
|
|
@@ -20,13 +21,18 @@ import TextField from '@mui/material/TextField';
|
|
|
20
21
|
import { useTheme } from '@mui/styles';
|
|
21
22
|
import _isFunction from 'lodash-es/isFunction';
|
|
22
23
|
import _isObject from 'lodash-es/isObject';
|
|
23
|
-
import FormGroup from '@mui/material/FormGroup';
|
|
24
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
25
24
|
import Checkbox from '@mui/material/Checkbox';
|
|
25
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
26
|
+
import FormGroup from '@mui/material/FormGroup';
|
|
26
27
|
import MuiPhoneNumber from 'material-ui-phone-number';
|
|
27
28
|
import _debounce from 'lodash-es/debounce';
|
|
28
29
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
29
30
|
import Select from '@mui/material/Select';
|
|
31
|
+
import FormControl$1 from '@mui/material/FormControl';
|
|
32
|
+
import FormHelperText$1 from '@mui/material/FormHelperText';
|
|
33
|
+
import FormLabel from '@mui/material/FormLabel';
|
|
34
|
+
import Radio from '@mui/material/Radio';
|
|
35
|
+
import RadioGroup from '@mui/material/RadioGroup';
|
|
30
36
|
import { object, string, ref, boolean } from 'yup';
|
|
31
37
|
import Box$1 from '@mui/material/Box';
|
|
32
38
|
import Modal$1 from '@mui/material/Modal';
|
|
@@ -42,12 +48,10 @@ import { loadStripe } from '@stripe/stripe-js';
|
|
|
42
48
|
import { FacebookShareButton, FacebookIcon, FacebookMessengerShareButton, FacebookMessengerIcon, TwitterShareButton, TwitterIcon, LinkedinShareButton, LinkedinIcon, PinterestShareButton, PinterestIcon, VKShareButton, VKIcon, OKShareButton, OKIcon, TelegramShareButton, TelegramIcon, WhatsappShareButton, WhatsappIcon, RedditShareButton, RedditIcon, TumblrShareButton, TumblrIcon, MailruShareButton, MailruIcon, EmailShareButton, EmailIcon, LivejournalShareButton, LivejournalIcon, ViberShareButton, ViberIcon, WorkplaceShareButton, WorkplaceIcon, LineShareButton, LineIcon, PocketShareButton, PocketIcon, InstapaperShareButton, InstapaperIcon, WeiboShareButton, WeiboIcon, HatenaShareButton, HatenaIcon } from 'react-share';
|
|
43
49
|
import { ThemeProvider as ThemeProvider$1 } from '@mui/private-theming';
|
|
44
50
|
import jwt_decode from 'jwt-decode';
|
|
45
|
-
import _find from 'lodash-es/find';
|
|
46
51
|
import _some from 'lodash-es/some';
|
|
47
52
|
import Button$1 from 'react-bootstrap/Button';
|
|
48
53
|
import moment from 'moment-timezone';
|
|
49
54
|
import _sortBy from 'lodash-es/sortBy';
|
|
50
|
-
import FormControl$1 from '@mui/material/FormControl';
|
|
51
55
|
import MenuItem from '@mui/material/MenuItem';
|
|
52
56
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
53
57
|
import Paper from '@mui/material/Paper';
|
|
@@ -59,7 +63,6 @@ import TableHead from '@mui/material/TableHead';
|
|
|
59
63
|
import TablePagination from '@mui/material/TablePagination';
|
|
60
64
|
import TableRow from '@mui/material/TableRow';
|
|
61
65
|
import _has from 'lodash-es/has';
|
|
62
|
-
import Radio from '@mui/material/Radio';
|
|
63
66
|
import _isNull from 'lodash-es/isNull';
|
|
64
67
|
import _reverse from 'lodash-es/reverse';
|
|
65
68
|
|
|
@@ -1180,6 +1183,22 @@ var createMarkup = function createMarkup(data) {
|
|
|
1180
1183
|
};
|
|
1181
1184
|
};
|
|
1182
1185
|
|
|
1186
|
+
var setLoggedUserData = function setLoggedUserData(data) {
|
|
1187
|
+
return {
|
|
1188
|
+
id: data.id,
|
|
1189
|
+
first_name: data.firstName,
|
|
1190
|
+
last_name: data.lastName,
|
|
1191
|
+
email: data.email,
|
|
1192
|
+
confirmEmail: data.email,
|
|
1193
|
+
city: (data == null ? void 0 : data.city) || '',
|
|
1194
|
+
country: (data == null ? void 0 : data.countryId) || (data == null ? void 0 : data.country) || '',
|
|
1195
|
+
phone: (data == null ? void 0 : data.phone) || '',
|
|
1196
|
+
street_address: (data == null ? void 0 : data.streetAddress) || '',
|
|
1197
|
+
state: (data == null ? void 0 : data.stateId) || '',
|
|
1198
|
+
zip: (data == null ? void 0 : data.zip) || (data == null ? void 0 : data.zipCode) || ''
|
|
1199
|
+
};
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1183
1202
|
var isWindowDefined = typeof window !== 'undefined';
|
|
1184
1203
|
var isDocumentDefined = typeof document !== 'undefined';
|
|
1185
1204
|
|
|
@@ -1223,8 +1242,6 @@ publicRequest.interceptors.response.use(function (response) {
|
|
|
1223
1242
|
return Promise.reject(error);
|
|
1224
1243
|
});
|
|
1225
1244
|
publicRequest.interceptors.request.use(function (config) {
|
|
1226
|
-
var _document$cookie;
|
|
1227
|
-
|
|
1228
1245
|
var guestToken = isWindowDefined ? window.localStorage.getItem('auth_guest_token') : null;
|
|
1229
1246
|
var userData = isWindowDefined ? window.localStorage.getItem('user_data') : null;
|
|
1230
1247
|
var accessToken = isWindowDefined ? window.localStorage.getItem('access_token') : null;
|
|
@@ -1255,16 +1272,6 @@ publicRequest.interceptors.request.use(function (config) {
|
|
|
1255
1272
|
config.headers = _updatedHeaders2;
|
|
1256
1273
|
}
|
|
1257
1274
|
|
|
1258
|
-
var additionalCookiesHeaderValue = (_document$cookie = document.cookie) != null ? _document$cookie : '';
|
|
1259
|
-
|
|
1260
|
-
if (additionalCookiesHeaderValue !== '') {
|
|
1261
|
-
var _updatedHeaders3 = _extends({}, config.headers, {
|
|
1262
|
-
'Additional-Cookies': additionalCookiesHeaderValue
|
|
1263
|
-
});
|
|
1264
|
-
|
|
1265
|
-
config.headers = _updatedHeaders3;
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
1275
|
if (CONFIGS.X_SOURCE_ORIGIN) {
|
|
1269
1276
|
var _updatedHeaders4 = _extends({}, config.headers, {
|
|
1270
1277
|
'X-Source-Origin': CONFIGS.X_SOURCE_ORIGIN
|
|
@@ -1459,7 +1466,7 @@ var getProfileData = function getProfileData(accessToken) {
|
|
|
1459
1466
|
});
|
|
1460
1467
|
};
|
|
1461
1468
|
var getCountries = function getCountries() {
|
|
1462
|
-
return publicRequest.get('/countries/');
|
|
1469
|
+
return publicRequest.get('/countries/list');
|
|
1463
1470
|
};
|
|
1464
1471
|
var getConfirmationData = function getConfirmationData(orderHash) {
|
|
1465
1472
|
return publicRequest.get("v1/order/" + orderHash + "/payment/complete");
|
|
@@ -1794,7 +1801,7 @@ var DatePickerField = function DatePickerField(_ref) {
|
|
|
1794
1801
|
})));
|
|
1795
1802
|
};
|
|
1796
1803
|
|
|
1797
|
-
var _excluded = ["label", "field", "selectOptions", "theme", "setFieldValue", "disableDropdown", "setPhoneValidationIsLoading"];
|
|
1804
|
+
var _excluded = ["label", "field", "selectOptions", "theme", "setFieldValue", "disableDropdown", "setPhoneValidationIsLoading", "defaultCountry", "dateFormat", "datePlaceholder"];
|
|
1798
1805
|
var CheckboxField = function CheckboxField(_ref) {
|
|
1799
1806
|
var _rest$form, _field$name, _rest$form2, _field$name2;
|
|
1800
1807
|
|
|
@@ -1804,14 +1811,14 @@ var CheckboxField = function CheckboxField(_ref) {
|
|
|
1804
1811
|
|
|
1805
1812
|
var customTheme = useTheme();
|
|
1806
1813
|
return React.createElement(FormControl, {
|
|
1807
|
-
error: !!(rest != null && (_rest$form = rest.form) != null && _rest$form.errors && rest.form.errors[(_field$name = field == null ? void 0 : field.name) != null ? _field$name :
|
|
1814
|
+
error: !!(rest != null && (_rest$form = rest.form) != null && _rest$form.errors && rest.form.errors[(_field$name = field == null ? void 0 : field.name) != null ? _field$name : ''])
|
|
1808
1815
|
}, React.createElement(FormGroup, null, React.createElement(FormControlLabel, {
|
|
1809
1816
|
control: React.createElement(Checkbox, Object.assign({}, field, rest)),
|
|
1810
1817
|
label: label,
|
|
1811
1818
|
componentsProps: {
|
|
1812
1819
|
typography: customTheme == null ? void 0 : customTheme.checkbox
|
|
1813
1820
|
}
|
|
1814
|
-
})), !!(rest != null && (_rest$form2 = rest.form) != null && _rest$form2.errors && rest.form.errors[(_field$name2 = field == null ? void 0 : field.name) != null ? _field$name2 :
|
|
1821
|
+
})), !!(rest != null && (_rest$form2 = rest.form) != null && _rest$form2.errors && rest.form.errors[(_field$name2 = field == null ? void 0 : field.name) != null ? _field$name2 : '']) ? React.createElement(FormHelperText, null, "Required") : null);
|
|
1815
1822
|
};
|
|
1816
1823
|
|
|
1817
1824
|
var PhoneNumberField = function PhoneNumberField(_ref) {
|
|
@@ -1996,6 +2003,48 @@ var SelectField = function SelectField(_ref) {
|
|
|
1996
2003
|
}, error) : null);
|
|
1997
2004
|
};
|
|
1998
2005
|
|
|
2006
|
+
var RadioGroupField = function RadioGroupField(_ref) {
|
|
2007
|
+
var label = _ref.label,
|
|
2008
|
+
field = _ref.field,
|
|
2009
|
+
radios = _ref.radios,
|
|
2010
|
+
_ref$form = _ref.form,
|
|
2011
|
+
errors = _ref$form.errors,
|
|
2012
|
+
setFieldValue = _ref$form.setFieldValue,
|
|
2013
|
+
_ref$onChange = _ref.onChange,
|
|
2014
|
+
onChange = _ref$onChange === void 0 ? _identity : _ref$onChange;
|
|
2015
|
+
var radioId = "radio-" + field.name;
|
|
2016
|
+
|
|
2017
|
+
var error = _get(errors, field.name);
|
|
2018
|
+
|
|
2019
|
+
var handleChange = function handleChange(e) {
|
|
2020
|
+
var value = e.target.value;
|
|
2021
|
+
setFieldValue(field.name, value);
|
|
2022
|
+
onChange(e);
|
|
2023
|
+
};
|
|
2024
|
+
|
|
2025
|
+
return React.createElement(FormControl$1, null, error ? React.createElement(FormHelperText$1, {
|
|
2026
|
+
className: "radio-error",
|
|
2027
|
+
error: true
|
|
2028
|
+
}, error) : null, label && React.createElement(FormLabel, {
|
|
2029
|
+
id: radioId
|
|
2030
|
+
}, label), React.createElement(RadioGroup, {
|
|
2031
|
+
"aria-labelledby": radioId,
|
|
2032
|
+
name: field.name,
|
|
2033
|
+
value: field.value,
|
|
2034
|
+
onChange: handleChange
|
|
2035
|
+
}, radios.map(function (radio) {
|
|
2036
|
+
var id = radio.id,
|
|
2037
|
+
name = radio.name,
|
|
2038
|
+
value = radio.value;
|
|
2039
|
+
return React.createElement(FormControlLabel, {
|
|
2040
|
+
key: id,
|
|
2041
|
+
label: name,
|
|
2042
|
+
value: value,
|
|
2043
|
+
control: React.createElement(Radio, null)
|
|
2044
|
+
});
|
|
2045
|
+
})));
|
|
2046
|
+
};
|
|
2047
|
+
|
|
1999
2048
|
var SnackbarAlert = function SnackbarAlert(_ref) {
|
|
2000
2049
|
var isOpen = _ref.isOpen,
|
|
2001
2050
|
message = _ref.message,
|
|
@@ -2181,7 +2230,7 @@ var style$1 = {
|
|
|
2181
2230
|
border: '1px solid white',
|
|
2182
2231
|
outline: 'none'
|
|
2183
2232
|
};
|
|
2184
|
-
var setLoggedUserData = function setLoggedUserData(data) {
|
|
2233
|
+
var setLoggedUserData$1 = function setLoggedUserData(data) {
|
|
2185
2234
|
return {
|
|
2186
2235
|
id: data.id,
|
|
2187
2236
|
first_name: data.firstName,
|
|
@@ -2279,7 +2328,7 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
2279
2328
|
|
|
2280
2329
|
case 17:
|
|
2281
2330
|
profileSpecifiedData = _get(profileResponse, 'data.data');
|
|
2282
|
-
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
2331
|
+
profileDataObj = setLoggedUserData$1(profileSpecifiedData);
|
|
2283
2332
|
|
|
2284
2333
|
if (typeof window !== 'undefined') {
|
|
2285
2334
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
@@ -2718,7 +2767,7 @@ var createRegisterFormData = function createRegisterFormData(values, checkoutBod
|
|
|
2718
2767
|
|
|
2719
2768
|
return bodyFormData;
|
|
2720
2769
|
};
|
|
2721
|
-
var setLoggedUserData$
|
|
2770
|
+
var setLoggedUserData$2 = function setLoggedUserData(data) {
|
|
2722
2771
|
return {
|
|
2723
2772
|
id: data.id,
|
|
2724
2773
|
first_name: data.firstName,
|
|
@@ -3056,6 +3105,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3056
3105
|
|
|
3057
3106
|
var themeMui = createTheme(themeOptions);
|
|
3058
3107
|
var isWindowDefined = typeof window !== 'undefined';
|
|
3108
|
+
var defaultCountry = isWindowDefined ? window.localStorage.getItem('eventCountry') : '';
|
|
3059
3109
|
var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
3060
3110
|
var access_token = isWindowDefined && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
|
|
3061
3111
|
|
|
@@ -3127,13 +3177,17 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3127
3177
|
loading = _useState14[0],
|
|
3128
3178
|
setLoading = _useState14[1];
|
|
3129
3179
|
|
|
3130
|
-
var _useState15 = useState(
|
|
3131
|
-
|
|
3132
|
-
|
|
3180
|
+
var _useState15 = useState(true),
|
|
3181
|
+
isCountriesLoading = _useState15[0],
|
|
3182
|
+
setIsCountriesLoading = _useState15[1];
|
|
3133
3183
|
|
|
3134
|
-
var _useState16 = useState(
|
|
3135
|
-
|
|
3136
|
-
|
|
3184
|
+
var _useState16 = useState(null),
|
|
3185
|
+
error = _useState16[0],
|
|
3186
|
+
setError = _useState16[1];
|
|
3187
|
+
|
|
3188
|
+
var _useState17 = useState(false),
|
|
3189
|
+
phoneValidationIsLoading = _useState17[0],
|
|
3190
|
+
setPhoneValidationIsLoading = _useState17[1];
|
|
3137
3191
|
|
|
3138
3192
|
var emailLogged = _get(userData, 'email', '') || _get(userValues, 'email', '');
|
|
3139
3193
|
|
|
@@ -3213,30 +3267,34 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3213
3267
|
case 3:
|
|
3214
3268
|
res = _context2.sent;
|
|
3215
3269
|
setCustomHeader(res);
|
|
3216
|
-
setCountries(_map(_get(res, 'data.data'), function (item
|
|
3270
|
+
setCountries(_map(_get(res, 'data.data'), function (item) {
|
|
3217
3271
|
return {
|
|
3218
|
-
label: item,
|
|
3219
|
-
value:
|
|
3272
|
+
label: item.name,
|
|
3273
|
+
value: item.id,
|
|
3274
|
+
code: item.code
|
|
3220
3275
|
};
|
|
3221
3276
|
}));
|
|
3277
|
+
setIsCountriesLoading(false);
|
|
3222
3278
|
onGetCountriesSuccess(res.data);
|
|
3223
|
-
_context2.next =
|
|
3279
|
+
_context2.next = 14;
|
|
3224
3280
|
break;
|
|
3225
3281
|
|
|
3226
|
-
case
|
|
3227
|
-
_context2.prev =
|
|
3282
|
+
case 10:
|
|
3283
|
+
_context2.prev = 10;
|
|
3228
3284
|
_context2.t0 = _context2["catch"](0);
|
|
3229
3285
|
|
|
3230
3286
|
if (axios.isAxiosError(_context2.t0)) {
|
|
3231
3287
|
onGetCountriesError(_context2.t0);
|
|
3232
3288
|
}
|
|
3233
3289
|
|
|
3234
|
-
|
|
3290
|
+
setIsCountriesLoading(false);
|
|
3291
|
+
|
|
3292
|
+
case 14:
|
|
3235
3293
|
case "end":
|
|
3236
3294
|
return _context2.stop();
|
|
3237
3295
|
}
|
|
3238
3296
|
}
|
|
3239
|
-
}, _callee2, null, [[0,
|
|
3297
|
+
}, _callee2, null, [[0, 10]]);
|
|
3240
3298
|
}));
|
|
3241
3299
|
|
|
3242
3300
|
return function fetchCountries() {
|
|
@@ -3315,7 +3373,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3315
3373
|
case 4:
|
|
3316
3374
|
userDataResponse = _context4.sent;
|
|
3317
3375
|
profileSpecifiedData = _get(userDataResponse, 'data.data');
|
|
3318
|
-
profileDataObj = setLoggedUserData$
|
|
3376
|
+
profileDataObj = setLoggedUserData$2(profileSpecifiedData);
|
|
3319
3377
|
setUserValues(_extends({}, profileDataObj, {
|
|
3320
3378
|
firstName: profileDataObj.first_name,
|
|
3321
3379
|
lastName: profileDataObj.last_name
|
|
@@ -3446,7 +3504,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3446
3504
|
|
|
3447
3505
|
return React.createElement(ThemeProvider, {
|
|
3448
3506
|
theme: themeMui
|
|
3449
|
-
}, loading && React.createElement(Backdrop, {
|
|
3507
|
+
}, (loading || isCountriesLoading) && React.createElement(Backdrop, {
|
|
3450
3508
|
sx: {
|
|
3451
3509
|
color: '#fff',
|
|
3452
3510
|
backgroundColor: '#000000bd',
|
|
@@ -3458,9 +3516,11 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3458
3516
|
})), !!expirationTime && enableTimer && React.createElement(TimerWidget$1, {
|
|
3459
3517
|
expires_at: expirationTime,
|
|
3460
3518
|
onCountdownFinish: onCountdownFinish
|
|
3461
|
-
}), React.createElement(Formik, {
|
|
3519
|
+
}), !isCountriesLoading && React.createElement(Formik, {
|
|
3462
3520
|
initialValues: getInitialValues(dataWithUniqueIds, _extends({
|
|
3463
|
-
country:
|
|
3521
|
+
country: (_find(countries, function (item) {
|
|
3522
|
+
return item.code.toLowerCase() === defaultCountry;
|
|
3523
|
+
}) || {}).value || _get(userData, 'country', '') || '1',
|
|
3464
3524
|
state: _get(userData, 'state', '') || '1',
|
|
3465
3525
|
brand_opt_in: optedInFieldValue,
|
|
3466
3526
|
ttf_opt_in: ttfOptIn
|
|
@@ -3505,7 +3565,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3505
3565
|
case 11:
|
|
3506
3566
|
updatedUserData = _context6.sent;
|
|
3507
3567
|
_profileSpecifiedData = _get(updatedUserData, 'data.data');
|
|
3508
|
-
_profileDataObj = setLoggedUserData$
|
|
3568
|
+
_profileDataObj = setLoggedUserData$2(_profileSpecifiedData);
|
|
3509
3569
|
window.localStorage.setItem('user_data', JSON.stringify(_profileDataObj));
|
|
3510
3570
|
|
|
3511
3571
|
case 15:
|
|
@@ -3579,7 +3639,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3579
3639
|
case 39:
|
|
3580
3640
|
profileData = _context6.sent;
|
|
3581
3641
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
3582
|
-
profileDataObj = setLoggedUserData$
|
|
3642
|
+
profileDataObj = setLoggedUserData$2(profileSpecifiedData);
|
|
3583
3643
|
|
|
3584
3644
|
if (isWindowDefined) {
|
|
3585
3645
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
@@ -3747,7 +3807,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3747
3807
|
return ['password', 'confirmPassword', 'password-info'].includes(element.name) && isLoggedIn ? null : ['data_capture[wallet_address]'].includes(element.name) && hideWalletAddressField ? null : React.createElement(React.Fragment, {
|
|
3748
3808
|
key: element.uniqueId
|
|
3749
3809
|
}, React.createElement("div", {
|
|
3750
|
-
className: element.className + " " + (props == null ? void 0 : props.errors[element.name])
|
|
3810
|
+
className: element.className + " " + ((props == null ? void 0 : props.errors[element.name]) || '')
|
|
3751
3811
|
}, element.component ? element.component : React.createElement(Field, {
|
|
3752
3812
|
setPhoneValidationIsLoading: element.type === 'phone' ? setPhoneValidationIsLoading : undefined,
|
|
3753
3813
|
name: element.name,
|
|
@@ -3757,11 +3817,12 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3757
3817
|
validate: getValidateFunctions(element, states, props.values, props.errors),
|
|
3758
3818
|
setFieldValue: props.setFieldValue,
|
|
3759
3819
|
onBlur: props.handleBlur,
|
|
3760
|
-
component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : element.type === 'phone' ? PhoneNumberField : element.type === 'date' ? DatePickerField : CustomField,
|
|
3820
|
+
component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : element.type === 'phone' ? PhoneNumberField : element.type === 'date' ? DatePickerField : element.type === 'radio' ? RadioGroupField : CustomField,
|
|
3761
3821
|
selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : [],
|
|
3822
|
+
radios: element.radios,
|
|
3762
3823
|
theme: theme,
|
|
3763
3824
|
disableDropdown: element.disableDropdown,
|
|
3764
|
-
defaultCountry: element.defaultCountry,
|
|
3825
|
+
defaultCountry: defaultCountry || element.defaultCountry,
|
|
3765
3826
|
dateFormat: element.format,
|
|
3766
3827
|
datePlaceholder: element.placeholder
|
|
3767
3828
|
})));
|
|
@@ -3799,7 +3860,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
3799
3860
|
}),
|
|
3800
3861
|
disableDropdown: element.disableDropdown,
|
|
3801
3862
|
setPhoneValidationIsLoading: setPhoneValidationIsLoading,
|
|
3802
|
-
defaultCountry: element.defaultCountry
|
|
3863
|
+
defaultCountry: defaultCountry || element.defaultCountry
|
|
3803
3864
|
}));
|
|
3804
3865
|
})));
|
|
3805
3866
|
}));
|
|
@@ -4956,6 +5017,38 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
|
|
|
4956
5017
|
}))))));
|
|
4957
5018
|
};
|
|
4958
5019
|
|
|
5020
|
+
var X_TF_ECOMMERCE = 'X-TF-ECOMMERCE';
|
|
5021
|
+
|
|
5022
|
+
var useCookieListener = function useCookieListener(key, handler) {
|
|
5023
|
+
var getCookie = function getCookie() {
|
|
5024
|
+
return getCookieByName(key);
|
|
5025
|
+
};
|
|
5026
|
+
|
|
5027
|
+
var _useState = useState(),
|
|
5028
|
+
intervalValue = _useState[0],
|
|
5029
|
+
setIntervalValue = _useState[1];
|
|
5030
|
+
|
|
5031
|
+
var cookieRef = useRef(getCookie());
|
|
5032
|
+
|
|
5033
|
+
var handleCookieChange = function handleCookieChange() {
|
|
5034
|
+
var currentCookie = getCookie();
|
|
5035
|
+
var prevCookie = cookieRef.current;
|
|
5036
|
+
|
|
5037
|
+
if (currentCookie !== prevCookie) {
|
|
5038
|
+
cookieRef.current = getCookie();
|
|
5039
|
+
handler(cookieRef.current);
|
|
5040
|
+
}
|
|
5041
|
+
};
|
|
5042
|
+
|
|
5043
|
+
useEffect(function () {
|
|
5044
|
+
var interval = setInterval(handleCookieChange, 500);
|
|
5045
|
+
setIntervalValue(interval);
|
|
5046
|
+
return function () {
|
|
5047
|
+
intervalValue && clearInterval(intervalValue);
|
|
5048
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5049
|
+
}, []);
|
|
5050
|
+
};
|
|
5051
|
+
|
|
4959
5052
|
var style$3 = {
|
|
4960
5053
|
position: 'absolute',
|
|
4961
5054
|
top: '50%',
|
|
@@ -5558,6 +5651,10 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
5558
5651
|
onLogoutSuccess = _ref$onLogoutSuccess === void 0 ? _identity : _ref$onLogoutSuccess,
|
|
5559
5652
|
_ref$onLogoutError = _ref.onLogoutError,
|
|
5560
5653
|
onLogoutError = _ref$onLogoutError === void 0 ? _identity : _ref$onLogoutError,
|
|
5654
|
+
_ref$onGetProfileData = _ref.onGetProfileDataSuccess,
|
|
5655
|
+
onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? _identity : _ref$onGetProfileData,
|
|
5656
|
+
_ref$onGetProfileData2 = _ref.onGetProfileDataError,
|
|
5657
|
+
onGetProfileDataError = _ref$onGetProfileData2 === void 0 ? _identity : _ref$onGetProfileData2,
|
|
5561
5658
|
_ref$theme = _ref.theme,
|
|
5562
5659
|
theme = _ref$theme === void 0 ? 'light' : _ref$theme,
|
|
5563
5660
|
_ref$queryPromoCode = _ref.queryPromoCode,
|
|
@@ -5600,9 +5697,8 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
5600
5697
|
setSelectedTickets = _useState[1];
|
|
5601
5698
|
|
|
5602
5699
|
var isWindowDefined = typeof window !== 'undefined';
|
|
5603
|
-
var xtfCookie = getCookieByName('X-TF-ECOMMERCE');
|
|
5604
5700
|
|
|
5605
|
-
var _useState2 = useState((
|
|
5701
|
+
var _useState2 = useState(Boolean(getCookieByName(X_TF_ECOMMERCE))),
|
|
5606
5702
|
isLogged = _useState2[0],
|
|
5607
5703
|
setIsLogged = _useState2[1];
|
|
5608
5704
|
|
|
@@ -5671,6 +5767,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
5671
5767
|
setIsInvalidLinkError = _useState18[1];
|
|
5672
5768
|
|
|
5673
5769
|
var ticketsContainerRef = useRef(null);
|
|
5770
|
+
useCookieListener(X_TF_ECOMMERCE, function (value) {
|
|
5771
|
+
return setIsLogged(Boolean(value));
|
|
5772
|
+
});
|
|
5674
5773
|
useEffect(function () {
|
|
5675
5774
|
if (typeof window !== 'undefined') {
|
|
5676
5775
|
var access_token = window.localStorage.getItem('access_token');
|
|
@@ -5688,6 +5787,18 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
5688
5787
|
useEffect(function () {
|
|
5689
5788
|
!!eventId && getTicketsApi();
|
|
5690
5789
|
}, [eventId]);
|
|
5790
|
+
useEffect(function () {
|
|
5791
|
+
if (isLogged) {
|
|
5792
|
+
fetchUserData().then(function (res) {
|
|
5793
|
+
window.localStorage.setItem('user_data', JSON.stringify(res));
|
|
5794
|
+
onGetProfileDataSuccess(res);
|
|
5795
|
+
})["catch"](function (e) {
|
|
5796
|
+
if (axios.isAxiosError(e)) {
|
|
5797
|
+
onGetProfileDataError(e);
|
|
5798
|
+
}
|
|
5799
|
+
});
|
|
5800
|
+
}
|
|
5801
|
+
}, [isLogged]);
|
|
5691
5802
|
|
|
5692
5803
|
var handleLogout = /*#__PURE__*/function () {
|
|
5693
5804
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
@@ -5756,26 +5867,26 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
5756
5867
|
}
|
|
5757
5868
|
|
|
5758
5869
|
function _getTicketsApi() {
|
|
5759
|
-
_getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5870
|
+
_getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(isUpdateingCode, type) {
|
|
5760
5871
|
var _previewKey, response, eventResponse, attributes, _event2;
|
|
5761
5872
|
|
|
5762
|
-
return runtime_1.wrap(function
|
|
5873
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
5763
5874
|
while (1) {
|
|
5764
|
-
switch (
|
|
5875
|
+
switch (_context4.prev = _context4.next) {
|
|
5765
5876
|
case 0:
|
|
5766
|
-
|
|
5877
|
+
_context4.prev = 0;
|
|
5767
5878
|
isUpdateingCode ? setCodeIsLoading(true) : setIsLoading(true);
|
|
5768
5879
|
_previewKey = getQueryVariable('pk') || undefined;
|
|
5769
|
-
|
|
5880
|
+
_context4.next = 5;
|
|
5770
5881
|
return getTickets(eventId, code, _previewKey);
|
|
5771
5882
|
|
|
5772
5883
|
case 5:
|
|
5773
|
-
response =
|
|
5774
|
-
|
|
5884
|
+
response = _context4.sent;
|
|
5885
|
+
_context4.next = 8;
|
|
5775
5886
|
return getEvent(eventId, _previewKey);
|
|
5776
5887
|
|
|
5777
5888
|
case 8:
|
|
5778
|
-
eventResponse =
|
|
5889
|
+
eventResponse = _context4.sent;
|
|
5779
5890
|
|
|
5780
5891
|
if (response.data.success) {
|
|
5781
5892
|
attributes = _get(response, 'data.data.attributes');
|
|
@@ -5792,32 +5903,36 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
5792
5903
|
if (eventResponse.data.success) {
|
|
5793
5904
|
_event2 = _get(eventResponse, 'data.data.attributes');
|
|
5794
5905
|
setEvent(_event2);
|
|
5906
|
+
|
|
5907
|
+
if (_event2.country && isWindowDefined) {
|
|
5908
|
+
window.localStorage.setItem('eventCountry', _event2.country);
|
|
5909
|
+
}
|
|
5795
5910
|
}
|
|
5796
5911
|
|
|
5797
|
-
|
|
5912
|
+
_context4.next = 16;
|
|
5798
5913
|
break;
|
|
5799
5914
|
|
|
5800
5915
|
case 13:
|
|
5801
|
-
|
|
5802
|
-
|
|
5916
|
+
_context4.prev = 13;
|
|
5917
|
+
_context4.t0 = _context4["catch"](0);
|
|
5803
5918
|
|
|
5804
|
-
if (axios.isAxiosError(
|
|
5805
|
-
onGetTicketsError(
|
|
5806
|
-
setError(_get(
|
|
5919
|
+
if (axios.isAxiosError(_context4.t0)) {
|
|
5920
|
+
onGetTicketsError(_context4.t0);
|
|
5921
|
+
setError(_get(_context4.t0, 'response.data.message'));
|
|
5807
5922
|
}
|
|
5808
5923
|
|
|
5809
5924
|
case 16:
|
|
5810
|
-
|
|
5925
|
+
_context4.prev = 16;
|
|
5811
5926
|
setIsLoading(false);
|
|
5812
5927
|
setCodeIsLoading(false);
|
|
5813
|
-
return
|
|
5928
|
+
return _context4.finish(16);
|
|
5814
5929
|
|
|
5815
5930
|
case 20:
|
|
5816
5931
|
case "end":
|
|
5817
|
-
return
|
|
5932
|
+
return _context4.stop();
|
|
5818
5933
|
}
|
|
5819
5934
|
}
|
|
5820
|
-
},
|
|
5935
|
+
}, _callee4, null, [[0, 13, 16, 20]]);
|
|
5821
5936
|
}));
|
|
5822
5937
|
return _getTicketsApi.apply(this, arguments);
|
|
5823
5938
|
}
|
|
@@ -6016,6 +6131,41 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
6016
6131
|
getTicketsApi(isUpdateingCode, type);
|
|
6017
6132
|
};
|
|
6018
6133
|
|
|
6134
|
+
var fetchUserData = /*#__PURE__*/function () {
|
|
6135
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
6136
|
+
var userDataResponse, profileData, profileDataObj;
|
|
6137
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
6138
|
+
while (1) {
|
|
6139
|
+
switch (_context3.prev = _context3.next) {
|
|
6140
|
+
case 0:
|
|
6141
|
+
_context3.prev = 0;
|
|
6142
|
+
_context3.next = 3;
|
|
6143
|
+
return getProfileData();
|
|
6144
|
+
|
|
6145
|
+
case 3:
|
|
6146
|
+
userDataResponse = _context3.sent;
|
|
6147
|
+
profileData = _get(userDataResponse, 'data.data');
|
|
6148
|
+
profileDataObj = setLoggedUserData(profileData);
|
|
6149
|
+
return _context3.abrupt("return", profileDataObj);
|
|
6150
|
+
|
|
6151
|
+
case 9:
|
|
6152
|
+
_context3.prev = 9;
|
|
6153
|
+
_context3.t0 = _context3["catch"](0);
|
|
6154
|
+
throw new Error(_context3.t0);
|
|
6155
|
+
|
|
6156
|
+
case 12:
|
|
6157
|
+
case "end":
|
|
6158
|
+
return _context3.stop();
|
|
6159
|
+
}
|
|
6160
|
+
}
|
|
6161
|
+
}, _callee3, null, [[0, 9]]);
|
|
6162
|
+
}));
|
|
6163
|
+
|
|
6164
|
+
return function fetchUserData() {
|
|
6165
|
+
return _ref5.apply(this, arguments);
|
|
6166
|
+
};
|
|
6167
|
+
}();
|
|
6168
|
+
|
|
6019
6169
|
var isTicketOnSale = _some(tickets, function (item) {
|
|
6020
6170
|
return item.salesStarted && !item.salesEnded && !item.soldOut;
|
|
6021
6171
|
});
|