tf-checkout-react 1.0.74 → 1.0.75

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.
@@ -5,6 +5,7 @@ interface IPublicRequest extends AxiosInstance {
5
5
  setBaseUrl: (baseUrl: string) => void;
6
6
  }
7
7
  export declare const publicRequest: IPublicRequest;
8
+ export declare const setXSourceOrigin: (sourceOrigin: string) => void;
8
9
  export declare const setCustomHeader: (response: any) => void;
9
10
  export declare const handleSetAccessToken: (token: any) => void;
10
11
  export declare function getTickets(id: string | number, promoCode: string): Promise<import("axios").AxiosResponse<any, any>>;
@@ -11,7 +11,7 @@ export interface IBillingInfoPage {
11
11
  accessToken: string;
12
12
  refreshToken: string;
13
13
  }) => void;
14
- onRegisterError?: (e: AxiosError) => void;
14
+ onRegisterError?: (e: AxiosError, email: string) => void;
15
15
  onSubmitError?: (e: AxiosError) => void;
16
16
  onGetCartSuccess?: (res: any) => void;
17
17
  onGetCartError?: (e: AxiosError) => void;
@@ -29,7 +29,8 @@ export interface IBillingInfoPage {
29
29
  buttonName?: string;
30
30
  theme?: 'light' | 'dark';
31
31
  isLoggedIn?: boolean;
32
+ accountInfoTitle?: string | JSX.Element;
32
33
  fontFamily?: string;
33
34
  hideLogo?: boolean;
34
35
  }
35
- export declare const BillingInfoContainer: ({ data, ticketHoldersFields, initialValues, buttonName, handleSubmit, theme, onRegisterSuccess, onRegisterError, onSubmitError, onGetCartSuccess, onGetCartError, onGetCountriesSuccess, onGetCountriesError, onGetStatesSuccess, onGetStatesError, onGetProfileDataSuccess, onGetProfileDataError, onAuthorizeSuccess, onAuthorizeError, onLogin, onLoginSuccess, isLoggedIn: pIsLoggedIn, fontFamily, hideLogo, }: IBillingInfoPage) => JSX.Element;
36
+ export declare const BillingInfoContainer: ({ data, ticketHoldersFields, initialValues, buttonName, handleSubmit, theme, onRegisterSuccess, onRegisterError, onSubmitError, onGetCartSuccess, onGetCartError, onGetCountriesSuccess, onGetCountriesError, onGetStatesSuccess, onGetStatesError, onGetProfileDataSuccess, onGetProfileDataError, onAuthorizeSuccess, onAuthorizeError, onLogin, onLoginSuccess, isLoggedIn: pIsLoggedIn, accountInfoTitle, fontFamily, hideLogo, }: IBillingInfoPage) => JSX.Element;
@@ -14,5 +14,6 @@ export interface IConfirmationPage {
14
14
  shareButtons: IShareButton[];
15
15
  onGetConfirmationDataSuccess: (res: any) => void;
16
16
  onGetConfirmationDataError: (e: AxiosError) => void;
17
+ orderHash?: string;
17
18
  }
18
- export declare const ConfirmationContainer: ({ isReferralEnabled, showDefaultShareButtons, messengerAppId, shareButtons, onGetConfirmationDataSuccess, onGetConfirmationDataError, }: IConfirmationPage) => JSX.Element;
19
+ export declare const ConfirmationContainer: ({ isReferralEnabled, showDefaultShareButtons, messengerAppId, shareButtons, onGetConfirmationDataSuccess, onGetConfirmationDataError, orderHash, }: IConfirmationPage) => JSX.Element;
@@ -14,6 +14,7 @@ export interface IPaymentPage {
14
14
  onGetPaymentDataError: (value: AxiosError) => void;
15
15
  onPaymentError: (value: AxiosError) => void;
16
16
  stripeCardOptions?: StripeCardNumberElementOptions;
17
+ disableZipSection: boolean;
17
18
  fontFamily?: string;
18
19
  }
