tf-checkout-react 1.0.44 → 1.0.45

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.
@@ -4,26 +4,26 @@ import { FormikHelpers, FormikValues } from 'formik';
4
4
  import './style.css';
5
5
  import { IBillingInfoData } from '../../types';
6
6
  export interface IBillingInfoPage {
7
- data: IBillingInfoData[];
7
+ data?: IBillingInfoData[];
8
8
  ticketHoldersFields?: IBillingInfoData;
9
- handleSubmit: (values: FormikValues, formikHelpers: FormikHelpers<FormikValues>, res?: any) => void;
10
- onRegisterSuccess: (value: {
9
+ handleSubmit?: (values: FormikValues, formikHelpers: FormikHelpers<FormikValues>, res?: any) => void;
10
+ onRegisterSuccess?: (value: {
11
11
  accessToken: string;
12
12
  refreshToken: string;
13
13
  }) => void;
14
- onRegisterError: (e: AxiosError) => void;
15
- onSubmitError: (e: AxiosError) => void;
16
- onGetCartSuccess: (res: any) => void;
17
- onGetCartError: (e: AxiosError) => void;
18
- onGetCountriesSuccess: (res: any) => void;
19
- onGetCountriesError: (e: AxiosError) => void;
20
- onGetStatesSuccess: (res: any) => void;
21
- onGetStatesError: (e: AxiosError) => void;
22
- onGetProfileDataSuccess: (res: any) => void;
23
- onGetProfileDataError: (e: AxiosError) => void;
24
- onAuthorizeSuccess: () => void;
25
- onAuthorizeError: (e: AxiosError) => void;
26
- onLogin: () => void;
14
+ onRegisterError?: (e: AxiosError) => void;
15
+ onSubmitError?: (e: AxiosError) => void;
16
+ onGetCartSuccess?: (res: any) => void;
17
+ onGetCartError?: (e: AxiosError) => void;
18
+ onGetCountriesSuccess?: (res: any) => void;
19
+ onGetCountriesError?: (e: AxiosError) => void;
20
+ onGetStatesSuccess?: (res: any) => void;
21
+ onGetStatesError?: (e: AxiosError) => void;
22
+ onGetProfileDataSuccess?: (res: any) => void;
23
+ onGetProfileDataError?: (e: AxiosError) => void;
24
+ onAuthorizeSuccess?: () => void;
25
+ onAuthorizeError?: (e: AxiosError) => void;
26
+ onLogin?: () => void;
27
27
  initialValues?: FormikValues;
28
28
  buttonName?: string;
29
29
  theme?: 'light' | 'dark';
@@ -1,16 +1,15 @@
1
- import React, { FC } from 'react';
1
+ import { FC } from 'react';
2
2
  import { AxiosError } from 'axios';
3
3
  import './style.css';
4
4
  interface Props {
5
5
  onClose: () => void;
6
6
  onLogin: () => void;
7
- alreadyHasUser: boolean;
8
- userExpired: boolean;
9
- setUserExpired: React.Dispatch<React.SetStateAction<boolean>>;
10
- onAuthorizeSuccess: (res: any) => void;
11
- onAuthorizeError: (e: AxiosError) => void;
12
- onGetProfileDataSuccess: (res: any) => void;
13
- onGetProfileDataError: (e: AxiosError) => void;
7
+ alreadyHasUser?: boolean;
8
+ userExpired?: boolean;
9
+ onAuthorizeSuccess?: (res: any) => void;
10
+ onAuthorizeError?: (e: AxiosError) => void;
11
+ onGetProfileDataSuccess?: (res: any) => void;
12
+ onGetProfileDataError?: (e: AxiosError) => void;
14
13
  }
15
14
  export declare const LoginModal: FC<Props>;
16
15
  export {};
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export { PaymentContainer } from './components/paymentContainer/index';
3
3
  export { ConfirmationContainer } from './components/confirmationContainer/index';
4
4
  export { TicketsContainer } from './components/ticketsContainer/index';
5
5
  export { currencyNormalizerCreator, createFixedFloatNormalizer } from './normalizers';
6
+ export { LoginModal } from './components/loginModal';
@@ -914,7 +914,7 @@ if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
914
914
  }
915
915
 
916
916
  if (isWindowDefined && window.location.origin !== 'https://www.houseofx.nyc' && window.location.origin !== 'https://tickets-staging.houseofx.nyc') {
917
- ttfHeaders['X-Source-Origin'] = 'houseofx.com';
917
+ ttfHeaders['X-Source-Origin'] = 'houseofx.nyc';
918
918
  }
919
919
 
920
920
  var publicRequest = /*#__PURE__*/axios.create({
@@ -961,7 +961,7 @@ publicRequest.interceptors.request.use(function (config) {
961
961
 
962
962
  if (isWindowDefined && window.location.origin !== 'https://www.houseofx.nyc' && window.location.origin !== 'https://tickets-staging.houseofx.nyc') {
963
963
  var _updatedHeaders2 = _extends({}, config.headers, {
964
- 'X-Source-Origin': 'houseofx.com'
964
+ 'X-Source-Origin': 'houseofx.nyc'
965
965
  });
966
966
 
967
967
  config.headers = _updatedHeaders2;
@@ -1082,9 +1082,10 @@ var style = {
1082
1082
  var LoginModal = function LoginModal(_ref) {
1083
1083
  var onClose = _ref.onClose,
1084
1084
  onLogin = _ref.onLogin,
1085
- alreadyHasUser = _ref.alreadyHasUser,
1086
- userExpired = _ref.userExpired,
1087
- setUserExpired = _ref.setUserExpired,
1085
+ _ref$alreadyHasUser = _ref.alreadyHasUser,
1086
+ alreadyHasUser = _ref$alreadyHasUser === void 0 ? false : _ref$alreadyHasUser,
1087
+ _ref$userExpired = _ref.userExpired,
1088
+ userExpired = _ref$userExpired === void 0 ? false : _ref$userExpired,
1088
1089
  _ref$onAuthorizeSucce = _ref.onAuthorizeSuccess,
1089
1090
  onAuthorizeSuccess = _ref$onAuthorizeSucce === void 0 ? function () {} : _ref$onAuthorizeSucce,
1090
1091
  _ref$onAuthorizeError = _ref.onAuthorizeError,
@@ -1148,7 +1149,11 @@ var LoginModal = function LoginModal(_ref) {
1148
1149
  case 22:
1149
1150
  _context.prev = 22;
1150
1151
  _context.t0 = _context["catch"](15);
1151
- onAuthorizeError(_context.t0.response);
1152
+
1153
+ if (axios.isAxiosError(_context.t0)) {
1154
+ onAuthorizeError(_context.t0);
1155
+ }
1156
+
1152
1157
  return _context.abrupt("return");
1153
1158
 
1154
1159
  case 26:
@@ -1168,7 +1173,11 @@ var LoginModal = function LoginModal(_ref) {
1168
1173
  case 36:
1169
1174
  _context.prev = 36;
1170
1175
  _context.t1 = _context["catch"](29);
1171
- onGetProfileDataError(_context.t1.response);
1176
+
1177
+ if (axios.isAxiosError(_context.t1)) {
1178
+ onGetProfileDataError(_context.t1);
1179
+ }
1180
+
1172
1181
  return _context.abrupt("return");
1173
1182
 
1174
1183
  case 40:
@@ -1185,13 +1194,12 @@ var LoginModal = function LoginModal(_ref) {
1185
1194
  window.localStorage.setItem('access_token', accessToken);
1186
1195
  }
1187
1196
 
1188
- setUserExpired(false);
1189
1197
  onLogin();
1190
- _context.next = 50;
1198
+ _context.next = 49;
1191
1199
  break;
1192
1200
 
1193
- case 47:
1194
- _context.prev = 47;
1201
+ case 46:
1202
+ _context.prev = 46;
1195
1203
  _context.t2 = _context["catch"](1);
1196
1204
 
1197
1205
  if (axios.isAxiosError(_context.t2)) {
@@ -1201,12 +1209,12 @@ var LoginModal = function LoginModal(_ref) {
1201
1209
  setError((_context.t2 == null ? void 0 : _context.t2.message) || 'Error');
1202
1210
  }
1203
1211
 
1204
- case 50:
1212
+ case 49:
1205
1213
  case "end":
1206
1214
  return _context.stop();
1207
1215
  }
1208
1216
  }
1209
- }, _callee, null, [[1, 47], [15, 22], [29, 36]]);
1217
+ }, _callee, null, [[1, 46], [15, 22], [29, 36]]);
1210
1218
  }));
1211
1219
 
1212
1220
  function onSubmit(_x) {
@@ -1704,7 +1712,10 @@ var LogicRunner = function LogicRunner(_ref) {
1704
1712
  case 10:
1705
1713
  _context.prev = 10;
1706
1714
  _context.t0 = _context["catch"](0);
1707
- onGetStatesError(_context.t0.response);
1715
+
1716
+ if (axios.isAxiosError(_context.t0)) {
1717
+ onGetStatesError(_context.t0);
1718
+ }
1708
1719
 
1709
1720
  case 13:
1710
1721
  case "end":
@@ -1910,7 +1921,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1910
1921
  case 12:
1911
1922
  _context2.prev = 12;
1912
1923
  _context2.t0 = _context2["catch"](0);
1913
- onGetCartError(_context2.t0.response);
1924
+
1925
+ if (axios.isAxiosError(_context2.t0)) {
1926
+ onGetCartError(_context2.t0);
1927
+ }
1914
1928
 
1915
1929
  case 15:
1916
1930
  case "end":
@@ -1958,7 +1972,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1958
1972
  case 12:
1959
1973
  _context3.prev = 12;
1960
1974
  _context3.t0 = _context3["catch"](0);
1961
- onGetProfileDataError(_context3.t0.response);
1975
+
1976
+ if (axios.isAxiosError(_context3.t0)) {
1977
+ onGetProfileDataError(_context3.t0);
1978
+ }
1962
1979
 
1963
1980
  case 15:
1964
1981
  case "end":
@@ -2004,7 +2021,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2004
2021
  case 9:
2005
2022
  _context4.prev = 9;
2006
2023
  _context4.t0 = _context4["catch"](0);
2007
- onGetCountriesError(_context4.t0.response);
2024
+
2025
+ if (axios.isAxiosError(_context4.t0)) {
2026
+ onGetCountriesError(_context4.t0);
2027
+ }
2008
2028
 
2009
2029
  case 12:
2010
2030
  case "end":
@@ -2095,7 +2115,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2095
2115
  refreshToken: refreshToken
2096
2116
  };
2097
2117
  onRegisterSuccess(tokens);
2098
- _context5.next = 33;
2118
+ _context5.next = 32;
2099
2119
  break;
2100
2120
 
2101
2121
  case 28:
@@ -2118,16 +2138,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2118
2138
  setAlreadyHasUser(true);
2119
2139
  setShowModalLogin(true);
2120
2140
  }
2141
+
2142
+ onRegisterError(_context5.t0);
2121
2143
  }
2122
2144
 
2123
- onRegisterError(_context5.t0.response);
2124
2145
  return _context5.abrupt("return");
2125
2146
 
2126
- case 33:
2127
- _context5.next = 35;
2147
+ case 32:
2148
+ _context5.next = 34;
2128
2149
  return getProfileData(access_token_register);
2129
2150
 
2130
- case 35:
2151
+ case 34:
2131
2152
  profileData = _context5.sent;
2132
2153
  profileSpecifiedData = _get(profileData, 'data.data');
2133
2154
  profileDataObj = setLoggedUserData(profileSpecifiedData);
@@ -2141,17 +2162,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2141
2162
  firstNameLogged: firstNameLogged,
2142
2163
  lastNameLogged: lastNameLogged
2143
2164
  }, showDOB);
