core-outline 1.1.13 → 1.1.14

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.
Files changed (3) hide show
  1. package/dist/index.es.js +621 -174
  2. package/dist/index.js +621 -174
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10,6 +10,393 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
 
11
11
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
12
 
13
+ function _arrayLikeToArray(r, a) {
14
+ (null == a || a > r.length) && (a = r.length);
15
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
16
+ return n;
17
+ }
18
+ function _arrayWithHoles(r) {
19
+ if (Array.isArray(r)) return r;
20
+ }
21
+ function _arrayWithoutHoles(r) {
22
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
23
+ }
24
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
25
+ try {
26
+ var i = n[a](c),
27
+ u = i.value;
28
+ } catch (n) {
29
+ return void e(n);
30
+ }
31
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
32
+ }
33
+ function _asyncToGenerator(n) {
34
+ return function () {
35
+ var t = this,
36
+ e = arguments;
37
+ return new Promise(function (r, o) {
38
+ var a = n.apply(t, e);
39
+ function _next(n) {
40
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
41
+ }
42
+ function _throw(n) {
43
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
44
+ }
45
+ _next(void 0);
46
+ });
47
+ };
48
+ }
49
+ function _iterableToArray(r) {
50
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
51
+ }
52
+ function _iterableToArrayLimit(r, l) {
53
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
54
+ if (null != t) {
55
+ var e,
56
+ n,
57
+ i,
58
+ u,
59
+ a = [],
60
+ f = !0,
61
+ o = !1;
62
+ try {
63
+ if (i = (t = t.call(r)).next, 0 === l) {
64
+ if (Object(t) !== t) return;
65
+ f = !1;
66
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
67
+ } catch (r) {
68
+ o = !0, n = r;
69
+ } finally {
70
+ try {
71
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
72
+ } finally {
73
+ if (o) throw n;
74
+ }
75
+ }
76
+ return a;
77
+ }
78
+ }
79
+ function _nonIterableRest() {
80
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
81
+ }
82
+ function _nonIterableSpread() {
83
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
84
+ }
85
+ function _regeneratorRuntime() {
86
+ _regeneratorRuntime = function () {
87
+ return e;
88
+ };
89
+ var t,
90
+ e = {},
91
+ r = Object.prototype,
92
+ n = r.hasOwnProperty,
93
+ o = Object.defineProperty || function (t, e, r) {
94
+ t[e] = r.value;
95
+ },
96
+ i = "function" == typeof Symbol ? Symbol : {},
97
+ a = i.iterator || "@@iterator",
98
+ c = i.asyncIterator || "@@asyncIterator",
99
+ u = i.toStringTag || "@@toStringTag";
100
+ function define(t, e, r) {
101
+ return Object.defineProperty(t, e, {
102
+ value: r,
103
+ enumerable: !0,
104
+ configurable: !0,
105
+ writable: !0
106
+ }), t[e];
107
+ }
108
+ try {
109
+ define({}, "");
110
+ } catch (t) {
111
+ define = function (t, e, r) {
112
+ return t[e] = r;
113
+ };
114
+ }
115
+ function wrap(t, e, r, n) {
116
+ var i = e && e.prototype instanceof Generator ? e : Generator,
117
+ a = Object.create(i.prototype),
118
+ c = new Context(n || []);
119
+ return o(a, "_invoke", {
120
+ value: makeInvokeMethod(t, r, c)
121
+ }), a;
122
+ }
123
+ function tryCatch(t, e, r) {
124
+ try {
125
+ return {
126
+ type: "normal",
127
+ arg: t.call(e, r)
128
+ };
129
+ } catch (t) {
130
+ return {
131
+ type: "throw",
132
+ arg: t
133
+ };
134
+ }
135
+ }
136
+ e.wrap = wrap;
137
+ var h = "suspendedStart",
138
+ l = "suspendedYield",
139
+ f = "executing",
140
+ s = "completed",
141
+ y = {};
142
+ function Generator() {}
143
+ function GeneratorFunction() {}
144
+ function GeneratorFunctionPrototype() {}
145
+ var p = {};
146
+ define(p, a, function () {
147
+ return this;
148
+ });
149
+ var d = Object.getPrototypeOf,
150
+ v = d && d(d(values([])));
151
+ v && v !== r && n.call(v, a) && (p = v);
152
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
153
+ function defineIteratorMethods(t) {
154
+ ["next", "throw", "return"].forEach(function (e) {
155
+ define(t, e, function (t) {
156
+ return this._invoke(e, t);
157
+ });
158
+ });
159
+ }
160
+ function AsyncIterator(t, e) {
161
+ function invoke(r, o, i, a) {
162
+ var c = tryCatch(t[r], t, o);
163
+ if ("throw" !== c.type) {
164
+ var u = c.arg,
165
+ h = u.value;
166
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
167
+ invoke("next", t, i, a);
168
+ }, function (t) {
169
+ invoke("throw", t, i, a);
170
+ }) : e.resolve(h).then(function (t) {
171
+ u.value = t, i(u);
172
+ }, function (t) {
173
+ return invoke("throw", t, i, a);
174
+ });
175
+ }
176
+ a(c.arg);
177
+ }
178
+ var r;
179
+ o(this, "_invoke", {
180
+ value: function (t, n) {
181
+ function callInvokeWithMethodAndArg() {
182
+ return new e(function (e, r) {
183
+ invoke(t, n, e, r);
184
+ });
185
+ }
186
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
187
+ }
188
+ });
189
+ }
190
+ function makeInvokeMethod(e, r, n) {
191
+ var o = h;
192
+ return function (i, a) {
193
+ if (o === f) throw Error("Generator is already running");
194
+ if (o === s) {
195
+ if ("throw" === i) throw a;
196
+ return {
197
+ value: t,
198
+ done: !0
199
+ };
200
+ }
201
+ for (n.method = i, n.arg = a;;) {
202
+ var c = n.delegate;
203
+ if (c) {
204
+ var u = maybeInvokeDelegate(c, n);
205
+ if (u) {
206
+ if (u === y) continue;
207
+ return u;
208
+ }
209
+ }
210
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
211
+ if (o === h) throw o = s, n.arg;
212
+ n.dispatchException(n.arg);
213
+ } else "return" === n.method && n.abrupt("return", n.arg);
214
+ o = f;
215
+ var p = tryCatch(e, r, n);
216
+ if ("normal" === p.type) {
217
+ if (o = n.done ? s : l, p.arg === y) continue;
218
+ return {
219
+ value: p.arg,
220
+ done: n.done
221
+ };
222
+ }
223
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
224
+ }
225
+ };
226
+ }
227
+ function maybeInvokeDelegate(e, r) {
228
+ var n = r.method,
229
+ o = e.iterator[n];
230
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
231
+ var i = tryCatch(o, e.iterator, r.arg);
232
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
233
+ var a = i.arg;
234
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
235
+ }
236
+ function pushTryEntry(t) {
237
+ var e = {
238
+ tryLoc: t[0]
239
+ };
240
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
241
+ }
242
+ function resetTryEntry(t) {
243
+ var e = t.completion || {};
244
+ e.type = "normal", delete e.arg, t.completion = e;
245
+ }
246
+ function Context(t) {
247
+ this.tryEntries = [{
248
+ tryLoc: "root"
249
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
250
+ }
251
+ function values(e) {
252
+ if (e || "" === e) {
253
+ var r = e[a];
254
+ if (r) return r.call(e);
255
+ if ("function" == typeof e.next) return e;
256
+ if (!isNaN(e.length)) {
257
+ var o = -1,
258
+ i = function next() {
259
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
260
+ return next.value = t, next.done = !0, next;
261
+ };
262
+ return i.next = i;
263
+ }
264
+ }
265
+ throw new TypeError(typeof e + " is not iterable");
266
+ }
267
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
268
+ value: GeneratorFunctionPrototype,
269
+ configurable: !0
270
+ }), o(GeneratorFunctionPrototype, "constructor", {
271
+ value: GeneratorFunction,
272
+ configurable: !0
273
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
274
+ var e = "function" == typeof t && t.constructor;
275
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
276
+ }, e.mark = function (t) {
277
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
278
+ }, e.awrap = function (t) {
279
+ return {
280
+ __await: t
281
+ };
282
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
283
+ return this;
284
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
285
+ void 0 === i && (i = Promise);
286
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
287
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
288
+ return t.done ? t.value : a.next();
289
+ });
290
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
291
+ return this;
292
+ }), define(g, "toString", function () {
293
+ return "[object Generator]";
294
+ }), e.keys = function (t) {
295
+ var e = Object(t),
296
+ r = [];
297
+ for (var n in e) r.push(n);
298
+ return r.reverse(), function next() {
299
+ for (; r.length;) {
300
+ var t = r.pop();
301
+ if (t in e) return next.value = t, next.done = !1, next;
302
+ }
303
+ return next.done = !0, next;
304
+ };
305
+ }, e.values = values, Context.prototype = {
306
+ constructor: Context,
307
+ reset: function (e) {
308
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
309
+ },
310
+ stop: function () {
311
+ this.done = !0;
312
+ var t = this.tryEntries[0].completion;
313
+ if ("throw" === t.type) throw t.arg;
314
+ return this.rval;
315
+ },
316
+ dispatchException: function (e) {
317
+ if (this.done) throw e;
318
+ var r = this;
319
+ function handle(n, o) {
320
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
321
+ }
322
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
323
+ var i = this.tryEntries[o],
324
+ a = i.completion;
325
+ if ("root" === i.tryLoc) return handle("end");
326
+ if (i.tryLoc <= this.prev) {
327
+ var c = n.call(i, "catchLoc"),
328
+ u = n.call(i, "finallyLoc");
329
+ if (c && u) {
330
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
331
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
332
+ } else if (c) {
333
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
334
+ } else {
335
+ if (!u) throw Error("try statement without catch or finally");
336
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
337
+ }
338
+ }
339
+ }
340
+ },
341
+ abrupt: function (t, e) {
342
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
343
+ var o = this.tryEntries[r];
344
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
345
+ var i = o;
346
+ break;
347
+ }
348
+ }
349
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
350
+ var a = i ? i.completion : {};
351
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
352
+ },
353
+ complete: function (t, e) {
354
+ if ("throw" === t.type) throw t.arg;
355
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
356
+ },
357
+ finish: function (t) {
358
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
359
+ var r = this.tryEntries[e];
360
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
361
+ }
362
+ },
363
+ catch: function (t) {
364
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
365
+ var r = this.tryEntries[e];
366
+ if (r.tryLoc === t) {
367
+ var n = r.completion;
368
+ if ("throw" === n.type) {
369
+ var o = n.arg;
370
+ resetTryEntry(r);
371
+ }
372
+ return o;
373
+ }
374
+ }
375
+ throw Error("illegal catch attempt");
376
+ },
377
+ delegateYield: function (e, r, n) {
378
+ return this.delegate = {
379
+ iterator: values(e),
380
+ resultName: r,
381
+ nextLoc: n
382
+ }, "next" === this.method && (this.arg = t), y;
383
+ }
384
+ }, e;
385
+ }
386
+ function _slicedToArray(r, e) {
387
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
388
+ }
389
+ function _toConsumableArray(r) {
390
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
391
+ }
392
+ function _unsupportedIterableToArray(r, a) {
393
+ if (r) {
394
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
395
+ var t = {}.toString.call(r).slice(8, -1);
396
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
397
+ }
398
+ }
399
+
13
400
  var NodeType;
