tf-checkout-react 1.0.74 → 1.0.78
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 -0
- package/dist/components/billing-info-container/index.d.ts +9 -3
- package/dist/components/billing-info-container/utils.d.ts +1 -0
- package/dist/components/common/FormikPhoneNumberField.d.ts +1 -1
- package/dist/components/confirmationContainer/index.d.ts +2 -1
- package/dist/components/countdown/index.d.ts +11 -0
- package/dist/components/orderDetailsContainer/ticketsTable.d.ts +13 -1
- package/dist/components/paymentContainer/index.d.ts +8 -3
- package/dist/components/stripePayment/index.d.ts +2 -1
- package/dist/components/ticketsContainer/index.d.ts +3 -1
- package/dist/components/waitingList/index.d.ts +1 -2
- package/dist/tf-checkout-react.cjs.development.js +549 -218
- 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 +541 -210
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +7 -0
- package/dist/utils/downloadPDF.d.ts +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/setConfigs.d.ts +2 -1
- package/package.json +2 -1
- package/src/api/index.ts +15 -20
- package/src/components/billing-info-container/index.tsx +39 -36
- package/src/components/billing-info-container/utils.ts +2 -1
- package/src/components/common/CheckboxField.tsx +15 -8
- package/src/components/common/CustomField.tsx +7 -0
- package/src/components/common/FormikPhoneNumberField.tsx +11 -1
- package/src/components/common/SelectField.tsx +5 -1
- package/src/components/confirmationContainer/index.tsx +59 -43
- package/src/components/countdown/index.tsx +89 -0
- package/src/components/countdown/style.css +10 -0
- package/src/components/loginModal/index.tsx +2 -0
- package/src/components/orderDetailsContainer/ticketsTable.tsx +66 -60
- package/src/components/paymentContainer/index.tsx +8 -10
- package/src/components/stripePayment/index.tsx +24 -16
- package/src/components/ticketsContainer/PromoCodeSection.tsx +3 -2
- package/src/components/ticketsContainer/TicketsSection.tsx +10 -6
- package/src/components/ticketsContainer/index.tsx +193 -42
- package/src/components/ticketsContainer/style.css +7 -0
- package/src/components/waitingList/index.tsx +3 -9
- package/src/components/waitingList/style.css +4 -2
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +51 -0
- package/src/utils/downloadPDF.tsx +22 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/setConfigs.ts +7 -2
|
@@ -7,7 +7,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var React__default = _interopDefault(React);
|
|
9
9
|
var formik = require('formik');
|
|
10
|
-
var
|
|
10
|
+
var Button = _interopDefault(require('@mui/material/Button'));
|
|
11
11
|
var _identity = _interopDefault(require('lodash/identity'));
|
|
12
12
|
var _map = _interopDefault(require('lodash/map'));
|
|
13
13
|
var _get = _interopDefault(require('lodash/get'));
|
|
@@ -21,12 +21,13 @@ var _flatMapDeep = _interopDefault(require('lodash/flatMapDeep'));
|
|
|
21
21
|
var _isArray = _interopDefault(require('lodash/isArray'));
|
|
22
22
|
var nanoid = require('nanoid');
|
|
23
23
|
var TextField = _interopDefault(require('@mui/material/TextField'));
|
|
24
|
+
var styles = require('@mui/styles');
|
|
24
25
|
var FormGroup = _interopDefault(require('@mui/material/FormGroup'));
|
|
25
26
|
var FormControlLabel = _interopDefault(require('@mui/material/FormControlLabel'));
|
|
26
27
|
var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
|
|
27
28
|
var Select = _interopDefault(require('@mui/material/Select'));
|
|
28
29
|
var MuiPhoneNumber = _interopDefault(require('material-ui-phone-number'));
|
|
29
|
-
var styles = require('@mui/material/styles');
|
|
30
|
+
var styles$1 = require('@mui/material/styles');
|
|
30
31
|
var Container = _interopDefault(require('@mui/material/Container'));
|
|
31
32
|
var CircularProgress = _interopDefault(require('@mui/material/CircularProgress'));
|
|
32
33
|
var Alert = _interopDefault(require('@mui/material/Alert'));
|
|
@@ -36,14 +37,14 @@ var reactShare = require('react-share');
|
|
|
36
37
|
var _some = _interopDefault(require('lodash/some'));
|
|
37
38
|
var _find = _interopDefault(require('lodash/find'));
|
|
38
39
|
var _isEmpty = _interopDefault(require('lodash/isEmpty'));
|
|
39
|
-
var Button = _interopDefault(require('react-bootstrap/Button'));
|
|
40
|
+
var Button$1 = _interopDefault(require('react-bootstrap/Button'));
|
|
40
41
|
var jwt_decode = _interopDefault(require('jwt-decode'));
|
|
41
42
|
var _sortBy = _interopDefault(require('lodash/sortBy'));
|
|
42
43
|
var _has = _interopDefault(require('lodash/has'));
|
|
43
44
|
var FormControl = _interopDefault(require('@mui/material/FormControl'));
|
|
44
45
|
var MenuItem = _interopDefault(require('@mui/material/MenuItem'));
|
|
45
|
-
var Button$1 = _interopDefault(require('@mui/material/Button'));
|
|
46
46
|
var SVG = _interopDefault(require('react-inlinesvg'));
|
|
47
|
+
var moment = _interopDefault(require('moment-timezone'));
|
|
47
48
|
var Table = _interopDefault(require('@mui/material/Table'));
|
|
48
49
|
var TableBody = _interopDefault(require('@mui/material/TableBody'));
|
|
49
50
|
var TableCell = _interopDefault(require('@mui/material/TableCell'));
|
|
@@ -932,6 +933,10 @@ var setConfigs = function setConfigs(configs) {
|
|
|
932
933
|
});
|
|
933
934
|
|
|
934
935
|
publicRequest.setBaseUrl(CONFIGS.BASE_URL);
|
|
936
|
+
|
|
937
|
+
if (CONFIGS.X_SOURCE_ORIGIN) {
|
|
938
|
+
setXSourceOrigin(CONFIGS.X_SOURCE_ORIGIN);
|
|
939
|
+
}
|
|
935
940
|
};
|
|
936
941
|
|
|
937
942
|
var getQueryVariable = function getQueryVariable(variable) {
|
|
@@ -990,9 +995,85 @@ var ErrorFocusInternal = /*#__PURE__*/function (_Component) {
|
|
|
990
995
|
|
|
991
996
|
var ErrorFocus = /*#__PURE__*/formik.connect(ErrorFocusInternal);
|
|
992
997
|
|
|
998
|
+
var downloadPDF = function downloadPDF(pdfUrl) {
|
|
999
|
+
if (typeof window === 'undefined') return;
|
|
1000
|
+
var accessToken = localStorage.getItem('access_token');
|
|
1001
|
+
if (!accessToken) return;
|
|
1002
|
+
fetch(pdfUrl, {
|
|
1003
|
+
headers: {
|
|
1004
|
+
Authorization: "Bearer " + accessToken
|
|
1005
|
+
}
|
|
1006
|
+
}).then( /*#__PURE__*/function () {
|
|
1007
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(response) {
|
|
1008
|
+
var blobValue;
|
|
1009
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
1010
|
+
while (1) {
|
|
1011
|
+
switch (_context.prev = _context.next) {
|
|
1012
|
+
case 0:
|
|
1013
|
+
_context.next = 2;
|
|
1014
|
+
return response.blob();
|
|
1015
|
+
|
|
1016
|
+
case 2:
|
|
1017
|
+
blobValue = _context.sent;
|
|
1018
|
+
return _context.abrupt("return", blobValue);
|
|
1019
|
+
|
|
1020
|
+
case 4:
|
|
1021
|
+
case "end":
|
|
1022
|
+
return _context.stop();
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}, _callee);
|
|
1026
|
+
}));
|
|
1027
|
+
|
|
1028
|
+
return function (_x) {
|
|
1029
|
+
return _ref.apply(this, arguments);
|
|
1030
|
+
};
|
|
1031
|
+
}()).then(function (blobValue) {
|
|
1032
|
+
var file = new Blob([blobValue], {
|
|
1033
|
+
type: 'application/pdf'
|
|
1034
|
+
});
|
|
1035
|
+
var fileURL = URL.createObjectURL(file);
|
|
1036
|
+
window.open(fileURL);
|
|
1037
|
+
});
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWithDefaultHolder(ticketsQuantity, logedInValues) {
|
|
1041
|
+
var ticket_holders = [];
|
|
1042
|
+
var first_name = _get(logedInValues, 'firstName') || _get(logedInValues, 'first_name') || '';
|
|
1043
|
+
var last_name = _get(logedInValues, 'lastName', '') || _get(logedInValues, 'last_name') || '';
|
|
1044
|
+
|
|
1045
|
+
var phone = _get(logedInValues, 'phone', '');
|
|
1046
|
+
|
|
1047
|
+
var email = _get(logedInValues, 'email', '');
|
|
1048
|
+
|
|
1049
|
+
for (var i = 0; i <= ticketsQuantity - 1; i++) {
|
|
1050
|
+
var individualHolder = i ? {
|
|
1051
|
+
first_name: '',
|
|
1052
|
+
last_name: '',
|
|
1053
|
+
phone: '',
|
|
1054
|
+
email: ''
|
|
1055
|
+
} : {
|
|
1056
|
+
first_name: first_name,
|
|
1057
|
+
last_name: last_name,
|
|
1058
|
+
phone: phone,
|
|
1059
|
+
email: email
|
|
1060
|
+
};
|
|
1061
|
+
ticket_holders.push(individualHolder);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
var body = {
|
|
1065
|
+
attributes: _extends({}, logedInValues, {
|
|
1066
|
+
email: email,
|
|
1067
|
+
confirm_email: email,
|
|
1068
|
+
first_name: first_name,
|
|
1069
|
+
last_name: last_name,
|
|
1070
|
+
ticket_holders: ticket_holders
|
|
1071
|
+
})
|
|
1072
|
+
};
|
|
1073
|
+
return body;
|
|
1074
|
+
};
|
|
1075
|
+
|
|
993
1076
|
var isWindowDefined = typeof window !== 'undefined';
|
|
994
|
-
var discardedOrigins = ['http://localhost', 'gtsb.io', 'gatsbyjs.io', 'https://www.houseofx.nyc', 'https://tickets-staging.houseofx.nyc'];
|
|
995
|
-
var origin = isWindowDefined && window.location.origin;
|
|
996
1077
|
var ttfHeaders = {
|
|
997
1078
|
Accept: 'application/vnd.api+json',
|
|
998
1079
|
'Content-Type': 'application/vnd.api+json'
|
|
@@ -1002,12 +1083,6 @@ if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
|
|
|
1002
1083
|
ttfHeaders['Authorization-Guest'] = /*#__PURE__*/localStorage.getItem('auth_guest_token');
|
|
1003
1084
|
}
|
|
1004
1085
|
|
|
1005
|
-
if (isWindowDefined && !discardedOrigins.some(function (el) {
|
|
1006
|
-
return origin && origin.includes(el);
|
|
1007
|
-
})) {
|
|
1008
|
-
ttfHeaders['X-Source-Origin'] = 'houseofx.nyc';
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
1086
|
var publicRequest = /*#__PURE__*/axios.create({
|
|
1012
1087
|
baseURL: CONFIGS.BASE_URL || "https://www.ticketfairy.com/api",
|
|
1013
1088
|
headers: ttfHeaders
|
|
@@ -1050,11 +1125,9 @@ publicRequest.interceptors.request.use(function (config) {
|
|
|
1050
1125
|
config.headers = _updatedHeaders;
|
|
1051
1126
|
}
|
|
1052
1127
|
|
|
1053
|
-
if (
|
|
1054
|
-
return origin && origin.includes(el);
|
|
1055
|
-
})) {
|
|
1128
|
+
if (CONFIGS.X_SOURCE_ORIGIN) {
|
|
1056
1129
|
var _updatedHeaders2 = _extends({}, config.headers, {
|
|
1057
|
-
'X-Source-Origin':
|
|
1130
|
+
'X-Source-Origin': CONFIGS.X_SOURCE_ORIGIN
|
|
1058
1131
|
});
|
|
1059
1132
|
|
|
1060
1133
|
config.headers = _updatedHeaders2;
|
|
@@ -1079,6 +1152,9 @@ publicRequest.setAccessToken = function (token) {
|
|
|
1079
1152
|
return publicRequest.defaults.headers.common.Authorization = token;
|
|
1080
1153
|
};
|
|
1081
1154
|
|
|
1155
|
+
var setXSourceOrigin = function setXSourceOrigin(sourceOrigin) {
|
|
1156
|
+
ttfHeaders['X-Source-Origin'] = sourceOrigin;
|
|
1157
|
+
};
|
|
1082
1158
|
var setCustomHeader = function setCustomHeader(response) {
|
|
1083
1159
|
var guestHeaderResponseValue = _get(response, 'headers.authorization-guest');
|
|
1084
1160
|
|
|
@@ -1101,6 +1177,14 @@ var handleSetAccessToken = function handleSetAccessToken(token) {
|
|
|
1101
1177
|
}
|
|
1102
1178
|
}
|
|
1103
1179
|
};
|
|
1180
|
+
function getEvent(id) {
|
|
1181
|
+
var response = publicRequest.get("v1/event/" + id, {
|
|
1182
|
+
headers: ttfHeaders
|
|
1183
|
+
})["catch"](function (error) {
|
|
1184
|
+
throw error;
|
|
1185
|
+
});
|
|
1186
|
+
return response;
|
|
1187
|
+
}
|
|
1104
1188
|
function getTickets(id, promoCode) {
|
|
1105
1189
|
var response = publicRequest.get("v1/event/" + id + "/tickets/", {
|
|
1106
1190
|
headers: promoCode ? _extends({}, ttfHeaders, {
|
|
@@ -1236,7 +1320,7 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1236
1320
|
},
|
|
1237
1321
|
onSubmit: function () {
|
|
1238
1322
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
|
|
1239
|
-
var email, password, bodyFormData, resAutorize, bodyFormDataToken, resAccessToken, accessToken, profileResponse, profileSpecifiedData, profileDataObj, _e$response, _e$response$data, _error;
|
|
1323
|
+
var email, password, bodyFormData, resAutorize, bodyFormDataToken, resAccessToken, accessToken, profileResponse, profileSpecifiedData, profileDataObj, event, _e$response, _e$response$data, _error;
|
|
1240
1324
|
|
|
1241
1325
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1242
1326
|
while (1) {
|
|
@@ -1315,6 +1399,8 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1315
1399
|
if (typeof window !== 'undefined') {
|
|
1316
1400
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
1317
1401
|
window.localStorage.setItem('access_token', accessToken);
|
|
1402
|
+
event = new window.CustomEvent('tf-login');
|
|
1403
|
+
window.document.dispatchEvent(event);
|
|
1318
1404
|
}
|
|
1319
1405
|
|
|
1320
1406
|
onLogin();
|
|
@@ -1661,7 +1747,7 @@ var setLoggedUserData = function setLoggedUserData(data) {
|
|
|
1661
1747
|
country: (data == null ? void 0 : data.country) || '',
|
|
1662
1748
|
phone: (data == null ? void 0 : data.phone) || '',
|
|
1663
1749
|
street_address: (data == null ? void 0 : data.streetAddress) || '',
|
|
1664
|
-
state: (data == null ? void 0 : data.
|
|
1750
|
+
state: (data == null ? void 0 : data.stateId) || '',
|
|
1665
1751
|
zip: (data == null ? void 0 : data.zip) || (data == null ? void 0 : data.zipCode) || ''
|
|
1666
1752
|
};
|
|
1667
1753
|
};
|
|
@@ -1787,6 +1873,7 @@ var CustomField = function CustomField(_ref) {
|
|
|
1787
1873
|
var error = _get(errors, field.name);
|
|
1788
1874
|
|
|
1789
1875
|
var isTouched = Boolean(_get(touched, field.name)) || _includes(field.name, 'holder') && !!error && !!submitCount;
|
|
1876
|
+
var customTheme = styles.useTheme();
|
|
1790
1877
|
return React__default.createElement(TextField, Object.assign({
|
|
1791
1878
|
id: field.name,
|
|
1792
1879
|
label: label,
|
|
@@ -1801,6 +1888,12 @@ var CustomField = function CustomField(_ref) {
|
|
|
1801
1888
|
MenuProps: {
|
|
1802
1889
|
className: theme
|
|
1803
1890
|
}
|
|
1891
|
+
},
|
|
1892
|
+
InputLabelProps: {
|
|
1893
|
+
sx: customTheme == null ? void 0 : customTheme.input
|
|
1894
|
+
},
|
|
1895
|
+
inputProps: {
|
|
1896
|
+
sx: customTheme == null ? void 0 : customTheme.input
|
|
1804
1897
|
}
|
|
1805
1898
|
}, field), isSelectField ? _map(selectOptions, function (option) {
|
|
1806
1899
|
return React__default.createElement("option", {
|
|
@@ -1817,9 +1910,13 @@ var CheckboxField = function CheckboxField(_ref) {
|
|
|
1817
1910
|
field = _ref.field,
|
|
1818
1911
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1819
1912
|
|
|
1913
|
+
var customTheme = styles.useTheme();
|
|
1820
1914
|
return React__default.createElement(FormGroup, null, React__default.createElement(FormControlLabel, {
|
|
1821
1915
|
control: React__default.createElement(Checkbox, Object.assign({}, field, rest)),
|
|
1822
|
-
label: label
|
|
1916
|
+
label: label,
|
|
1917
|
+
componentsProps: {
|
|
1918
|
+
typography: customTheme == null ? void 0 : customTheme.checkbox
|
|
1919
|
+
}
|
|
1823
1920
|
}));
|
|
1824
1921
|
};
|
|
1825
1922
|
|
|
@@ -1838,9 +1935,11 @@ var SelectField = function SelectField(_ref) {
|
|
|
1838
1935
|
|
|
1839
1936
|
var error = _get(errors, field.name);
|
|
1840
1937
|
|
|
1938
|
+
var customTheme = styles.useTheme();
|
|
1841
1939
|
return React__default.createElement(material.FormControl, {
|
|
1842
1940
|
fullWidth: true
|
|
1843
1941
|
}, React__default.createElement(material.InputLabel, {
|
|
1942
|
+
style: customTheme == null ? void 0 : customTheme.input,
|
|
1844
1943
|
htmlFor: field.name,
|
|
1845
1944
|
error: !!error && isTouched,
|
|
1846
1945
|
shrink: true
|
|
@@ -1858,7 +1957,9 @@ var SelectField = function SelectField(_ref) {
|
|
|
1858
1957
|
MenuProps: {
|
|
1859
1958
|
className: theme
|
|
1860
1959
|
}
|
|
1861
|
-
}, field
|
|
1960
|
+
}, field, {
|
|
1961
|
+
style: customTheme == null ? void 0 : customTheme.input
|
|
1962
|
+
}), _map(selectOptions, function (option) {
|
|
1862
1963
|
return React__default.createElement("option", {
|
|
1863
1964
|
key: option.value,
|
|
1864
1965
|
value: option.value,
|
|
@@ -1950,14 +2051,17 @@ var FormikPhoneNumberField = function FormikPhoneNumberField(_ref) {
|
|
|
1950
2051
|
_ref$form = _ref.form,
|
|
1951
2052
|
touched = _ref$form.touched,
|
|
1952
2053
|
errors = _ref$form.errors,
|
|
2054
|
+
initialValues = _ref$form.initialValues,
|
|
1953
2055
|
setFieldValue = _ref.setFieldValue,
|
|
1954
2056
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
1955
2057
|
|
|
1956
2058
|
var error = _get(errors, field.name);
|
|
1957
2059
|
|
|
1958
2060
|
var isTouched = Boolean(_get(touched, field.name));
|
|
2061
|
+
var customTheme = styles.useTheme();
|
|
1959
2062
|
return React__default.createElement(MuiPhoneNumber, Object.assign({
|
|
1960
2063
|
name: 'phone',
|
|
2064
|
+
value: initialValues.phone,
|
|
1961
2065
|
onChange: function onChange(e) {
|
|
1962
2066
|
return setFieldValue("phone", removePlusSign(e));
|
|
1963
2067
|
},
|
|
@@ -1968,6 +2072,12 @@ var FormikPhoneNumberField = function FormikPhoneNumberField(_ref) {
|
|
|
1968
2072
|
error: !!error && isTouched,
|
|
1969
2073
|
helperText: isTouched && error,
|
|
1970
2074
|
fullWidth: true,
|
|
2075
|
+
InputLabelProps: {
|
|
2076
|
+
sx: customTheme == null ? void 0 : customTheme.input
|
|
2077
|
+
},
|
|
2078
|
+
InputProps: {
|
|
2079
|
+
sx: customTheme == null ? void 0 : customTheme.input
|
|
2080
|
+
},
|
|
1971
2081
|
autoFormat: false
|
|
1972
2082
|
}, rest));
|
|
1973
2083
|
};
|
|
@@ -1980,10 +2090,11 @@ var LogicRunner = function LogicRunner(_ref) {
|
|
|
1980
2090
|
setUserValues = _ref.setUserValues,
|
|
1981
2091
|
onGetStatesSuccess = _ref.onGetStatesSuccess,
|
|
1982
2092
|
onGetStatesError = _ref.onGetStatesError;
|
|
2093
|
+
var prevCountry = React.useRef(values.country);
|
|
1983
2094
|
React.useEffect(function () {
|
|
1984
2095
|
var fetchStates = /*#__PURE__*/function () {
|
|
1985
2096
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1986
|
-
var _mappedStates$0$value, _mappedStates
|
|
2097
|
+
var res, mappedStates, _mappedStates$0$value, _mappedStates$;
|
|
1987
2098
|
|
|
1988
2099
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1989
2100
|
while (1) {
|
|
@@ -2002,7 +2113,12 @@ var LogicRunner = function LogicRunner(_ref) {
|
|
|
2002
2113
|
};
|
|
2003
2114
|
});
|
|
2004
2115
|
setStates(mappedStates);
|
|
2005
|
-
|
|
2116
|
+
|
|
2117
|
+
if (prevCountry.current !== values.country) {
|
|
2118
|
+
setFieldValue('state', (_mappedStates$0$value = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.value) != null ? _mappedStates$0$value : '');
|
|
2119
|
+
prevCountry.current = values.country;
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2006
2122
|
onGetStatesSuccess(res.data);
|
|
2007
2123
|
_context.next = 13;
|
|
2008
2124
|
break;
|
|
@@ -2040,13 +2156,13 @@ var LogicRunner = function LogicRunner(_ref) {
|
|
|
2040
2156
|
var parsedData = JSON.parse(userDataEncoded);
|
|
2041
2157
|
var mappedValues = {
|
|
2042
2158
|
firstName: (parsedData == null ? void 0 : parsedData.first_name) || '',
|
|
2043
|
-
lastName: parsedData == null ? void 0 : parsedData.last_name,
|
|
2159
|
+
lastName: (parsedData == null ? void 0 : parsedData.last_name) || '',
|
|
2044
2160
|
email: (parsedData == null ? void 0 : parsedData.email) || '',
|
|
2045
2161
|
phone: (parsedData == null ? void 0 : parsedData.phone) || '',
|
|
2046
2162
|
confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
|
|
2047
2163
|
state: (parsedData == null ? void 0 : parsedData.state) || '',
|
|
2048
2164
|
street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
|
|
2049
|
-
country: (parsedData == null ? void 0 : parsedData.country) || 1,
|
|
2165
|
+
country: (parsedData == null ? void 0 : parsedData.country) || "1",
|
|
2050
2166
|
zip: (parsedData == null ? void 0 : parsedData.zip) || '',
|
|
2051
2167
|
brand_opt_in: (parsedData == null ? void 0 : parsedData.brand_opt_in) || '',
|
|
2052
2168
|
city: (parsedData == null ? void 0 : parsedData.city) || '',
|
|
@@ -2110,21 +2226,16 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2110
2226
|
onAuthorizeSuccess = _ref3$onAuthorizeSucc === void 0 ? function () {} : _ref3$onAuthorizeSucc,
|
|
2111
2227
|
_ref3$onAuthorizeErro = _ref3.onAuthorizeError,
|
|
2112
2228
|
onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? function () {} : _ref3$onAuthorizeErro,
|
|
2113
|
-
|
|
2114
|
-
onLogin = _ref3$onLogin === void 0 ? function () {} : _ref3$onLogin,
|
|
2229
|
+
onLogin = _ref3.onLogin,
|
|
2115
2230
|
_ref3$onLoginSuccess = _ref3.onLoginSuccess,
|
|
2116
2231
|
onLoginSuccess = _ref3$onLoginSuccess === void 0 ? function () {} : _ref3$onLoginSuccess,
|
|
2117
2232
|
_ref3$isLoggedIn = _ref3.isLoggedIn,
|
|
2118
2233
|
pIsLoggedIn = _ref3$isLoggedIn === void 0 ? false : _ref3$isLoggedIn,
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
fontFamily: fontFamily
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
});
|
|
2234
|
+
_ref3$accountInfoTitl = _ref3.accountInfoTitle,
|
|
2235
|
+
accountInfoTitle = _ref3$accountInfoTitl === void 0 ? '' : _ref3$accountInfoTitl,
|
|
2236
|
+
hideLogo = _ref3.hideLogo,
|
|
2237
|
+
themeOptions = _ref3.themeOptions;
|
|
2238
|
+
var themeMui = styles$1.createTheme(themeOptions);
|
|
2128
2239
|
var isWindowDefined = typeof window !== 'undefined';
|
|
2129
2240
|
var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
2130
2241
|
var access_token = isWindowDefined && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
|
|
@@ -2250,7 +2361,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2250
2361
|
setCountries(_map(_get(res, 'data.data'), function (item, key) {
|
|
2251
2362
|
return {
|
|
2252
2363
|
label: item,
|
|
2253
|
-
value:
|
|
2364
|
+
value: key
|
|
2254
2365
|
};
|
|
2255
2366
|
}));
|
|
2256
2367
|
onGetCountriesSuccess(res.data);
|
|
@@ -2350,7 +2461,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2350
2461
|
userDataResponse = _context4.sent;
|
|
2351
2462
|
profileSpecifiedData = _get(userDataResponse, 'data.data');
|
|
2352
2463
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
2353
|
-
setUserValues(profileDataObj
|
|
2464
|
+
setUserValues(_extends({}, profileDataObj, {
|
|
2465
|
+
firstName: profileDataObj.first_name,
|
|
2466
|
+
lastName: profileDataObj.last_name
|
|
2467
|
+
}));
|
|
2354
2468
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
2355
2469
|
onGetProfileDataSuccess(userDataResponse.data);
|
|
2356
2470
|
|
|
@@ -2382,13 +2496,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2382
2496
|
React.useEffect(function () {
|
|
2383
2497
|
fetchUserData(access_token);
|
|
2384
2498
|
}, [access_token]);
|
|
2385
|
-
return React__default.createElement(styles.ThemeProvider, {
|
|
2499
|
+
return React__default.createElement(styles$1.ThemeProvider, {
|
|
2386
2500
|
theme: themeMui
|
|
2387
2501
|
}, React__default.createElement(formik.Formik, {
|
|
2388
2502
|
initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
country: 1,
|
|
2503
|
+
country: _get(userData, 'country', '') || "1",
|
|
2504
|
+
state: _get(userData, 'state', '') || "1",
|
|
2392
2505
|
brand_opt_in: optedInFieldValue
|
|
2393
2506
|
}), userValues),
|
|
2394
2507
|
enableReinitialize: true,
|
|
@@ -2479,12 +2592,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2479
2592
|
formikHelpers.setFieldError('confirmPassword', error.password);
|
|
2480
2593
|
}
|
|
2481
2594
|
|
|
2482
|
-
if (error != null && error.email) {
|
|
2595
|
+
if (error != null && error.email && !onLogin) {
|
|
2596
|
+
// False will stand for outside controll
|
|
2483
2597
|
setAlreadyHasUser(true);
|
|
2484
2598
|
setShowModalLogin(true);
|
|
2485
2599
|
}
|
|
2486
2600
|
|
|
2487
|
-
onRegisterError(_context5.t0);
|
|
2601
|
+
onRegisterError(_context5.t0, values.email);
|
|
2488
2602
|
}
|
|
2489
2603
|
|
|
2490
2604
|
return _context5.abrupt("return");
|
|
@@ -2562,14 +2676,18 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2562
2676
|
className: "billing-info-container " + theme
|
|
2563
2677
|
}, !isLoggedIn && React__default.createElement("div", {
|
|
2564
2678
|
className: "account-actions-block"
|
|
2565
|
-
}, React__default.createElement("div", null,
|
|
2679
|
+
}, React__default.createElement("div", null, accountInfoTitle), React__default.createElement("div", null, "Login & skip ahead:"), React__default.createElement("div", {
|
|
2566
2680
|
className: "login-block"
|
|
2567
2681
|
}, React__default.createElement("button", {
|
|
2568
2682
|
className: "login-register-button",
|
|
2569
2683
|
type: "button",
|
|
2570
2684
|
onClick: function onClick() {
|
|
2571
|
-
|
|
2572
|
-
|
|
2685
|
+
// If outside login needed to skip package login functionallity
|
|
2686
|
+
if (onLogin) {
|
|
2687
|
+
onLogin();
|
|
2688
|
+
} else {
|
|
2689
|
+
setShowModalLogin(true);
|
|
2690
|
+
}
|
|
2573
2691
|
}
|
|
2574
2692
|
}, "Login"), !hideLogo && React__default.createElement("div", {
|
|
2575
2693
|
className: "logo-image-container"
|
|
@@ -2647,17 +2765,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2647
2765
|
}));
|
|
2648
2766
|
})), React__default.createElement("div", {
|
|
2649
2767
|
className: "button-container"
|
|
2650
|
-
}, React__default.createElement(
|
|
2768
|
+
}, React__default.createElement(Button, {
|
|
2651
2769
|
type: "submit",
|
|
2652
2770
|
variant: "contained",
|
|
2653
2771
|
className: "login-register-button",
|
|
2654
|
-
loadingIndicator: React__default.createElement(material.CircularProgress, {
|
|
2655
|
-
color: "inherit",
|
|
2656
|
-
size: 26
|
|
2657
|
-
}),
|
|
2658
|
-
loading: props.isSubmitting,
|
|
2659
2772
|
disabled: props.isSubmitting
|
|
2660
|
-
},
|
|
2773
|
+
}, props.isSubmitting ? React__default.createElement(material.CircularProgress, {
|
|
2774
|
+
size: 26
|
|
2775
|
+
}) : buttonName))));
|
|
2661
2776
|
}), showModalLogin && React__default.createElement(LoginModal, {
|
|
2662
2777
|
onClose: function onClose() {
|
|
2663
2778
|
setShowModalLogin(false);
|
|
@@ -2721,7 +2836,8 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2721
2836
|
_ref$handleSetLoading = _ref.handleSetLoading,
|
|
2722
2837
|
handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading,
|
|
2723
2838
|
_ref$conditions = _ref.conditions,
|
|
2724
|
-
conditions = _ref$conditions === void 0 ? [] : _ref$conditions
|
|
2839
|
+
conditions = _ref$conditions === void 0 ? [] : _ref$conditions,
|
|
2840
|
+
disableZipSection = _ref.disableZipSection;
|
|
2725
2841
|
var stripe = reactStripeJs.useStripe();
|
|
2726
2842
|
var elements = reactStripeJs.useElements();
|
|
2727
2843
|
|
|
@@ -2753,7 +2869,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2753
2869
|
_context.prev = 1;
|
|
2754
2870
|
event.preventDefault();
|
|
2755
2871
|
|
|
2756
|
-
if (postalCode) {
|
|
2872
|
+
if (!(!postalCode && !disableZipSection)) {
|
|
2757
2873
|
_context.next = 7;
|
|
2758
2874
|
break;
|
|
2759
2875
|
}
|
|
@@ -2778,10 +2894,14 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2778
2894
|
address = {
|
|
2779
2895
|
city: billing_info.city,
|
|
2780
2896
|
line1: billing_info.street_address,
|
|
2781
|
-
state: billing_info.state
|
|
2782
|
-
postal_code: postalCode
|
|
2897
|
+
state: billing_info.state
|
|
2783
2898
|
};
|
|
2784
|
-
|
|
2899
|
+
|
|
2900
|
+
if (!disableZipSection) {
|
|
2901
|
+
address.postal_code = postalCode;
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
_context.next = 15;
|
|
2785
2905
|
return stripe.createPaymentMethod({
|
|
2786
2906
|
type: 'card',
|
|
2787
2907
|
card: card || {
|
|
@@ -2792,11 +2912,11 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2792
2912
|
}
|
|
2793
2913
|
});
|
|
2794
2914
|
|
|
2795
|
-
case
|
|
2915
|
+
case 15:
|
|
2796
2916
|
paymentMethodReq = _context.sent;
|
|
2797
2917
|
|
|
2798
2918
|
if (!paymentMethodReq.error) {
|
|
2799
|
-
_context.next =
|
|
2919
|
+
_context.next = 20;
|
|
2800
2920
|
break;
|
|
2801
2921
|
}
|
|
2802
2922
|
|
|
@@ -2804,18 +2924,18 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2804
2924
|
handleSetLoading(false);
|
|
2805
2925
|
return _context.abrupt("return");
|
|
2806
2926
|
|
|
2807
|
-
case
|
|
2808
|
-
_context.next =
|
|
2927
|
+
case 20:
|
|
2928
|
+
_context.next = 22;
|
|
2809
2929
|
return stripe.confirmCardPayment(stripe_client_secret, {
|
|
2810
2930
|
payment_method: paymentMethodReq.paymentMethod.id
|
|
2811
2931
|
});
|
|
2812
2932
|
|
|
2813
|
-
case
|
|
2933
|
+
case 22:
|
|
2814
2934
|
_yield$stripe$confirm = _context.sent;
|
|
2815
2935
|
_error = _yield$stripe$confirm.error;
|
|
2816
2936
|
|
|
2817
2937
|
if (!_error) {
|
|
2818
|
-
_context.next =
|
|
2938
|
+
_context.next = 28;
|
|
2819
2939
|
break;
|
|
2820
2940
|
}
|
|
2821
2941
|
|
|
@@ -2823,22 +2943,22 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2823
2943
|
handleSetLoading(false);
|
|
2824
2944
|
return _context.abrupt("return");
|
|
2825
2945
|
|
|
2826
|
-
case
|
|
2946
|
+
case 28:
|
|
2827
2947
|
onSubmit(null);
|
|
2828
|
-
_context.next =
|
|
2948
|
+
_context.next = 34;
|
|
2829
2949
|
break;
|
|
2830
2950
|
|
|
2831
|
-
case
|
|
2832
|
-
_context.prev =
|
|
2951
|
+
case 31:
|
|
2952
|
+
_context.prev = 31;
|
|
2833
2953
|
_context.t0 = _context["catch"](1);
|
|
2834
2954
|
onSubmit(_context.t0);
|
|
2835
2955
|
|
|
2836
|
-
case
|
|
2956
|
+
case 34:
|
|
2837
2957
|
case "end":
|
|
2838
2958
|
return _context.stop();
|
|
2839
2959
|
}
|
|
2840
2960
|
}
|
|
2841
|
-
}, _callee, null, [[1,
|
|
2961
|
+
}, _callee, null, [[1, 31]]);
|
|
2842
2962
|
}));
|
|
2843
2963
|
|
|
2844
2964
|
return function handleSubmit(_x) {
|
|
@@ -2899,7 +3019,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2899
3019
|
}, React__default.createElement("span", {
|
|
2900
3020
|
className: "card_label_text"
|
|
2901
3021
|
}, "Card number"), React__default.createElement(reactStripeJs.CardNumberElement, {
|
|
2902
|
-
options: _extends({}, options, stripeCardOptions),
|
|
3022
|
+
options: _extends({}, options.style, stripeCardOptions),
|
|
2903
3023
|
onReady: _identity,
|
|
2904
3024
|
onChange: _identity,
|
|
2905
3025
|
onBlur: _identity,
|
|
@@ -2909,14 +3029,14 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2909
3029
|
}, React__default.createElement("span", {
|
|
2910
3030
|
className: "card_label_text"
|
|
2911
3031
|
}, "Expiration date"), React__default.createElement(reactStripeJs.CardExpiryElement, {
|
|
2912
|
-
options: _extends({}, options, stripeCardOptions)
|
|
3032
|
+
options: _extends({}, options.style, stripeCardOptions)
|
|
2913
3033
|
})), React__default.createElement("label", {
|
|
2914
3034
|
className: "cvc_element"
|
|
2915
3035
|
}, React__default.createElement("span", {
|
|
2916
3036
|
className: "card_label_text"
|
|
2917
3037
|
}, "CVC"), React__default.createElement(reactStripeJs.CardCvcElement, {
|
|
2918
|
-
options: _extends({}, options, stripeCardOptions)
|
|
2919
|
-
})), React__default.createElement("label", {
|
|
3038
|
+
options: _extends({}, options.style, stripeCardOptions)
|
|
3039
|
+
})), !disableZipSection && React__default.createElement("label", {
|
|
2920
3040
|
className: "zip_element"
|
|
2921
3041
|
}, React__default.createElement("p", {
|
|
2922
3042
|
className: "card_label_text"
|
|
@@ -2943,7 +3063,9 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2943
3063
|
}, React__default.createElement("button", {
|
|
2944
3064
|
disabled: buttonIsDiabled,
|
|
2945
3065
|
type: "submit"
|
|
2946
|
-
}, isLoading ? React__default.createElement(CircularProgress,
|
|
3066
|
+
}, isLoading ? React__default.createElement(CircularProgress, {
|
|
3067
|
+
size: 26
|
|
3068
|
+
}) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
|
|
2947
3069
|
};
|
|
2948
3070
|
|
|
2949
3071
|
var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
|
|
@@ -3003,7 +3125,9 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3003
3125
|
onPaymentError = _ref$onPaymentError === void 0 ? function () {} : _ref$onPaymentError,
|
|
3004
3126
|
_ref$stripeCardOption = _ref.stripeCardOptions,
|
|
3005
3127
|
stripeCardOptions = _ref$stripeCardOption === void 0 ? {} : _ref$stripeCardOption,
|
|
3006
|
-
|
|
3128
|
+
_ref$disableZipSectio = _ref.disableZipSection,
|
|
3129
|
+
disableZipSection = _ref$disableZipSectio === void 0 ? false : _ref$disableZipSectio,
|
|
3130
|
+
themeOptions = _ref.themeOptions;
|
|
3007
3131
|
|
|
3008
3132
|
var _useState = React.useState(initialReviewValues),
|
|
3009
3133
|
reviewData = _useState[0],
|
|
@@ -3187,14 +3311,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3187
3311
|
};
|
|
3188
3312
|
}();
|
|
3189
3313
|
|
|
3190
|
-
var themeMui = styles.createTheme(
|
|
3191
|
-
|
|
3192
|
-
allVariants: {
|
|
3193
|
-
fontFamily: fontFamily
|
|
3194
|
-
}
|
|
3195
|
-
}
|
|
3196
|
-
});
|
|
3197
|
-
return React__default.createElement(styles.ThemeProvider, {
|
|
3314
|
+
var themeMui = styles$1.createTheme(themeOptions);
|
|
3315
|
+
return React__default.createElement(styles$1.ThemeProvider, {
|
|
3198
3316
|
theme: themeMui
|
|
3199
3317
|
}, React__default.createElement("div", {
|
|
3200
3318
|
className: "payment_page"
|
|
@@ -3243,7 +3361,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3243
3361
|
return setPaymentIsLoading(value);
|
|
3244
3362
|
},
|
|
3245
3363
|
conditions: conditions,
|
|
3246
|
-
stripeCardOptions: stripeCardOptions
|
|
3364
|
+
stripeCardOptions: stripeCardOptions,
|
|
3365
|
+
disableZipSection: disableZipSection
|
|
3247
3366
|
})))))));
|
|
3248
3367
|
};
|
|
3249
3368
|
|
|
@@ -3417,7 +3536,8 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
|
|
|
3417
3536
|
_ref$onGetConfirmatio = _ref.onGetConfirmationDataSuccess,
|
|
3418
3537
|
onGetConfirmationDataSuccess = _ref$onGetConfirmatio === void 0 ? function () {} : _ref$onGetConfirmatio,
|
|
3419
3538
|
_ref$onGetConfirmatio2 = _ref.onGetConfirmationDataError,
|
|
3420
|
-
onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2
|
|
3539
|
+
onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2,
|
|
3540
|
+
orderHash = _ref.orderHash;
|
|
3421
3541
|
var inputRef = React.useRef(null);
|
|
3422
3542
|
|
|
3423
3543
|
var _useState = React.useState(null),
|
|
@@ -3433,15 +3553,17 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
|
|
|
3433
3553
|
while (1) {
|
|
3434
3554
|
switch (_context.prev = _context.next) {
|
|
3435
3555
|
case 0:
|
|
3436
|
-
dataEncoded = typeof window !== 'undefined' && window.localStorage.getItem('checkoutData');
|
|
3556
|
+
dataEncoded = typeof window !== 'undefined' && window.localStorage.getItem('checkoutData') || '';
|
|
3557
|
+
dataDecoded = dataEncoded ? JSON.parse(dataEncoded) : {
|
|
3558
|
+
hash: orderHash
|
|
3559
|
+
};
|
|
3560
|
+
hash = dataDecoded.hash;
|
|
3437
3561
|
|
|
3438
|
-
if (!
|
|
3562
|
+
if (!hash) {
|
|
3439
3563
|
_context.next = 18;
|
|
3440
3564
|
break;
|
|
3441
3565
|
}
|
|
3442
3566
|
|
|
3443
|
-
dataDecoded = JSON.parse(dataEncoded);
|
|
3444
|
-
hash = dataDecoded.hash;
|
|
3445
3567
|
_context.prev = 4;
|
|
3446
3568
|
_context.next = 7;
|
|
3447
3569
|
return getConfirmationData(hash);
|
|
@@ -3551,13 +3673,13 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
|
|
|
3551
3673
|
value: data.personal_share_link,
|
|
3552
3674
|
onChange: onChangeShareLink
|
|
3553
3675
|
}), React__default.createElement("div", {
|
|
3554
|
-
className:
|
|
3676
|
+
className: "share-by-link-copy-icon",
|
|
3555
3677
|
onClick: function onClick() {
|
|
3556
3678
|
return navigator.clipboard.writeText(_get(inputRef, 'current.value'));
|
|
3557
3679
|
}
|
|
3558
3680
|
}, React__default.createElement("img", {
|
|
3559
3681
|
src: "https://img.icons8.com/office/50/000000/copy.png",
|
|
3560
|
-
alt:
|
|
3682
|
+
alt: "copy"
|
|
3561
3683
|
})))), (showDefaultShareButtons || !!shareButtons.length) && React__default.createElement(SocialButtons, {
|
|
3562
3684
|
showDefaultShareButtons: showDefaultShareButtons,
|
|
3563
3685
|
name: data.product_name,
|
|
@@ -3571,7 +3693,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
|
|
|
3571
3693
|
}, "How much cheaper?"), _map(data.personal_share_sales, function (pricing, index) {
|
|
3572
3694
|
return React__default.createElement("div", {
|
|
3573
3695
|
key: index,
|
|
3574
|
-
className:
|
|
3696
|
+
className: "pricing-section_wrapper"
|
|
3575
3697
|
}, React__default.createElement("div", {
|
|
3576
3698
|
className: "pricing-section_label"
|
|
3577
3699
|
}, pricing.label, pricing.subLabel && React__default.createElement("div", {
|
|
@@ -3709,12 +3831,14 @@ var TicketsSection = function TicketsSection(_ref) {
|
|
|
3709
3831
|
style: {
|
|
3710
3832
|
minWidth: 55
|
|
3711
3833
|
}
|
|
3712
|
-
}, React__default.createElement(TicketRow, {
|
|
3834
|
+
}, ticket.salesStarted ? React__default.createElement(TicketRow, {
|
|
3713
3835
|
ticketTier: ticket,
|
|
3714
3836
|
prevTicketTier: arr[i - 1],
|
|
3715
3837
|
selectedTickets: selectedTickets,
|
|
3716
3838
|
handleTicketSelect: ticketSelect
|
|
3717
|
-
})
|
|
3839
|
+
}) : React__default.createElement("p", {
|
|
3840
|
+
className: 'ticket-not-started-message'
|
|
3841
|
+
}, "Sales not started"))));
|
|
3718
3842
|
}));
|
|
3719
3843
|
};
|
|
3720
3844
|
|
|
@@ -3734,8 +3858,7 @@ var generateQuantity = function generateQuantity(n) {
|
|
|
3734
3858
|
var WaitingList = function WaitingList(_ref) {
|
|
3735
3859
|
var _ref$tickets = _ref.tickets,
|
|
3736
3860
|
tickets = _ref$tickets === void 0 ? {} : _ref$tickets,
|
|
3737
|
-
eventId = _ref.eventId
|
|
3738
|
-
isPromotionsEnabled = _ref.isPromotionsEnabled;
|
|
3861
|
+
eventId = _ref.eventId;
|
|
3739
3862
|
|
|
3740
3863
|
var _useState = React.useState(false),
|
|
3741
3864
|
showSuccessMessage = _useState[0],
|
|
@@ -3810,9 +3933,7 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3810
3933
|
className: "success-message"
|
|
3811
3934
|
}, React__default.createElement("p", {
|
|
3812
3935
|
className: "added-success-message"
|
|
3813
|
-
}, "You've been added to the waiting list!"), React__default.createElement("p", null, "You'll be notified if tickets become available.")) : React__default.createElement(React__default.Fragment, null,
|
|
3814
|
-
className: "no-tickets-text"
|
|
3815
|
-
}, "No tickets are currently available for this event."), React__default.createElement("h2", null, "WAITING LIST"), React__default.createElement(formik.Formik, {
|
|
3936
|
+
}, "You've been added to the waiting list!"), React__default.createElement("p", null, "You'll be notified if tickets become available.")) : React__default.createElement(React__default.Fragment, null, React__default.createElement("h2", null, "WAITING LIST"), React__default.createElement(formik.Formik, {
|
|
3816
3937
|
initialValues: {
|
|
3817
3938
|
ticketTypeId: '',
|
|
3818
3939
|
quantity: '',
|
|
@@ -3874,7 +3995,7 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3874
3995
|
return emailValidator(value);
|
|
3875
3996
|
}),
|
|
3876
3997
|
component: CustomField
|
|
3877
|
-
})), React__default.createElement(Button
|
|
3998
|
+
})), React__default.createElement(Button, {
|
|
3878
3999
|
type: "submit",
|
|
3879
4000
|
variant: "contained",
|
|
3880
4001
|
className: "waiting-list-button"
|
|
@@ -3913,10 +4034,12 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
|
|
|
3913
4034
|
preProcessor: function preProcessor(code) {
|
|
3914
4035
|
return code.replace(/fill=".*?"/g, 'fill="currentColor"');
|
|
3915
4036
|
}
|
|
3916
|
-
}), React__default.createElement("p",
|
|
4037
|
+
}), React__default.createElement("p", {
|
|
4038
|
+
className: "promo-code-success"
|
|
4039
|
+
}, "PROMO CODE APPLIED SUCCESSFULLY")) : null, showPromoInput && React__default.createElement("div", {
|
|
3917
4040
|
className: "promo-code-block"
|
|
3918
|
-
}, React__default.createElement("input", {
|
|
3919
|
-
placeholder: "
|
|
4041
|
+
}, React__default.createElement("label", null, "PROMO CODE"), React__default.createElement("input", {
|
|
4042
|
+
placeholder: "",
|
|
3920
4043
|
onChange: function onChange(e) {
|
|
3921
4044
|
setPromoCode(e.target.value);
|
|
3922
4045
|
},
|
|
@@ -3925,7 +4048,7 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
|
|
|
3925
4048
|
setPromoCodeUpdated(promoCode);
|
|
3926
4049
|
}
|
|
3927
4050
|
}
|
|
3928
|
-
}), React__default.createElement(Button, {
|
|
4051
|
+
}), React__default.createElement(Button$1, {
|
|
3929
4052
|
className: "promo-apply-button",
|
|
3930
4053
|
placeholder: "Promo Code",
|
|
3931
4054
|
onClick: function onClick() {
|
|
@@ -3933,7 +4056,7 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
|
|
|
3933
4056
|
}
|
|
3934
4057
|
}, "Apply")), isPromotionsEnabled && !showPromoInput && isAllTicketsSoldOut && React__default.createElement("p", {
|
|
3935
4058
|
className: "promo-code-text"
|
|
3936
|
-
}, "Access code needed"), isPromotionsEnabled && !showPromoInput ? React__default.createElement(Button, {
|
|
4059
|
+
}, "Access code needed"), isPromotionsEnabled && !showPromoInput ? React__default.createElement(Button$1, {
|
|
3937
4060
|
className: "promo-code-button",
|
|
3938
4061
|
placeholder: "Promo Codes",
|
|
3939
4062
|
onClick: function onClick() {
|
|
@@ -3942,6 +4065,84 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
|
|
|
3942
4065
|
}, "Got a promo code? Click here") : null);
|
|
3943
4066
|
};
|
|
3944
4067
|
|
|
4068
|
+
var isTimeExpired = function isTimeExpired(startDate, timezone) {
|
|
4069
|
+
return !moment(startDate).isAfter(moment.tz(moment(), timezone).format('YYYY-MM-DD HH:mm:ss'));
|
|
4070
|
+
};
|
|
4071
|
+
|
|
4072
|
+
function Countdown(_ref) {
|
|
4073
|
+
var startDate = _ref.startDate,
|
|
4074
|
+
_ref$timezone = _ref.timezone,
|
|
4075
|
+
timezone = _ref$timezone === void 0 ? moment.tz.guess() : _ref$timezone,
|
|
4076
|
+
_ref$title = _ref.title,
|
|
4077
|
+
title = _ref$title === void 0 ? '' : _ref$title,
|
|
4078
|
+
_ref$message = _ref.message,
|
|
4079
|
+
message = _ref$message === void 0 ? '' : _ref$message,
|
|
4080
|
+
_ref$callback = _ref.callback,
|
|
4081
|
+
callback = _ref$callback === void 0 ? function () {} : _ref$callback;
|
|
4082
|
+
|
|
4083
|
+
var _useState = React.useState(''),
|
|
4084
|
+
duration = _useState[0],
|
|
4085
|
+
setDuration = _useState[1];
|
|
4086
|
+
|
|
4087
|
+
var _useState2 = React.useState(false),
|
|
4088
|
+
timeExpired = _useState2[0],
|
|
4089
|
+
setTimeExpired = _useState2[1];
|
|
4090
|
+
|
|
4091
|
+
React.useEffect(function () {
|
|
4092
|
+
setTimeExpired(isTimeExpired(startDate, timezone));
|
|
4093
|
+
}, []);
|
|
4094
|
+
React.useEffect(function () {
|
|
4095
|
+
var timer;
|
|
4096
|
+
|
|
4097
|
+
if (!timeExpired) {
|
|
4098
|
+
timer = setInterval(function () {
|
|
4099
|
+
if (isTimeExpired(startDate, timezone)) {
|
|
4100
|
+
clearInterval(timer);
|
|
4101
|
+
setTimeExpired(true);
|
|
4102
|
+
callback();
|
|
4103
|
+
}
|
|
4104
|
+
|
|
4105
|
+
var currentDate = moment.tz(moment(), timezone).format('YYYY-MM-DD HH:mm:ss');
|
|
4106
|
+
var diffTime = moment(startDate).diff(currentDate);
|
|
4107
|
+
var duration = moment.duration(diffTime);
|
|
4108
|
+
var dateArr = {
|
|
4109
|
+
year: duration.years(),
|
|
4110
|
+
month: duration.months(),
|
|
4111
|
+
day: duration.days(),
|
|
4112
|
+
hour: duration.hours(),
|
|
4113
|
+
minute: duration.minutes(),
|
|
4114
|
+
second: duration.seconds()
|
|
4115
|
+
};
|
|
4116
|
+
var timeLeft = '';
|
|
4117
|
+
|
|
4118
|
+
for (var date in dateArr) {
|
|
4119
|
+
var unit = dateArr[date] === 1 ? date : date + 's';
|
|
4120
|
+
var val = String(dateArr[date]).length === 1 ? '0' + dateArr[date] : dateArr[date];
|
|
4121
|
+
|
|
4122
|
+
if (timeLeft) {
|
|
4123
|
+
timeLeft += ", " + val + " " + unit;
|
|
4124
|
+
} else if (dateArr[date]) {
|
|
4125
|
+
timeLeft += val + " " + unit;
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
|
|
4129
|
+
setDuration(timeLeft);
|
|
4130
|
+
}, 1000);
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
return function () {
|
|
4134
|
+
clearInterval(timer);
|
|
4135
|
+
};
|
|
4136
|
+
}, [timeExpired]);
|
|
4137
|
+
return React__default.createElement(React__default.Fragment, null, !timeExpired && duration && React__default.createElement("div", {
|
|
4138
|
+
className: 'countdown'
|
|
4139
|
+
}, React__default.createElement("div", null, React__default.createElement("p", {
|
|
4140
|
+
className: 'title'
|
|
4141
|
+
}, title), React__default.createElement("p", null, duration)), React__default.createElement("p", {
|
|
4142
|
+
className: 'message'
|
|
4143
|
+
}, message)));
|
|
4144
|
+
}
|
|
4145
|
+
|
|
3945
4146
|
function Loader$1() {
|
|
3946
4147
|
return React__default.createElement("div", {
|
|
3947
4148
|
className: "loader-container"
|
|
@@ -3949,7 +4150,8 @@ function Loader$1() {
|
|
|
3949
4150
|
}
|
|
3950
4151
|
|
|
3951
4152
|
var TicketsContainer = function TicketsContainer(_ref) {
|
|
3952
|
-
var
|
|
4153
|
+
var onLoginSuccess = _ref.onLoginSuccess,
|
|
4154
|
+
getTicketsLabel = _ref.getTicketsLabel,
|
|
3953
4155
|
eventId = _ref.eventId,
|
|
3954
4156
|
onAddToCartSuccess = _ref.onAddToCartSuccess,
|
|
3955
4157
|
_ref$contentStyle = _ref.contentStyle,
|
|
@@ -3971,37 +4173,51 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
3971
4173
|
selectedTickets = _useState[0],
|
|
3972
4174
|
setSelectedTickets = _useState[1];
|
|
3973
4175
|
|
|
3974
|
-
var
|
|
3975
|
-
tickets = _useState2[0],
|
|
3976
|
-
setTickets = _useState2[1];
|
|
4176
|
+
var isWindowDefined = typeof window !== 'undefined';
|
|
3977
4177
|
|
|
3978
|
-
var
|
|
3979
|
-
|
|
3980
|
-
|
|
4178
|
+
var _useState2 = React.useState(isWindowDefined ? !!window.localStorage.getItem('access_token') : false),
|
|
4179
|
+
isLogged = _useState2[0],
|
|
4180
|
+
setIsLogged = _useState2[1];
|
|
3981
4181
|
|
|
3982
|
-
var
|
|
3983
|
-
|
|
3984
|
-
|
|
4182
|
+
var _React$useState = React__default.useState(false),
|
|
4183
|
+
showLoginModal = _React$useState[0],
|
|
4184
|
+
setShowLoginModal = _React$useState[1];
|
|
4185
|
+
|
|
4186
|
+
var _useState3 = React.useState([]),
|
|
4187
|
+
tickets = _useState3[0],
|
|
4188
|
+
setTickets = _useState3[1];
|
|
4189
|
+
|
|
4190
|
+
var _useState4 = React.useState(null),
|
|
4191
|
+
event = _useState4[0],
|
|
4192
|
+
setEvent = _useState4[1];
|
|
3985
4193
|
|
|
3986
4194
|
var _useState5 = React.useState(false),
|
|
3987
|
-
|
|
3988
|
-
|
|
4195
|
+
showWaitingList = _useState5[0],
|
|
4196
|
+
setShowWaitingList = _useState5[1];
|
|
4197
|
+
|
|
4198
|
+
var _useState6 = React.useState(false),
|
|
4199
|
+
isLoading = _useState6[0],
|
|
4200
|
+
setIsLoading = _useState6[1];
|
|
3989
4201
|
|
|
3990
|
-
var
|
|
3991
|
-
|
|
3992
|
-
|
|
4202
|
+
var _useState7 = React.useState(false),
|
|
4203
|
+
handleBookIsLoading = _useState7[0],
|
|
4204
|
+
setHandleBookIsLoading = _useState7[1];
|
|
3993
4205
|
|
|
3994
|
-
var
|
|
3995
|
-
|
|
3996
|
-
|
|
4206
|
+
var _useState8 = React.useState(''),
|
|
4207
|
+
promoCode = _useState8[0],
|
|
4208
|
+
setPromoCode = _useState8[1];
|
|
3997
4209
|
|
|
3998
|
-
var
|
|
3999
|
-
|
|
4000
|
-
|
|
4210
|
+
var _useState9 = React.useState(queryPromoCode),
|
|
4211
|
+
promoCodeUpdated = _useState9[0],
|
|
4212
|
+
setPromoCodeUpdated = _useState9[1];
|
|
4001
4213
|
|
|
4002
|
-
var
|
|
4003
|
-
|
|
4004
|
-
|
|
4214
|
+
var _useState10 = React.useState(false),
|
|
4215
|
+
showPromoInput = _useState10[0],
|
|
4216
|
+
setShowPromoInput = _useState10[1];
|
|
4217
|
+
|
|
4218
|
+
var _useState11 = React.useState(false),
|
|
4219
|
+
promoCodeIsApplied = _useState11[0],
|
|
4220
|
+
setPromoCodeIsApplied = _useState11[1];
|
|
4005
4221
|
|
|
4006
4222
|
React.useEffect(function () {
|
|
4007
4223
|
if (typeof window !== 'undefined') {
|
|
@@ -4018,62 +4234,102 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4018
4234
|
}
|
|
4019
4235
|
}, []);
|
|
4020
4236
|
React.useEffect(function () {
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
}
|
|
4237
|
+
getTicketsApi();
|
|
4238
|
+
}, [eventId, promoCodeUpdated]);
|
|
4024
4239
|
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
switch (_context.prev = _context.next) {
|
|
4031
|
-
case 0:
|
|
4032
|
-
_context.prev = 0;
|
|
4033
|
-
setIsLoading(true);
|
|
4034
|
-
_context.next = 4;
|
|
4035
|
-
return getTickets(eventId, promoCodeUpdated);
|
|
4036
|
-
|
|
4037
|
-
case 4:
|
|
4038
|
-
response = _context.sent;
|
|
4039
|
-
|
|
4040
|
-
if (response.data.success) {
|
|
4041
|
-
setCustomHeader(response);
|
|
4042
|
-
attributes = _get(response, 'data.data.attributes');
|
|
4043
|
-
setPromoCodeIsApplied(attributes.ValidPromoCode);
|
|
4044
|
-
setTickets(_get(attributes, 'tickets'));
|
|
4045
|
-
setShowWaitingList(attributes.showWaitingList);
|
|
4046
|
-
onGetTicketsSuccess(response.data);
|
|
4047
|
-
}
|
|
4240
|
+
var handleLogout = function handleLogout() {
|
|
4241
|
+
if (isWindowDefined) {
|
|
4242
|
+
window.localStorage.removeItem('access_token');
|
|
4243
|
+
window.localStorage.removeItem('user_data');
|
|
4244
|
+
setIsLogged(false);
|
|
4048
4245
|
|
|
4049
|
-
|
|
4050
|
-
break;
|
|
4246
|
+
var _event = new window.CustomEvent('tf-logout');
|
|
4051
4247
|
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4248
|
+
window.document.dispatchEvent(_event);
|
|
4249
|
+
}
|
|
4250
|
+
};
|
|
4055
4251
|
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4252
|
+
var handleExternalLogin = function handleExternalLogin() {
|
|
4253
|
+
setIsLogged(true);
|
|
4254
|
+
};
|
|
4059
4255
|
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
return _context.finish(11);
|
|
4256
|
+
var handleOnClose = function handleOnClose() {
|
|
4257
|
+
setShowLoginModal(false);
|
|
4258
|
+
};
|
|
4064
4259
|
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
}));
|
|
4072
|
-
return _getTicketsApi.apply(this, arguments);
|
|
4260
|
+
var handleOnLogin = function handleOnLogin() {
|
|
4261
|
+
setShowLoginModal(false);
|
|
4262
|
+
setIsLogged(true);
|
|
4263
|
+
|
|
4264
|
+
if (onLoginSuccess) {
|
|
4265
|
+
onLoginSuccess();
|
|
4073
4266
|
}
|
|
4267
|
+
};
|
|
4074
4268
|
|
|
4075
|
-
|
|
4076
|
-
|
|
4269
|
+
function getTicketsApi() {
|
|
4270
|
+
return _getTicketsApi.apply(this, arguments);
|
|
4271
|
+
}
|
|
4272
|
+
|
|
4273
|
+
function _getTicketsApi() {
|
|
4274
|
+
_getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
4275
|
+
var response, eventResponse, attributes, _event2;
|
|
4276
|
+
|
|
4277
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
4278
|
+
while (1) {
|
|
4279
|
+
switch (_context2.prev = _context2.next) {
|
|
4280
|
+
case 0:
|
|
4281
|
+
_context2.prev = 0;
|
|
4282
|
+
setIsLoading(true);
|
|
4283
|
+
_context2.next = 4;
|
|
4284
|
+
return getTickets(eventId, promoCodeUpdated);
|
|
4285
|
+
|
|
4286
|
+
case 4:
|
|
4287
|
+
response = _context2.sent;
|
|
4288
|
+
_context2.next = 7;
|
|
4289
|
+
return getEvent(eventId);
|
|
4290
|
+
|
|
4291
|
+
case 7:
|
|
4292
|
+
eventResponse = _context2.sent;
|
|
4293
|
+
|
|
4294
|
+
if (response.data.success) {
|
|
4295
|
+
setCustomHeader(response);
|
|
4296
|
+
attributes = _get(response, 'data.data.attributes');
|
|
4297
|
+
setPromoCodeIsApplied(attributes.ValidPromoCode);
|
|
4298
|
+
setTickets(_get(attributes, 'tickets'));
|
|
4299
|
+
setShowWaitingList(attributes.showWaitingList);
|
|
4300
|
+
onGetTicketsSuccess(response.data);
|
|
4301
|
+
}
|
|
4302
|
+
|
|
4303
|
+
if (eventResponse.data.success) {
|
|
4304
|
+
_event2 = _get(eventResponse, 'data.data.attributes');
|
|
4305
|
+
setEvent(_event2);
|
|
4306
|
+
}
|
|
4307
|
+
|
|
4308
|
+
_context2.next = 15;
|
|
4309
|
+
break;
|
|
4310
|
+
|
|
4311
|
+
case 12:
|
|
4312
|
+
_context2.prev = 12;
|
|
4313
|
+
_context2.t0 = _context2["catch"](0);
|
|
4314
|
+
|
|
4315
|
+
if (axios.isAxiosError(_context2.t0)) {
|
|
4316
|
+
onGetTicketsError(_context2.t0);
|
|
4317
|
+
}
|
|
4318
|
+
|
|
4319
|
+
case 15:
|
|
4320
|
+
_context2.prev = 15;
|
|
4321
|
+
setIsLoading(false);
|
|
4322
|
+
return _context2.finish(15);
|
|
4323
|
+
|
|
4324
|
+
case 18:
|
|
4325
|
+
case "end":
|
|
4326
|
+
return _context2.stop();
|
|
4327
|
+
}
|
|
4328
|
+
}
|
|
4329
|
+
}, _callee2, null, [[0, 12, 15, 18]]);
|
|
4330
|
+
}));
|
|
4331
|
+
return _getTicketsApi.apply(this, arguments);
|
|
4332
|
+
}
|
|
4077
4333
|
|
|
4078
4334
|
var handleTicketSelect = function handleTicketSelect(key, value) {
|
|
4079
4335
|
setSelectedTickets(function (prevState) {
|
|
@@ -4087,15 +4343,21 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4087
4343
|
});
|
|
4088
4344
|
};
|
|
4089
4345
|
|
|
4346
|
+
var handleOrdersClick = function handleOrdersClick() {
|
|
4347
|
+
if (isWindowDefined) {
|
|
4348
|
+
window.location.href = '/orders';
|
|
4349
|
+
}
|
|
4350
|
+
};
|
|
4351
|
+
|
|
4090
4352
|
var handleBook = /*#__PURE__*/function () {
|
|
4091
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4353
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
4092
4354
|
var _product_options, _product_options2, _ticket_types;
|
|
4093
4355
|
|
|
4094
|
-
var ticket, optionName, ticketId, ticketQuantity, data, result, _result$data$data$att, _result$data, _result$data$data, _result$data$data$att2, _result$data$data$att3, _result$data2, _result$data2$data, _result$data2$data$at, _result$data$data$att4, _result$data3, _result$data3$data, _result$data3$data$at;
|
|
4356
|
+
var ticket, optionName, ticketId, ticketQuantity, data, result, _result$data$data$att, _result$data, _result$data$data, _result$data$data$att2, _result$data$data$att3, _result$data2, _result$data2$data, _result$data2$data$at, _result$data$data$att4, _result$data3, _result$data3$data, _result$data3$data$at, skipBillingPage, nameIsRequired, ageIsRequired, hash, _isWindowDefined, userData, access_token, ticketsQuantity, checkoutBody, checkoutResult;
|
|
4095
4357
|
|
|
4096
|
-
return runtime_1.wrap(function
|
|
4358
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
4097
4359
|
while (1) {
|
|
4098
|
-
switch (
|
|
4360
|
+
switch (_context.prev = _context.next) {
|
|
4099
4361
|
case 0:
|
|
4100
4362
|
setHandleBookIsLoading(true);
|
|
4101
4363
|
ticket = _find(tickets, function (item) {
|
|
@@ -4116,45 +4378,74 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4116
4378
|
}, _ticket_types)
|
|
4117
4379
|
}
|
|
4118
4380
|
};
|
|
4119
|
-
|
|
4120
|
-
|
|
4381
|
+
_context.prev = 6;
|
|
4382
|
+
_context.next = 9;
|
|
4121
4383
|
return addToCart(eventId, data);
|
|
4122
4384
|
|
|
4123
4385
|
case 9:
|
|
4124
|
-
result =
|
|
4125
|
-
|
|
4126
|
-
if (result.status === 200) {
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
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,
|
|
4130
|
-
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,
|
|
4131
|
-
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,
|
|
4132
|
-
event_id: String(eventId)
|
|
4133
|
-
});
|
|
4386
|
+
result = _context.sent;
|
|
4387
|
+
|
|
4388
|
+
if (!(result.status === 200)) {
|
|
4389
|
+
_context.next = 27;
|
|
4390
|
+
break;
|
|
4134
4391
|
}
|
|
4135
4392
|
|
|
4136
|
-
|
|
4393
|
+
setCustomHeader(result);
|
|
4394
|
+
skipBillingPage = (_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;
|
|
4395
|
+
nameIsRequired = (_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;
|
|
4396
|
+
ageIsRequired = (_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;
|
|
4397
|
+
hash = '';
|
|
4398
|
+
|
|
4399
|
+
if (!skipBillingPage) {
|
|
4400
|
+
_context.next = 26;
|
|
4401
|
+
break;
|
|
4402
|
+
}
|
|
4403
|
+
|
|
4404
|
+
// Get user data for checkout data
|
|
4405
|
+
_isWindowDefined = typeof window !== 'undefined';
|
|
4406
|
+
userData = _isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
4407
|
+
access_token = _isWindowDefined && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
|
|
4408
|
+
ticketsQuantity = Object.keys(selectedTickets).length;
|
|
4409
|
+
checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity, userData);
|
|
4410
|
+
_context.next = 24;
|
|
4411
|
+
return postOnCheckout(checkoutBody, access_token);
|
|
4412
|
+
|
|
4413
|
+
case 24:
|
|
4414
|
+
checkoutResult = _context.sent;
|
|
4415
|
+
hash = _get(checkoutResult, 'data.data.attributes.hash');
|
|
4416
|
+
|
|
4417
|
+
case 26:
|
|
4418
|
+
onAddToCartSuccess({
|
|
4419
|
+
skip_billing_page: skipBillingPage,
|
|
4420
|
+
names_required: nameIsRequired,
|
|
4421
|
+
age_required: ageIsRequired,
|
|
4422
|
+
event_id: String(eventId),
|
|
4423
|
+
hash: hash
|
|
4424
|
+
});
|
|
4425
|
+
|
|
4426
|
+
case 27:
|
|
4427
|
+
_context.next = 32;
|
|
4137
4428
|
break;
|
|
4138
4429
|
|
|
4139
|
-
case
|
|
4140
|
-
|
|
4141
|
-
|
|
4430
|
+
case 29:
|
|
4431
|
+
_context.prev = 29;
|
|
4432
|
+
_context.t0 = _context["catch"](6);
|
|
4142
4433
|
|
|
4143
|
-
if (axios.isAxiosError(
|
|
4144
|
-
onAddToCartError(
|
|
4434
|
+
if (axios.isAxiosError(_context.t0)) {
|
|
4435
|
+
onAddToCartError(_context.t0);
|
|
4145
4436
|
}
|
|
4146
4437
|
|
|
4147
|
-
case
|
|
4148
|
-
|
|
4438
|
+
case 32:
|
|
4439
|
+
_context.prev = 32;
|
|
4149
4440
|
setHandleBookIsLoading(false);
|
|
4150
|
-
return
|
|
4441
|
+
return _context.finish(32);
|
|
4151
4442
|
|
|
4152
|
-
case
|
|
4443
|
+
case 35:
|
|
4153
4444
|
case "end":
|
|
4154
|
-
return
|
|
4445
|
+
return _context.stop();
|
|
4155
4446
|
}
|
|
4156
4447
|
}
|
|
4157
|
-
},
|
|
4448
|
+
}, _callee, null, [[6, 29, 32, 35]]);
|
|
4158
4449
|
}));
|
|
4159
4450
|
|
|
4160
4451
|
return function handleBook() {
|
|
@@ -4162,9 +4453,25 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4162
4453
|
};
|
|
4163
4454
|
}();
|
|
4164
4455
|
|
|
4456
|
+
var updateTickets = function updateTickets() {
|
|
4457
|
+
getTicketsApi();
|
|
4458
|
+
};
|
|
4459
|
+
|
|
4165
4460
|
var isAllTicketsSoldOut = !_some(tickets, function (item) {
|
|
4166
4461
|
return !(item.sold_out || item.soldOut);
|
|
4167
4462
|
});
|
|
4463
|
+
React.useEffect(function () {
|
|
4464
|
+
isWindowDefined && window.document.addEventListener('custom-logout', handleLogout);
|
|
4465
|
+
return function () {
|
|
4466
|
+
isWindowDefined && window.document.removeEventListener('custom-logout', handleLogout);
|
|
4467
|
+
};
|
|
4468
|
+
}, []);
|
|
4469
|
+
React.useEffect(function () {
|
|
4470
|
+
isWindowDefined && window.document.addEventListener('custom-login', handleExternalLogin);
|
|
4471
|
+
return function () {
|
|
4472
|
+
isWindowDefined && window.document.removeEventListener('custom-login', handleExternalLogin);
|
|
4473
|
+
};
|
|
4474
|
+
}, []);
|
|
4168
4475
|
return React__default.createElement("div", {
|
|
4169
4476
|
className: "get-tickets-page " + theme,
|
|
4170
4477
|
style: contentStyle
|
|
@@ -4173,10 +4480,15 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4173
4480
|
selectedTickets: selectedTickets,
|
|
4174
4481
|
handleTicketSelect: handleTicketSelect,
|
|
4175
4482
|
promoCodeIsApplied: promoCodeIsApplied
|
|
4176
|
-
}),
|
|
4483
|
+
}), event != null && event.salesEnded ? React__default.createElement("p", null, "Sales for this event are closed.") : event != null && event.salesStart ? React__default.createElement(Countdown, {
|
|
4484
|
+
startDate: event.salesStart,
|
|
4485
|
+
timezone: event.timezone,
|
|
4486
|
+
title: "Sales start in:",
|
|
4487
|
+
message: "No tickets are currently available for this event.",
|
|
4488
|
+
callback: updateTickets
|
|
4489
|
+
}) : null, showWaitingList && React__default.createElement(WaitingList, {
|
|
4177
4490
|
tickets: tickets,
|
|
4178
|
-
eventId: eventId
|
|
4179
|
-
isPromotionsEnabled: isPromotionsEnabled
|
|
4491
|
+
eventId: eventId
|
|
4180
4492
|
}), React__default.createElement(PromoCodeSection, {
|
|
4181
4493
|
promoCode: promoCode,
|
|
4182
4494
|
promoCodeIsApplied: promoCodeIsApplied,
|
|
@@ -4186,11 +4498,28 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4186
4498
|
setShowPromoInput: setShowPromoInput,
|
|
4187
4499
|
isPromotionsEnabled: isPromotionsEnabled,
|
|
4188
4500
|
isAllTicketsSoldOut: isAllTicketsSoldOut
|
|
4189
|
-
}), !isAllTicketsSoldOut && React__default.createElement(Button, {
|
|
4501
|
+
}), !isAllTicketsSoldOut && React__default.createElement(Button$1, {
|
|
4190
4502
|
"aria-hidden": true,
|
|
4191
4503
|
className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
|
|
4192
4504
|
onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
|
|
4193
|
-
}, getTicketsLabel || 'GET TICKETS')
|
|
4505
|
+
}, getTicketsLabel || 'GET TICKETS'), isLogged ? React__default.createElement("div", {
|
|
4506
|
+
className: "session-wrapper"
|
|
4507
|
+
}, React__default.createElement("span", {
|
|
4508
|
+
className: "session-container"
|
|
4509
|
+
}, React__default.createElement(Button$1, {
|
|
4510
|
+
variant: "outline-light",
|
|
4511
|
+
className: "session-buttons",
|
|
4512
|
+
onClick: handleOrdersClick
|
|
4513
|
+
}, "My Orders")), React__default.createElement("span", {
|
|
4514
|
+
className: "session-container"
|
|
4515
|
+
}, React__default.createElement(Button$1, {
|
|
4516
|
+
variant: "outline-light",
|
|
4517
|
+
className: "session-buttons",
|
|
4518
|
+
onClick: handleLogout
|
|
4519
|
+
}, "Log out"))) : ''), showLoginModal ? React__default.createElement(LoginModal, {
|
|
4520
|
+
onClose: handleOnClose,
|
|
4521
|
+
onLogin: handleOnLogin
|
|
4522
|
+
}) : null);
|
|
4194
4523
|
};
|
|
4195
4524
|
|
|
4196
4525
|
var EventInfoItem = function EventInfoItem(_ref) {
|
|
@@ -4398,9 +4727,9 @@ var TicketsTable = function TicketsTable(_ref) {
|
|
|
4398
4727
|
var _ref$tickets = _ref.tickets,
|
|
4399
4728
|
tickets = _ref$tickets === void 0 ? [] : _ref$tickets;
|
|
4400
4729
|
return React__default.createElement("div", {
|
|
4401
|
-
className:
|
|
4730
|
+
className: "tickets-box"
|
|
4402
4731
|
}, React__default.createElement("h4", {
|
|
4403
|
-
className:
|
|
4732
|
+
className: "sub-title"
|
|
4404
4733
|
}, "Your Tickets"), React__default.createElement(TableContainer, {
|
|
4405
4734
|
component: Paper
|
|
4406
4735
|
}, React__default.createElement(Table, {
|
|
@@ -4410,14 +4739,16 @@ var TicketsTable = function TicketsTable(_ref) {
|
|
|
4410
4739
|
|
|
4411
4740
|
return React__default.createElement(React.Fragment, {
|
|
4412
4741
|
key: index
|
|
4413
|
-
}, React__default.createElement(TableRow, null, React__default.createElement(TableCell, null, ticket.hash), React__default.createElement(TableCell, null, ticket.ticket_type), React__default.createElement(TableCell, null, ticket.holder_name), React__default.createElement(TableCell, null, ticket.status), React__default.createElement(TableCell, null, React__default.createElement("
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4742
|
+
}, React__default.createElement(TableRow, null, React__default.createElement(TableCell, null, ticket.hash), React__default.createElement(TableCell, null, ticket.ticket_type), React__default.createElement(TableCell, null, ticket.holder_name), React__default.createElement(TableCell, null, ticket.status), React__default.createElement(TableCell, null, React__default.createElement("span", {
|
|
4743
|
+
"aria-hidden": true,
|
|
4744
|
+
className: "download-button",
|
|
4745
|
+
onClick: function onClick() {
|
|
4746
|
+
return downloadPDF(ticket.pdf_link);
|
|
4747
|
+
}
|
|
4417
4748
|
}, "Download"))), !!((_ticket$add_ons = ticket.add_ons) != null && _ticket$add_ons.length) && React__default.createElement(TableRow, null, React__default.createElement(TableCell, {
|
|
4418
4749
|
colSpan: 5
|
|
4419
4750
|
}, React__default.createElement(Table, {
|
|
4420
|
-
className:
|
|
4751
|
+
className: "ticket-add-on-table"
|
|
4421
4752
|
}, React__default.createElement(TableHead, null, React__default.createElement(TableRow, null, React__default.createElement(TableCell, null, "Add-On"), React__default.createElement(TableCell, null, "Status"))), React__default.createElement(TableBody, null, ticket.add_ons.map(function (add_on, index) {
|
|
4422
4753
|
return React__default.createElement(TableRow, {
|
|
4423
4754
|
key: index
|