tf-checkout-react 1.3.11 → 1.3.12-beta.2
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/billing-info-container/index.d.ts +1 -3
- package/dist/components/forgotPasswordModal/index.d.ts +4 -5
- package/dist/components/loginForm/index.d.ts +45 -0
- package/dist/components/loginModal/index.d.ts +5 -43
- package/dist/components/preRegistration/FieldsSection.d.ts +13 -0
- package/dist/components/preRegistration/constants.d.ts +2 -0
- package/dist/components/preRegistration/index.d.ts +10 -0
- package/dist/components/preRegistration/utils.d.ts +9 -0
- package/dist/hooks/useCookieListener.d.ts +1 -0
- package/dist/hooks/useEventListener.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +706 -90
- 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 +707 -92
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/replaceVarInString.d.ts +1 -0
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/api/index.ts +15 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/billing-info-container/index.tsx +9 -8
- package/src/components/common/SelectField.tsx +1 -1
- package/src/components/common/dist/PhoneNumberField.js +96 -0
- package/src/components/forgotPasswordModal/index.tsx +12 -14
- package/src/components/loginForm/index.tsx +195 -0
- package/src/components/loginModal/index.tsx +39 -184
- package/src/components/preRegistration/FieldsSection.tsx +136 -0
- package/src/components/preRegistration/constants.tsx +155 -0
- package/src/components/preRegistration/index.tsx +219 -0
- package/src/components/preRegistration/utils.ts +95 -0
- package/src/hooks/useCookieListener.ts +32 -0
- package/src/hooks/useEventListener.ts +32 -0
- package/src/index.ts +2 -1
- package/src/types/api/auth.d.ts +55 -0
- package/src/types/api/preRegistration.d.ts +11 -0
- package/src/types/formFields.d.ts +30 -0
- package/src/utils/cookies.ts +7 -7
- package/src/utils/index.ts +1 -0
- package/src/utils/replaceVarInString.ts +9 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormControl, FormHelperText, InputLabel, Snackbar, Alert, Modal, Box, CircularProgress as CircularProgress$1,
|
|
1
|
+
import { FormControl, FormHelperText, InputLabel, Snackbar, Alert, Modal, Box, CircularProgress as CircularProgress$1, createTheme as createTheme$1, Button as Button$2 } from '@mui/material';
|
|
2
2
|
import Backdrop from '@mui/material/Backdrop';
|
|
3
3
|
import Button from '@mui/material/Button';
|
|
4
4
|
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
|
@@ -1016,7 +1016,7 @@ function setCustomCookie(name, value, days) {
|
|
|
1016
1016
|
|
|
1017
1017
|
if (typeof window !== 'undefined') {
|
|
1018
1018
|
var domain = getDomain(window.location.hostname);
|
|
1019
|
-
document.cookie = name + '=' + (value || '') + expires +
|
|
1019
|
+
document.cookie = name + '=' + (value || '') + expires + ("; path=/; domain=" + domain);
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
1022
|
function getCookieByName(cname) {
|
|
@@ -1027,11 +1027,11 @@ function getCookieByName(cname) {
|
|
|
1027
1027
|
for (var i = 0; i < ca.length; i++) {
|
|
1028
1028
|
var c = ca[i];
|
|
1029
1029
|
|
|
1030
|
-
while (c.charAt(0)
|
|
1030
|
+
while (c.charAt(0) === ' ') {
|
|
1031
1031
|
c = c.substring(1);
|
|
1032
1032
|
}
|
|
1033
1033
|
|
|
1034
|
-
if (c.indexOf(name)
|
|
1034
|
+
if (c.indexOf(name) === 0) {
|
|
1035
1035
|
return c.substring(name.length, c.length);
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
@@ -1178,6 +1178,20 @@ var createMarkup = function createMarkup(data) {
|
|
|
1178
1178
|
};
|
|
1179
1179
|
};
|
|
1180
1180
|
|
|
1181
|
+
var replaceVarInString = function replaceVarInString(message, varArray) {
|
|
1182
|
+
if (message === void 0) {
|
|
1183
|
+
message = '';
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
var re = new RegExp(/\{.*?\}/g);
|
|
1187
|
+
var index = 0;
|
|
1188
|
+
return message.replace(re, function (_) {
|
|
1189
|
+
var value = varArray[index] || '';
|
|
1190
|
+
index++;
|
|
1191
|
+
return value;
|
|
1192
|
+
});
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1181
1195
|
var isWindowDefined = typeof window !== 'undefined';
|
|
1182
1196
|
var isDocumentDefined = typeof document !== 'undefined';
|
|
1183
1197
|
|
|
@@ -1560,6 +1574,36 @@ var getCheckoutPageConfigs = /*#__PURE__*/function () {
|
|
|
1560
1574
|
return _ref3.apply(this, arguments);
|
|
1561
1575
|
};
|
|
1562
1576
|
}();
|
|
1577
|
+
var confirmPreRegistration = /*#__PURE__*/function () {
|
|
1578
|
+
var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(eventId, data) {
|
|
1579
|
+
var response;
|
|
1580
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1581
|
+
while (1) {
|
|
1582
|
+
switch (_context4.prev = _context4.next) {
|
|
1583
|
+
case 0:
|
|
1584
|
+
_context4.next = 2;
|
|
1585
|
+
return publicRequest.post("v1/event/" + eventId + "/pre-registration/confirm", {
|
|
1586
|
+
data: {
|
|
1587
|
+
attributes: data
|
|
1588
|
+
}
|
|
1589
|
+
});
|
|
1590
|
+
|
|
1591
|
+
case 2:
|
|
1592
|
+
response = _context4.sent;
|
|
1593
|
+
return _context4.abrupt("return", response.data);
|
|
1594
|
+
|
|
1595
|
+
case 4:
|
|
1596
|
+
case "end":
|
|
1597
|
+
return _context4.stop();
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}, _callee4);
|
|
1601
|
+
}));
|
|
1602
|
+
|
|
1603
|
+
return function confirmPreRegistration(_x3, _x4) {
|
|
1604
|
+
return _ref4.apply(this, arguments);
|
|
1605
|
+
};
|
|
1606
|
+
}();
|
|
1563
1607
|
|
|
1564
1608
|
var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
1565
1609
|
var combineValidators = function combineValidators() {
|
|
@@ -1906,7 +1950,7 @@ var SelectField = function SelectField(_ref) {
|
|
|
1906
1950
|
id: field.name
|
|
1907
1951
|
},
|
|
1908
1952
|
"native": true,
|
|
1909
|
-
className: theme,
|
|
1953
|
+
className: "Mui-Select " + theme,
|
|
1910
1954
|
MenuProps: {
|
|
1911
1955
|
className: theme
|
|
1912
1956
|
}
|
|
@@ -1981,8 +2025,8 @@ var Schema = /*#__PURE__*/object().shape({
|
|
|
1981
2025
|
var ForgotPasswordModal = function ForgotPasswordModal(_ref) {
|
|
1982
2026
|
var _ref$onClose = _ref.onClose,
|
|
1983
2027
|
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
|
|
1984
|
-
_ref$
|
|
1985
|
-
|
|
2028
|
+
_ref$onLoginButtonCli = _ref.onLoginButtonClick,
|
|
2029
|
+
onLoginButtonClick = _ref$onLoginButtonCli === void 0 ? function () {} : _ref$onLoginButtonCli,
|
|
1986
2030
|
_ref$onForgotPassword = _ref.onForgotPasswordSuccess,
|
|
1987
2031
|
onForgotPasswordSuccess = _ref$onForgotPassword === void 0 ? function () {} : _ref$onForgotPassword,
|
|
1988
2032
|
_ref$onForgotPassword2 = _ref.onForgotPasswordError,
|
|
@@ -2082,21 +2126,11 @@ var ForgotPasswordModal = function ForgotPasswordModal(_ref) {
|
|
|
2082
2126
|
}) : 'Submit')), React.createElement("div", {
|
|
2083
2127
|
className: "login"
|
|
2084
2128
|
}, React.createElement("span", {
|
|
2085
|
-
onClick:
|
|
2129
|
+
onClick: onLoginButtonClick
|
|
2086
2130
|
}, "Back to Log In")));
|
|
2087
2131
|
}))));
|
|
2088
2132
|
};
|
|
2089
2133
|
|
|
2090
|
-
var style$1 = {
|
|
2091
|
-
position: 'absolute',
|
|
2092
|
-
top: '50%',
|
|
2093
|
-
left: '50%',
|
|
2094
|
-
transform: 'translate(-50%, -50%)',
|
|
2095
|
-
minWidth: 480,
|
|
2096
|
-
backgroundColor: '#e3e3e3',
|
|
2097
|
-
border: '1px solid white',
|
|
2098
|
-
outline: 'none'
|
|
2099
|
-
};
|
|
2100
2134
|
var setLoggedUserData = function setLoggedUserData(data) {
|
|
2101
2135
|
return {
|
|
2102
2136
|
id: data.id,
|
|
@@ -2112,23 +2146,23 @@ var setLoggedUserData = function setLoggedUserData(data) {
|
|
|
2112
2146
|
zip: (data == null ? void 0 : data.zip) || (data == null ? void 0 : data.zipCode) || ''
|
|
2113
2147
|
};
|
|
2114
2148
|
};
|
|
2115
|
-
var
|
|
2116
|
-
var
|
|
2117
|
-
onLogin = _ref.onLogin,
|
|
2118
|
-
_ref$alreadyHasUser = _ref.alreadyHasUser,
|
|
2149
|
+
var LoginForm = function LoginForm(_ref) {
|
|
2150
|
+
var _ref$alreadyHasUser = _ref.alreadyHasUser,
|
|
2119
2151
|
alreadyHasUser = _ref$alreadyHasUser === void 0 ? false : _ref$alreadyHasUser,
|
|
2120
2152
|
_ref$userExpired = _ref.userExpired,
|
|
2121
2153
|
userExpired = _ref$userExpired === void 0 ? false : _ref$userExpired,
|
|
2154
|
+
_ref$onLoginSuccess = _ref.onLoginSuccess,
|
|
2155
|
+
onLoginSuccess = _ref$onLoginSuccess === void 0 ? _identity : _ref$onLoginSuccess,
|
|
2156
|
+
_ref$onLoginError = _ref.onLoginError,
|
|
2157
|
+
onLoginError = _ref$onLoginError === void 0 ? _identity : _ref$onLoginError,
|
|
2122
2158
|
_ref$onGetProfileData = _ref.onGetProfileDataSuccess,
|
|
2123
2159
|
onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? _identity : _ref$onGetProfileData,
|
|
2124
2160
|
_ref$onGetProfileData2 = _ref.onGetProfileDataError,
|
|
2125
2161
|
onGetProfileDataError = _ref$onGetProfileData2 === void 0 ? _identity : _ref$onGetProfileData2,
|
|
2126
|
-
_ref$onForgotPassword = _ref.
|
|
2127
|
-
|
|
2128
|
-
_ref$
|
|
2129
|
-
|
|
2130
|
-
_ref$modalClassname = _ref.modalClassname,
|
|
2131
|
-
modalClassname = _ref$modalClassname === void 0 ? '' : _ref$modalClassname,
|
|
2162
|
+
_ref$onForgotPassword = _ref.onForgotPasswordButtonClick,
|
|
2163
|
+
onForgotPasswordButtonClick = _ref$onForgotPassword === void 0 ? _identity : _ref$onForgotPassword,
|
|
2164
|
+
_ref$onSignupButtonCl = _ref.onSignupButtonClick,
|
|
2165
|
+
onSignupButtonClick = _ref$onSignupButtonCl === void 0 ? _identity : _ref$onSignupButtonCl,
|
|
2132
2166
|
logo = _ref.logo,
|
|
2133
2167
|
_ref$showForgotPasswo = _ref.showForgotPasswordButton,
|
|
2134
2168
|
showForgotPasswordButton = _ref$showForgotPasswo === void 0 ? false : _ref$showForgotPasswo,
|
|
@@ -2139,22 +2173,14 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
2139
2173
|
error = _useState[0],
|
|
2140
2174
|
setError = _useState[1];
|
|
2141
2175
|
|
|
2142
|
-
return React.createElement(
|
|
2143
|
-
open: true,
|
|
2144
|
-
onClose: onClose,
|
|
2145
|
-
"aria-labelledby": "modal-modal-title",
|
|
2146
|
-
"aria-describedby": "modal-modal-description",
|
|
2147
|
-
className: "login-modal " + modalClassname
|
|
2148
|
-
}, React.createElement(Box$1, {
|
|
2149
|
-
style: style$1
|
|
2150
|
-
}, React.createElement("div", null, React.createElement(Formik, {
|
|
2176
|
+
return React.createElement("div", null, React.createElement(Formik, {
|
|
2151
2177
|
initialValues: {
|
|
2152
2178
|
email: '',
|
|
2153
2179
|
password: ''
|
|
2154
2180
|
},
|
|
2155
2181
|
onSubmit: function () {
|
|
2156
2182
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
|
|
2157
|
-
var email, password, body, profileResponse, profileSpecifiedData, profileDataObj, event, _e$response, _e$response$data, _error;
|
|
2183
|
+
var email, password, body, authRes, profileResponse, profileSpecifiedData, profileDataObj, event, _e$response, _e$response$data, _error;
|
|
2158
2184
|
|
|
2159
2185
|
return runtime_1.wrap(function _callee$(_context) {
|
|
2160
2186
|
while (1) {
|
|
@@ -2170,20 +2196,21 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
2170
2196
|
return authorize(body);
|
|
2171
2197
|
|
|
2172
2198
|
case 5:
|
|
2199
|
+
authRes = _context.sent;
|
|
2173
2200
|
profileResponse = null;
|
|
2174
|
-
_context.prev =
|
|
2175
|
-
_context.next =
|
|
2201
|
+
_context.prev = 7;
|
|
2202
|
+
_context.next = 10;
|
|
2176
2203
|
return getProfileData();
|
|
2177
2204
|
|
|
2178
|
-
case
|
|
2205
|
+
case 10:
|
|
2179
2206
|
profileResponse = _context.sent;
|
|
2180
|
-
onGetProfileDataSuccess(profileResponse.data);
|
|
2181
|
-
_context.next =
|
|
2207
|
+
onGetProfileDataSuccess(_get(profileResponse, 'data.data'));
|
|
2208
|
+
_context.next = 18;
|
|
2182
2209
|
break;
|
|
2183
2210
|
|
|
2184
|
-
case
|
|
2185
|
-
_context.prev =
|
|
2186
|
-
_context.t0 = _context["catch"](
|
|
2211
|
+
case 14:
|
|
2212
|
+
_context.prev = 14;
|
|
2213
|
+
_context.t0 = _context["catch"](7);
|
|
2187
2214
|
|
|
2188
2215
|
if (axios.isAxiosError(_context.t0)) {
|
|
2189
2216
|
onGetProfileDataError(_context.t0);
|
|
@@ -2191,7 +2218,7 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
2191
2218
|
|
|
2192
2219
|
return _context.abrupt("return");
|
|
2193
2220
|
|
|
2194
|
-
case
|
|
2221
|
+
case 18:
|
|
2195
2222
|
profileSpecifiedData = _get(profileResponse, 'data.data');
|
|
2196
2223
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
2197
2224
|
|
|
@@ -2201,27 +2228,28 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
2201
2228
|
window.document.dispatchEvent(event);
|
|
2202
2229
|
}
|
|
2203
2230
|
|
|
2204
|
-
|
|
2205
|
-
_context.next =
|
|
2231
|
+
onLoginSuccess(_get(authRes, 'data.data'));
|
|
2232
|
+
_context.next = 27;
|
|
2206
2233
|
break;
|
|
2207
2234
|
|
|
2208
|
-
case
|
|
2209
|
-
_context.prev =
|
|
2235
|
+
case 24:
|
|
2236
|
+
_context.prev = 24;
|
|
2210
2237
|
_context.t1 = _context["catch"](1);
|
|
2211
2238
|
|
|
2212
2239
|
if (axios.isAxiosError(_context.t1)) {
|
|
2213
2240
|
_error = (_context.t1 == null ? void 0 : (_e$response = _context.t1.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message) || 'Error';
|
|
2214
2241
|
setError(_error);
|
|
2242
|
+
onLoginError(_context.t1);
|
|
2215
2243
|
} else if (_context.t1 instanceof Error) {
|
|
2216
2244
|
setError((_context.t1 == null ? void 0 : _context.t1.message) || 'Error');
|
|
2217
2245
|
}
|
|
2218
2246
|
|
|
2219
|
-
case
|
|
2247
|
+
case 27:
|
|
2220
2248
|
case "end":
|
|
2221
2249
|
return _context.stop();
|
|
2222
2250
|
}
|
|
2223
2251
|
}
|
|
2224
|
-
}, _callee, null, [[1,
|
|
2252
|
+
}, _callee, null, [[1, 24], [7, 14]]);
|
|
2225
2253
|
}));
|
|
2226
2254
|
|
|
2227
2255
|
function onSubmit(_x) {
|
|
@@ -2236,10 +2264,10 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
2236
2264
|
}, React.createElement("div", {
|
|
2237
2265
|
className: "modal-title"
|
|
2238
2266
|
}, "Login"), React.createElement("div", {
|
|
2239
|
-
className:
|
|
2267
|
+
className: "login-logo-container"
|
|
2240
2268
|
}, React.createElement("img", {
|
|
2241
2269
|
className: "login-logo-tff",
|
|
2242
|
-
src: logo ||
|
|
2270
|
+
src: logo || 'https://www.ticketfairy.com/resources/images/logo-ttf-black.svg',
|
|
2243
2271
|
alt: "logo"
|
|
2244
2272
|
})), React.createElement("div", {
|
|
2245
2273
|
className: "server_auth__error"
|
|
@@ -2252,33 +2280,19 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
2252
2280
|
}, React.createElement("div", {
|
|
2253
2281
|
className: "login-modal-body__email"
|
|
2254
2282
|
}, React.createElement(Field, {
|
|
2255
|
-
name:
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
return React.createElement(TextField$1, Object.assign({
|
|
2261
|
-
label: 'Email',
|
|
2262
|
-
type: 'email',
|
|
2263
|
-
fullWidth: true,
|
|
2264
|
-
error: !!meta.error && meta.touched,
|
|
2265
|
-
helperText: meta.touched && meta.error
|
|
2266
|
-
}, field));
|
|
2283
|
+
name: "email",
|
|
2284
|
+
label: "Email",
|
|
2285
|
+
type: "email",
|
|
2286
|
+
component: CustomField,
|
|
2287
|
+
validate: combineValidators(requiredValidator, emailValidator)
|
|
2267
2288
|
})), React.createElement("div", {
|
|
2268
2289
|
className: "login-modal-body__password"
|
|
2269
2290
|
}, React.createElement(Field, {
|
|
2270
|
-
name:
|
|
2291
|
+
name: "password",
|
|
2292
|
+
label: "Password",
|
|
2293
|
+
type: "password",
|
|
2294
|
+
component: CustomField,
|
|
2271
2295
|
validate: requiredValidator
|
|
2272
|
-
}, function (_ref4) {
|
|
2273
|
-
var field = _ref4.field,
|
|
2274
|
-
meta = _ref4.meta;
|
|
2275
|
-
return React.createElement(TextField$1, Object.assign({
|
|
2276
|
-
label: "Password",
|
|
2277
|
-
type: "password",
|
|
2278
|
-
fullWidth: true,
|
|
2279
|
-
error: !!meta.error && meta.touched,
|
|
2280
|
-
helperText: meta.touched && meta.error
|
|
2281
|
-
}, field));
|
|
2282
2296
|
})), React.createElement("div", {
|
|
2283
2297
|
className: "login-action-button"
|
|
2284
2298
|
}, React.createElement("button", {
|
|
@@ -2287,14 +2301,60 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
2287
2301
|
className: "forgot-password"
|
|
2288
2302
|
}, React.createElement("span", {
|
|
2289
2303
|
"aria-hidden": "true",
|
|
2290
|
-
onClick:
|
|
2304
|
+
onClick: onForgotPasswordButtonClick
|
|
2291
2305
|
}, "Forgot password?")), showSignUpButton && React.createElement("div", {
|
|
2292
2306
|
className: "forgot-password"
|
|
2293
2307
|
}, React.createElement("span", {
|
|
2294
2308
|
"aria-hidden": "true",
|
|
2295
|
-
onClick:
|
|
2309
|
+
onClick: onSignupButtonClick
|
|
2296
2310
|
}, "Sign up"))));
|
|
2297
|
-
}))
|
|
2311
|
+
}));
|
|
2312
|
+
};
|
|
2313
|
+
|
|
2314
|
+
var style$1 = {
|
|
2315
|
+
position: 'absolute',
|
|
2316
|
+
top: '50%',
|
|
2317
|
+
left: '50%',
|
|
2318
|
+
transform: 'translate(-50%, -50%)',
|
|
2319
|
+
minWidth: 480,
|
|
2320
|
+
backgroundColor: '#e3e3e3',
|
|
2321
|
+
border: '1px solid white',
|
|
2322
|
+
outline: 'none'
|
|
2323
|
+
};
|
|
2324
|
+
var LoginModal = function LoginModal(_ref) {
|
|
2325
|
+
var onClose = _ref.onClose,
|
|
2326
|
+
onLogin = _ref.onLogin,
|
|
2327
|
+
alreadyHasUser = _ref.alreadyHasUser,
|
|
2328
|
+
userExpired = _ref.userExpired,
|
|
2329
|
+
onGetProfileDataSuccess = _ref.onGetProfileDataSuccess,
|
|
2330
|
+
onGetProfileDataError = _ref.onGetProfileDataError,
|
|
2331
|
+
onForgotPassword = _ref.onForgotPassword,
|
|
2332
|
+
onSignup = _ref.onSignup,
|
|
2333
|
+
_ref$modalClassname = _ref.modalClassname,
|
|
2334
|
+
modalClassname = _ref$modalClassname === void 0 ? '' : _ref$modalClassname,
|
|
2335
|
+
logo = _ref.logo,
|
|
2336
|
+
showForgotPasswordButton = _ref.showForgotPasswordButton,
|
|
2337
|
+
showSignUpButton = _ref.showSignUpButton;
|
|
2338
|
+
return React.createElement(Modal$1, {
|
|
2339
|
+
open: true,
|
|
2340
|
+
onClose: onClose,
|
|
2341
|
+
"aria-labelledby": "modal-modal-title",
|
|
2342
|
+
"aria-describedby": "modal-modal-description",
|
|
2343
|
+
className: "login-modal " + modalClassname
|
|
2344
|
+
}, React.createElement(Box$1, {
|
|
2345
|
+
style: style$1
|
|
2346
|
+
}, React.createElement(LoginForm, {
|
|
2347
|
+
alreadyHasUser: alreadyHasUser,
|
|
2348
|
+
userExpired: userExpired,
|
|
2349
|
+
onLoginSuccess: onLogin,
|
|
2350
|
+
onGetProfileDataSuccess: onGetProfileDataSuccess,
|
|
2351
|
+
onGetProfileDataError: onGetProfileDataError,
|
|
2352
|
+
onForgotPasswordButtonClick: onForgotPassword,
|
|
2353
|
+
onSignupButtonClick: onSignup,
|
|
2354
|
+
logo: logo,
|
|
2355
|
+
showForgotPasswordButton: showForgotPasswordButton,
|
|
2356
|
+
showSignUpButton: showSignUpButton
|
|
2357
|
+
})));
|
|
2298
2358
|
};
|
|
2299
2359
|
|
|
2300
2360
|
var style$2 = {
|
|
@@ -2913,10 +2973,6 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
|
|
|
2913
2973
|
_onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? _identity : _ref3$onGetProfileDat,
|
|
2914
2974
|
_ref3$onGetProfileDat2 = _ref3.onGetProfileDataError,
|
|
2915
2975
|
onGetProfileDataError = _ref3$onGetProfileDat2 === void 0 ? _identity : _ref3$onGetProfileDat2,
|
|
2916
|
-
_ref3$onAuthorizeSucc = _ref3.onAuthorizeSuccess,
|
|
2917
|
-
onAuthorizeSuccess = _ref3$onAuthorizeSucc === void 0 ? _identity : _ref3$onAuthorizeSucc,
|
|
2918
|
-
_ref3$onAuthorizeErro = _ref3.onAuthorizeError,
|
|
2919
|
-
onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? _identity : _ref3$onAuthorizeErro,
|
|
2920
2976
|
onLogin = _ref3.onLogin,
|
|
2921
2977
|
_ref3$onLoginSuccess = _ref3.onLoginSuccess,
|
|
2922
2978
|
onLoginSuccess = _ref3$onLoginSuccess === void 0 ? _identity : _ref3$onLoginSuccess,
|
|
@@ -3364,7 +3420,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
|
|
|
3364
3420
|
enableReinitialize: false,
|
|
3365
3421
|
onSubmit: function () {
|
|
3366
3422
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
|
|
3367
|
-
var _checkoutBody, _res, updatedUserData, _profileSpecifiedData, _profileDataObj, checkoutBodyForRegistration, bodyFormData, resRegister, _xtfCookie, accessToken, refreshToken, userProfile, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3;
|
|
3423
|
+
var _checkoutBody, _res, updatedUserData, _profileSpecifiedData, _profileDataObj, checkoutBodyForRegistration, bodyFormData, resRegister, _xtfCookie, accessToken, refreshToken, userProfile, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3, _e$response3$data, _e$response4, event;
|
|
3368
3424
|
|
|
3369
3425
|
return runtime_1.wrap(function _callee6$(_context6) {
|
|
3370
3426
|
while (1) {
|
|
@@ -3502,16 +3558,22 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
|
|
|
3502
3558
|
setLoading(false);
|
|
3503
3559
|
|
|
3504
3560
|
if (axios.isAxiosError(_context6.t1)) {
|
|
3505
|
-
if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
|
|
3561
|
+
if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.status) === 401 || ((_e$response3 = _context6.t1.response) == null ? void 0 : (_e$response3$data = _e$response3.data) == null ? void 0 : _e$response3$data.error) === 'invalid_token') {
|
|
3506
3562
|
if (isWindowDefined) {
|
|
3507
3563
|
window.localStorage.removeItem('user_data');
|
|
3508
3564
|
window.localStorage.removeItem('access_token');
|
|
3509
3565
|
setUserExpired(true);
|
|
3510
3566
|
setShowModalLogin(true);
|
|
3567
|
+
setIsLoggedIn(false);
|
|
3568
|
+
setShowModalSignup(false);
|
|
3569
|
+
setShowModalForgotPassword(false);
|
|
3570
|
+
event = new window.CustomEvent('tf-logout');
|
|
3571
|
+
deleteCookieByName('X-TF-ECOMMERCE');
|
|
3572
|
+
window.document.dispatchEvent(event);
|
|
3511
3573
|
}
|
|
3512
3574
|
}
|
|
3513
3575
|
|
|
3514
|
-
if ((_e$
|
|
3576
|
+
if ((_e$response4 = _context6.t1.response) != null && _e$response4.data.message && !hideErrorsAlertSection) {
|
|
3515
3577
|
setError(_get(_context6.t1, 'response.data.message'));
|
|
3516
3578
|
}
|
|
3517
3579
|
|
|
@@ -3693,8 +3755,6 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
|
|
|
3693
3755
|
},
|
|
3694
3756
|
alreadyHasUser: alreadyHasUser,
|
|
3695
3757
|
userExpired: userExpired,
|
|
3696
|
-
onAuthorizeSuccess: onAuthorizeSuccess,
|
|
3697
|
-
onAuthorizeError: onAuthorizeError,
|
|
3698
3758
|
onGetProfileDataSuccess: function onGetProfileDataSuccess(data) {
|
|
3699
3759
|
fetchCart();
|
|
3700
3760
|
|
|
@@ -3725,7 +3785,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
|
|
|
3725
3785
|
onClose: function onClose() {
|
|
3726
3786
|
setShowModalForgotPassword(false);
|
|
3727
3787
|
},
|
|
3728
|
-
|
|
3788
|
+
onLoginButtonClick: function onLoginButtonClick() {
|
|
3729
3789
|
setShowModalForgotPassword(false);
|
|
3730
3790
|
setShowModalLogin(true);
|
|
3731
3791
|
},
|
|
@@ -8042,5 +8102,560 @@ var RsvpContainer = function RsvpContainer(_ref) {
|
|
|
8042
8102
|
}, "RSVP"))))))));
|
|
8043
8103
|
};
|
|
8044
8104
|
|
|
8045
|
-
|
|
8105
|
+
var useCookieListener = function useCookieListener(key, handler) {
|
|
8106
|
+
var getCookie = function getCookie() {
|
|
8107
|
+
return getCookieByName(key);
|
|
8108
|
+
};
|
|
8109
|
+
|
|
8110
|
+
var _useState = useState(),
|
|
8111
|
+
intervalValue = _useState[0],
|
|
8112
|
+
setIntervalValue = _useState[1];
|
|
8113
|
+
|
|
8114
|
+
var cookieRef = useRef(getCookie());
|
|
8115
|
+
|
|
8116
|
+
var handleCookieChange = function handleCookieChange() {
|
|
8117
|
+
var currentCookie = getCookie();
|
|
8118
|
+
var prevCookie = cookieRef.current;
|
|
8119
|
+
|
|
8120
|
+
if (currentCookie !== prevCookie) {
|
|
8121
|
+
cookieRef.current = getCookie();
|
|
8122
|
+
handler(cookieRef.current);
|
|
8123
|
+
}
|
|
8124
|
+
};
|
|
8125
|
+
|
|
8126
|
+
useEffect(function () {
|
|
8127
|
+
var interval = setInterval(handleCookieChange, 500);
|
|
8128
|
+
setIntervalValue(interval);
|
|
8129
|
+
return function () {
|
|
8130
|
+
intervalValue && clearInterval(intervalValue);
|
|
8131
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8132
|
+
}, []);
|
|
8133
|
+
};
|
|
8134
|
+
|
|
8135
|
+
var formFieldsNotLoggedIn = [{
|
|
8136
|
+
name: 'basic-info',
|
|
8137
|
+
groupLabel: 'Create (or log in to) your account, then click on Confirm Registration.',
|
|
8138
|
+
groupLabelClassName: '',
|
|
8139
|
+
groupClassName: '',
|
|
8140
|
+
fields: [{
|
|
8141
|
+
className: 'half-width',
|
|
8142
|
+
name: 'firstName',
|
|
8143
|
+
label: 'First Name',
|
|
8144
|
+
type: 'text',
|
|
8145
|
+
required: true,
|
|
8146
|
+
onValidate: null
|
|
8147
|
+
}, {
|
|
8148
|
+
className: 'half-width',
|
|
8149
|
+
name: 'lastName',
|
|
8150
|
+
label: 'Last Name',
|
|
8151
|
+
type: 'text',
|
|
8152
|
+
required: true,
|
|
8153
|
+
onValidate: null
|
|
8154
|
+
}, {
|
|
8155
|
+
name: 'email',
|
|
8156
|
+
label: 'Email',
|
|
8157
|
+
type: 'email',
|
|
8158
|
+
required: true,
|
|
8159
|
+
onValidate: null
|
|
8160
|
+
}, {
|
|
8161
|
+
name: 'confirmEmail',
|
|
8162
|
+
label: 'Confirm Email',
|
|
8163
|
+
type: 'email',
|
|
8164
|
+
required: true,
|
|
8165
|
+
onValidate: null
|
|
8166
|
+
}]
|
|
8167
|
+
}, {
|
|
8168
|
+
name: 'billing-info',
|
|
8169
|
+
groupLabel: '',
|
|
8170
|
+
groupLabelClassName: '',
|
|
8171
|
+
groupClassName: '',
|
|
8172
|
+
fields: [{
|
|
8173
|
+
className: 'half-width',
|
|
8174
|
+
name: 'zip',
|
|
8175
|
+
label: 'Post Code/Zip',
|
|
8176
|
+
type: 'text',
|
|
8177
|
+
required: true,
|
|
8178
|
+
onValidate: null
|
|
8179
|
+
}, {
|
|
8180
|
+
className: 'half-width',
|
|
8181
|
+
name: 'country',
|
|
8182
|
+
label: 'Country',
|
|
8183
|
+
type: 'select',
|
|
8184
|
+
required: true,
|
|
8185
|
+
onValidate: null
|
|
8186
|
+
}]
|
|
8187
|
+
}, {
|
|
8188
|
+
name: 'password-info',
|
|
8189
|
+
groupLabel: /*#__PURE__*/React.createElement("div", {
|
|
8190
|
+
className: "email-info-block"
|
|
8191
|
+
}, /*#__PURE__*/React.createElement("span", null, "Choose a password for your new"), /*#__PURE__*/React.createElement("b", null, " Mana Common "), /*#__PURE__*/React.createElement("span", null, "account")),
|
|
8192
|
+
groupLabelClassName: '',
|
|
8193
|
+
groupClassName: '',
|
|
8194
|
+
fields: [{
|
|
8195
|
+
className: 'half-width',
|
|
8196
|
+
name: 'password',
|
|
8197
|
+
label: 'Password',
|
|
8198
|
+
type: 'password',
|
|
8199
|
+
required: true,
|
|
8200
|
+
onValidate: null
|
|
8201
|
+
}, {
|
|
8202
|
+
className: 'half-width',
|
|
8203
|
+
name: 'confirmPassword',
|
|
8204
|
+
label: 'Confirm Password',
|
|
8205
|
+
type: 'password',
|
|
8206
|
+
required: true,
|
|
8207
|
+
onValidate: null
|
|
8208
|
+
}]
|
|
8209
|
+
}];
|
|
8210
|
+
var formFieldsLoggedIn = [{
|
|
8211
|
+
name: 'basic-info-logged-in',
|
|
8212
|
+
groupLabel: 'To confirm your pre-registration for {event_name} simply click on the confirmation button below.',
|
|
8213
|
+
groupLabelClassName: '',
|
|
8214
|
+
groupClassName: '',
|
|
8215
|
+
fields: [{
|
|
8216
|
+
name: 'email',
|
|
8217
|
+
label: 'Email',
|
|
8218
|
+
type: 'email',
|
|
8219
|
+
required: true,
|
|
8220
|
+
onValidate: null
|
|
8221
|
+
}, {
|
|
8222
|
+
name: 'confirmEmail',
|
|
8223
|
+
label: 'Confirm Email',
|
|
8224
|
+
type: 'email',
|
|
8225
|
+
required: true,
|
|
8226
|
+
onValidate: null
|
|
8227
|
+
}]
|
|
8228
|
+
}, {
|
|
8229
|
+
name: 'billing-info-logged-in',
|
|
8230
|
+
groupLabel: '',
|
|
8231
|
+
groupLabelClassName: '',
|
|
8232
|
+
groupClassName: '',
|
|
8233
|
+
fields: [{
|
|
8234
|
+
name: 'numTickets',
|
|
8235
|
+
label: 'How many tickets do you want to buy?',
|
|
8236
|
+
type: 'select',
|
|
8237
|
+
required: true,
|
|
8238
|
+
options: /*#__PURE__*/new Array(10).fill(null).map(function (_, index) {
|
|
8239
|
+
return {
|
|
8240
|
+
label: index + 1,
|
|
8241
|
+
value: index + 1
|
|
8242
|
+
};
|
|
8243
|
+
}),
|
|
8244
|
+
onValidate: null
|
|
8245
|
+
}, {
|
|
8246
|
+
name: 'holderAge',
|
|
8247
|
+
label: 'Ticket Holder Age',
|
|
8248
|
+
type: 'date',
|
|
8249
|
+
required: true,
|
|
8250
|
+
onValidate: null
|
|
8251
|
+
}, {
|
|
8252
|
+
name: 'brandOptIn',
|
|
8253
|
+
label: 'I would like to be updated on Mana Common news, events and offers.',
|
|
8254
|
+
type: 'checkbox'
|
|
8255
|
+
}]
|
|
8256
|
+
}];
|
|
8257
|
+
|
|
8258
|
+
var getValidateFunctions$1 = function getValidateFunctions(_ref) {
|
|
8259
|
+
var element = _ref.element,
|
|
8260
|
+
values = _ref.values;
|
|
8261
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8262
|
+
var validationFunctions = [];
|
|
8263
|
+
|
|
8264
|
+
if (element.required) {
|
|
8265
|
+
validationFunctions.push(requiredValidator);
|
|
8266
|
+
}
|
|
8267
|
+
|
|
8268
|
+
if (element.onValidate) {
|
|
8269
|
+
validationFunctions.push(element.onValidate);
|
|
8270
|
+
}
|
|
8271
|
+
|
|
8272
|
+
if (element.name === 'confirmEmail') {
|
|
8273
|
+
var isSameEmail = function isSameEmail(confirmEmail) {
|
|
8274
|
+
return values.email !== confirmEmail ? 'Please confirm your email address correctly' : null;
|
|
8275
|
+
};
|
|
8276
|
+
|
|
8277
|
+
validationFunctions.push(isSameEmail);
|
|
8278
|
+
}
|
|
8279
|
+
|
|
8280
|
+
if (element.name === 'confirmPassword') {
|
|
8281
|
+
var isSame = function isSame(confirmPassword) {
|
|
8282
|
+
return values.password !== confirmPassword ? 'Password confirmation does not match' : null;
|
|
8283
|
+
};
|
|
8284
|
+
|
|
8285
|
+
validationFunctions.push(isSame);
|
|
8286
|
+
}
|
|
8287
|
+
|
|
8288
|
+
return combineValidators.apply(void 0, validationFunctions);
|
|
8289
|
+
};
|
|
8290
|
+
var getFormInitialValues = function getFormInitialValues(fieldsSections) {
|
|
8291
|
+
var initialValues = {};
|
|
8292
|
+
var isWindowDefined = typeof window !== 'undefined';
|
|
8293
|
+
var userData = JSON.parse(isWindowDefined ? window.localStorage.getItem('user_data') || '{}' : '{}');
|
|
8294
|
+
|
|
8295
|
+
_forEach(fieldsSections, function (item) {
|
|
8296
|
+
_forEach(item.fields, function (fieldItem) {
|
|
8297
|
+
switch (fieldItem.name) {
|
|
8298
|
+
case 'country':
|
|
8299
|
+
case 'numTickets':
|
|
8300
|
+
initialValues[fieldItem.name] = 1;
|
|
8301
|
+
break;
|
|
8302
|
+
|
|
8303
|
+
case 'brandOptIn':
|
|
8304
|
+
initialValues[fieldItem.name] = true;
|
|
8305
|
+
break;
|
|
8306
|
+
|
|
8307
|
+
default:
|
|
8308
|
+
initialValues[fieldItem.name] = _get(userData, fieldItem.name) || '';
|
|
8309
|
+
break;
|
|
8310
|
+
}
|
|
8311
|
+
});
|
|
8312
|
+
});
|
|
8313
|
+
|
|
8314
|
+
return initialValues;
|
|
8315
|
+
};
|
|
8316
|
+
var updateFormFieldsAttributes = function updateFormFieldsAttributes(formFields, attributes) {
|
|
8317
|
+
if (attributes && !_isEmpty(attributes)) {
|
|
8318
|
+
var updatedFormFields = _map(formFields, function (fieldSection) {
|
|
8319
|
+
var fieldSectionAttributes = attributes[fieldSection.name] || {};
|
|
8320
|
+
|
|
8321
|
+
var updatedFields = _map(fieldSection.fields, function (fieldItem) {
|
|
8322
|
+
var fieldItemAttributes = attributes[fieldItem.name] || {};
|
|
8323
|
+
return _extends({}, fieldItem, fieldItemAttributes);
|
|
8324
|
+
});
|
|
8325
|
+
|
|
8326
|
+
return _extends({}, fieldSection, fieldSectionAttributes, {
|
|
8327
|
+
fields: updatedFields
|
|
8328
|
+
});
|
|
8329
|
+
});
|
|
8330
|
+
|
|
8331
|
+
return updatedFormFields;
|
|
8332
|
+
}
|
|
8333
|
+
|
|
8334
|
+
return formFields;
|
|
8335
|
+
};
|
|
8336
|
+
|
|
8337
|
+
var SectionContainer = function SectionContainer(_ref) {
|
|
8338
|
+
var children = _ref.children,
|
|
8339
|
+
className = _ref.className;
|
|
8340
|
+
return React.createElement("div", {
|
|
8341
|
+
className: className
|
|
8342
|
+
}, children);
|
|
8343
|
+
};
|
|
8344
|
+
|
|
8345
|
+
var insertHTML = function insertHTML(elementId, text) {
|
|
8346
|
+
if (text === void 0) {
|
|
8347
|
+
text = '';
|
|
8348
|
+
}
|
|
8349
|
+
|
|
8350
|
+
var elem = document && document.getElementById(elementId);
|
|
8351
|
+
|
|
8352
|
+
if (!(elem != null && elem.childNodes.length)) {
|
|
8353
|
+
elem == null ? void 0 : elem.insertAdjacentHTML('afterbegin', text);
|
|
8354
|
+
}
|
|
8355
|
+
|
|
8356
|
+
return null;
|
|
8357
|
+
};
|
|
8358
|
+
|
|
8359
|
+
var getFieldClassNames = function getFieldClassNames(id, existingClassNames) {
|
|
8360
|
+
var _elem$parentElement;
|
|
8361
|
+
|
|
8362
|
+
var elem = document && document.getElementById(id);
|
|
8363
|
+
|
|
8364
|
+
if (((elem == null ? void 0 : (_elem$parentElement = elem.parentElement) == null ? void 0 : _elem$parentElement.clientWidth) || 0) < 375) {
|
|
8365
|
+
return existingClassNames + ' full-width';
|
|
8366
|
+
}
|
|
8367
|
+
|
|
8368
|
+
return existingClassNames;
|
|
8369
|
+
};
|
|
8370
|
+
|
|
8371
|
+
var FieldsSection = function FieldsSection(_ref2) {
|
|
8372
|
+
var _ref2$formFields = _ref2.formFields,
|
|
8373
|
+
formFields = _ref2$formFields === void 0 ? [] : _ref2$formFields,
|
|
8374
|
+
_ref2$countries = _ref2.countries,
|
|
8375
|
+
countries = _ref2$countries === void 0 ? [] : _ref2$countries,
|
|
8376
|
+
values = _ref2.values,
|
|
8377
|
+
setFieldValue = _ref2.setFieldValue,
|
|
8378
|
+
theme = _ref2.theme,
|
|
8379
|
+
_ref2$containerClass = _ref2.containerClass,
|
|
8380
|
+
containerClass = _ref2$containerClass === void 0 ? '' : _ref2$containerClass;
|
|
8381
|
+
return React.createElement(React.Fragment, null, _map(formFields, function (item, index) {
|
|
8382
|
+
var name = item.name,
|
|
8383
|
+
groupLabel = item.groupLabel,
|
|
8384
|
+
_item$groupLabelVars = item.groupLabelVars,
|
|
8385
|
+
groupLabelVars = _item$groupLabelVars === void 0 ? [] : _item$groupLabelVars,
|
|
8386
|
+
groupLabelClassName = item.groupLabelClassName,
|
|
8387
|
+
_item$groupClassName = item.groupClassName,
|
|
8388
|
+
groupClassName = _item$groupClassName === void 0 ? '' : _item$groupClassName,
|
|
8389
|
+
fields = item.fields;
|
|
8390
|
+
return React.createElement(SectionContainer, {
|
|
8391
|
+
key: name,
|
|
8392
|
+
className: groupClassName
|
|
8393
|
+
}, React.createElement("span", {
|
|
8394
|
+
id: "group_label_" + index,
|
|
8395
|
+
className: groupLabelClassName
|
|
8396
|
+
}, typeof groupLabel === 'string' ? insertHTML("group_label_" + index, replaceVarInString(groupLabel, groupLabelVars)) : groupLabel), React.createElement("div", {
|
|
8397
|
+
className: "fields-container " + groupClassName
|
|
8398
|
+
}, _map(fields, function (fieldData, fieldIndex) {
|
|
8399
|
+
var name = fieldData.name,
|
|
8400
|
+
label = fieldData.label,
|
|
8401
|
+
_fieldData$className = fieldData.className,
|
|
8402
|
+
className = _fieldData$className === void 0 ? 'full-width' : _fieldData$className,
|
|
8403
|
+
type = fieldData.type,
|
|
8404
|
+
component = fieldData.component,
|
|
8405
|
+
_fieldData$options = fieldData.options,
|
|
8406
|
+
options = _fieldData$options === void 0 ? [] : _fieldData$options;
|
|
8407
|
+
var id = name + "-" + fieldIndex;
|
|
8408
|
+
var classNames = containerClass + "-container__field " + className;
|
|
8409
|
+
return component || React.createElement("div", {
|
|
8410
|
+
key: name,
|
|
8411
|
+
id: id,
|
|
8412
|
+
className: getFieldClassNames(id, classNames)
|
|
8413
|
+
}, React.createElement(Field, {
|
|
8414
|
+
name: name,
|
|
8415
|
+
label: label,
|
|
8416
|
+
type: type,
|
|
8417
|
+
validate: getValidateFunctions$1({
|
|
8418
|
+
element: fieldData,
|
|
8419
|
+
values: values
|
|
8420
|
+
}),
|
|
8421
|
+
setFieldValue: setFieldValue,
|
|
8422
|
+
component: type === 'checkbox' ? CheckboxField : type === 'select' ? SelectField : type === 'phone' ? PhoneNumberField : type === 'date' ? DatePickerField : CustomField,
|
|
8423
|
+
selectOptions: name === 'country' ? countries : options,
|
|
8424
|
+
theme: theme
|
|
8425
|
+
}));
|
|
8426
|
+
})));
|
|
8427
|
+
}));
|
|
8428
|
+
};
|
|
8429
|
+
|
|
8430
|
+
var X_TF_ECOMMERCE = 'X-TF-ECOMMERCE';
|
|
8431
|
+
var PreRegistration = function PreRegistration(_ref) {
|
|
8432
|
+
var eventId = _ref.eventId,
|
|
8433
|
+
pFormFields = _ref.formFields,
|
|
8434
|
+
additionalFieldAttribute = _ref.additionalFieldAttribute,
|
|
8435
|
+
logo = _ref.logo,
|
|
8436
|
+
showForgotPasswordButton = _ref.showForgotPasswordButton,
|
|
8437
|
+
_ref$onLoginSuccess = _ref.onLoginSuccess,
|
|
8438
|
+
onLoginSuccess = _ref$onLoginSuccess === void 0 ? _identity : _ref$onLoginSuccess,
|
|
8439
|
+
_ref$onForgotPassword = _ref.onForgotPasswordSuccess,
|
|
8440
|
+
onForgotPasswordSuccess = _ref$onForgotPassword === void 0 ? _identity : _ref$onForgotPassword,
|
|
8441
|
+
_ref$onForgotPassword2 = _ref.onForgotPasswordError,
|
|
8442
|
+
onForgotPasswordError = _ref$onForgotPassword2 === void 0 ? _identity : _ref$onForgotPassword2;
|
|
8443
|
+
|
|
8444
|
+
var _useState = useState(''),
|
|
8445
|
+
error = _useState[0],
|
|
8446
|
+
setError = _useState[1];
|
|
8447
|
+
|
|
8448
|
+
var _useState2 = useState(false),
|
|
8449
|
+
showModalLogin = _useState2[0],
|
|
8450
|
+
setShowModalLogin = _useState2[1];
|
|
8451
|
+
|
|
8452
|
+
var _useState3 = useState(false),
|
|
8453
|
+
showModalForgotPassword = _useState3[0],
|
|
8454
|
+
setShowModalForgotPassword = _useState3[1];
|
|
8455
|
+
|
|
8456
|
+
var _useState4 = useState([]),
|
|
8457
|
+
countries = _useState4[0],
|
|
8458
|
+
setCountries = _useState4[1];
|
|
8459
|
+
|
|
8460
|
+
var _useState5 = useState(Boolean(getCookieByName(X_TF_ECOMMERCE))),
|
|
8461
|
+
isLoggedIn = _useState5[0],
|
|
8462
|
+
setIsLoggedIn = _useState5[1];
|
|
8463
|
+
|
|
8464
|
+
useCookieListener(X_TF_ECOMMERCE, function (value) {
|
|
8465
|
+
return setIsLoggedIn(Boolean(value));
|
|
8466
|
+
});
|
|
8467
|
+
var formFields = updateFormFieldsAttributes(pFormFields || isLoggedIn ? formFieldsLoggedIn : formFieldsNotLoggedIn, additionalFieldAttribute);
|
|
8468
|
+
useEffect(function () {
|
|
8469
|
+
// fetch countries data
|
|
8470
|
+
var fetchCountries = /*#__PURE__*/function () {
|
|
8471
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
8472
|
+
var res, _e$response, _e$response$data, _error;
|
|
8473
|
+
|
|
8474
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
8475
|
+
while (1) {
|
|
8476
|
+
switch (_context.prev = _context.next) {
|
|
8477
|
+
case 0:
|
|
8478
|
+
_context.prev = 0;
|
|
8479
|
+
_context.next = 3;
|
|
8480
|
+
return getCountries();
|
|
8481
|
+
|
|
8482
|
+
case 3:
|
|
8483
|
+
res = _context.sent;
|
|
8484
|
+
setCountries(_map(_get(res, 'data.data'), function (item, key) {
|
|
8485
|
+
return {
|
|
8486
|
+
label: item,
|
|
8487
|
+
value: key
|
|
8488
|
+
};
|
|
8489
|
+
})); // onGetCountriesSuccess(res.data)
|
|
8490
|
+
|
|
8491
|
+
_context.next = 10;
|
|
8492
|
+
break;
|
|
8493
|
+
|
|
8494
|
+
case 7:
|
|
8495
|
+
_context.prev = 7;
|
|
8496
|
+
_context.t0 = _context["catch"](0);
|
|
8497
|
+
|
|
8498
|
+
if (axios.isAxiosError(_context.t0)) {
|
|
8499
|
+
_error = (_context.t0 == null ? void 0 : (_e$response = _context.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message) || 'Error';
|
|
8500
|
+
setError(_error); // onGetCountriesError(e)
|
|
8501
|
+
}
|
|
8502
|
+
|
|
8503
|
+
case 10:
|
|
8504
|
+
case "end":
|
|
8505
|
+
return _context.stop();
|
|
8506
|
+
}
|
|
8507
|
+
}
|
|
8508
|
+
}, _callee, null, [[0, 7]]);
|
|
8509
|
+
}));
|
|
8510
|
+
|
|
8511
|
+
return function fetchCountries() {
|
|
8512
|
+
return _ref2.apply(this, arguments);
|
|
8513
|
+
};
|
|
8514
|
+
}();
|
|
8515
|
+
|
|
8516
|
+
fetchCountries();
|
|
8517
|
+
}, []);
|
|
8518
|
+
return React.createElement("div", {
|
|
8519
|
+
className: "pre-registration-container"
|
|
8520
|
+
}, React.createElement(SnackbarAlert, {
|
|
8521
|
+
type: "error",
|
|
8522
|
+
isOpen: !!error,
|
|
8523
|
+
message: error || '',
|
|
8524
|
+
onClose: function onClose() {
|
|
8525
|
+
setError('');
|
|
8526
|
+
}
|
|
8527
|
+
}), !isLoggedIn && React.createElement("div", {
|
|
8528
|
+
className: "account-actions-block"
|
|
8529
|
+
}, React.createElement("div", {
|
|
8530
|
+
className: "action-item"
|
|
8531
|
+
}, React.createElement("div", null, "Got a ", React.createElement("strong", null, "MANA Common"), " account?"), React.createElement("div", null, "Login & skip ahead:")), React.createElement("div", {
|
|
8532
|
+
className: "action-item login-block"
|
|
8533
|
+
}, React.createElement("button", {
|
|
8534
|
+
className: "login-register-button",
|
|
8535
|
+
type: "button",
|
|
8536
|
+
onClick: function onClick() {
|
|
8537
|
+
setShowModalLogin(true);
|
|
8538
|
+
}
|
|
8539
|
+
}, "Login"))), showModalLogin && React.createElement(LoginModal, {
|
|
8540
|
+
logo: logo,
|
|
8541
|
+
onClose: function onClose() {
|
|
8542
|
+
setShowModalLogin(false);
|
|
8543
|
+
},
|
|
8544
|
+
onLogin: function onLogin(res) {
|
|
8545
|
+
setShowModalLogin(false);
|
|
8546
|
+
onLoginSuccess(res);
|
|
8547
|
+
},
|
|
8548
|
+
showForgotPasswordButton: showForgotPasswordButton,
|
|
8549
|
+
onForgotPassword: function onForgotPassword() {
|
|
8550
|
+
setShowModalLogin(false);
|
|
8551
|
+
setShowModalForgotPassword(true);
|
|
8552
|
+
}
|
|
8553
|
+
}), showModalForgotPassword && React.createElement(ForgotPasswordModal, {
|
|
8554
|
+
onClose: function onClose() {
|
|
8555
|
+
setShowModalForgotPassword(false);
|
|
8556
|
+
},
|
|
8557
|
+
onLoginButtonClick: function onLoginButtonClick() {
|
|
8558
|
+
setShowModalForgotPassword(false);
|
|
8559
|
+
setShowModalLogin(true);
|
|
8560
|
+
},
|
|
8561
|
+
onForgotPasswordSuccess: onForgotPasswordSuccess,
|
|
8562
|
+
onForgotPasswordError: onForgotPasswordError
|
|
8563
|
+
}), React.createElement("h2", null, "Pre-Registration"), React.createElement(Formik, {
|
|
8564
|
+
initialValues: getFormInitialValues(formFields),
|
|
8565
|
+
enableReinitialize: true,
|
|
8566
|
+
onSubmit: function () {
|
|
8567
|
+
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(values) {
|
|
8568
|
+
var updatedValues, holderAgeDate, bodyFormData, _e$response2, _e$response2$data, _error2;
|
|
8569
|
+
|
|
8570
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
8571
|
+
while (1) {
|
|
8572
|
+
switch (_context2.prev = _context2.next) {
|
|
8573
|
+
case 0:
|
|
8574
|
+
_context2.prev = 0;
|
|
8575
|
+
|
|
8576
|
+
if (!isLoggedIn) {
|
|
8577
|
+
_context2.next = 12;
|
|
8578
|
+
break;
|
|
8579
|
+
}
|
|
8580
|
+
|
|
8581
|
+
updatedValues = _extends({}, values);
|
|
8582
|
+
holderAgeDate = new Date(values.holderAge);
|
|
8583
|
+
updatedValues.dobDay = holderAgeDate.getDate();
|
|
8584
|
+
updatedValues.dobMonth = holderAgeDate.getMonth() + 1;
|
|
8585
|
+
updatedValues.dobYear = holderAgeDate.getFullYear(); // remove date picker string value
|
|
8586
|
+
|
|
8587
|
+
delete updatedValues.holderAge;
|
|
8588
|
+
_context2.next = 10;
|
|
8589
|
+
return confirmPreRegistration(eventId, updatedValues);
|
|
8590
|
+
|
|
8591
|
+
case 10:
|
|
8592
|
+
_context2.next = 24;
|
|
8593
|
+
break;
|
|
8594
|
+
|
|
8595
|
+
case 12:
|
|
8596
|
+
bodyFormData = new FormData();
|
|
8597
|
+
bodyFormData.append('first_name', values.firstName);
|
|
8598
|
+
bodyFormData.append('last_name', values.lastName);
|
|
8599
|
+
bodyFormData.append('email', values.email);
|
|
8600
|
+
bodyFormData.append('confirm_email', values.confirmEmail);
|
|
8601
|
+
bodyFormData.append('zip', values.zip);
|
|
8602
|
+
bodyFormData.append('country', values.country);
|
|
8603
|
+
bodyFormData.append('password', values.password);
|
|
8604
|
+
bodyFormData.append('password_confirmation', values.confirmPassword);
|
|
8605
|
+
bodyFormData.append('register_for', 'prereg');
|
|
8606
|
+
_context2.next = 24;
|
|
8607
|
+
return register(bodyFormData);
|
|
8608
|
+
|
|
8609
|
+
case 24:
|
|
8610
|
+
_context2.next = 29;
|
|
8611
|
+
break;
|
|
8612
|
+
|
|
8613
|
+
case 26:
|
|
8614
|
+
_context2.prev = 26;
|
|
8615
|
+
_context2.t0 = _context2["catch"](0);
|
|
8616
|
+
|
|
8617
|
+
if (axios.isAxiosError(_context2.t0)) {
|
|
8618
|
+
_error2 = (_context2.t0 == null ? void 0 : (_e$response2 = _context2.t0.response) == null ? void 0 : (_e$response2$data = _e$response2.data) == null ? void 0 : _e$response2$data.message) || 'Error';
|
|
8619
|
+
setError(_error2);
|
|
8620
|
+
} else if (_context2.t0 instanceof Error) {
|
|
8621
|
+
setError((_context2.t0 == null ? void 0 : _context2.t0.message) || 'Error');
|
|
8622
|
+
}
|
|
8623
|
+
|
|
8624
|
+
case 29:
|
|
8625
|
+
case "end":
|
|
8626
|
+
return _context2.stop();
|
|
8627
|
+
}
|
|
8628
|
+
}
|
|
8629
|
+
}, _callee2, null, [[0, 26]]);
|
|
8630
|
+
}));
|
|
8631
|
+
|
|
8632
|
+
function onSubmit(_x) {
|
|
8633
|
+
return _onSubmit.apply(this, arguments);
|
|
8634
|
+
}
|
|
8635
|
+
|
|
8636
|
+
return onSubmit;
|
|
8637
|
+
}()
|
|
8638
|
+
}, function (props) {
|
|
8639
|
+
return React.createElement(Form, null, React.createElement("div", {
|
|
8640
|
+
className: "login-modal-body"
|
|
8641
|
+
}, React.createElement(FieldsSection, {
|
|
8642
|
+
formFields: formFields,
|
|
8643
|
+
values: props.values,
|
|
8644
|
+
setFieldValue: props.setFieldValue,
|
|
8645
|
+
containerClass: "pre-registration",
|
|
8646
|
+
countries: countries
|
|
8647
|
+
})), React.createElement("div", {
|
|
8648
|
+
className: "button-container"
|
|
8649
|
+
}, React.createElement(Button$2, {
|
|
8650
|
+
type: "submit",
|
|
8651
|
+
variant: "contained",
|
|
8652
|
+
className: "login-register-button",
|
|
8653
|
+
disabled: props.isSubmitting
|
|
8654
|
+
}, props.isSubmitting ? React.createElement(CircularProgress$1, {
|
|
8655
|
+
size: 26
|
|
8656
|
+
}) : isLoggedIn ? 'Confirm Pre-Registration' : 'Create Account')));
|
|
8657
|
+
}));
|
|
8658
|
+
};
|
|
8659
|
+
|
|
8660
|
+
export { AddonsContainter, BillingInfoContainer, ConfirmationContainer, ForgotPasswordModal, LoginModal, MyTicketsContainer, OrderDetailsContainer, PaymentContainer, PreRegistration, RedirectModal, ResetPasswordContainer, RsvpContainer, TicketResaleContainer, TicketsContainer, createFixedFloatNormalizer, currencyNormalizerCreator, setConfigs };
|
|
8046
8661
|
//# sourceMappingURL=tf-checkout-react.esm.js.map
|