tf-checkout-react 1.0.89 → 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 {};
@@ -1294,7 +1294,7 @@ var getStates = function getStates(countryId) {
1294
1294
  return publicRequest.get("/countries/" + countryId + "/states/");
1295
1295
  };
1296
1296
  var getOrders = function getOrders(page, limit, eventSlug) {
1297
- return publicRequest.get("/v1/account/orders/?page=" + page + "&limit=" + limit + "&filter[event]=" + eventSlug);
1297
+ return publicRequest.get("/v1/account/orders/?page=" + page + "&limit=" + limit + "&filter[event]=" + eventSlug + "&filter[brand]=" + CONFIGS.BRAND_SLUG);
1298
1298
  };
1299
1299
  var getOrderDetails = function getOrderDetails(orderId) {
1300
1300
  return publicRequest.get("/v1/account/order/" + orderId);
@@ -1338,6 +1338,12 @@ var LoginModal = function LoginModal(_ref) {
1338
1338
  error = _useState[0],
1339
1339
  setError = _useState[1];
1340
1340
 
1341
+ var handleForgotPassword = function handleForgotPassword() {
1342
+ if (typeof window !== 'undefined') {
1343
+ window.open(CONFIGS.BASE_URL + "/password-restore/");
1344
+ }
1345
+ };
1346
+
1341
1347
  return React__default.createElement(Modal, {
1342
1348
  open: true,
1343
1349
  onClose: onClose,
@@ -1516,7 +1522,11 @@ var LoginModal = function LoginModal(_ref) {
1516
1522
  className: "login-action-button"
1517
1523
  }, React__default.createElement("button", {
1518
1524
  type: "submit"
1519
- }, "Login"))));
1525
+ }, "Login")), React__default.createElement("div", {
1526
+ className: 'forgot-password'
1527
+ }, React__default.createElement("span", {
1528
+ onClick: handleForgotPassword
1529
+ }, "Forgot password?"))));
1520
1530
  }))));
1521
1531
  };
1522
1532
 
@@ -1856,7 +1866,7 @@ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, va
1856
1866
 
1857
1867
  return body;
1858
1868
  };
1859
- var getValidateFunctions = function getValidateFunctions(element, states) {
1869
+ var getValidateFunctions = function getValidateFunctions(element, states, values) {
1860
1870
  var validationFunctions = [];
1861
1871
 
1862
1872
  if (element.required) {
@@ -1869,6 +1879,14 @@ var getValidateFunctions = function getValidateFunctions(element, states) {
1869
1879
  validationFunctions.push(element.onValidate);
1870
1880
  }
1871
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
+
1872
1890
  return combineValidators.apply(void 0, validationFunctions);
1873
1891
  };
1874
1892
  var assingUniqueIds = function assingUniqueIds(data) {
@@ -2369,7 +2387,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2369
2387
 
2370
2388
  var ttfOptIn = Boolean(_get(cartInfoData, 'ttfOptIn', false));
2371
2389
 
2372
- 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
2373
2393
 
2374
2394
 
2375
2395
  var prevData = React.useRef(data);
@@ -2612,7 +2632,24 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2612
2632
  }();
2613
2633
 
2614
2634
  collectPaymentData();
2615
- }, [skipPage, ticketsQuantity]); // Displaying loader
2635
+ }, [skipPage, ticketsQuantity]);
2636
+
2637
+ var collectCheckoutBody = function collectCheckoutBody(values) {
2638
+ var checkoutBody = {}; // Auto collect ticket holders name when it was skipped optionally
2639
+
2640
+ if (showDOB && !showTicketHolders && canSkipHolderNames) {
2641
+ checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity.length, values, true);
2642
+ } else {
2643
+ checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
2644
+ emailLogged: emailLogged,
2645
+ firstNameLogged: firstNameLogged,
2646
+ lastNameLogged: lastNameLogged
2647
+ }, showDOB);
2648
+ }
2649
+
2650
+ return checkoutBody;
2651
+ }; // Displaying loader
2652
+
2616
2653
 
2617
2654
  if (loading) {
2618
2655
  return React__default.createElement(Backdrop, {
@@ -2646,7 +2683,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2646
2683
  _context6.prev = 0;
2647
2684
 
2648
2685
  if (!isLoggedIn) {
2649
- _context6.next = 18;
2686
+ _context6.next = 17;
2650
2687
  break;
2651
2688
  }
2652
2689
 
@@ -2668,31 +2705,20 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2668
2705
  }
2669
2706
 
2670
2707
  case 9:
2671
- _checkoutBody = {}; // Auto collect ticket holders name when it was skipped optionally
2672
-
2673
- if (showDOB && !showTicketHolders && canSkipHolderNames) {
2674
- _checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity.length, values, true);
2675
- } else {
2676
- _checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
2677
- emailLogged: emailLogged,
2678
- firstNameLogged: firstNameLogged,
2679
- lastNameLogged: lastNameLogged
2680
- }, showDOB);
2681
- }
2682
-
2683
- _context6.next = 13;
2708
+ _checkoutBody = collectCheckoutBody(values);
2709
+ _context6.next = 12;
2684
2710
  return postOnCheckout(_checkoutBody, access_token);
2685
2711
 
2686
- case 13:
2712
+ case 12:
2687
2713
  _res = _context6.sent;
2688
- _context6.next = 16;
2714
+ _context6.next = 15;
2689
2715
  return getPaymentData(_res.data.data.attributes.hash);
2690
2716
 
2691
- case 16:
2717
+ case 15:
2692
2718
  handleSubmit(values, formikHelpers, eventId, _res);
