releasebird-javascript-sdk 1.0.26 → 1.0.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.
@@ -171,6 +171,7 @@ export default class RbirdSessionManager {
171
171
  let response = JSON.parse(http.responseText);
172
172
  if (response.valid) {
173
173
  state.identify.people = response.peopleId;
174
+ state.identify.company = response.companyId;
174
175
  if (hash) {
175
176
  state.identify.hash = hash;
176
177
  }
@@ -0,0 +1,30 @@
1
+ export class ReleasebirdConsoleLogger {
2
+ constructor() {
3
+ // Originales console.log speichern, damit wir es später wiederverwenden können
4
+ this.originalConsoleLog = console.log;
5
+
6
+ // console.log überschreiben
7
+ console.log = (...args) => {
8
+ // Jedes console.log an die Methode printLog übergeben
9
+ this.printLog(...args);
10
+
11
+ // Originales console.log aufrufen, um sicherzustellen, dass die Logs weiterhin in der Konsole erscheinen
12
+ this.originalConsoleLog(...args);
13
+ };
14
+ }
15
+
16
+ // Methode zum Ausdrucken der Logs
17
+ printLog(...args) {
18
+ //document.body.insertAdjacentHTML('beforeend', `<p>bin im interceptor</p>`);
19
+ // Hier können wir entscheiden, wie die Logs behandelt oder verarbeitet werden
20
+ // Zum Beispiel, alle Logs in einem Array speichern, an einen Server senden, etc.
21
+ // Aktuell drucken wir die Logs nur aus
22
+ const logMessage = args.map(arg => JSON.stringify(arg)).join(' ');
23
+ //document.body.insertAdjacentHTML('beforeend', `<p>hallo ${logMessage}</p>`);
24
+ }
25
+
26
+ // Methode zum Zurücksetzen von console.log auf die ursprüngliche Funktion
27
+ resetConsoleLog() {
28
+ console.log = this.originalConsoleLog;
29
+ }
30
+ }
package/src/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { injectStyledCSS } from "./Styles";
2
2
  import RbirdSessionManager from "./RbirdSessionManager";
3
3
  import RbirdWebsiteWidget from "./RbirdWebsiteWidget";
4
+ import { ReleasebirdConsoleLogger } from "./ReleasebirdConsoleLogger";
4
5
 
5
6
  class Rbird {
6
7
 
@@ -35,6 +36,11 @@ class Rbird {
35
36
  static getInstance() {
36
37
  if (!this.instance) {
37
38
  this.instance = new Rbird();
39
+ // Instanz der Klasse erstellen, um alle console.logs abzufangen
40
+ const logger = new ReleasebirdConsoleLogger();
41
+ // Beispiel-Logs zum Testen
42
+ // console.log("Hello, world!");
43
+ // console.log("This is a test log", { key: "value" }, 123);
38
44
  return this.instance;
39
45
  } else {
40
46
  return this.instance;
@@ -86,14 +92,6 @@ class Rbird {
86
92
  }
87
93
  }
88
94
 
89
- static trackEvent(name, data) {
90
- try {
91
- RbirdSessionManager.getInstance().trackEvent(name, data);
92
- } catch (e) {
93
- console.error(e);
94
- }
95
- }
96
-
97
95
  static identify(identify, hash) {
98
96
  try {
99
97
  RbirdSessionManager.getInstance().identifyUser(identify, hash);