19
- export declare const PaymentContainer: ({ paymentFields, handlePayment, formTitle, errorText, checkoutData, onErrorClose, onGetPaymentDataSuccess, onGetPaymentDataError, onPaymentError, stripeCardOptions, fontFamily, }: IPaymentPage) => JSX.Element;
20
+ export declare const PaymentContainer: ({ paymentFields, handlePayment, formTitle, errorText, checkoutData, onErrorClose, onGetPaymentDataSuccess, onGetPaymentDataError, onPaymentError, stripeCardOptions, disableZipSection, fontFamily, }: IPaymentPage) => JSX.Element;
@@ -14,6 +14,7 @@ export interface ICheckoutForm {
14
14
  isLoading: any;
15
15
  handleSetLoading: (loading: any) => void;
16
16
  conditions: any;
17
+ disableZipSection: boolean;
17
18
  }
18
- declare const CheckoutForm: ({ total, onSubmit, stripeCardOptions, error, stripe_client_secret, currency, billing_info, isLoading, handleSetLoading, conditions, }: ICheckoutForm) => JSX.Element;
19
+ declare const CheckoutForm: ({ total, onSubmit, stripeCardOptions, error, stripe_client_secret, currency, billing_info, isLoading, handleSetLoading, conditions, disableZipSection, }: ICheckoutForm) => JSX.Element;
19
20
  export default CheckoutForm;
@@ -932,6 +932,10 @@ var setConfigs = function setConfigs(configs) {
932
932
  });
933
933
 
934
934
  publicRequest.setBaseUrl(CONFIGS.BASE_URL);
935
+
936
+ if (CONFIGS.X_SOURCE_ORIGIN) {
937
+ setXSourceOrigin(CONFIGS.X_SOURCE_ORIGIN);
938
+ }
935
939
  };
936
940
 