14
401
  (function (NodeType) {
15
402
  NodeType[NodeType["Document"] = 0] = "Document";
@@ -4603,11 +4990,11 @@ class BinaryReconstructor {
4603
4990
  }
4604
4991
 
4605
4992
  var parser = /*#__PURE__*/Object.freeze({
4606
- __proto__: null,
4607
- protocol: protocol,
4608
- get PacketType () { return PacketType; },
4609
- Encoder: Encoder,
4610
- Decoder: Decoder
4993
+ __proto__: null,
4994
+ protocol: protocol,
4995
+ get PacketType () { return PacketType; },
4996
+ Encoder: Encoder,
4997
+ Decoder: Decoder
4611
4998
  });
4612
4999
 
4613
5000
  function on(obj, ev, fn) {
@@ -5968,75 +6355,121 @@ Object.assign(lookup, {
5968
6355
  connect: lookup,
5969
6356
  });
5970
6357
 
5971
- const socket = lookup('http://localhost:8000');
6358
+ var socket = lookup('http://localhost:8000');
5972
6359
 
5973
- const CoreOutline = ({
5974
- children,
5975
- data_source_id,
5976
- data_source_secret
5977
- }) => {
5978
- const [events, setEvents] = React.useState([]);
5979
- const [replayEvents, setReplayEvents] = React.useState([]);
5980
- const recorderActive = React.useRef(false);
5981
- const [currentPage, setCurrentPage] = React.useState(window.location.href);
5982
- const [location, setLocation] = React.useState({
5983
- latitude: null,
5984
- longitude: null
5985
- });
5986
- const [browser, setBrowser] = React.useState(getBrowserInfo());
5987
- const [appToken, setAppToken] = React.useState('');
5988
- const [sessionId, setSessionId] = React.useState('');
5989
- async function authorizeApp(data_source_id, data_source_secret) {
5990
- const requestOptions = {
5991
- method: 'POST',
5992
- headers: {
5993
- 'Content-Type': 'application/json'
5994
- },
5995
- body: JSON.stringify({
5996
- data_source_id: data_source_id,
5997
- data_source_secret: data_source_secret
5998
- })
5999
- };
6000
- const response = fetch(`http://localhost:4000/data-source/authorize`, requestOptions).then(response => response.json()).then(data => {
6001
- setAppToken(data.app_token);
6002
- return data;
6003
- }).catch(error => {
6004
- console.error('Error:', error);
6005
- return error;
6006
- });
6007
- return response;
6360
+ var CoreOutline = function CoreOutline(_ref) {
6361
+ var children = _ref.children,
6362
+ data_source_id = _ref.data_source_id,
6363
+ data_source_secret = _ref.data_source_secret;
6364
+ var _useState = React.useState([]),
6365
+ _useState2 = _slicedToArray(_useState, 2),
6366
+ events = _useState2[0],
6367
+ setEvents = _useState2[1];
6368
+ var _useState3 = React.useState([]),
6369
+ _useState4 = _slicedToArray(_useState3, 2),
6370
+ replayEvents = _useState4[0],
6371
+ setReplayEvents = _useState4[1];
6372
+ var recorderActive = React.useRef(false);
6373
+ var _useState5 = React.useState(window.location.href),
6374
+ _useState6 = _slicedToArray(_useState5, 2),
6375
+ currentPage = _useState6[0],
6376
+ setCurrentPage = _useState6[1];
6377
+ var _useState7 = React.useState({
6378
+ latitude: null,
6379
+ longitude: null
6380
+ }),
6381
+ _useState8 = _slicedToArray(_useState7, 2),
6382
+ location = _useState8[0],
6383
+ setLocation = _useState8[1];
6384
+ var _useState9 = React.useState(getBrowserInfo()),
6385
+ _useState10 = _slicedToArray(_useState9, 2),
6386
+ browser = _useState10[0];
6387
+ _useState10[1];
6388
+ var _useState11 = React.useState(""),
6389
+ _useState12 = _slicedToArray(_useState11, 2);
6390
+ _useState12[0];
6391
+ var setAppToken = _useState12[1];
6392
+ var _useState13 = React.useState(uuid.v4()),
6393
+ _useState14 = _slicedToArray(_useState13, 2),
6394
+ sessionId = _useState14[0];
6395
+ _useState14[1];
6396
+ function authorizeApp(_x, _x2) {
6397
+ return _authorizeApp.apply(this, arguments);
6008
6398
  }
6009
- React.useEffect(async () => {
6010
- await authorizeApp(data_source_id, data_source_secret);
6011
- setSessionId(uuid.v4());
6012
- localStorage.setItem('coreOutlineSessionId', sessionId);
6013
- localStorage.setItem('coreOutlineDataSourceIdId', data_source_id);
6014
- console.log('Session', sessionId);
6015
- socket.send({
6016
- topic: 'session-data',
6017
- data_source_id: data_source_id,
6018
- session_id: sessionId,
6019
- start_date: new Date().toLocaleString(),
6020
- latitude: location.latitude,
6021
- longitude: location.longitude,
6022
- browser: browser,
6023
- event_id: 'SESSION_START'
6024
- });
6025
- return () => {
6026
- socket.send({
6027
- topic: 'session-data',
6028
- data_source_id: data_source_id,
6029
- session_id: sessionId,
6030
- start_date: new Date().toLocaleString(),
6031
- latitude: location.latitude,
6032
- longitude: location.longitude,
6033
- browser: browser,
6034
- event_id: 'SESSION_END'
6035
- });
6036
- };
6037
- }, []);
6038
- React.useEffect(() => {
6039
- const navigationEvent = {
6399
+ function _authorizeApp() {
6400
+ _authorizeApp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data_source_id, data_source_secret) {
6401
+ var requestOptions, response;
6402
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
6403
+ while (1) switch (_context2.prev = _context2.next) {
6404
+ case 0:
6405
+ requestOptions = {
6406
+ method: "POST",
6407
+ headers: {
6408
+ "Content-Type": "application/json"
6409
+ },
6410
+ body: JSON.stringify({
6411
+ data_source_id: data_source_id,
6412
+ data_source_secret: data_source_secret
6413
+ })
6414
+ };
6415
+ response = fetch("http://localhost:4000/data-source/authorize", requestOptions).then(function (response) {
6416
+ return response.json();
6417
+ }).then(function (data) {
6418
+ setAppToken(data.app_token);
6419
+ return data;
6420
+ })["catch"](function (error) {
6421
+ console.error("Error:", error);
6422
+ return error;
6423
+ });
6424
+ return _context2.abrupt("return", response);
6425
+ case 3:
6426
+ case "end":
6427
+ return _context2.stop();
6428
+ }
6429
+ }, _callee2);
6430
+ }));
6431
+ return _authorizeApp.apply(this, arguments);
6432
+ }
6433
+ React.useEffect(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
6434
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
6435
+ while (1) switch (_context.prev = _context.next) {
6436
+ case 0:
6437
+ _context.next = 2;
6438
+ return authorizeApp(data_source_id, data_source_secret);
6439
+ case 2:
6440
+ localStorage.setItem("coreOutlineSessionId", sessionId);
6441
+ localStorage.setItem("coreOutlineDataSourceIdId", data_source_id);
6442
+ console.log("Session", sessionId);
6443
+ socket.send({
6444
+ topic: "session-data",
6445
+ data_source_id: data_source_id,
6446
+ session_id: localStorage.getItem("coreOutlineSessionId"),
6447
+ start_date: new Date().toLocaleString(),
6448
+ latitude: location.latitude,
6449
+ longitude: location.longitude,
6450
+ browser: browser,
6451
+ event_id: "SESSION_START"
6452
+ });
6453
+ return _context.abrupt("return", function () {
6454
+ socket.send({
6455
+ topic: "session-data",
6456
+ data_source_id: data_source_id,
6457
+ session_id: localStorage.getItem("coreOutlineSessionId"),
6458
+ start_date: new Date().toLocaleString(),
6459
+ latitude: location.latitude,
6460
+ longitude: location.longitude,
6461
+ browser: browser,
6462
+ event_id: "SESSION_END"
6463
+ });
6464
+ });
6465
+ case 7:
6466
+ case "end":
6467
+ return _context.stop();
6468
+ }
6469
+ }, _callee);
6470
+ })), []);
6471
+ React.useEffect(function () {
6472
+ var navigationEvent = {
6040
6473
  type: 4,
6041
6474
  data: {
6042
6475
  href: window.location.href,
@@ -6045,65 +6478,72 @@ const CoreOutline = ({
6045
6478
  },
6046
6479
  timestamp: Date.now()
6047
6480
  };
6048
- const startTime = performance.now();
6049
- const observer = new MutationObserver(() => {
6050
- const endTime = performance.now();
6051
- const loadTime = endTime - startTime;
6481
+ var startTime = performance.now();
6482
+ var observer = new MutationObserver(function () {
6483
+ var endTime = performance.now();
6484
+ var loadTime = endTime - startTime;
6052
6485
  navigationEvent.data.loadTime = loadTime;
6053
- const hours = Math.floor(loadTime / 3600000);
6054
- const minutes = Math.floor(loadTime % 3600000 / 60000);
6055
- const seconds = Math.floor(loadTime % 60000 / 1000);
6056
- navigationEvent.data.loadTimeFormatted = `${hours} hours ${minutes} minutes ${seconds} seconds`;
6486
+ var hours = Math.floor(loadTime / 3600000);
6487
+ var minutes = Math.floor(loadTime % 3600000 / 60000);
6488
+ var seconds = Math.floor(loadTime % 60000 / 1000);
6489
+ navigationEvent.data.loadTimeFormatted = "".concat(hours, " hours ").concat(minutes, " minutes ").concat(seconds, " seconds");
6057
6490
  observer.disconnect();
6058
6491
  });
6059
6492
  observer.observe(document, {
6060
6493
  childList: true,
6061
6494
  subtree: true
6062
6495
  });
6063
- setEvents(prevEvents => [...prevEvents, navigationEvent]);
6064
- const handleNavigation = () => {
6496
+ setEvents(function (prevEvents) {
6497
+ return [].concat(_toConsumableArray(prevEvents), [navigationEvent]);
6498
+ });
6499
+ var handleNavigation = function handleNavigation() {
6065
6500
  setCurrentPage(window.location.href);
6066
6501
  socket.send({
6067
- topic: 'session-data',
6502
+ topic: "session-data",
6068
6503
  data_source_id: data_source_id,
6069
- session_id: sessionId,
6504
+ session_id: localStorage.getItem("coreOutlineSessionId"),
6070
6505
  start_date: new Date().toLocaleString(),
6071
6506
  latitude: location.latitude,
6072
6507
  longitude: location.longitude,
6073
6508
  browser: browser,
6074
6509
  page_name: window.location.href,
6075
- event_id: 'PAGE_NAVIGATION'
6510
+ event_id: "PAGE_NAVIGATION"
6076
6511
  });
6077
6512
  saveEvents(events);
6078
6513
  };
6079
- window.addEventListener('popstate', handleNavigation);
6080
- const originalPushState = window.history.pushState;
6081
- window.history.pushState = function (...args) {
6514
+ window.addEventListener("popstate", handleNavigation);
6515
+ var originalPushState = window.history.pushState;
6516
+ window.history.pushState = function () {
6517
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
6518
+ args[_key] = arguments[_key];
6519
+ }
6082
6520
  originalPushState.apply(this, args);
6083
6521
  handleNavigation();
6084
6522
  };
6085
- return () => {
6086
- window.removeEventListener('popstate', handleNavigation);
6523
+ return function () {
6524
+ window.removeEventListener("popstate", handleNavigation);
6087
6525
  window.history.pushState = originalPushState;
6088
6526
  };
6089
6527
  }, [currentPage]);
6090
- React.useEffect(() => {
6091
- console.log('Location', location);
6528
+ React.useEffect(function () {
6529
+ console.log("Location", location);
6092
6530
  getLocation();
6093
6531
  }, []);
6094
- React.useEffect(() => {
6095
- let stopFn;
6532
+ React.useEffect(function () {
6533
+ var stopFn;
6096
6534
  if (!recorderActive.current) {
6097
6535
  stopFn = record({
6098
- emit(event) {
6099
- setReplayEvents(prevEvents => [...prevEvents, event]);
6536
+ emit: function emit(event) {
6537
+ setReplayEvents(function (prevEvents) {
6538
+ return [].concat(_toConsumableArray(prevEvents), [event]);
6539
+ });
6100
6540
  },
6101
6541
  maskAllInputs: false,
6102
6542
  maskTextSelector: null
6103
6543
  });
6104
6544
  recorderActive.current = true;
6105
6545
  }
6106
- return () => {
6546
+ return function () {
6107
6547
  if (stopFn) {
6108
6548
  stopFn();
6109
6549
  saveEvents(events);
@@ -6111,12 +6551,12 @@ const CoreOutline = ({
6111
6551
  }
6112
6552
  };
6113
6553
  }, []);
6114
- React.useEffect(() => {
6115
- let stopFn;
6554
+ React.useEffect(function () {
6555
+ var stopFn;
6116
6556
  if (!recorderActive.current) {
6117
6557
  stopFn = record({
6118
- emit(event) {
6119
- console.log('Event:', event);
6558
+ emit: function emit(event) {
6559
+ console.log("Event:", event);
6120
6560
  if (event.type == 3 && event.data.type == 2) {
6121
6561
  return;
6122
6562
  }
@@ -6130,16 +6570,18 @@ const CoreOutline = ({
6130
6570
  return;
6131
6571
  }
6132
6572
  if (event.type == 3 && event.data.type == 3) {
6133
- console.log('Contextmenu Event:', event);
6573
+ console.log("Contextmenu Event:", event);
6134
6574
  }
6135
- setEvents(prevEvents => [...prevEvents, event]);
6575
+ setEvents(function (prevEvents) {
6576
+ return [].concat(_toConsumableArray(prevEvents), [event]);
6577
+ });
6136
6578
  },
6137
6579
  maskAllInputs: false,
6138
6580
  maskTextSelector: null
6139
6581
  });
6140
6582
  recorderActive.current = true;
6141
6583
  }
6142
- return () => {
6584
+ return function () {
6143
6585
  if (stopFn) {
6144
6586
  stopFn();
6145
6587
  saveEvents(events);
@@ -6147,10 +6589,10 @@ const CoreOutline = ({
6147
6589
  }
6148
6590
  };
6149
6591
  }, []);
6150
- React.useEffect(() => {
6151
- const handleClick = event => {
6152
- console.log('Inner text:', event.target.innerText);
6153
- const clickEvent = {
6592
+ React.useEffect(function () {
6593
+ var handleClick = function handleClick(event) {
6594
+ console.log("Inner text:", event.target.innerText);
6595
+ var clickEvent = {
6154
6596
  type: EventType.IncrementalSnapshot,
6155
6597
  data: {
6156
6598
  source: IncrementalSource.MouseInteraction,
@@ -6161,139 +6603,144 @@ const CoreOutline = ({
6161
6603
  },
6162
6604
  timestamp: Date.now()
6163
6605
  };
6164
- const clickedElement = document.elementFromPoint(clickEvent.data.x, clickEvent.data.y);
6606
+ var clickedElement = document.elementFromPoint(clickEvent.data.x, clickEvent.data.y);
6165
6607
  if (clickedElement) {
6166
6608
  clickEvent.data.metadata = {
6167
- label: clickedElement.getAttribute('data-label') || clickedElement.innerText || null,
6168
- value: clickedElement.getAttribute('value') || clickedElement.innerText || null,
6169
- id: clickedElement.getAttribute('id') || clickedElement.innerText || null,
6170
- name: clickedElement.getAttribute('name') || clickedElement.innerText || null,
6171
- class: clickedElement.getAttribute('class') || clickedElement.innerText || null,
6609
+ label: clickedElement.getAttribute("data-label") || clickedElement.innerText || null,
6610
+ value: clickedElement.getAttribute("value") || clickedElement.innerText || null,
6611
+ id: clickedElement.getAttribute("id") || clickedElement.innerText || null,
6612
+ name: clickedElement.getAttribute("name") || clickedElement.innerText || null,
6613
+ "class": clickedElement.getAttribute("class") || clickedElement.innerText || null,
6172
6614
  tag: clickedElement.tagName,
6173
6615
  html: String(clickedElement.getHTML()),
6174
6616
  innerText: event.target.innerText
6175
6617
  };
6176
6618
  }
6177
- setEvents(prevEvents => [...prevEvents, clickEvent]);
6619
+ setEvents(function (prevEvents) {
6620
+ return [].concat(_toConsumableArray(prevEvents), [clickEvent]);
6621
+ });
6178
6622
  socket.send({
6179
- topic: 'session-data',
6623
+ topic: "session-data",
6180
6624
  data_source_id: data_source_id,
6181
- session_id: sessionId,
6625
+ session_id: localStorage.getItem("coreOutlineSessionId"),
6182
6626
  start_date: new Date().toLocaleString(),
6183
6627
  latitude: location.latitude,
6184
6628
  longitude: location.longitude,
6185
6629
  browser: browser,
6186
- event_id: 'ITEM_CLICKED'
6630
+ event_id: "ITEM_CLICKED"
6187
6631
  // item_clicked: event.target,
6188
6632
  });
6189
6633
  };
6190
- document.addEventListener('click', handleClick);
6191
- return () => {
6192
- document.removeEventListener('click', handleClick);
6634
+ document.addEventListener("click", handleClick);
6635
+ return function () {
6636
+ document.removeEventListener("click", handleClick);
6193
6637
  };
6194
6638
  }, []);
6195
6639
  function saveEvents(events) {
6196
- const requestOptions = {
6197
- method: 'PUT',
6640
+ var requestOptions = {
6641
+ method: "PUT",
6198
6642
  headers: {
6199
- 'Content-Type': 'application/json'
6643
+ "Content-Type": "application/json"
6200
6644
  },
6201
6645
  body: JSON.stringify(events)
6202
6646
  };
6203
- fetch(`http://localhost:5000/generate-s3-url/${data_source_id}/${sessionId}`).then(response => response.json()).then(data => {
6204
- const uploadURL = data.signed_url;
6647
+ fetch("http://localhost:5000/generate-s3-url/".concat(data_source_id, "/").concat(sessionId)).then(function (response) {
6648
+ return response.json();
6649
+ }).then(function (data) {
6650
+ var uploadURL = data.signed_url;
6205
6651
  return fetch(uploadURL, requestOptions);
6206
6652
  });
6207
6653
  }
6208
- function saveEventsLocally(type = 'formatted' ) {
6209
- let blob = '';
6210
- if (type === 'formatted') {
6654
+ function saveEventsLocally() {
6655
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "formatted" ;
6656
+ var blob = "";
6657
+ if (type === "formatted") {
6211
6658
  blob = new Blob([JSON.stringify(events, null, 2)], {
6212
- type: 'application/json'
6659
+ type: "application/json"
6213
6660
  });
6214
- } else if (type === 'raw') {
6661
+ } else if (type === "raw") {
6215
6662
  blob = new Blob([JSON.stringify(replayEvents, null, 2)], {
6216
- type: 'application/json'
6663
+ type: "application/json"
6217
6664
  });
6218
6665
  }
6219
- const url = URL.createObjectURL(blob);
6220
- const a = document.createElement('a');
6666
+ var url = URL.createObjectURL(blob);
6667
+ var a = document.createElement("a");
6221
6668
  a.href = url;
6222
- a.download = `${type}_events.json`;
6669
+ a.download = "".concat(type, "_events.json");
6223
6670
  a.click();
6224
6671
  URL.revokeObjectURL(url);
6225
6672
  }
6226
6673
  function getBrowserInfo() {
6227
- const userAgent = navigator.userAgent;
6228
- let browserName = 'Unknown';
6229
- if (userAgent.indexOf('Firefox') > -1) {
6230
- browserName = 'Firefox';
6231
- } else if (userAgent.indexOf('Opera') > -1 || userAgent.indexOf('OPR') > -1) {
6232
- browserName = 'Opera';
6233
- } else if (userAgent.indexOf('Chrome') > -1) {
6234
- browserName = 'Chrome';
6235
- } else if (userAgent.indexOf('Safari') > -1) {
6236
- browserName = 'Safari';
6237
- } else if (userAgent.indexOf('MSIE') > -1 || userAgent.indexOf('Trident/') > -1) {
6238
- browserName = 'Internet Explorer';
6674
+ var userAgent = navigator.userAgent;
6675
+ var browserName = "Unknown";
6676
+ if (userAgent.indexOf("Firefox") > -1) {
6677
+ browserName = "Firefox";
6678
+ } else if (userAgent.indexOf("Opera") > -1 || userAgent.indexOf("OPR") > -1) {
6679
+ browserName = "Opera";
6680
+ } else if (userAgent.indexOf("Chrome") > -1) {
6681
+ browserName = "Chrome";
6682
+ } else if (userAgent.indexOf("Safari") > -1) {
6683
+ browserName = "Safari";
6684
+ } else if (userAgent.indexOf("MSIE") > -1 || userAgent.indexOf("Trident/") > -1) {
6685
+ browserName = "Internet Explorer";
6239
6686
  }
6240
6687
  return browserName;
6241
6688
  }
6242
6689
  function getLocation() {
6243
6690
  if (navigator.geolocation) {
6244
- navigator.geolocation.getCurrentPosition(position => {
6691
+ navigator.geolocation.getCurrentPosition(function (position) {
6245
6692
  setLocation({
6246
6693
  latitude: position.coords.latitude,
6247
6694
  longitude: position.coords.longitude
6248
6695
  });
6249
- }, error => {
6250
- console.error('Error getting location:', error);
6696
+ }, function (error) {
6697
+ console.error("Error getting location:", error);
6251
6698
  });
6252
6699
  } else {
6253
- console.error('Geolocation is not supported by this browser.');
6700
+ console.error("Geolocation is not supported by this browser.");
6254
6701
  }
6255
6702
  }
6256
6703
  return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("button", {
6257
- onClick: () => {
6258
- saveEventsLocally('formatted');
6259
- saveEventsLocally('raw');
6704
+ onClick: function onClick() {
6705
+ saveEventsLocally("formatted");
6706
+ saveEventsLocally("raw");
6260
6707
  }
6261
6708
  }, "Save Events Locally"), children);
6262
6709
  };
6263
- const flag_item_clicked = item_id => {
6264
- const sessionId = localStorage.getItem('coreOutlineSessionId');
6265
- const dataSourceId = localStorage.getItem('coreOutlineDataSourceIdId');
6266
- console.log('Session', sessionId);
6267
- console.log('Data Source', dataSourceId);
6710
+ var flag_item_clicked = function flag_item_clicked(item_id) {
6711
+ var sessionId = localStorage.getItem("coreOutlineSessionId");
6712
+ var dataSourceId = localStorage.getItem("coreOutlineDataSourceIdId");
6713
+ console.log("Session", sessionId);
6714
+ console.log("Data Source", dataSourceId);
6268
6715
  socket.send({
6269
- topic: 'session-data',
6716
+ topic: "session-data",
6270
6717
  data_source_id: dataSourceId,
6271
- session_id: sessionId,
6718
+ session_id: localStorage.getItem("coreOutlineSessionId"),
6272
6719
  start_date: new Date().toLocaleString(),
6273
- event_id: 'PRODUCT_CLICKED',
6720
+ event_id: "PRODUCT_CLICKED",
6274
6721
  item_clicked: item_id
6275
6722
  });
6276
6723
  return {
6277
- status: 'success',
6278
- message: 'Item click flagged successfully.'
6724
+ status: "success",
6725
+ message: "Item click flagged successfully."
6279
6726
  };
6280
6727
  };
6281
- const flag_item_purchased = item_id => {
6282
- const sessionId = localStorage.getItem('coreOutlineSessionId');
6283
- const dataSourceId = localStorage.getItem('coreOutlineDataSourceIdId');
6284
- console.log('Session', sessionId);
6285
- console.log('Data Source', dataSourceId);
6728
+ var flag_item_purchased = function flag_item_purchased(item_id) {
6729
+ var sessionId = localStorage.getItem("coreOutlineSessionId");
6730
+ var dataSourceId = localStorage.getItem("coreOutlineDataSourceIdId");
6731
+ console.log("Session", sessionId);
6732
+ console.log("Data Source", dataSourceId);
6286
6733
  socket.send({
6287
- topic: 'session-data',
6734
+ topic: "session-data",
6288
6735
  data_source_id: dataSourceId,
6289
- session_id: sessionId,
6736
+ session_id: localStorage.getItem("coreOutlineSessionId"),
6290
6737
  start_date: new Date().toLocaleString(),
6291
- event_id: 'PRODUCT_PURCHASED',
6738
+ event_id: "PRODUCT_PURCHASED",
6292
6739
  item_clicked: item_id
6293
6740
  });
6294
6741
  return {
6295
- status: 'success',
6296
- message: 'Item purchase flagged successfully.'
6742
+ status: "success",
6743
+ message: "Item purchase flagged successfully."
6297
6744
  };
6298
6745
  };
6299
6746