tf-checkout-react 1.0.95 → 1.0.96-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 +6 -2
- package/dist/tf-checkout-react.cjs.development.js +151 -116
- 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 +151 -116
- 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 +21 -4
- package/src/components/billing-info-container/index.tsx +7 -9
- package/src/components/loginModal/index.tsx +6 -41
- package/src/components/paymentContainer/index.tsx +18 -5
- 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
|
@@ -13,13 +13,17 @@ export declare function getTickets(id: string | number, promoCode: string): Prom
|
|
|
13
13
|
export declare const addToCart: (id: string | number, data: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
14
14
|
export declare const getCart: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
15
15
|
export declare const postOnCheckout: (data: any, accessToken: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
16
|
-
export declare const authorize: (data:
|
|
16
|
+
export declare const authorize: (data: {
|
|
17
|
+
email: string;
|
|
18
|
+
password: string;
|
|
19
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
17
20
|
export declare const register: (data: FormData) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
18
21
|
export declare const getAccessToken: (data: FormData) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
19
22
|
export declare const getPaymentData: (hash: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
20
23
|
export declare const handlePaymentData: (orderHash: string, data: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
21
24
|
export declare const handlePaymentSuccess: (orderHash: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
22
|
-
export declare const
|
|
25
|
+
export declare const handleFreeSuccess: (orderHash: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
26
|
+
export declare const getProfileData: (accessToken?: string | undefined) => Promise<any>;
|
|
23
27
|
export declare const getCountries: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
24
28
|
export declare const getConfirmationData: (orderHash: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
25
29
|
export declare const getStates: (countryId: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -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,14 +1196,22 @@ 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
|
}
|
|
@@ -1255,14 +1296,11 @@ var postOnCheckout = function postOnCheckout(data, accessToken) {
|
|
|
1255
1296
|
return res;
|
|
1256
1297
|
};
|
|
1257
1298
|
var authorize = function authorize(data) {
|
|
1258
|
-
return publicRequest.post("/
|
|
1299
|
+
return publicRequest.post("/auth?clientId=" + (CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'), data);
|
|
1259
1300
|
};
|
|
1260
1301
|
var register = function register(data) {
|
|
1261
1302
|
return publicRequest.post('/v1/oauth/register-rn', data);
|
|
1262
1303
|
};
|
|
1263
|
-
var getAccessToken = function getAccessToken(data) {
|
|
1264
|
-
return publicRequest.post('/v1/oauth/access_token', data);
|
|
1265
|
-
};
|
|
1266
1304
|
var getPaymentData = function getPaymentData(hash) {
|
|
1267
1305
|
var response = publicRequest.get("v1/order/" + hash + "/review/")["catch"](function (error) {
|
|
1268
1306
|
throw error;
|
|
@@ -1275,6 +1313,12 @@ var handlePaymentSuccess = function handlePaymentSuccess(orderHash) {
|
|
|
1275
1313
|
});
|
|
1276
1314
|
return res;
|
|
1277
1315
|
};
|
|
1316
|
+
var handleFreeSuccess = function handleFreeSuccess(orderHash) {
|
|
1317
|
+
var res = publicRequest.post("v1/order/" + orderHash + "/complete_free_registration")["catch"](function (error) {
|
|
1318
|
+
throw error;
|
|
1319
|
+
});
|
|
1320
|
+
return res;
|
|
1321
|
+
};
|
|
1278
1322
|
var getProfileData = function getProfileData(accessToken) {
|
|
1279
1323
|
return publicRequest.get('/customer/profile/', {
|
|
1280
1324
|
headers: _extends({}, ttfHeaders, {
|
|
@@ -1328,10 +1372,6 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1328
1372
|
alreadyHasUser = _ref$alreadyHasUser === void 0 ? false : _ref$alreadyHasUser,
|
|
1329
1373
|
_ref$userExpired = _ref.userExpired,
|
|
1330
1374
|
userExpired = _ref$userExpired === void 0 ? false : _ref$userExpired,
|
|
1331
|
-
_ref$onAuthorizeSucce = _ref.onAuthorizeSuccess,
|
|
1332
|
-
onAuthorizeSuccess = _ref$onAuthorizeSucce === void 0 ? function () {} : _ref$onAuthorizeSucce,
|
|
1333
|
-
_ref$onAuthorizeError = _ref.onAuthorizeError,
|
|
1334
|
-
onAuthorizeError = _ref$onAuthorizeError === void 0 ? function () {} : _ref$onAuthorizeError,
|
|
1335
1375
|
_ref$onGetProfileData = _ref.onGetProfileDataSuccess,
|
|
1336
1376
|
onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? function () {} : _ref$onGetProfileData,
|
|
1337
1377
|
_ref$onGetProfileData2 = _ref.onGetProfileDataError,
|
|
@@ -1364,7 +1404,7 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1364
1404
|
},
|
|
1365
1405
|
onSubmit: function () {
|
|
1366
1406
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
|
|
1367
|
-
var email, password,
|
|
1407
|
+
var email, password, body, resAutorize, xtfCookie, profileResponse, profileSpecifiedData, profileDataObj, event, _e$response, _e$response$data, _error;
|
|
1368
1408
|
|
|
1369
1409
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1370
1410
|
while (1) {
|
|
@@ -1372,66 +1412,39 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1372
1412
|
case 0:
|
|
1373
1413
|
email = _ref2.email, password = _ref2.password;
|
|
1374
1414
|
_context.prev = 1;
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1415
|
+
body = {
|
|
1416
|
+
email: email,
|
|
1417
|
+
password: password
|
|
1418
|
+
};
|
|
1419
|
+
_context.next = 5;
|
|
1420
|
+
return authorize(body);
|
|
1380
1421
|
|
|
1381
|
-
case
|
|
1422
|
+
case 5:
|
|
1382
1423
|
resAutorize = _context.sent;
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
bodyFormDataToken.append('scope', 'profile');
|
|
1386
|
-
bodyFormDataToken.append('grant_type', 'authorization_code');
|
|
1387
|
-
bodyFormDataToken.append('client_id', CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf');
|
|
1388
|
-
bodyFormDataToken.append('client_secret', CONFIGS.CLIENT_SECRET || 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9');
|
|
1389
|
-
resAccessToken = null;
|
|
1390
|
-
_context.prev = 15;
|
|
1391
|
-
_context.next = 18;
|
|
1392
|
-
return getAccessToken(bodyFormDataToken);
|
|
1393
|
-
|
|
1394
|
-
case 18:
|
|
1395
|
-
resAccessToken = _context.sent;
|
|
1396
|
-
onAuthorizeSuccess(resAccessToken.data);
|
|
1397
|
-
_context.next = 26;
|
|
1398
|
-
break;
|
|
1399
|
-
|
|
1400
|
-
case 22:
|
|
1401
|
-
_context.prev = 22;
|
|
1402
|
-
_context.t0 = _context["catch"](15);
|
|
1403
|
-
|
|
1404
|
-
if (axios.isAxiosError(_context.t0)) {
|
|
1405
|
-
onAuthorizeError(_context.t0);
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
return _context.abrupt("return");
|
|
1409
|
-
|
|
1410
|
-
case 26:
|
|
1411
|
-
accessToken = _get(resAccessToken, 'data.access_token');
|
|
1412
|
-
handleSetAccessToken(accessToken);
|
|
1424
|
+
xtfCookie = _get(resAutorize, 'headers.x-tf-ecommerce');
|
|
1425
|
+
setCustomCookie('X-TF-ECOMMERCE', xtfCookie);
|
|
1413
1426
|
profileResponse = null;
|
|
1414
|
-
_context.prev =
|
|
1415
|
-
_context.next =
|
|
1416
|
-
return getProfileData(
|
|
1427
|
+
_context.prev = 9;
|
|
1428
|
+
_context.next = 12;
|
|
1429
|
+
return getProfileData();
|
|
1417
1430
|
|
|
1418
|
-
case
|
|
1431
|
+
case 12:
|
|
1419
1432
|
profileResponse = _context.sent;
|
|
1420
1433
|
onGetProfileDataSuccess(profileResponse.data);
|
|
1421
|
-
_context.next =
|
|
1434
|
+
_context.next = 20;
|
|
1422
1435
|
break;
|
|
1423
1436
|
|
|
1424
|
-
case
|
|
1425
|
-
_context.prev =
|
|
1426
|
-
_context.
|
|
1437
|
+
case 16:
|
|
1438
|
+
_context.prev = 16;
|
|
1439
|
+
_context.t0 = _context["catch"](9);
|
|
1427
1440
|
|
|
1428
|
-
if (axios.isAxiosError(_context.
|
|
1429
|
-
onGetProfileDataError(_context.
|
|
1441
|
+
if (axios.isAxiosError(_context.t0)) {
|
|
1442
|
+
onGetProfileDataError(_context.t0);
|
|
1430
1443
|
}
|
|
1431
1444
|
|
|
1432
1445
|
return _context.abrupt("return");
|
|
1433
1446
|
|
|
1434
|
-
case
|
|
1447
|
+
case 20:
|
|
1435
1448
|
profileSpecifiedData = _get(profileResponse, 'data.data');
|
|
1436
1449
|
profileDataObj = {
|
|
1437
1450
|
id: profileSpecifiedData.id,
|
|
@@ -1442,32 +1455,31 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1442
1455
|
|
|
1443
1456
|
if (typeof window !== 'undefined') {
|
|
1444
1457
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
1445
|
-
window.localStorage.setItem('access_token', accessToken);
|
|
1446
1458
|
event = new window.CustomEvent('tf-login');
|
|
1447
1459
|
window.document.dispatchEvent(event);
|
|
1448
1460
|
}
|
|
1449
1461
|
|
|
1450
1462
|
onLogin();
|
|
1451
|
-
_context.next =
|
|
1463
|
+
_context.next = 29;
|
|
1452
1464
|
break;
|
|
1453
1465
|
|
|
1454
|
-
case
|
|
1455
|
-
_context.prev =
|
|
1456
|
-
_context.
|
|
1466
|
+
case 26:
|
|
1467
|
+
_context.prev = 26;
|
|
1468
|
+
_context.t1 = _context["catch"](1);
|
|
1457
1469
|
|
|
1458
|
-
if (axios.isAxiosError(_context.
|
|
1459
|
-
_error = (_context.
|
|
1470
|
+
if (axios.isAxiosError(_context.t1)) {
|
|
1471
|
+
_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';
|
|
1460
1472
|
setError(_error);
|
|
1461
|
-
} else if (_context.
|
|
1462
|
-
setError((_context.
|
|
1473
|
+
} else if (_context.t1 instanceof Error) {
|
|
1474
|
+
setError((_context.t1 == null ? void 0 : _context.t1.message) || 'Error');
|
|
1463
1475
|
}
|
|
1464
1476
|
|
|
1465
|
-
case
|
|
1477
|
+
case 29:
|
|
1466
1478
|
case "end":
|
|
1467
1479
|
return _context.stop();
|
|
1468
1480
|
}
|
|
1469
1481
|
}
|
|
1470
|
-
}, _callee, null, [[1,
|
|
1482
|
+
}, _callee, null, [[1, 26], [9, 16]]);
|
|
1471
1483
|
}));
|
|
1472
1484
|
|
|
1473
1485
|
function onSubmit(_x) {
|
|
@@ -2316,7 +2328,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2316
2328
|
dataWithUniqueIds = _useState[0],
|
|
2317
2329
|
setDataWithUniqueIds = _useState[1];
|
|
2318
2330
|
|
|
2319
|
-
var
|
|
2331
|
+
var xtfCookie = getCookieByName('X-TF-ECOMMERCE');
|
|
2332
|
+
|
|
2333
|
+
var _useState2 = React.useState(!!access_token || xtfCookie),
|
|
2320
2334
|
isLoggedIn = _useState2[0],
|
|
2321
2335
|
setIsLoggedIn = _useState2[1];
|
|
2322
2336
|
|
|
@@ -2425,10 +2439,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2425
2439
|
};
|
|
2426
2440
|
|
|
2427
2441
|
React.useEffect(function () {
|
|
2428
|
-
if ((pIsLoggedIn || access_token) && !isLoggedIn) {
|
|
2442
|
+
if ((pIsLoggedIn || access_token) && !isLoggedIn || xtfCookie) {
|
|
2429
2443
|
setIsLoggedIn(true);
|
|
2430
2444
|
}
|
|
2431
|
-
}, [pIsLoggedIn, isLoggedIn, access_token]); //just once
|
|
2445
|
+
}, [pIsLoggedIn, isLoggedIn, access_token, xtfCookie]); //just once
|
|
2432
2446
|
|
|
2433
2447
|
React.useEffect(function () {
|
|
2434
2448
|
// fetch countries data
|
|
@@ -2537,7 +2551,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2537
2551
|
case 0:
|
|
2538
2552
|
_context4.prev = 0;
|
|
2539
2553
|
|
|
2540
|
-
if (!(isWindowDefined && token)) {
|
|
2554
|
+
if (!(isWindowDefined && token || xtfCookie)) {
|
|
2541
2555
|
_context4.next = 10;
|
|
2542
2556
|
break;
|
|
2543
2557
|
}
|
|
@@ -2584,7 +2598,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2584
2598
|
|
|
2585
2599
|
React.useEffect(function () {
|
|
2586
2600
|
fetchUserData(access_token);
|
|
2587
|
-
}, [access_token]);
|
|
2601
|
+
}, [access_token, xtfCookie]);
|
|
2588
2602
|
React.useEffect(function () {
|
|
2589
2603
|
var collectPaymentData = /*#__PURE__*/function () {
|
|
2590
2604
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
|
|
@@ -2688,7 +2702,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2688
2702
|
_context6.prev = 0;
|
|
2689
2703
|
|
|
2690
2704
|
if (!isLoggedIn) {
|
|
2691
|
-
_context6.next =
|
|
2705
|
+
_context6.next = 15;
|
|
2692
2706
|
break;
|
|
2693
2707
|
}
|
|
2694
2708
|
|
|
@@ -2716,14 +2730,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2716
2730
|
|
|
2717
2731
|
case 12:
|
|
2718
2732
|
_res = _context6.sent;
|
|
2719
|
-
_context6.next = 15;
|
|
2720
|
-
return getPaymentData(_res.data.data.attributes.hash);
|
|
2721
|
-
|
|
2722
|
-
case 15:
|
|
2723
2733
|
handleSubmit(values, formikHelpers, eventId, _res);
|
|
2724
2734
|
return _context6.abrupt("return");
|
|
2725
2735
|
|
|
2726
|
-
case
|
|
2736
|
+
case 15:
|
|
2727
2737
|
checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
2728
2738
|
emailLogged: emailLogged,
|
|
2729
2739
|
firstNameLogged: firstNameLogged,
|
|
@@ -2731,11 +2741,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2731
2741
|
}, showDOB);
|
|
2732
2742
|
bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
|
|
2733
2743
|
access_token_register = null;
|
|
2734
|
-
_context6.prev =
|
|
2735
|
-
_context6.next =
|
|
2744
|
+
_context6.prev = 18;
|
|
2745
|
+
_context6.next = 21;
|
|
2736
2746
|
return register(bodyFormData);
|
|
2737
2747
|
|
|
2738
|
-
case
|
|
2748
|
+
case 21:
|
|
2739
2749
|
resRegister = _context6.sent;
|
|
2740
2750
|
access_token_register = _get(resRegister, 'data.data.attributes.access_token');
|
|
2741
2751
|
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
@@ -2745,12 +2755,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2745
2755
|
refreshToken: refreshToken
|
|
2746
2756
|
};
|
|
2747
2757
|
onRegisterSuccess(tokens);
|
|
2748
|
-
_context6.next =
|
|
2758
|
+
_context6.next = 33;
|
|
2749
2759
|
break;
|
|
2750
2760
|
|
|
2751
|
-
case
|
|
2752
|
-
_context6.prev =
|
|
2753
|
-
_context6.t0 = _context6["catch"](
|
|
2761
|
+
case 29:
|
|
2762
|
+
_context6.prev = 29;
|
|
2763
|
+
_context6.t0 = _context6["catch"](18);
|
|
2754
2764
|
|
|
2755
2765
|
if (axios.isAxiosError(_context6.t0)) {
|
|
2756
2766
|
_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;
|
|
@@ -2775,11 +2785,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2775
2785
|
|
|
2776
2786
|
return _context6.abrupt("return");
|
|
2777
2787
|
|
|
2778
|
-
case
|
|
2779
|
-
_context6.next =
|
|
2788
|
+
case 33:
|
|
2789
|
+
_context6.next = 35;
|
|
2780
2790
|
return getProfileData(access_token_register);
|
|
2781
2791
|
|
|
2782
|
-
case
|
|
2792
|
+
case 35:
|
|
2783
2793
|
profileData = _context6.sent;
|
|
2784
2794
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2785
2795
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
@@ -2789,21 +2799,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2789
2799
|
}
|
|
2790
2800
|
|
|
2791
2801
|
checkoutBody = collectCheckoutBody(values);
|
|
2792
|
-
_context6.next =
|
|
2802
|
+
_context6.next = 42;
|
|
2793
2803
|
return postOnCheckout(checkoutBody, access_token_register);
|
|
2794
2804
|
|
|
2795
|
-
case
|
|
2805
|
+
case 42:
|
|
2796
2806
|
res = _context6.sent;
|
|
2797
|
-
_context6.next = 47;
|
|
2798
|
-
return getPaymentData(res.data.data.attributes.hash);
|
|
2799
|
-
|
|
2800
|
-
case 47:
|
|
2801
2807
|
handleSubmit(values, formikHelpers, eventId, res);
|
|
2802
|
-
_context6.next =
|
|
2808
|
+
_context6.next = 49;
|
|
2803
2809
|
break;
|
|
2804
2810
|
|
|
2805
|
-
case
|
|
2806
|
-
_context6.prev =
|
|
2811
|
+
case 46:
|
|
2812
|
+
_context6.prev = 46;
|
|
2807
2813
|
_context6.t1 = _context6["catch"](0);
|
|
2808
2814
|
|
|
2809
2815
|
if (axios.isAxiosError(_context6.t1)) {
|
|
@@ -2827,12 +2833,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2827
2833
|
onSubmitError(_context6.t1);
|
|
2828
2834
|
}
|
|
2829
2835
|
|
|
2830
|
-
case
|
|
2836
|
+
case 49:
|
|
2831
2837
|
case "end":
|
|
2832
2838
|
return _context6.stop();
|
|
2833
2839
|
}
|
|
2834
2840
|
}
|
|
2835
|
-
}, _callee6, null, [[0,
|
|
2841
|
+
}, _callee6, null, [[0, 46], [18, 29]]);
|
|
2836
2842
|
}));
|
|
2837
2843
|
|
|
2838
2844
|
function onSubmit(_x2, _x3) {
|
|
@@ -3414,9 +3420,9 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3414
3420
|
var showFormTitle = Boolean(formTitle);
|
|
3415
3421
|
var showErrorText = Boolean(errorText);
|
|
3416
3422
|
var eventId = getQueryVariable('event_id');
|
|
3423
|
+
var hash = checkoutData.hash,
|
|
3424
|
+
total = checkoutData.total;
|
|
3417
3425
|
React.useEffect(function () {
|
|
3418
|
-
var hash = checkoutData.hash;
|
|
3419
|
-
|
|
3420
3426
|
_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
3421
3427
|
var response, _cart$, attributes, cart, order_details, _order_details$ticket, ticket, _orderData;
|
|
3422
3428
|
|
|
@@ -3536,32 +3542,50 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3536
3542
|
|
|
3537
3543
|
case 4:
|
|
3538
3544
|
order_hash = reviewData.order_details.order_hash;
|
|
3539
|
-
|
|
3545
|
+
|
|
3546
|
+
if (!(total === "0.00")) {
|
|
3547
|
+
_context3.next = 11;
|
|
3548
|
+
break;
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
_context3.next = 8;
|
|
3552
|
+
return handleFreeSuccess(order_hash);
|
|
3553
|
+
|
|
3554
|
+
case 8:
|
|
3555
|
+
_context3.t0 = _context3.sent;
|
|
3556
|
+
_context3.next = 14;
|
|
3557
|
+
break;
|
|
3558
|
+
|
|
3559
|
+
case 11:
|
|
3560
|
+
_context3.next = 13;
|
|
3540
3561
|
return handlePaymentSuccess(order_hash);
|
|
3541
3562
|
|
|
3542
|
-
case
|
|
3543
|
-
|
|
3563
|
+
case 13:
|
|
3564
|
+
_context3.t0 = _context3.sent;
|
|
3565
|
+
|
|
3566
|
+
case 14:
|
|
3567
|
+
paymentSuccessResponse = _context3.t0;
|
|
3544
3568
|
|
|
3545
3569
|
if (paymentSuccessResponse.status === 200) {
|
|
3546
3570
|
handlePayment(paymentSuccessResponse);
|
|
3547
3571
|
setPaymentIsLoading(false);
|
|
3548
3572
|
}
|
|
3549
3573
|
|
|
3550
|
-
_context3.next =
|
|
3574
|
+
_context3.next = 22;
|
|
3551
3575
|
break;
|
|
3552
3576
|
|
|
3553
|
-
case
|
|
3554
|
-
_context3.prev =
|
|
3555
|
-
_context3.
|
|
3556
|
-
setError(_get(_context3.
|
|
3557
|
-
onPaymentError(_context3.
|
|
3577
|
+
case 18:
|
|
3578
|
+
_context3.prev = 18;
|
|
3579
|
+
_context3.t1 = _context3["catch"](0);
|
|
3580
|
+
setError(_get(_context3.t1, 'response.data.message'));
|
|
3581
|
+
onPaymentError(_context3.t1.response);
|
|
3558
3582
|
|
|
3559
|
-
case
|
|
3583
|
+
case 22:
|
|
3560
3584
|
case "end":
|
|
3561
3585
|
return _context3.stop();
|
|
3562
3586
|
}
|
|
3563
3587
|
}
|
|
3564
|
-
}, _callee3, null, [[0,
|
|
3588
|
+
}, _callee3, null, [[0, 18]]);
|
|
3565
3589
|
}));
|
|
3566
3590
|
|
|
3567
3591
|
return function handlePaymentMiddleWare(_x) {
|
|
@@ -3603,7 +3627,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3603
3627
|
}, label), React__default.createElement("div", {
|
|
3604
3628
|
className: className + " order_info_text"
|
|
3605
3629
|
}, normalizer(orderData[id], orderData.currency)));
|
|
3606
|
-
})), React__default.createElement("div", {
|
|
3630
|
+
})), total !== "0.00" ? React__default.createElement("div", {
|
|
3607
3631
|
className: "payment_info"
|
|
3608
3632
|
}, React__default.createElement("div", {
|
|
3609
3633
|
className: "payment_info_label"
|
|
@@ -3626,7 +3650,17 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3626
3650
|
conditions: conditions,
|
|
3627
3651
|
stripeCardOptions: stripeCardOptions,
|
|
3628
3652
|
disableZipSection: disableZipSection
|
|
3629
|
-
}))))
|
|
3653
|
+
})))) : React__default.createElement("div", {
|
|
3654
|
+
className: "payment_button " + (paymentIsLoading ? 'disabled-payment-button' : '')
|
|
3655
|
+
}, React__default.createElement("button", {
|
|
3656
|
+
disabled: paymentIsLoading,
|
|
3657
|
+
type: "button",
|
|
3658
|
+
onClick: function onClick() {
|
|
3659
|
+
handlePaymentMiddleWare(null);
|
|
3660
|
+
}
|
|
3661
|
+
}, paymentIsLoading ? React__default.createElement(CircularProgress, {
|
|
3662
|
+
size: 26
|
|
3663
|
+
}) : "Complete Registration")))));
|
|
3630
3664
|
};
|
|
3631
3665
|
|
|
3632
3666
|
var config = {
|
|
@@ -4567,6 +4601,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4567
4601
|
|
|
4568
4602
|
var _event = new window.CustomEvent('tf-logout');
|
|
4569
4603
|
|
|
4604
|
+
deleteCookieByName('X-TF-ECOMMERCE');
|
|
4570
4605
|
window.document.dispatchEvent(_event);
|
|
4571
4606
|
}
|
|
4572
4607
|
};
|