2693
2719
  return _context6.abrupt("return");
2694
2720
 
2695
- case 18:
2721
+ case 17:
2696
2722
  checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
2697
2723
  emailLogged: emailLogged,
2698
2724
  firstNameLogged: firstNameLogged,
@@ -2700,11 +2726,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2700
2726
  }, showDOB);
2701
2727
  bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
2702
2728
  access_token_register = null;
2703
- _context6.prev = 21;
2704
- _context6.next = 24;
2729
+ _context6.prev = 20;
2730
+ _context6.next = 23;
2705
2731
  return register(bodyFormData);
2706
2732
 
2707
- case 24:
2733
+ case 23:
2708
2734
  resRegister = _context6.sent;
2709
2735
  access_token_register = _get(resRegister, 'data.data.attributes.access_token');
2710
2736
  refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
@@ -2714,12 +2740,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2714
2740
  refreshToken: refreshToken
2715
2741
  };
2716
2742
  onRegisterSuccess(tokens);
2717
- _context6.next = 36;
2743
+ _context6.next = 35;
2718
2744
  break;
2719
2745
 
2720
- case 32:
2721
- _context6.prev = 32;
2722
- _context6.t0 = _context6["catch"](21);
2746
+ case 31:
2747
+ _context6.prev = 31;
2748
+ _context6.t0 = _context6["catch"](20);
2723
2749
 
2724
2750
  if (axios.isAxiosError(_context6.t0)) {
2725
2751
  _error = _context6.t0 == null ? void 0 : (_e$response = _context6.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
@@ -2744,11 +2770,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2744
2770
 
2745
2771
  return _context6.abrupt("return");
2746
2772
 
2747
- case 36:
2748
- _context6.next = 38;
2773
+ case 35:
2774
+ _context6.next = 37;
2749
2775
  return getProfileData(access_token_register);
2750
2776
 
2751
- case 38:
2777
+ case 37:
2752
2778
  profileData = _context6.sent;
2753
2779
  profileSpecifiedData = _get(profileData, 'data.data');
2754
2780
  profileDataObj = setLoggedUserData(profileSpecifiedData);
@@ -2757,26 +2783,22 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2757
2783
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
2758
2784
  }
2759
2785
 
2760
- checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
2761
- emailLogged: emailLogged,
2762
- firstNameLogged: firstNameLogged,
2763
- lastNameLogged: lastNameLogged
2764
- }, showDOB);
2765
- _context6.next = 45;
2786
+ checkoutBody = collectCheckoutBody(values);
2787
+ _context6.next = 44;
2766
2788
  return postOnCheckout(checkoutBody, access_token_register);
2767
2789
 
2768
- case 45:
2790
+ case 44:
2769
2791
  res = _context6.sent;
2770
- _context6.next = 48;
2792
+ _context6.next = 47;
2771
2793
  return getPaymentData(res.data.data.attributes.hash);
2772
2794
 
2773
- case 48:
2795
+ case 47:
2774
2796
  handleSubmit(values, formikHelpers, eventId, res);
2775
- _context6.next = 54;
2797
+ _context6.next = 53;
2776
2798
  break;
2777
2799
 
2778
- case 51:
2779
- _context6.prev = 51;
2800
+ case 50:
2801
+ _context6.prev = 50;
2780
2802
  _context6.t1 = _context6["catch"](0);
2781
2803
 
2782
2804
  if (axios.isAxiosError(_context6.t1)) {
@@ -2800,12 +2822,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2800
2822
  onSubmitError(_context6.t1);
2801
2823
  }
2802
2824
 
2803
- case 54:
2825
+ case 53:
2804
2826
  case "end":
2805
2827
  return _context6.stop();
2806
2828
  }
2807
2829
  }
2808
- }, _callee6, null, [[0, 51], [21, 32]]);
2830
+ }, _callee6, null, [[0, 50], [20, 31]]);
2809
2831
  }));
2810
2832
 
2811
2833
  function onSubmit(_x2, _x3) {
@@ -2875,6 +2897,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2875
2897
  return false;
2876
2898
  }
2877
2899
 
2900
+ if (el.name === 'phone' && !flagRequirePhone) {
2901
+ el.required = true;
2902
+ }
2903
+
2878
2904
  return true;
2879
2905
  }), function (element) {
2880
2906
  return ['password', 'confirmPassword', 'password-info'].includes(element.name) && isLoggedIn ? null : React__default.createElement(React__default.Fragment, {
@@ -2885,7 +2911,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2885
2911
  name: element.name,
2886
2912
  label: element.label,
2887
2913
  type: element.type,
2888
- validate: getValidateFunctions(element, states),
2914
+ validate: getValidateFunctions(element, states, props.values),
2889
2915
  setFieldValue: props.setFieldValue,
2890
2916
  onBlur: props.handleBlur,
2891
2917
  component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : element.type === 'phone' ? FormikPhoneNumberField : CustomField,
@@ -3755,7 +3781,7 @@ var SocialButtons = function SocialButtons(_ref2) {
3755
3781
  return React__default.createElement(SocialComponent, Object.assign({
3756
3782
  key: index
3757
3783
  }, shareButton));
3758
- })));
3784
+ })), (showDefaultShareButtons || shareButtons.length) && React__default.createElement("p", null, "We ", React__default.createElement("strong", null, "never"), " post on Facebook without your permission!"));
3759
3785
  };
3760
3786
 
3761
3787
  var ConfirmationContainer = function ConfirmationContainer(_ref) {