tf-checkout-react 1.0.46 → 1.0.47
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 -0
- package/dist/components/ticketsContainer/index.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +199 -126
- 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 +199 -126
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/types/billing-info-data.d.ts +2 -2
- package/package.json +2 -1
- package/src/api/index.ts +2 -0
- package/src/components/billing-info-container/index.tsx +66 -34
- package/src/components/ticketsContainer/index.tsx +2 -0
- package/src/types/billing-info-data.ts +2 -2
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
package/dist/api/index.d.ts
CHANGED
|
@@ -21,4 +21,5 @@ export declare const getCountries: () => Promise<import("axios").AxiosResponse<a
|
|
|
21
21
|
export declare const getConfirmationData: (orderHash: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
22
22
|
export declare const getStates: (countryId: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
23
23
|
export declare const addToWaitingList: (id: number, data: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
24
|
+
export declare const getConditions: (eventId: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
24
25
|
export {};
|
|
@@ -23,6 +23,7 @@ var styles = require('@mui/styles');
|
|
|
23
23
|
var FormGroup = _interopDefault(require('@mui/material/FormGroup'));
|
|
24
24
|
var FormControlLabel = _interopDefault(require('@mui/material/FormControlLabel'));
|
|
25
25
|
var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
|
|
26
|
+
var nanoid = require('nanoid');
|
|
26
27
|
var Container = _interopDefault(require('@mui/material/Container'));
|
|
27
28
|
var Alert = _interopDefault(require('@mui/material/Alert'));
|
|
28
29
|
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
@@ -1074,6 +1075,9 @@ var getStates = function getStates(countryId) {
|
|
|
1074
1075
|
var addToWaitingList = function addToWaitingList(id, data) {
|
|
1075
1076
|
return publicRequest.post("/v1/event/" + id + "/add_to_waiting_list", data);
|
|
1076
1077
|
};
|
|
1078
|
+
var getConditions = function getConditions(eventId) {
|
|
1079
|
+
return publicRequest.get("v1/event/" + eventId + "/conditions");
|
|
1080
|
+
};
|
|
1077
1081
|
|
|
1078
1082
|
var style = {
|
|
1079
1083
|
position: 'absolute',
|
|
@@ -1861,11 +1865,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1861
1865
|
showModalRegister = _useState7[0],
|
|
1862
1866
|
setShowModalRegister = _useState7[1];
|
|
1863
1867
|
|
|
1864
|
-
var _useState8 = React.useState(
|
|
1868
|
+
var _useState8 = React.useState([]),
|
|
1865
1869
|
ticketsQuantity = _useState8[0],
|
|
1866
1870
|
setTicketsQuantity = _useState8[1];
|
|
1867
1871
|
|
|
1868
|
-
var _useState9 = React.useState(
|
|
1872
|
+
var _useState9 = React.useState([]),
|
|
1873
|
+
conditions = _useState9[0],
|
|
1874
|
+
setConditions = _useState9[1];
|
|
1875
|
+
|
|
1876
|
+
var _useState10 = React.useState({
|
|
1869
1877
|
firstName: '',
|
|
1870
1878
|
lastName: '',
|
|
1871
1879
|
email: '',
|
|
@@ -1880,8 +1888,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1880
1888
|
state: '',
|
|
1881
1889
|
zip: ''
|
|
1882
1890
|
}),
|
|
1883
|
-
userValues =
|
|
1884
|
-
setUserValues =
|
|
1891
|
+
userValues = _useState10[0],
|
|
1892
|
+
setUserValues = _useState10[1];
|
|
1885
1893
|
|
|
1886
1894
|
var isLoggedIn = !!access_token;
|
|
1887
1895
|
|
|
@@ -1893,9 +1901,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1893
1901
|
|
|
1894
1902
|
var showDOB = getQueryVariable('age_required') === 'true';
|
|
1895
1903
|
var showTicketHolderName = getQueryVariable('names_required') === 'true';
|
|
1904
|
+
var eventId = getQueryVariable('event_id');
|
|
1896
1905
|
|
|
1897
1906
|
var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
|
|
1898
1907
|
|
|
1908
|
+
var hideOptIn = _get(cartInfoData, 'hide_ttf_opt_in', false);
|
|
1909
|
+
|
|
1899
1910
|
var getQuantity = function getQuantity(cart) {
|
|
1900
1911
|
if (cart === void 0) {
|
|
1901
1912
|
cart = [];
|
|
@@ -1906,73 +1917,166 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1906
1917
|
qty += +item.quantity;
|
|
1907
1918
|
});
|
|
1908
1919
|
return qty;
|
|
1909
|
-
}; //
|
|
1920
|
+
}; //just once
|
|
1921
|
+
|
|
1922
|
+
|
|
1923
|
+
React.useEffect(function () {
|
|
1924
|
+
// fetch conditions data
|
|
1925
|
+
var fetchConditions = /*#__PURE__*/function () {
|
|
1926
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
1927
|
+
var res, conditionsInfo;
|
|
1928
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1929
|
+
while (1) {
|
|
1930
|
+
switch (_context2.prev = _context2.next) {
|
|
1931
|
+
case 0:
|
|
1932
|
+
if (!eventId) {
|
|
1933
|
+
_context2.next = 6;
|
|
1934
|
+
break;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
_context2.next = 3;
|
|
1938
|
+
return getConditions(eventId);
|
|
1939
|
+
|
|
1940
|
+
case 3:
|
|
1941
|
+
res = _context2.sent;
|
|
1942
|
+
conditionsInfo = _get(res, 'data.data.attributes');
|
|
1943
|
+
setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
|
|
1944
|
+
return {
|
|
1945
|
+
id: nanoid.nanoid(),
|
|
1946
|
+
text: item
|
|
1947
|
+
};
|
|
1948
|
+
}) : []);
|
|
1949
|
+
|
|
1950
|
+
case 6:
|
|
1951
|
+
case "end":
|
|
1952
|
+
return _context2.stop();
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
}, _callee2);
|
|
1956
|
+
}));
|
|
1957
|
+
|
|
1958
|
+
return function fetchConditions() {
|
|
1959
|
+
return _ref5.apply(this, arguments);
|
|
1960
|
+
};
|
|
1961
|
+
}();
|
|
1962
|
+
|
|
1963
|
+
fetchConditions(); // fetch countries data
|
|
1964
|
+
|
|
1965
|
+
var fetchCountries = /*#__PURE__*/function () {
|
|
1966
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
1967
|
+
var res;
|
|
1968
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1969
|
+
while (1) {
|
|
1970
|
+
switch (_context3.prev = _context3.next) {
|
|
1971
|
+
case 0:
|
|
1972
|
+
_context3.prev = 0;
|
|
1973
|
+
_context3.next = 3;
|
|
1974
|
+
return getCountries();
|
|
1975
|
+
|
|
1976
|
+
case 3:
|
|
1977
|
+
res = _context3.sent;
|
|
1978
|
+
setCustomHeader(res);
|
|
1979
|
+
setCountries(_map(_get(res, 'data.data'), function (item, key) {
|
|
1980
|
+
return {
|
|
1981
|
+
label: item,
|
|
1982
|
+
value: Number(key)
|
|
1983
|
+
};
|
|
1984
|
+
}));
|
|
1985
|
+
onGetCountriesSuccess(res.data);
|
|
1986
|
+
_context3.next = 12;
|
|
1987
|
+
break;
|
|
1910
1988
|
|
|
1989
|
+
case 9:
|
|
1990
|
+
_context3.prev = 9;
|
|
1991
|
+
_context3.t0 = _context3["catch"](0);
|
|
1992
|
+
|
|
1993
|
+
if (axios.isAxiosError(_context3.t0)) {
|
|
1994
|
+
onGetCountriesError(_context3.t0);
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
case 12:
|
|
1998
|
+
case "end":
|
|
1999
|
+
return _context3.stop();
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
}, _callee3, null, [[0, 9]]);
|
|
2003
|
+
}));
|
|
2004
|
+
|
|
2005
|
+
return function fetchCountries() {
|
|
2006
|
+
return _ref6.apply(this, arguments);
|
|
2007
|
+
};
|
|
2008
|
+
}();
|
|
2009
|
+
|
|
2010
|
+
fetchCountries();
|
|
2011
|
+
fetchCart();
|
|
2012
|
+
}, []); // fetch cart data
|
|
1911
2013
|
|
|
1912
2014
|
var fetchCart = /*#__PURE__*/function () {
|
|
1913
|
-
var
|
|
2015
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
1914
2016
|
var res, cartInfo, _cartInfo$cart, cart;
|
|
1915
2017
|
|
|
1916
|
-
return runtime_1.wrap(function
|
|
2018
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1917
2019
|
while (1) {
|
|
1918
|
-
switch (
|
|
2020
|
+
switch (_context4.prev = _context4.next) {
|
|
1919
2021
|
case 0:
|
|
1920
|
-
|
|
1921
|
-
|
|
2022
|
+
_context4.prev = 0;
|
|
2023
|
+
_context4.next = 3;
|
|
1922
2024
|
return getCart();
|
|
1923
2025
|
|
|
1924
2026
|
case 3:
|
|
1925
|
-
res =
|
|
2027
|
+
res = _context4.sent;
|
|
1926
2028
|
setCustomHeader(res);
|
|
1927
2029
|
cartInfo = _get(res, 'data.data.attributes');
|
|
1928
2030
|
setCartInfo(cartInfo);
|
|
1929
2031
|
_cartInfo$cart = cartInfo.cart, cart = _cartInfo$cart === void 0 ? [] : _cartInfo$cart;
|
|
1930
|
-
setTicketsQuantity(getQuantity(cart))
|
|
2032
|
+
setTicketsQuantity(new Array(getQuantity(cart)).fill(null).map(function () {
|
|
2033
|
+
return nanoid.nanoid();
|
|
2034
|
+
}));
|
|
1931
2035
|
onGetCartSuccess(res.data);
|
|
1932
|
-
|
|
2036
|
+
_context4.next = 15;
|
|
1933
2037
|
break;
|
|
1934
2038
|
|
|
1935
2039
|
case 12:
|
|
1936
|
-
|
|
1937
|
-
|
|
2040
|
+
_context4.prev = 12;
|
|
2041
|
+
_context4.t0 = _context4["catch"](0);
|
|
1938
2042
|
|
|
1939
|
-
if (axios.isAxiosError(
|
|
1940
|
-
onGetCartError(
|
|
2043
|
+
if (axios.isAxiosError(_context4.t0)) {
|
|
2044
|
+
onGetCartError(_context4.t0);
|
|
1941
2045
|
}
|
|
1942
2046
|
|
|
1943
2047
|
case 15:
|
|
1944
2048
|
case "end":
|
|
1945
|
-
return
|
|
2049
|
+
return _context4.stop();
|
|
1946
2050
|
}
|
|
1947
2051
|
}
|
|
1948
|
-
},
|
|
2052
|
+
}, _callee4, null, [[0, 12]]);
|
|
1949
2053
|
}));
|
|
1950
2054
|
|
|
1951
2055
|
return function fetchCart() {
|
|
1952
|
-
return
|
|
2056
|
+
return _ref7.apply(this, arguments);
|
|
1953
2057
|
};
|
|
1954
2058
|
}(); // fetch user data
|
|
1955
2059
|
|
|
1956
2060
|
|
|
1957
2061
|
var fetchUserData = /*#__PURE__*/function () {
|
|
1958
|
-
var
|
|
2062
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(token) {
|
|
1959
2063
|
var userDataResponse, profileSpecifiedData, profileDataObj;
|
|
1960
|
-
return runtime_1.wrap(function
|
|
2064
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
1961
2065
|
while (1) {
|
|
1962
|
-
switch (
|
|
2066
|
+
switch (_context5.prev = _context5.next) {
|
|
1963
2067
|
case 0:
|
|
1964
|
-
|
|
2068
|
+
_context5.prev = 0;
|
|
1965
2069
|
|
|
1966
2070
|
if (!(typeof window !== 'undefined' && token)) {
|
|
1967
|
-
|
|
2071
|
+
_context5.next = 10;
|
|
1968
2072
|
break;
|
|
1969
2073
|
}
|
|
1970
2074
|
|
|
1971
|
-
|
|
2075
|
+
_context5.next = 4;
|
|
1972
2076
|
return getProfileData(token);
|
|
1973
2077
|
|
|
1974
2078
|
case 4:
|
|
1975
|
-
userDataResponse =
|
|
2079
|
+
userDataResponse = _context5.sent;
|
|
1976
2080
|
profileSpecifiedData = _get(userDataResponse, 'data.data');
|
|
1977
2081
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
1978
2082
|
setUserValues(profileDataObj);
|
|
@@ -1980,83 +2084,33 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1980
2084
|
onGetProfileDataSuccess(userDataResponse.data);
|
|
1981
2085
|
|
|
1982
2086
|
case 10:
|
|
1983
|
-
|
|
2087
|
+
_context5.next = 15;
|
|
1984
2088
|
break;
|
|
1985
2089
|
|
|
1986
2090
|
case 12:
|
|
1987
|
-
|
|
1988
|
-
|
|
2091
|
+
_context5.prev = 12;
|
|
2092
|
+
_context5.t0 = _context5["catch"](0);
|
|
1989
2093
|
|
|
1990
|
-
if (axios.isAxiosError(
|
|
1991
|
-
onGetProfileDataError(
|
|
2094
|
+
if (axios.isAxiosError(_context5.t0)) {
|
|
2095
|
+
onGetProfileDataError(_context5.t0);
|
|
1992
2096
|
}
|
|
1993
2097
|
|
|
1994
2098
|
case 15:
|
|
1995
2099
|
case "end":
|
|
1996
|
-
return
|
|
2100
|
+
return _context5.stop();
|
|
1997
2101
|
}
|
|
1998
2102
|
}
|
|
1999
|
-
},
|
|
2103
|
+
}, _callee5, null, [[0, 12]]);
|
|
2000
2104
|
}));
|
|
2001
2105
|
|
|
2002
2106
|
return function fetchUserData(_x) {
|
|
2003
|
-
return
|
|
2107
|
+
return _ref8.apply(this, arguments);
|
|
2004
2108
|
};
|
|
2005
2109
|
}();
|
|
2006
2110
|
|
|
2007
2111
|
React.useEffect(function () {
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
var fetchCountries = /*#__PURE__*/function () {
|
|
2012
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
2013
|
-
var res;
|
|
2014
|
-
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2015
|
-
while (1) {
|
|
2016
|
-
switch (_context4.prev = _context4.next) {
|
|
2017
|
-
case 0:
|
|
2018
|
-
_context4.prev = 0;
|
|
2019
|
-
_context4.next = 3;
|
|
2020
|
-
return getCountries();
|
|
2021
|
-
|
|
2022
|
-
case 3:
|
|
2023
|
-
res = _context4.sent;
|
|
2024
|
-
setCustomHeader(res);
|
|
2025
|
-
setCountries(_map(_get(res, 'data.data'), function (item, key) {
|
|
2026
|
-
return {
|
|
2027
|
-
label: item,
|
|
2028
|
-
value: Number(key)
|
|
2029
|
-
};
|
|
2030
|
-
}));
|
|
2031
|
-
onGetCountriesSuccess(res.data);
|
|
2032
|
-
_context4.next = 12;
|
|
2033
|
-
break;
|
|
2034
|
-
|
|
2035
|
-
case 9:
|
|
2036
|
-
_context4.prev = 9;
|
|
2037
|
-
_context4.t0 = _context4["catch"](0);
|
|
2038
|
-
|
|
2039
|
-
if (axios.isAxiosError(_context4.t0)) {
|
|
2040
|
-
onGetCountriesError(_context4.t0);
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
case 12:
|
|
2044
|
-
case "end":
|
|
2045
|
-
return _context4.stop();
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
}, _callee4, null, [[0, 9]]);
|
|
2049
|
-
}));
|
|
2050
|
-
|
|
2051
|
-
return function fetchCountries() {
|
|
2052
|
-
return _ref7.apply(this, arguments);
|
|
2053
|
-
};
|
|
2054
|
-
}();
|
|
2055
|
-
|
|
2056
|
-
if (!(countries && countries.length)) {
|
|
2057
|
-
fetchCountries();
|
|
2058
|
-
}
|
|
2059
|
-
}, [access_token, countries]);
|
|
2112
|
+
fetchUserData(access_token);
|
|
2113
|
+
}, [access_token]);
|
|
2060
2114
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement(formik.Formik, {
|
|
2061
2115
|
initialValues: getInitialValues(data, _extends({}, initialValues, {
|
|
2062
2116
|
email: emailLogged,
|
|
@@ -2067,30 +2121,30 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2067
2121
|
}), userValues),
|
|
2068
2122
|
enableReinitialize: true,
|
|
2069
2123
|
onSubmit: function () {
|
|
2070
|
-
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2124
|
+
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
|
|
2071
2125
|
var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, bodyFormData, access_token_register, resRegister, refreshToken, tokens, _e$response, _e$response$data, error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2;
|
|
2072
2126
|
|
|
2073
|
-
return runtime_1.wrap(function
|
|
2127
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2074
2128
|
while (1) {
|
|
2075
|
-
switch (
|
|
2129
|
+
switch (_context6.prev = _context6.next) {
|
|
2076
2130
|
case 0:
|
|
2077
|
-
|
|
2131
|
+
_context6.prev = 0;
|
|
2078
2132
|
|
|
2079
2133
|
if (!isLoggedIn) {
|
|
2080
|
-
|
|
2134
|
+
_context6.next = 15;
|
|
2081
2135
|
break;
|
|
2082
2136
|
}
|
|
2083
2137
|
|
|
2084
2138
|
if (!access_token) {
|
|
2085
|
-
|
|
2139
|
+
_context6.next = 9;
|
|
2086
2140
|
break;
|
|
2087
2141
|
}
|
|
2088
2142
|
|
|
2089
|
-
|
|
2143
|
+
_context6.next = 5;
|
|
2090
2144
|
return getProfileData(access_token);
|
|
2091
2145
|
|
|
2092
2146
|
case 5:
|
|
2093
|
-
updatedUserData =
|
|
2147
|
+
updatedUserData = _context6.sent;
|
|
2094
2148
|
_profileSpecifiedData = _get(updatedUserData, 'data.data');
|
|
2095
2149
|
_profileDataObj = setLoggedUserData(_profileSpecifiedData);
|
|
2096
2150
|
|
|
@@ -2099,28 +2153,28 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2099
2153
|
}
|
|
2100
2154
|
|
|
2101
2155
|
case 9:
|
|
2102
|
-
_checkoutBody = createCheckoutDataBody(ticketsQuantity, values, {
|
|
2156
|
+
_checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
2103
2157
|
emailLogged: emailLogged,
|
|
2104
2158
|
firstNameLogged: firstNameLogged,
|
|
2105
2159
|
lastNameLogged: lastNameLogged
|
|
2106
2160
|
}, showDOB);
|
|
2107
|
-
|
|
2161
|
+
_context6.next = 12;
|
|
2108
2162
|
return postOnCheckout(_checkoutBody, access_token);
|
|
2109
2163
|
|
|
2110
2164
|
case 12:
|
|
2111
|
-
_res =
|
|
2165
|
+
_res = _context6.sent;
|
|
2112
2166
|
handleSubmit(values, formikHelpers, _res);
|
|
2113
|
-
return
|
|
2167
|
+
return _context6.abrupt("return");
|
|
2114
2168
|
|
|
2115
2169
|
case 15:
|
|
2116
2170
|
bodyFormData = createRegisterFormData(values);
|
|
2117
2171
|
access_token_register = null;
|
|
2118
|
-
|
|
2119
|
-
|
|
2172
|
+
_context6.prev = 17;
|
|
2173
|
+
_context6.next = 20;
|
|
2120
2174
|
return register(bodyFormData);
|
|
2121
2175
|
|
|
2122
2176
|
case 20:
|
|
2123
|
-
resRegister =
|
|
2177
|
+
resRegister = _context6.sent;
|
|
2124
2178
|
access_token_register = _get(resRegister, 'data.data.attributes.access_token');
|
|
2125
2179
|
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
2126
2180
|
handleSetAccessToken(access_token_register);
|
|
@@ -2129,15 +2183,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2129
2183
|
refreshToken: refreshToken
|
|
2130
2184
|
};
|
|
2131
2185
|
onRegisterSuccess(tokens);
|
|
2132
|
-
|
|
2186
|
+
_context6.next = 32;
|
|
2133
2187
|
break;
|
|
2134
2188
|
|
|
2135
2189
|
case 28:
|
|
2136
|
-
|
|
2137
|
-
|
|
2190
|
+
_context6.prev = 28;
|
|
2191
|
+
_context6.t0 = _context6["catch"](17);
|
|
2138
2192
|
|
|
2139
|
-
if (axios.isAxiosError(
|
|
2140
|
-
error =
|
|
2193
|
+
if (axios.isAxiosError(_context6.t0)) {
|
|
2194
|
+
error = _context6.t0 == null ? void 0 : (_e$response = _context6.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
|
|
2141
2195
|
|
|
2142
2196
|
if (_includes(error, 'You must be aged')) {
|
|
2143
2197
|
formikHelpers.setFieldError('holderAge', error);
|
|
@@ -2153,17 +2207,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2153
2207
|
setShowModalLogin(true);
|
|
2154
2208
|
}
|
|
2155
2209
|
|
|
2156
|
-
onRegisterError(
|
|
2210
|
+
onRegisterError(_context6.t0);
|
|
2157
2211
|
}
|
|
2158
2212
|
|
|
2159
|
-
return
|
|
2213
|
+
return _context6.abrupt("return");
|
|
2160
2214
|
|
|
2161
2215
|
case 32:
|
|
2162
|
-
|
|
2216
|
+
_context6.next = 34;
|
|
2163
2217
|
return getProfileData(access_token_register);
|
|
2164
2218
|
|
|
2165
2219
|
case 34:
|
|
2166
|
-
profileData =
|
|
2220
|
+
profileData = _context6.sent;
|
|
2167
2221
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2168
2222
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
2169
2223
|
|
|
@@ -2171,26 +2225,26 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2171
2225
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
2172
2226
|
}
|
|
2173
2227
|
|
|
2174
|
-
checkoutBody = createCheckoutDataBody(ticketsQuantity, values, {
|
|
2228
|
+
checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
2175
2229
|
emailLogged: emailLogged,
|
|
2176
2230
|
firstNameLogged: firstNameLogged,
|
|
2177
2231
|
lastNameLogged: lastNameLogged
|
|
2178
2232
|
}, showDOB);
|
|
2179
|
-
|
|
2233
|
+
_context6.next = 41;
|
|
2180
2234
|
return postOnCheckout(checkoutBody, access_token_register);
|
|
2181
2235
|
|
|
2182
2236
|
case 41:
|
|
2183
|
-
res =
|
|
2237
|
+
res = _context6.sent;
|
|
2184
2238
|
handleSubmit(values, formikHelpers, res);
|
|
2185
|
-
|
|
2239
|
+
_context6.next = 48;
|
|
2186
2240
|
break;
|
|
2187
2241
|
|
|
2188
2242
|
case 45:
|
|
2189
|
-
|
|
2190
|
-
|
|
2243
|
+
_context6.prev = 45;
|
|
2244
|
+
_context6.t1 = _context6["catch"](0);
|
|
2191
2245
|
|
|
2192
|
-
if (axios.isAxiosError(
|
|
2193
|
-
if (((_e$response2 =
|
|
2246
|
+
if (axios.isAxiosError(_context6.t1)) {
|
|
2247
|
+
if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
|
|
2194
2248
|
if (typeof window !== 'undefined') {
|
|
2195
2249
|
window.localStorage.removeItem('user_data');
|
|
2196
2250
|
window.localStorage.removeItem('access_token');
|
|
@@ -2199,15 +2253,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2199
2253
|
}
|
|
2200
2254
|
}
|
|
2201
2255
|
|
|
2202
|
-
onSubmitError(
|
|
2256
|
+
onSubmitError(_context6.t1);
|
|
2203
2257
|
}
|
|
2204
2258
|
|
|
2205
2259
|
case 48:
|
|
2206
2260
|
case "end":
|
|
2207
|
-
return
|
|
2261
|
+
return _context6.stop();
|
|
2208
2262
|
}
|
|
2209
2263
|
}
|
|
2210
|
-
},
|
|
2264
|
+
}, _callee6, null, [[0, 45], [17, 28]]);
|
|
2211
2265
|
}));
|
|
2212
2266
|
|
|
2213
2267
|
function onSubmit(_x2, _x3) {
|
|
@@ -2278,6 +2332,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2278
2332
|
return false;
|
|
2279
2333
|
}
|
|
2280
2334
|
|
|
2335
|
+
if (el.name === 'brand_opt_in' && hideOptIn) {
|
|
2336
|
+
return false;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2281
2339
|
return true;
|
|
2282
2340
|
}), function (element) {
|
|
2283
2341
|
return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React__default.createElement("div", {
|
|
@@ -2293,9 +2351,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2293
2351
|
}));
|
|
2294
2352
|
})));
|
|
2295
2353
|
}));
|
|
2296
|
-
}), showTicketHolderName && React__default.createElement(
|
|
2354
|
+
}), showTicketHolderName && React__default.createElement(React__default.Fragment, null, React__default.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
|
|
2297
2355
|
return React__default.createElement("div", {
|
|
2298
|
-
key:
|
|
2356
|
+
key: _item
|
|
2299
2357
|
}, React__default.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
|
|
2300
2358
|
var groupClassname = group.groupClassname,
|
|
2301
2359
|
groupItems = group.groupItems;
|
|
@@ -2318,7 +2376,21 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2318
2376
|
}));
|
|
2319
2377
|
})));
|
|
2320
2378
|
}));
|
|
2321
|
-
})),
|
|
2379
|
+
})), conditions == null ? void 0 : conditions.map(function (checkbox) {
|
|
2380
|
+
return React__default.createElement("div", {
|
|
2381
|
+
className: 'billing-info-container__singleField',
|
|
2382
|
+
key: checkbox.id
|
|
2383
|
+
}, React__default.createElement("div", {
|
|
2384
|
+
className: "width-fc"
|
|
2385
|
+
}, React__default.createElement(formik.Field, {
|
|
2386
|
+
name: checkbox.id,
|
|
2387
|
+
label: checkbox.text,
|
|
2388
|
+
type: 'checkbox',
|
|
2389
|
+
required: true,
|
|
2390
|
+
component: CheckboxField,
|
|
2391
|
+
validate: combineValidators(requiredValidator)
|
|
2392
|
+
})));
|
|
2393
|
+
}), React__default.createElement("div", {
|
|
2322
2394
|
className: "button-container"
|
|
2323
2395
|
}, React__default.createElement(LoadingButton, {
|
|
2324
2396
|
type: "submit",
|
|
@@ -3480,7 +3552,8 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
3480
3552
|
onAddToCartSuccess({
|
|
3481
3553
|
skip_billing_page: (_result$data$data$att = result == null ? void 0 : (_result$data = result.data) == null ? void 0 : (_result$data$data = _result$data.data) == null ? void 0 : (_result$data$data$att2 = _result$data$data.attributes) == null ? void 0 : _result$data$data$att2.skip_billing_page) != null ? _result$data$data$att : false,
|
|
3482
3554
|
names_required: (_result$data$data$att3 = result == null ? void 0 : (_result$data2 = result.data) == null ? void 0 : (_result$data2$data = _result$data2.data) == null ? void 0 : (_result$data2$data$at = _result$data2$data.attributes) == null ? void 0 : _result$data2$data$at.names_required) != null ? _result$data$data$att3 : false,
|
|
3483
|
-
age_required: (_result$data$data$att4 = result == null ? void 0 : (_result$data3 = result.data) == null ? void 0 : (_result$data3$data = _result$data3.data) == null ? void 0 : (_result$data3$data$at = _result$data3$data.attributes) == null ? void 0 : _result$data3$data$at.age_required) != null ? _result$data$data$att4 : false
|
|
3555
|
+
age_required: (_result$data$data$att4 = result == null ? void 0 : (_result$data3 = result.data) == null ? void 0 : (_result$data3$data = _result$data3.data) == null ? void 0 : (_result$data3$data$at = _result$data3$data.attributes) == null ? void 0 : _result$data3$data$at.age_required) != null ? _result$data$data$att4 : false,
|
|
3556
|
+
event_id: String(eventId)
|
|
3484
3557
|
});
|
|
3485
3558
|
}
|
|
3486
3559
|
|