tf-checkout-react 1.4.20 → 1.4.21
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/README.md +462 -229
- package/dist/api/guestTicketDelegation.d.ts +47 -0
- package/dist/api/index.d.ts +2 -2
- package/dist/components/common/CustomField.d.ts +1 -1
- package/dist/components/common/FieldSection/index.d.ts +19 -0
- package/dist/components/common/FieldSection/utils/index.d.ts +8 -0
- package/dist/components/common/index.d.ts +2 -2
- package/dist/components/confirmModal/index.d.ts +2 -2
- package/dist/components/delegationsContainer/IssueComponent.d.ts +10 -0
- package/dist/components/delegationsContainer/IssueTicketForm.d.ts +9 -0
- package/dist/components/delegationsContainer/TicketsAssignedTable.d.ts +11 -0
- package/dist/components/delegationsContainer/TicketsAvailableTable.d.ts +11 -0
- package/dist/components/delegationsContainer/index.d.ts +10 -0
- package/dist/components/idVerificationContainer/constants.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/loginForm/index.d.ts +45 -0
- package/dist/components/registerForm/adapters/index.d.ts +4 -0
- package/dist/components/registerForm/constants.d.ts +1 -0
- package/dist/components/registerForm/index.d.ts +16 -0
- package/dist/index.d.ts +3 -1
- package/dist/tf-checkout-react.cjs.development.js +1413 -283
- 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 +1416 -288
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/utils/form.d.ts +3 -0
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/replaceVarInString.d.ts +1 -0
- package/package.json +1 -1
- package/src/api/guestTicketDelegation.ts +79 -0
- package/src/api/index.ts +3 -2
- package/src/components/billing-info-container/utils.ts +1 -1
- package/src/components/common/CustomField.tsx +2 -0
- package/src/components/common/FieldSection/index.tsx +141 -0
- package/src/components/common/FieldSection/utils/index.tsx +92 -0
- package/src/components/common/SelectField/index.tsx +1 -1
- package/src/components/common/index.tsx +2 -2
- package/src/components/confirmModal/index.tsx +2 -2
- package/src/components/delegationsContainer/IssueComponent.tsx +155 -0
- package/src/components/delegationsContainer/IssueTicketForm.tsx +109 -0
- package/src/components/delegationsContainer/TicketsAssignedTable.tsx +55 -0
- package/src/components/delegationsContainer/TicketsAvailableTable.tsx +54 -0
- package/src/components/delegationsContainer/index.tsx +83 -0
- package/src/components/forgotPasswordModal/index.tsx +3 -9
- package/src/components/idVerificationContainer/constants.ts +5 -2
- package/src/components/index.ts +1 -0
- package/src/components/loginForm/index.tsx +195 -0
- package/src/components/registerForm/adapters/index.tsx +10 -0
- package/src/components/registerForm/constants.tsx +96 -0
- package/src/components/registerForm/index.tsx +192 -0
- package/src/index.ts +3 -4
- package/src/types/api/auth.d.ts +55 -0
- package/src/types/api/guestTicketDelegation.d.ts +18 -0
- package/src/types/formFields.d.ts +29 -0
- package/src/utils/form.ts +34 -0
- package/src/utils/index.ts +3 -1
- package/src/utils/replaceVarInString.ts +9 -0
- package/src/validators/index.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Snackbar, Alert, Modal as Modal$1, Box, CircularProgress, TextField as TextField$1, FormControl, FormHelperText, InputLabel, createTheme as createTheme$1, Select as Select$1 } from '@mui/material';
|
|
1
|
+
import { Snackbar, Alert, Modal as Modal$1, Box, CircularProgress, TextField as TextField$1, FormControl, FormHelperText, InputLabel, createTheme as createTheme$1, Button as Button$2, Select as Select$1 } 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';
|
|
@@ -32,18 +32,18 @@ import FormControlLabel from '@mui/material/FormControlLabel';
|
|
|
32
32
|
import FormGroup from '@mui/material/FormGroup';
|
|
33
33
|
import MuiPhoneNumber from 'material-ui-phone-number';
|
|
34
34
|
import _debounce from 'lodash-es/debounce';
|
|
35
|
-
import Select from '@mui/material/Select';
|
|
36
|
-
import FormControl$1 from '@mui/material/FormControl';
|
|
37
35
|
import FormHelperText$1 from '@mui/material/FormHelperText';
|
|
38
|
-
import FormLabel from '@mui/material/FormLabel';
|
|
39
|
-
import Radio from '@mui/material/Radio';
|
|
40
|
-
import RadioGroup from '@mui/material/RadioGroup';
|
|
41
36
|
import ListItemText from '@mui/material/ListItemText';
|
|
42
37
|
import MenuItem from '@mui/material/MenuItem';
|
|
43
38
|
import OutlinedInput from '@mui/material/OutlinedInput';
|
|
39
|
+
import Select from '@mui/material/Select';
|
|
44
40
|
import { DatePicker } from '@mui/x-date-pickers';
|
|
45
41
|
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
46
42
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
43
|
+
import FormControl$1 from '@mui/material/FormControl';
|
|
44
|
+
import FormLabel from '@mui/material/FormLabel';
|
|
45
|
+
import Radio from '@mui/material/Radio';
|
|
46
|
+
import RadioGroup from '@mui/material/RadioGroup';
|
|
47
47
|
import Alert$1 from '@mui/material/Alert';
|
|
48
48
|
import Container from '@mui/material/Container';
|
|
49
49
|
import { useStripe, useElements, CardNumberElement, CardExpiryElement, CardCvcElement, Elements } from '@stripe/react-stripe-js';
|
|
@@ -76,7 +76,7 @@ import ReactDom from 'react-dom';
|
|
|
76
76
|
import SeatMapView from 'tf-seat-map-view';
|
|
77
77
|
import InputLabel$1 from '@mui/material/InputLabel';
|
|
78
78
|
import Tooltip from '@mui/material/Tooltip';
|
|
79
|
-
import { Button as Button$
|
|
79
|
+
import { Button as Button$3 } from 'react-bootstrap';
|
|
80
80
|
|
|
81
81
|
function _regeneratorRuntime() {
|
|
82
82
|
_regeneratorRuntime = function () {
|
|
@@ -677,6 +677,48 @@ var createMarkup = function createMarkup(data) {
|
|
|
677
677
|
};
|
|
678
678
|
};
|
|
679
679
|
|
|
680
|
+
var replaceVarInString = function replaceVarInString(message, varArray) {
|
|
681
|
+
if (message === void 0) {
|
|
682
|
+
message = '';
|
|
683
|
+
}
|
|
684
|
+
var re = new RegExp(/\{.*?\}/g);
|
|
685
|
+
var index = 0;
|
|
686
|
+
return message.replace(re, function (_) {
|
|
687
|
+
var value = varArray[index] || '';
|
|
688
|
+
index++;
|
|
689
|
+
return value;
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
694
|
+
|
|
695
|
+
var getFormInitialValues = function getFormInitialValues(fieldsSections) {
|
|
696
|
+
var initialValues = {};
|
|
697
|
+
var isWindowDefined = typeof window !== 'undefined';
|
|
698
|
+
var userData = JSON.parse(isWindowDefined ? window.localStorage.getItem('user_data') || '{}' : '{}');
|
|
699
|
+
_forEach(fieldsSections, function (item) {
|
|
700
|
+
_forEach(item.fields, function (fieldItem) {
|
|
701
|
+
switch (fieldItem.name) {
|
|
702
|
+
case 'country':
|
|
703
|
+
case 'numTickets':
|
|
704
|
+
case 'state':
|
|
705
|
+
initialValues[fieldItem.name] = '';
|
|
706
|
+
break;
|
|
707
|
+
case 'brandOptIn':
|
|
708
|
+
initialValues[fieldItem.name] = true;
|
|
709
|
+
break;
|
|
710
|
+
case 'confirmEmail':
|
|
711
|
+
initialValues[fieldItem.name] = _get(userData, fieldItem.name) || _get(userData, 'email') || '';
|
|
712
|
+
break;
|
|
713
|
+
default:
|
|
714
|
+
initialValues[fieldItem.name] = _get(userData, fieldItem.name) || '';
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
});
|
|
719
|
+
return initialValues;
|
|
720
|
+
};
|
|
721
|
+
|
|
680
722
|
var setLoggedUserData = function setLoggedUserData(data) {
|
|
681
723
|
return {
|
|
682
724
|
id: data.id,
|
|
@@ -693,8 +735,6 @@ var setLoggedUserData = function setLoggedUserData(data) {
|
|
|
693
735
|
};
|
|
694
736
|
};
|
|
695
737
|
|
|
696
|
-
var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
697
|
-
|
|
698
738
|
var isJson = function isJson(value) {
|
|
699
739
|
try {
|
|
700
740
|
JSON.parse(value);
|
|
@@ -704,6 +744,57 @@ var isJson = function isJson(value) {
|
|
|
704
744
|
return true;
|
|
705
745
|
};
|
|
706
746
|
|
|
747
|
+
var getCustomerExistsData = /*#__PURE__*/function () {
|
|
748
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(accessHash) {
|
|
749
|
+
var response;
|
|
750
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
751
|
+
while (1) switch (_context.prev = _context.next) {
|
|
752
|
+
case 0:
|
|
753
|
+
_context.next = 2;
|
|
754
|
+
return publicRequest.get("/v1/delegation-access/" + accessHash + "/customer-exists");
|
|
755
|
+
case 2:
|
|
756
|
+
response = _context.sent;
|
|
757
|
+
return _context.abrupt("return", response.data);
|
|
758
|
+
case 4:
|
|
759
|
+
case "end":
|
|
760
|
+
return _context.stop();
|
|
761
|
+
}
|
|
762
|
+
}, _callee);
|
|
763
|
+
}));
|
|
764
|
+
return function getCustomerExistsData(_x) {
|
|
765
|
+
return _ref.apply(this, arguments);
|
|
766
|
+
};
|
|
767
|
+
}();
|
|
768
|
+
var getDelegationTickets = function getDelegationTickets(accessHash) {
|
|
769
|
+
var res = publicRequest.get("v1/delegation-access/" + accessHash + "/consumer-page-info");
|
|
770
|
+
return res;
|
|
771
|
+
};
|
|
772
|
+
var issueTicket = /*#__PURE__*/function () {
|
|
773
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(accessHash, data) {
|
|
774
|
+
var response;
|
|
775
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
776
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
777
|
+
case 0:
|
|
778
|
+
_context2.next = 2;
|
|
779
|
+
return publicRequest.post("v1/delegation-access/" + accessHash + "/issue-ticket", {
|
|
780
|
+
data: {
|
|
781
|
+
attributes: data
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
case 2:
|
|
785
|
+
response = _context2.sent;
|
|
786
|
+
return _context2.abrupt("return", response.data);
|
|
787
|
+
case 4:
|
|
788
|
+
case "end":
|
|
789
|
+
return _context2.stop();
|
|
790
|
+
}
|
|
791
|
+
}, _callee2);
|
|
792
|
+
}));
|
|
793
|
+
return function issueTicket(_x2, _x3) {
|
|
794
|
+
return _ref2.apply(this, arguments);
|
|
795
|
+
};
|
|
796
|
+
}();
|
|
797
|
+
|
|
707
798
|
var isWindowDefined = typeof window !== 'undefined';
|
|
708
799
|
var isDocumentDefined = typeof document !== 'undefined';
|
|
709
800
|
if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
|
|
@@ -881,7 +972,6 @@ var postOnCheckout = function postOnCheckout(data, accessToken, freeTicket) {
|
|
|
881
972
|
delete data.attributes.city;
|
|
882
973
|
delete data.attributes.country;
|
|
883
974
|
delete data.attributes.state;
|
|
884
|
-
delete data.attributes.zip;
|
|
885
975
|
delete data.attributes.street_address;
|
|
886
976
|
}
|
|
887
977
|
var res = publicRequest.post("v1/on-checkout/", {
|
|
@@ -1408,9 +1498,9 @@ function isFalsy(item) {
|
|
|
1408
1498
|
try {
|
|
1409
1499
|
if (!item ||
|
|
1410
1500
|
// handles most, like false, 0, null, etc
|
|
1411
|
-
typeof item
|
|
1501
|
+
typeof item === 'object' && Object.keys(item).length === 0 &&
|
|
1412
1502
|
// for empty objects, like {}, []
|
|
1413
|
-
!(typeof item.addEventListener
|
|
1503
|
+
!(typeof item.addEventListener === 'function') // omit webpage elements
|
|
1414
1504
|
) {
|
|
1415
1505
|
return true;
|
|
1416
1506
|
}
|
|
@@ -1487,7 +1577,8 @@ var CustomField = function CustomField(_ref2) {
|
|
|
1487
1577
|
_ref2$multiline = _ref2.multiline,
|
|
1488
1578
|
multiline = _ref2$multiline === void 0 ? false : _ref2$multiline,
|
|
1489
1579
|
minRows = _ref2.minRows,
|
|
1490
|
-
maxRows = _ref2.maxRows
|
|
1580
|
+
maxRows = _ref2.maxRows,
|
|
1581
|
+
disabled = _ref2.disabled;
|
|
1491
1582
|
var _useState = useState(Boolean(field.value)),
|
|
1492
1583
|
isShrinked = _useState[0],
|
|
1493
1584
|
setIsShrinked = _useState[1];
|
|
@@ -1508,6 +1599,7 @@ var CustomField = function CustomField(_ref2) {
|
|
|
1508
1599
|
}
|
|
1509
1600
|
});
|
|
1510
1601
|
return React.createElement(TextField, Object.assign({
|
|
1602
|
+
disabled: disabled,
|
|
1511
1603
|
placeholder: "",
|
|
1512
1604
|
id: field.name,
|
|
1513
1605
|
label: label,
|
|
@@ -2303,107 +2395,6 @@ var Loader = function Loader() {
|
|
|
2303
2395
|
}, React.createElement(CircularProgress$1, null));
|
|
2304
2396
|
};
|
|
2305
2397
|
|
|
2306
|
-
var NativeSelectField = function NativeSelectField(_ref) {
|
|
2307
|
-
var label = _ref.label,
|
|
2308
|
-
_ref$type = _ref.type,
|
|
2309
|
-
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
2310
|
-
field = _ref.field,
|
|
2311
|
-
_ref$selectOptions = _ref.selectOptions,
|
|
2312
|
-
selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
|
|
2313
|
-
_ref$form = _ref.form,
|
|
2314
|
-
touched = _ref$form.touched,
|
|
2315
|
-
errors = _ref$form.errors,
|
|
2316
|
-
setFieldValue = _ref$form.setFieldValue,
|
|
2317
|
-
theme = _ref.theme,
|
|
2318
|
-
_ref$onChange = _ref.onChange,
|
|
2319
|
-
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange;
|
|
2320
|
-
var isTouched = Boolean(_get(touched, field.name));
|
|
2321
|
-
var error = _get(errors, field.name);
|
|
2322
|
-
var customTheme = useTheme();
|
|
2323
|
-
return React.createElement(FormControl, {
|
|
2324
|
-
fullWidth: true
|
|
2325
|
-
}, React.createElement(InputLabel, {
|
|
2326
|
-
style: customTheme == null ? void 0 : customTheme.input,
|
|
2327
|
-
htmlFor: field.name,
|
|
2328
|
-
error: !!error && isTouched,
|
|
2329
|
-
shrink: true
|
|
2330
|
-
}, label), React.createElement(Select, Object.assign({
|
|
2331
|
-
id: field.name,
|
|
2332
|
-
label: label,
|
|
2333
|
-
type: type,
|
|
2334
|
-
fullWidth: true,
|
|
2335
|
-
error: !!error && isTouched,
|
|
2336
|
-
inputProps: {
|
|
2337
|
-
id: field.name
|
|
2338
|
-
},
|
|
2339
|
-
"native": true,
|
|
2340
|
-
className: theme,
|
|
2341
|
-
MenuProps: {
|
|
2342
|
-
className: theme
|
|
2343
|
-
}
|
|
2344
|
-
}, field, {
|
|
2345
|
-
style: customTheme == null ? void 0 : customTheme.input,
|
|
2346
|
-
onChange: function onChange(e) {
|
|
2347
|
-
_onChange(e);
|
|
2348
|
-
setFieldValue(field.name, e.target.value);
|
|
2349
|
-
}
|
|
2350
|
-
}), _map(selectOptions, function (option) {
|
|
2351
|
-
return React.createElement("option", {
|
|
2352
|
-
key: option.value,
|
|
2353
|
-
value: option.value,
|
|
2354
|
-
disabled: option.disabled
|
|
2355
|
-
}, option.label);
|
|
2356
|
-
})), isTouched && error ? React.createElement(FormHelperText, {
|
|
2357
|
-
error: !!error && isTouched
|
|
2358
|
-
}, error) : null);
|
|
2359
|
-
};
|
|
2360
|
-
|
|
2361
|
-
var RadioGroupField = function RadioGroupField(_ref) {
|
|
2362
|
-
var label = _ref.label,
|
|
2363
|
-
field = _ref.field,
|
|
2364
|
-
radios = _ref.radios,
|
|
2365
|
-
disabled = _ref.disabled,
|
|
2366
|
-
_ref$form = _ref.form,
|
|
2367
|
-
touched = _ref$form.touched,
|
|
2368
|
-
errors = _ref$form.errors,
|
|
2369
|
-
setFieldValue = _ref$form.setFieldValue,
|
|
2370
|
-
_ref$onChange = _ref.onChange,
|
|
2371
|
-
onChange = _ref$onChange === void 0 ? _identity : _ref$onChange;
|
|
2372
|
-
var radioId = "radio-" + field.name;
|
|
2373
|
-
var error = _get(errors, field.name);
|
|
2374
|
-
var isTouched = Boolean(_get(touched, field.name));
|
|
2375
|
-
var handleChange = function handleChange(e) {
|
|
2376
|
-
var value = e.target.value;
|
|
2377
|
-
setFieldValue(field.name, value);
|
|
2378
|
-
onChange(e);
|
|
2379
|
-
};
|
|
2380
|
-
if (!radios) return null;
|
|
2381
|
-
return React.createElement(FormControl$1, {
|
|
2382
|
-
disabled: disabled,
|
|
2383
|
-
error: isTouched && Boolean(error)
|
|
2384
|
-
}, isTouched && Boolean(error) ? React.createElement(FormHelperText$1, {
|
|
2385
|
-
className: "radio-error",
|
|
2386
|
-
error: true
|
|
2387
|
-
}, error) : null, label && React.createElement(FormLabel, {
|
|
2388
|
-
id: radioId
|
|
2389
|
-
}, label), React.createElement(RadioGroup, {
|
|
2390
|
-
"aria-labelledby": radioId,
|
|
2391
|
-
name: field.name,
|
|
2392
|
-
value: field.value,
|
|
2393
|
-
onChange: handleChange
|
|
2394
|
-
}, radios.map(function (radio) {
|
|
2395
|
-
var id = radio.id,
|
|
2396
|
-
label = radio.label,
|
|
2397
|
-
value = radio.value;
|
|
2398
|
-
return React.createElement(FormControlLabel, {
|
|
2399
|
-
key: id,
|
|
2400
|
-
label: label,
|
|
2401
|
-
value: value,
|
|
2402
|
-
control: React.createElement(Radio, null)
|
|
2403
|
-
});
|
|
2404
|
-
})));
|
|
2405
|
-
};
|
|
2406
|
-
|
|
2407
2398
|
function SelectField(_ref) {
|
|
2408
2399
|
var label = _ref.label,
|
|
2409
2400
|
isMultiple = _ref.isMultiple,
|
|
@@ -2462,7 +2453,7 @@ function SelectField(_ref) {
|
|
|
2462
2453
|
sx: {
|
|
2463
2454
|
textAlign: 'start'
|
|
2464
2455
|
}
|
|
2465
|
-
}, options.map(function (option) {
|
|
2456
|
+
}, options == null ? void 0 : options.map(function (option) {
|
|
2466
2457
|
return React.createElement(MenuItem, {
|
|
2467
2458
|
key: option.label,
|
|
2468
2459
|
value: option.value
|
|
@@ -2565,93 +2556,194 @@ var DatePickerField = function DatePickerField(_ref) {
|
|
|
2565
2556
|
})));
|
|
2566
2557
|
};
|
|
2567
2558
|
|
|
2568
|
-
var
|
|
2569
|
-
var
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
})
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
};
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
}
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2559
|
+
var NativeSelectField = function NativeSelectField(_ref) {
|
|
2560
|
+
var label = _ref.label,
|
|
2561
|
+
_ref$type = _ref.type,
|
|
2562
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
2563
|
+
field = _ref.field,
|
|
2564
|
+
_ref$selectOptions = _ref.selectOptions,
|
|
2565
|
+
selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
|
|
2566
|
+
_ref$form = _ref.form,
|
|
2567
|
+
touched = _ref$form.touched,
|
|
2568
|
+
errors = _ref$form.errors,
|
|
2569
|
+
setFieldValue = _ref$form.setFieldValue,
|
|
2570
|
+
theme = _ref.theme,
|
|
2571
|
+
_ref$onChange = _ref.onChange,
|
|
2572
|
+
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange;
|
|
2573
|
+
var isTouched = Boolean(_get(touched, field.name));
|
|
2574
|
+
var error = _get(errors, field.name);
|
|
2575
|
+
var customTheme = useTheme();
|
|
2576
|
+
return React.createElement(FormControl, {
|
|
2577
|
+
fullWidth: true
|
|
2578
|
+
}, React.createElement(InputLabel, {
|
|
2579
|
+
style: customTheme == null ? void 0 : customTheme.input,
|
|
2580
|
+
htmlFor: field.name,
|
|
2581
|
+
error: !!error && isTouched,
|
|
2582
|
+
shrink: true
|
|
2583
|
+
}, label), React.createElement(Select, Object.assign({
|
|
2584
|
+
id: field.name,
|
|
2585
|
+
label: label,
|
|
2586
|
+
type: type,
|
|
2587
|
+
fullWidth: true,
|
|
2588
|
+
error: !!error && isTouched,
|
|
2589
|
+
inputProps: {
|
|
2590
|
+
id: field.name
|
|
2591
|
+
},
|
|
2592
|
+
"native": true,
|
|
2593
|
+
className: theme,
|
|
2594
|
+
MenuProps: {
|
|
2595
|
+
className: theme
|
|
2596
|
+
}
|
|
2597
|
+
}, field, {
|
|
2598
|
+
style: customTheme == null ? void 0 : customTheme.input,
|
|
2599
|
+
onChange: function onChange(e) {
|
|
2600
|
+
_onChange(e);
|
|
2601
|
+
setFieldValue(field.name, e.target.value);
|
|
2602
|
+
}
|
|
2603
|
+
}), _map(selectOptions, function (option) {
|
|
2604
|
+
return React.createElement("option", {
|
|
2605
|
+
key: option.value,
|
|
2606
|
+
value: option.value,
|
|
2607
|
+
disabled: option.disabled
|
|
2608
|
+
}, option.label);
|
|
2609
|
+
})), isTouched && error ? React.createElement(FormHelperText, {
|
|
2610
|
+
error: !!error && isTouched
|
|
2611
|
+
}, error) : null);
|
|
2612
|
+
};
|
|
2613
|
+
|
|
2614
|
+
var RadioGroupField = function RadioGroupField(_ref) {
|
|
2615
|
+
var label = _ref.label,
|
|
2616
|
+
field = _ref.field,
|
|
2617
|
+
radios = _ref.radios,
|
|
2618
|
+
disabled = _ref.disabled,
|
|
2619
|
+
_ref$form = _ref.form,
|
|
2620
|
+
touched = _ref$form.touched,
|
|
2621
|
+
errors = _ref$form.errors,
|
|
2622
|
+
setFieldValue = _ref$form.setFieldValue,
|
|
2623
|
+
_ref$onChange = _ref.onChange,
|
|
2624
|
+
onChange = _ref$onChange === void 0 ? _identity : _ref$onChange;
|
|
2625
|
+
var radioId = "radio-" + field.name;
|
|
2626
|
+
var error = _get(errors, field.name);
|
|
2627
|
+
var isTouched = Boolean(_get(touched, field.name));
|
|
2628
|
+
var handleChange = function handleChange(e) {
|
|
2629
|
+
var value = e.target.value;
|
|
2630
|
+
setFieldValue(field.name, value);
|
|
2631
|
+
onChange(e);
|
|
2632
|
+
};
|
|
2633
|
+
if (!radios) return null;
|
|
2634
|
+
return React.createElement(FormControl$1, {
|
|
2635
|
+
disabled: disabled,
|
|
2636
|
+
error: isTouched && Boolean(error)
|
|
2637
|
+
}, isTouched && Boolean(error) ? React.createElement(FormHelperText$1, {
|
|
2638
|
+
className: "radio-error",
|
|
2639
|
+
error: true
|
|
2640
|
+
}, error) : null, label && React.createElement(FormLabel, {
|
|
2641
|
+
id: radioId
|
|
2642
|
+
}, label), React.createElement(RadioGroup, {
|
|
2643
|
+
"aria-labelledby": radioId,
|
|
2644
|
+
name: field.name,
|
|
2645
|
+
value: field.value,
|
|
2646
|
+
onChange: handleChange
|
|
2647
|
+
}, radios.map(function (radio) {
|
|
2648
|
+
var id = radio.id,
|
|
2649
|
+
label = radio.label,
|
|
2650
|
+
value = radio.value;
|
|
2651
|
+
return React.createElement(FormControlLabel, {
|
|
2652
|
+
key: id,
|
|
2653
|
+
label: label,
|
|
2654
|
+
value: value,
|
|
2655
|
+
control: React.createElement(Radio, null)
|
|
2656
|
+
});
|
|
2657
|
+
})));
|
|
2658
|
+
};
|
|
2659
|
+
|
|
2660
|
+
var _excluded$1 = ["firstName", "lastName", "holderAge", "confirmEmail", "confirmPassword"];
|
|
2661
|
+
var getInitialValues = function getInitialValues(data, propsInitialValues, userValues) {
|
|
2662
|
+
if (data === void 0) {
|
|
2663
|
+
data = [];
|
|
2664
|
+
}
|
|
2665
|
+
if (propsInitialValues === void 0) {
|
|
2666
|
+
propsInitialValues = {};
|
|
2667
|
+
}
|
|
2668
|
+
if (userValues === void 0) {
|
|
2669
|
+
userValues = {};
|
|
2670
|
+
}
|
|
2671
|
+
var results = _flatMapDeep(data, function (_ref) {
|
|
2672
|
+
var fields = _ref.fields;
|
|
2673
|
+
return _map(fields, function (_ref2) {
|
|
2674
|
+
var groupItems = _ref2.groupItems;
|
|
2675
|
+
return _map(groupItems, function (_ref3) {
|
|
2676
|
+
var name = _ref3.name,
|
|
2677
|
+
value = _ref3.value;
|
|
2678
|
+
return {
|
|
2679
|
+
name: name,
|
|
2680
|
+
value: value
|
|
2681
|
+
};
|
|
2682
|
+
});
|
|
2683
|
+
});
|
|
2684
|
+
});
|
|
2685
|
+
var initialValues = {};
|
|
2686
|
+
_forEach(results, function (groupItem) {
|
|
2687
|
+
var name = groupItem.name,
|
|
2688
|
+
value = groupItem.value;
|
|
2689
|
+
initialValues[name] = value || propsInitialValues[name] || userValues[name] || '';
|
|
2690
|
+
});
|
|
2691
|
+
// set logged in user as first ticket holder
|
|
2692
|
+
initialValues['holderFirstName-0'] = propsInitialValues.firstName || userValues.firstName || '';
|
|
2693
|
+
initialValues['holderLastName-0'] = propsInitialValues.lastName || userValues.lastName || '';
|
|
2694
|
+
initialValues['holderEmail-0'] = propsInitialValues.email || userValues.email || '';
|
|
2695
|
+
return initialValues;
|
|
2696
|
+
};
|
|
2697
|
+
var createRegisterFormData = function createRegisterFormData(values, checkoutBody, flagFreeTicket) {
|
|
2698
|
+
if (values === void 0) {
|
|
2699
|
+
values = {};
|
|
2700
|
+
}
|
|
2701
|
+
if (flagFreeTicket === void 0) {
|
|
2702
|
+
flagFreeTicket = false;
|
|
2703
|
+
}
|
|
2704
|
+
var bodyFormData = new FormData();
|
|
2705
|
+
bodyFormData.append('first_name', values.firstName);
|
|
2706
|
+
bodyFormData.append('last_name', values.lastName);
|
|
2707
|
+
bodyFormData.append('email', values.email);
|
|
2708
|
+
bodyFormData.append('password', values.password);
|
|
2709
|
+
bodyFormData.append('password_confirmation', values.confirmPassword);
|
|
2710
|
+
bodyFormData.append('client_id', CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf');
|
|
2711
|
+
bodyFormData.append('client_secret', CONFIGS.CLIENT_SECRET || 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9');
|
|
2712
|
+
bodyFormData.append('check_cart_expiration', 'true');
|
|
2713
|
+
_forEach(checkoutBody.attributes, function (item, key) {
|
|
2714
|
+
if (!(flagFreeTicket && ['country', 'state', 'city', 'street_address'].includes(key))) {
|
|
2715
|
+
bodyFormData.append(key, item);
|
|
2716
|
+
}
|
|
2717
|
+
});
|
|
2718
|
+
return bodyFormData;
|
|
2719
|
+
};
|
|
2720
|
+
var setLoggedUserData$2 = function setLoggedUserData(data) {
|
|
2721
|
+
return {
|
|
2722
|
+
id: data.id,
|
|
2723
|
+
first_name: data.firstName,
|
|
2724
|
+
last_name: data.lastName,
|
|
2725
|
+
email: data.email,
|
|
2726
|
+
confirmEmail: data.email,
|
|
2727
|
+
city: (data == null ? void 0 : data.city) || '',
|
|
2728
|
+
country: (data == null ? void 0 : data.countryId) || (data == null ? void 0 : data.country) || '',
|
|
2729
|
+
phone: (data == null ? void 0 : data.phone) || '',
|
|
2730
|
+
street_address: (data == null ? void 0 : data.streetAddress) || '',
|
|
2731
|
+
state: (data == null ? void 0 : data.stateId) || '',
|
|
2732
|
+
zip: (data == null ? void 0 : data.zip) || (data == null ? void 0 : data.zipCode) || ''
|
|
2733
|
+
};
|
|
2734
|
+
};
|
|
2735
|
+
var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, values, logedInValues, includeDob) {
|
|
2736
|
+
if (values === void 0) {
|
|
2737
|
+
values = {};
|
|
2738
|
+
}
|
|
2739
|
+
if (logedInValues === void 0) {
|
|
2740
|
+
logedInValues = {};
|
|
2741
|
+
}
|
|
2742
|
+
if (includeDob === void 0) {
|
|
2743
|
+
includeDob = false;
|
|
2744
|
+
}
|
|
2745
|
+
var _values = values,
|
|
2746
|
+
firstName = _values.firstName,
|
|
2655
2747
|
lastName = _values.lastName,
|
|
2656
2748
|
holderAge = _values.holderAge,
|
|
2657
2749
|
restValues = _objectWithoutPropertiesLoose(_values, _excluded$1);
|
|
@@ -8215,75 +8307,1125 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
8215
8307
|
}));
|
|
8216
8308
|
};
|
|
8217
8309
|
|
|
8218
|
-
var
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8310
|
+
var setLoggedUserData$3 = function setLoggedUserData(data) {
|
|
8311
|
+
return {
|
|
8312
|
+
id: data.id,
|
|
8313
|
+
first_name: data.firstName,
|
|
8314
|
+
last_name: data.lastName,
|
|
8315
|
+
email: data.email,
|
|
8316
|
+
confirmEmail: data.email,
|
|
8317
|
+
city: (data == null ? void 0 : data.city) || '',
|
|
8318
|
+
country: (data == null ? void 0 : data.countryId) || (data == null ? void 0 : data.country) || '',
|
|
8319
|
+
phone: (data == null ? void 0 : data.phone) || '',
|
|
8320
|
+
street_address: (data == null ? void 0 : data.streetAddress) || '',
|
|
8321
|
+
state: (data == null ? void 0 : data.stateId) || '',
|
|
8322
|
+
zip: (data == null ? void 0 : data.zip) || (data == null ? void 0 : data.zipCode) || ''
|
|
8323
|
+
};
|
|
8324
|
+
};
|
|
8325
|
+
var LoginForm = function LoginForm(_ref) {
|
|
8326
|
+
var _ref$alreadyHasUser = _ref.alreadyHasUser,
|
|
8327
|
+
alreadyHasUser = _ref$alreadyHasUser === void 0 ? false : _ref$alreadyHasUser,
|
|
8328
|
+
_ref$userExpired = _ref.userExpired,
|
|
8329
|
+
userExpired = _ref$userExpired === void 0 ? false : _ref$userExpired,
|
|
8330
|
+
_ref$onLoginSuccess = _ref.onLoginSuccess,
|
|
8331
|
+
onLoginSuccess = _ref$onLoginSuccess === void 0 ? _identity : _ref$onLoginSuccess,
|
|
8332
|
+
_ref$onLoginError = _ref.onLoginError,
|
|
8333
|
+
onLoginError = _ref$onLoginError === void 0 ? _identity : _ref$onLoginError,
|
|
8334
|
+
_ref$onGetProfileData = _ref.onGetProfileDataSuccess,
|
|
8335
|
+
onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? _identity : _ref$onGetProfileData,
|
|
8336
|
+
_ref$onGetProfileData2 = _ref.onGetProfileDataError,
|
|
8337
|
+
onGetProfileDataError = _ref$onGetProfileData2 === void 0 ? _identity : _ref$onGetProfileData2,
|
|
8338
|
+
_ref$onForgotPassword = _ref.onForgotPasswordButtonClick,
|
|
8339
|
+
onForgotPasswordButtonClick = _ref$onForgotPassword === void 0 ? _identity : _ref$onForgotPassword,
|
|
8340
|
+
_ref$onSignupButtonCl = _ref.onSignupButtonClick,
|
|
8341
|
+
onSignupButtonClick = _ref$onSignupButtonCl === void 0 ? _identity : _ref$onSignupButtonCl,
|
|
8342
|
+
logo = _ref.logo,
|
|
8343
|
+
_ref$showForgotPasswo = _ref.showForgotPasswordButton,
|
|
8344
|
+
showForgotPasswordButton = _ref$showForgotPasswo === void 0 ? false : _ref$showForgotPasswo,
|
|
8345
|
+
_ref$showSignUpButton = _ref.showSignUpButton,
|
|
8346
|
+
showSignUpButton = _ref$showSignUpButton === void 0 ? false : _ref$showSignUpButton;
|
|
8347
|
+
var _useState = useState(''),
|
|
8348
|
+
error = _useState[0],
|
|
8349
|
+
setError = _useState[1];
|
|
8350
|
+
return React.createElement("div", {
|
|
8351
|
+
className: 'login-modal'
|
|
8352
|
+
}, React.createElement(Formik, {
|
|
8353
|
+
initialValues: {
|
|
8354
|
+
email: '',
|
|
8355
|
+
password: ''
|
|
8356
|
+
},
|
|
8357
|
+
onSubmit: function () {
|
|
8358
|
+
var _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
8359
|
+
var email, password, body, authRes, profileResponse, profileSpecifiedData, profileDataObj, event, _e$response, _e$response$data, _error;
|
|
8360
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8361
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8362
|
+
case 0:
|
|
8363
|
+
email = _ref2.email, password = _ref2.password;
|
|
8364
|
+
_context.prev = 1;
|
|
8365
|
+
body = {
|
|
8366
|
+
email: email,
|
|
8367
|
+
password: password
|
|
8368
|
+
};
|
|
8369
|
+
_context.next = 5;
|
|
8370
|
+
return authorize(body);
|
|
8371
|
+
case 5:
|
|
8372
|
+
authRes = _context.sent;
|
|
8373
|
+
profileResponse = null;
|
|
8374
|
+
_context.prev = 7;
|
|
8375
|
+
_context.next = 10;
|
|
8376
|
+
return getProfileData();
|
|
8377
|
+
case 10:
|
|
8378
|
+
profileResponse = _context.sent;
|
|
8379
|
+
onGetProfileDataSuccess(_get(profileResponse, 'data.data'));
|
|
8380
|
+
_context.next = 18;
|
|
8381
|
+
break;
|
|
8382
|
+
case 14:
|
|
8383
|
+
_context.prev = 14;
|
|
8384
|
+
_context.t0 = _context["catch"](7);
|
|
8385
|
+
if (axios.isAxiosError(_context.t0)) {
|
|
8386
|
+
onGetProfileDataError(_context.t0);
|
|
8387
|
+
}
|
|
8388
|
+
return _context.abrupt("return");
|
|
8389
|
+
case 18:
|
|
8390
|
+
profileSpecifiedData = _get(profileResponse, 'data.data');
|
|
8391
|
+
profileDataObj = setLoggedUserData$3(profileSpecifiedData);
|
|
8392
|
+
if (typeof window !== 'undefined') {
|
|
8393
|
+
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
8394
|
+
event = new window.CustomEvent('tf-login');
|
|
8395
|
+
window.document.dispatchEvent(event);
|
|
8396
|
+
}
|
|
8397
|
+
onLoginSuccess(_get(authRes, 'data.data'));
|
|
8398
|
+
_context.next = 27;
|
|
8399
|
+
break;
|
|
8400
|
+
case 24:
|
|
8401
|
+
_context.prev = 24;
|
|
8402
|
+
_context.t1 = _context["catch"](1);
|
|
8403
|
+
if (axios.isAxiosError(_context.t1)) {
|
|
8404
|
+
_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';
|
|
8405
|
+
setError(_error);
|
|
8406
|
+
onLoginError(_context.t1);
|
|
8407
|
+
} else if (_context.t1 instanceof Error) {
|
|
8408
|
+
setError((_context.t1 == null ? void 0 : _context.t1.message) || 'Error');
|
|
8409
|
+
}
|
|
8410
|
+
case 27:
|
|
8411
|
+
case "end":
|
|
8412
|
+
return _context.stop();
|
|
8413
|
+
}
|
|
8414
|
+
}, _callee, null, [[1, 24], [7, 14]]);
|
|
8415
|
+
}));
|
|
8416
|
+
function onSubmit(_x) {
|
|
8417
|
+
return _onSubmit.apply(this, arguments);
|
|
8418
|
+
}
|
|
8419
|
+
return onSubmit;
|
|
8420
|
+
}()
|
|
8421
|
+
}, function (props) {
|
|
8422
|
+
return React.createElement(Form, {
|
|
8423
|
+
onSubmit: props.handleSubmit
|
|
8424
|
+
}, React.createElement("div", {
|
|
8425
|
+
className: "modal-title"
|
|
8426
|
+
}, "Login"), React.createElement("div", {
|
|
8427
|
+
className: "login-logo-container"
|
|
8428
|
+
}, React.createElement("img", {
|
|
8429
|
+
className: "login-logo-tff",
|
|
8430
|
+
src: logo || 'https://www.ticketfairy.com/resources/images/logo-ttf-black.svg',
|
|
8431
|
+
alt: "logo"
|
|
8432
|
+
})), React.createElement("div", {
|
|
8433
|
+
className: "server_auth__error"
|
|
8434
|
+
}, error), alreadyHasUser && React.createElement("p", {
|
|
8435
|
+
className: "info-text-for-login"
|
|
8436
|
+
}, "It appears this email is already attached to an account. Please log in here to complete your registration."), userExpired && React.createElement("p", {
|
|
8437
|
+
className: "info-text-for-login"
|
|
8438
|
+
}, "Your session has expired, please log in again."), React.createElement("div", {
|
|
8439
|
+
className: "login-modal-body"
|
|
8440
|
+
}, React.createElement("div", {
|
|
8441
|
+
className: "login-modal-body__email"
|
|
8442
|
+
}, React.createElement(Field, {
|
|
8443
|
+
name: "email",
|
|
8444
|
+
label: "Email",
|
|
8445
|
+
type: "email",
|
|
8446
|
+
component: CustomField,
|
|
8447
|
+
validate: combineValidators(requiredValidator, emailValidator)
|
|
8448
|
+
})), React.createElement("div", {
|
|
8449
|
+
className: "login-modal-body__password"
|
|
8450
|
+
}, React.createElement(Field, {
|
|
8451
|
+
name: "password",
|
|
8452
|
+
label: "Password",
|
|
8453
|
+
type: "password",
|
|
8454
|
+
component: CustomField,
|
|
8455
|
+
validate: requiredValidator
|
|
8456
|
+
})), React.createElement("div", {
|
|
8457
|
+
className: "login-action-button"
|
|
8458
|
+
}, React.createElement("button", {
|
|
8459
|
+
type: "submit"
|
|
8460
|
+
}, "Login")), showForgotPasswordButton && React.createElement("div", {
|
|
8461
|
+
className: "forgot-password"
|
|
8462
|
+
}, React.createElement("span", {
|
|
8463
|
+
"aria-hidden": "true",
|
|
8464
|
+
onClick: onForgotPasswordButtonClick
|
|
8465
|
+
}, "Forgot password?")), showSignUpButton && React.createElement("div", {
|
|
8466
|
+
className: "forgot-password"
|
|
8467
|
+
}, React.createElement("span", {
|
|
8468
|
+
"aria-hidden": "true",
|
|
8469
|
+
onClick: onSignupButtonClick
|
|
8470
|
+
}, "Sign up"))));
|
|
8471
|
+
}));
|
|
8472
|
+
};
|
|
8473
|
+
|
|
8474
|
+
var getValidateFunctions$1 = function getValidateFunctions(_ref) {
|
|
8475
|
+
var element = _ref.element,
|
|
8476
|
+
values = _ref.values;
|
|
8477
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8478
|
+
var validationFunctions = [];
|
|
8479
|
+
if (element.required) {
|
|
8480
|
+
validationFunctions.push(requiredValidator);
|
|
8481
|
+
}
|
|
8482
|
+
if (element.onValidate) {
|
|
8483
|
+
validationFunctions.push(element.onValidate);
|
|
8484
|
+
}
|
|
8485
|
+
if (element.name === 'confirmEmail') {
|
|
8486
|
+
var isSameEmail = function isSameEmail(confirmEmail) {
|
|
8487
|
+
return values.email !== confirmEmail ? 'Please confirm your email address correctly' : null;
|
|
8488
|
+
};
|
|
8489
|
+
validationFunctions.push(isSameEmail);
|
|
8490
|
+
}
|
|
8491
|
+
if (element.name === 'confirmPassword') {
|
|
8492
|
+
var isSame = function isSame(confirmPassword) {
|
|
8493
|
+
return values.password !== confirmPassword ? 'Password confirmation does not match' : null;
|
|
8494
|
+
};
|
|
8495
|
+
validationFunctions.push(isSame);
|
|
8496
|
+
}
|
|
8497
|
+
return combineValidators.apply(void 0, validationFunctions);
|
|
8498
|
+
};
|
|
8499
|
+
var updateFormFieldsAttributes = function updateFormFieldsAttributes(formFields, attributes) {
|
|
8500
|
+
if (attributes && !_isEmpty(attributes)) {
|
|
8501
|
+
var updatedFormFields = _map(formFields, function (fieldSection) {
|
|
8502
|
+
var fieldSectionAttributes = attributes[fieldSection.name] || {};
|
|
8503
|
+
var updatedFields = _map(fieldSection.fields, function (fieldItem) {
|
|
8504
|
+
var fieldItemAttributes = attributes[fieldItem.name] || {};
|
|
8505
|
+
return _extends({}, fieldItem, fieldItemAttributes);
|
|
8506
|
+
});
|
|
8507
|
+
return _extends({}, fieldSection, fieldSectionAttributes, {
|
|
8508
|
+
fields: updatedFields
|
|
8509
|
+
});
|
|
8510
|
+
});
|
|
8511
|
+
return updatedFormFields;
|
|
8512
|
+
}
|
|
8513
|
+
return formFields;
|
|
8514
|
+
};
|
|
8515
|
+
var getFieldClassNames = function getFieldClassNames(id, existingClassNames) {
|
|
8516
|
+
if (isBrowser) {
|
|
8517
|
+
var _elem$parentElement;
|
|
8518
|
+
var elem = document && document.getElementById(id);
|
|
8519
|
+
if (((elem == null ? void 0 : (_elem$parentElement = elem.parentElement) == null ? void 0 : _elem$parentElement.clientWidth) || 0) < 375) {
|
|
8520
|
+
return existingClassNames + ' full-width';
|
|
8521
|
+
}
|
|
8522
|
+
}
|
|
8523
|
+
return existingClassNames;
|
|
8524
|
+
};
|
|
8525
|
+
var insertHTML = function insertHTML(elementId, text) {
|
|
8526
|
+
if (text === void 0) {
|
|
8527
|
+
text = '';
|
|
8528
|
+
}
|
|
8529
|
+
if (isBrowser) {
|
|
8530
|
+
var elem = document && document.getElementById(elementId);
|
|
8531
|
+
if (!(elem != null && elem.childNodes.length)) {
|
|
8532
|
+
elem == null ? void 0 : elem.insertAdjacentHTML('afterbegin', text);
|
|
8533
|
+
}
|
|
8534
|
+
}
|
|
8535
|
+
return null;
|
|
8536
|
+
};
|
|
8537
|
+
|
|
8538
|
+
var SectionContainer = function SectionContainer(_ref) {
|
|
8539
|
+
var children = _ref.children,
|
|
8540
|
+
className = _ref.className;
|
|
8541
|
+
return React.createElement("div", {
|
|
8542
|
+
className: className
|
|
8543
|
+
}, children);
|
|
8544
|
+
};
|
|
8545
|
+
var FieldsSection = function FieldsSection(_ref2) {
|
|
8546
|
+
var _ref2$formFields = _ref2.formFields,
|
|
8547
|
+
formFields = _ref2$formFields === void 0 ? [] : _ref2$formFields,
|
|
8548
|
+
_ref2$countries = _ref2.countries,
|
|
8549
|
+
countries = _ref2$countries === void 0 ? [] : _ref2$countries,
|
|
8550
|
+
_ref2$states = _ref2.states,
|
|
8551
|
+
states = _ref2$states === void 0 ? [] : _ref2$states,
|
|
8552
|
+
values = _ref2.values,
|
|
8553
|
+
setFieldValue = _ref2.setFieldValue,
|
|
8554
|
+
theme = _ref2.theme,
|
|
8555
|
+
_ref2$containerClass = _ref2.containerClass,
|
|
8556
|
+
containerClass = _ref2$containerClass === void 0 ? '' : _ref2$containerClass,
|
|
8557
|
+
_ref2$setPhoneValidat = _ref2.setPhoneValidationIsLoading,
|
|
8558
|
+
setPhoneValidationIsLoading = _ref2$setPhoneValidat === void 0 ? _identity : _ref2$setPhoneValidat,
|
|
8559
|
+
_ref2$onFieldChange = _ref2.onFieldChange,
|
|
8560
|
+
onFieldChange = _ref2$onFieldChange === void 0 ? _identity : _ref2$onFieldChange,
|
|
8561
|
+
disableField = _ref2.disableField;
|
|
8562
|
+
return React.createElement(React.Fragment, null, _map(formFields, function (item, index) {
|
|
8563
|
+
var name = item.name,
|
|
8564
|
+
groupLabel = item.groupLabel,
|
|
8565
|
+
_item$groupLabelVars = item.groupLabelVars,
|
|
8566
|
+
groupLabelVars = _item$groupLabelVars === void 0 ? [] : _item$groupLabelVars,
|
|
8567
|
+
groupLabelClassName = item.groupLabelClassName,
|
|
8568
|
+
_item$groupClassName = item.groupClassName,
|
|
8569
|
+
groupClassName = _item$groupClassName === void 0 ? '' : _item$groupClassName,
|
|
8570
|
+
fields = item.fields;
|
|
8571
|
+
return React.createElement(SectionContainer, {
|
|
8572
|
+
key: name,
|
|
8573
|
+
className: groupClassName
|
|
8574
|
+
}, React.createElement("span", {
|
|
8575
|
+
id: "group_label_" + index,
|
|
8576
|
+
className: groupLabelClassName
|
|
8577
|
+
}, typeof groupLabel === 'string' ? insertHTML("group_label_" + index, replaceVarInString(groupLabel, groupLabelVars)) : groupLabel), React.createElement("div", {
|
|
8578
|
+
className: "fields-container " + groupClassName
|
|
8579
|
+
}, _map(fields, function (fieldData, fieldIndex) {
|
|
8580
|
+
var name = fieldData.name,
|
|
8581
|
+
label = fieldData.label,
|
|
8582
|
+
_fieldData$className = fieldData.className,
|
|
8583
|
+
className = _fieldData$className === void 0 ? 'full-width' : _fieldData$className,
|
|
8584
|
+
type = fieldData.type,
|
|
8585
|
+
component = fieldData.component,
|
|
8586
|
+
_fieldData$options = fieldData.options,
|
|
8587
|
+
options = _fieldData$options === void 0 ? [] : _fieldData$options,
|
|
8588
|
+
required = fieldData.required;
|
|
8589
|
+
var id = name + "-" + fieldIndex;
|
|
8590
|
+
var classNames = containerClass + "-container__field " + className;
|
|
8591
|
+
return component || React.createElement("div", {
|
|
8592
|
+
key: name,
|
|
8593
|
+
id: id,
|
|
8594
|
+
className: getFieldClassNames(id, classNames)
|
|
8595
|
+
}, React.createElement(Field, {
|
|
8596
|
+
disabled: name === disableField || name === 'state' && !states.length,
|
|
8597
|
+
name: name,
|
|
8598
|
+
label: "" + label + (required ? '' : ' (optional)'),
|
|
8599
|
+
type: type,
|
|
8600
|
+
validate: name === 'state' && !states.length ? false : getValidateFunctions$1({
|
|
8601
|
+
element: fieldData,
|
|
8602
|
+
values: values
|
|
8603
|
+
}),
|
|
8604
|
+
setFieldValue: setFieldValue,
|
|
8605
|
+
component: type === 'checkbox' ? CheckboxField : type === 'select' ? SelectField : type === 'phone' ? PhoneNumberField : type === 'date' ? DatePickerField : CustomField,
|
|
8606
|
+
options: name === 'country' ? countries : name === 'state' ? states : options,
|
|
8607
|
+
theme: theme,
|
|
8608
|
+
setPhoneValidationIsLoading: type === 'phone' ? setPhoneValidationIsLoading : undefined,
|
|
8609
|
+
onChange: function onChange(e) {
|
|
8610
|
+
var element = e.target;
|
|
8611
|
+
var value = element.value;
|
|
8612
|
+
setFieldValue(name, value);
|
|
8613
|
+
onFieldChange(name, value);
|
|
8614
|
+
},
|
|
8615
|
+
disableDropdown: fieldData.disableDropdown
|
|
8616
|
+
}));
|
|
8617
|
+
})));
|
|
8618
|
+
}));
|
|
8619
|
+
};
|
|
8620
|
+
|
|
8621
|
+
var collectStates = function collectStates(states) {
|
|
8622
|
+
var mappedStates = _map(states, function (item, key) {
|
|
8623
|
+
return {
|
|
8624
|
+
label: item,
|
|
8625
|
+
value: key
|
|
8626
|
+
};
|
|
8627
|
+
});
|
|
8628
|
+
return mappedStates;
|
|
8629
|
+
};
|
|
8630
|
+
|
|
8631
|
+
var formDefaultFields = [{
|
|
8632
|
+
name: 'basic-info',
|
|
8633
|
+
groupLabel: 'Create your account.',
|
|
8634
|
+
groupLabelClassName: '',
|
|
8635
|
+
groupClassName: '',
|
|
8636
|
+
fields: [{
|
|
8637
|
+
className: 'half-width',
|
|
8638
|
+
name: 'firstName',
|
|
8639
|
+
label: 'First Name',
|
|
8640
|
+
type: 'text',
|
|
8641
|
+
required: true,
|
|
8642
|
+
onValidate: null
|
|
8643
|
+
}, {
|
|
8644
|
+
className: 'half-width',
|
|
8645
|
+
name: 'lastName',
|
|
8646
|
+
label: 'Last Name',
|
|
8647
|
+
type: 'text',
|
|
8648
|
+
required: true,
|
|
8649
|
+
onValidate: null
|
|
8650
|
+
}, {
|
|
8651
|
+
name: 'email',
|
|
8652
|
+
label: 'Email',
|
|
8653
|
+
type: 'email',
|
|
8654
|
+
required: true,
|
|
8655
|
+
onValidate: null
|
|
8656
|
+
}, {
|
|
8657
|
+
name: 'confirmEmail',
|
|
8658
|
+
label: 'Confirm Email',
|
|
8659
|
+
type: 'email',
|
|
8660
|
+
required: true,
|
|
8661
|
+
onValidate: null
|
|
8662
|
+
}]
|
|
8663
|
+
}, {
|
|
8664
|
+
name: 'billing-info',
|
|
8665
|
+
groupLabel: '',
|
|
8666
|
+
groupLabelClassName: '',
|
|
8667
|
+
groupClassName: '',
|
|
8668
|
+
fields: [{
|
|
8669
|
+
className: 'half-width',
|
|
8670
|
+
name: 'zip',
|
|
8671
|
+
label: 'Post Code/Zip',
|
|
8672
|
+
type: 'text',
|
|
8673
|
+
required: true,
|
|
8674
|
+
onValidate: null
|
|
8675
|
+
}, {
|
|
8676
|
+
className: 'half-width',
|
|
8677
|
+
name: 'country',
|
|
8678
|
+
label: 'Country',
|
|
8679
|
+
type: 'select',
|
|
8680
|
+
required: true,
|
|
8681
|
+
onValidate: null
|
|
8682
|
+
}]
|
|
8683
|
+
}, {
|
|
8684
|
+
name: 'password-info',
|
|
8685
|
+
groupLabel: /*#__PURE__*/React.createElement("div", {
|
|
8686
|
+
className: "email-info-block"
|
|
8687
|
+
}, /*#__PURE__*/React.createElement("span", null, "Choose a password for your new"), /*#__PURE__*/React.createElement("b", null, " Mana Common "), /*#__PURE__*/React.createElement("span", null, "account")),
|
|
8688
|
+
groupLabelClassName: '',
|
|
8689
|
+
groupClassName: '',
|
|
8690
|
+
fields: [{
|
|
8691
|
+
className: 'half-width',
|
|
8692
|
+
name: 'password',
|
|
8693
|
+
label: 'Password',
|
|
8694
|
+
type: 'password',
|
|
8695
|
+
required: true,
|
|
8696
|
+
onValidate: null
|
|
8697
|
+
}, {
|
|
8698
|
+
className: 'half-width',
|
|
8699
|
+
name: 'confirmPassword',
|
|
8700
|
+
label: 'Confirm Password',
|
|
8701
|
+
type: 'password',
|
|
8702
|
+
required: true,
|
|
8703
|
+
onValidate: null
|
|
8704
|
+
}]
|
|
8705
|
+
}];
|
|
8706
|
+
|
|
8707
|
+
var RegistrationForm = function RegistrationForm(_ref) {
|
|
8708
|
+
var formFields = _ref.formFields,
|
|
8709
|
+
additionalFieldAttribute = _ref.additionalFieldAttribute,
|
|
8710
|
+
registrationType = _ref.registrationType,
|
|
8711
|
+
customerEmail = _ref.customerEmail,
|
|
8712
|
+
_ref$onGetCountriesSu = _ref.onGetCountriesSuccess,
|
|
8713
|
+
onGetCountriesSuccess = _ref$onGetCountriesSu === void 0 ? _identity : _ref$onGetCountriesSu,
|
|
8714
|
+
_ref$onGetCountriesEr = _ref.onGetCountriesError,
|
|
8715
|
+
onGetCountriesError = _ref$onGetCountriesEr === void 0 ? _identity : _ref$onGetCountriesEr,
|
|
8716
|
+
_ref$onRegisterAccoun = _ref.onRegisterAccountSuccess,
|
|
8717
|
+
onRegisterAccountSuccess = _ref$onRegisterAccoun === void 0 ? _identity : _ref$onRegisterAccoun,
|
|
8718
|
+
_ref$onRegisterAccoun2 = _ref.onRegisterAccountError,
|
|
8719
|
+
onRegisterAccountError = _ref$onRegisterAccoun2 === void 0 ? _identity : _ref$onRegisterAccoun2,
|
|
8720
|
+
_ref$onGetStatesSucce = _ref.onGetStatesSuccess,
|
|
8721
|
+
onGetStatesSuccess = _ref$onGetStatesSucce === void 0 ? _identity : _ref$onGetStatesSucce,
|
|
8722
|
+
_ref$onGetStatesError = _ref.onGetStatesError,
|
|
8723
|
+
onGetStatesError = _ref$onGetStatesError === void 0 ? _identity : _ref$onGetStatesError;
|
|
8724
|
+
var _useState = useState(''),
|
|
8725
|
+
errorMessage = _useState[0],
|
|
8726
|
+
setErrorMessage = _useState[1];
|
|
8727
|
+
var _useState2 = useState([]),
|
|
8728
|
+
countries = _useState2[0],
|
|
8729
|
+
setCountries = _useState2[1];
|
|
8730
|
+
var _useState3 = useState([]),
|
|
8731
|
+
states = _useState3[0],
|
|
8732
|
+
setStates = _useState3[1];
|
|
8733
|
+
var _useState4 = useState(false),
|
|
8734
|
+
phoneValidationIsLoading = _useState4[0],
|
|
8735
|
+
setPhoneValidationIsLoading = _useState4[1];
|
|
8736
|
+
var _useState5 = useState(false),
|
|
8737
|
+
showErrorModal = _useState5[0],
|
|
8738
|
+
setshowErrorModal = _useState5[1];
|
|
8739
|
+
var updatedFormFields = updateFormFieldsAttributes(formFields || formDefaultFields, additionalFieldAttribute);
|
|
8740
|
+
// Fetch countries data
|
|
8741
|
+
var fetchCountries = /*#__PURE__*/function () {
|
|
8742
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8743
|
+
var res, _e$response, _e$response$data, _errorMessage;
|
|
8744
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8745
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8746
|
+
case 0:
|
|
8747
|
+
_context.prev = 0;
|
|
8748
|
+
_context.next = 3;
|
|
8749
|
+
return getCountries();
|
|
8750
|
+
case 3:
|
|
8751
|
+
res = _context.sent;
|
|
8752
|
+
setCountries(_map(_get(res, 'data.data'), function (item) {
|
|
8753
|
+
return {
|
|
8754
|
+
label: item.name,
|
|
8755
|
+
value: item.id
|
|
8756
|
+
};
|
|
8757
|
+
}));
|
|
8758
|
+
onGetCountriesSuccess(res.data);
|
|
8759
|
+
_context.next = 11;
|
|
8760
|
+
break;
|
|
8761
|
+
case 8:
|
|
8762
|
+
_context.prev = 8;
|
|
8763
|
+
_context.t0 = _context["catch"](0);
|
|
8764
|
+
if (axios.isAxiosError(_context.t0)) {
|
|
8765
|
+
_errorMessage = (_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';
|
|
8766
|
+
setErrorMessage(_errorMessage);
|
|
8767
|
+
onGetCountriesError(_context.t0);
|
|
8768
|
+
}
|
|
8769
|
+
case 11:
|
|
8770
|
+
case "end":
|
|
8771
|
+
return _context.stop();
|
|
8772
|
+
}
|
|
8773
|
+
}, _callee, null, [[0, 8]]);
|
|
8774
|
+
}));
|
|
8775
|
+
return function fetchCountries() {
|
|
8776
|
+
return _ref2.apply(this, arguments);
|
|
8777
|
+
};
|
|
8778
|
+
}();
|
|
8779
|
+
// Fetch states data
|
|
8780
|
+
var fetchStates = /*#__PURE__*/function () {
|
|
8781
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(countryId) {
|
|
8782
|
+
var fetchCountryId, res, _states, mappedStates, _e$response2, _e$response2$data, _errorMessage2;
|
|
8783
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8784
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8785
|
+
case 0:
|
|
8786
|
+
_context2.prev = 0;
|
|
8787
|
+
fetchCountryId = countryId ? countryId : '1';
|
|
8788
|
+
_context2.next = 4;
|
|
8789
|
+
return getStates(fetchCountryId);
|
|
8790
|
+
case 4:
|
|
8791
|
+
res = _context2.sent;
|
|
8792
|
+
_states = _get(res, 'data.data', []);
|
|
8793
|
+
mappedStates = collectStates(_states);
|
|
8794
|
+
setStates(mappedStates);
|
|
8795
|
+
onGetStatesSuccess(res.data);
|
|
8796
|
+
_context2.next = 14;
|
|
8797
|
+
break;
|
|
8798
|
+
case 11:
|
|
8799
|
+
_context2.prev = 11;
|
|
8800
|
+
_context2.t0 = _context2["catch"](0);
|
|
8801
|
+
if (axios.isAxiosError(_context2.t0)) {
|
|
8802
|
+
_errorMessage2 = (_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';
|
|
8803
|
+
onGetStatesError(_errorMessage2);
|
|
8804
|
+
}
|
|
8805
|
+
case 14:
|
|
8806
|
+
case "end":
|
|
8807
|
+
return _context2.stop();
|
|
8808
|
+
}
|
|
8809
|
+
}, _callee2, null, [[0, 11]]);
|
|
8810
|
+
}));
|
|
8811
|
+
return function fetchStates(_x) {
|
|
8812
|
+
return _ref3.apply(this, arguments);
|
|
8813
|
+
};
|
|
8814
|
+
}();
|
|
8815
|
+
var handleRegisterAccount = /*#__PURE__*/function () {
|
|
8816
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(values) {
|
|
8817
|
+
var accessHash, bodyFormData, profileRes, _e$response3, _e$response3$data, _errorMessage3;
|
|
8818
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
8819
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
8820
|
+
case 0:
|
|
8821
|
+
accessHash = getQueryVariable('hash') || '';
|
|
8822
|
+
_context3.prev = 1;
|
|
8823
|
+
bodyFormData = new FormData();
|
|
8824
|
+
bodyFormData.append('first_name', values.firstName);
|
|
8825
|
+
bodyFormData.append('last_name', values.lastName);
|
|
8826
|
+
bodyFormData.append('email', values.email);
|
|
8827
|
+
bodyFormData.append('zip', values.zip);
|
|
8828
|
+
bodyFormData.append('city', values.city);
|
|
8829
|
+
bodyFormData.append('country', values.country);
|
|
8830
|
+
bodyFormData.append('password', values.password);
|
|
8831
|
+
bodyFormData.append('phone', values.phone || '');
|
|
8832
|
+
bodyFormData.append('password_confirmation', values.confirmPassword);
|
|
8833
|
+
bodyFormData.append('client_id', CONFIGS.CLIENT_ID);
|
|
8834
|
+
bodyFormData.append('client_secret', CONFIGS.CLIENT_SECRET);
|
|
8835
|
+
bodyFormData.append('register_for', registrationType);
|
|
8836
|
+
bodyFormData.append('delegation_access_hash', accessHash);
|
|
8837
|
+
_context3.next = 18;
|
|
8838
|
+
return register(bodyFormData);
|
|
8839
|
+
case 18:
|
|
8840
|
+
_context3.next = 20;
|
|
8841
|
+
return getProfileData();
|
|
8842
|
+
case 20:
|
|
8843
|
+
profileRes = _context3.sent;
|
|
8844
|
+
window.localStorage.setItem('user_data', JSON.stringify(_get(profileRes, 'data.data')));
|
|
8845
|
+
onRegisterAccountSuccess(profileRes);
|
|
8846
|
+
_context3.next = 28;
|
|
8847
|
+
break;
|
|
8848
|
+
case 25:
|
|
8849
|
+
_context3.prev = 25;
|
|
8850
|
+
_context3.t0 = _context3["catch"](1);
|
|
8851
|
+
if (axios.isAxiosError(_context3.t0)) {
|
|
8852
|
+
console.log(_context3.t0);
|
|
8853
|
+
_errorMessage3 = (_context3.t0 == null ? void 0 : (_e$response3 = _context3.t0.response) == null ? void 0 : (_e$response3$data = _e$response3.data) == null ? void 0 : _e$response3$data.message) || 'Error';
|
|
8854
|
+
onRegisterAccountError(_context3.t0);
|
|
8855
|
+
setshowErrorModal(true);
|
|
8856
|
+
setErrorMessage(_errorMessage3);
|
|
8857
|
+
} else if (_context3.t0 instanceof Error) {
|
|
8858
|
+
setErrorMessage((_context3.t0 == null ? void 0 : _context3.t0.message) || 'Error');
|
|
8859
|
+
}
|
|
8860
|
+
case 28:
|
|
8861
|
+
case "end":
|
|
8862
|
+
return _context3.stop();
|
|
8863
|
+
}
|
|
8864
|
+
}, _callee3, null, [[1, 25]]);
|
|
8865
|
+
}));
|
|
8866
|
+
return function handleRegisterAccount(_x2) {
|
|
8867
|
+
return _ref4.apply(this, arguments);
|
|
8868
|
+
};
|
|
8869
|
+
}();
|
|
8870
|
+
useEffect(function () {
|
|
8871
|
+
fetchCountries();
|
|
8872
|
+
fetchStates();
|
|
8873
|
+
}, []);
|
|
8874
|
+
return React.createElement("div", {
|
|
8875
|
+
className: "register-form-container"
|
|
8876
|
+
}, React.createElement("h2", null, "Create an account"), React.createElement("div", {
|
|
8877
|
+
className: "register-sub-title"
|
|
8878
|
+
}, "To manage your tickets, please create an account:"), showErrorModal && React.createElement(ConfirmModal, {
|
|
8879
|
+
hideCancelBtn: true,
|
|
8880
|
+
message: errorMessage,
|
|
8881
|
+
onClose: function onClose() {
|
|
8882
|
+
return window.location.href = '/';
|
|
8883
|
+
},
|
|
8884
|
+
onConfirm: function onConfirm() {
|
|
8885
|
+
return window.location.href = '/';
|
|
8886
|
+
}
|
|
8887
|
+
}), errorMessage && React.createElement("div", {
|
|
8888
|
+
className: "register-error"
|
|
8889
|
+
}, errorMessage), React.createElement(Formik, {
|
|
8890
|
+
initialValues: _extends({}, getFormInitialValues(updatedFormFields), {
|
|
8891
|
+
email: customerEmail
|
|
8892
|
+
}),
|
|
8893
|
+
enableReinitialize: true,
|
|
8894
|
+
onSubmit: handleRegisterAccount
|
|
8895
|
+
}, function (props) {
|
|
8896
|
+
return React.createElement(Form, null, React.createElement("div", {
|
|
8897
|
+
className: "register-body"
|
|
8898
|
+
}, React.createElement(FieldsSection, {
|
|
8899
|
+
disableField: 'email',
|
|
8900
|
+
containerClass: "register",
|
|
8901
|
+
formFields: updatedFormFields,
|
|
8902
|
+
values: props.values,
|
|
8903
|
+
setFieldValue: props.setFieldValue,
|
|
8904
|
+
setPhoneValidationIsLoading: setPhoneValidationIsLoading,
|
|
8905
|
+
countries: countries,
|
|
8906
|
+
states: states,
|
|
8907
|
+
onFieldChange: function onFieldChange(name, value) {
|
|
8908
|
+
if (name === 'country') {
|
|
8909
|
+
fetchStates(value);
|
|
8910
|
+
}
|
|
8911
|
+
}
|
|
8912
|
+
})), React.createElement("div", {
|
|
8913
|
+
className: "button-container"
|
|
8914
|
+
}, React.createElement(Button$2, {
|
|
8915
|
+
className: "register-button",
|
|
8916
|
+
type: "submit",
|
|
8917
|
+
disabled: props.isSubmitting || phoneValidationIsLoading
|
|
8918
|
+
}, props.isSubmitting ? React.createElement(CircularProgress, {
|
|
8919
|
+
size: 26
|
|
8920
|
+
}) : 'Create Account')));
|
|
8921
|
+
}));
|
|
8922
|
+
};
|
|
8923
|
+
|
|
8924
|
+
/* eslint-disable max-len */
|
|
8925
|
+
var VERIFICATION_STATUSES = {
|
|
8926
|
+
PENDING: 'PENDING',
|
|
8927
|
+
APPROVED: 'APPROVED_VERIFIED',
|
|
8928
|
+
FAILED: 'FAILED',
|
|
8929
|
+
WRONG_CUSTOMER: 'WRONG_CUSTOMER'
|
|
8930
|
+
};
|
|
8931
|
+
var VERIFICATION_MESSAGES = {
|
|
8932
|
+
PENDING: 'Your ID verification is currently being processed. We will notify you as soon as it is completed. Thank you for your patience.',
|
|
8933
|
+
APPROVED: 'Your ID verification is approved!',
|
|
8934
|
+
FAILED: 'Unfortunately your ID verification has failed. Please try again.',
|
|
8935
|
+
WRONG_CUSTOMER: 'The order does not belong to the customer.'
|
|
8936
|
+
};
|
|
8937
|
+
var DELEGATION_ACCESS_ERROR = 'Delegation Access not found';
|
|
8938
|
+
|
|
8939
|
+
var IssueTicketForm = function IssueTicketForm(_ref) {
|
|
8940
|
+
var _ref$classNamePrefix = _ref.classNamePrefix,
|
|
8941
|
+
classNamePrefix = _ref$classNamePrefix === void 0 ? 'delegations' : _ref$classNamePrefix,
|
|
8942
|
+
_ref$handleSubmit = _ref.handleSubmit,
|
|
8943
|
+
handleSubmit = _ref$handleSubmit === void 0 ? _identity : _ref$handleSubmit,
|
|
8944
|
+
selectTicketTypeOptions = _ref.selectTicketTypeOptions,
|
|
8945
|
+
initialValues = _ref.initialValues;
|
|
8946
|
+
return React.createElement("div", {
|
|
8947
|
+
className: classNamePrefix + "-issue-form"
|
|
8948
|
+
}, React.createElement(Formik, {
|
|
8949
|
+
initialValues: initialValues,
|
|
8950
|
+
onSubmit: function onSubmit(values, _ref2) {
|
|
8951
|
+
var resetForm = _ref2.resetForm,
|
|
8952
|
+
setSubmitting = _ref2.setSubmitting;
|
|
8953
|
+
delete values.confirm;
|
|
8954
|
+
handleSubmit(values, {
|
|
8955
|
+
resetForm: resetForm,
|
|
8956
|
+
setSubmitting: setSubmitting
|
|
8957
|
+
});
|
|
8958
|
+
}
|
|
8959
|
+
}, function (_ref3) {
|
|
8960
|
+
var isValid = _ref3.isValid,
|
|
8961
|
+
values = _ref3.values,
|
|
8962
|
+
isSubmitting = _ref3.isSubmitting;
|
|
8963
|
+
return React.createElement(Form, null, React.createElement("div", {
|
|
8964
|
+
className: "body"
|
|
8965
|
+
}, React.createElement("div", {
|
|
8966
|
+
className: "field-item"
|
|
8967
|
+
}, React.createElement("div", {
|
|
8968
|
+
className: "field_label"
|
|
8969
|
+
}, "Ticket Type"), React.createElement(Field, {
|
|
8970
|
+
name: "ticketTypeId",
|
|
8971
|
+
label: "Ticket Type",
|
|
8972
|
+
component: SelectField,
|
|
8973
|
+
validate: requiredValidator,
|
|
8974
|
+
options: selectTicketTypeOptions
|
|
8975
|
+
})), React.createElement("div", {
|
|
8976
|
+
className: "field-item"
|
|
8977
|
+
}, React.createElement("div", {
|
|
8978
|
+
className: "field_label"
|
|
8979
|
+
}, "Name"), React.createElement(Field, {
|
|
8980
|
+
name: "firstName",
|
|
8981
|
+
label: "Name",
|
|
8982
|
+
component: CustomField,
|
|
8983
|
+
validate: requiredValidator
|
|
8984
|
+
})), React.createElement("div", {
|
|
8985
|
+
className: "field-item"
|
|
8986
|
+
}, React.createElement("div", {
|
|
8987
|
+
className: "field_label"
|
|
8988
|
+
}, "Last Name"), React.createElement(Field, {
|
|
8989
|
+
name: "lastName",
|
|
8990
|
+
label: "Last Name",
|
|
8991
|
+
component: CustomField,
|
|
8992
|
+
validate: requiredValidator
|
|
8993
|
+
})), React.createElement("div", {
|
|
8994
|
+
className: "field-item"
|
|
8995
|
+
}, React.createElement("div", {
|
|
8996
|
+
className: "field_label"
|
|
8997
|
+
}, "Email"), React.createElement(Field, {
|
|
8998
|
+
name: "email",
|
|
8999
|
+
label: "Email",
|
|
9000
|
+
component: CustomField,
|
|
9001
|
+
validate: requiredValidator
|
|
9002
|
+
})), React.createElement("div", {
|
|
9003
|
+
className: "field-item"
|
|
9004
|
+
}, React.createElement("div", {
|
|
9005
|
+
className: "field_label"
|
|
9006
|
+
}, "Confirm Email"), React.createElement(Field, {
|
|
9007
|
+
name: "confirmEmail",
|
|
9008
|
+
label: "Confirm Email",
|
|
9009
|
+
component: CustomField,
|
|
9010
|
+
validate: getValidateFunctions$1({
|
|
9011
|
+
element: {
|
|
9012
|
+
name: 'confirmEmail',
|
|
9013
|
+
label: 'Confirm Email',
|
|
9014
|
+
required: true
|
|
9015
|
+
},
|
|
9016
|
+
values: values
|
|
9017
|
+
})
|
|
9018
|
+
}))), React.createElement("div", {
|
|
9019
|
+
className: "field-item checkbox_item"
|
|
9020
|
+
}, React.createElement(Field, {
|
|
9021
|
+
name: "confirm",
|
|
9022
|
+
label: "I agree to ManaCommon's privacy policy",
|
|
9023
|
+
type: "checkbox",
|
|
9024
|
+
validate: requiredValidator,
|
|
9025
|
+
component: CheckboxField
|
|
9026
|
+
})), React.createElement("div", {
|
|
9027
|
+
className: "action-button"
|
|
9028
|
+
}, React.createElement("button", {
|
|
9029
|
+
type: "submit",
|
|
9030
|
+
disabled: !isValid
|
|
9031
|
+
}, isSubmitting ? React.createElement(CircularProgress, {
|
|
9032
|
+
size: "22px"
|
|
9033
|
+
}) : 'Issue Ticket')));
|
|
9034
|
+
}));
|
|
9035
|
+
};
|
|
9036
|
+
|
|
9037
|
+
var TicketsAssignedTable = function TicketsAssignedTable(_ref) {
|
|
9038
|
+
var _issuePageData$ticket, _issuePageData$ticket2;
|
|
9039
|
+
var _ref$tableTitle = _ref.tableTitle,
|
|
9040
|
+
tableTitle = _ref$tableTitle === void 0 ? 'Tickets assigned' : _ref$tableTitle,
|
|
9041
|
+
_ref$classNamePrefix = _ref.classNamePrefix,
|
|
9042
|
+
classNamePrefix = _ref$classNamePrefix === void 0 ? 'delegations' : _ref$classNamePrefix,
|
|
9043
|
+
issuePageData = _ref.issuePageData,
|
|
9044
|
+
_ref$noTicketsAssigne = _ref.noTicketsAssignedText,
|
|
9045
|
+
noTicketsAssignedText = _ref$noTicketsAssigne === void 0 ? "You haven't issued any tickets yet." : _ref$noTicketsAssigne;
|
|
9046
|
+
return React.createElement("div", {
|
|
9047
|
+
className: classNamePrefix + "-tables-block"
|
|
9048
|
+
}, React.createElement("div", {
|
|
9049
|
+
className: classNamePrefix + "-ticket-holder"
|
|
9050
|
+
}, tableTitle), (_issuePageData$ticket = issuePageData.tickets) != null && _issuePageData$ticket.length ? React.createElement(TableContainer, {
|
|
9051
|
+
className: "my-ticket-table"
|
|
9052
|
+
}, React.createElement(Table, {
|
|
9053
|
+
"aria-label": "collapsible table"
|
|
9054
|
+
}, React.createElement(TableHead, null, React.createElement(TableRow, null, React.createElement(TableCell, {
|
|
9055
|
+
key: 'Ticket Holder'
|
|
9056
|
+
}, 'Ticket Holder'), React.createElement(TableCell, {
|
|
9057
|
+
key: 'Ticket Type'
|
|
9058
|
+
}, 'Ticket Type'), React.createElement(TableCell, {
|
|
9059
|
+
key: 'Status'
|
|
9060
|
+
}, 'Status'))), React.createElement(TableBody, null, (_issuePageData$ticket2 = issuePageData.tickets) == null ? void 0 : _issuePageData$ticket2.map(function (ticket) {
|
|
9061
|
+
return React.createElement(TableRow, {
|
|
9062
|
+
key: ticket.id
|
|
9063
|
+
}, React.createElement(TableCell, {
|
|
9064
|
+
key: ticket.id + 'type'
|
|
9065
|
+
}, ticket.firstName + ' ' + ticket.lastName), React.createElement(TableCell, {
|
|
9066
|
+
key: ticket.id + 'ticketType'
|
|
9067
|
+
}, ticket.ticketType), React.createElement(TableCell, {
|
|
9068
|
+
key: ticket.id + 'status'
|
|
9069
|
+
}, ticket.status));
|
|
9070
|
+
})))) : noTicketsAssignedText);
|
|
9071
|
+
};
|
|
9072
|
+
|
|
9073
|
+
var TicketsAvailableTable = function TicketsAvailableTable(_ref) {
|
|
9074
|
+
var _ref$tableTitle = _ref.tableTitle,
|
|
9075
|
+
tableTitle = _ref$tableTitle === void 0 ? 'Tickets available' : _ref$tableTitle,
|
|
9076
|
+
_ref$classNamePrefix = _ref.classNamePrefix,
|
|
9077
|
+
classNamePrefix = _ref$classNamePrefix === void 0 ? 'delegations' : _ref$classNamePrefix,
|
|
9078
|
+
issuePageData = _ref.issuePageData;
|
|
9079
|
+
return React.createElement("div", {
|
|
9080
|
+
className: classNamePrefix + "-tables-block"
|
|
9081
|
+
}, React.createElement("div", {
|
|
9082
|
+
className: classNamePrefix + "-ticket-holder"
|
|
9083
|
+
}, tableTitle), React.createElement(TableContainer, {
|
|
9084
|
+
className: "my-ticket-table"
|
|
9085
|
+
}, React.createElement(Table, {
|
|
9086
|
+
"aria-label": "collapsible table"
|
|
9087
|
+
}, React.createElement(TableHead, null, React.createElement(TableRow, null, React.createElement(TableCell, {
|
|
9088
|
+
key: 1
|
|
9089
|
+
}, 'Ticket Type'), React.createElement(TableCell, {
|
|
9090
|
+
key: 2
|
|
9091
|
+
}, 'Total Quantity'), React.createElement(TableCell, {
|
|
9092
|
+
key: 3
|
|
9093
|
+
}, 'Quantity Issued'), React.createElement(TableCell, {
|
|
9094
|
+
key: 4
|
|
9095
|
+
}, 'Quantity Remaining'))), React.createElement(TableBody, null, _map(issuePageData.ticketTypes, function (val, key) {
|
|
9096
|
+
return React.createElement(TableRow, {
|
|
9097
|
+
key: key
|
|
9098
|
+
}, React.createElement(TableCell, {
|
|
9099
|
+
key: key + 'name'
|
|
9100
|
+
}, val.optionValue), React.createElement(TableCell, {
|
|
9101
|
+
key: key + 'maxQty'
|
|
9102
|
+
}, val.delegationMaxQuantity), React.createElement(TableCell, {
|
|
9103
|
+
key: key + 'issued'
|
|
9104
|
+
}, val.delegationQuantityIssued), React.createElement(TableCell, {
|
|
9105
|
+
key: key + 'remaining'
|
|
9106
|
+
}, Number(val.delegationMaxQuantity) - Number(val.delegationQuantityIssued)));
|
|
9107
|
+
})))));
|
|
9108
|
+
};
|
|
9109
|
+
|
|
9110
|
+
var IssueComponent = function IssueComponent(_ref) {
|
|
9111
|
+
var _ref$classNamePrefix = _ref.classNamePrefix,
|
|
9112
|
+
classNamePrefix = _ref$classNamePrefix === void 0 ? 'delegations' : _ref$classNamePrefix,
|
|
9113
|
+
_ref$headTitle = _ref.headTitle,
|
|
9114
|
+
headTitle = _ref$headTitle === void 0 ? 'Manage Your Guest Tickets' : _ref$headTitle,
|
|
9115
|
+
_ref$onGetIssuePageDa = _ref.onGetIssuePageDataSuccess,
|
|
9116
|
+
onGetIssuePageDataSuccess = _ref$onGetIssuePageDa === void 0 ? _identity : _ref$onGetIssuePageDa,
|
|
9117
|
+
_ref$onGetIssuePageDa2 = _ref.onGetIssuePageDataError,
|
|
9118
|
+
onGetIssuePageDataError = _ref$onGetIssuePageDa2 === void 0 ? _identity : _ref$onGetIssuePageDa2;
|
|
9119
|
+
var _useState = useState(true),
|
|
9120
|
+
loading = _useState[0],
|
|
9121
|
+
setLoading = _useState[1];
|
|
9122
|
+
var _useState2 = useState(false),
|
|
9123
|
+
showMaxQtyModal = _useState2[0],
|
|
9124
|
+
setShowMaxQtyModal = _useState2[1];
|
|
9125
|
+
var _useState3 = useState(false),
|
|
9126
|
+
showSuccessModal = _useState3[0],
|
|
9127
|
+
setShowSuccessModal = _useState3[1];
|
|
9128
|
+
var _useState4 = useState(''),
|
|
9129
|
+
error = _useState4[0],
|
|
9130
|
+
setError = _useState4[1];
|
|
9131
|
+
var accessHash = getQueryVariable('hash') || '';
|
|
9132
|
+
var _useState5 = useState({}),
|
|
9133
|
+
issuePageData = _useState5[0],
|
|
9134
|
+
setIssuePageData = _useState5[1];
|
|
9135
|
+
useEffect(function () {
|
|
9136
|
+
var fetchDelegationTickets = /*#__PURE__*/function () {
|
|
9137
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9138
|
+
var _res$data, _res$data$data, res;
|
|
9139
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9140
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9141
|
+
case 0:
|
|
9142
|
+
_context.prev = 0;
|
|
9143
|
+
_context.next = 3;
|
|
9144
|
+
return getDelegationTickets(accessHash);
|
|
9145
|
+
case 3:
|
|
9146
|
+
res = _context.sent;
|
|
9147
|
+
setLoading(false);
|
|
9148
|
+
setIssuePageData((res == null ? void 0 : (_res$data = res.data) == null ? void 0 : (_res$data$data = _res$data.data) == null ? void 0 : _res$data$data.attributes) || {});
|
|
9149
|
+
onGetIssuePageDataSuccess();
|
|
9150
|
+
_context.next = 13;
|
|
9151
|
+
break;
|
|
9152
|
+
case 9:
|
|
9153
|
+
_context.prev = 9;
|
|
9154
|
+
_context.t0 = _context["catch"](0);
|
|
9155
|
+
setLoading(false);
|
|
9156
|
+
if (axios.isAxiosError(_context.t0)) {
|
|
9157
|
+
onGetIssuePageDataError(_context.t0);
|
|
9158
|
+
}
|
|
9159
|
+
case 13:
|
|
9160
|
+
case "end":
|
|
9161
|
+
return _context.stop();
|
|
9162
|
+
}
|
|
9163
|
+
}, _callee, null, [[0, 9]]);
|
|
9164
|
+
}));
|
|
9165
|
+
return function fetchDelegationTickets() {
|
|
9166
|
+
return _ref2.apply(this, arguments);
|
|
9167
|
+
};
|
|
9168
|
+
}();
|
|
9169
|
+
fetchDelegationTickets();
|
|
9170
|
+
}, [showSuccessModal]);
|
|
9171
|
+
var selectTicketTypeOptions = _map(issuePageData.ticketTypes || {}, function (val, key) {
|
|
9172
|
+
return {
|
|
9173
|
+
value: key,
|
|
9174
|
+
label: val.optionValue
|
|
9175
|
+
};
|
|
9176
|
+
});
|
|
9177
|
+
return React.createElement("div", {
|
|
9178
|
+
className: classNamePrefix + "-container"
|
|
9179
|
+
}, loading ? React.createElement(Loader, null) : React.createElement(React.Fragment, null, showMaxQtyModal && React.createElement(ConfirmModal, {
|
|
9180
|
+
hideCancelBtn: true,
|
|
9181
|
+
message: error,
|
|
9182
|
+
onClose: function onClose() {
|
|
9183
|
+
return error === DELEGATION_ACCESS_ERROR ? window.location.href = '/' : setShowMaxQtyModal(false);
|
|
9184
|
+
},
|
|
9185
|
+
onConfirm: function onConfirm() {
|
|
9186
|
+
return error === DELEGATION_ACCESS_ERROR ? window.location.href = '/' : setShowMaxQtyModal(false);
|
|
9187
|
+
}
|
|
9188
|
+
}), showSuccessModal && React.createElement(ConfirmModal, {
|
|
9189
|
+
hideCancelBtn: true,
|
|
9190
|
+
message: "Your ticket successfully issued.",
|
|
9191
|
+
onClose: function onClose() {
|
|
9192
|
+
return setShowSuccessModal(false);
|
|
9193
|
+
},
|
|
9194
|
+
onConfirm: function onConfirm() {
|
|
9195
|
+
return setShowSuccessModal(false);
|
|
9196
|
+
}
|
|
9197
|
+
}), React.createElement("div", {
|
|
9198
|
+
className: classNamePrefix + "-head-title"
|
|
9199
|
+
}, headTitle), React.createElement("div", {
|
|
9200
|
+
className: classNamePrefix + "-inner-blocks"
|
|
9201
|
+
}, React.createElement("div", {
|
|
9202
|
+
className: classNamePrefix + "-image-block"
|
|
9203
|
+
}, React.createElement("img", {
|
|
9204
|
+
src: "" + CONFIGS.BASE_URL + (issuePageData == null ? void 0 : issuePageData.eventImage),
|
|
9205
|
+
alt: "main_event_img",
|
|
9206
|
+
title: ""
|
|
9207
|
+
})), React.createElement("div", {
|
|
9208
|
+
className: classNamePrefix + "-tables"
|
|
9209
|
+
}, React.createElement(TicketsAvailableTable, {
|
|
9210
|
+
tableTitle: "Tickets available",
|
|
9211
|
+
issuePageData: issuePageData,
|
|
9212
|
+
classNamePrefix: "delegations"
|
|
9213
|
+
}), React.createElement(TicketsAssignedTable, {
|
|
9214
|
+
tableTitle: "Tickets assigned",
|
|
9215
|
+
issuePageData: issuePageData,
|
|
9216
|
+
classNamePrefix: "delegations"
|
|
9217
|
+
}), React.createElement("div", {
|
|
9218
|
+
className: classNamePrefix + "-issue-block"
|
|
9219
|
+
}, React.createElement("div", {
|
|
9220
|
+
className: classNamePrefix + "-issue-title"
|
|
9221
|
+
}, "Issue New Tickets"), React.createElement("div", {
|
|
9222
|
+
className: classNamePrefix + "-issue-subtitle"
|
|
9223
|
+
}, "Please select the type of tickets and enter recipient details:")), React.createElement(IssueTicketForm, {
|
|
9224
|
+
classNamePrefix: 'delegations',
|
|
9225
|
+
handleSubmit: function () {
|
|
9226
|
+
var _handleSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values, _ref3) {
|
|
9227
|
+
var resetForm, setSubmitting, _e$response, _e$response$data, _error;
|
|
9228
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
9229
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
9230
|
+
case 0:
|
|
9231
|
+
resetForm = _ref3.resetForm, setSubmitting = _ref3.setSubmitting;
|
|
9232
|
+
_context2.prev = 1;
|
|
9233
|
+
_context2.next = 4;
|
|
9234
|
+
return issueTicket(accessHash, values);
|
|
9235
|
+
case 4:
|
|
9236
|
+
setShowSuccessModal(true);
|
|
9237
|
+
resetForm();
|
|
9238
|
+
_context2.next = 12;
|
|
9239
|
+
break;
|
|
9240
|
+
case 8:
|
|
9241
|
+
_context2.prev = 8;
|
|
9242
|
+
_context2.t0 = _context2["catch"](1);
|
|
9243
|
+
if (axios.isAxiosError(_context2.t0)) {
|
|
9244
|
+
_error = (_context2.t0 == null ? void 0 : (_e$response = _context2.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message) || 'Error';
|
|
9245
|
+
setError(_error);
|
|
9246
|
+
} else if (_context2.t0 instanceof Error) {
|
|
9247
|
+
setError((_context2.t0 == null ? void 0 : _context2.t0.message) || 'Error');
|
|
9248
|
+
}
|
|
9249
|
+
setShowMaxQtyModal(true);
|
|
9250
|
+
case 12:
|
|
9251
|
+
_context2.prev = 12;
|
|
9252
|
+
setLoading(false);
|
|
9253
|
+
setSubmitting(false);
|
|
9254
|
+
return _context2.finish(12);
|
|
9255
|
+
case 16:
|
|
9256
|
+
case "end":
|
|
9257
|
+
return _context2.stop();
|
|
9258
|
+
}
|
|
9259
|
+
}, _callee2, null, [[1, 8, 12, 16]]);
|
|
9260
|
+
}));
|
|
9261
|
+
function handleSubmit(_x, _x2) {
|
|
9262
|
+
return _handleSubmit.apply(this, arguments);
|
|
9263
|
+
}
|
|
9264
|
+
return handleSubmit;
|
|
9265
|
+
}(),
|
|
9266
|
+
selectTicketTypeOptions: selectTicketTypeOptions,
|
|
9267
|
+
initialValues: {
|
|
9268
|
+
ticketTypeId: '',
|
|
9269
|
+
firstName: '',
|
|
9270
|
+
lastName: '',
|
|
9271
|
+
email: '',
|
|
9272
|
+
confirmEmail: '',
|
|
9273
|
+
confirm: false
|
|
9274
|
+
}
|
|
9275
|
+
})))));
|
|
9276
|
+
};
|
|
9277
|
+
|
|
9278
|
+
var X_TF_ECOMMERCE$1 = 'X-TF-ECOMMERCE';
|
|
9279
|
+
var DelegationsContainer = function DelegationsContainer(_ref) {
|
|
9280
|
+
var registerFormFields = _ref.registerFormFields,
|
|
9281
|
+
_ref$classNamePrefix = _ref.classNamePrefix,
|
|
9282
|
+
classNamePrefix = _ref$classNamePrefix === void 0 ? 'guest-ticket-delegation' : _ref$classNamePrefix,
|
|
9283
|
+
_ref$issuePageErrorTe = _ref.issuePageErrorText,
|
|
9284
|
+
issuePageErrorText = _ref$issuePageErrorTe === void 0 ? 'You do not have access to manage these tickets.' : _ref$issuePageErrorTe,
|
|
9285
|
+
_ref$onCustomerExists = _ref.onCustomerExistsError,
|
|
9286
|
+
onCustomerExistsError = _ref$onCustomerExists === void 0 ? _identity : _ref$onCustomerExists,
|
|
9287
|
+
logo = _ref.logo;
|
|
9288
|
+
var _useState = useState(true),
|
|
9289
|
+
loading = _useState[0],
|
|
9290
|
+
setLoading = _useState[1];
|
|
9291
|
+
var _useState2 = useState(Boolean(getCookieByName(X_TF_ECOMMERCE$1))),
|
|
9292
|
+
isLoggedIn = _useState2[0],
|
|
9293
|
+
setIsLoggedIn = _useState2[1];
|
|
9294
|
+
var _useState3 = useState(false),
|
|
9295
|
+
isCustomerExsists = _useState3[0],
|
|
9296
|
+
setIsCustomerExsists = _useState3[1];
|
|
9297
|
+
var _useState4 = useState(false),
|
|
9298
|
+
issuePageError = _useState4[0],
|
|
9299
|
+
setIssuePageError = _useState4[1];
|
|
9300
|
+
var _useState5 = useState(''),
|
|
9301
|
+
customerEmail = _useState5[0],
|
|
9302
|
+
setCustomerEmail = _useState5[1];
|
|
9303
|
+
var accessHash = getQueryVariable('hash') || '';
|
|
9304
|
+
useCookieListener(X_TF_ECOMMERCE$1, function (value) {
|
|
9305
|
+
return setIsLoggedIn(Boolean(value));
|
|
9306
|
+
});
|
|
9307
|
+
var onGetIssuePageDataError = function onGetIssuePageDataError() {
|
|
9308
|
+
setIssuePageError(true);
|
|
9309
|
+
};
|
|
9310
|
+
useEffect(function () {
|
|
9311
|
+
var getCustomerData = /*#__PURE__*/function () {
|
|
9312
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9313
|
+
var response, _isCustomerExsists;
|
|
9314
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9315
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9316
|
+
case 0:
|
|
9317
|
+
_context.prev = 0;
|
|
9318
|
+
_context.next = 3;
|
|
9319
|
+
return getCustomerExistsData(accessHash);
|
|
9320
|
+
case 3:
|
|
9321
|
+
response = _context.sent;
|
|
9322
|
+
_isCustomerExsists = _get(response, 'data.attributes.customerExists', false);
|
|
9323
|
+
setIsCustomerExsists(_isCustomerExsists);
|
|
9324
|
+
setCustomerEmail(_get(response, 'data.attributes.email', ''));
|
|
9325
|
+
setLoading(false);
|
|
9326
|
+
_context.next = 13;
|
|
9327
|
+
break;
|
|
9328
|
+
case 10:
|
|
9329
|
+
_context.prev = 10;
|
|
9330
|
+
_context.t0 = _context["catch"](0);
|
|
9331
|
+
onCustomerExistsError(_context.t0);
|
|
9332
|
+
case 13:
|
|
9333
|
+
case "end":
|
|
9334
|
+
return _context.stop();
|
|
9335
|
+
}
|
|
9336
|
+
}, _callee, null, [[0, 10]]);
|
|
9337
|
+
}));
|
|
9338
|
+
return function getCustomerData() {
|
|
9339
|
+
return _ref2.apply(this, arguments);
|
|
9340
|
+
};
|
|
9341
|
+
}();
|
|
9342
|
+
getCustomerData();
|
|
9343
|
+
}, []);
|
|
9344
|
+
return React.createElement("div", {
|
|
9345
|
+
className: classNamePrefix + "__container"
|
|
9346
|
+
}, loading ? React.createElement(Loader, null) : issuePageError ? React.createElement("div", {
|
|
9347
|
+
className: "issue_page_error"
|
|
9348
|
+
}, issuePageErrorText) : isLoggedIn ? React.createElement("div", null, React.createElement(IssueComponent, {
|
|
9349
|
+
classNamePrefix: classNamePrefix,
|
|
9350
|
+
onGetIssuePageDataError: onGetIssuePageDataError
|
|
9351
|
+
})) : isCustomerExsists ? React.createElement(LoginForm, {
|
|
9352
|
+
logo: logo
|
|
9353
|
+
}) : React.createElement(RegistrationForm, {
|
|
9354
|
+
customerEmail: customerEmail,
|
|
9355
|
+
formFields: registerFormFields,
|
|
9356
|
+
registrationType: "delegation"
|
|
9357
|
+
}));
|
|
9358
|
+
};
|
|
9359
|
+
|
|
9360
|
+
var addToCartFunc = /*#__PURE__*/function () {
|
|
9361
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9362
|
+
var eventId, data, ticketQuantity, _ref$enableBillingInf, enableBillingInfoAutoCreate, isWindowDefined, result, pageConfigsDataResponse, pageConfigsData, _pageConfigsData$skip, skipBillingPage, _pageConfigsData$name, nameIsRequired, _pageConfigsData$age_, ageIsRequired, _pageConfigsData$phon, phoneIsRequired, _pageConfigsData$hide, hidePhoneField, _pageConfigsData$has_, hasAddOn, _pageConfigsData$free, freeTicket, _pageConfigsData$coll, collectOptionalWalletAddress, _pageConfigsData$coll2, collectMandatoryWalletAddress, hash, total, userData, checkoutBody, checkoutResult;
|
|
9363
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9364
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9365
|
+
case 0:
|
|
9366
|
+
eventId = _ref.eventId, data = _ref.data, ticketQuantity = _ref.ticketQuantity, _ref$enableBillingInf = _ref.enableBillingInfoAutoCreate, enableBillingInfoAutoCreate = _ref$enableBillingInf === void 0 ? true : _ref$enableBillingInf;
|
|
9367
|
+
isWindowDefined = typeof window !== 'undefined';
|
|
9368
|
+
_context.next = 4;
|
|
9369
|
+
return addToCart(eventId, data);
|
|
9370
|
+
case 4:
|
|
9371
|
+
result = _context.sent;
|
|
9372
|
+
_context.next = 7;
|
|
9373
|
+
return getCheckoutPageConfigs();
|
|
9374
|
+
case 7:
|
|
9375
|
+
pageConfigsDataResponse = _context.sent;
|
|
9376
|
+
if (!(result.status === 200 && pageConfigsDataResponse.status === 200)) {
|
|
9377
|
+
_context.next = 28;
|
|
9378
|
+
break;
|
|
9379
|
+
}
|
|
9380
|
+
pageConfigsData = _get(pageConfigsDataResponse, 'data.attributes') || {};
|
|
9381
|
+
_pageConfigsData$skip = pageConfigsData.skip_billing_page, skipBillingPage = _pageConfigsData$skip === void 0 ? false : _pageConfigsData$skip, _pageConfigsData$name = pageConfigsData.names_required, nameIsRequired = _pageConfigsData$name === void 0 ? false : _pageConfigsData$name, _pageConfigsData$age_ = pageConfigsData.age_required, ageIsRequired = _pageConfigsData$age_ === void 0 ? false : _pageConfigsData$age_, _pageConfigsData$phon = pageConfigsData.phone_required, phoneIsRequired = _pageConfigsData$phon === void 0 ? false : _pageConfigsData$phon, _pageConfigsData$hide = pageConfigsData.hide_phone_field, hidePhoneField = _pageConfigsData$hide === void 0 ? false : _pageConfigsData$hide, _pageConfigsData$has_ = pageConfigsData.has_add_on, hasAddOn = _pageConfigsData$has_ === void 0 ? false : _pageConfigsData$has_, _pageConfigsData$free = pageConfigsData.free_ticket, freeTicket = _pageConfigsData$free === void 0 ? false : _pageConfigsData$free, _pageConfigsData$coll = pageConfigsData.collect_optional_wallet_address, collectOptionalWalletAddress = _pageConfigsData$coll === void 0 ? false : _pageConfigsData$coll, _pageConfigsData$coll2 = pageConfigsData.collect_mandatory_wallet_address, collectMandatoryWalletAddress = _pageConfigsData$coll2 === void 0 ? false : _pageConfigsData$coll2;
|
|
9382
|
+
hash = '';
|
|
9383
|
+
total = '';
|
|
9384
|
+
isWindowDefined && window.localStorage.removeItem('add_ons');
|
|
9385
|
+
if (!(skipBillingPage && !hasAddOn)) {
|
|
9386
|
+
_context.next = 27;
|
|
9387
|
+
break;
|
|
9388
|
+
}
|
|
9389
|
+
// Get user data for checkout data
|
|
9390
|
+
userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
9391
|
+
checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketQuantity, userData);
|
|
9392
|
+
if (!enableBillingInfoAutoCreate) {
|
|
9393
|
+
_context.next = 23;
|
|
9394
|
+
break;
|
|
9395
|
+
}
|
|
9396
|
+
_context.next = 20;
|
|
9397
|
+
return postOnCheckout(checkoutBody, undefined, freeTicket);
|
|
9398
|
+
case 20:
|
|
9399
|
+
_context.t0 = _context.sent;
|
|
9400
|
+
_context.next = 24;
|
|
9401
|
+
break;
|
|
9402
|
+
case 23:
|
|
9403
|
+
_context.t0 = null;
|
|
9404
|
+
case 24:
|
|
9405
|
+
checkoutResult = _context.t0;
|
|
9406
|
+
hash = _get(checkoutResult, 'data.data.attributes.hash') || '';
|
|
9407
|
+
total = _get(checkoutResult, 'data.data.attributes.total') || '';
|
|
9408
|
+
case 27:
|
|
9409
|
+
return _context.abrupt("return", {
|
|
9410
|
+
skip_billing_page: skipBillingPage,
|
|
9411
|
+
names_required: nameIsRequired,
|
|
9412
|
+
phone_required: phoneIsRequired,
|
|
9413
|
+
age_required: ageIsRequired,
|
|
9414
|
+
hide_phone_field: hidePhoneField,
|
|
9415
|
+
free_ticket: freeTicket,
|
|
9416
|
+
collect_optional_wallet_address: collectOptionalWalletAddress,
|
|
9417
|
+
collect_mandatory_wallet_address: collectMandatoryWalletAddress,
|
|
9418
|
+
event_id: String(eventId),
|
|
9419
|
+
hash: hash,
|
|
9420
|
+
total: total,
|
|
9421
|
+
hasAddOn: hasAddOn
|
|
9422
|
+
});
|
|
9423
|
+
case 28:
|
|
9424
|
+
return _context.abrupt("return", null);
|
|
9425
|
+
case 29:
|
|
9426
|
+
case "end":
|
|
9427
|
+
return _context.stop();
|
|
9428
|
+
}
|
|
8287
9429
|
}, _callee);
|
|
8288
9430
|
}));
|
|
8289
9431
|
return function addToCartFunc(_x) {
|
|
@@ -8551,7 +9693,7 @@ var TicketsSection$1 = function TicketsSection(props) {
|
|
|
8551
9693
|
}, option.ticket_type_name);
|
|
8552
9694
|
}
|
|
8553
9695
|
return null;
|
|
8554
|
-
})), React.createElement(Button$
|
|
9696
|
+
})), React.createElement(Button$3, {
|
|
8555
9697
|
className: "ticket-delete",
|
|
8556
9698
|
onClick: function onClick() {
|
|
8557
9699
|
handleCancelReservation(dropdownData.seatId, dropdownData.tierId);
|
|
@@ -8653,7 +9795,7 @@ var TicketsSection$1 = function TicketsSection(props) {
|
|
|
8653
9795
|
className: "ticket-description-content",
|
|
8654
9796
|
dangerouslySetInnerHTML: createMarkup(selectedTicketData.description || '')
|
|
8655
9797
|
})));
|
|
8656
|
-
})), React.createElement("div", null, React.createElement(Button$
|
|
9798
|
+
})), React.createElement("div", null, React.createElement(Button$3, {
|
|
8657
9799
|
className: "book-button\n " + (bookButtonIsDisabled ? 'disabled' : '') + "\n " + (isButtonScrollable ? 'is-scrollable' : '') + "\n ",
|
|
8658
9800
|
onClick: !bookButtonIsDisabled ? handleGetTicketClick : _identity,
|
|
8659
9801
|
disabled: isAddingToCart
|
|
@@ -9128,20 +10270,6 @@ var SeatMapContainer = function SeatMapContainer(props) {
|
|
|
9128
10270
|
}));
|
|
9129
10271
|
};
|
|
9130
10272
|
|
|
9131
|
-
/* eslint-disable max-len */
|
|
9132
|
-
var VERIFICATION_STATUSES = {
|
|
9133
|
-
PENDING: 'PENDING',
|
|
9134
|
-
APPROVED: 'APPROVED_VERIFIED',
|
|
9135
|
-
FAILED: 'FAILED',
|
|
9136
|
-
WRONG_CUSTOMER: 'WRONG_CUSTOMER'
|
|
9137
|
-
};
|
|
9138
|
-
var VERIFICATION_MESSAGES = {
|
|
9139
|
-
PENDING: 'Your ID verification is currently being processed. We will notify you as soon as it is completed. Thank you for your patience.',
|
|
9140
|
-
APPROVED: 'Your ID verification is approved!',
|
|
9141
|
-
FAILED: 'Unfortunately your ID verification has failed. Please try again.',
|
|
9142
|
-
WRONG_CUSTOMER: 'The order does not belong to the customer.'
|
|
9143
|
-
};
|
|
9144
|
-
|
|
9145
10273
|
var IDVerification = function IDVerification(props) {
|
|
9146
10274
|
var _props$onGetVerifyUrl = props.onGetVerifyUrlSuccess,
|
|
9147
10275
|
onGetVerifyUrlSuccess = _props$onGetVerifyUrl === void 0 ? _identity : _props$onGetVerifyUrl,
|
|
@@ -9604,5 +10732,5 @@ var RsvpContainer = function RsvpContainer(_ref) {
|
|
|
9604
10732
|
}, "RSVP"))))))));
|
|
9605
10733
|
};
|
|
9606
10734
|
|
|
9607
|
-
export { AddonsContainter, BillingInfoContainer, ConfirmationContainer, ForgotPasswordModal, IDVerification, LoginModal, MyTicketsContainer, OrderDetailsContainer, PaymentContainer, PoweredBy, RedirectModal, ResetPasswordContainer, RsvpContainer, SeatMapContainer, TicketResaleContainer, TicketsContainer, VERIFICATION_STATUSES, createFixedFloatNormalizer, currencyNormalizerCreator, setConfigs };
|
|
10735
|
+
export { AddonsContainter, BillingInfoContainer, ConfirmationContainer, DelegationsContainer, ForgotPasswordModal, IDVerification, LoginModal, MyTicketsContainer, OrderDetailsContainer, PaymentContainer, PoweredBy, RedirectModal, ResetPasswordContainer, RsvpContainer, SeatMapContainer, TicketResaleContainer, TicketsContainer, VERIFICATION_STATUSES, createFixedFloatNormalizer, currencyNormalizerCreator, setConfigs, useCookieListener };
|
|
9608
10736
|
//# sourceMappingURL=tf-checkout-react.esm.js.map
|