937
941
  var getQueryVariable = function getQueryVariable(variable) {
@@ -991,8 +995,6 @@ var ErrorFocusInternal = /*#__PURE__*/function (_Component) {
991
995
  var ErrorFocus = /*#__PURE__*/formik.connect(ErrorFocusInternal);
992
996
 
993
997
  var isWindowDefined = typeof window !== 'undefined';
994
- var discardedOrigins = ['http://localhost', 'gtsb.io', 'gatsbyjs.io', 'https://www.houseofx.nyc', 'https://tickets-staging.houseofx.nyc'];
995
- var origin = isWindowDefined && window.location.origin;
996
998
  var ttfHeaders = {
997
999
  Accept: 'application/vnd.api+json',
998
1000
  'Content-Type': 'application/vnd.api+json'
@@ -1002,12 +1004,6 @@ if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
1002
1004
  ttfHeaders['Authorization-Guest'] = /*#__PURE__*/localStorage.getItem('auth_guest_token');
1003
1005
  }
1004
1006
 
1005
- if (isWindowDefined && !discardedOrigins.some(function (el) {
1006
- return origin && origin.includes(el);
1007
- })) {
1008
- ttfHeaders['X-Source-Origin'] = 'houseofx.nyc';
1009
- }
1010
-
1011
1007
  var publicRequest = /*#__PURE__*/axios.create({
1012
1008
  baseURL: CONFIGS.BASE_URL || "https://www.ticketfairy.com/api",
1013
1009
  headers: ttfHeaders
@@ -1050,11 +1046,9 @@ publicRequest.interceptors.request.use(function (config) {
1050
1046
  config.headers = _updatedHeaders;
1051
1047
  }
1052
1048
 
1053
- if (isWindowDefined && !discardedOrigins.some(function (el) {
1054
- return origin && origin.includes(el);
1055
- })) {
1049
+ if (CONFIGS.X_SOURCE_ORIGIN) {
1056
1050
  var _updatedHeaders2 = _extends({}, config.headers, {
1057
- 'X-Source-Origin': 'houseofx.nyc'
1051
+ 'X-Source-Origin': CONFIGS.X_SOURCE_ORIGIN
1058
1052
  });
1059
1053
 
1060
1054
  config.headers = _updatedHeaders2;
@@ -1079,6 +1073,9 @@ publicRequest.setAccessToken = function (token) {
1079
1073
  return publicRequest.defaults.headers.common.Authorization = token;
1080
1074
  };
1081
1075
 
1076
+ var setXSourceOrigin = function setXSourceOrigin(sourceOrigin) {
1077
+ ttfHeaders['X-Source-Origin'] = sourceOrigin;
1078
+ };
1082
1079
  var setCustomHeader = function setCustomHeader(response) {
1083
1080
  var guestHeaderResponseValue = _get(response, 'headers.authorization-guest');
1084
1081
 
@@ -2110,12 +2107,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2110
2107
  onAuthorizeSuccess = _ref3$onAuthorizeSucc === void 0 ? function () {} : _ref3$onAuthorizeSucc,
2111
2108
  _ref3$onAuthorizeErro = _ref3.onAuthorizeError,
2112
2109
  onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? function () {} : _ref3$onAuthorizeErro,
2113
- _ref3$onLogin = _ref3.onLogin,
2114
- onLogin = _ref3$onLogin === void 0 ? function () {} : _ref3$onLogin,
2110
+ onLogin = _ref3.onLogin,
2115
2111
  _ref3$onLoginSuccess = _ref3.onLoginSuccess,
2116
2112
  onLoginSuccess = _ref3$onLoginSuccess === void 0 ? function () {} : _ref3$onLoginSuccess,
2117
2113
  _ref3$isLoggedIn = _ref3.isLoggedIn,
2118
2114
  pIsLoggedIn = _ref3$isLoggedIn === void 0 ? false : _ref3$isLoggedIn,
2115
+ _ref3$accountInfoTitl = _ref3.accountInfoTitle,
2116
+ accountInfoTitle = _ref3$accountInfoTitl === void 0 ? '' : _ref3$accountInfoTitl,
2119
2117
  fontFamily = _ref3.fontFamily,
2120
2118
  hideLogo = _ref3.hideLogo;
2121
2119
  var themeMui = styles.createTheme({
@@ -2479,12 +2477,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2479
2477
  formikHelpers.setFieldError('confirmPassword', error.password);
2480
2478
  }
2481
2479
 
2482
- if (error != null && error.email) {
2480
+ if (error != null && error.email && !onLogin) {
2481
+ // False will stand for outside controll
2483
2482
  setAlreadyHasUser(true);
2484
2483
  setShowModalLogin(true);
2485
2484
  }
2486
2485
 
2487
- onRegisterError(_context5.t0);
2486
+ onRegisterError(_context5.t0, values.email);
2488
2487
  }
2489
2488
 
2490
2489
  return _context5.abrupt("return");
@@ -2562,14 +2561,18 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2562
2561
  className: "billing-info-container " + theme
2563
2562
  }, !isLoggedIn && React__default.createElement("div", {
2564
2563
  className: "account-actions-block"
2565
- }, React__default.createElement("div", null, "Got a ", React__default.createElement("strong", null, "TICKET"), "FAIRY account?"), React__default.createElement("div", null, "Login & skip ahead:"), React__default.createElement("div", {
2564
+ }, React__default.createElement("div", null, accountInfoTitle), React__default.createElement("div", null, "Login & skip ahead:"), React__default.createElement("div", {
2566
2565
  className: "login-block"
2567
2566
  }, React__default.createElement("button", {
2568
2567
  className: "login-register-button",
2569
2568
  type: "button",
2570
2569
  onClick: function onClick() {
2571
- onLogin();
2572
- setShowModalLogin(true);
2570
+ // If outside login needed to skip package login functionallity
2571
+ if (onLogin) {
2572
+ onLogin();
2573
+ } else {
2574
+ setShowModalLogin(true);
2575
+ }
2573
2576
  }
2574
2577
  }, "Login"), !hideLogo && React__default.createElement("div", {
2575
2578
  className: "logo-image-container"
@@ -2721,7 +2724,8 @@ var CheckoutForm = function CheckoutForm(_ref) {
2721
2724
  _ref$handleSetLoading = _ref.handleSetLoading,
2722
2725
  handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading,
2723
2726
  _ref$conditions = _ref.conditions,
2724
- conditions = _ref$conditions === void 0 ? [] : _ref$conditions;
2727
+ conditions = _ref$conditions === void 0 ? [] : _ref$conditions,
2728
+ disableZipSection = _ref.disableZipSection;
2725
2729
  var stripe = reactStripeJs.useStripe();
2726
2730
  var elements = reactStripeJs.useElements();
2727
2731
 
@@ -2753,7 +2757,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2753
2757
  _context.prev = 1;
2754
2758
  event.preventDefault();
2755
2759
 
2756
- if (postalCode) {
2760
+ if (!(!postalCode && !disableZipSection)) {
2757
2761
  _context.next = 7;
2758
2762
  break;
2759
2763
  }
@@ -2778,10 +2782,14 @@ var CheckoutForm = function CheckoutForm(_ref) {
2778
2782
  address = {
2779
2783
  city: billing_info.city,
2780
2784
  line1: billing_info.street_address,
2781
- state: billing_info.state,
2782
- postal_code: postalCode
2785
+ state: billing_info.state
2783
2786
  };
2784
- _context.next = 14;
2787
+
2788
+ if (!disableZipSection) {
2789
+ address.postal_code = postalCode;
2790
+ }
2791
+
2792
+ _context.next = 15;
2785
2793
  return stripe.createPaymentMethod({
2786
2794
  type: 'card',
2787
2795
  card: card || {
@@ -2792,11 +2800,11 @@ var CheckoutForm = function CheckoutForm(_ref) {
2792
2800
  }
2793
2801
  });
2794
2802
 
2795
- case 14:
2803
+ case 15:
2796
2804
  paymentMethodReq = _context.sent;
2797
2805
 
2798
2806
  if (!paymentMethodReq.error) {
2799
- _context.next = 19;
2807
+ _context.next = 20;
2800
2808
  break;
2801
2809
  }
2802
2810
 
@@ -2804,18 +2812,18 @@ var CheckoutForm = function CheckoutForm(_ref) {
2804
2812
  handleSetLoading(false);
2805
2813
  return _context.abrupt("return");
2806
2814
 
2807
- case 19:
2808
- _context.next = 21;
2815
+ case 20:
2816
+ _context.next = 22;
2809
2817
  return stripe.confirmCardPayment(stripe_client_secret, {
2810
2818
  payment_method: paymentMethodReq.paymentMethod.id
2811
2819
  });
2812
2820
 
2813
- case 21:
2821
+ case 22:
2814
2822
  _yield$stripe$confirm = _context.sent;
2815
2823
  _error = _yield$stripe$confirm.error;
2816
2824
 
2817
2825
  if (!_error) {
2818
- _context.next = 27;
2826
+ _context.next = 28;
2819
2827
  break;
2820
2828
  }
2821
2829
 
@@ -2823,22 +2831,22 @@ var CheckoutForm = function CheckoutForm(_ref) {
2823
2831
  handleSetLoading(false);
2824
2832
  return _context.abrupt("return");
2825
2833
 
2826
- case 27:
2834
+ case 28:
2827
2835
  onSubmit(null);
2828
- _context.next = 33;
2836
+ _context.next = 34;
2829
2837
  break;
2830
2838
 
2831
- case 30:
2832
- _context.prev = 30;
2839
+ case 31:
2840
+ _context.prev = 31;
2833
2841
  _context.t0 = _context["catch"](1);
2834
2842
  onSubmit(_context.t0);
2835
2843
 
2836
- case 33:
2844
+ case 34:
2837
2845
  case "end":
2838
2846
  return _context.stop();
2839
2847
  }
2840
2848
  }
2841
- }, _callee, null, [[1, 30]]);
2849
+ }, _callee, null, [[1, 31]]);
2842
2850
  }));
2843
2851
 
2844
2852
  return function handleSubmit(_x) {
@@ -2899,7 +2907,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2899
2907
  }, React__default.createElement("span", {
2900
2908
  className: "card_label_text"
2901
2909
  }, "Card number"), React__default.createElement(reactStripeJs.CardNumberElement, {
2902
- options: _extends({}, options, stripeCardOptions),
2910
+ options: _extends({}, options.style, stripeCardOptions),
2903
2911
  onReady: _identity,
2904
2912
  onChange: _identity,
2905
2913
  onBlur: _identity,
@@ -2909,14 +2917,14 @@ var CheckoutForm = function CheckoutForm(_ref) {
2909
2917
  }, React__default.createElement("span", {
2910
2918
  className: "card_label_text"
2911
2919
  }, "Expiration date"), React__default.createElement(reactStripeJs.CardExpiryElement, {
2912
- options: _extends({}, options, stripeCardOptions)
2920
+ options: _extends({}, options.style, stripeCardOptions)
2913
2921
  })), React__default.createElement("label", {
2914
2922
  className: "cvc_element"
2915
2923
  }, React__default.createElement("span", {
2916
2924
  className: "card_label_text"
2917
2925
  }, "CVC"), React__default.createElement(reactStripeJs.CardCvcElement, {
2918
- options: _extends({}, options, stripeCardOptions)
2919
- })), React__default.createElement("label", {
2926
+ options: _extends({}, options.style, stripeCardOptions)
2927
+ })), !disableZipSection && React__default.createElement("label", {
2920
2928
  className: "zip_element"
2921
2929
  }, React__default.createElement("p", {
2922
2930
  className: "card_label_text"
@@ -3003,6 +3011,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
3003
3011
  onPaymentError = _ref$onPaymentError === void 0 ? function () {} : _ref$onPaymentError,
3004
3012
  _ref$stripeCardOption = _ref.stripeCardOptions,
3005
3013
  stripeCardOptions = _ref$stripeCardOption === void 0 ? {} : _ref$stripeCardOption,
3014
+ _ref$disableZipSectio = _ref.disableZipSection,
3015
+ disableZipSection = _ref$disableZipSectio === void 0 ? false : _ref$disableZipSectio,
3006
3016
  fontFamily = _ref.fontFamily;
3007
3017
 
3008
3018
  var _useState = React.useState(initialReviewValues),
@@ -3243,7 +3253,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
3243
3253
  return setPaymentIsLoading(value);
3244
3254
  },
3245
3255
  conditions: conditions,
3246
- stripeCardOptions: stripeCardOptions
3256
+ stripeCardOptions: stripeCardOptions,
3257
+ disableZipSection: disableZipSection
3247
3258
  })))))));
3248
3259
  };
3249
3260
 
@@ -3417,7 +3428,8 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3417
3428
  _ref$onGetConfirmatio = _ref.onGetConfirmationDataSuccess,
3418
3429
  onGetConfirmationDataSuccess = _ref$onGetConfirmatio === void 0 ? function () {} : _ref$onGetConfirmatio,
3419
3430
  _ref$onGetConfirmatio2 = _ref.onGetConfirmationDataError,
3420
- onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2;
3431
+ onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2,
3432
+ orderHash = _ref.orderHash;
3421
3433
  var inputRef = React.useRef(null);
3422
3434
 
3423
3435
  var _useState = React.useState(null),
@@ -3433,15 +3445,17 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3433
3445
  while (1) {
3434
3446
  switch (_context.prev = _context.next) {
3435
3447
  case 0:
3436
- dataEncoded = typeof window !== 'undefined' && window.localStorage.getItem('checkoutData');
3448
+ dataEncoded = typeof window !== 'undefined' && window.localStorage.getItem('checkoutData') || '';
3449
+ dataDecoded = dataEncoded ? JSON.parse(dataEncoded) : {
3450
+ hash: orderHash
3451
+ };
3452
+ hash = dataDecoded.hash;
3437
3453
 
3438
- if (!dataEncoded) {
3454
+ if (!hash) {
3439
3455
  _context.next = 18;
3440
3456
  break;
3441
3457
  }
3442
3458
 
3443
- dataDecoded = JSON.parse(dataEncoded);
3444
- hash = dataDecoded.hash;
3445
3459
  _context.prev = 4;
3446
3460
  _context.next = 7;
3447
3461
  return getConfirmationData(hash);
@@ -3551,13 +3565,13 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3551
3565
  value: data.personal_share_link,
3552
3566
  onChange: onChangeShareLink
3553
3567
  }), React__default.createElement("div", {
3554
- className: 'share-by-link-copy-icon',
3568
+ className: "share-by-link-copy-icon",
3555
3569
  onClick: function onClick() {
3556
3570
  return navigator.clipboard.writeText(_get(inputRef, 'current.value'));
3557
3571
  }
3558
3572
  }, React__default.createElement("img", {
3559
3573
  src: "https://img.icons8.com/office/50/000000/copy.png",
3560
- alt: 'copy'
3574
+ alt: "copy"
3561
3575
  })))), (showDefaultShareButtons || !!shareButtons.length) && React__default.createElement(SocialButtons, {
3562
3576
  showDefaultShareButtons: showDefaultShareButtons,
3563
3577
  name: data.product_name,
@@ -3571,7 +3585,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3571
3585
  }, "How much cheaper?"), _map(data.personal_share_sales, function (pricing, index) {
3572
3586
  return React__default.createElement("div", {
3573
3587
  key: index,
3574
- className: 'pricing-section_wrapper'
3588
+ className: "pricing-section_wrapper"
3575
3589
  }, React__default.createElement("div", {
3576
3590
  className: "pricing-section_label"
3577
3591
  }, pricing.label, pricing.subLabel && React__default.createElement("div", {