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