tf-checkout-react 1.0.55 → 1.0.59

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.
Files changed (37) hide show
  1. package/dist/api/index.d.ts +2 -0
  2. package/dist/components/billing-info-container/index.d.ts +3 -1
  3. package/dist/components/confirmationContainer/index.d.ts +1 -1
  4. package/dist/components/index.d.ts +2 -0
  5. package/dist/components/myTicketsContainer/index.d.ts +9 -0
  6. package/dist/components/myTicketsContainer/row.d.ts +15 -0
  7. package/dist/components/myTicketsContainer/tableConfig.d.ts +5 -0
  8. package/dist/components/orderDetailsContainer/index.d.ts +8 -0
  9. package/dist/components/orderDetailsContainer/ticketsTable.d.ts +6 -0
  10. package/dist/components/paymentContainer/index.d.ts +3 -1
  11. package/dist/components/ticketsContainer/index.d.ts +2 -1
  12. package/dist/tf-checkout-react.cjs.development.css +1 -1
  13. package/dist/tf-checkout-react.cjs.development.js +85 -48
  14. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  15. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  16. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  17. package/dist/tf-checkout-react.esm.js +86 -49
  18. package/dist/tf-checkout-react.esm.js.map +1 -1
  19. package/package.json +1 -1
  20. package/src/api/index.ts +6 -1
  21. package/src/components/billing-info-container/index.tsx +22 -7
  22. package/src/components/billing-info-container/utils.ts +8 -0
  23. package/src/components/confirmationContainer/index.tsx +4 -3
  24. package/src/components/index.ts +2 -0
  25. package/src/components/loginModal/index.tsx +1 -0
  26. package/src/components/myTicketsContainer/index.tsx +125 -0
  27. package/src/components/myTicketsContainer/row.tsx +41 -0
  28. package/src/components/myTicketsContainer/style.css +40 -0
  29. package/src/components/myTicketsContainer/tableConfig.tsx +34 -0
  30. package/src/components/orderDetailsContainer/index.tsx +120 -0
  31. package/src/components/orderDetailsContainer/style.css +53 -0
  32. package/src/components/orderDetailsContainer/ticketsTable.tsx +86 -0
  33. package/src/components/paymentContainer/index.tsx +5 -1
  34. package/src/components/stripePayment/index.tsx +17 -13
  35. package/src/components/ticketsContainer/index.tsx +3 -1
  36. package/src/components/waitingList/index.tsx +2 -1
  37. package/src/components/waitingList/style.css +7 -0
@@ -1281,7 +1281,11 @@ var LoginModal = function LoginModal(_ref) {
1281
1281
  onSubmit: props.handleSubmit
1282
1282
  }, React.createElement("div", {
1283
1283
  className: "modal-title"
1284
- }, "Login"), React.createElement("div", {
1284
+ }, "Login"), React.createElement("img", {
1285
+ className: "login-logo-tff",
1286
+ src: "https://www.ticketfairy.com/resources/images/logo-ttf-black.svg",
1287
+ alt: ""
1288
+ }), React.createElement("div", {
1285
1289
  className: "server_auth__error"
1286
1290
  }, error), alreadyHasUser && React.createElement("p", {
1287
1291
  className: "info-text-for-login"
@@ -1551,8 +1555,12 @@ var getInitialValues = function getInitialValues(data, propsInitialValues, userV
1551
1555
 
1552
1556
  _forEach(results, function (item) {
1553
1557
  initialValues[item] = propsInitialValues[item] || userValues[item] || '';
1554
- });
1558
+ }); // set logged in user as first ticket holder
1559
+
1555
1560
 
1561
+ initialValues['holderFirstName-0'] = propsInitialValues.firstName || userValues.firstName || '';
1562
+ initialValues['holderLastName-0'] = propsInitialValues.lastName || userValues.lastName || '';
1563
+ initialValues['holderEmail-0'] = propsInitialValues.email || userValues.email || '';
1556
1564
  return initialValues;
1557
1565
  };
