tf-checkout-react 1.1.0 → 1.2.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.
@@ -1193,6 +1193,7 @@ var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWit
1193
1193
  };
1194
1194
 
1195
1195
  var isWindowDefined = typeof window !== 'undefined';
1196
+ var isDocumentDefined = typeof document !== 'undefined';
1196
1197
  var ttfHeaders = {
1197
1198
  Accept: 'application/vnd.api+json',
1198
1199
  'Content-Type': 'application/vnd.api+json'
@@ -1338,8 +1339,26 @@ var handleSetAccessToken = function handleSetAccessToken(token) {
1338
1339
  }
1339
1340
  };
1340
1341
  function getEvent(id) {
1342
+ var referralValue = "";
1343
+
1344
+ if (isWindowDefined) {
1345
+ var params = new URL("" + window.location);
1346
+ var referralId = params.searchParams.get('ttf_r') || '';
1347
+ var referral_key = window.localStorage.getItem('referral_key');
1348
+ var referralIdlocal = "";
1349
+
1350
+ if (referral_key) {
1351
+ referralIdlocal = referral_key.split('.')[1];
1352
+ }
1353
+
1354
+ referralValue = referralId || referralIdlocal;
1355
+ }
1356
+
1341
1357
  var response = publicRequest.get("v1/event/" + id, {
1342
- headers: ttfHeaders
1358
+ headers: _extends({}, ttfHeaders, {
1359
+ "Referer-Url": isDocumentDefined ? document.referrer : '',
1360
+ "Referrer-Id": isWindowDefined ? referralValue : ''
1361
+ })
1343
1362
  })["catch"](function (error) {
1344
1363
  throw error;
1345
1364
  });
@@ -1358,7 +1377,10 @@ function getTickets(id, promoCode) {
1358
1377
  }
1359
1378
  var addToCart = function addToCart(id, data) {
1360
1379
  var res = publicRequest.post("v1/event/" + id + "/add-to-cart/", {
1361
- data: data
1380
+ data: data,
1381
+ headers: {
1382
+ "Referer-Url": isDocumentDefined ? document.referrer : ''
1383
+ }
1362
1384
  });
1363
1385
  return res;
1364
1386
  };
@@ -1383,19 +1405,31 @@ var register = function register(data) {
1383
1405
  return publicRequest.post('v1/oauth/register-rn', data);
1384
1406
  };
1385
1407
  var getPaymentData = function getPaymentData(hash) {
1386
- var response = publicRequest.get("v1/order/" + hash + "/review/")["catch"](function (error) {
1408
+ var response = publicRequest.get("v1/order/" + hash + "/review/", {
1409
+ headers: {
1410
+ "Referer-Url": isDocumentDefined ? document.referrer : ''
1411
+ }
1412
+ })["catch"](function (error) {
1387
1413
  throw error;
1388
1414
  });
1389
1415
  return response;
1390
1416
  };
1391
1417
  var handlePaymentSuccess = function handlePaymentSuccess(orderHash) {
1392
- var res = publicRequest.post("v1/order/" + orderHash + "/success")["catch"](function (error) {
1418
+ var res = publicRequest.post("v1/order/" + orderHash + "/success", {
1419
+ headers: {
1420
+ "Referer-Url": isDocumentDefined ? document.referrer : ''
1421
+ }
1422
+ })["catch"](function (error) {
1393
1423
  throw error;
1394
1424
  });
1395
1425
  return res;
1396
1426
  };
1397
1427
  var handleFreeSuccess = function handleFreeSuccess(orderHash) {
1398
- var res = publicRequest.post("v1/order/" + orderHash + "/complete_free_registration")["catch"](function (error) {
1428
+ var res = publicRequest.post("v1/order/" + orderHash + "/complete_free_registration", {
1429
+ headers: {
1430
+ "Referer-Url": isDocumentDefined ? document.referrer : ''
1431
+ }
1432
+ })["catch"](function (error) {
1399
1433
  throw error;
1400
1434
  });
1401
1435
  return res;