tf-checkout-react 1.6.5 → 1.6.6
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/tf-checkout-react.cjs.development.js +24 -14
- 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 +24 -14
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/api/common.ts +14 -0
- package/src/components/ticketsContainer/index.tsx +17 -23
- package/src/hooks/useLocalStorageListener.ts +6 -1
|
@@ -1210,11 +1210,16 @@ var getEvent = /*#__PURE__*/function () {
|
|
|
1210
1210
|
}();
|
|
1211
1211
|
var getTickets = /*#__PURE__*/function () {
|
|
1212
1212
|
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(eventId, promoCode, pk) {
|
|
1213
|
-
var invitationHash, params, headers, response, tickets, ticketsArr, adaptedResponse;
|
|
1213
|
+
var invitationHash, referralId, promoterId, params, headers, response, tickets, ticketsArr, adaptedResponse;
|
|
1214
1214
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1215
1215
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1216
1216
|
case 0:
|
|
1217
1217
|
invitationHash = getQueryVariable('invitation-hash');
|
|
1218
|
+
referralId = getQueryVariable('ttf_r');
|
|
1219
|
+
if (referralId) {
|
|
1220
|
+
window.localStorage.setItem('promoter_id', referralId);
|
|
1221
|
+
}
|
|
1222
|
+
promoterId = window.localStorage.getItem('promoter_id');
|
|
1218
1223
|
params = {
|
|
1219
1224
|
pk: pk
|
|
1220
1225
|
};
|
|
@@ -1222,16 +1227,21 @@ var getTickets = /*#__PURE__*/function () {
|
|
|
1222
1227
|
params['invitation-hash'] = invitationHash;
|
|
1223
1228
|
}
|
|
1224
1229
|
headers = publicRequest.defaults.headers.common;
|
|
1230
|
+
if (promoterId) {
|
|
1231
|
+
headers['Promotion-Event'] = String(eventId);
|
|
1232
|
+
headers['Referrer-Id'] = isBrowser ? promoterId : '';
|
|
1233
|
+
}
|
|
1225
1234
|
if (promoCode) {
|
|
1226
1235
|
headers['Promotion-Event'] = String(eventId);
|
|
1227
1236
|
headers['Promotion-Code'] = promoCode;
|
|
1237
|
+
window.localStorage.removeItem('promoter_id');
|
|
1228
1238
|
}
|
|
1229
|
-
_context2.next =
|
|
1239
|
+
_context2.next = 11;
|
|
1230
1240
|
return publicRequest.get("v1/event/" + eventId + "/tickets/", {
|
|
1231
1241
|
params: params,
|
|
1232
1242
|
headers: headers
|
|
1233
1243
|
});
|
|
1234
|
-
case
|
|
1244
|
+
case 11:
|
|
1235
1245
|
response = _context2.sent;
|
|
1236
1246
|
tickets = response.data.data.attributes.tickets;
|
|
1237
1247
|
ticketsArr = [];
|
|
@@ -1248,7 +1258,7 @@ var getTickets = /*#__PURE__*/function () {
|
|
|
1248
1258
|
})
|
|
1249
1259
|
});
|
|
1250
1260
|
return _context2.abrupt("return", adaptedResponse.data);
|
|
1251
|
-
case
|
|
1261
|
+
case 17:
|
|
1252
1262
|
case "end":
|
|
1253
1263
|
return _context2.stop();
|
|
1254
1264
|
}
|
|
@@ -6269,7 +6279,12 @@ function useLocalStorageListener(key, callback) {
|
|
|
6269
6279
|
var newValue = localStorage.getItem(key);
|
|
6270
6280
|
if (newValue !== value) {
|
|
6271
6281
|
setValue(newValue);
|
|
6272
|
-
|
|
6282
|
+
if (newValue) {
|
|
6283
|
+
var parsed = JSON.parse(newValue);
|
|
6284
|
+
if (parsed) {
|
|
6285
|
+
callback(parsed);
|
|
6286
|
+
}
|
|
6287
|
+
}
|
|
6273
6288
|
}
|
|
6274
6289
|
}, 100);
|
|
6275
6290
|
return function () {
|
|
@@ -7377,23 +7392,18 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
7377
7392
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
7378
7393
|
while (1) switch (_context3.prev = _context3.next) {
|
|
7379
7394
|
case 0:
|
|
7380
|
-
_context3.
|
|
7381
|
-
_context3.next = 3;
|
|
7395
|
+
_context3.next = 2;
|
|
7382
7396
|
return getProfileData();
|
|
7383
|
-
case
|
|
7397
|
+
case 2:
|
|
7384
7398
|
userDataResponse = _context3.sent;
|
|
7385
7399
|
profileData = _get(userDataResponse, 'data');
|
|
7386
7400
|
profileDataObj = setLoggedUserData(profileData);
|
|
7387
7401
|
return _context3.abrupt("return", profileDataObj);
|
|
7388
|
-
case
|
|
7389
|
-
_context3.prev = 9;
|
|
7390
|
-
_context3.t0 = _context3["catch"](0);
|
|
7391
|
-
throw new Error(_context3.t0);
|
|
7392
|
-
case 12:
|
|
7402
|
+
case 6:
|
|
7393
7403
|
case "end":
|
|
7394
7404
|
return _context3.stop();
|
|
7395
7405
|
}
|
|
7396
|
-
}, _callee3
|
|
7406
|
+
}, _callee3);
|
|
7397
7407
|
}));
|
|
7398
7408
|
return function fetchUserData() {
|
|
7399
7409
|
return _ref5.apply(this, arguments);
|