@xylabs/sdk-react 2.7.26 → 2.8.4

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.
@@ -1,21 +1,20 @@
1
+ import { delay } from '@xylabs/sdk-js'
2
+
1
3
  import { global } from '../../global'
2
4
 
3
5
  class SnapTr {
4
- static pixelId?: string
5
-
6
6
  public static getSnapTr() {
7
- return global.snaptr
7
+ if (global.snaptr) {
8
+ return global.snaptr
9
+ }
10
+ console.warn('Missing snaptr')
8
11
  }
9
12
 
10
13
  public static instance: SnapTr
11
- public static init(pixelId: string) {
12
- this.pixelId = pixelId
13
- this.track('PAGE_VIEW')
14
- }
15
14
 
16
- public static track<T>(event: string, data?: T) {
17
- this.getSnapTr()('init', this.pixelId)
15
+ public static async track<T>(event: string, data?: T) {
18
16
  this.getSnapTr()('track', event, data)
17
+ await delay(0)
19
18
  }
20
19
  }
21
20
 
@@ -13,7 +13,10 @@ class Ttq {
13
13
  }
14
14
 
15
15
  public static getTtq() {
16
- return global.ttq
16
+ if (global.ttq) {
17
+ return global.ttq
18
+ }
19
+ console.warn('Missing ttq')
17
20
  }
18
21
 
19
22
  public static page() {
Binary file