1558
1566
  var createRegisterFormData = function createRegisterFormData(values, checkoutBody) {
@@ -1953,7 +1961,10 @@ var LogicRunner = function LogicRunner(_ref) {
1953
1961
  brand_opt_in: (parsedData == null ? void 0 : parsedData.brand_opt_in) || '',
1954
1962
  city: (parsedData == null ? void 0 : parsedData.city) || '',
1955
1963
  confirmPassword: '',
1956
- password: ''
1964
+ password: '',
1965
+ 'holderFirstName-0': (parsedData == null ? void 0 : parsedData.first_name) || '',
1966
+ 'holderLastName-0': (parsedData == null ? void 0 : parsedData.last_name) || '',
1967
+ 'holderEmail-0': (parsedData == null ? void 0 : parsedData.email) || ''
1957
1968
  };
1958
1969
  setValues(mappedValues);
1959
1970
  setUserValues(mappedValues);
@@ -2010,47 +2021,56 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2010
2021
  _ref3$onAuthorizeErro = _ref3.onAuthorizeError,
2011
2022
  onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? function () {} : _ref3$onAuthorizeErro,
2012
2023
  _ref3$onLogin = _ref3.onLogin,
2013
- onLogin = _ref3$onLogin === void 0 ? function () {} : _ref3$onLogin;
2014
- var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
2015
- var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
2024
+ onLogin = _ref3$onLogin === void 0 ? function () {} : _ref3$onLogin,
2025
+ _ref3$onLoginSuccess = _ref3.onLoginSuccess,
2026
+ onLoginSuccess = _ref3$onLoginSuccess === void 0 ? function () {} : _ref3$onLoginSuccess,
2027
+ _ref3$isLoggedIn = _ref3.isLoggedIn,
2028
+ pIsLoggedIn = _ref3$isLoggedIn === void 0 ? false : _ref3$isLoggedIn;
2029
+ var isWindowDefined = typeof window !== 'undefined';
2030
+ var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
2031
+ var access_token = isWindowDefined && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
2016
2032
 
2017
2033
  var _useState = useState(data),
2018
2034
  dataWithUniqueIds = _useState[0],
2019
2035
  setDataWithUniqueIds = _useState[1];
2020
2036
 
2021
- var _useState2 = useState({}),
2022
- cartInfoData = _useState2[0],
2023
- setCartInfo = _useState2[1];
2037
+ var _useState2 = useState(!!access_token),
2038
+ isLoggedIn = _useState2[0],
2039
+ setIsLoggedIn = _useState2[1];
2024
2040
 
2025
- var _useState3 = useState([]),
2026
- countries = _useState3[0],
2027
- setCountries = _useState3[1];
2041
+ var _useState3 = useState({}),
2042
+ cartInfoData = _useState3[0],
2043
+ setCartInfo = _useState3[1];
2028
2044
 
2029
2045
  var _useState4 = useState([]),
2030
- states = _useState4[0],
2031
- setStates = _useState4[1];
2046
+ countries = _useState4[0],
2047
+ setCountries = _useState4[1];
2032
2048
 
2033
- var _useState5 = useState(false),
2034
- showModalLogin = _useState5[0],
2035
- setShowModalLogin = _useState5[1];
2049
+ var _useState5 = useState([]),
2050
+ states = _useState5[0],
2051
+ setStates = _useState5[1];
2036
2052
 
2037
2053
  var _useState6 = useState(false),
2038
- alreadyHasUser = _useState6[0],
2039
- setAlreadyHasUser = _useState6[1];
2054
+ showModalLogin = _useState6[0],
2055
+ setShowModalLogin = _useState6[1];
2040
2056
 
2041
2057
  var _useState7 = useState(false),
2042
- userExpired = _useState7[0],
2043
- setUserExpired = _useState7[1];
2058
+ alreadyHasUser = _useState7[0],
2059
+ setAlreadyHasUser = _useState7[1];
2044
2060
 
2045
2061
  var _useState8 = useState(false),
2046
- showModalRegister = _useState8[0],
2047
- setShowModalRegister = _useState8[1];
2062
+ userExpired = _useState8[0],
2063
+ setUserExpired = _useState8[1];
2064
+
2065
+ var _useState9 = useState(false),
2066
+ showModalRegister = _useState9[0],
2067
+ setShowModalRegister = _useState9[1];
2048
2068
 
2049
- var _useState9 = useState([]),
2050
- ticketsQuantity = _useState9[0],
2051
- setTicketsQuantity = _useState9[1];
2069
+ var _useState10 = useState([]),
2070
+ ticketsQuantity = _useState10[0],
2071
+ setTicketsQuantity = _useState10[1];
2052
2072
 
2053
- var _useState10 = useState({
2073
+ var _useState11 = useState({
2054
2074
  firstName: '',
2055
2075
  lastName: '',
2056
2076
  email: '',
@@ -2065,10 +2085,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2065
2085
  state: '',
2066
2086
  zip: ''
2067
2087
  }),
2068
- userValues = _useState10[0],
2069
- setUserValues = _useState10[1];
2070
-
2071
- var isLoggedIn = !!access_token;
2088
+ userValues = _useState11[0],
2089
+ setUserValues = _useState11[1];
2072
2090
 
2073
2091
  var emailLogged = _get(userData, 'email', '') || _get(userValues, 'email', '');
2074
2092
 
@@ -2097,8 +2115,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2097
2115
  qty += +item.quantity;
2098
2116
  });
2099
2117
  return qty;
2100
- }; //just once
2118
+ };
2101
2119
 
