tf-checkout-react 1.6.6-beta.23 → 1.6.6-beta.24

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,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import './style.css';
3
- import { ThemeOptions } from "@mui/material";
4
- import { CSSProperties } from "@mui/styles";
3
+ import { ThemeOptions } from '@mui/material';
4
+ import { CSSProperties } from '@mui/styles';
5
5
  import { IActionColumns, ITicketTypes } from './ticketsTable';
6
6
  interface OrderDetailsTypes {
7
7
  columns: Array<{
@@ -1,6 +1,6 @@
1
- import { FC } from 'react';
2
- import { AxiosError } from 'axios';
3
1
  import './style.css';
2
+ import { AxiosError } from 'axios';
3
+ import { FC } from 'react';
4
4
  interface IResetPasswordProps {
5
5
  token?: string;
6
6
  onResetPasswordSuccess?: (res: any) => void;
@@ -3460,10 +3460,10 @@ var AddonComponent = function AddonComponent(_ref) {
3460
3460
  }, _map(groupItems, function (element) {
3461
3461
  return React__default.createElement("div", {
3462
3462
  className: element.className,
3463
- key: element.name
3463
+ key: data.id + "-" + id + "-" + element.name
3464
3464
  }, React__default.createElement(formik.Field, Object.assign({}, element, {
3465
3465
  type: element.type === 'radio' || element.type === 'checkbox' ? undefined : element.type,
3466
- name: "" + element.name,
3466
+ name: data.id + "-" + id + "-" + element.name,
3467
3467
  label: getFieldLabel(element, configs),
3468
3468
  component: getFieldComponent(element),
3469
3469
  validate: getValidateFunctions(element, [], values, errors)
@@ -3905,6 +3905,22 @@ var AddonsContainter = function AddonsContainter(_ref) {
3905
3905
  var handleClearAddons = function handleClearAddons() {
3906
3906
  window.localStorage.removeItem('add_ons');
3907
3907
  };
3908
+ var initialValues = React.useMemo(function () {
3909
+ var _addOnDataWithCustomF;
3910
+ var addOnsData = {};
3911
+ if ((addons == null ? void 0 : addons.length) > 0 && (addOnDataWithCustomFields == null ? void 0 : (_addOnDataWithCustomF = addOnDataWithCustomFields.fields) == null ? void 0 : _addOnDataWithCustomF.length) > 0) {
3912
+ _map(addons, function (addon) {
3913
+ _map(addOnDataWithCustomFields.fields, function (field) {
3914
+ var id = field.id,
3915
+ groupItems = field.groupItems;
3916
+ _map(groupItems, function (item) {
3917
+ addOnsData[addon.id + "-" + id + "-" + item.name] = item.value;
3918
+ });
3919
+ });
3920
+ });
3921
+ }
3922
+ return addOnsData;
3923
+ }, [addons, addOnDataWithCustomFields]);
3908
3924
  if (loading) {
3909
3925
  return React__default.createElement("div", {
3910
3926
  className: classNamePrefix + "_loader"
@@ -3941,7 +3957,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
3941
3957
  }, "Skip")), (!(addons != null && addons.length) || isResale && addOnIsIncluded) && samePage ? null : React__default.createElement("div", {
3942
3958
  className: classNamePrefix + "_subtitle"
3943
3959
  }, "PLEASE SELECT FROM THE OPTIONAL ADD-ONS BELOW"), React__default.createElement(formik.Formik, {
3944
- initialValues: {},
3960
+ initialValues: initialValues,
3945
3961
  onSubmit: function onSubmit(values) {
3946
3962
  handleConfirm(values);
3947
3963
  },
@@ -3952,7 +3968,8 @@ var AddonsContainter = function AddonsContainter(_ref) {
3952
3968
  } : undefined
3953
3969
  }, function (_ref4) {
3954
3970
  var values = _ref4.values,
3955
- errors = _ref4.errors;
3971
+ errors = _ref4.errors,
3972
+ setFieldTouched = _ref4.setFieldTouched;
3956
3973
  var isConfirmDisabled = !isAtLeastOneAddonSelected(values);
3957
3974
  return React__default.createElement(formik.Form, {
3958
3975
  autoComplete: "off",
@@ -4037,7 +4054,14 @@ var AddonsContainter = function AddonsContainter(_ref) {
4037
4054
  selectOptions: addonsOptions[addon.id],
4038
4055
  classNamePrefix: classNamePrefix,
4039
4056
  handleAddonChange: function handleAddonChange(id, value) {
4040
- return onFieldChange(id, value, addon);
4057
+ onFieldChange(id, value, addon);
4058
+ _map(addOnDataWithCustomFields.fields, function (fieldGroup) {
4059
+ var id = fieldGroup.id,
4060
+ groupItems = fieldGroup.groupItems;
4061
+ _map(groupItems, function (field) {
4062
+ setFieldTouched(addon.id + "-" + id + "-" + field.name, true, true);
4063
+ });
4064
+ });
4041
4065
  },
4042
4066
  addOnDataWithCustomFields: addOnDataWithCustomFields,
4043
4067
  configs: configs,
@@ -5614,7 +5638,8 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
5614
5638
  },
5615
5639
  onForgotPasswordSuccess: onForgotPasswordSuccess,
5616
5640
  onForgotPasswordError: onForgotPasswordError,
5617
- showPoweredByImage: showPoweredByImage
5641
+ showPoweredByImage: showPoweredByImage,
5642
+ displaySuccessMessage: true
5618
5643
  }), React__default.createElement(VerificationPendingModal, {
5619
5644
  message: pendingVerificationMessage,
5620
5645
  onClose: function onClose() {
@@ -13313,13 +13338,14 @@ var PreRegistration = function PreRegistration(_ref) {
13313
13338
  setShowModalLogin(true);
13314
13339
  },
13315
13340
  onForgotPasswordSuccess: onForgotPasswordSuccess,
13316
- onForgotPasswordError: onForgotPasswordError
13341
+ onForgotPasswordError: onForgotPasswordError,
13342
+ displaySuccessMessage: true
13317
13343
  }), React__default.createElement("h2", null, "Pre-Registration"), React__default.createElement(formik.Formik, {
13318
13344
  initialValues: getFormInitialValues$1(formFields),
13319
13345
  enableReinitialize: true,
13320
13346
  onSubmit: function () {
13321
13347
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
13322
- var updatedValues, holderAgeDate, confirmationData, bodyFormData, res, profileRes, _e$response, _e$response$data, _e$response$data$mess, _e$response2, _e$response2$data, errorMessage, emailErrors, _e$response3, _e$response3$data;
13348
+ var updatedValues, holderAgeDate, confirmationData, bodyFormData, res, profileRes, _error2$response, _error2$response$data, _error2$response$data2, _error2$response2, _error2$response2$dat, _error2, errorMessage, emailErrors, _error2$response3, _error2$response3$dat;
13323
13349
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
13324
13350
  while (1) switch (_context2.prev = _context2.next) {
13325
13351
  case 0:
@@ -13386,15 +13412,16 @@ var PreRegistration = function PreRegistration(_ref) {
13386
13412
  setUserData(_get(profileRes, 'data'));
13387
13413
  }
13388
13414
  case 41:
13389
- _context2.next = 50;
13415
+ _context2.next = 51;
13390
13416
  break;
13391
13417
  case 43:
13392
13418
  _context2.prev = 43;
13393
13419
  _context2.t0 = _context2["catch"](0);
13394
- errorMessage = (_context2.t0 == null ? void 0 : _context2.t0.message) || 'Error';
13395
- emailErrors = _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$mess = _e$response$data.message) == null ? void 0 : _e$response$data$mess.email;
13396
- if (typeof (_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) === 'string') {
13397
- errorMessage = _context2.t0 == null ? void 0 : (_e$response3 = _context2.t0.response) == null ? void 0 : (_e$response3$data = _e$response3.data) == null ? void 0 : _e$response3$data.message;
13420
+ _error2 = _context2.t0;
13421
+ errorMessage = (_error2 == null ? void 0 : _error2.message) || 'Error';
13422
+ emailErrors = _error2 == null ? void 0 : (_error2$response = _error2.response) == null ? void 0 : (_error2$response$data = _error2$response.data) == null ? void 0 : (_error2$response$data2 = _error2$response$data.message) == null ? void 0 : _error2$response$data2.email;
13423
+ if (typeof (_error2 == null ? void 0 : (_error2$response2 = _error2.response) == null ? void 0 : (_error2$response2$dat = _error2$response2.data) == null ? void 0 : _error2$response2$dat.message) === 'string') {
13424
+ errorMessage = _error2 == null ? void 0 : (_error2$response3 = _error2.response) == null ? void 0 : (_error2$response3$dat = _error2$response3.data) == null ? void 0 : _error2$response3$dat.message;
13398
13425
  }
13399
13426
  if ((emailErrors == null ? void 0 : emailErrors.length) > 0) {
13400
13427
  if (emailErrors[0] === 'The email is already used') {
@@ -13404,8 +13431,8 @@ var PreRegistration = function PreRegistration(_ref) {
13404
13431
  } else {
13405
13432
  setError(errorMessage);
13406
13433
  }
13407
- onConfirmationError(_context2.t0);
13408
- case 50:
13434
+ onConfirmationError(_error2);
13435
+ case 51:
13409
13436
  case "end":
13410
13437
  return _context2.stop();
13411
13438
  }