core-outline 1.1.26 → 1.1.28
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/index.es.js +30 -31
- package/dist/index.js +30 -31
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -4355,6 +4355,7 @@ record.mirror = mirror;
|
|
|
4355
4355
|
var ANON_ID_KEY = 'co_anon_id';
|
|
4356
4356
|
var SESSION_ID_KEY = 'co_session_id';
|
|
4357
4357
|
function getAnonymousId() {
|
|
4358
|
+
if (typeof window === 'undefined') return '';
|
|
4358
4359
|
var id = localStorage.getItem(ANON_ID_KEY);
|
|
4359
4360
|
if (!id) {
|
|
4360
4361
|
id = v4();
|
|
@@ -4363,6 +4364,7 @@ function getAnonymousId() {
|
|
|
4363
4364
|
return id;
|
|
4364
4365
|
}
|
|
4365
4366
|
function getSessionId() {
|
|
4367
|
+
if (typeof window === 'undefined') return '';
|
|
4366
4368
|
var id = sessionStorage.getItem(SESSION_ID_KEY);
|
|
4367
4369
|
if (!id) {
|
|
4368
4370
|
id = v4();
|
|
@@ -4565,7 +4567,7 @@ function flush() {
|
|
|
4565
4567
|
}
|
|
4566
4568
|
function _flush() {
|
|
4567
4569
|
_flush = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
4568
|
-
var events, body
|
|
4570
|
+
var events, body;
|
|
4569
4571
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
4570
4572
|
while (1) switch (_context5.prev = _context5.next) {
|
|
4571
4573
|
case 0:
|
|
@@ -4573,32 +4575,26 @@ function _flush() {
|
|
|
4573
4575
|
return _ensureFreshToken();
|
|
4574
4576
|
case 2:
|
|
4575
4577
|
// if (!_token || _buffer.length === 0) return;
|
|
4578
|
+
print(_token);
|
|
4576
4579
|
events = _buffer.splice(0, _buffer.length);
|
|
4577
4580
|
body = JSON.stringify({
|
|
4578
4581
|
warehouse_id: _warehouseId,
|
|
4579
4582
|
organization_id: _organizationId,
|
|
4580
4583
|
events: events
|
|
4581
4584
|
});
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
}
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
body: body,
|
|
4596
|
-
keepalive: true
|
|
4597
|
-
})["catch"](function (err) {
|
|
4598
|
-
return console.error('[CoreOutline] Flush error:', err);
|
|
4599
|
-
});
|
|
4600
|
-
}
|
|
4601
|
-
case 6:
|
|
4585
|
+
console.log("Flushing here: ", body);
|
|
4586
|
+
fetch("".concat(INGEST_BASE, "/api/ingest/events"), {
|
|
4587
|
+
method: 'POST',
|
|
4588
|
+
headers: {
|
|
4589
|
+
'Content-Type': 'application/json',
|
|
4590
|
+
Authorization: "Bearer ".concat(_token)
|
|
4591
|
+
},
|
|
4592
|
+
body: body,
|
|
4593
|
+
keepalive: true
|
|
4594
|
+
})["catch"](function (err) {
|
|
4595
|
+
return console.error('[CoreOutline] Flush error:', err);
|
|
4596
|
+
});
|
|
4597
|
+
case 7:
|
|
4602
4598
|
case "end":
|
|
4603
4599
|
return _context5.stop();
|
|
4604
4600
|
}
|
|
@@ -4617,8 +4613,11 @@ function _sendRrwebBatch() {
|
|
|
4617
4613
|
_context6.next = 2;
|
|
4618
4614
|
return _ensureFreshToken();
|
|
4619
4615
|
case 2:
|
|
4620
|
-
|
|
4621
|
-
|
|
4616
|
+
// if (!_token || !chunks || chunks.length === 0) return;
|
|
4617
|
+
print(_token);
|
|
4618
|
+
console.log("RRWeb here: ", chunks);
|
|
4619
|
+
_context6.prev = 4;
|
|
4620
|
+
_context6.next = 7;
|
|
4622
4621
|
return fetch("".concat(INGEST_BASE, "/api/ingest/rrweb"), {
|
|
4623
4622
|
method: 'POST',
|
|
4624
4623
|
headers: {
|
|
@@ -4634,18 +4633,18 @@ function _sendRrwebBatch() {
|
|
|
4634
4633
|
}),
|
|
4635
4634
|
keepalive: true
|
|
4636
4635
|
});
|
|
4637
|
-
case 5:
|
|
4638
|
-
_context6.next = 10;
|
|
4639
|
-
break;
|
|
4640
4636
|
case 7:
|
|
4641
|
-
_context6.
|
|
4642
|
-
|
|
4637
|
+
_context6.next = 12;
|
|
4638
|
+
break;
|
|
4639
|
+
case 9:
|
|
4640
|
+
_context6.prev = 9;
|
|
4641
|
+
_context6.t0 = _context6["catch"](4);
|
|
4643
4642
|
console.error('[CoreOutline] rrweb upload error:', _context6.t0);
|
|
4644
|
-
case
|
|
4643
|
+
case 12:
|
|
4645
4644
|
case "end":
|
|
4646
4645
|
return _context6.stop();
|
|
4647
4646
|
}
|
|
4648
|
-
}, _callee6, null, [[
|
|
4647
|
+
}, _callee6, null, [[4, 9]]);
|
|
4649
4648
|
}));
|
|
4650
4649
|
return _sendRrwebBatch.apply(this, arguments);
|
|
4651
4650
|
}
|
|
@@ -4666,7 +4665,7 @@ var CoreOutline = function CoreOutline(_ref) {
|
|
|
4666
4665
|
replayEvents = _useState2[0],
|
|
4667
4666
|
setReplayEvents = _useState2[1];
|
|
4668
4667
|
var recorderActive = useRef(false);
|
|
4669
|
-
var _useState3 = useState(window.location.href),
|
|
4668
|
+
var _useState3 = useState(typeof window !== 'undefined' ? window.location.href : ''),
|
|
4670
4669
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
4671
4670
|
currentPage = _useState4[0],
|
|
4672
4671
|
setCurrentPage = _useState4[1];
|
package/dist/index.js
CHANGED
|
@@ -4363,6 +4363,7 @@ record.mirror = mirror;
|
|
|
4363
4363
|
var ANON_ID_KEY = 'co_anon_id';
|
|
4364
4364
|
var SESSION_ID_KEY = 'co_session_id';
|
|
4365
4365
|
function getAnonymousId() {
|
|
4366
|
+
if (typeof window === 'undefined') return '';
|
|
4366
4367
|
var id = localStorage.getItem(ANON_ID_KEY);
|
|
4367
4368
|
if (!id) {
|
|
4368
4369
|
id = uuid.v4();
|
|
@@ -4371,6 +4372,7 @@ function getAnonymousId() {
|
|
|
4371
4372
|
return id;
|
|
4372
4373
|
}
|
|
4373
4374
|
function getSessionId() {
|
|
4375
|
+
if (typeof window === 'undefined') return '';
|
|
4374
4376
|
var id = sessionStorage.getItem(SESSION_ID_KEY);
|
|
4375
4377
|
if (!id) {
|
|
4376
4378
|
id = uuid.v4();
|
|
@@ -4573,7 +4575,7 @@ function flush() {
|
|
|
4573
4575
|
}
|
|
4574
4576
|
function _flush() {
|
|
4575
4577
|
_flush = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
4576
|
-
var events, body
|
|
4578
|
+
var events, body;
|
|
4577
4579
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
4578
4580
|
while (1) switch (_context5.prev = _context5.next) {
|
|
4579
4581
|
case 0:
|
|
@@ -4581,32 +4583,26 @@ function _flush() {
|
|
|
4581
4583
|
return _ensureFreshToken();
|
|
4582
4584
|
case 2:
|
|
4583
4585
|
// if (!_token || _buffer.length === 0) return;
|
|
4586
|
+
print(_token);
|
|
4584
4587
|
events = _buffer.splice(0, _buffer.length);
|
|
4585
4588
|
body = JSON.stringify({
|
|
4586
4589
|
warehouse_id: _warehouseId,
|
|
4587
4590
|
organization_id: _organizationId,
|
|
4588
4591
|
events: events
|
|
4589
4592
|
});
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
}
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
body: body,
|
|
4604
|
-
keepalive: true
|
|
4605
|
-
})["catch"](function (err) {
|
|
4606
|
-
return console.error('[CoreOutline] Flush error:', err);
|
|
4607
|
-
});
|
|
4608
|
-
}
|
|
4609
|
-
case 6:
|
|
4593
|
+
console.log("Flushing here: ", body);
|
|
4594
|
+
fetch("".concat(INGEST_BASE, "/api/ingest/events"), {
|
|
4595
|
+
method: 'POST',
|
|
4596
|
+
headers: {
|
|
4597
|
+
'Content-Type': 'application/json',
|
|
4598
|
+
Authorization: "Bearer ".concat(_token)
|
|
4599
|
+
},
|
|
4600
|
+
body: body,
|
|
4601
|
+
keepalive: true
|
|
4602
|
+
})["catch"](function (err) {
|
|
4603
|
+
return console.error('[CoreOutline] Flush error:', err);
|
|
4604
|
+
});
|
|
4605
|
+
case 7:
|
|
4610
4606
|
case "end":
|
|
4611
4607
|
return _context5.stop();
|
|
4612
4608
|
}
|
|
@@ -4625,8 +4621,11 @@ function _sendRrwebBatch() {
|
|
|
4625
4621
|
_context6.next = 2;
|
|
4626
4622
|
return _ensureFreshToken();
|
|
4627
4623
|
case 2:
|
|
4628
|
-
|
|
4629
|
-
|
|
4624
|
+
// if (!_token || !chunks || chunks.length === 0) return;
|
|
4625
|
+
print(_token);
|
|
4626
|
+
console.log("RRWeb here: ", chunks);
|
|
4627
|
+
_context6.prev = 4;
|
|
4628
|
+
_context6.next = 7;
|
|
4630
4629
|
return fetch("".concat(INGEST_BASE, "/api/ingest/rrweb"), {
|
|
4631
4630
|
method: 'POST',
|
|
4632
4631
|
headers: {
|
|
@@ -4642,18 +4641,18 @@ function _sendRrwebBatch() {
|
|
|
4642
4641
|
}),
|
|
4643
4642
|
keepalive: true
|
|
4644
4643
|
});
|
|
4645
|
-
case 5:
|
|
4646
|
-
_context6.next = 10;
|
|
4647
|
-
break;
|
|
4648
4644
|
case 7:
|
|
4649
|
-
_context6.
|
|
4650
|
-
|
|
4645
|
+
_context6.next = 12;
|
|
4646
|
+
break;
|
|
4647
|
+
case 9:
|
|
4648
|
+
_context6.prev = 9;
|
|
4649
|
+
_context6.t0 = _context6["catch"](4);
|
|
4651
4650
|
console.error('[CoreOutline] rrweb upload error:', _context6.t0);
|
|
4652
|
-
case
|
|
4651
|
+
case 12:
|
|
4653
4652
|
case "end":
|
|
4654
4653
|
return _context6.stop();
|
|
4655
4654
|
}
|
|
4656
|
-
}, _callee6, null, [[
|
|
4655
|
+
}, _callee6, null, [[4, 9]]);
|
|
4657
4656
|
}));
|
|
4658
4657
|
return _sendRrwebBatch.apply(this, arguments);
|
|
4659
4658
|
}
|
|
@@ -4674,7 +4673,7 @@ var CoreOutline = function CoreOutline(_ref) {
|
|
|
4674
4673
|
replayEvents = _useState2[0],
|
|
4675
4674
|
setReplayEvents = _useState2[1];
|
|
4676
4675
|
var recorderActive = React.useRef(false);
|
|
4677
|
-
var _useState3 = React.useState(window.location.href),
|
|
4676
|
+
var _useState3 = React.useState(typeof window !== 'undefined' ? window.location.href : ''),
|
|
4678
4677
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
4679
4678
|
currentPage = _useState4[0],
|
|
4680
4679
|
setCurrentPage = _useState4[1];
|