tf-checkout-react 1.0.92 → 1.0.93

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,4 +1,5 @@
1
1
  import { IGroupItem } from '../../types';
2
+ import { FormikValues } from 'formik';
2
3
  export interface ILoggedInValues {
3
4
  emailLogged?: string;
4
5
  firstNameLogged?: string;
@@ -48,6 +49,6 @@ export declare const setLoggedUserData: (data: IUserData) => {
48
49
  export declare const createCheckoutDataBody: (ticketsQuantity: number, values?: IValues, logedInValues?: ILoggedInValues, includeDob?: boolean) => ICheckoutBody;
49
50
  export declare const getValidateFunctions: (element: IGroupItem, states: {
50
51
  [key: string]: any;
51
- }[]) => (...value: any) => any;
52
+ }[], values: FormikValues) => (...value: any) => any;
52
53
  export declare const assingUniqueIds: (data: any) => any;
53
54
  export {};
@@ -1866,7 +1866,7 @@ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, va
1866
1866
 
1867
1867
  return body;
1868
1868
  };
1869
- var getValidateFunctions = function getValidateFunctions(element, states) {
1869
+ var getValidateFunctions = function getValidateFunctions(element, states, values) {
1870
1870
  var validationFunctions = [];
1871
1871
 
1872
1872
  if (element.required) {
@@ -1879,6 +1879,14 @@ var getValidateFunctions = function getValidateFunctions(element, states) {
1879
1879
  validationFunctions.push(element.onValidate);
1880
1880
  }
1881
1881
 
1882
+ if (element.name === 'confirmEmail') {
1883
+ var isSameEmail = function isSameEmail(confirmEmail) {
1884
+ return values.email !== confirmEmail ? 'Please confirm your email address correctly' : null;
1885
+ };
1886
+
1887
+ validationFunctions.push(isSameEmail);
1888
+ }
1889
+
1882
1890
  return combineValidators.apply(void 0, validationFunctions);
1883
1891
  };
1884
1892
  var assingUniqueIds = function assingUniqueIds(data) {
@@ -2379,7 +2387,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2379
2387
 
2380
2388
  var ttfOptIn = Boolean(_get(cartInfoData, 'ttfOptIn', false));
2381
2389
 
2382
- var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true); // Get prevProps
2390
+ var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true);
2391
+
2392
+ var flagRequirePhone = _get(cartInfoData, 'flagRequirePhone', false); // Get prevProps
2383
2393
 
2384
2394
 
2385
2395
  var prevData = React.useRef(data);
@@ -2887,6 +2897,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2887
2897
  return false;
2888
2898
  }
2889
2899
 
2900
+ if (el.name === 'phone' && !flagRequirePhone) {
2901
+ el.required = true;
2902
+ }
2903
+
2890
2904
  return true;
2891
2905
  }), function (element) {
2892
2906
  return ['password', 'confirmPassword', 'password-info'].includes(element.name) && isLoggedIn ? null : React__default.createElement(React__default.Fragment, {
@@ -2897,7 +2911,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2897
2911
  name: element.name,
2898
2912
  label: element.label,
2899
2913
  type: element.type,
2900
- validate: getValidateFunctions(element, states),
2914
+ validate: getValidateFunctions(element, states, props.values),
2901
2915
  setFieldValue: props.setFieldValue,
2902
2916
  onBlur: props.handleBlur,
2903
2917
  component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : element.type === 'phone' ? FormikPhoneNumberField : CustomField,
@@ -3767,7 +3781,7 @@ var SocialButtons = function SocialButtons(_ref2) {
3767
3781
  return React__default.createElement(SocialComponent, Object.assign({
3768
3782
  key: index
3769
3783
  }, shareButton));
3770
- })));
3784
+ })), (showDefaultShareButtons || shareButtons.length) && React__default.createElement("p", null, "We ", React__default.createElement("strong", null, "never"), " post on Facebook without your permission!"));
3771
3785
  };
3772
3786
 
3773
3787
  var ConfirmationContainer = function ConfirmationContainer(_ref) {