2144
- _context5.next = 42;
2165
+ _context5.next = 41;
2145
2166
  return postOnCheckout(checkoutBody, access_token_register);
2146
2167
 
2147
- case 42:
2168
+ case 41:
2148
2169
  res = _context5.sent;
2149
2170
  handleSubmit(values, formikHelpers, res);
2150
- _context5.next = 50;
2171
+ _context5.next = 48;
2151
2172
  break;
2152
2173
 
2153
- case 46:
2154
- _context5.prev = 46;
2174
+ case 45:
2175
+ _context5.prev = 45;
2155
2176
  _context5.t1 = _context5["catch"](0);
2156
2177
 
2157
2178
  if (axios.isAxiosError(_context5.t1)) {
@@ -2163,16 +2184,16 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2163
2184
  setShowModalLogin(true);
2164
2185
  }
2165
2186
  }
2166
- }
2167
2187
 
2168
- onSubmitError(_context5.t1.response);
2188
+ onSubmitError(_context5.t1);
2189
+ }
2169
2190
 
2170
- case 50:
2191
+ case 48:
2171
2192
  case "end":
2172
2193
  return _context5.stop();
2173
2194
  }
2174
2195
  }
2175
- }, _callee5, null, [[0, 46], [17, 28]]);
2196
+ }, _callee5, null, [[0, 45], [17, 28]]);
2176
2197
  }));
