tf-checkout-react 1.3.15 → 1.3.17

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,5 +1,5 @@
1
- import { IGroupItem } from '../../types';
2
1
  import { FormikErrors, FormikValues } from 'formik';
2
+ import { IGroupItem } from '../../types';
3
3
  export interface ILoggedInValues {
4
4
  emailLogged?: string;
5
5
  firstNameLogged?: string;
@@ -13,7 +13,7 @@ export declare const createRegisterFormData: (values: IValues | undefined, check
13
13
  attributes: {
14
14
  [key: string]: any;
15
15
  };
16
- }) => FormData;
16
+ }, flagFreeTicket?: boolean) => FormData;
17
17
  interface ICheckoutBody {
18
18
  attributes: {
19
19
  [key: string]: any;
@@ -2624,11 +2624,15 @@ var getInitialValues = function getInitialValues(data, propsInitialValues, userV
2624
2624
  initialValues['holderEmail-0'] = propsInitialValues.email || userValues.email || '';
2625
2625
  return initialValues;
2626
2626
  };
2627
- var createRegisterFormData = function createRegisterFormData(values, checkoutBody) {
2627
+ var createRegisterFormData = function createRegisterFormData(values, checkoutBody, flagFreeTicket) {
2628
2628
  if (values === void 0) {
2629
2629
  values = {};
2630
2630
  }
2631
2631
 
2632
+ if (flagFreeTicket === void 0) {
2633
+ flagFreeTicket = false;
2634
+ }
2635
+
2632
2636
  var bodyFormData = new FormData();
2633
2637
  bodyFormData.append('first_name', values.firstName);
2634
2638
  bodyFormData.append('last_name', values.lastName);
@@ -2640,7 +2644,9 @@ var createRegisterFormData = function createRegisterFormData(values, checkoutBod
2640
2644
  bodyFormData.append('check_cart_expiration', 'true');
2641
2645
 
2642
2646
  _forEach(checkoutBody.attributes, function (item, key) {
2643
- bodyFormData.append(key, item);
2647
+ if (!(flagFreeTicket && ['country', 'state', 'city', 'street_address', 'zip'].includes(key))) {
2648
+ bodyFormData.append(key, item);
2649
+ }
2644
2650
  });
2645
2651
 
2646
2652
  return bodyFormData;
@@ -3077,10 +3083,11 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3077
3083
  var expirationTime = _get(cartInfoData, 'expiresAt');
3078
3084
 
3079
3085
  var flagRequirePhone = getQueryVariable('phone_required') === 'true';
3080
- var collectOptionalWalletAddress = getQueryVariable('collect_optional_wallet_address') === 'true';
3081
3086
  var collectMandatoryWalletAddress = getQueryVariable('collect_mandatory_wallet_address') === 'true';
3087
+ var collectOptionalWalletAddress = getQueryVariable('collect_optional_wallet_address') === 'true';
3082
3088
  var flagFreeTicket = getQueryVariable('free_ticket') === 'true';
3083
- var hidePhoneField = getQueryVariable('hide_phone_field') === 'true'; // Get prevProps
3089
+ var hidePhoneField = getQueryVariable('hide_phone_field') === 'true';
3090
+ var hideWalletAddressField = !collectOptionalWalletAddress && !collectMandatoryWalletAddress; // Get prevProps
3084
3091
 
3085
3092
  var prevData = React.useRef(data);
3086
3093
 
@@ -3442,7 +3449,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3442
3449
  firstNameLogged: firstNameLogged,
3443
3450
  lastNameLogged: lastNameLogged
3444
3451
  }, showDOB);
3445
- bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
3452
+ bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration, flagFreeTicket);
3446
3453
  _context6.prev = 19;
3447
3454
  setLoading(true);
3448
3455
  _context6.next = 23;
@@ -3650,10 +3657,6 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3650
3657
  }
3651
3658
 
3652
3659
  if (el.name === 'data_capture[wallet_address]') {
3653
- if (collectOptionalWalletAddress) {
3654
- el.required = false;
3655
- }
3656
-
3657
3660
  if (collectMandatoryWalletAddress) {
3658
3661
  el.required = true;
3659
3662
  }
@@ -3668,14 +3671,14 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3668
3671
 
3669
3672
  return true;
3670
3673
  }), function (element) {
3671
- return ['password', 'confirmPassword', 'password-info'].includes(element.name) && isLoggedIn ? null : React__default.createElement(React__default.Fragment, {
3674
+ return ['password', 'confirmPassword', 'password-info'].includes(element.name) && isLoggedIn ? null : ['data_capture[wallet_address]'].includes(element.name) && hideWalletAddressField ? null : React__default.createElement(React__default.Fragment, {
3672
3675
  key: element.uniqueId
3673
3676
  }, React__default.createElement("div", {
3674
3677
  className: element.className + " " + (props == null ? void 0 : props.errors[element.name])
3675
3678
  }, element.component ? element.component : React__default.createElement(formik.Field, {
3676
3679
  setPhoneValidationIsLoading: element.type === 'phone' ? setPhoneValidationIsLoading : undefined,
3677
3680
  name: element.name,
3678
- label: element.name === 'phone' ? "" + element.label + (flagRequirePhone ? '' : ' (optional)') + " " : element.name === 'data_capture[wallet_address]' ? "" + element.label + (collectOptionalWalletAddress ? ' (optional)' : '') + " " : element.label,
3681
+ label: element.name === 'phone' ? "" + element.label + (flagRequirePhone ? '' : ' (optional)') + " " : element.name === 'data_capture[wallet_address]' ? "" + element.label + (!collectMandatoryWalletAddress ? ' (optional)' : '') + " " : element.label,
3679
3682
  type: element.type,
3680
3683
  fill: element.fill,
3681
3684
  validate: getValidateFunctions(element, states, props.values, props.errors),