tf-checkout-react 1.3.12-beta.3 → 1.3.12-beta.4

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.
@@ -1,3 +1,4 @@
1
+ import { AxiosError } from 'axios';
1
2
  import { FC } from 'react';
2
3
  import { IForgotPasswordProps } from '../forgotPasswordModal';
3
4
  import { ILoginModalProps } from '../loginModal';
@@ -5,6 +6,8 @@ interface IPreRegistrationProps extends ILoginModalProps, IForgotPasswordProps {
5
6
  eventId: string | number;
6
7
  formFields?: IFormFieldsSection[];
7
8
  additionalFieldAttribute?: IFieldAttribute;
9
+ onGetCountriesSuccess?: (res: any) => void;
10
+ onGetCountriesError?: (e: AxiosError) => void;
8
11
  }
9
12
  export declare const PreRegistration: FC<IPreRegistrationProps>;
10
13
  export {};
@@ -8447,7 +8447,11 @@ var PreRegistration = function PreRegistration(_ref) {
8447
8447
  _ref$onForgotPassword = _ref.onForgotPasswordSuccess,
8448
8448
  onForgotPasswordSuccess = _ref$onForgotPassword === void 0 ? _identity : _ref$onForgotPassword,
8449
8449
  _ref$onForgotPassword2 = _ref.onForgotPasswordError,
8450
- onForgotPasswordError = _ref$onForgotPassword2 === void 0 ? _identity : _ref$onForgotPassword2;
8450
+ onForgotPasswordError = _ref$onForgotPassword2 === void 0 ? _identity : _ref$onForgotPassword2,
8451
+ _ref$onGetCountriesSu = _ref.onGetCountriesSuccess,
8452
+ onGetCountriesSuccess = _ref$onGetCountriesSu === void 0 ? _identity : _ref$onGetCountriesSu,
8453
+ _ref$onGetCountriesEr = _ref.onGetCountriesError,
8454
+ onGetCountriesError = _ref$onGetCountriesEr === void 0 ? _identity : _ref$onGetCountriesEr;
8451
8455
 
8452
8456
  var _useState = React.useState(''),
8453
8457
  error = _useState[0],
@@ -8494,26 +8498,27 @@ var PreRegistration = function PreRegistration(_ref) {
8494
8498
  label: item,
8495
8499
  value: key
8496
8500
  };
8497
- })); // onGetCountriesSuccess(res.data)
8498
-
8499
- _context.next = 10;
8501
+ }));
8502
+ onGetCountriesSuccess(res.data);
8503
+ _context.next = 11;
8500
8504
  break;
8501
8505
 
8502
- case 7:
8503
- _context.prev = 7;
8506
+ case 8:
8507
+ _context.prev = 8;
8504
8508
  _context.t0 = _context["catch"](0);
8505
8509
 
8506
8510
  if (axios.isAxiosError(_context.t0)) {
8507
8511
  _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';
8508
- setError(_error); // onGetCountriesError(e)
8512
+ setError(_error);
8513
+ onGetCountriesError(_context.t0);
8509
8514
  }
8510
8515
 
8511
- case 10:
8516
+ case 11:
8512
8517
  case "end":
8513
8518
  return _context.stop();
8514
8519
  }
8515
8520
  }
8516
- }, _callee, null, [[0, 7]]);
8521
+ }, _callee, null, [[0, 8]]);
8517
8522
  }));
8518
8523
 
8519
8524
  return function fetchCountries() {
@@ -8573,7 +8578,7 @@ var PreRegistration = function PreRegistration(_ref) {
8573
8578
  enableReinitialize: true,
8574
8579
  onSubmit: function () {
8575
8580
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(values) {
8576
- var updatedValues, holderAgeDate, bodyFormData, _e$response2, _e$response2$data, _error2;
8581
+ var updatedValues, holderAgeDate, bodyFormData, _e$response2, _e$response2$data;
8577
8582
 
8578
8583
  return runtime_1.wrap(function _callee2$(_context2) {
8579
8584
  while (1) {
@@ -8597,7 +8602,7 @@ var PreRegistration = function PreRegistration(_ref) {
8597
8602
  return confirmPreRegistration(eventId, updatedValues);
8598
8603
 
8599
8604
  case 10:
8600
- _context2.next = 24;
8605
+ _context2.next = 26;
8601
8606
  break;
8602
8607
 
8603
8608
  case 12:
@@ -8610,31 +8615,27 @@ var PreRegistration = function PreRegistration(_ref) {
8610
8615
  bodyFormData.append('country', values.country);
8611
8616
  bodyFormData.append('password', values.password);
8612
8617
  bodyFormData.append('password_confirmation', values.confirmPassword);
8618
+ bodyFormData.append('client_id', CONFIGS.CLIENT_ID);
8619
+ bodyFormData.append('client_secret', CONFIGS.CLIENT_SECRET);
8613
8620
  bodyFormData.append('register_for', 'prereg');
8614
- _context2.next = 24;
8621
+ _context2.next = 26;
8615
8622
  return register(bodyFormData);
8616
8623
 
8617
- case 24:
8618
- _context2.next = 29;
8624
+ case 26:
8625
+ _context2.next = 31;
8619
8626
  break;
8620
8627
 
8621
- case 26:
8622
- _context2.prev = 26;
8628
+ case 28:
8629
+ _context2.prev = 28;
8623
8630
  _context2.t0 = _context2["catch"](0);
8631
+ setError((_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) || (_context2.t0 == null ? void 0 : _context2.t0.message) || 'Error');
8624
8632
 
8625
- if (axios.isAxiosError(_context2.t0)) {
8626
- _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';
8627
- setError(_error2);
8628
- } else if (_context2.t0 instanceof Error) {
8629
- setError((_context2.t0 == null ? void 0 : _context2.t0.message) || 'Error');
8630
- }
8631
-
8632
- case 29:
8633
+ case 31:
8633
8634
  case "end":
8634
8635
  return _context2.stop();
8635
8636
  }
8636
8637
  }
8637
- }, _callee2, null, [[0, 26]]);
8638
+ }, _callee2, null, [[0, 28]]);
8638
8639
  }));
8639
8640
 
8640
8641
  function onSubmit(_x) {