2177
2198
 
2178
2199
  function onSubmit(_x2, _x3) {
@@ -2258,16 +2279,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2258
2279
  }));
2259
2280
  })));
2260
2281
  }));
2261
- }), showTicketHolderName && React__default.createElement(SectionContainer, {
2262
- key: ticketHoldersFields.id
2263
- }, React__default.createElement("p", null, ticketHoldersFields.label), _map(new Array(ticketsQuantity), function (_item, index) {
2282
+ }), showTicketHolderName && React__default.createElement("div", null, React__default.createElement("p", null, ticketHoldersFields.label), _map(new Array(ticketsQuantity), function (_item, index) {
2264
2283
  return React__default.createElement("div", {
2265
2284
  key: index
2266
- }, React__default.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group, i) {
2285
+ }, React__default.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
2267
2286
  var groupClassname = group.groupClassname,
2268
2287
  groupItems = group.groupItems;
2269
2288
  return React__default.createElement("div", {
2270
- key: i
2289
+ key: group.id
2271
2290
  }, React__default.createElement("div", {
2272
2291
  className: groupClassname
2273
2292
  }, _map(groupItems, function (element) {
@@ -2304,10 +2323,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2304
2323
  },
2305
2324
  onLogin: function onLogin() {
2306
2325
  setShowModalLogin(false);
2326
+ setUserExpired(false);
2307
2327
  },
2308
2328
  alreadyHasUser: alreadyHasUser,
2309
2329
  userExpired: userExpired,
2310
- setUserExpired: setUserExpired,
2311
2330
  onAuthorizeSuccess: onAuthorizeSuccess,
2312
2331
  onAuthorizeError: onAuthorizeError,
2313
2332
  onGetProfileDataSuccess: onGetProfileDataSuccess,
@@ -3181,7 +3200,10 @@ var TicketsContainer = function TicketsContainer(_ref) {
3181
3200
  case 8:
3182
3201
  _context.prev = 8;
3183
3202
  _context.t0 = _context["catch"](0);
3184
- onGetTicketsError(_context.t0.response);
3203
+
3204
+ if (axios.isAxiosError(_context.t0)) {
3205
+ onGetTicketsError(_context.t0);
3206
+ }
3185
3207
 
3186
3208
  case 11:
3187
3209
  _context.prev = 11;
@@ -3264,7 +3286,10 @@ var TicketsContainer = function TicketsContainer(_ref) {
3264
3286
  case 13:
3265
3287
  _context2.prev = 13;
3266
3288
  _context2.t0 = _context2["catch"](6);
3267
- onAddToCartError(_context2.t0.response);
3289
+
3290
+ if (axios.isAxiosError(_context2.t0)) {
3291
+ onAddToCartError(_context2.t0);
3292
+ }
3268
3293
 
3269
3294
  case 16:
3270
3295
  _context2.prev = 16;
@@ -3330,6 +3355,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
3330
3355
 
3331
3356
  exports.BillingInfoContainer = BillingInfoContainer;
3332
3357
  exports.ConfirmationContainer = ConfirmationContainer;
3358
+ exports.LoginModal = LoginModal;
3333
3359
  exports.PaymentContainer = PaymentContainer;
3334
3360
  exports.TicketsContainer = TicketsContainer;
3335
3361
  exports.createFixedFloatNormalizer = createFixedFloatNormalizer;