2120
+ useEffect(function () {
2121
+ if ((pIsLoggedIn || access_token) && !isLoggedIn) {
2122
+ setIsLoggedIn(true);
2123
+ }
2124
+ }, [pIsLoggedIn, isLoggedIn, access_token]); //just once
2102
2125
 
2103
2126
  useEffect(function () {
2104
2127
  // fetch countries data
@@ -2207,7 +2230,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2207
2230
  case 0:
2208
2231
  _context4.prev = 0;
2209
2232
 
2210
- if (!(typeof window !== 'undefined' && token)) {
2233
+ if (!(isWindowDefined && token)) {
2211
2234
  _context4.next = 10;
2212
2235
  break;
2213
2236
  }
@@ -2288,7 +2311,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2288
2311
  _profileSpecifiedData = _get(updatedUserData, 'data.data');
2289
2312
  _profileDataObj = setLoggedUserData(_profileSpecifiedData);
2290
2313
 
2291
- if (typeof window !== 'undefined') {
2314
+ if (isWindowDefined) {
2292
2315
  window.localStorage.setItem('user_data', JSON.stringify(_profileDataObj));
2293
2316
  }
2294
2317
 
@@ -2366,7 +2389,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2366
2389
  profileSpecifiedData = _get(profileData, 'data.data');
2367
2390
  profileDataObj = setLoggedUserData(profileSpecifiedData);
2368
2391
 
2369
- if (typeof window !== 'undefined') {
2392
+ if (isWindowDefined) {
2370
2393
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
2371
2394
  }
2372
2395
 
@@ -2390,7 +2413,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2390
2413
 
2391
2414
  if (axios.isAxiosError(_context5.t1)) {
2392
2415
  if (((_e$response2 = _context5.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
2393
- if (typeof window !== 'undefined') {
2416
+ if (isWindowDefined) {
2394
2417
  window.localStorage.removeItem('user_data');
2395
2418
  window.localStorage.removeItem('access_token');
2396
2419
  setUserExpired(true);
@@ -2528,6 +2551,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2528
2551
  onLogin: function onLogin() {
2529
2552
  setShowModalLogin(false);
2530
2553
  setUserExpired(false);
2554
+ onLoginSuccess();
2531
2555
  },
2532
2556
  alreadyHasUser: alreadyHasUser,
2533
2557
  userExpired: userExpired,
@@ -2627,6 +2651,9 @@ var options = {
2627
2651
  fontSize: '18px',
2628
2652
  color: '#ffffff',
2629
2653
  letterSpacing: '1px',
2654
+ ':-webkit-autofill': {
2655
+ color: '#ffffff'
2656
+ },
2630
2657
  '::placeholder': {
2631
2658
  color: 'rgba(201, 201, 201, 0.5)'
2632
2659
  }
@@ -2642,7 +2669,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2642
2669
  _ref$onSubmit = _ref.onSubmit,
2643
2670
  onSubmit = _ref$onSubmit === void 0 ? _identity : _ref$onSubmit,
2644
2671
  _ref$stripeCardOption = _ref.stripeCardOptions,
2645
- stripeCardOptions = _ref$stripeCardOption === void 0 ? options : _ref$stripeCardOption,
2672
+ stripeCardOptions = _ref$stripeCardOption === void 0 ? {} : _ref$stripeCardOption,
2646
2673
  _ref$error = _ref.error,
2647
2674
  error = _ref$error === void 0 ? null : _ref$error,
2648
2675
  stripe_client_secret = _ref.stripe_client_secret,
@@ -2829,7 +2856,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2829
2856
  }, React.createElement("span", {
2830
2857
  className: "card_label_text"
2831
2858
  }, "Card number"), React.createElement(CardNumberElement, {
2832
- options: stripeCardOptions,
2859
+ options: _extends({}, options, stripeCardOptions),
2833
2860
  onReady: _identity,
2834
2861
  onChange: _identity,
2835
2862
  onBlur: _identity,
@@ -2839,13 +2866,13 @@ var CheckoutForm = function CheckoutForm(_ref) {
2839
2866
  }, React.createElement("span", {
2840
2867
  className: "card_label_text"
2841
2868
  }, "Expiration date"), React.createElement(CardExpiryElement, {
2842
- options: stripeCardOptions
2869
+ options: _extends({}, options, stripeCardOptions)
2843
2870
  })), React.createElement("label", {
2844
2871
  className: "cvc_element"
2845
2872
  }, React.createElement("span", {
2846
2873
  className: "card_label_text"
2847
2874
  }, "CVC"), React.createElement(CardCvcElement, {
2848
- options: stripeCardOptions
2875
+ options: _extends({}, options, stripeCardOptions)
2849
2876
  })), React.createElement("label", {
2850
2877
  className: "zip_element"
2851
2878
  }, React.createElement("p", {
@@ -2911,7 +2938,9 @@ var PaymentContainer = function PaymentContainer(_ref) {
2911
2938
  _ref$onGetPaymentData2 = _ref.onGetPaymentDataError,
2912
2939
  onGetPaymentDataError = _ref$onGetPaymentData2 === void 0 ? function () {} : _ref$onGetPaymentData2,
2913
2940
  _ref$onPaymentError = _ref.onPaymentError,
2914
- onPaymentError = _ref$onPaymentError === void 0 ? function () {} : _ref$onPaymentError;
2941
+ onPaymentError = _ref$onPaymentError === void 0 ? function () {} : _ref$onPaymentError,
2942
+ _ref$stripeCardOption = _ref.stripeCardOptions,
2943
+ stripeCardOptions = _ref$stripeCardOption === void 0 ? {} : _ref$stripeCardOption;
2915
2944
 
2916
2945
  var _useState = useState(initialReviewValues),
2917
2946
  reviewData = _useState[0],
@@ -3132,7 +3161,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
3132
3161
  handleSetLoading: function handleSetLoading(value) {
3133
3162
  return setPaymentIsLoading(value);
3134
3163
  },
3135
- conditions: conditions
3164
+ conditions: conditions,
3165
+ stripeCardOptions: stripeCardOptions
3136
3166
  }))))));
3137
3167
  };
3138
3168
 
@@ -3141,7 +3171,8 @@ styleInject(css_248z$5);
3141
3171
 
3142
3172
  var defaultSvg = 'https://img.icons8.com/ios-filled/50/000000/facebook-new.svg';
3143
3173
  var ConfirmationContainer = function ConfirmationContainer(_ref) {
3144
- var _ref$referralPromotio = _ref.referralPromotions,
3174
+ var isReferralEnabled = _ref.isReferralEnabled,
3175
+ _ref$referralPromotio = _ref.referralPromotions,
3145
3176
  referralPromotions = _ref$referralPromotio === void 0 ? [] : _ref$referralPromotio,
3146
3177
  _ref$shareButtons = _ref.shareButtons,
3147
3178
  shareButtons = _ref$shareButtons === void 0 ? [] : _ref$shareButtons,
@@ -3201,7 +3232,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3201
3232
  }
3202
3233
  }, _callee, null, [[4, 13]]);
3203
3234
  }))();
3204
- }, [onGetConfirmationDataSuccess, onGetConfirmationDataError]);
3235
+ }, []);
3205
3236
  return React.createElement("div", {
3206
3237
  className: "confirmation-page"
3207
3238
  }, React.createElement("p", {
@@ -3212,7 +3243,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3212
3243
  className: "main"
3213
3244
  }, "Your tickets have been emailed to you"), React.createElement("span", {
3214
3245
  className: "helper"
3215
- }, "Please bring them with you to the event")), data.disable_referral === false && React.createElement(React.Fragment, null, React.createElement("div", {
3246
+ }, "Please bring them with you to the event")), data.disable_referral === false && isReferralEnabled && React.createElement(React.Fragment, null, React.createElement("div", {
3216
3247
  className: "referral_text_image_section"
3217
3248
  }, React.createElement("div", {
3218
3249
  className: "referral_text_section"
@@ -3439,7 +3470,7 @@ var TicketsSection = function TicketsSection(_ref) {
3439
3470
  }));
3440
3471
  };
3441
3472
 
3442
- var css_248z$7 = ".style_waiting-list__2sJxM{padding:17px 35px 20px}.style_waiting-list__2sJxM .style_field-item__34MYc{margin-bottom:30px}.style_waiting-list__2sJxM .style_waiting-list-button__tO7D2{width:100%!important}.style_waiting-list__2sJxM .style_waiting-list-button__tO7D2:hover{background-color:#505050}.style_waiting-list__2sJxM .style_success-message__BvF3R h3{margin:10px 0}.style_waiting-list__2sJxM .style_success-message__BvF3R p{margin:0}";
3473
+ var css_248z$7 = ".style_waiting-list__2sJxM{padding:17px 35px 20px}.style_waiting-list__2sJxM .style_field-item__34MYc{margin-bottom:30px}.style_waiting-list__2sJxM .style_waiting-list-button__tO7D2{width:100%!important}.style_waiting-list__2sJxM .style_waiting-list-button__tO7D2:hover{background-color:#505050}.style_waiting-list__2sJxM .style_success-message__BvF3R h3{margin:10px 0}.style_waiting-list__2sJxM .style_success-message__BvF3R p{margin:0}.style_waiting-list__2sJxM .style_no-tickets-text__zGdaP{font-weight:700;text-align:center}.style_waiting-list__2sJxM .style_added-success-message__FbPZS{font-size:22px}";
3443
3474
  styleInject(css_248z$7);
3444
3475
 
3445
3476
  var generateQuantity = function generateQuantity(n) {
@@ -3531,7 +3562,11 @@ var WaitingList = function WaitingList(_ref) {
3531
3562
  className: "waiting-list"
3532
3563
  }, showSuccessMessage ? React.createElement("div", {
3533
3564
  className: "success-message"
3534
- }, React.createElement("h3", null, "You've been added to the waiting list!"), React.createElement("p", null, "You'll be notified if tickets become available.")) : React.createElement(React.Fragment, null, React.createElement("h2", null, "WAITING LIST"), React.createElement(Formik, {
3565
+ }, React.createElement("p", {
3566
+ className: "added-success-message"
3567
+ }, "You've been added to the waiting list!"), React.createElement("p", null, "You'll be notified if tickets become available.")) : React.createElement(React.Fragment, null, React.createElement("p", {
3568
+ className: "no-tickets-text"
3569
+ }, "No tickets are currently available for this event."), React.createElement("h2", null, "WAITING LIST"), React.createElement(Formik, {
3535
3570
  initialValues: {
3536
3571
  ticketTypeId: '',
3537
3572
  quantity: '',
@@ -3621,7 +3656,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
3621
3656
  _ref$onGetTicketsErro = _ref.onGetTicketsError,
3622
3657
  onGetTicketsError = _ref$onGetTicketsErro === void 0 ? function () {} : _ref$onGetTicketsErro,
3623
3658
  _ref$theme = _ref.theme,
3624
- theme = _ref$theme === void 0 ? 'light' : _ref$theme;
3659
+ theme = _ref$theme === void 0 ? 'light' : _ref$theme,
3660
+ _ref$queryPromoCode = _ref.queryPromoCode,
3661
+ queryPromoCode = _ref$queryPromoCode === void 0 ? '' : _ref$queryPromoCode;
3625
3662
 
3626
3663
  var _useState = useState({}),
3627
3664
  selectedTickets = _useState[0],
@@ -3647,7 +3684,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
3647
3684
  promoCode = _useState6[0],
3648
3685
  setPromoCode = _useState6[1];
3649
3686
 
3650
- var _useState7 = useState(''),
3687
+ var _useState7 = useState(queryPromoCode),
3651
3688
  promoCodeUpdated = _useState7[0],
3652
3689
  setPromoCodeUpdated = _useState7[1];
3653
3690