tf-checkout-react 1.0.96 → 1.0.97-beta.0
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.
- package/dist/api/index.d.ts +25 -23
- package/dist/components/billing-info-container/index.d.ts +1 -4
- package/dist/tf-checkout-react.cjs.development.js +123 -129
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +123 -129
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/utils/cookies.d.ts +3 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/api/index.ts +24 -15
- package/src/components/billing-info-container/index.tsx +12 -32
- package/src/components/loginModal/index.tsx +3 -41
- package/src/components/registerModal/index.tsx +3 -10
- package/src/components/ticketsContainer/index.tsx +2 -1
- package/src/utils/cookies.ts +28 -0
- package/src/utils/index.ts +1 -0
package/dist/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
1
|
+
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
2
2
|
interface IPublicRequest extends AxiosInstance {
|
|
3
3
|
setGuestToken: (token: string) => void;
|
|
4
4
|
setAccessToken: (token: string) => void;
|
|
@@ -7,26 +7,28 @@ interface IPublicRequest extends AxiosInstance {
|
|
|
7
7
|
export declare const publicRequest: IPublicRequest;
|
|
8
8
|
export declare const setXSourceOrigin: (sourceOrigin: string) => void;
|
|
9
9
|
export declare const setCustomHeader: (response: any) => void;
|
|
10
|
-
export declare
|
|
11
|
-
export declare function
|
|
12
|
-
export declare
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const
|
|
10
|
+
export declare function getEvent(id: string | number): Promise<AxiosResponse<any, any>>;
|
|
11
|
+
export declare function getTickets(id: string | number, promoCode: string): Promise<AxiosResponse<any, any>>;
|
|
12
|
+
export declare const addToCart: (id: string | number, data: any) => Promise<AxiosResponse<any, any>>;
|
|
13
|
+
export declare const getCart: () => Promise<AxiosResponse<any, any>>;
|
|
14
|
+
export declare const postOnCheckout: (data: any, accessToken?: string | undefined) => Promise<AxiosResponse<any, any>>;
|
|
15
|
+
export declare const authorize: (data: {
|
|
16
|
+
email: string;
|
|
17
|
+
password: string;
|
|
18
|
+
}) => Promise<AxiosResponse<any, any>>;
|
|
19
|
+
export declare const register: (data: FormData) => Promise<AxiosResponse<any, any>>;
|
|
20
|
+
export declare const getAccessToken: (data: FormData) => Promise<AxiosResponse<any, any>>;
|
|
21
|
+
export declare const getPaymentData: (hash: string) => Promise<AxiosResponse<any, any>>;
|
|
22
|
+
export declare const handlePaymentData: (orderHash: string, data: any) => Promise<AxiosResponse<any, any>>;
|
|
23
|
+
export declare const handlePaymentSuccess: (orderHash: string) => Promise<AxiosResponse<any, any>>;
|
|
24
|
+
export declare const handleFreeSuccess: (orderHash: string) => Promise<AxiosResponse<any, any>>;
|
|
25
|
+
export declare const getProfileData: (accessToken?: string | undefined) => Promise<any>;
|
|
26
|
+
export declare const getCountries: () => Promise<AxiosResponse<any, any>>;
|
|
27
|
+
export declare const getConfirmationData: (orderHash: string) => Promise<AxiosResponse<any, any>>;
|
|
28
|
+
export declare const getStates: (countryId: string) => Promise<AxiosResponse<any, any>>;
|
|
29
|
+
export declare const getOrders: (page: number, limit: number, eventSlug: string) => Promise<AxiosResponse<any, any>>;
|
|
30
|
+
export declare const getOrderDetails: (orderId: string) => Promise<AxiosResponse<any, any>>;
|
|
31
|
+
export declare const addToWaitingList: (id: number, data: any) => Promise<AxiosResponse<any, any>>;
|
|
32
|
+
export declare const getConditions: (eventId: string) => Promise<AxiosResponse<any, any>>;
|
|
33
|
+
export declare const postReferralVisits: (eventId: string, referralId: string) => Promise<AxiosResponse<any, any>>;
|
|
32
34
|
export {};
|
|
@@ -9,10 +9,7 @@ export interface IBillingInfoPage {
|
|
|
9
9
|
data?: IBillingInfoData[];
|
|
10
10
|
ticketHoldersFields?: IBillingInfoData;
|
|
11
11
|
handleSubmit?: (values: FormikValues, formikHelpers: FormikHelpers<FormikValues>, eventId: any, res: any) => void;
|
|
12
|
-
onRegisterSuccess?: (
|
|
13
|
-
accessToken: string;
|
|
14
|
-
refreshToken: string;
|
|
15
|
-
}) => void;
|
|
12
|
+
onRegisterSuccess?: () => void;
|
|
16
13
|
onRegisterError?: (e: AxiosError, email: string) => void;
|
|
17
14
|
onSubmitError?: (e: AxiosError) => void;
|
|
18
15
|
onGetCartSuccess?: (res: any) => void;
|
|
@@ -1104,6 +1104,39 @@ var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWit
|
|
|
1104
1104
|
return body;
|
|
1105
1105
|
};
|
|
1106
1106
|
|
|
1107
|
+
function setCustomCookie(name, value, days) {
|
|
1108
|
+
var expires = '';
|
|
1109
|
+
|
|
1110
|
+
if (days) {
|
|
1111
|
+
var date = new Date();
|
|
1112
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
1113
|
+
expires = '; expires=' + date.toUTCString();
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
document.cookie = name + '=' + (value || '') + expires + '; path=/';
|
|
1117
|
+
}
|
|
1118
|
+
function getCookieByName(cname) {
|
|
1119
|
+
var name = cname + '=';
|
|
1120
|
+
var ca = document.cookie.split(';');
|
|
1121
|
+
|
|
1122
|
+
for (var i = 0; i < ca.length; i++) {
|
|
1123
|
+
var c = ca[i];
|
|
1124
|
+
|
|
1125
|
+
while (c.charAt(0) == ' ') {
|
|
1126
|
+
c = c.substring(1);
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
if (c.indexOf(name) == 0) {
|
|
1130
|
+
return c.substring(name.length, c.length);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
return '';
|
|
1135
|
+
}
|
|
1136
|
+
function deleteCookieByName(name) {
|
|
1137
|
+
document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1107
1140
|
var isWindowDefined = typeof window !== 'undefined';
|
|
1108
1141
|
var ttfHeaders = {
|
|
1109
1142
|
Accept: 'application/vnd.api+json',
|
|
@@ -1163,20 +1196,37 @@ publicRequest.interceptors.request.use(function (config) {
|
|
|
1163
1196
|
config.headers = _updatedHeaders;
|
|
1164
1197
|
}
|
|
1165
1198
|
|
|
1166
|
-
if (
|
|
1199
|
+
if (getCookieByName('X-TF-ECOMMERCE')) {
|
|
1167
1200
|
var _updatedHeaders2 = _extends({}, config.headers, {
|
|
1168
|
-
'X-
|
|
1201
|
+
'X-TF-ECOMMERCE': getCookieByName('X-TF-ECOMMERCE')
|
|
1169
1202
|
});
|
|
1170
1203
|
|
|
1171
1204
|
config.headers = _updatedHeaders2;
|
|
1172
1205
|
}
|
|
1173
1206
|
|
|
1207
|
+
if (CONFIGS.X_SOURCE_ORIGIN) {
|
|
1208
|
+
var _updatedHeaders3 = _extends({}, config.headers, {
|
|
1209
|
+
'X-Source-Origin': CONFIGS.X_SOURCE_ORIGIN
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
config.headers = _updatedHeaders3;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1174
1215
|
if (CONFIGS.BASE_URL) {
|
|
1175
1216
|
config.baseURL = CONFIGS.BASE_URL + '/api';
|
|
1176
1217
|
}
|
|
1177
1218
|
|
|
1178
1219
|
return config;
|
|
1179
1220
|
});
|
|
1221
|
+
publicRequest.interceptors.response.use(function (response) {
|
|
1222
|
+
var xtfCookie = _get(response, 'headers.x-tf-ecommerce');
|
|
1223
|
+
|
|
1224
|
+
if (xtfCookie) {
|
|
1225
|
+
setCustomCookie('X-TF-ECOMMERCE', xtfCookie);
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
return response;
|
|
1229
|
+
});
|
|
1180
1230
|
|
|
1181
1231
|
publicRequest.setGuestToken = function (token) {
|
|
1182
1232
|
return publicRequest.defaults.headers.common['Authorization-Guest'] = token;
|
|
@@ -1207,14 +1257,6 @@ var setCustomHeader = function setCustomHeader(response) {
|
|
|
1207
1257
|
}
|
|
1208
1258
|
}
|
|
1209
1259
|
};
|
|
1210
|
-
var handleSetAccessToken = function handleSetAccessToken(token) {
|
|
1211
|
-
if (token) {
|
|
1212
|
-
if (isWindowDefined) {
|
|
1213
|
-
window.localStorage.setItem('access_token', token);
|
|
1214
|
-
publicRequest.setAccessToken(token);
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
};
|
|
1218
1260
|
function getEvent(id) {
|
|
1219
1261
|
var response = publicRequest.get("v1/event/" + id, {
|
|
1220
1262
|
headers: ttfHeaders
|
|
@@ -1255,14 +1297,11 @@ var postOnCheckout = function postOnCheckout(data, accessToken) {
|
|
|
1255
1297
|
return res;
|
|
1256
1298
|
};
|
|
1257
1299
|
var authorize = function authorize(data) {
|
|
1258
|
-
return publicRequest.post("/
|
|
1300
|
+
return publicRequest.post("/auth?clientId=" + (CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'), data);
|
|
1259
1301
|
};
|
|
1260
1302
|
var register = function register(data) {
|
|
1261
1303
|
return publicRequest.post('/v1/oauth/register-rn', data);
|
|
1262
1304
|
};
|
|
1263
|
-
var getAccessToken = function getAccessToken(data) {
|
|
1264
|
-
return publicRequest.post('/v1/oauth/access_token', data);
|
|
1265
|
-
};
|
|
1266
1305
|
var getPaymentData = function getPaymentData(hash) {
|
|
1267
1306
|
var response = publicRequest.get("v1/order/" + hash + "/review/")["catch"](function (error) {
|
|
1268
1307
|
throw error;
|
|
@@ -1334,10 +1373,6 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1334
1373
|
alreadyHasUser = _ref$alreadyHasUser === void 0 ? false : _ref$alreadyHasUser,
|
|
1335
1374
|
_ref$userExpired = _ref.userExpired,
|
|
1336
1375
|
userExpired = _ref$userExpired === void 0 ? false : _ref$userExpired,
|
|
1337
|
-
_ref$onAuthorizeSucce = _ref.onAuthorizeSuccess,
|
|
1338
|
-
onAuthorizeSuccess = _ref$onAuthorizeSucce === void 0 ? function () {} : _ref$onAuthorizeSucce,
|
|
1339
|
-
_ref$onAuthorizeError = _ref.onAuthorizeError,
|
|
1340
|
-
onAuthorizeError = _ref$onAuthorizeError === void 0 ? function () {} : _ref$onAuthorizeError,
|
|
1341
1376
|
_ref$onGetProfileData = _ref.onGetProfileDataSuccess,
|
|
1342
1377
|
onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? function () {} : _ref$onGetProfileData,
|
|
1343
1378
|
_ref$onGetProfileData2 = _ref.onGetProfileDataError,
|
|
@@ -1370,7 +1405,7 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1370
1405
|
},
|
|
1371
1406
|
onSubmit: function () {
|
|
1372
1407
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
|
|
1373
|
-
var email, password,
|
|
1408
|
+
var email, password, body, profileResponse, profileSpecifiedData, profileDataObj, event, _e$response, _e$response$data, _error;
|
|
1374
1409
|
|
|
1375
1410
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1376
1411
|
while (1) {
|
|
@@ -1378,66 +1413,36 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1378
1413
|
case 0:
|
|
1379
1414
|
email = _ref2.email, password = _ref2.password;
|
|
1380
1415
|
_context.prev = 1;
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
case 7:
|
|
1388
|
-
resAutorize = _context.sent;
|
|
1389
|
-
bodyFormDataToken = new FormData();
|
|
1390
|
-
bodyFormDataToken.append('code', resAutorize.data.data.code);
|
|
1391
|
-
bodyFormDataToken.append('scope', 'profile');
|
|
1392
|
-
bodyFormDataToken.append('grant_type', 'authorization_code');
|
|
1393
|
-
bodyFormDataToken.append('client_id', CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf');
|
|
1394
|
-
bodyFormDataToken.append('client_secret', CONFIGS.CLIENT_SECRET || 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9');
|
|
1395
|
-
resAccessToken = null;
|
|
1396
|
-
_context.prev = 15;
|
|
1397
|
-
_context.next = 18;
|
|
1398
|
-
return getAccessToken(bodyFormDataToken);
|
|
1399
|
-
|
|
1400
|
-
case 18:
|
|
1401
|
-
resAccessToken = _context.sent;
|
|
1402
|
-
onAuthorizeSuccess(resAccessToken.data);
|
|
1403
|
-
_context.next = 26;
|
|
1404
|
-
break;
|
|
1405
|
-
|
|
1406
|
-
case 22:
|
|
1407
|
-
_context.prev = 22;
|
|
1408
|
-
_context.t0 = _context["catch"](15);
|
|
1409
|
-
|
|
1410
|
-
if (axios.isAxiosError(_context.t0)) {
|
|
1411
|
-
onAuthorizeError(_context.t0);
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
return _context.abrupt("return");
|
|
1416
|
+
body = {
|
|
1417
|
+
email: email,
|
|
1418
|
+
password: password
|
|
1419
|
+
};
|
|
1420
|
+
_context.next = 5;
|
|
1421
|
+
return authorize(body);
|
|
1415
1422
|
|
|
1416
|
-
case
|
|
1417
|
-
accessToken = _get(resAccessToken, 'data.access_token');
|
|
1418
|
-
handleSetAccessToken(accessToken);
|
|
1423
|
+
case 5:
|
|
1419
1424
|
profileResponse = null;
|
|
1420
|
-
_context.prev =
|
|
1421
|
-
_context.next =
|
|
1422
|
-
return getProfileData(
|
|
1425
|
+
_context.prev = 6;
|
|
1426
|
+
_context.next = 9;
|
|
1427
|
+
return getProfileData();
|
|
1423
1428
|
|
|
1424
|
-
case
|
|
1429
|
+
case 9:
|
|
1425
1430
|
profileResponse = _context.sent;
|
|
1426
1431
|
onGetProfileDataSuccess(profileResponse.data);
|
|
1427
|
-
_context.next =
|
|
1432
|
+
_context.next = 17;
|
|
1428
1433
|
break;
|
|
1429
1434
|
|
|
1430
|
-
case
|
|
1431
|
-
_context.prev =
|
|
1432
|
-
_context.
|
|
1435
|
+
case 13:
|
|
1436
|
+
_context.prev = 13;
|
|
1437
|
+
_context.t0 = _context["catch"](6);
|
|
1433
1438
|
|
|
1434
|
-
if (axios.isAxiosError(_context.
|
|
1435
|
-
onGetProfileDataError(_context.
|
|
1439
|
+
if (axios.isAxiosError(_context.t0)) {
|
|
1440
|
+
onGetProfileDataError(_context.t0);
|
|
1436
1441
|
}
|
|
1437
1442
|
|
|
1438
1443
|
return _context.abrupt("return");
|
|
1439
1444
|
|
|
1440
|
-
case
|
|
1445
|
+
case 17:
|
|
1441
1446
|
profileSpecifiedData = _get(profileResponse, 'data.data');
|
|
1442
1447
|
profileDataObj = {
|
|
1443
1448
|
id: profileSpecifiedData.id,
|
|
@@ -1448,32 +1453,31 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1448
1453
|
|
|
1449
1454
|
if (typeof window !== 'undefined') {
|
|
1450
1455
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
1451
|
-
window.localStorage.setItem('access_token', accessToken);
|
|
1452
1456
|
event = new window.CustomEvent('tf-login');
|
|
1453
1457
|
window.document.dispatchEvent(event);
|
|
1454
1458
|
}
|
|
1455
1459
|
|
|
1456
1460
|
onLogin();
|
|
1457
|
-
_context.next =
|
|
1461
|
+
_context.next = 26;
|
|
1458
1462
|
break;
|
|
1459
1463
|
|
|
1460
|
-
case
|
|
1461
|
-
_context.prev =
|
|
1462
|
-
_context.
|
|
1464
|
+
case 23:
|
|
1465
|
+
_context.prev = 23;
|
|
1466
|
+
_context.t1 = _context["catch"](1);
|
|
1463
1467
|
|
|
1464
|
-
if (axios.isAxiosError(_context.
|
|
1465
|
-
_error = (_context.
|
|
1468
|
+
if (axios.isAxiosError(_context.t1)) {
|
|
1469
|
+
_error = (_context.t1 == null ? void 0 : (_e$response = _context.t1.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message) || 'Error';
|
|
1466
1470
|
setError(_error);
|
|
1467
|
-
} else if (_context.
|
|
1468
|
-
setError((_context.
|
|
1471
|
+
} else if (_context.t1 instanceof Error) {
|
|
1472
|
+
setError((_context.t1 == null ? void 0 : _context.t1.message) || 'Error');
|
|
1469
1473
|
}
|
|
1470
1474
|
|
|
1471
|
-
case
|
|
1475
|
+
case 26:
|
|
1472
1476
|
case "end":
|
|
1473
1477
|
return _context.stop();
|
|
1474
1478
|
}
|
|
1475
1479
|
}
|
|
1476
|
-
}, _callee, null, [[1,
|
|
1480
|
+
}, _callee, null, [[1, 23], [6, 13]]);
|
|
1477
1481
|
}));
|
|
1478
1482
|
|
|
1479
1483
|
function onSubmit(_x) {
|
|
@@ -1570,7 +1574,7 @@ var RegisterModal = function RegisterModal(_ref) {
|
|
|
1570
1574
|
},
|
|
1571
1575
|
onSubmit: function () {
|
|
1572
1576
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
|
|
1573
|
-
var firstName, lastName, email, password, confirmPassword, bodyFormData,
|
|
1577
|
+
var firstName, lastName, email, password, confirmPassword, bodyFormData, profileResponse, profileSpecifiedData, profileDataObj;
|
|
1574
1578
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1575
1579
|
while (1) {
|
|
1576
1580
|
switch (_context.prev = _context.next) {
|
|
@@ -1588,27 +1592,24 @@ var RegisterModal = function RegisterModal(_ref) {
|
|
|
1588
1592
|
return register(bodyFormData);
|
|
1589
1593
|
|
|
1590
1594
|
case 11:
|
|
1591
|
-
resRegister = _context.sent;
|
|
1592
|
-
access_token = _get(resRegister, 'data.data.attributes.access_token');
|
|
1593
|
-
handleSetAccessToken(access_token);
|
|
1594
1595
|
profileResponse = null;
|
|
1595
|
-
_context.prev =
|
|
1596
|
-
_context.next =
|
|
1597
|
-
return getProfileData(
|
|
1596
|
+
_context.prev = 12;
|
|
1597
|
+
_context.next = 15;
|
|
1598
|
+
return getProfileData();
|
|
1598
1599
|
|
|
1599
|
-
case
|
|
1600
|
+
case 15:
|
|
1600
1601
|
profileResponse = _context.sent;
|
|
1601
1602
|
onGetProfileDataSuccess(profileResponse.data);
|
|
1602
|
-
_context.next =
|
|
1603
|
+
_context.next = 23;
|
|
1603
1604
|
break;
|
|
1604
1605
|
|
|
1605
|
-
case
|
|
1606
|
-
_context.prev =
|
|
1607
|
-
_context.t0 = _context["catch"](
|
|
1606
|
+
case 19:
|
|
1607
|
+
_context.prev = 19;
|
|
1608
|
+
_context.t0 = _context["catch"](12);
|
|
1608
1609
|
onGetProfileDataError(_context.t0.response);
|
|
1609
1610
|
return _context.abrupt("return");
|
|
1610
1611
|
|
|
1611
|
-
case
|
|
1612
|
+
case 23:
|
|
1612
1613
|
profileSpecifiedData = _get(profileResponse, 'data.data');
|
|
1613
1614
|
profileDataObj = {
|
|
1614
1615
|
id: profileSpecifiedData.id,
|
|
@@ -1618,18 +1619,17 @@ var RegisterModal = function RegisterModal(_ref) {
|
|
|
1618
1619
|
};
|
|
1619
1620
|
|
|
1620
1621
|
if (typeof window !== 'undefined') {
|
|
1621
|
-
window.localStorage.setItem('access_token', access_token);
|
|
1622
1622
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
1623
1623
|
}
|
|
1624
1624
|
|
|
1625
1625
|
onClose();
|
|
1626
1626
|
|
|
1627
|
-
case
|
|
1627
|
+
case 27:
|
|
1628
1628
|
case "end":
|
|
1629
1629
|
return _context.stop();
|
|
1630
1630
|
}
|
|
1631
1631
|
}
|
|
1632
|
-
}, _callee, null, [[
|
|
1632
|
+
}, _callee, null, [[12, 19]]);
|
|
1633
1633
|
}));
|
|
1634
1634
|
|
|
1635
1635
|
function onSubmit(_x) {
|
|
@@ -2322,7 +2322,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2322
2322
|
dataWithUniqueIds = _useState[0],
|
|
2323
2323
|
setDataWithUniqueIds = _useState[1];
|
|
2324
2324
|
|
|
2325
|
-
var
|
|
2325
|
+
var xtfCookie = getCookieByName('X-TF-ECOMMERCE');
|
|
2326
|
+
|
|
2327
|
+
var _useState2 = React.useState(!!access_token || xtfCookie),
|
|
2326
2328
|
isLoggedIn = _useState2[0],
|
|
2327
2329
|
setIsLoggedIn = _useState2[1];
|
|
2328
2330
|
|
|
@@ -2431,10 +2433,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2431
2433
|
};
|
|
2432
2434
|
|
|
2433
2435
|
React.useEffect(function () {
|
|
2434
|
-
if ((pIsLoggedIn || access_token) && !isLoggedIn) {
|
|
2436
|
+
if ((pIsLoggedIn || access_token) && !isLoggedIn || xtfCookie) {
|
|
2435
2437
|
setIsLoggedIn(true);
|
|
2436
2438
|
}
|
|
2437
|
-
}, [pIsLoggedIn, isLoggedIn, access_token]); //just once
|
|
2439
|
+
}, [pIsLoggedIn, isLoggedIn, access_token, xtfCookie]); //just once
|
|
2438
2440
|
|
|
2439
2441
|
React.useEffect(function () {
|
|
2440
2442
|
// fetch countries data
|
|
@@ -2543,7 +2545,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2543
2545
|
case 0:
|
|
2544
2546
|
_context4.prev = 0;
|
|
2545
2547
|
|
|
2546
|
-
if (!(isWindowDefined && token)) {
|
|
2548
|
+
if (!(isWindowDefined && token || isLoggedIn)) {
|
|
2547
2549
|
_context4.next = 10;
|
|
2548
2550
|
break;
|
|
2549
2551
|
}
|
|
@@ -2590,7 +2592,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2590
2592
|
|
|
2591
2593
|
React.useEffect(function () {
|
|
2592
2594
|
fetchUserData(access_token);
|
|
2593
|
-
}, [access_token]);
|
|
2595
|
+
}, [access_token, isLoggedIn]);
|
|
2594
2596
|
React.useEffect(function () {
|
|
2595
2597
|
var collectPaymentData = /*#__PURE__*/function () {
|
|
2596
2598
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
|
|
@@ -2685,7 +2687,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2685
2687
|
enableReinitialize: true,
|
|
2686
2688
|
onSubmit: function () {
|
|
2687
2689
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
|
|
2688
|
-
var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, checkoutBodyForRegistration, bodyFormData,
|
|
2690
|
+
var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, checkoutBodyForRegistration, bodyFormData, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3;
|
|
2689
2691
|
|
|
2690
2692
|
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2691
2693
|
while (1) {
|
|
@@ -2732,27 +2734,18 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2732
2734
|
lastNameLogged: lastNameLogged
|
|
2733
2735
|
}, showDOB);
|
|
2734
2736
|
bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
|
|
2735
|
-
|
|
2736
|
-
_context6.
|
|
2737
|
-
_context6.next = 21;
|
|
2737
|
+
_context6.prev = 17;
|
|
2738
|
+
_context6.next = 20;
|
|
2738
2739
|
return register(bodyFormData);
|
|
2739
2740
|
|
|
2740
|
-
case
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
2744
|
-
handleSetAccessToken(access_token_register);
|
|
2745
|
-
tokens = {
|
|
2746
|
-
accessToken: access_token_register,
|
|
2747
|
-
refreshToken: refreshToken
|
|
2748
|
-
};
|
|
2749
|
-
onRegisterSuccess(tokens);
|
|
2750
|
-
_context6.next = 33;
|
|
2741
|
+
case 20:
|
|
2742
|
+
onRegisterSuccess();
|
|
2743
|
+
_context6.next = 27;
|
|
2751
2744
|
break;
|
|
2752
2745
|
|
|
2753
|
-
case
|
|
2754
|
-
_context6.prev =
|
|
2755
|
-
_context6.t0 = _context6["catch"](
|
|
2746
|
+
case 23:
|
|
2747
|
+
_context6.prev = 23;
|
|
2748
|
+
_context6.t0 = _context6["catch"](17);
|
|
2756
2749
|
|
|
2757
2750
|
if (axios.isAxiosError(_context6.t0)) {
|
|
2758
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;
|
|
@@ -2777,11 +2770,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2777
2770
|
|
|
2778
2771
|
return _context6.abrupt("return");
|
|
2779
2772
|
|
|
2780
|
-
case
|
|
2781
|
-
_context6.next =
|
|
2782
|
-
return getProfileData(
|
|
2773
|
+
case 27:
|
|
2774
|
+
_context6.next = 29;
|
|
2775
|
+
return getProfileData();
|
|
2783
2776
|
|
|
2784
|
-
case
|
|
2777
|
+
case 29:
|
|
2785
2778
|
profileData = _context6.sent;
|
|
2786
2779
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2787
2780
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
@@ -2791,17 +2784,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2791
2784
|
}
|
|
2792
2785
|
|
|
2793
2786
|
checkoutBody = collectCheckoutBody(values);
|
|
2794
|
-
_context6.next =
|
|
2795
|
-
return postOnCheckout(checkoutBody
|
|
2787
|
+
_context6.next = 36;
|
|
2788
|
+
return postOnCheckout(checkoutBody);
|
|
2796
2789
|
|
|
2797
|
-
case
|
|
2790
|
+
case 36:
|
|
2798
2791
|
res = _context6.sent;
|
|
2799
2792
|
handleSubmit(values, formikHelpers, eventId, res);
|
|
2800
|
-
_context6.next =
|
|
2793
|
+
_context6.next = 43;
|
|
2801
2794
|
break;
|
|
2802
2795
|
|
|
2803
|
-
case
|
|
2804
|
-
_context6.prev =
|
|
2796
|
+
case 40:
|
|
2797
|
+
_context6.prev = 40;
|
|
2805
2798
|
_context6.t1 = _context6["catch"](0);
|
|
2806
2799
|
|
|
2807
2800
|
if (axios.isAxiosError(_context6.t1)) {
|
|
@@ -2825,12 +2818,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2825
2818
|
onSubmitError(_context6.t1);
|
|
2826
2819
|
}
|
|
2827
2820
|
|
|
2828
|
-
case
|
|
2821
|
+
case 43:
|
|
2829
2822
|
case "end":
|
|
2830
2823
|
return _context6.stop();
|
|
2831
2824
|
}
|
|
2832
2825
|
}
|
|
2833
|
-
}, _callee6, null, [[0,
|
|
2826
|
+
}, _callee6, null, [[0, 40], [17, 23]]);
|
|
2834
2827
|
}));
|
|
2835
2828
|
|
|
2836
2829
|
function onSubmit(_x2, _x3) {
|
|
@@ -4593,6 +4586,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4593
4586
|
|
|
4594
4587
|
var _event = new window.CustomEvent('tf-logout');
|
|
4595
4588
|
|
|
4589
|
+
deleteCookieByName('X-TF-ECOMMERCE');
|
|
4596
4590
|
window.document.dispatchEvent(_event);
|
|
4597
4591
|
}
|
|
4598
4592
|
};
|